public static function listaralertasdashboard($model) { // Obtener ids de contactos $contactos_ids = array(); // foreach ($model->contactos as $contacto) // $contactos_ids[] = $contacto->id; /** * Obtener las actividades */ $alertas = array(); $query = Yii::app()->db->createCommand()->select()->from('alerta')->where(array('and', 'entidad_tipo = :cuenta', 'entidad_id = :entidad_id'), array(':cuenta' => $model->tableName(), ':entidad_id' => $model->id))->orWhere(array('and', 'entidad_tipo = :contacto', array('in', 'entidad_id', $contactos_ids)), array(':contacto' => Contacto::model()->tableName()))->orWhere(array('and', 'entidad_tipo = :tarea', array('in', 'entidad_id', $tareas_ids)), array(':tarea' => Tarea::model()->tableName()))->orWhere(array('and', 'entidad_tipo = :oportunidad', array('in', 'entidad_id', $oportunidades_ids)), array(':oportunidad' => Oportunidad::model()->tableName()))->orWhere(array('and', 'entidad_tipo = :cobranza', array('in', 'entidad_id', $cobranzas_ids)), array(':cobranza' => Cobranza::model()->tableName()))->orWhere(array('and', 'entidad_tipo = :evento', array('in', 'entidad_id', $eventos_ids)), array(':evento' => Evento::model()->tableName()))->orWhere(array('and', 'entidad_tipo = :nota', array('in', 'entidad_id', $notas_ids)), array(':nota' => Nota::model()->tableName()))->order('fecha DESC'); $alertas = $query->queryAll(); return $alertas; }
/** * 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 $tareas = Tarea::model()->de_Etapa($id)->findAll(); if (count($tareas) == 0) { // $this->loadModel($id)->delete(); $this->reordenarPesoDeleted(); TareaEtapa::model()->updateByPk($id, array('estado' => TareaEtapa::ESTADO_INACTIVO), array('id' => $id)); Yii::app()->user->setFlash('success', "La Etapa ha sido eliminada con exito!."); } else { Yii::app()->user->setFlash('error', "No se puede eliminar esta Etapa, contiene Tareas asignadas."); } // 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.'); } }
public function listTareas() { $listTareas = array(); foreach (Tarea::model()->findAllByAttributes(array('empresa_id' => Yii::app()->user->empresa)) as $index => $tarea) { $tiempo = $tarea->tiempo; $precio = $tarea->precio; $nombre = $tarea->nombre; $listTareas[] = array('label' => $nombre, 'value' => $nombre, 'id' => $tarea->id, 'nombre' => $nombre, 'precio' => $precio, 'tiempo' => $tiempo); } return $listTareas; }
public function actionAjaxUpdateEtapa($id_data = null, $id_etapa = null) { if (Yii::app()->request->isAjaxRequest) { $modelSolicitud = Tarea::model()->findByPk($id_data); $modelSolicitud->tarea_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->responsable_id))->userid); } } }
echo $form->labelEx($model, 'realizado', array('class' => 'control-label')); ?> <div class="controls span4"> <style type="text/css"> .toggle-button label { z-index: 1; } </style> <?php $this->widget('ext.bootstrap.widgets.TbToggleButton', array('model' => $model, 'enabledLabel' => 'SI', 'disabledLabel' => 'NO', 'width' => 100, 'attribute' => 'realizado')); ?> </div> </div> <?php echo $form->dropDownListRow($model, 'tarea_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Tarea::model()->findAll(), 'id', Tarea::representingColumn()), array('placeholder' => null)); ?> <div class="form-actions bg-silver"> <div class="form-actions-float"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'success', 'label' => $model->isNewRecord ? Yii::t('AweCrud.app', 'Create') : Yii::t('AweCrud.app', 'Save'))); ?> <?php $this->widget('bootstrap.widgets.TbButton', array('label' => Yii::t('AweCrud.app', 'Cancel'), 'htmlOptions' => array('onclick' => 'javascript:history.go(-1)'))); ?> </div> </div> </div> </div> </div> </div>
<div class="kanban-title"><?php echo $etapa->nombre; ?> </div> <ul class="kanban-body" cont-id="<?php echo $etapa->id; ?> "> <?php //var_dump( $id); //var_dump(in_array($id, array_map('Tarea::getEncargadoId', $etapa->tareas))); //die(); if (in_array($id, array_map('Tarea::getEncargadoId', $etapa->tareas))) { ?> <?php $tareas = Tarea::model()->findAll('(usuario_creacion_id=:idEncargado or responsable_id=:responsable ) and tarea_etapa_id=:idEtapa', array(':idEncargado' => $id, ':idEtapa' => $etapa->id, ':responsable' => Empleado::model()->find('userid=:isuser', array(':isuser' => Yii::app()->user->id))->id)); ?> <?php // $tareas = Tarea::model()->findAll('( responsable_id=:responsable ) and tarea_etapa_id=:idEtapa', array( ':idEtapa' => $etapa->id, ':responsable' => Empleado::model()->find('userid=:isuser', array(':isuser' => Yii::app()->user->id))->id)); ?> <?php // $tareas = Tarea::model()->findAll('usuario_creacion_id=:idEncargado and tarea_etapa_id=:idEtapa', array(':idEncargado' => $id, ':idEtapa' => $etapa->id)); ?> <?php // var_dump($tareas);die(); ?> <?php foreach ($tareas as $tarea) { ?> <li class="kanban-item" data-id="<?php
/** @var TareaObjetivo $model */ ?> <div class = "empty-model"> <div class = "row-fluid"> <div class = "span3"> <div class = "empty-model-icon"><i class = "aweso-tasks"></i></div> </div> <div class = "span9"> <div class = "empty-model-description"> <h1><?php echo $model->label(2); ?> </h1> <h2>La mejor manera de tener la información de sus <?php echo $model->label(2); ?> organizada.</h2> <?php if (count(Tarea::model()->findAll()) > 0) { echo CHtml::link('<i class="aweso-plus"></i> Crear Nuevo', array('/' . $this->module->id . '/' . $this->id . '/create'), array('class' => 'btn btn-large btn-success')); } else { Yii::app()->user->setFlash('error', "Aun no se a creado registros de Tareas."); } ?> </div> </div> </div> </div>
/** * 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-tasks"></i> <?php echo Yii::t('AweCrud.app', 'Manage'); ?> <?php echo TareaObjetivo::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' => 'tarea-objetivo-grid', 'type' => 'striped bordered hover advance ', 'template' => '{summary}{items}{pager}', 'dataProvider' => $model->search(), 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'columns' => array('id', 'objetivo', array('name' => 'realizado', 'value' => '($data->realizado === 0) ? Yii::t(\'AweCrud.app\', \'No\') : Yii::t(\'AweCrud.app\', \'Yes\')', 'filter' => array('0' => Yii::t('AweCrud.app', 'No'), '1' => Yii::t('AweCrud.app', 'Yes'))), array('name' => 'tarea_id', 'value' => 'isset($data->tarea) ? $data->tarea : null', 'filter' => CHtml::listData(Tarea::model()->findAll(), 'id', Tarea::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 $form = $this->beginWidget('booster.widgets.TbActiveForm', array('id' => 'addTarea-form', 'type' => 'horizontal', 'htmlOptions' => array('class' => 'well'))); ?> <fieldset> <div class="col-md-6"> <?php echo $form->dropDownListGroup($tarea, 'tarea_id', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => CHtml::listData(Tarea::model()->findAll(), 'id', 'nombre'), 'htmlOptions' => array('prompt' => 'Seleccione Tarea')))); ?> </div> <div class="form-actions col-md-6" > <?php $this->widget('booster.widgets.TbButton', array('buttonType' => 'submit', 'context' => 'primary', 'label' => 'Guardar')); ?> </div> </fieldset> <script> $(document).ready(function(){ $('#addTarea-form').submit(function(){ $.ajax({ url : "<?php echo Yii::app()->createURL('configuracion/addTarea', array('id' => $id)); ?> ", type : 'post',