if ($modelEmpleado != null) { $modelEmpleado = Empleado::model()->findByPk($modelEmpleado->empleado_id); $array[0] = $modelEmpleado; $modelEmpleado = $array; } } // } else { // $modelEmpleado = Empleado::model()->findAll(); //// $model->seccion // } // die(var_dump($modelEmpleado)); echo $form->select2Row($model, 'entidad_id', array('asDropDownList' => true, 'data' => !empty($modelEmpleado) ? array('' => ' -- Seleccione -- ') + CHtml::listData($modelEmpleado, 'id', 'nombre_completo') : array('' => ' -- Seleccione -- '), 'options' => array('placeholder' => !empty($modelEmpleado) ? '-- Seleccione --' : '-- Nadie Esta A Cargo de ti --'))); ?> <?php // if ($model->isNewRecord) { $modelEmpleado = EmpleadoSubalterno::model()->find('subalterno_id=:idEmpleado', array(':idEmpleado' => $model->entidad_tipo)); if (Yii::app()->user->id == 1 && $modelEmpleado == null) { $modelEmpleado = Empleado::model()->activos()->findAll(); } else { if ($modelEmpleado != null) { $modelEmpleado = Empleado::model()->findByPk($modelEmpleado->empleado_id); $array[0] = $modelEmpleado; $modelEmpleado = $array; } } // } else { // $modelEmpleado = Empleado::model()->findAll(); //// $model->seccion // } // die(var_dump($modelEmpleado)); echo $form->select2Row($model, 'entidad_tipo', array('asDropDownList' => true, 'data' => !empty($modelEmpleado) ? array('' => ' -- Seleccione -- ') + CHtml::listData($modelEmpleado, 'id', 'nombre_completo') : array('' => ' -- Seleccione -- '), 'options' => array('placeholder' => !empty($modelEmpleado) ? '-- Seleccione --' : '-- Nadie Esta A Cargo de ti --')));
<?php /** @var EmpleadoSubalternoController $this */ /** @var EmpleadoSubalterno $model */ $this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('app', $model->id) => array('view', 'id' => $model->id), Yii::t('AweCrud.app', 'Update')); $this->header = '<i class="aweso-pencil aweso-2x"></i> ' . Yii::t('AweCrud.app', 'Update') . ' ' . EmpleadoSubalterno::label(); $this->menu = array(array('label' => Yii::t('AweCrud.app', 'Delete'), 'icon' => 'trash', 'url' => '#', 'linkOptions' => array('submit' => array('delete', 'id' => $model->id), 'confirm' => Yii::t('AweCrud.app', 'Are you sure you want to delete this item?'))), array('label' => Yii::t('AweCrud.app', 'Manage'), 'icon' => 'list-alt', 'url' => array('admin'))); ?> <fieldset> <?php echo $this->renderPartial('_form', array('model' => $model)); ?> </fieldset>
/** * 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 = EmpleadoSubalterno::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
/** * Carga archivos a carpeta tmp * @autor * @throws CHttpException */ public function actionSubAlternos($id) { $model = Empleado::model()->findByPk($id); $result = array(); $validadorPartial = false; if (Yii::app()->request->isAjaxRequest) { if (isset($_POST['EmpleadosSubalterno'])) { $idsEmpleados = $_POST['EmpleadosSubalterno']; $result['success'] = true; $transaccion = Yii::app()->db->beginTransaction(); foreach ($idsEmpleados as $idSub) { $subalterno = new EmpleadoSubalterno(); $subalterno->empleado_id = $id; $subalterno->subalterno_id = $idSub; ActividadSistema::registrarActividad($model, ActividadSistema::TIPO_RESTORE, Yii::app()->user->id, $idSub); $asignadonuevo = $model->userid; if ($asignadonuevo != Yii::app()->user->id) { Notificacion::registrarAlertaA($model, Notificacion::ASIGNADO); } $result['success'] = $result['success'] && $subalterno->save(); } if ($result['success']) { $transaccion->commit(); } else { $transaccion->rollback(); } $validadorPartial = TRUE; echo json_encode($result); } if (!$validadorPartial) { $this->renderPartial('_adminEmpleadosSubAlternos', array('model' => $model), false, true); } } }
<?php // echo $form->textField($model, 'nombre', array('maxlength' => 64)) ?> <?php // echo $form->error($model, 'nombre') ?> </div> </div>--> <?php ?> <?php // if ($model->isNewRecord) { $modelEmpleado = EmpleadoSubalterno::model()->find('subalterno_id=:idEmpleado', array(':idEmpleado' => $model->empleado_id)); if (Yii::app()->user->id == 1 && $modelEmpleado == null) { $modelEmpleado = Empleado::model()->activos()->findAll(); } else { if ($modelEmpleado != null) { $modelEmpleado = Empleado::model()->findByPk($modelEmpleado->empleado_id); $array[0] = $modelEmpleado; $modelEmpleado = $array; } } // } else { // $modelEmpleado = Empleado::model()->findAll(); //// $model->seccion // } // die(var_dump($modelEmpleado)); echo $form->select2Row($model, 'seccion', array('asDropDownList' => true, 'data' => !empty($modelEmpleado) ? array('' => ' -- Seleccione -- ') + CHtml::listData($modelEmpleado, 'id', 'nombre_completo') : array('' => ' -- Seleccione -- '), 'options' => array('placeholder' => !empty($modelEmpleado) ? '-- Seleccione --' : '-- Nadie Esta A Cargo de ti --')));
<!--<fieldset>--> <div class="row-fluid"> <div class="span12"> <!-- widget button --> <div class="widget border-cyan" id="widget-button"> <!-- widget header --> <div class="widget-header bg-cyan"> <!-- widget title --> <h4 class="widget-title"><i class="aweso-user"></i> <?php echo Yii::t('AweCrud.app', 'Manage'); ?> <?php echo EmpleadoSubalterno::label(2); ?> </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-button" class="btn"> <i class="aweso-chevron-up color-cyan" data-toggle-icon="aweso-chevron-down aweso-chevron-up"></i> </button> </div> </div><!-- /widget header --> <!-- widget content --> <div class="widget-content bg-white"> <div style='overflow:auto'> <?php //$this->widget('bootstrap.widgets.TbGridView',array( $this->widget('ext.selgridview.BootSelGridView', array('id' => 'empleado-subalterno-grid', 'type' => 'striped bordered hover advance ', 'template' => '{summary}{items}{pager}', 'dataProvider' => $model->search(), 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'columns' => array('id', array('name' => 'empleado_id', 'value' => 'isset($data->empleado) ? $data->empleado : null', 'filter' => CHtml::listData(Empleado::model()->findAll(), 'id', Empleado::representingColumn())), array('class' => 'CButtonColumn', 'template' => '{view} {update} {delete}', 'deleteConfirmation' => CrugeTranslator::t('admin', 'Are you sure you want to delete this user'), 'buttons' => array('view' => array('label' => '<button class="btn btn-success"><i class="aweso-eye-open"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'View')), 'imageUrl' => false), 'update' => array('label' => '<button class="btn btn-info"><i class="aweso-pencil"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'Update')), 'imageUrl' => false), 'delete' => array('label' => '<button class="btn btn-danger"><i class="aweso-trash"></i></button>', 'options' => array('title' => Yii::t('AweCrud.app', 'Delete')), 'imageUrl' => false)), 'htmlOptions' => array('width' => '206px')))));
/** @var EmpleadoSubalternoController $this */ /** @var EmpleadoSubalterno $model */ /** @var AweActiveForm $form */ $form = $this->beginWidget('ext.AweCrud.components.AweActiveForm', array('id' => 'empleado-subalterno-form', 'type' => 'horizontal', 'enableAjaxValidation' => true, 'clientOptions' => array('validateOnSubmit' => false, 'validateOnChange' => true), 'enableClientValidation' => false)); ?> <div class="row-fluid"> <div class="span12"> <!-- widget button --> <div class="widget border-cyan" id="widget-button"> <!-- widget header --> <div class="widget-header bg-cyan"> <!-- widget title --> <h4 class="widget-title"><i class="aweso-user"></i> <?php echo Yii::t('AweCrud.app', $model->isNewRecord ? 'Create' : 'Update') . ' ' . EmpleadoSubalterno::label(); ?> </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-button" class="btn"> <i class="aweso-chevron-up color-cyan" data-toggle-icon="aweso-chevron-down aweso-chevron-up"></i> </button> </div> </div><!-- /widget header --> <div class="widget-content form bg-white"> <p class="note"> <?php echo Yii::t('AweCrud.app', 'Fields with');
<?php /** @var EmpleadoSubalternoController $this */ /** @var EmpleadoSubalterno $model */ $this->breadcrumbs = array('Empleado Subalternos' => array('index'), $model->id); $this->header = '<i class="aweso-info-sign aweso-2x"></i> ' . Yii::t('AweCrud.app', 'View') . ' ' . EmpleadoSubalterno::label() . ' ' . CHtml::encode($model); $this->menu = array(array('label' => Yii::t('AweCrud.app', 'Manage'), 'icon' => 'list-alt', 'url' => array('admin'))); ?> <fieldset> <div class="row-fluid"> <div class="span5"> <!-- widget button --> <div class="widget border-cyan" id="widget-button"> <!-- widget header --> <div class="widget-header bg-cyan"> <!-- widget title --> <h4 class="widget-title"><i class="aweso-info"></i> Informacion General</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-button" class="btn"> <i class="aweso-chevron-up color-cyan" data-toggle-icon="aweso-chevron-down aweso-chevron-up"></i> </button> </div> </div><!-- /widget header --> <!-- widget content --> <div class="widget-content bg-white"> <?php $this->widget('bootstrap.widgets.TbDetailView', array('data' => $model, 'attributes' => array('id', array('name' => 'empleado_id', 'value' => $model->empleado !== null ? CHtml::link($model->empleado, array('/empleado/view', 'id' => $model->empleado->id)) . ' ' : null, 'type' => 'html'))));
<?php /** @var EmpleadoSubalternoController $this */ /** @var EmpleadoSubalterno $model */ $this->breadcrumbs = array($model->label(2) => array('index'), Yii::t('AweCrud.app', 'Create')); $this->header = '<i class="aweso-paper-clip aweso-2x"></i> ' . Yii::t('AweCrud.app', 'Create') . ' ' . EmpleadoSubalterno::label(); $this->menu = array(array('label' => Yii::t('AweCrud.app', 'Manage'), 'icon' => 'list-alt', 'url' => array('admin'))); ?> <fieldset> <?php echo $this->renderPartial('_form', array('model' => $model)); ?> </fieldset>