/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Appointments(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Appointments'])) { $model->attributes = $_POST['Appointments']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $this->pagename = "Create " . $this->pagename; $model = new Appointments(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Appointments'])) { $model->attributes = $_POST['Appointments']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } if (isset($_GET['appointmentdate'])) { $model->start_datetime = $_GET['appointmentdate']; } $this->render('create', array('model' => $model, 'providers_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Providers::model()->findAll("id in (select providers_id from workers where users_id=" . Yii::app()->user->id . ")"), "id", 'name')), 'services_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Services::model()->findAll(), "id", 'name')), 'workers_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Users::model()->findAll('id in (select userid from AuthAssignment where ' . 'itemname="technician" and userid in ' . '(select users_id from workers where providers_id in ' . '(select providers_id from workers where users_id=' . Yii::app()->user->id . ')))'), "id", 'email')), 'users_array' => CMap::mergeArray(array("" => ""), CHtml::listData(Users::model()->findAll('id in (select userid from AuthAssignment where ' . 'itemname="client")'), "id", 'email')))); }