/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Pregunta();
     $b = new Metrica();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Pregunta'], $_POST['Metrica'])) {
         $model->attributes = $_POST['Pregunta'];
         $b->attributes = $_POST['Metrica'];
         $model->descripcion_pregunta = $model->descripcion_pregunta;
         $arr2 = implode(",", $model->attributes['id_caracteristica']);
         $model->id_caracteristica = $arr2;
         $model->id_aspecto = $model->id_aspecto;
         $model->estatus_pregunta = $model->estatus_pregunta;
         $model->save();
         $arr = implode(",", $b->attributes['id_metrica']);
         $porciones = explode(",", $arr);
         foreach ($porciones as $met) {
             $c = new OpcionRespuesta();
             $c->isNewRecord = true;
             error_log('Metrica_id: ' . $met);
             $c->id_metrica = $met;
             $c->id_pregunta = $model->id_pregunta;
             $c->save();
         }
         $this->redirect(array('view', 'id' => $model->id_pregunta));
     }
     $this->render('create', array('model' => $model, 'b' => $b));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new OpcionRespuesta();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['OpcionRespuesta'])) {
         $model->attributes = $_POST['OpcionRespuesta'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id_respuesta));
         }
     }
     $this->render('create', array('model' => $model));
 }