예제 #1
0
 public static function DropDown($KOATUUCode = '0000000000', $MaskLen = 4)
 {
     $res = array();
     //debug('$MaskLen = '.$MaskLen);
     $KOATUUCode = substr($KOATUUCode, 0, $MaskLen);
     //debug($KOATUUCode);
     foreach (Schools::model()->findAll("KOATUUCode like :KOATUUCode ORDER BY SchoolName", array(":KOATUUCode" => $KOATUUCode . "%")) as $record) {
         $res[$record->idSchool] = $record->SchoolName;
     }
     return $res;
 }
예제 #2
0
 /**
  * Контроллер для работы выбора школ при редактировании персоны
  */
 public function actionSchoolr($id)
 {
     $result = array();
     $text = "";
     $model = Schools::model()->find("idSchool = {$id}");
     if (!empty($model)) {
         $text = $model->SchoolName;
     }
     $result = array("id" => $id, 'text' => $text);
     echo CJSON::encode($result);
 }
예제 #3
0
 /**
  * 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 = Schools::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
예제 #4
0
 /**
  * Метод асинхронно повертає список НЗ, що закінчили персони
  */
 public function actionSchools()
 {
     $models = Schools::model()->findAll('1 ORDER BY SchoolName ASC');
     $result = array();
     foreach ($models as $model) {
         /* @var $model Schools */
         $result[] = array('text' => str_replace('"', "'", $model->SchoolName), 'id' => $model->idSchool);
     }
     echo CJSON::encode($result);
 }