public static function DropDown() { $res = array(); foreach (Personbasespeciality::model()->findAll() as $record) { $res[$record->idPersonBaseSpeciality] = "({$record->PersonBaseSpecialityClasifierCode}) {$record->PersonBaseSpecialityName}"; } return $res; }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Personbasespeciality::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function docTypeValid($attribute, $params) { //11 Диплом бакалавра 1 //12 Диплом спеціаліста 1 //13 Диплом магістра 1 if ($this->PersonBaseSpecealityID > 0) { $bs = Personbasespeciality::model()->findByPk($this->PersonBaseSpecealityID); $pos = 0; if ($this->TypeID == 11) { $pos = strpos($bs->PersonBaseSpecialityClasifierCode, "6."); } if ($this->TypeID == 12) { $pos = strpos($bs->PersonBaseSpecialityClasifierCode, "7."); } if ($this->TypeID == 13) { $pos = strpos($bs->PersonBaseSpecialityClasifierCode, "8."); } if ($pos === false && $pos >= 0) { $this->addError($attribute, "Невірний базовий напрям!"); } } }
public function actionBasespecs() { $models = Personbasespeciality::model()->findAll('1 ORDER BY PersonBaseSpecialityName'); $result = array(); foreach ($models as $model) { /* @var $model Personbasespeciality */ $result[] = array('text' => str_replace('"', "'", implode(' ', array($model->PersonBaseSpecialityClasifierCode, $model->PersonBaseSpecialityName))), 'id' => $model->idPersonBaseSpeciality); } echo CJSON::encode($result); }