Se añade la gestión de idiomas

git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_IntranetNueva/trunk@47 77cfc57b-8ef4-1849-9df6-4a38aa5da120
This commit is contained in:
roberto 2012-04-19 11:52:27 +00:00
parent 619cbf05e3
commit a561ad78fb
2 changed files with 118 additions and 0 deletions

View File

@ -0,0 +1,82 @@
<?php
class IdiomaController extends Controller
{
public function actionCreate()
{
$model=new Idioma;
// 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('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;
}
}

View File

@ -0,0 +1,36 @@
<?php
class SistemaController extends Controller
{
public function actionIndex()
{
$this->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',
),
);
}
*/
}