/** * 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 = Personsextypes::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<div class ="span4"> <?php echo $form->labelEx($model, 'Birthday'); ?> <?php echo $form->textField($model, 'Birthday', array('class' => 'span12 datepicker')); ?> </div> <div class ="span4"> <?php echo $form->labelEx($model, 'PersonSexID'); ?> <?php echo $form->dropDownList($model, 'PersonSexID', Personsextypes::DropDown(), array('class' => 'span12')); ?> </div> <?php if (Yii::app()->user->checkAccess("editResident")) { ?> <div class ="span4"> <?php echo $form->labelEx($model, 'IsResident'); ?> <?php $access = Yii::app()->user->checkAccess("editResident") ? "" : "disabled"; ?> <div class="switch" data-on-label="Так" data-off-label="Ні">
/** * Lists all models. */ public function actionIndex() { $model = new Personsextypes('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['PersonSexTypes'])) { $model->attributes = $_GET['PersonSexTypes']; } $this->render('admin', array('model' => $model)); /* $dataProvider=new CActiveDataProvider('Personbasespeciality'); $this->render('index',array( 'dataProvider'=>$dataProvider, ));*/ }
/** * Manages all models. */ public function actionAdmin() { $model = new Personsextypes('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['PersonSexTypes'])) { $model->attributes = $_GET['PersonSexTypes']; } $this->render('admin', array('model' => $model)); }