Source for file Application_Controller.php

Documentation is available at Application_Controller.php

  1. <?php
  2. /**
  3.  *    LAIKA FRAMEWORK Release Notes:
  4.  *
  5.  *    @filesource     Application_Controller.php
  6.  *
  7.  *    @version        0.1.0b
  8.  *    @package        Laika
  9.  *    @subpackage     core
  10.  *    @category       control
  11.  *    @date           2010-01-18 02:29:45 -0500 (Mon, 18 Jan 2010)
  12.  * 
  13.  *    @author         Leonard M. Witzel <witzel@post.harvard.edu>
  14.  *    @copyright      Copyright (c) 2010 Harvard University <{@link http://lab.dce.harvard.edu}>
  15.  *
  16.  */
  17.  
  18. /**
  19.  * Laika_Application_Controller class.
  20.  * 
  21.  * @extends Laika_Abstract_Controller
  22.  */
  23.  
  24. //-------------------------------------------------------------------
  25. //    VARIABLES
  26. //-------------------------------------------------------------------
  27.     /**
  28.      * instance
  29.      * 
  30.      * @var    object 
  31.      * @access protected
  32.      * @static
  33.      */
  34.     protected static $instance;
  35.  
  36. //-------------------------------------------------------------------
  37. //    METHODS
  38. //-------------------------------------------------------------------
  39.     /**
  40.      * call_target function.
  41.      * 
  42.      * @access public
  43.      * @param  mixed  $command_set 
  44.      * @return void 
  45.      */
  46.     public function call_target($command_set){
  47.  
  48.         $method     array_pop($command_set['COMMANDS']);
  49.         $controller array_pop($command_set['COMMANDS']);
  50.         $parameters $command_set['PARAMETERS'];
  51.         $this->invoke_target($controller,$method,$parameters);
  52.     }
  53.  
  54.     /**
  55.      * invoke_target function.
  56.      * 
  57.      * @access private
  58.      * @param  string  $controller 
  59.      * @param  string  $method 
  60.      * @param  array   $parameters 
  61.      * @return void 
  62.      */
  63.     private function invoke_target($controller,$method$parameters){
  64.         
  65.         $class_name Laika_Data::format_class_name($controller);        
  66.         $page CODE_NAME.'_'.$class_name.'_Controller';        
  67.         $action strtolower($method);
  68.  
  69.         try{
  70.             if($page::$access_level == 'PUBLIC' && !REQUIRE_LOGIN)
  71.                 $page::init()->action_handler($action,$parameters);
  72.             
  73.             elseif($controller != 'login' && !Laika_Access::is_logged_in()) 
  74.                 $this->login_interrupt($controller,$method$parameters);                
  75.             
  76.             else $page::init()->action_handler($action,$parameters)
  77.         }
  78.         catch(Laika_Exception $e){
  79.             if($e->getCode(== 900)
  80.                 self::redirect_to('/error/missing');
  81.         }
  82.     }
  83.     
  84.     /**
  85.      * login_interrupt function.
  86.      * 
  87.      * @access private
  88.      * @return void 
  89.      */
  90.     private function login_interrupt($controller,$method$parameters){
  91.         Laika_Controller::process(new Laika_Command('ROUTER','SET_REDIRECT',array($controller$method$parameters)));
  92.         $this->invoke_target('login','default'NULL);
  93.     }
  94.     
  95. }

Documentation generated on Sat, 19 May 2012 02:16:57 -0400 by phpDocumentor 1.4.4