Source for file User_Controller.php

Documentation is available at User_Controller.php

  1. <?php
  2. /**
  3.  *    LAIKA FRAMEWORK Release Notes:
  4.  *
  5.  *    @filesource     User_Controller.php
  6.  *
  7.  *    @version        0.1.0b
  8.  *    @package        Laika
  9.  *    @subpackage     module
  10.  *    @category       control
  11.  *    @date           2012-05-18 22:03:54 -0400 (Fri, 18 May 2012)
  12.  *
  13.  *    @author         Leonard M. Witzel <witzel@post.harvard.edu>
  14.  *    @copyright      Copyright (c) 2012  Laika Soft <{@link http://oafbot.com}>
  15.  *
  16.  */
  17. /**
  18.  * Laika_User_Controller class.
  19.  * 
  20.  * @extends Laika_Abstract_Page_Controller
  21.  */
  22.  
  23.     protected static $instance;
  24.     protected        $parameters;
  25.     public    static $access_level 'PRIVATE';
  26.     public    static $access_group 'USER';
  27.  
  28.     /**
  29.      * display function.
  30.      * 
  31.      * @access public
  32.      * @return void 
  33.      */
  34.     public function display(){
  35.         $args func_get_args();
  36.         ob_start(OB_HANDLER);
  37.         Laika_User_Page::init()->render_page($args);
  38.         ob_end_flush();
  39.     }
  40.     
  41.     /**
  42.      * default_action function.
  43.      * 
  44.      * @access public
  45.      * @return void 
  46.      */
  47.     public function default_action()
  48.         $this->me();
  49.     }
  50.  
  51.     /**
  52.      * action_handler function.
  53.      * 
  54.      * @access public
  55.      * @param mixed $action 
  56.      * @param mixed $parameters 
  57.      * @return void 
  58.      */
  59.     public function action_handler($action,$parameters){    
  60.         $ignore get_class_methods(get_parent_class(get_parent_class($this)));
  61.         $ignore['action_handler';        
  62.         !empty($parameters$this->parameters = $parameters $this->parameters = NULL;
  63.         if($action == 'default')
  64.             $this->default_action();
  65.         else if($action == 'action_handler' in_array($action,$ignore))
  66.             $this->default_action();
  67.         else
  68.             $this->$action();    
  69.     }
  70.         
  71.     /**
  72.      * __call function.
  73.      * 
  74.      * @access public
  75.      * @param mixed $name 
  76.      * @param mixed $arg 
  77.      * @return void 
  78.      */
  79.     public function __call($name,$arg){
  80.         $user Laika_User::find('username',$name);
  81.         $id $user->id();
  82.         if(isset$id ))
  83.             $this->display(array("user"=>$id,"page"=>$user->username));
  84.         else
  85.             $this->display(array("alert"=>"User not found","alert_type"=>"warning"));
  86.     }
  87.     
  88.     /**
  89.      * me function.
  90.      * 
  91.      * @access public
  92.      * @return void 
  93.      */
  94.     public function me(){
  95.         $this->display(array(
  96.             "page"=>Laika_User::active()->username(),
  97.             "user"=>Laika_User::active()->id() ));        
  98.     }
  99.     
  100.     /**
  101.      * directory function.
  102.      * 
  103.      * @access public
  104.      * @return void 
  105.      */
  106.     public function directory(){
  107.         $this->itemize();
  108.     }
  109.     
  110.     /**
  111.      * itemize function.
  112.      * 
  113.      * @access public
  114.      * @return void 
  115.      */
  116.     public function itemize(){
  117.         
  118.         $_SESSION['User_offset']=NULL;
  119.         
  120.         if(!isset($this->parameters['show']))
  121.             $this->parameters['show'20;
  122.         
  123.         switch($this->parameters['show']){
  124.             case 'all':
  125.                 $users Laika_User::paginate();
  126.                 break;
  127.             default:
  128.                 $users Laika_User::paginate($this->parameters['show']);
  129.                 break;
  130.         }        
  131.          
  132.         foreach($users as $k => $user)                            
  133.             foreachLaika_User::accessible(as $k2 => $v 
  134.                 $response[$k][$k2$user->get_property($k2);
  135.         $this->display(array("component"=>"directory","users"=>$response));
  136.     }
  137. }

Documentation generated on Sat, 19 May 2012 02:17:04 -0400 by phpDocumentor 1.4.4