From a561ad78fbe354c1b974eb1ed488cfd72fd98af4 Mon Sep 17 00:00:00 2001 From: roberto Date: Thu, 19 Apr 2012 11:52:27 +0000 Subject: [PATCH] =?UTF-8?q?Se=20a=C3=B1ade=20la=20gesti=C3=B3n=20de=20idio?= =?UTF-8?q?mas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_IntranetNueva/trunk@47 77cfc57b-8ef4-1849-9df6-4a38aa5da120 --- .../controllers/IdiomaController.php | 82 +++++++++++++++++++ .../controllers/SistemaController.php | 36 ++++++++ 2 files changed, 118 insertions(+) create mode 100644 www/protected/controllers/IdiomaController.php create mode 100644 www/protected/controllers/SistemaController.php diff --git a/www/protected/controllers/IdiomaController.php b/www/protected/controllers/IdiomaController.php new file mode 100644 index 0000000..119c809 --- /dev/null +++ b/www/protected/controllers/IdiomaController.php @@ -0,0 +1,82 @@ +performAjaxValidation($model); + + if(isset($_POST['Idioma'])) + { + $model->attributes=$_POST['Idioma']; + if($model->save()) + $this->redirect(array('index','id'=>$model->id)); + } + + $this->render('create',array( + 'model'=>$model, + )); + } + + public function actionDelete($id) + { + if(Yii::app()->request->isPostRequest) + { + // we only allow deletion via POST request + $this->loadModel($id)->delete(); + } + else + throw new CHttpException(400,'Invalid request. Please do not repeat this request again.'); + + } + + public function actionIndex() + { + $model=new Idioma('search'); + $model->unsetAttributes(); // clear any default values + + if(isset($_GET['Idioma'])) + $model->attributes=$_GET['Idioma']; + + $this->render('index',array( + 'model'=>$model, + )); + } + + public function actionUpdate($id) + { + $model=$this->loadModel($id); + + // Uncomment the following line if AJAX validation is needed + // $this->performAjaxValidation($model); + + if(isset($_POST['Idioma'])) + { + $model->attributes=$_POST['Idioma']; + if($model->save()) + $this->redirect(array('index','id'=>$model->id)); + } + + $this->render('update',array( + 'model'=>$model, + )); + + } + + /** + * Returns the data model based on the primary key given in the GET variable. + * If the data model is not found, an HTTP exception will be raised. + * @param integer the ID of the model to be loaded + */ + public function loadModel($id) + { + $model=Idioma::model()->findByPk($id); + if($model===null) + throw new CHttpException(404,'The requested page does not exist.'); + return $model; + } + +} \ No newline at end of file diff --git a/www/protected/controllers/SistemaController.php b/www/protected/controllers/SistemaController.php new file mode 100644 index 0000000..1b7323e --- /dev/null +++ b/www/protected/controllers/SistemaController.php @@ -0,0 +1,36 @@ +render('index'); + } + + // Uncomment the following methods and override them if needed + /* + public function filters() + { + // return the filter configuration for this controller, e.g.: + return array( + 'inlineFilterName', + array( + 'class'=>'path.to.FilterClass', + 'propertyName'=>'propertyValue', + ), + ); + } + + public function actions() + { + // return external action classes, e.g.: + return array( + 'action1'=>'path.to.ActionClass', + 'action2'=>array( + 'class'=>'path.to.AnotherActionClass', + 'propertyName'=>'propertyValue', + ), + ); + } + */ +} \ No newline at end of file