/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function actionCreate()
 {
     $model = new Opcionescamposdocu();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Opcionescamposdocu'])) {
         $model->attributes = $_POST['Opcionescamposdocu'];
         if ($model->save()) {
             $this->redirect(array('view', 'id' => $model->id));
         }
     }
     $this->render('create', array('model' => $model));
 }
示例#2
0
 public function actionCreadetalle($id)
 {
     $id = (int) MiFactoria::cleanInput($id);
     $modelopadre = $this->loadModel($id);
     // $descuento=(is_null($modelopadre->descuento))?1:(1-$modelopadre->descuento/100);
     $model = new Opcionescamposdocu();
     //$model->estadodetalle=ESTADO_PREVIO;
     // $model->idusertemp=Yii::app()->user->id;
     // $model->valorespordefecto($this->documentohijo);
     if (isset($_POST['Opcionescamposdocu'])) {
         $model->attributes = $_POST['Opcionescamposdocu'];
         $model->codocu = $modelopadre->coddocu;
         ///detalle guia
         if ($model->save()) {
             if (!empty($_GET['asDialog'])) {
                 //Close the dialog, reset the iframe and update the grid
                 echo CHtml::script("window.parent.\$('#cru-dialog3').dialog('close');\n\t\t\t\t\t\t\t\t\t\t\t\t\t                    window.parent.\$('#cru-frame3').attr('src','');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('detalle-grid');\n\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
             }
         } else {
             print_r($model->geterrors());
         }
         Yii::app()->end();
     }
     // if (!empty($_GET['asDialog']))
     $this->layout = '//layouts/iframe';
     $this->render('//opcionescamposdocu/_form', array('model' => $model));
 }