Example #1
0
 public function beforeAction($action)
 {
     $criteria = new CDbCriteria();
     $criteria->addCondition('status = 1');
     $criteria->addCondition('created_by = ' . Yii::app()->user->getInfo());
     $this->servicesArray = Services::model()->findAll($criteria);
     $arrayForSettings = array();
     $Settings = Settings::model()->findAll();
     foreach ($Settings as $key => $val) {
         $arrayForSettings[$val->setting_name] = $val->setting_value;
     }
     self::$settings = $arrayForSettings;
     $this->pageTitle = Yii::app()->name;
     $this->pageName = 'Account';
     $this->pageClass = 'blue';
     Yii::app()->session['securityCheck'] = md5(ip2long(Yii::app()->request->userHostAddress) + date("Y"));
     /* @var $cs CClientScript */
     $cs = Yii::app()->clientScript;
     // register jQuery script
     $cs->registerPackage('jquery');
     // register bootstrap script
     $cs->registerPackage('bootstrap');
     // If application is using a theme, replace default layout controller variable that start with '//layouts/' with a theme link
     if (empty(Yii::app()->theme->name) == false && isset($this->layout) == true && strpos($this->layout, '//layouts/') === 0) {
         // Replace path with slash by dot.
         $sThemeLayout = 'webroot.themes.' . Yii::app()->theme->name . '.views.layouts.' . str_replace('/', '.', substr($this->layout, 10));
         // If theme override given layout, get it from theme
         if ($this->getLayoutFile($sThemeLayout) !== false) {
             $this->layout = $sThemeLayout;
         }
     }
     return true;
 }