nfdevil

Untitled

Mar 6th, 2013
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.24 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  * Controller is the customized base controller class.
  5.  * All controller classes for this application should extend from this base class.
  6.  */
  7. class Controller extends CController {
  8.  
  9.     /**
  10.      * @var string the default layout for the controller view. Defaults to '//layouts/column1',
  11.      * meaning using a single column layout. See 'protected/views/layouts/column1.php'.
  12.      */
  13.     public $layout = '//layouts/column1';
  14.  
  15.     /**
  16.      * @var array context menu items. This property will be assigned to {@link CMenu::items}.
  17.      */
  18.     public $menu = array();
  19.  
  20.     /**
  21.      * @var array the breadcrumbs of the current page. The value of this property will
  22.      * be assigned to {@link CBreadcrumbs::links}. Please refer to {@link CBreadcrumbs::links}
  23.      * for more details on how to specify this property.
  24.      */
  25.     public $breadcrumbs = array();
  26.  
  27.     public function init() {
  28.         Yii::app()->name = setting('sitename');
  29.         $this->_updateSession();
  30.         parent::init();
  31.     }
  32.  
  33.     private function _updateSession() {
  34.         session()->currentlocation = Yii::app()->request->requestUri;
  35.         session()->hostname = Yii::app()->request->userHostAddress;
  36.         session()->updateLastActivity();
  37.     }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment