/** * 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, $modelClass = __CLASS__) { $model = ContactoTelefonico::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
<h4 class="widget-title"><i class="aweso-phone"></i> <?php echo 'Telefono'; ?> </h4> <!-- widget action, you can also use btn, btn-group, nav-tabs or nav-pills (also support dropdown). enjoy! --> <div class="widget-action"> <button data-toggle="collapse" data-collapse="#widget-telefono" class="btn"> <i class="aweso-chevron-up color-amber" data-toggle-icon="aweso-chevron-down aweso-chevron-up"></i> </button> </div> </div><!-- /widget header --> <div class="widget-content form bg-white"> <div style='overflow:auto'> <?php $modelTelefono = new ContactoTelefonico(); $telefeno = $modelTelefono->model()->activos()->de_empleado($model->id)->count(); ?> <div id="div-contacto-telefonico-grid" style="<?php echo !$telefeno ? 'display: none;' : ''; ?> "> <?php //$this->widget('bootstrap.widgets.TbGridView',array( $this->widget('ext.selgridview.BootSelGridView', array('id' => 'contacto-telefonico-grid', 'type' => 'striped bordered hover advance condensed', 'template' => '{summary}{items}{pager}', 'dataProvider' => $modelTelefono->model()->activos()->de_empleado($model->id)->search(), 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'columns' => array('numero', array('name' => 'tipo', 'filter' => array('FIJO' => 'FIJO', 'CELULAR' => 'CELULAR')), array('name' => 'principlal', 'filter' => array('SI' => 'SI', 'NO' => 'NO')), array('name' => 'estado', 'filter' => array('ACTIVO' => 'ACTIVO', 'INACTIVO' => 'INACTIVO')), array('class' => 'CButtonColumn', 'template' => '{update} {delete}', 'deleteConfirmation' => CrugeTranslator::t('admin', 'Are you sure you want to delete this user'), 'buttons' => array('update' => array('label' => '<button class="btn btn-info"><i class="aweso-pencil"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'Update')), 'url' => '"personal/contactoTelefonico/update/id/".$data->id', 'click' => 'function(e){e.preventDefault(); viewModal($(this).attr("href"),false,function() {maskAttributes();}); return false; }', 'imageUrl' => false), 'delete' => array('label' => '<button class="btn btn-danger"><i class="aweso-trash"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'Delete')), 'url' => 'array("contactoTelefonico/delete","id"=>$data->getPrimaryKey())', 'imageUrl' => false)), 'htmlOptions' => array('width' => '80px'))))); ?> </div> <?php $this->widget('bootstrap.widgets.TbButton', array('id' => 'add-Telefonos', 'label' => $telefeno ? 'Teléfonos' : '<h3>Teléfonos</h3>', 'encodeLabel' => false, 'icon' => $telefeno ? 'plus-sign' : 'phone', 'htmlOptions' => array('onClick' => 'viewModal("personal/contactoTelefonico/create/idEmpleado/' . $model->id . '",false,function(){' . 'maskAttributes();})', 'class' => $telefeno ? '' : 'empty-portlet'))); ?> </div>