/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { $model = new Usuariosfavoritos(); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Usuariosfavoritos'])) { $model->attributes = $_POST['Usuariosfavoritos']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model)); }
public function actionAgregafavorito() { $model = new Usuariosfavoritos(); $vaccion = $_GET['maccion']; $vcontrolador = $_GET['mcontrolador']; $url = Yii::app()->baseUrl . DIRECTORY_SEPARATOR . $vcontrolador . DIRECTORY_SEPARATOR . $vaccion; if (isset($_POST['Usuariosfavoritos'])) { $model->attributes = $_POST['Usuariosfavoritos']; $model->save(); echo CHtml::script("window.parent.\$('#cru-dialoggeneral').dialog('close');\n\t\t\t\t\t\t\t\t\t\twindow.parent.\$('#cru-framegeneral').attr('src','');\n\t\t\t\t\t\t\t\t\t\twindow.parent.\$.fn.yiiGridView.update('{$_GET['gridId']}');"); Yii::app()->end(); } // if (!empty($_GET['asDialog'])) $this->layout = '//layouts/iframe'; $this->render('_form_favoritos', array('model' => $model, 'url' => $url)); }