/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { if ($this->menu_use[10]) { $model = new StudentServiceType(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $ser_group_list = array(); $criteria = new CDbCriteria(); $criteria->order = 'ser_group'; $ser_group = StudentServiceGroup::model()->findAll($criteria); foreach ($ser_group as $type) { $ser_group_list[$type->ser_group] = $type->ser_name; } if (isset($_POST['StudentServiceType'])) { $model->attributes = $_POST['StudentServiceType']; if ($model->save()) { $this->redirect(array('index')); } } $this->render('create', array('model' => $model, 'ser_group_list' => $ser_group_list)); } else { $this->redirect(array('site/index')); } }