/* @var $dataProvider CActiveDataProvider */ $this->breadcrumbs = array('Conductores' => array('index'), $model->IdConductor); //$this->menu=$this->verPermisosMenuOperaciones(); ?> <?php /* echo TbHtml::linkButton('Crear Registro', array('color' => TbHtml::BUTTON_COLOR_PRIMARY, 'method' => 'post', 'submit' => array ('conductor/create'), ));*/ ?> <div class="panel panel-primary"> <div class="panel-heading"> <h3 class="panel-title">Conductores</h3> </div> <div class=" panel-body"> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'usuarios-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'columns' => array(array('name' => 'IdConductor', 'htmlOptions' => array('width' => '50')), array('name' => 'NumeroDocumento', 'htmlOptions' => array('width' => '50', 'align' => 'right'), 'value' => function ($model) { return Yii::app()->format->formatNumber($model->NumeroDocumento); }), array('name' => 'PrimerNombre', 'htmlOptions' => array('width' => '50')), array('name' => 'SegundoNombre', 'htmlOptions' => array('width' => '50')), array('name' => 'PrimerApellido', 'htmlOptions' => array('width' => '50')), array('name' => 'SegundoApellido', 'htmlOptions' => array('width' => '100')), array('name' => 'EmailConductor', 'htmlOptions' => array('width' => '100')), array('name' => 'Telefono1', 'htmlOptions' => array('width' => '100')), array('name' => 'Telefono2', 'htmlOptions' => array('width' => '100')), 'IdEstadoRegistro' => array('name' => 'IdEstadoRegistro', 'htmlOptions' => array('width' => '80'), 'value' => function ($model) { return EstadosRegistro::getNombreEstado($model->IdEstadoRegistro); }, 'filter' => CHtml::listData(EstadosRegistro::model()->findAll(array('order' => 'NombreEstadoRegistro')), 'IdEstadoRegistro', 'NombreEstadoRegistro'))))); ?> </div> </div>
?> <title><?php echo Yii::app()->controller->module->getName() . " >> " . $this->pageTitle; ?> </title> <?php $this->widget('zii.widgets.CBreadcrumbs', array('links' => $this->breadcrumbs, 'htmlOptions' => array('class' => 'breadcrumb'))); ?> <div class="page-header"> <h1>Catálogo Usuarios </h1> </div> <?php echo TbHtml::linkButton('Crear Registro', array('color' => TbHtml::BUTTON_COLOR_PRIMARY, 'method' => 'post', 'submit' => array('usuarios/create'))); ?> <br /><br /> <?php $this->widget('zii.widgets.grid.CGridView', array('id' => 'usuarios-grid', 'dataProvider' => $model->search(), 'filter' => $model, 'summaryText' => "Mostrando {start} – {end} de {count} resultados", 'pager' => array('header' => 'Ir a la pagina:', 'firstPageLabel' => '< <', 'prevPageLabel' => 'Anterior', 'nextPageLabel' => 'Siguiente', 'lastPageLabel' => '>>'), 'htmlOptions' => array('style' => 'word-wrap:break-word; width:1250px; font-family:"Times New Roman"'), 'columns' => array(array('name' => 'IdUsuario', 'htmlOptions' => array('width' => '50')), array('name' => 'username', 'htmlOptions' => array('width' => '50')), array('name' => 'NumeroDocumento', 'htmlOptions' => array('width' => '50', 'align' => 'right'), 'value' => function ($model) { return Yii::app()->format->formatNumber($model->NumeroDocumento); }), array('name' => 'PrimerNombre', 'htmlOptions' => array('width' => '50')), array('name' => 'SegundoNombre', 'htmlOptions' => array('width' => '50')), array('name' => 'PrimerApellido', 'htmlOptions' => array('width' => '50')), array('name' => 'SegundoApellido', 'htmlOptions' => array('width' => '100')), array('name' => 'EmailUsuario', 'htmlOptions' => array('width' => '100')), 'IdRol' => array('name' => 'IdRol', 'htmlOptions' => array('width' => '100'), 'value' => function ($model) { return Roles::getNombreRol($model->IdRol); }, 'filter' => CHtml::listData(Roles::model()->findAll(array('order' => 'NombreRol')), 'IdRol', 'NombreRol')), 'IdEstadoRegistro' => array('name' => 'IdEstadoRegistro', 'htmlOptions' => array('width' => '80'), 'value' => function ($model) { return EstadosRegistro::getNombreEstado($model->IdEstadoRegistro); }, 'filter' => CHtml::listData(EstadosRegistro::model()->findAll(array('order' => 'NombreEstadoRegistro')), 'IdEstadoRegistro', 'NombreEstadoRegistro')), array('class' => 'CButtonColumn', 'htmlOptions' => array('width' => '120')))));
/** * 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 $id the ID of the model to be loaded * @return EstadosRegistro the loaded model * @throws CHttpException */ public function loadModel($id) { $model = EstadosRegistro::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public static function getNombreEstado($_Id) { $elNombreEstadoRegistro = ''; $criteria = new CDbCriteria(); $criteria->select = 'NombreEstadoRegistro'; // seleccionar solo la columna 'title' $criteria->condition = 'IdEstadoRegistro=:Id'; $criteria->params = array(':Id' => $_Id); $elEstadoRegistro = EstadosRegistro::model()->find($criteria); // $params no es necesario if ($elEstadoRegistro != null) { $elNombreEstadoRegistro = $elEstadoRegistro->NombreEstadoRegistro; } return $elNombreEstadoRegistro; }