- Arreglado grid de candidatos.
- Extensión SelGridView para conservar la fila seleccionada del grid en ordenación/paginación - Arreglos menores git-svn-id: https://192.168.0.254/svn/Proyectos.Incam_IntranetNueva/trunk@23 77cfc57b-8ef4-1849-9df6-4a38aa5da120
This commit is contained in:
parent
c261148291
commit
d23e585db6
@ -240,6 +240,18 @@ tr.even {
|
||||
background-color: #eee;
|
||||
}
|
||||
|
||||
tr.even.selected td {
|
||||
background-color: #FFFCCC;
|
||||
}
|
||||
|
||||
tr.odd.selected td {
|
||||
background-color: #FFFCCC;
|
||||
}
|
||||
|
||||
tr:hover {
|
||||
background-color: #DDDDDD;
|
||||
}
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
* DataTables cells classes
|
||||
*/
|
||||
@ -289,15 +301,6 @@ td.details {
|
||||
}
|
||||
|
||||
|
||||
table.display tr.even.row_selected td {
|
||||
background-color: #B0BED9;
|
||||
}
|
||||
|
||||
table.display tr.odd.row_selected td {
|
||||
background-color: #9FAFD1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Sorting classes for columns
|
||||
*/
|
||||
|
||||
@ -27,13 +27,9 @@ class CandidatoController extends Controller
|
||||
{
|
||||
return array(
|
||||
array('allow', // allow authenticated user to perform 'create' and 'update' actions
|
||||
'actions'=>array('index','view','create','update','delete'),
|
||||
'actions'=>array('index','view','create','update','delete','admin'),
|
||||
'users'=>array('@'),
|
||||
),
|
||||
array('allow', // allow admin user to perform 'admin' and 'delete' actions
|
||||
'actions'=>array('admin'),
|
||||
'users'=>array('admin'),
|
||||
),
|
||||
array('deny', // deny all users
|
||||
'users'=>array('*'),
|
||||
),
|
||||
@ -114,10 +110,9 @@ class CandidatoController extends Controller
|
||||
if (isset($_POST['Candidato'])) {
|
||||
$model->attributes=$_POST['Candidato'];
|
||||
$foto=CUploadedFile::getInstance($model,'foto');
|
||||
|
||||
if ($model->validate()) {
|
||||
$foundInvalidChild = false;
|
||||
|
||||
|
||||
$foundInvalidChild = false;
|
||||
if ($model->validate()) {
|
||||
if (!MultiModelForm::validate($model, $idiomasValidos, $idiomasBorrados))
|
||||
$foundInvalidChild = true;
|
||||
|
||||
@ -133,7 +128,9 @@ class CandidatoController extends Controller
|
||||
{
|
||||
$this->guardarFoto($model->id, $foto);
|
||||
Yii::app()->user->setFlash('success', "Candidato dado de alta correctamente.");
|
||||
$this->redirect(array('index'));
|
||||
$url=$this->createUrl('index', array('id' => $model->id));
|
||||
//$this->redirect(array('index'));
|
||||
$this->redirect($url);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -211,9 +208,34 @@ class CandidatoController extends Controller
|
||||
}
|
||||
}*/
|
||||
|
||||
if(isset($_POST['Candidato'])) {
|
||||
$foto=CUploadedFile::getInstance($model,'foto');
|
||||
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 actualizado correctamente.");
|
||||
$this->redirect(array('index'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*if(isset($_POST['Candidato'])) {
|
||||
|
||||
//the value for the foreign key 'candidato_id'
|
||||
$masterValues = array ('candidato_id'=>$model->id);
|
||||
@ -224,12 +246,14 @@ class CandidatoController extends Controller
|
||||
Yii::app()->user->setFlash('success', "Candidato actualizado correctamente.");
|
||||
//$this->redirect(array('view','id'=>$model->id));
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
$this->render('update',array(
|
||||
'model'=>$model,
|
||||
'idioma'=>$idioma,
|
||||
'validatedIdiomas'=>$validatedIdiomas,
|
||||
'titulacion'=>$titulacion,
|
||||
'idiomasValidos'=>$idiomasValidos,
|
||||
'titulacionesValidas'=>$titulacionesValidas,
|
||||
));
|
||||
}
|
||||
|
||||
@ -257,85 +281,14 @@ class CandidatoController extends Controller
|
||||
/**
|
||||
* Lists all models.
|
||||
*/
|
||||
public function actionIndex()
|
||||
public function actionIndex($id)
|
||||
{
|
||||
$model=new Candidato('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
/*$columns = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'nombreApellidos',
|
||||
'value' => 'CHtml::link(CHtml::encode($data->nombreApellidos), array("update", "id"=>$data->id));',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head0 sorting',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'estado',
|
||||
'value' => 'CHtml::link(CHtml::encode($data->estado), "#", array("class" => $data->cssClassEstado));',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head1 sorting',
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'id',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head0 sorting',
|
||||
),
|
||||
),
|
||||
array(
|
||||
'name' => 'fecha_modificacion',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head1 sorting',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
$sortableColumnNamesArray = array('estado', 'id', 'nombre');
|
||||
|
||||
$criteria = new CDbCriteria;
|
||||
// bro-tip: $_REQUEST is like $_GET and $_POST combined
|
||||
if (isset($_REQUEST['sSearch']) && isset($_REQUEST['sSearch']{0})) {
|
||||
// use operator ILIKE if using PostgreSQL to get case insensitive search
|
||||
$criteria->addSearchCondition('nombre', $_REQUEST['sSearch'], true, 'AND', 'LIKE');
|
||||
}
|
||||
|
||||
$sort = new EDTSort('Candidato', $sortableColumnNamesArray);
|
||||
$sort->defaultOrder = 'id';
|
||||
$pagination = new EDTPagination();
|
||||
|
||||
$dataProvider = new CActiveDataProvider('Candidato', array(
|
||||
'criteria' => $criteria,
|
||||
'pagination' => $pagination,
|
||||
'sort' => $sort,
|
||||
)) ;
|
||||
|
||||
$widget=$this->createWidget('ext.EDataTables.EDataTables', array(
|
||||
'id' => 'candidato-grid',
|
||||
'dataProvider' => $dataProvider,
|
||||
'cssFile' => Yii::app()->baseUrl . '/css/gridview.css',
|
||||
'ajaxUrl' => Yii::app()->createUrl('/candidato/index'),
|
||||
'filter' => Candidato::model(),
|
||||
'filterPosition'=> 'footer',
|
||||
'columns' => $columns,
|
||||
)); */
|
||||
|
||||
/*if(isset($_GET['Candidato']))
|
||||
if(isset($_GET['Candidato']))
|
||||
$model->attributes=$_GET['Candidato'];
|
||||
|
||||
if (!Yii::app()->getRequest()->getIsAjaxRequest()) {
|
||||
$this->render('index',array(
|
||||
'model'=>$model,
|
||||
'widget' => $widget,
|
||||
));
|
||||
return;
|
||||
} else {
|
||||
echo json_encode($widget->getFormattedData(intval($_REQUEST['sEcho'])));
|
||||
Yii::app()->end();
|
||||
}*/
|
||||
|
||||
$this->render('index',array(
|
||||
'model'=>$model));
|
||||
}
|
||||
|
||||
@ -122,11 +122,12 @@ class UsuarioController extends Controller
|
||||
{
|
||||
$model=new Usuario('search');
|
||||
$model->unsetAttributes(); // clear any default values
|
||||
|
||||
if(isset($_GET['Usuario']))
|
||||
$model->attributes=$_GET['Usuario'];
|
||||
|
||||
$this->render('index',array(
|
||||
'model'=>$model,
|
||||
'model'=>$model,
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@ -18,9 +18,9 @@ class PageSize extends CWidget
|
||||
Yii::app()->user->setState('pageSize', $this->mPageSize);
|
||||
|
||||
$this->mPageSize = null == $this->mPageSize ? $this->mDefPageSize : $this->mPageSize;
|
||||
|
||||
echo Yii::t('pagesize', 'Mostrar ');
|
||||
echo CHtml::dropDownList('pageSize', $this->mPageSize, $this->mPageSizeOptions,array(
|
||||
|
||||
echo Yii::t('pagesize', 'Mostrar ');
|
||||
echo CHtml::dropDownList('pageSize', $this->mPageSize, $this->mPageSizeOptions, array(
|
||||
'onchange'=>"$.fn.yiiGridView.update('$this->mGridId',{ data:{pageSize: $(this).val() }})",
|
||||
));
|
||||
echo Yii::t('pagesize', ' registros');
|
||||
|
||||
162
www/protected/extensions/SelGridView.php
Normal file
162
www/protected/extensions/SelGridView.php
Normal file
@ -0,0 +1,162 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* SelGridView class file.
|
||||
* @author Vitaliy Potapov <noginsk@rambler.ru>
|
||||
*/
|
||||
|
||||
Yii::import('zii.widgets.grid.CGridView');
|
||||
|
||||
/**
|
||||
* SelGridView v1.1
|
||||
*
|
||||
* SelGridView remembers selected rows of gridview when sorting or navigating by pages. Also it can select particular rows by GET param when page is loading
|
||||
*
|
||||
* Usage:
|
||||
* Just put this file to extensions directory, create widget as usual and enjoy
|
||||
*
|
||||
* <pre>
|
||||
* $this->widget('application.extensions.SelGridView', array(
|
||||
* ...
|
||||
* ));
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
class SelGridView extends CGridView
|
||||
{
|
||||
/**
|
||||
* GET param name to pass selected row(s)
|
||||
*
|
||||
* @var mixed
|
||||
*/
|
||||
public $selVar;
|
||||
|
||||
/**
|
||||
* Creates column objects and initializes them.
|
||||
* Automatically add hidden checkbox column.
|
||||
*/
|
||||
protected function initColumns()
|
||||
{
|
||||
parent::initColumns();
|
||||
|
||||
if($this->selectableRows == 0) return;
|
||||
|
||||
if(empty($this->selVar)) {
|
||||
$this->selVar = $this->dataProvider->getId().'_sel';
|
||||
}
|
||||
|
||||
//if gridview already has user defined Checkbox column --> exit
|
||||
foreach($this->columns as $col) {
|
||||
if($col instanceof CCheckBoxColumn) return;
|
||||
}
|
||||
|
||||
if($this->dataProvider instanceOf CActiveDataProvider) {
|
||||
$primaryKey = '$data->primaryKey';
|
||||
} elseif($this->dataProvider instanceOf CArrayDataProvider) {
|
||||
$primaryKey = '$data["'.$this->dataProvider->keyField.'"]';
|
||||
} else {
|
||||
throw new CException('Unsupported DataProvider!');
|
||||
}
|
||||
|
||||
//creating hidden checkbox column
|
||||
$checkboxColumn = new CCheckBoxColumn($this);
|
||||
$checkboxColumn->checked = 'isset($_GET["'.$this->selVar.'"]) ? in_array('.$primaryKey.', is_array($_GET["'.$this->selVar.'"]) ? $_GET["'.$this->selVar.'"] : array($_GET["'.$this->selVar.'"])) : false;';
|
||||
$checkboxColumn->htmlOptions = array('style'=>'display:none');
|
||||
$checkboxColumn->headerHtmlOptions = array('style'=>'display:none');
|
||||
$checkboxColumn->init();
|
||||
|
||||
$this->columns[] = $checkboxColumn;
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers necessary client scripts.
|
||||
* Automaticlly prepend user's beforeajaxUpdate with needed code that will modify GET params when navigating and sorting
|
||||
*/
|
||||
public function registerClientScript()
|
||||
{
|
||||
if($this->selectableRows > 0) $this->applyBeforeAjaxUpdate();
|
||||
parent::registerClientScript();
|
||||
}
|
||||
|
||||
/**
|
||||
* prepending user's beforeajaxUpdate with needed code
|
||||
*
|
||||
*/
|
||||
protected function applyBeforeAjaxUpdate()
|
||||
{
|
||||
$funcChangeQuery = '
|
||||
function(id, options) {
|
||||
if(this.selectableRows == 0) return;
|
||||
|
||||
//all GET params in current url
|
||||
var params = $.deparam.querystring(options.url);
|
||||
|
||||
//GET param named "{ModelClass}_sel" showing selected rows in whole grid (not only current page)
|
||||
var selVar = "'.$this->selVar.'";
|
||||
var checkedInQuery = (params[selVar]) ? params[selVar] : [];
|
||||
if(!$.isArray(checkedInQuery)) checkedInQuery = [checkedInQuery];
|
||||
|
||||
//rows selected on current page
|
||||
var checkedInPage = $.fn.yiiGridView.getSelection(id);
|
||||
|
||||
//if only one row can be selected - logic is simple: if any row selected on current page, clear all previously selected
|
||||
if(this.selectableRows == 1) {
|
||||
if(!checkedInPage.length) return;
|
||||
params[selVar] = checkedInPage;
|
||||
options.url = $.param.querystring(options.url, params);
|
||||
return;
|
||||
}
|
||||
|
||||
//iterating all keys of this page
|
||||
$("#"+id).find(".keys span").each(function (i) {
|
||||
var key = $(this).text();
|
||||
|
||||
//row found in GET params
|
||||
var indexInQuery = $.inArray(key, checkedInQuery);
|
||||
|
||||
//row is checked on current page
|
||||
var indexInChecked = $.inArray(key, checkedInPage);
|
||||
|
||||
//row is selected and not in GET params --> adding to GET params
|
||||
if(indexInChecked >= 0 && indexInQuery == -1) {
|
||||
checkedInQuery.push(key);
|
||||
}
|
||||
|
||||
//row not selected, but in GET params due to selected previously --> deleting from GET params
|
||||
if(indexInChecked == -1 && indexInQuery >= 0) {
|
||||
delete checkedInQuery[indexInQuery];
|
||||
}
|
||||
});
|
||||
|
||||
if(!checkedInQuery) {
|
||||
if(params[selVar]) delete params[selVar];
|
||||
} else {
|
||||
params[selVar] = checkedInQuery;
|
||||
}
|
||||
|
||||
options.url = $.param.querystring( options.url, params);
|
||||
}
|
||||
';
|
||||
|
||||
if(empty($this->beforeAjaxUpdate)) {
|
||||
//no user defined ajaxUpdate handler. Simply use SelGridView's
|
||||
$this->beforeAjaxUpdate = $funcChangeQuery;
|
||||
} else {
|
||||
|
||||
//beforeAjaxUpdate = function or direct JS code
|
||||
if(preg_match('/(function.+\})/is', $this->beforeAjaxUpdate, $matches)) {
|
||||
$userScript = '('.$matches[0].')(id, options);';
|
||||
} else {
|
||||
$userScript = $this->beforeAjaxUpdate;
|
||||
}
|
||||
|
||||
//merge to one beforeAjaxUpdate function
|
||||
$this->beforeAjaxUpdate = '
|
||||
function(id, options) {
|
||||
('.$funcChangeQuery.')(id, options);
|
||||
'.$userScript.'
|
||||
}
|
||||
';
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -96,6 +96,7 @@ class Candidato extends CActiveRecord
|
||||
return array(
|
||||
array('nombre, apellidos', 'required'),
|
||||
array('email', 'unique'),
|
||||
array('email', 'email'),
|
||||
array('foto', 'file',
|
||||
'types'=>'jpg',
|
||||
'maxSize'=>1024 * 1024 * 1, // 1MB como máximo
|
||||
@ -156,28 +157,33 @@ class Candidato extends CActiveRecord
|
||||
*/
|
||||
public function search()
|
||||
{
|
||||
// Warning: Please modify the following code to remove attributes that
|
||||
// should not be searched.
|
||||
// Warning: Please modify the following code to remove attributes that
|
||||
// should not be searched.
|
||||
|
||||
$criteria=new CDbCriteria;
|
||||
$criteria=new CDbCriteria;
|
||||
|
||||
$criteria->compare('id',$this->id);
|
||||
$criteria->compare('estado',$this->estado,true);
|
||||
$criteria->compare('dni',$this->dni,true);
|
||||
$criteria->compare('nombre',$this->nombre,true);
|
||||
$criteria->compare('apellidos',$this->apellidos,true);
|
||||
$criteria->compare('email',$this->email,true);
|
||||
$criteria->compare('telefono_fijo',$this->telefono_fijo,true);
|
||||
$criteria->compare('telefono_movil',$this->telefono_movil,true);
|
||||
$criteria->compare('sexo',$this->sexo,true);
|
||||
$criteria->compare('fecha_nacimiento',$this->fecha_nacimiento,true);
|
||||
$criteria->compare('lugar_nacimiento',$this->lugar_nacimiento,true);
|
||||
$criteria->compare('id',$this->id);
|
||||
$criteria->compare('estado',$this->estado,true);
|
||||
$criteria->compare('dni',$this->dni,true);
|
||||
$criteria->compare('nombre',$this->nombre,true);
|
||||
$criteria->compare('apellidos',$this->apellidos,true);
|
||||
$criteria->compare('email',$this->email,true);
|
||||
$criteria->compare('telefono_fijo',$this->telefono_fijo,true);
|
||||
$criteria->compare('telefono_movil',$this->telefono_movil,true);
|
||||
$criteria->compare('sexo',$this->sexo,true);
|
||||
$criteria->compare('fecha_nacimiento',$this->fecha_nacimiento,true);
|
||||
$criteria->compare('lugar_nacimiento',$this->lugar_nacimiento,true);
|
||||
|
||||
//$criteria->compare('nombreApellidos',$this->nombreApellidos,true);
|
||||
//$criteria->compare('nombreApellidos',$this->nombreApellidos,true);
|
||||
|
||||
$sort = new CSort;
|
||||
$sort->defaultOrder = 'nombre, apellidos ASC';
|
||||
|
||||
return new CActiveDataProvider($this, array(
|
||||
'criteria' => $criteria,
|
||||
'sort' => $sort,
|
||||
));
|
||||
|
||||
return new CActiveDataProvider($this, array(
|
||||
'criteria'=>$criteria,
|
||||
));
|
||||
}
|
||||
|
||||
protected function beforeValidate() {
|
||||
|
||||
@ -9,8 +9,15 @@ $this->menu=array(
|
||||
'url'=>array('create'),
|
||||
'linkOptions'=>array('class'=>'iconlink'),
|
||||
),
|
||||
array(
|
||||
'label'=>'<img class="mgright5" alt="' . Yii::t('intranet', 'Búsqueda avanzada') . '" src="' . Yii::app()->baseUrl . '/images/icons/small/white/search.png"/>' . Yii::t('intranet', 'Búsqueda avanzada'),
|
||||
'url'=>array('#'),
|
||||
'linkOptions'=>array('class'=>'iconlink search-button'),
|
||||
),
|
||||
);
|
||||
|
||||
$this->pageTitle=Yii::t('intranet', 'Gestión de candidatos');
|
||||
|
||||
Yii::app()->clientScript->registerScript('search', "
|
||||
$('.search-button').click(function(){
|
||||
$('.search-form').toggle();
|
||||
@ -24,119 +31,119 @@ $('.search-form form').submit(function(){
|
||||
});
|
||||
");
|
||||
|
||||
$this->pageTitle=Yii::t('intranet', '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.
|
||||
</p>
|
||||
|
||||
<?php echo CHtml::link('Advanced Search','#',array('class'=>'search-button')); ?>
|
||||
<div class="search-form" style="display:none">
|
||||
<?php $this->renderPartial('_search',array(
|
||||
'model'=>$model,
|
||||
)); ?>
|
||||
</div><!-- search-form -->
|
||||
</div>
|
||||
<div class="clear"></div>
|
||||
|
||||
<?php /*$this->widget('ext.EDataTables.EDataTables', array(
|
||||
'id' => 'candidatos',
|
||||
'options' => array(
|
||||
'class' => 'dataTables_wrapper',
|
||||
|
||||
<div class="dataTables_wrapper">
|
||||
<div class="top">
|
||||
<div class="dataTables_length">
|
||||
<?php
|
||||
$this->widget('application.extensions.PageSize.PageSize', array(
|
||||
'mGridId' => 'candidato-grid',
|
||||
'mPageSize' => @$_GET['pageSize'],
|
||||
'mDefPageSize' => Yii::app()->params['defaultPageSize'],
|
||||
'mPageSizeOptions' => Yii::app()->params['pageSizeOptions'],
|
||||
));
|
||||
?>
|
||||
</div>
|
||||
|
||||
<div class="dataTables_filter">
|
||||
<label>Buscar: <input type="text"></label>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$columns = array(
|
||||
/*array(
|
||||
'type' => 'html',
|
||||
'name' => 'nombreApellidos',
|
||||
'value' => 'CHtml::link(CHtml::encode($data->nombreApellidos), array("update", "id"=>$data->id));',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head0 sorting',
|
||||
),
|
||||
),*/
|
||||
array(
|
||||
'name' => 'id',
|
||||
'headerHtmlOptions'=>array(
|
||||
'style' => 'width:35px;',
|
||||
'class' => 'head0 sorting',
|
||||
/*'colspan' => '1',
|
||||
'rowspan' => '1',*/
|
||||
),
|
||||
'dataProvider' => $model->search(),
|
||||
//'ajaxUrl' => Yii::app()->getBaseUrl().'/candidato/index',
|
||||
'columns'=>array(
|
||||
'id',
|
||||
'foto',
|
||||
'dni',
|
||||
'nombre',
|
||||
'apellidos',
|
||||
'email',
|
||||
)));*/
|
||||
|
||||
|
||||
//$widget->run();
|
||||
|
||||
$columns = array(
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'nombreApellidos',
|
||||
'value' => 'CHtml::link(CHtml::encode($data->nombreApellidos), array("update", "id"=>$data->id));',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head0 sorting',
|
||||
/*'colspan' => '1',
|
||||
'rowspan' => '2',*/
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'estado',
|
||||
'value' => 'CHtml::link(CHtml::encode($data->estado), "#", array("class" => $data->cssClassEstado));',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head1 sorting',
|
||||
/*'colspan' => '1',
|
||||
'rowspan' => '2',*/
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'nombre',
|
||||
'value' => 'CHtml::link(CHtml::encode($data->nombre), array("update", "id"=>$data->id));',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head1 sorting',
|
||||
/*'colspan' => '1',
|
||||
'rowspan' => '2',*/
|
||||
),
|
||||
),
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'apellidos',
|
||||
'value' => 'CHtml::link(CHtml::encode($data->apellidos), array("update", "id"=>$data->id));',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head0 sorting',
|
||||
/*'colspan' => '1',
|
||||
'rowspan' => '2',*/
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
array(
|
||||
'name' => 'id',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head0 sorting',
|
||||
/*'colspan' => '1',
|
||||
'rowspan' => '1',*/
|
||||
array(
|
||||
'type' => 'html',
|
||||
'name' => 'estado',
|
||||
'value' => 'CHtml::link(CHtml::encode($data->estado), "#", array("class" => $data->cssClassEstado));',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head1 sorting',
|
||||
/*'colspan' => '1',
|
||||
'rowspan' => '2',*/
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'name' => 'fecha_modificacion',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head1 sorting',
|
||||
/*'colspan' => '1',
|
||||
'rowspan' => '2',*/
|
||||
array(
|
||||
'name' => 'fecha_modificacion',
|
||||
'headerHtmlOptions'=>array(
|
||||
'class' => 'head1 sorting',
|
||||
/*'colspan' => '1',
|
||||
'rowspan' => '2',*/
|
||||
),
|
||||
),
|
||||
),
|
||||
array(
|
||||
'class'=>'CButtonColumn',
|
||||
//'template'=>'{update}{delete}',
|
||||
//'updateButtonUrl'=>'Yii::app()->createUrl("/candidato/update", array("id" => $data["id"]))',
|
||||
//'deleteButtonUrl'=>'Yii::app()->createUrl("/candidato/delete", array("id" => $data["id"]))',
|
||||
),
|
||||
);
|
||||
array(
|
||||
'class'=>'CButtonColumn',
|
||||
//'template'=>'{update}{delete}',
|
||||
//'updateButtonUrl'=>'Yii::app()->createUrl("/candidato/update", array("id" => $data["id"]))',
|
||||
//'deleteButtonUrl'=>'Yii::app()->createUrl("/candidato/delete", array("id" => $data["id"]))',
|
||||
),
|
||||
);
|
||||
|
||||
$dataProvider = $model->search();
|
||||
$pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']);
|
||||
$dataProvider->getPagination()->setPageSize($pageSize);
|
||||
|
||||
$this->widget('application.extensions.SelGridView', array(
|
||||
'id'=>'candidato-grid',
|
||||
'dataProvider'=>$dataProvider,
|
||||
'columns'=>$columns,
|
||||
'filter'=>$model,
|
||||
'filterPosition' => 'footer',
|
||||
'cssFile' => Yii::app()->baseUrl . '/css/gridview2.css',
|
||||
'itemsCssClass' => 'display',
|
||||
'pagerCssClass' => 'dataTables_paginate',
|
||||
'template' => '{items}{summary}{pager}',
|
||||
'emptyText' => Yii::t('intranet', 'No hay candidatos'),
|
||||
'summaryCssClass' => 'dataTables_info',
|
||||
'summaryText' => 'Mostrando registros del {start} al {end} de {count} en total.',
|
||||
'selectableRows' => 1,
|
||||
));
|
||||
?>
|
||||
|
||||
|
||||
$this->widget('zii.widgets.grid.CGridView', array(
|
||||
'id'=>'candidato-grid',
|
||||
'dataProvider'=>$model->search(),
|
||||
'filter'=>$model,
|
||||
'cssFile' => Yii::app()->baseUrl . '/css/gridview2.css',
|
||||
'itemsCssClass' => 'display',
|
||||
'summaryCssClass' => 'dataTables_length',
|
||||
'pagerCssClass' => 'ui-toolbar dataTables_paginate',
|
||||
'htmlOptions' => array(
|
||||
'class' => 'dataTables_wrapper',
|
||||
),
|
||||
'filterPosition' => 'footer',
|
||||
'emptyText' => Yii::t('intranet', 'No hay candidatos'),
|
||||
'summaryText' => 'Mostrando registros del {start} al {end} de {count} en total.',
|
||||
'columns'=>$columns,
|
||||
));
|
||||
|
||||
echo "<br/><br/><br/><br/>";
|
||||
|
||||
$this->widget('ext.EDataTables.EDataTables', array(
|
||||
'id' => 'candidato-grid2',
|
||||
'dataProvider' => $model->search(),
|
||||
'cssFile' => Yii::app()->baseUrl . '/css/gridview.css',
|
||||
'ajaxUrl' => Yii::app()->createUrl('/candidato/index'),
|
||||
'columns' => $columns,
|
||||
'filter' => Candidato::model(),
|
||||
'filterPosition'=> 'footer',
|
||||
|
||||
//'hasFooter' => true,
|
||||
));
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
@ -37,18 +37,13 @@ $('.search-form form').submit(function(){
|
||||
");
|
||||
|
||||
?>
|
||||
|
||||
<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.
|
||||
</p>
|
||||
|
||||
<div class="search-form" style="display:none">
|
||||
<?php $this->renderPartial('_search',array(
|
||||
'model'=>$model,
|
||||
)); ?>
|
||||
<?php $this->renderPartial('_search',array(
|
||||
'model'=>$model,
|
||||
)); ?>
|
||||
</div>
|
||||
|
||||
<div class="clear"></div>
|
||||
|
||||
<div class="dataTables_wrapper">
|
||||
<div class="top">
|
||||
@ -111,22 +106,23 @@ or <b>=</b>) at the beginning of each of your search values to specify how the c
|
||||
);
|
||||
|
||||
$dataProvider = $model->search();
|
||||
$pageSize = Yii::app()->user->getState('pageSize',10/*Yii::app()->params['defaultPageSize']*/);
|
||||
$dataProvider->getPagination()->setPageSize($pageSize);
|
||||
$pageSize = Yii::app()->user->getState('pageSize', Yii::app()->params['defaultPageSize']);
|
||||
$dataProvider->getPagination()->setPageSize($pageSize);
|
||||
|
||||
$this->widget('zii.widgets.grid.CGridView', array(
|
||||
$this->widget('application.extensions.SelGridView', array(
|
||||
'id'=>'usuario-grid',
|
||||
'dataProvider'=>$dataProvider,
|
||||
'columns'=>$columns,
|
||||
'filter'=>$model,
|
||||
'filterPosition' => 'footer',
|
||||
'cssFile' => Yii::app()->baseUrl . '/css/gridview2.css',
|
||||
'itemsCssClass' => 'display',
|
||||
'summaryCssClass' => 'dataTables_info',
|
||||
'itemsCssClass' => 'display',
|
||||
'pagerCssClass' => 'dataTables_paginate',
|
||||
'template' => '{items}{summary}{pager}',
|
||||
'emptyText' => Yii::t('intranet', 'No hay candidatos'),
|
||||
'emptyText' => Yii::t('intranet', 'No hay usuarios'),
|
||||
'summaryCssClass' => 'dataTables_info',
|
||||
'summaryText' => 'Mostrando registros del {start} al {end} de {count} en total.',
|
||||
'columns'=>$columns,
|
||||
'selectableRows' => 1,
|
||||
));
|
||||
?>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user