- Indicar idioma castellano en la configuración.
git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_IntranetNueva/trunk@13 77cfc57b-8ef4-1849-9df6-4a38aa5da120
This commit is contained in:
parent
25ecb5c441
commit
665d4af0f0
@ -8,6 +8,8 @@
|
||||
return array(
|
||||
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
|
||||
'name'=>'My Web Application',
|
||||
'theme'=>'intranet',
|
||||
'language'=>'es',
|
||||
|
||||
// preloading 'log' component
|
||||
'preload'=>array('log'),
|
||||
@ -61,8 +63,8 @@ return array(
|
||||
),
|
||||
|
||||
'errorHandler'=>array(
|
||||
// use 'site/error' action to display errors
|
||||
'errorAction'=>'site/error',
|
||||
// use 'site/error' action to display errors
|
||||
'errorAction'=>'site/error',
|
||||
),
|
||||
'log'=>array(
|
||||
'class'=>'CLogRouter',
|
||||
@ -87,5 +89,5 @@ return array(
|
||||
// this is used in contact page
|
||||
'adminEmail'=>'webmaster@example.com',
|
||||
),
|
||||
'theme'=>'intranet',
|
||||
|
||||
);
|
||||
@ -57,25 +57,94 @@ class CandidatoController extends Controller
|
||||
*/
|
||||
public function actionCreate()
|
||||
{
|
||||
$model=new Candidato;
|
||||
Yii::import('ext.multimodelform.MultiModelForm');
|
||||
|
||||
$model = new Candidato;
|
||||
$idioma = new CandidatoIdioma();
|
||||
$titulacion = new CandidatoTitulacion();
|
||||
|
||||
$idiomasValidos = array();
|
||||
$titulacionesValidas = array();
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
//$this->performAjaxValidation($model);
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
//$this->performAjaxValidation($model);
|
||||
/*if(isset($_POST['Candidato']))
|
||||
{
|
||||
$model->attributes=$_POST['Candidato'];
|
||||
$foto=CUploadedFile::getInstance($model,'foto');
|
||||
|
||||
if(isset($_POST['Candidato']))
|
||||
{
|
||||
$model->attributes=$_POST['Candidato'];
|
||||
$foto=CUploadedFile::getInstance($model,'foto');
|
||||
if ($model->validate())
|
||||
{
|
||||
$foundInvalidChild = false;
|
||||
$arrayIdiomas = array();
|
||||
if(isset($_POST['CandidatoIdioma']))
|
||||
{
|
||||
foreach ($_POST['CandidatoIdioma'] as $idioma)
|
||||
{
|
||||
$CandidatoIdioma = new CandidatoIdioma;
|
||||
$CandidatoIdioma->attributes = $idioma;
|
||||
|
||||
if ($model->save()) {
|
||||
$this->guardarFoto($model->id, $foto);
|
||||
$this->redirect(array('view','id'=>$model->id));
|
||||
if ($model->id)
|
||||
$CandidatoIdioma->candidato_id = $model->id;
|
||||
|
||||
if (!$CandidatoIdioma->validate())
|
||||
$foundInvalidChild = true;
|
||||
|
||||
$arrayIdiomas[] = $CandidatoIdioma;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->render('create',array(
|
||||
'model'=>$model,
|
||||
));
|
||||
if (!$foundInvalidChild && $model->save()) {
|
||||
$this->guardarFoto($model->id, $foto);
|
||||
|
||||
// Guardar los idiomas
|
||||
foreach($arrayIdiomas as $CandidatoIdioma)
|
||||
{
|
||||
$CandidatoIdioma->candidato_id = $model->id;
|
||||
$CandidatoIdioma->save();
|
||||
}
|
||||
|
||||
Yii::app()->user->setFlash('success', "Candidato dado de alta correctamente.");
|
||||
$this->redirect(array('index'));
|
||||
}
|
||||
}*/
|
||||
|
||||
if (isset($_POST['Candidato'])) {
|
||||
$model->attributes=$_POST['Candidato'];
|
||||
$foto=CUploadedFile::getInstance($model,'foto');
|
||||
|
||||
$foundInvalidChild = false;
|
||||
|
||||
if ($model->validate()) {
|
||||
if (!MultiModelForm::validate($model, $idiomasValidos, $idiomasBorrados))
|
||||
$foundInvalidChild = true;
|
||||
|
||||
if (!MultiModelForm::validate($model, $titulacionesValidas, $titulacionesBorradas))
|
||||
$foundInvalidChild = true;
|
||||
}
|
||||
|
||||
if (!$foundInvalidChild && $model->save() ) {
|
||||
$masterValues = array ('candidato_id'=>$model->id);
|
||||
|
||||
if (MultiModelForm::save($model, $idiomasValidos, $idiomasBorrados, $masterValues) &&
|
||||
MultiModelForm::save($model, $titulacionesValidas, $titulacionesBorradas, $masterValues))
|
||||
{
|
||||
$this->guardarFoto($model->id, $foto);
|
||||
Yii::app()->user->setFlash('success', "Candidato dado de alta correctamente.");
|
||||
$this->redirect(array('index'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->render('create',array(
|
||||
'model'=>$model,
|
||||
'idioma'=>$idioma,
|
||||
'titulacion'=>$titulacion,
|
||||
'idiomasValidos'=>$idiomasValidos,
|
||||
'titulacionesValidas'=>$titulacionesValidas,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -85,24 +154,85 @@ class CandidatoController extends Controller
|
||||
*/
|
||||
public function actionUpdate($id)
|
||||
{
|
||||
$model=$this->loadModel($id);
|
||||
Yii::import('ext.multimodelform.MultiModelForm');
|
||||
|
||||
$model=$this->loadModel($id);
|
||||
$idioma=new CandidatoIdioma();
|
||||
$titulacion = new CandidatoTitulacion();
|
||||
|
||||
$idiomasValidos = array();
|
||||
$titulacionesValidas = array();
|
||||
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
//$this->performAjaxValidation($model);
|
||||
// Uncomment the following line if AJAX validation is needed
|
||||
//$this->performAjaxValidation($model);
|
||||
|
||||
if(isset($_POST['Candidato']))
|
||||
{
|
||||
$foto=CUploadedFile::getInstance($model,'foto');
|
||||
$model->attributes=$_POST['Candidato'];
|
||||
if($model->save()) {
|
||||
$this->guardarFoto($model->id, $foto);
|
||||
$this->redirect(array('view','id'=>$model->id));
|
||||
/*if(isset($_POST['Candidato']))
|
||||
{
|
||||
$foto=CUploadedFile::getInstance($model,'foto');
|
||||
$model->attributes=$_POST['Candidato'];
|
||||
|
||||
if ($model->validate())
|
||||
{
|
||||
$foundInvalidChild = false;
|
||||
$arrayIdiomas = array();
|
||||
if(isset($_POST['CandidatoIdioma']))
|
||||
{
|
||||
foreach ($_POST['CandidatoIdioma'] as $idioma)
|
||||
{
|
||||
//$CandidatoIdioma = CandidatoIdioma::model()->findB;
|
||||
//CandidatoIdioma::model()->deleteAllByAttributes($arrayIdiomas)
|
||||
|
||||
$CandidatoIdioma->attributes = $idioma;
|
||||
|
||||
|
||||
if ($model->id)
|
||||
$CandidatoIdioma->candidato_id = $model->id;
|
||||
|
||||
if (!$CandidatoIdioma->validate())
|
||||
$foundInvalidChild = true;
|
||||
|
||||
$arrayIdiomas[] = $CandidatoIdioma;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->render('update',array(
|
||||
'model'=>$model,
|
||||
));
|
||||
if (!$foundInvalidChild && $model->save()) {
|
||||
$this->guardarFoto($model->id, $foto);
|
||||
|
||||
// Guardar los idiomas
|
||||
foreach($arrayIdiomas as $CandidatoIdioma)
|
||||
{
|
||||
$CandidatoIdioma->candidato_id = $model->id;
|
||||
$CandidatoIdioma->save();
|
||||
}
|
||||
|
||||
Yii::app()->user->setFlash('success', "Candidato actualizado correctamente.");
|
||||
//$this->redirect(array('view','id'=>$model->id));
|
||||
}
|
||||
}*/
|
||||
|
||||
if(isset($_POST['Candidato'])) {
|
||||
$foto=CUploadedFile::getInstance($model,'foto');
|
||||
$model->attributes=$_POST['Candidato'];
|
||||
|
||||
//the value for the foreign key 'candidato_id'
|
||||
$masterValues = array ('candidato_id'=>$model->id);
|
||||
|
||||
//Save the master model after saving valid members
|
||||
if (MultiModelForm::save($idioma, $validatedIdiomas, $deleteIdiomas, $masterValues) && $model->save() ) {
|
||||
$this->guardarFoto($model->id, $foto);
|
||||
Yii::app()->user->setFlash('success', "Candidato actualizado correctamente.");
|
||||
//$this->redirect(array('view','id'=>$model->id));
|
||||
}
|
||||
}
|
||||
|
||||
$this->render('update',array(
|
||||
'model'=>$model,
|
||||
'idioma'=>$idioma,
|
||||
'titulacion'=>$titulacion,
|
||||
'idiomasValidos'=>$idiomasValidos,
|
||||
'titulacionesValidas'=>$titulacionesValidas,
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -12,7 +12,7 @@ class m120130_120838_tbl_idiomas extends CDbMigration
|
||||
|
||||
public function down()
|
||||
{
|
||||
$this->dropTable('tbl_idiomas');
|
||||
$this->dropTable('tbl_idiomas');
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@ -25,7 +25,7 @@ class Candidato extends CActiveRecord
|
||||
const GENERO_MUJER=1;
|
||||
|
||||
public $foto;
|
||||
|
||||
|
||||
/**
|
||||
* Devuelve la lista de géneros de un candidato.
|
||||
* @return array lista de géneros permitidos
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -1,30 +0,0 @@
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo $form->textField($model,"[$id]idioma"); ?>
|
||||
<?php echo $form->error($model,"idioma"); ?>
|
||||
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $form->textField($model,"[$id]conversacion"); ?>
|
||||
<?php echo $form->error($model,"conversacion"); ?>
|
||||
</td>
|
||||
|
||||
<td>
|
||||
<?php echo $form->textField($model,"[$id]lectura_traduccion"); ?>
|
||||
<?php echo $form->error($model,"lectura_traduccion"); ?>
|
||||
</td>
|
||||
|
||||
|
||||
<td><?php echo CHtml::link(
|
||||
'delete',
|
||||
'#',
|
||||
array(
|
||||
'submit'=>'',
|
||||
'params'=>array(
|
||||
'CandidatoIdioma[command]'=>'delete',
|
||||
'CandidatoIdioma[id]'=>$id,
|
||||
'noValidate'=>true)
|
||||
));?>
|
||||
</td>
|
||||
</tr>
|
||||
@ -62,3 +62,34 @@ span.timestamp {
|
||||
color: #006699;
|
||||
}
|
||||
|
||||
.button.plain {
|
||||
background: none repeat scroll 0 0 #F2F2F2;
|
||||
border: 1px solid #DDDDDD;
|
||||
border-radius: 0 0 0 0;
|
||||
box-shadow: none;
|
||||
color: #666;
|
||||
height: 22px;
|
||||
line-height: 22px;
|
||||
margin: -4px -4px -4px 0;
|
||||
padding: 0 14px;
|
||||
text-decoration: none;
|
||||
text-shadow: 0 1px 0 #FFFFFF;
|
||||
font-weight: bold;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.button.plain:hover {
|
||||
color: #333;
|
||||
background: none repeat scroll 0 0 #E2E2E2;
|
||||
}
|
||||
|
||||
.button.plain:first-child {
|
||||
border-bottom-left-radius: 2px;
|
||||
border-top-left-radius: 2px;
|
||||
}
|
||||
|
||||
.button.plain:last-child {
|
||||
border-bottom-right-radius: 2px;
|
||||
border-top-right-radius: 2px;
|
||||
}
|
||||
|
||||
|
||||
@ -362,7 +362,7 @@ input[type=radio], input[type=checkbox] { margin: 0; padding: 0; vertical-align:
|
||||
.form_default fieldset { border: 1px solid #ccc; padding: 20px; background: #f7f7f7; }
|
||||
.form_default legend { text-transform: uppercase; }
|
||||
.form_default p { margin: 20px 0 !important; }
|
||||
.form_default label { width: 150px; float: left; text-align: right; padding-top: 5px; margin-right: 20px; }
|
||||
.form_default label { width: 130px; float: left; text-align: right; padding-top: 5px; margin-right: 20px; }
|
||||
|
||||
.form_default input[type=text], .form_default input[type=password] { font-size: 12px; padding: 8px 5px; border: 1px solid #ccc; background: #fcfcfc; outline: none; }
|
||||
.form_default input[type=text], .form_default input[type=password] { -moz-box-shadow: inset 1px 1px 3px #ccc; -webkit-box-shadow: inset 1px 1px 3px #ccc; box-shadow: inset 1px 1px 3px #ccc; }
|
||||
@ -450,7 +450,7 @@ input[type=radio], input[type=checkbox] { margin: 0; padding: 0; vertical-align:
|
||||
.sTable2 tbody tr.even td { background: #fcfcfc; }
|
||||
|
||||
.sTable3 { border-collapse: collapse; }
|
||||
.sTable3 thead td { padding: 5px 10px; background: #eee url(../images/thead.png) repeat-x top left; border-bottom: 1px solid #ccc; }
|
||||
.sTable3 thead td, .sTable3 thead th { padding: 5px 10px; background: #eee url(../images/thead.png) repeat-x top left; border-bottom: 1px solid #ccc; }
|
||||
.sTable3 tbody tr td { padding: 10px; background: #fff; border-top: 1px solid #eee; border-left: 1px solid #eee; }
|
||||
.sTable3 tbody tr.even td { background: #fcfcfc; }
|
||||
|
||||
@ -578,6 +578,7 @@ input[type=radio], input[type=checkbox] { margin: 0; padding: 0; vertical-align:
|
||||
.loaders img { vertical-align: middle; display: inline-block; margin-right: 10px; }
|
||||
.padding15 { padding: 15px; overflow: hidden; }
|
||||
.padding1020 { padding: 10px 20px; }
|
||||
.padding020 { padding: 0px 20px; }
|
||||
.padding20 { padding: 20px; overflow: hidden; }
|
||||
.borderbottom { border-bottom: 1px solid #eee; }
|
||||
.floatleft { float: left; }
|
||||
@ -597,7 +598,7 @@ input[type=radio], input[type=checkbox] { margin: 0; padding: 0; vertical-align:
|
||||
.inlineblock { display: inline-block; }
|
||||
.alignright { text-align: right; }
|
||||
.bordertop { border-top: 1px solid #ccc; }
|
||||
|
||||
.fullwidth { width: 100%; }
|
||||
|
||||
/***CUSTOM STYLES***/
|
||||
.operations > ul {list-style: none;}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/custom/elements.js');
|
||||
//Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/custom/elements.js');
|
||||
?>
|
||||
|
||||
<?php $form=$this->beginWidget('CActiveForm', array(
|
||||
@ -14,7 +14,7 @@ Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/c
|
||||
<p>Los campos marcados con <span class="required">*</span> son obligatorios.</p>
|
||||
</div><!-- notification msginfo -->
|
||||
|
||||
<?php echo $form->errorSummary($model, "<a class='close'></a>", "", array('class'=>"notification msgerror")); ?>
|
||||
<?php echo $form->errorSummary(array_merge(array($model), $idiomasValidos, $titulacionesValidas), "<a class='close'></a>", "", array('class'=>"notification msgerror")); ?>
|
||||
</div>
|
||||
<br clear="all" />
|
||||
<div class="widgetbox two_third last form_default">
|
||||
@ -135,9 +135,8 @@ Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/c
|
||||
unset($lista[$provincia->id]);
|
||||
}
|
||||
}
|
||||
echo CHtml::dropDownList(
|
||||
echo CHtml::activeDropDownList($model,
|
||||
'localidad',
|
||||
$model->localidad,
|
||||
$lista,
|
||||
array(
|
||||
'empty'=>'<Seleccionar>',
|
||||
@ -152,15 +151,28 @@ Yii::app()->clientScript->registerScriptFile(Yii::app()->theme->baseUrl . '/js/c
|
||||
</div>
|
||||
</div>
|
||||
<br clear="all" />
|
||||
|
||||
<div class="widgetbox two_third last form_default">
|
||||
<h3>
|
||||
<span>
|
||||
<legend>Datos académicos</legend>
|
||||
</span>
|
||||
</h3>
|
||||
|
||||
<?php $this->renderPartial('_idiomas', array(
|
||||
'model'=>$model,
|
||||
'idioma'=>$idioma,
|
||||
'idiomasValidos'=>$idiomasValidos,
|
||||
)); ?>
|
||||
|
||||
<?php $this->renderPartial('_titulaciones', array(
|
||||
'model'=>$model,
|
||||
'titulacion'=>$titulacion,
|
||||
'titulacionesValidas'=>$titulacionesValidas,
|
||||
)); ?>
|
||||
|
||||
</div>
|
||||
<br clear="all" />
|
||||
|
||||
<div class="form_default">
|
||||
<button type="submit"><?php echo $model->isNewRecord ? 'Crear' : 'Guardar'; ?></button>
|
||||
</div>
|
||||
|
||||
@ -14,5 +14,11 @@ $this->pageTitle='Nuevo candidato';
|
||||
?>
|
||||
|
||||
<?php echo $this->renderPartial('_form', array(
|
||||
'model'=>$model,
|
||||
)); ?>
|
||||
'model'=>$model,
|
||||
'idioma'=>$idioma,
|
||||
'titulacion'=>$titulacion,
|
||||
'idiomasValidos'=>$idiomasValidos,
|
||||
'titulacionesValidas'=>$titulacionesValidas,
|
||||
));
|
||||
?>
|
||||
|
||||
|
||||
@ -27,6 +27,9 @@ $('.search-form form').submit(function(){
|
||||
$this->pageTitle='Gestión de candidatos';
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<p>
|
||||
You may optionally enter a comparison operator (<b><</b>, <b><=</b>, <b>></b>, <b>>=</b>, <b><></b>
|
||||
or <b>=</b>) at the beginning of each of your search values to specify how the comparison should be done.
|
||||
|
||||
@ -11,8 +11,17 @@ $this->menu=array(
|
||||
array('label'=>'View Candidato', 'url'=>array('view', 'id'=>$model->id)),
|
||||
array('label'=>'Manage Candidato', 'url'=>array('admin')),
|
||||
);
|
||||
|
||||
$this->pageTitle='Modificar candidato ' . $model->nombre . ' ' . $model->apellidos;
|
||||
?>
|
||||
|
||||
<h1>Update Candidato <?php echo $model->id; ?></h1>
|
||||
|
||||
<?php echo $this->renderPartial('_form', array('model'=>$model)); ?>
|
||||
<?php echo $this->renderPartial('_form', array(
|
||||
'model'=>$model,
|
||||
'idioma'=>$idioma,
|
||||
'titulacion'=>$titulacion,
|
||||
'idiomasValidos'=>$idiomasValidos,
|
||||
'titulacionesValidas'=>$titulacionesValidas,
|
||||
));
|
||||
?>
|
||||
|
||||
@ -16,9 +16,13 @@
|
||||
<!--[if IE 7]>
|
||||
<link rel="stylesheet" media="screen" href="<?php echo Yii::app()->theme->baseUrl; ?>/css/ie7.css"/>
|
||||
<![endif]-->
|
||||
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/js/plugins/jquery-1.7.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/js/plugins/jquery-ui-1.8.16.custom.min.js"></script>
|
||||
<script type="text/javascript" src="<?php echo Yii::app()->theme->baseUrl; ?>/js/custom/general.js"></script>
|
||||
<?php
|
||||
$base = Yii::app()->theme->baseUrl;
|
||||
$cs = Yii::app()->getClientScript();
|
||||
$cs->registerCoreScript('jquery');
|
||||
$cs->registerScriptFile($base.'/js/plugins/jquery-ui-1.8.16.custom.min.js', CClientScript::POS_HEAD);
|
||||
$cs->registerScriptFile($base.'/js/custom/general.js', CClientScript::POS_HEAD);
|
||||
?>
|
||||
|
||||
<title><?php echo CHtml::encode($this->pageTitle); ?></title>
|
||||
</head>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user