コード例 #1
0
 public function check_type($attribute, $params)
 {
     if (!$this->hasErrors()) {
         $user = CatalogUsers::findByAttributes(array("email" => $this->email, "password" => md5($this->password)));
         $consoleType = CatalogUsersType::fetchByKeyWord("console");
         if ($user[0]->type_id != $consoleType->id) {
             $this->addErrors(array("0" => "У вас нет доступа для данного раздела"));
         }
     }
 }
コード例 #2
0
ファイル: CatalogUsers.php プロジェクト: bogiesoft/yii-travel
 public function setDefaultType($attribute, $params)
 {
     if (empty($this->type_id)) {
         $type = CatalogUsersType::fetchByKeyWord("user");
         $this->type_id = intval($type->id);
     }
 }