[ Index ]
 

Code source de phpMyVisites 2.3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/include/ -> AdminModule.class.php (source)

   1  <?php
   2  /* 
   3   * phpMyVisites : website statistics and audience measurements
   4   * Copyright (C) 2002 - 2006
   5   * http://www.phpmyvisites.net/ 
   6   * phpMyVisites is free software (license GNU/GPL)
   7   * Authors : phpMyVisites team
   8  */
   9  
  10  // $Id: AdminModule.class.php 133 2006-10-29 14:12:07Z cmil $
  11  
  12  require_once  INCLUDE_PATH."/core/include/DataModel.class.php";
  13  require_once  INCLUDE_PATH."/core/include/Site.class.php";
  14  require_once  INCLUDE_PATH."/core/include/Archive.class.php";
  15  require_once  INCLUDE_PATH."/core/include/PdfConfigDb.class.php";
  16  
  17  class AdminModule extends Module
  18  {
  19      var $partName;
  20      
  21      //the datamodel
  22      var $data;
  23      
  24      /**
  25       * ViewModule constructor
  26       * @param $name string the partName
  27       * @param $o_data object , datas to render
  28       * 
  29       * @return void
  30       */
  31  	function AdminModule($name = "", $o_data = null)
  32      {
  33          define ('THEME', THEME_ADMIN);        
  34      
  35          $this->partName = $name;
  36          $this->data =& $o_data;
  37      
  38          parent::Module();
  39      }
  40      
  41      
  42      /**
  43       * initialize module with request datas
  44       * 
  45       * @param object request
  46       * @return void
  47       */
  48  	function init(&$request)
  49      {
  50          parent::init($request);
  51          $this->tpl->caching = 0;
  52          $this->tpl->mainTemplate = 'admin/structureAdmin.tpl';
  53          
  54          if(isset($this->site))
  55          {
  56              $this->site->generateFiles();
  57          }
  58  
  59          // set mod to view because of specific elements in this case (period_selection.tpl)
  60          $this->tpl->assign('mod', 'admin');
  61  
  62      }
  63  
  64      /**
  65       * Main job method overided in each view plugin
  66       * this method should take care of obtaining and processing datas
  67       * 
  68       * @return void
  69       */
  70  	function process()
  71      {
  72          echo('please override me...');
  73      }
  74      
  75      
  76      /**
  77       * default display method for all views
  78       * 
  79       * @return void
  80       */
  81  	function showAll()
  82      {    
  83          $this->process();        
  84          
  85          $this->display();
  86      }
  87  
  88  	function needASiteAdminSelected()
  89      {
  90          $idSite = $this->request->getAdminSite();
  91          
  92          if( !$idSite )
  93          {
  94              //print("Select a site");
  95              $this->tpl->template = "admin/site_selection.tpl";
  96              
  97              return false;
  98          }
  99          else
 100          {
 101              //print("Site selected");
 102              return $idSite;
 103          }
 104      }
 105      
 106  	function needConfirmation( $type, $idDependOnType)
 107      {    
 108          $confirmed = $this->request->getConfirmedState();
 109          
 110          if($confirmed == 1)
 111          {
 112              return true;
 113          }
 114          else
 115          {
 116              switch($type)
 117              {
 118                  case 'site':
 119                      $o_site = new Site($idDependOnType);
 120                      
 121                      $subStr = sprintf( 
 122                                          $GLOBALS['lang']['generique_siteno'],
 123                                          '<b>"'.$o_site->getName().'"</b>'
 124                                          );
 125                  
 126                  break;
 127                  
 128                  case 'newsletter':
 129                      
 130                      $subStr = sprintf( 
 131                                          $GLOBALS['lang']['generique_newsletterno'],
 132                                          '<b>"'.$this->site->getNewsletterName($idDependOnType ).'"</b>'
 133                                          );
 134                  
 135                  
 136                  break;
 137                  
 138                  case 'partner':
 139                      $subStr = sprintf( 
 140                                          $GLOBALS['lang']['generique_partnerno'],
 141                                          '<b>"'.$this->site->getPartnerNameFromId( $idDependOnType ).'"</b>'
 142                                          );
 143                  break;
 144                  
 145                  case 'user':
 146                      $subStr = sprintf( 
 147                                          $GLOBALS['lang']['generique_user'],
 148                                          '<b>"'. $idDependOnType.'"</b>'
 149                                          );
 150                  break;
 151                      
 152                  case 'pdf':
 153                      $pdfDb = new PdfConfigDb($this->site->id);
 154                      $o_pdf = $pdfDb->getPdf($idDependOnType);
 155                      $subStr = sprintf( 
 156                                          $GLOBALS['lang']['generique_pdfno'],
 157                                          '<b>"'.$o_pdf->pdfName.'"</b>'
 158                                          );
 159                  
 160                  
 161                  break;
 162                  
 163              }
 164              $this->tpl->assign( 'message', 
 165                              sprintf( 
 166                                  $GLOBALS['lang']['admin_deleteconfirm'],
 167                                  $subStr
 168                                      )
 169                                  );
 170              $this->tpl->assign("confirmation", $type); // flag smarty
 171              
 172              $this->tpl->template = "admin/ask_confirmation.tpl";
 173              
 174              return false;
 175          }
 176      }
 177      
 178  	function setMessage(  )
 179      {
 180          $this->tpl->template = "admin/message.tpl";
 181          $this->tpl->assign("message", $GLOBALS['lang']['generique_done']);
 182      }
 183  }
 184  ?>


Généré le : Mon Nov 26 14:10:01 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics