public function actionUtil() { $model = new PersonSpecialityView('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['PersonSpecialityView'])) { $model->attributes = $_GET['PersonSpecialityView']; $out = ""; if (isset($_GET['renum'])) { $c = new CDbCriteria(); $c->compare("SepcialityID", $model->SepcialityID); $c->order = "CreateDate"; $pspes = Personspeciality::model()->findAll($c); foreach ($pspes as $i => $obj) { $out .= "RequestNumber: " . $obj->RequestNumber . " chaget to: " . ($i + 1) . "<br>"; $obj->RequestNumber = $i + 1; if ($obj->QualificationID > 1 && $obj->SepcialityID != 70686 && $obj->SepcialityID != 90661) { $obj->scenario = "SHORTFORM"; //$obj->CausalityID = 100; } if (!$obj->save()) { debug(print_r($obj->getErrors(), true)); } } } $this->render('sverka', array("model" => $model)); if (!empty($out)) { echo $out; } } else { $this->render('util'); } }
/** * Manages all models. */ public function actionAdmin() { $model = new PersonSpecialityView('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['PersonSpecialityView'])) { $model->attributes = $_GET['PersonSpecialityView']; } $this->render('admin', array('model' => $model)); }
/** * Обновление цены за обучение * @param type $id */ public function actionStudupdate($id) { $model = $this->loadModel($id); $valid = true; if (isset($_POST['Personspeciality'])) { $model->attributes = $_POST['Personspeciality']; $valid = $model->validate() && $valid; try { if ($model->save()) { $model = new PersonSpecialityView('search'); } $model->unsetAttributes(); // clear any default values if (isset($_GET['PersonSpecialityView'])) { $model->attributes = $_GET['PersonSpecialityView']; } //$person = PersonSpecialityView::model()->findByPk($model->idPersonSpeciality); echo CJSON::encode(array("result" => "success", "data" => $this->renderPartial("//prices/tabs/_studprice", array('model' => $model), true))); Yii::app()->end(); } catch (Exception $e) { echo CJSON::encode(array("result" => "error", "data" => $e->getMessage())); Yii::app()->end(); } } $this->renderPartial('_studpriceModal', array('model' => $model, 'personid' => $model->idPersonSpeciality)); }
/** * Lists all models. */ public function actionIndex() { $model = new PersonSpecialityView('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['PersonSpecialityView'])) { $model->attributes = $_GET['PersonSpecialityView']; } $this->render('_personlist', array("model" => $model)); }