Пример #1
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate($framework_id)
 {
     $model = new Indicator();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Indicator'])) {
         $model->attributes = $_POST['Indicator'];
         if ($model->save()) {
             $frequencyMapping = new IndicatorFrequencyMapping();
             $frequencyMapping->indicator_id = $model->id;
             $frequencyMapping->frequency_id = $model->frequency;
             $frequencyMapping->save();
             $frameworkMapping = new EamsFrameworkIndicatorMapping();
             $frameworkMapping->framework_id = $framework_id;
             $frameworkMapping->indicator_id = $model->id;
             $frameworkMapping->indicator_unit_id = $model->indicatorUnit;
             $frameworkMapping->data_source_id = $model->indicatorDataSource;
             $frameworkMapping->created_by = Yii::app()->user->id;
             $frameworkMapping->save();
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }