Пример #1
0
 protected function afterConstruct()
 {
     $this->gs_list = Gs::model()->getOpenServers();
     if (count($this->gs_list) == 1) {
         $this->gs_id = key($this->gs_list);
     }
     parent::afterConstruct();
 }
Пример #2
0
 /**
  * (non-PHPdoc)
  * @see yii/base/CModel#afterConstruct()
  */
 protected function afterConstruct()
 {
     $this->forceSSL = Yii::app()->settings->get(Setting::FORCE_SSL);
     $this->recentEntryWidgetEnabled = Yii::app()->settings->get(Setting::RECENT_ENTRIES_WIDGET_ENABLED);
     $this->recentEntryWidgetCount = Yii::app()->settings->get(Setting::RECENT_ENTRIES_WIDGET_COUNT);
     $this->mostViewedEntriesWidgetEnabled = Yii::app()->settings->get(Setting::MOST_VIEWED_ENTRIES_WIDGET_ENABLED);
     $this->mostViewedEntriesWidgetCount = Yii::app()->settings->get(Setting::MOST_VIEWED_ENTRIES_WIDGET_COUNT);
     return parent::afterConstruct();
 }
Пример #3
0
 public function afterConstruct()
 {
     $dependency = new CDbCacheDependency("SELECT COUNT(0), MAX(UNIX_TIMESTAMP(updated_at)) FROM {{gs}} WHERE status = :status");
     $dependency->params = array('status' => ActiveRecord::STATUS_ON);
     $dependency->reuseDependentData = TRUE;
     $res = Gs::model()->cache(3600 * 24, $dependency)->opened()->findAll();
     if ($res) {
         foreach ($res as $gs) {
             $this->gs_list[$gs['id']] = $gs;
         }
     }
     unset($res);
     if (count($this->gs_list) == 1) {
         $this->gs_id = key($this->gs_list);
     }
     parent::afterConstruct();
 }
Пример #4
0
 /**
  * This event is raised after the model instance is created by new operator.
  */
 protected function afterConstruct()
 {
     parent::afterConstruct();
     if ($this->scenario == 'test1') {
         $this->ce_lat = 58.3844382319306;
         $this->ce_lon = 26.7022705078125;
         $this->zoom = 5;
         $this->sw_lat = 58.23785;
         $this->sw_lon = 24.38965;
         $this->ne_lat = 59.46518;
         $this->ne_lon = 27.07031;
     }
     if ($this->scenario == 'test2') {
         $this->ce_lat = null;
         $this->ce_lon = null;
         $this->zoom = null;
         $this->sw_lat = 58.23785;
         $this->sw_lon = 24.38965;
         $this->ne_lat = 59.46518;
         $this->ne_lon = 27.07031;
     }
 }
Пример #5
0
    /**
     * @retunr void
     */
    protected function afterConstruct()
    {
        /* @var SettingsComponent $settings */
        /** @noinspection PhpUndefinedFieldInspection */
        $settings = Yii::app()->settings;

        $this->forceSSL = $settings->get(Setting::FORCE_SSL);
        $this->recentEntryWidgetEnabled = $settings->get(Setting::RECENT_ENTRIES_WIDGET_ENABLED);
        $this->recentEntryWidgetCount = $settings->get(Setting::RECENT_ENTRIES_WIDGET_COUNT);
        $this->mostViewedEntriesWidgetEnabled = $settings->get(Setting::MOST_VIEWED_ENTRIES_WIDGET_ENABLED);
        $this->mostViewedEntriesWidgetCount = $settings->get(Setting::MOST_VIEWED_ENTRIES_WIDGET_COUNT);

        parent::afterConstruct();
    }
 /**
  * Switch to the password scenario, when we dealing with passwords
  */
 public function afterConstruct()
 {
     parent::afterConstruct();
     if (isset($_POST) && !empty($_POST[__CLASS__]['password'])) {
         $this->scenario .= '_pass';
     }
 }
Пример #7
0
 /**
  * The after construct event, sets the default value of $this->rememberMe
  * @see CFormModel::afterConstruct()
  */
 public function afterConstruct()
 {
     parent::afterConstruct();
     $this->rememberMe = Yii::app()->getModule("users")->autoLoginByDefault;
 }