[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/view/admin/ -> adminview.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH.'class/view/view.class.php' );
   4      lt_include( PLOG_CLASS_PATH.'class/template/templateservice.class.php' );
   5      lt_include( PLOG_CLASS_PATH.'class/net/requestgenerator.class.php' );
   6      
   7      /**
   8       * \ingroup View
   9       *
  10       * Extends the View class to add some commont methods and attributes that will be shared
  11       * by all the views of the administrative interface. This is the main basic view that all
  12       * view classes from the admin interface should extend.
  13       * 
  14       * This class has support for loading templates from the templates/admin folder, as well as
  15       * being able to use locales and even to throw events if needed. 
  16       *
  17       * The AdminView::render() method implements some logic of its own so it must be called
  18       * at some point in our custom classes extending AdminView.
  19       *
  20       * As of pLog 1.0, AdminView classes do not have support for cached views.
  21       */
  22      class AdminView extends View 
  23      {
  24          var $_pm;
  25          var $_templateService;
  26          var $_blogInfo;
  27          var $_userInfo;
  28  
  29          /**
  30           * Calls the parent constructor and initializes the template service used
  31           * to fetch the templates
  32           *
  33           * @param blogInfo A valid BlogInfo object
  34           */
  35      	function AdminView( $blogInfo )
  36          {
  37              $this->View();
  38  
  39              $this->_templateService = new TemplateService();
  40  
  41              $this->_blogInfo = $blogInfo;
  42              $this->setValue( 'url', RequestGenerator::getRequestGenerator($blogInfo));
  43              
  44              $blogSettings = $this->_blogInfo->getSettings();
  45              
  46              // initialize the plugin manager, so that we can throw events from views too!
  47              $this->_pm =& PluginManager::getPluginManager();
  48              $this->_pm->setBlogInfo( $this->_blogInfo );            
  49              
  50              // set the character set in the request based on the blog locale
  51              $locale = $this->_blogInfo->getLocale();
  52              $this->setCharset( $locale->getCharset());
  53              $this->addHeaderResponse( 'Cache-Control: no-cache, must-revalidate' );
  54              $this->addHeaderResponse( 'Last-Modified: ' . gmdate( "D, d M Y H:i:s" ) . ' GMT' );
  55              $this->addHeaderResponse( 'Expires: now' );
  56              $this->addHeaderResponse( 'Pragma: no-cache' );
  57          }
  58          
  59          /**
  60           * some views need to know who is executing them... but since it's not mandatory
  61           * for all, we'll have to use AdminView::setUserInfo whenever needed
  62           *
  63           * @param userInfo a UserInfo object with information about the user who is currently
  64           * executing this view
  65           */
  66          function setUserInfo( $userInfo )
  67          {
  68              $this->_userInfo = $userInfo;
  69          }
  70          
  71          /**
  72           * notifies of a throwable event
  73           *
  74           * @param eventType The code of the event we're throwing
  75           * @param params Array with the event parameters
  76           */
  77  		function notifyEvent( $eventType, $params = Array())
  78          {
  79              $params[ 'from' ] = get_class( $this );
  80                                  
  81              return $this->_pm->notifyEvent( $eventType, $params );
  82          }        
  83          
  84          /**
  85           * call the View::render() method.
  86           */
  87  		function render()
  88          {
  89              lt_include( PLOG_CLASS_PATH.'class/template/menu/menu.class.php' );
  90              lt_include( PLOG_CLASS_PATH.'class/template/menu/menurenderer.class.php' );        
  91          
  92              // set a few common parametres...
  93              $config =& Config::getConfig();
  94              $this->setValue( 'baseurl', $config->getValue( 'base_url'));            
  95              $this->setValue( 'version', Version::getVersion());
  96              $this->setValue( 'uploads_enabled', $config->getValue( 'uploads_enabled' ));            
  97              $this->setValue( 'bayesian_filter_enabled', $config->getValue( 'bayesian_filter_enabled' ));            
  98  
  99              //
 100              // stuff to generate the menu on the left
 101              //
 102              $menu =& Menu::getMenu();
 103              // initialize the menu renderer, passing as parameters the original menu structure,
 104              // the current logged in user (so that we can check permissions and so on)
 105              // and the current value of the 'op' parameter so that we can now which option is the
 106              // current active one
 107              $menuRenderer = new MenuRenderer( $menu, $this->_blogInfo, $this->_userInfo );
 108              //$this->setValue( "menus", $menuRenderer->generateAt("Manage"));
 109              
 110              $this->setValue( 'menu', $menuRenderer );
 111  
 112              parent::render();
 113          }
 114      }
 115  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics