[ 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/controller/ -> blogcontroller.class.php (source)

   1  <?php
   2  
   3      lt_include( PLOG_CLASS_PATH."class/controller/controller.class.php" );
   4      
   5      $_plogBlogController_running = null;
   6  
   7      /**
   8       * \ingroup Controller
   9       *
  10       * Extends the Controller class so that the operation of loading the
  11       * file with the mappings is done automatically. The default action parameter becomes
  12       * "op" and the file class/controller/controllermap.class.php will be used as the default
  13       * action class map.
  14       *
  15       * You will rarely need to use this class in real life, see the main Controller class.
  16        *
  17        * @see Controller
  18       */
  19      class BlogController extends Controller 
  20      {
  21  
  22          /**
  23           * Constructor. Automatically loads the maps
  24           */
  25  		function BlogController()
  26          {
  27              $actionMap = $this->_loadActionMaps();
  28              $defaultActionParam = "op";
  29              
  30              global $_plogBlogController_running;
  31              $_plogBlogController_running = true;            
  32  
  33              $this->Controller( $actionMap, $defaultActionParam );
  34              $this->setActionFolderPath( PLOG_CLASS_PATH."class/action/" );
  35          }
  36          
  37          /**
  38           * If a plugin adds an action
  39           * for the public side and an action for the admin side, the action will be accessible via
  40           * both index.php?op=theActionName and admin.php?op=theActionName. We will use
  41           * use a global variable that is initialized when the constructor of
  42           * this class is called. If that variable is set to 'true', then it means that our constructor
  43           * was initialized and that we can go ahead and add the action. If not, then we skip the whole
  44           * thing and the action is not added.
  45           *
  46           * This method should therefore be called when adding new actions but <b>only for the public side</b>. In
  47           * case of plugins, please use PluginBase::registerBlogAction() and PluginBase::registerAdminAction()
  48           * which will nicely hide all these things from you.
  49           *         
  50           * @param actionKey Action key to add
  51           * @param actionClass Action class to which the class will map
  52           * @see Controller
  53           */        
  54          function registerAction( $actionKey, $actionClass )
  55          {
  56              global $_plogBlogController_running;
  57              
  58              if( $_plogBlogController_running )
  59                  Controller::registerAction( $actionKey, $actionClass );
  60              
  61              return true;
  62          }        
  63  
  64          /**
  65           * Loads the maps
  66           *
  67           * @private
  68           */
  69          function _loadActionMaps()
  70          {
  71                  // Note: this is an acceptable use of include()
  72              include ( PLOG_CLASS_PATH."class/controller/controllermap.properties.php" );
  73  
  74              return $actions;
  75          }
  76      }
  77  ?>


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