Ejemplo n.º 1
0
 public function actionagregarrangos($id, $idu)
 {
     $modelopadre = $this->loadModel($id);
     $usuario = Yii::app()->user->um->loadUserById($idu, true);
     /*var_dump($usuario);
     		yii::app()->end();*/
     if (is_null($usuario)) {
         throw new CHttpException(500, 'El userId ' . $idu . ' no existe.');
     }
     $model = new Authobjetosrango('centros');
     if (isset($_POST['Authobjetosrango'])) {
         $model->attributes = $_POST['Authobjetosrango'];
         $model->iduser = $idu;
         $model->hidobjeto = $modelopadre->id;
         $model->signo = 1;
         $model->save();
         /*print_r($model->geterrors());
         		yii::app()->end();*/
         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-detalle3').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-grid2');\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t");
             Yii::app()->end();
         }
     }
     // if (!empty($_GET['asDialog']))
     $this->layout = '//layouts/iframe';
     $this->render('vw_centros_rango', array('model' => $model));
 }