Exemplo n.º 1
0
 public function beforeFind()
 {
     if (is_subclass_of(Yii::app()->controller, 'BackController') && Yii::app()->languageManager->multilang) {
         $this->multilang();
     }
     return parent::beforeFind();
 }
Exemplo n.º 2
0
 public function beforeFind()
 {
     if (parent::beforeFind()) {
         $this->username = strtolower($this->username);
         return true;
     }
     return false;
 }
Exemplo n.º 3
0
 protected function beforeFind()
 {
     parent::beforeFind();
     if (isset(Yii::app()->user->latitude, Yii::app()->user->longitude)) {
         $this->attachBehaviors(array('NearScopeBehavior' => array('class' => 'ext.behavior.NearScopeBehavior', 'latitude' => Yii::app()->user->latitude, 'longitude' => Yii::app()->user->longitude, 'enableDistance' => true)));
         $this->near();
         //CTimeBehavior实现了自动调用。人家用的是事件。我们没有用事件,只能是手工调用了
     }
     return true;
 }
Exemplo n.º 4
0
 public function beforeFind()
 {
     $attrs = $this->attributeLabels();
     if ($this->tableName() != "sites") {
         if (@$attrs['site_id']) {
             $this->getDbCriteria()->mergeWith(array('alias' => 't', 'condition' => "t.site_id=" . (int) Sites::model()->getCurrentSite()->id));
         }
     }
     //var_dump($this->dbCriteria);
     parent::beforeFind();
 }
Exemplo n.º 5
0
 protected function beforeSave()
 {
     if (parent::beforeFind()) {
         if ($this->isNewRecord) {
             $this->created_at = time();
             $this->score = 100;
         }
         return true;
     }
     return false;
 }
Exemplo n.º 6
0
 protected function beforeFind()
 {
     if (parent::beforeFind()) {
         if ($this->hora_inicio) {
             $this->hora_inicio = Horario::hora($this->hora_inicio, true);
         }
         if ($this->hora_fin) {
             $this->hora_fin = Horario::hora($this->hora_fin, true);
         }
         return true;
     } else {
         return false;
     }
 }
Exemplo n.º 7
0
 protected function beforeFind()
 {
     // Поддержка многих языков после загрузки модели
     $this->languageBehavior->multilang();
     return parent::beforeFind();
 }
Exemplo n.º 8
0
    protected function beforeFind()
    {
        $t = $this->tableAlias;
        // Select community ID
        $select = array('(CASE
				WHEN ' . $t . '.identity LIKE "STEAM_%" THEN 76561197960265728 + CAST(SUBSTRING(' . $t . '.identity, 9, 1) AS UNSIGNED) + CAST(SUBSTRING(' . $t . '.identity, 11) * 2 AS UNSIGNED)
				WHEN ' . $t . '.identity LIKE "[U:%]" THEN 76561197960265728 + CAST(SUBSTRING(' . $t . '.identity, 6, CHAR_LENGTH(' . $t . '.identity) - 6) AS UNSIGNED)
			END) AS admin_community_id');
        if ($this->dbCriteria->select === '*') {
            array_unshift($select, '*');
        }
        $this->dbCriteria->mergeWith(array('select' => $select));
        parent::beforeFind();
    }
Exemplo n.º 9
0
 protected function beforeFind()
 {
     //$this->categorize($this->illust_category_enum);
     return parent::beforeFind();
 }
Exemplo n.º 10
0
 protected function beforeFind()
 {
     parent::beforeFind();
     $this->incrementCounter(__FUNCTION__);
 }
Exemplo n.º 11
0
 protected function beforeFind()
 {
     // Xử lý ngôn ngữ
     if ($this->enableLanguage) {
         $tableSchema = $this->getTableSchema();
         if (isset($tableSchema->columns['locale'])) {
             $criteria = new CDbCriteria();
             $criteria->condition = "locale = '" . Yii::app()->language . "'";
             $this->dbCriteria->mergeWith($criteria);
             //$this->setAttribute('locale', Yii::app()->language);
         }
     }
     parent::beforeFind();
 }
Exemplo n.º 12
0
 protected function beforeFind()
 {
     $this->enableCache();
     $this->setDbReading();
     parent::beforeFind();
 }