/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); $this->performAjaxValidation($model, 'sancion-form'); if (isset($_POST['Sancion'])) { $model->attributes = $_POST['Sancion']; if ($model->save()) { ActividadSistema::registrarActividad($model, ActividadSistema::TIPO_UPDATE, Yii::app()->user->id); Notificacion::registrarAlertaA($model, Notificacion::ASIGNADO, Empleado::model()->find('id=:idUser', array(':idUser' => $model->empleado_id))->userid); $this->redirect(array('view', 'id' => $model->id)); } } $this->render('update', array('model' => $model)); }
public function authenticate() { $employe = Empleado::model()->with('empresa')->findByAttributes(array('username' => $this->username)); if ($employe === null || $employe->password !== $this->password) { $this->errorCode = self::ERROR_UNKNOWN_IDENTITY; } else { $this->_id = $employe->id; $this->setState('idEmpresa', $employe->idEmpresa); $fullData = '[' . $employe->numero . '] ' . $employe->nombre . ' ' . $employe->apellido; $this->setState('fullData', $fullData); $this->setState('nombreEmpresa', $employe->empresa->nombre); $this->errorCode = self::ERROR_NONE; } return !$this->errorCode; }
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); $this->performAjaxValidation($model, 'informe-form'); if (isset($_POST['Informe'])) { $model->attributes = $_POST['Informe']; $model->usuario_actualizacion_id = Yii::app()->user->id; $model->fecha_actualizacion = Util::FechaActual(); if ($model->save()) { ActividadSistema::registrarActividad($model, ActividadSistema::TIPO_UPDATE, Yii::app()->user->id); Notificacion::registrarAlertaA($model, Notificacion::ASIGNADO, Empleado::model()->find('id=:idUser', array(':idUser' => $model->entidad_tipo ? $model->entidad_tipo : $model->entidad_id))->userid); //$this->redirect(array('view', 'id' => $model->id)); $this->redirect(array('admin')); } } $this->render('update', array('model' => $model)); }
/** * Deletes a particular model. * If deletion is successful, the browser will be redirected to the 'admin' page. * @param integer $id the ID of the model to be deleted */ public function actionDelete($id) { if (Yii::app()->request->isPostRequest) { // we only allow deletion via POST request $empleados = Empleado::model()->de_Cargo($id)->findAll(); if (count($empleados) == 0) { $this->reordenarPesoDeleted(); $this->loadModel($id)->delete(); Yii::app()->user->setFlash('success', "El Cargo ha sido eliminado con exito!."); } else { Yii::app()->user->setFlash('error', "No se puede eliminar este Cargo, contiene Empleados asignados."); } // if AJAX request (triggered by deletion via admin grid view), we should not redirect the browser if (!isset($_GET['ajax'])) { $this->redirect(isset($_POST['returnUrl']) ? $_POST['returnUrl'] : array('admin')); } } else { throw new CHttpException(400, 'Invalid request. Please do not repeat this request again.'); } }
?> <?php echo Empleado::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 $dataProvider = ''; if (Util::getRolUser(Yii::app()->user->id) == 'OPERADOR') { $dataProvider = $model->activos()->searchSubAlterno(Empleado::model()->find('userid=:idUser', array(':idUser' => Yii::app()->user->id))->id, true); } else { $dataProvider = $model->noUser()->activos()->search(); } //$this->widget('bootstrap.widgets.TbGridView',array( $this->widget('ext.selgridview.BootSelGridView', array('id' => 'empleado-grid', 'type' => 'striped bordered hover advance ', 'template' => '{summary}{items}{pager}', 'dataProvider' => $dataProvider, 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'filter' => $model, 'columns' => array(array('id' => 'check_id', 'class' => 'CCheckBoxColumn', 'value' => '$data->id'), array('name' => 'documento', 'value' => 'CHtml::link($data->documento, Yii::app()->createUrl("/personal/empleado/view", array("id"=>$data->id)))', 'type' => 'html'), array('name' => 'nombre_completo', 'value' => 'CHtml::link($data->nombre_completo, Yii::app()->createUrl("/personal/empleado/view", array("id"=>$data->id)))', 'type' => 'html'), array('name' => 'fecha_contratacion', 'value' => 'Util::FormatDate($data->fecha_contratacion, "Y/m/d")'), array('name' => 'usuario_creacion_id', 'value' => 'Yii::app()->user->um->loadUserById($data->usuario_creacion_id)->username'), array('name' => 'empleo_cargo_id', 'value' => 'isset($data->empleoCargo) ? $data->empleoCargo : null', 'filter' => CHtml::listData(EmpleoCargo::model()->findAll(), 'id', EmpleoCargo::representingColumn())), array('name' => 'horario_id', 'value' => 'isset($data->horario) ? $data->horario : null', 'filter' => CHtml::listData(Horario::model()->findAll(), 'id', Horario::representingColumn())), 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')), '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' => '80px'))))); ?> </div> </div> </div> </div> </div> <!--</fieldset>-->
} // } 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 echo $form->datepickerRow($model, 'fecha_emision', array('options' => array('language' => 'es', 'autoclose' => 'true', 'format' => 'yyyy-mm-dd'), 'htmlOptions' => array('readonly' => 'readonly'))); ?> <?php
/** * 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); } } }
<div class="widget-content form bg-white"> <p class="note"> <?php echo Yii::t('AweCrud.app', 'Fields with'); ?> <span class="required">*</span> <?php echo Yii::t('AweCrud.app', 'are required'); ?> . </p> <?php echo $form->select2Row($model, 'responsable_id', array('asDropDownList' => true, 'data' => array('' => ' -- Seleccione -- ') + CHtml::listData(Empleado::model()->activos()->findAll(), 'id', 'nombre_completo'), 'options' => array('placeholder' => '-- Seleccione --'))); ?> <?php echo $form->textFieldRow($model, 'nombre', array('maxlength' => 64)); ?> <?php // echo $form->textFieldRow($model, 'usuario_creacion_id') ?> <?php // echo $form->textFieldRow($model, 'usuario_actualizacion_id') ?> <?php /* echo $form->datepickerRow($model, 'fecha_fin', array('prepend' => '<i class="icon-calendar"></i>')) */ ?> <?php
/** * 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. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Empleado::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }
<?php /** @var EmpleadoSubalternoController $this */ /** @var AweActiveForm $form */ $form = $this->beginWidget('bootstrap.widgets.TbActiveForm', array('action' => Yii::app()->createUrl($this->route), 'method' => 'get')); ?> <?php echo $form->textFieldRow($model, 'id'); ?> <?php echo $form->dropDownListRow($model, 'empleado_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Empleado::model()->findAll(), 'id', Empleado::representingColumn())); ?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array('type' => 'primary', 'label' => Yii::t('AweCrud.app', 'Search'))); ?> </div> <?php $this->endWidget();
<?php foreach ($tareas as $tarea) { ?> <li class="kanban-item" data-id="<?php echo $tarea->id; ?> "> <!-- <div class="kanban-item-title"> <?php // echo CHtml::link($credito->fecha_credito, ""); // echo CHtml::link($cliente->nombre_formato, "", array("id" => $cliente->id, "onClick" => "viewModal('incidencias/incidencia/view/id/" . $cliente->id . "')")); ?> </div>--> <div><label>Emisor: </label> <?php echo Empleado::model()->find('userid=:idUser', array(':idUser' => $tarea->usuario_creacion_id))->nombre_completo; ?> </div> <!--<div><label>Responsable: </label> <?php // echo Empleado::model()->find('id=:idUser', array(':idUser' => $tarea->responsable_id))->nombre_completo; ?> </div>--> <div><label>fecha y hora fin: </label> <?php echo Util::FormatDate($tarea->fecha_fin, 'd/m/Y') . " a las " . Util::formatTime($tarea->hora_fin); ?> </div> <div><label>descripcion: </label> <?php echo Util::Truncate($tarea->descripcion, 20); ?> </div> <div >
</div> </a> </div> </div><!-- /block looper --> </div><!-- /tile-content --> <div class="tile-peek"> <div class="icon"><i class="aweso-user"></i> </div> <!--<span class="brand">--> <?php echo count(Empleado::model()->activos()->findAll()); ?> <!--</span>--> <span class="badge"> <?php echo Empleado::model()->label(2); ?> </span> </div><!-- /tile-peek --> </div><!-- /tile --> <?php } ?> <!-- tile --> <div data-looper="go" data-interval="6000" class="span2 tile bg-cyan looper slide up"> <!--tile-content--> <div class="tile-content"> <!-- block looper --> <div class="looper-inner"> <div class="item">
/** * Devuelve un mensaje formateado segun el tipo de actividad * @param Actividad $actividad objeto de tipo Actividad que se quiere formatear * @return string mensaje formateado */ public static function getMensaje($actividad) { // El mensaje $mensaje = ""; $icon = ""; // Primero buscamos el usuario que realizó la accion $usuario = Yii::app()->user->um->loadUserById($actividad['usuario_id']); if ($usuario) { switch ($actividad['entidad_tipo']) { // Si es una actividad sobre un empleado case Empleado::model()->tableName(): $empleado = Empleado::model()->findByPk($actividad['entidad_id']); $icon = 'group'; if ($actividad['tipo'] == self::TIPO_CREATE) { $mensaje = "<b>" . $usuario->username . "</b> creó el empleado " . CHtml::link($empleado->nombre_completo, array('/personal/empleado/view', 'id' => $empleado->id), array('class' => 'btn btn-small btn-silver')); } elseif ($actividad['tipo'] == self::TIPO_UPDATE) { if ($actividad['detalle'] != null) { $mensaje = "<b>" . $usuario->username . "</b> " . $actividad['detalle'] . " del empleado " . CHtml::link($empleado->nombre_completo, array('/personal/empleado/view', 'id' => $empleado->id), array('class' => 'btn btn-small btn-silver')); } else { $mensaje = $usuario->username . " actualizó los datos del contacto " . CHtml::link($empleado->nombre_completo, array('/personal/empleado/view', 'id' => $empleado->id), array('class' => 'btn btn-small btn-silver')); } } elseif ($actividad['tipo'] == self::TIPO_DELETE) { $mensaje = "<b>" . $usuario->username . "</b> elimino al empleado \"" . Util::Truncate($empleado->nombre_completo, 15) . "\" "; } elseif ($actividad['tipo'] == self::TIPO_RESTORE) { $mensaje = "<b>" . $usuario->username . "</b> Asigno como Encargado a " . CHtml::link($empleado->nombre_completo, array('/personal/empleado/view', 'id' => $empleado->id), array('class' => 'btn btn-small btn-silver')) . " de <b> \"" . Util::Truncate(Empleado::model()->findByPk($actividad['detalle'])->nombre_completo, 15) . "\" </b> a ACTIVOS"; } break; // Si es una actividad sobre un una Solicitud // Si es una actividad sobre un una Solicitud case SolicitudPermiso::model()->tableName(): $solicitud = SolicitudPermiso::model()->findByPk($actividad['entidad_id']); $icon = 'archive'; if ($actividad['tipo'] == self::TIPO_CREATE) { // $mensaje = "<b>" . $usuario->username . "</b> ha enviado una solicitud a " . CHtml::link(Empleado::model()->findByPk($solicitud->seccion)->nombre_completo, array('/personal/empleado/view', 'id' => $solicitud->empleado_id), array('class' => 'btn btn-small btn-silver')); } elseif ($actividad['tipo'] == self::TIPO_UPDATE) { if ($actividad['detalle'] != null) { $mensaje = "<b>" . $usuario->username . "</b> " . $actividad['detalle'] . " del empleado " . CHtml::link(Empleado::model()->findByPk($solicitud->seccion)->nombre_completo, array('/personal/empleado/view', 'id' => $solicitud->empleado_id), array('class' => 'btn btn-small btn-silver')); } else { $mensaje = $usuario->username . " actualizó los datos de la solicitud enviada a " . CHtml::link(Empleado::model()->findByPk($solicitud->seccion)->nombre_completo, array('/personal/empleado/view', 'id' => $solicitud->empleado_id), array('class' => 'btn btn-small btn-silver')); } } elseif ($actividad['tipo'] == self::TIPO_DELETE) { $mensaje = "<b>" . $usuario->username . "</b> ha cambiado de etapa a la solicitud enviada por \"" . Util::Truncate(Empleado::model()->findByPk($solicitud->seccion)->nombre_completo, 15); } elseif ($actividad['tipo'] == self::TIPO_RESTORE) { // $mensaje = "<b>" . $usuario->username . "</b> ha cambiado de etapa a la solicitud enviada por " . CHtml::link(Empleado::model()->findByPk($solicitud->seccion)->nombre_completo, array('/personal/empleado/view', 'id' => $solicitud->empleado_id), array('class' => 'btn btn-small btn-silver')) . " <b> \""; } break; // Si es una actividad sobre un deuda // Si es una actividad sobre un deuda case Informe::model()->tableName(): $informe = Informe::model()->findByPk($actividad['entidad_id']); $icon = 'usd'; if ($actividad['tipo'] == self::TIPO_CREATE) { $mensaje = "<b>" . $usuario->username . "</b> A enviado un informe a " . CHtml::link(Empleado::model()->findByPk($informe->entidad_id)->nombre_completo, array('/notificacion/informe/view', 'id' => $informe->id), array('class' => 'btn btn-small btn-silver')); } elseif ($actividad['tipo'] == self::TIPO_UPDATE) { if ($actividad['detalle'] != null) { $mensaje = "<b>" . $usuario->username . "</b> " . $actividad['detalle'] . " del contacto " . CHtml::link($informe->cltCliente->nombre_completo, array('/notificacion/cltCliente/view', 'id' => $informe->id), array('class' => 'btn btn-small btn-silver')); } else { $mensaje = $usuario->username . " actualizó el informe enviado a " . CHtml::link(Empleado::model()->findByPk($informe->entidad_id)->nombre_completo, array('/notificacion/informe/view', 'id' => $informe->cltCliente->id), array('class' => 'btn btn-small btn-silver')); } } elseif ($actividad['tipo'] == self::TIPO_DELETE) { $mensaje = "<b>" . $usuario->username . "</b> eliminó el informe enviado a \"" . CHtml::link(Empleado::model()->findByPk($informe->entidad_id)->nombre_completo, array('/notificacion/informe/view', 'id' => $informe->cltCliente->id), array('class' => 'btn btn-small btn-silver')); } break; // // Si es una actividad sobre una Transaccion // // Si es una actividad sobre una Transaccion case Tarea::model()->tableName(): $tarea = Tarea::model()->findByPk($actividad['entidad_id']); $icon = 'tasks'; if ($actividad['tipo'] == self::TIPO_CREATE) { // $mensaje = "<b>" . $usuario->username . "</b> asigno la tarea <b>" . $tarea->nombre . "</b> al empleado/a " . CHtml::link(Empleado::model()->findByPk($tarea->responsable_id)->nombre_completo, array('/tareas/tarea/view', 'id' => $tarea->id), array('class' => 'btn btn-small btn-silver')); } elseif ($actividad['tipo'] == self::TIPO_UPDATE) { if ($actividad['detalle'] != null) { $mensaje = "<b>" . $usuario->username . "</b> " . $actividad['detalle'] . " del cliente " . CHtml::link(Empleado::model()->findByPk($tarea->responsable_id)->nombre_completo, array('/cliente/cltCliente/view', 'id' => $tarea->id), array('class' => 'btn btn-small btn-silver')); } else { $mensaje = "<b>" . $usuario->username . "</b> actualizó la tarea <b>" . $tarea->nombre . "</b> del clienete " . CHtml::link(Empleado::model()->findByPk($tarea->responsable_id)->nombre_completo, array('/cliente/cltCliente/view', 'id' => $tarea->id), array('class' => 'btn btn-small btn-silver')); } } elseif ($actividad['tipo'] == self::TIPO_DELETE) { $mensaje = "<b>" . $usuario->username . "</b> eliminó la tarea \"" . Util::Truncate($tarea->nombre, 15) . "\" signada a " . Empleado::model()->findByPk($tarea->responsable_id)->nombre_completo; } break; // Si es una actividad sobre un mail // case Mail::model()->tableName(): // $mail = Mail::model()->findByPk($actividad['entidad_id']); // if (isset($mail)) { // $contacto = CltCliente::model()->findByPk($mail->contacto_id); // $icon = 'envelope'; // // if ($actividad['tipo'] == self::TIPO_CREATE) { // $mensaje = $usuario->username . " envió un mail a " . CHtml::link($contacto->nombre_completo, array('/cliente/cltCliente/view', 'id' => $contacto->id), array('class' => 'btn btn-small btn-silver')); // } // } // break; // Si es una actividad sobre un mail // case Mail::model()->tableName(): // $mail = Mail::model()->findByPk($actividad['entidad_id']); // if (isset($mail)) { // $contacto = CltCliente::model()->findByPk($mail->contacto_id); // $icon = 'envelope'; // // if ($actividad['tipo'] == self::TIPO_CREATE) { // $mensaje = $usuario->username . " envió un mail a " . CHtml::link($contacto->nombre_completo, array('/cliente/cltCliente/view', 'id' => $contacto->id), array('class' => 'btn btn-small btn-silver')); // } // } // break; default: break; } if ($mensaje) { return "<div class='metro_tmtime' datetime='2013-04-10 18:30'>\n <span class='date'>" . Util::FormatDate($actividad['fecha'], 'd/m/Y') . "</span>\n <span class='time'>" . Util::FormatDate($actividad['fecha'], 'H:i') . "</span>\n </div>\n <div class='metro_tmicon'><i class='aweso-{$icon}'></i></div>\n <div class='metro_tmlabel'>{$mensaje}</div>"; } } }
<!-- 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 ContactoTelefonico::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' => 'contacto-telefonico-grid', 'type' => 'striped bordered hover advance ', 'template' => '{summary}{items}{pager}', 'dataProvider' => $model->search(), 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'columns' => array('id', '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('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'))))); ?> </div> </div> </div> </div> </div> <!--</fieldset>-->
<?php /** @var SolicitudPermisoController $this */ /** @var SolicitudPermiso $model */ ?> <?php $empleado = !count(Empleado::model()->activos()->searchSubAlterno(Empleado::model()->find('userid=:idUser', array(':idUser' => Yii::app()->user->id))->id, true)->getData()) > 0; //$this->header='<i class="aweso-dashboard aweso-2x"></i> '. Yii::t('AweCrud.app', 'Manage') .' '. SolicitudPermiso::label(2) ; $this->menu = array(array('label' => Yii::t('AweCrud.app', 'Create') . ' Solicitud', 'icon' => 'plus', 'url' => array('create'), 'visible' => Util::checkAccess(array('action_solicitudPermiso_create')) && $empleado), array('label' => Yii::t('AweCrud.app', 'Kanban'), 'icon' => 'trello', 'url' => array('solicitudPermiso/kanban/id/' . Yii::app()->user->id), 'visible' => Util::checkAccess(array('action_solicitudPermiso_kanban')))); ?> <!--<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 SolicitudPermiso::label(2); ?> </h4>
public function actionAjaxUpdateEtapa($id_data = null, $id_etapa = null) { if (Yii::app()->request->isAjaxRequest) { $modelSolicitud = SolicitudPermiso::model()->findByPk($id_data); $modelSolicitud->permismo_etapa_id = $id_etapa; // $updated = SolicitudPermiso::model()->updateByPk($id_data, array( // 'permismo_etapa_id' => $id_etapa // ) // ); // var_dump($modelSolicitud->empleado_id); // die(); if ($modelSolicitud->save()) { ActividadSistema::registrarActividad($modelSolicitud, ActividadSistema::TIPO_RESTORE, Yii::app()->user->id); Notificacion::registrarAlertaA($modelSolicitud, Notificacion::TIPO_RESTORE, Empleado::model()->find('id=:idUser', array(':idUser' => $modelSolicitud->empleado_id))->userid); } } }
public function scopes() { // var_dump(Empleado::model()->find('userid=:idUser', array(':idUser' => Yii::app()->user->id))->id); // die(); return array('activos' => array('condition' => 'estado = :estado', 'params' => array(':estado' => self::ESTADO_ACTIVO)), 'aCargo' => array('condition' => 'seccion = :idEncargado', 'params' => array(':idEncargado' => Yii::app()->user->id)), 'propias' => array('condition' => 'empleado_id = :id', 'params' => array(':id' => Empleado::model()->find('userid=:idUser', array(':idUser' => Yii::app()->user->id))->id)), 'propiasAcargo' => array('condition' => 'seccion = :idEncargado or empleado_id = :id', 'params' => array(':id' => Empleado::model()->find('userid=:idUser', array(':idUser' => Yii::app()->user->id))->id, ':idEncargado' => Yii::app()->user->id)), 'ordenByFechaSolicitud' => array('order' => 'fecha_solicitud DESC')); }
/** * 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 Empleado the loaded model * @throws CHttpException */ public function loadModel($id) { $model = Empleado::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
?> <?php // echo $form->error($model, 'nombre') ?> </div> </div>--> <?php echo $form->datepickerRow($model, 'fecaha_inicio', array('options' => array('format' => 'yyyy-mm-dd'))); ?> <?php echo $form->datepickerRow($model, 'fecha_fin', array('options' => array('format' => 'yyyy-mm-dd'))); ?> <?php echo $form->dropDownListRow($model, 'empleado_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Empleado::model()->findAll(), 'id', 'nombre_completo'), array('placeholder' => null)); ?> <?php echo $form->dropDownListRow($model, 'tipo_sancion_id', array('' => ' -- Seleccione -- ') + CHtml::listData(TipoSancion::model()->findAll(), 'id', TipoSancion::representingColumn()), array('placeholder' => null)); ?> <?php echo $form->textAreaRow($model, 'descripcion', array('rows' => 3, 'cols' => 50)); ?> <?php echo $form->textAreaRow($model, 'observacion', array('rows' => 3, 'cols' => 50)); ?> <div class="form-actions bg-silver"> <div class="form-actions-float"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'))); ?>
<!-- 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 Sancion::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' => 'sancion-grid', 'type' => 'striped bordered hover advance ', 'template' => '{summary}{items}{pager}', 'dataProvider' => $model->search(), 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'columns' => array(array('name' => 'empleado_id', 'value' => 'isset($data->empleado) ? $data->empleado->nombre_completo : null', 'filter' => CHtml::listData(Empleado::model()->findAll(), 'id', 'nombre_completo')), 'fecaha_inicio', 'fecha_fin', 'descripcion', 'observacion', array('name' => 'tipo_sancion_id', 'value' => 'isset($data->tipoSancion) ? $data->tipoSancion : null', 'filter' => CHtml::listData(TipoSancion::model()->findAll(), 'id', TipoSancion::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, 'visible' => Util::checkAccess(array('action_sancion_update')) ? 'true' : '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'))))); ?> </div> </div> </div> </div> </div> <!--</fieldset>-->