/** * * Adiciona um horario na agenda a partir de requisições ajax * @throws CHttpException */ public function actionAjaxGet($id = null) { if ($id != null) { $horarios = Horario::model()->findAll('cod_pessoa = ' . $id); } $response = CJSON::encode($horarios, 'cod_pessoa', 'dia_semana', 'turno', 'local'); echo $response; }
/** * 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) { $horario = Horario::model()->findByPk($id); if (isset($_POST['Horario'])) { $horario->attributes = $_POST['Horario']; $horario->hora_inicio = date('Gi', strtotime($horario->hora_inicio)); $horario->hora_fin = date('Gi', strtotime($horario->hora_fin)); if ($horario->save()) { Yii::app()->user->setFlash('success', Horarios::getDiaSemana($horario->dia_semana) . ' ' . Horarios::hora($horario->hora_inicio) . ' guardado con éxito'); $pgPrograma = PgPrograma::model()->with('pagina')->findByPk($horario->pg_programa_id); $this->redirect(array('programas/view', 'id' => $pgPrograma->pagina->micrositio_id)); } //if($horario->save()) } //if(isset($_POST['Horario'])) // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); $this->render('modificar', array('model' => $horario)); }
?> <?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>-->
$pessoas = Horario::model()->findAll("turno = 'tarde' AND dia_semana = 'quinta'"); ?> <?php foreach ($pessoas as $p) { ?> <?php echo $p->pessoa->nome; ?> <br> <?php } ?> </td> <td class="tarde sexta"> <?php $pessoas = Horario::model()->findAll("turno = 'tarde' AND dia_semana = 'sexta'"); ?> <?php foreach ($pessoas as $p) { ?> <?php echo $p->pessoa->nome; ?> <br> <?php } ?> </td> </tr> </tbody>
protected function beforeDelete() { $this->transaccion = $this->dbConnection->getCurrentTransaction(); if ($this->transaccion === null) { $this->transaccion = $this->dbConnection->beginTransaction(); } try { // 1. Desasignar de los micrositios que la tengan por defecto. $micrositios = Micrositio::model()->findAllByAttributes(array('pagina_id' => $this->id)); foreach ($micrositios as $m) { $m->pagina_id = NULL; $m->save(); } // 3.Verifico el tipo de página para ver si tiene una tabla auxiliar $tabla = $this->tipoPagina->tabla; $t = new $tabla(); $contenido = $t->findByAttributes(array('pagina_id' => $this->id)); switch ($tabla) { case 'PgPrograma': Horario::model()->deleteAllByAttributes(array('pg_programa_id' => $contenido->id)); break; case 'PgDocumental': FichaTecnica::model()->deleteAllByAttributes(array('pg_documental_id' => $contenido->id)); break; /*case 'Carpeta': Carpeta::model()->vaciar_carpeta( $contenido->id ); break;/**/ /*case 'Carpeta': Carpeta::model()->vaciar_carpeta( $contenido->id ); break;/**/ case 'PgFiltro': FiltroItem::model()->deleteAllByAttributes(array('pg_filtro_id' => $contenido->id)); break; case 'PgBloques': Bloque::model()->deleteAllByAttributes(array('pg_bloques_id' => $contenido->id)); break; case 'PgEventos': Evento::model()->deleteAllByAttributes(array('pg_eventos_id' => $contenido->id)); break; } // 4. Borro la tabla pg_ //$this->transaccion->commit(); return parent::beforeDelete(); } catch (Exception $e) { $this->transaccion->rollback(); return false; } }
/** * 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 = Horario::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function run($args) { $horarios = Horario::model()->with('pgPrograma')->findAll(array('order' => 'dia_semana ASC, hora_inicio ASC', 'condition' => 'pgPrograma.estado = 2')); foreach ($horarios as $horario) { $pagina = Pagina::model()->findByPk($horario->pgPrograma->pagina_id); $micrositio_id = $pagina->micrositio_id; $tipo_emision_id = $horario->tipo_emision_id; $dia_semana = $horario->dia_semana; $hora_inicio = $horario->hora_inicio; $hora_fin = $horario->hora_fin; $estado = 1; date_default_timezone_set('America/Bogota'); setlocale(LC_ALL, 'es_ES.UTF-8'); $sts = mktime(0, 0, 0, date('m'), date('d'), date('Y')); // set current date // parse about any English textual datetime description into a Unix timestamp $ts = $sts; // calculate the number of days since Monday $dow = date('w', $ts); $offset = $dow - 1; if ($offset < 0) { $offset = 6; } // calculate timestamp for the Monday $ts = $ts - $offset * 86400; $semana = array(); // loop from Monday till Sunday for ($i = 0; $i < 7; $i++, $ts += 86400) { $semana[] = $ts; } $hora_inicio = $semana[$dia_semana - 1] + Horarios::hora_a_timestamp($hora_inicio); $hora_fin = $semana[$dia_semana - 1] + Horarios::hora_a_timestamp($hora_fin); /* PILAS AQUÍ, FESTIVO /**/ $tts = mktime(0, 0, 0, date('m', $hora_inicio), date('d', $hora_inicio), date('Y', $hora_inicio)); if ($tts == mktime(0, 0, 0, 3, 23, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 4, 2, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 4, 3, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 5, 1, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 5, 18, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 6, 8, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 6, 15, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 6, 29, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 7, 20, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 8, 7, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 8, 17, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 10, 12, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 11, 2, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 11, 16, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 12, 8, date('Y'))) { continue; } if ($tts == mktime(0, 0, 0, 12, 25, date('Y'))) { continue; } $p = new Programacion(); if (!$p->exists(array('condition' => 'hora_inicio=' . $hora_inicio . ' AND hora_fin=' . $hora_fin . ' AND estado=1'))) { $p->micrositio_id = $micrositio_id; $p->hora_inicio = $hora_inicio; $p->hora_fin = $hora_fin; $p->tipo_emision_id = $tipo_emision_id; $p->estado = $estado; $p->save(); if ($p) { echo '+ Guardado ' . $pagina->nombre . ' ' . $hora_inicio . '<br />' . "\r\n"; } } else { echo '- Existía ' . $pagina->nombre . '<br />' . "\r\n"; } } return 0; }
echo $form->textFieldRow($model, 'curriculum', array('maxlength' => 200)); ?> <?php echo $form->textFieldRow($model, 'foto', array('maxlength' => 200)); ?> <?php echo $form->dropDownListRow($model, 'empleo_cargo_id', array('' => ' -- Seleccione -- ') + CHtml::listData(EmpleoCargo::model()->findAll(), 'id', EmpleoCargo::representingColumn())); ?> <?php echo $form->dropDownListRow($model, 'estado_empleo_id', array('' => ' -- Seleccione -- ') + CHtml::listData(EstadoEmpleo::model()->findAll(), 'id', EstadoEmpleo::representingColumn()), array('prompt' => Yii::t('AweApp', 'None'))); ?> <?php echo $form->dropDownListRow($model, 'direccion_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Direccion::model()->findAll(), 'id', Direccion::representingColumn()), array('prompt' => Yii::t('AweApp', 'None'))); ?> <?php echo $form->dropDownListRow($model, 'horario_id', array('' => ' -- Seleccione -- ') + CHtml::listData(Horario::model()->findAll(), 'id', Horario::representingColumn()), array('prompt' => Yii::t('AweApp', 'None'))); ?> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array('type' => 'primary', 'label' => Yii::t('AweCrud.app', 'Search'))); ?> </div> <?php $this->endWidget();
</button> </div> </div><!-- /widget header --> <div class="widget-content form bg-white"> <div style='overflow:auto'> <?php $empleadosSubAlternos = $model->activos()->searchSubAlterno($model->id, true)->getData(); // var_dump($empleadosSubAlternos); ?> <div id="div-empleado-grid" style="<?php echo !$empleadosSubAlternos ? 'display: none;' : ''; ?> "> <?php //$this->widget('bootstrap.widgets.TbGridView',array( $this->widget('ext.selgridview.BootSelGridView', array('id' => 'empleado-grid', 'type' => 'striped bordered hover advance condensed', 'template' => '{summary}{items}{pager}', 'dataProvider' => $model->activos()->searchSubAlterno($model->id, true), 'pagerCssClass' => 'pagination text-center', 'selectableRows' => 2, 'columns' => array(array('name' => 'nombre_completo', 'value' => 'CHtml::link($data->nombre_completo, Yii::app()->createUrl("/personal/empleado/view", array("id"=>$data->id)))', 'type' => 'html'), 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()))))); ?> </div> <?php if (Util::checkAccess(array('action_empleado_SubAlternos'))) { ?> <?php $this->widget('bootstrap.widgets.TbButton', array('id' => 'add-EmpleadoSubalterno', 'label' => !empty($empleadosSubAlternos) ? 'Agregar' : '<h3>Empleados A Cargo</h3>', 'encodeLabel' => false, 'icon' => !empty($empleadosSubAlternos) ? 'plus-sign' : 'group', 'htmlOptions' => array('onClick' => 'viewModal("personal/empleado/SubAlternos/id/' . $model->id . '",false,function(){' . 'maskAttributes();})', 'class' => !empty($empleadosSubAlternos) ? '' : 'empty-portlet'))); ?> <?php } else { ?> <?php $this->widget('bootstrap.widgets.TbButton', array('id' => 'add-EmpleadoSubalterno', 'label' => !empty($empleadosSubAlternos) ? 'Agregar' : '<h3>Empleados A Cargo</h3>', 'encodeLabel' => false, 'icon' => !empty($empleadosSubAlternos) ? 'plus-sign' : 'group', 'htmlOptions' => array('class' => !Util::checkAccess(array('action_empleado_SubAlternos')) && !empty($empleadosSubAlternos) ? 'hidden' : 'empty-portlet'))); ?>
array('empty'=>'', 'class'=>'span5') ); ?> <?php echo $form->dropDownListRow( $model, 'HoraInicio', CHtml::listData(Horario::model()->findAll(), 'IdHorario', 'HorarioCompleto'), array('empty'=>'', 'class'=>'span5') ); ?> <?php echo $form->dropDownListRow( $model, 'HoraFinal', CHtml::listData(Horario::model()->findAll(), 'IdHorario', 'HorarioCompleto'), array('empty'=>'', 'class'=>'span5') ); ?> </div> </div> <div class="form-actions"> <?php $this->widget('bootstrap.widgets.TbButton', array( 'buttonType'=>'submit', 'type'=>'primary', 'icon'=>'ok white', 'label'=>$model->isNewRecord ? 'Crear' : 'Actualizar',
<?php } ?> <?php } ?> </td> <td> <?php foreach ($salas as $s) { ?> <?php echo "<p class='sala'>" . $s->local . "</p>"; ?> <?php $pessoas = Horario::model()->with('pessoa')->findAll(array('condition' => "turno = 'tarde' AND dia_semana = 'sexta' AND local='{$s->local}' ", 'order' => 'local, pessoa.nome')); ?> <?php if (empty($pessoas)) { ?> <?php echo "<p class='sala-pessoa'>-</p>"; ?> <?php } else { ?> <?php foreach ($pessoas as $p) { ?> <?php if (!$p->pessoa->isInVacation($p->cod_pessoa)) {
public function actionGeneratePdf() { $session=new CHttpSession; $session->open(); Yii::import('application.extensions.bootstrap.gii.*'); require_once('bootstrap/tcpdf/tcpdf.php'); require_once('bootstrap/tcpdf/config/lang/eng.php'); if(isset($session['Horario_records'])) { $model=$session['Horario_records']; } else $model = Horario::model()->findAll(); $html = $this->renderPartial('expenseGridtoReport', array( 'model'=>$model ), true); //die($html); $pdf = new TCPDF(); $pdf->SetCreator(PDF_CREATOR); $pdf->SetAuthor(Yii::app()->name); $pdf->SetTitle('Horario Report'); $pdf->SetSubject('Horario Report'); //$pdf->SetKeywords('example, text, report'); $pdf->SetHeaderData('', 0, "Report", ''); $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, "Example Report by ".Yii::app()->name, ""); $pdf->setHeaderFont(Array('helvetica', '', 8)); $pdf->setFooterFont(Array('helvetica', '', 6)); $pdf->SetMargins(15, 18, 15); $pdf->SetHeaderMargin(5); $pdf->SetFooterMargin(10); $pdf->SetAutoPageBreak(TRUE, 0); $pdf->SetFont('dejavusans', '', 7); $pdf->AddPage(); $pdf->writeHTML($html, true, false, true, false, ''); $pdf->LastPage(); $pdf->Output("Horario_002.pdf", "I"); }
echo $form->textFieldRow($model, 'AULA', array('maxlength' => 20)); ?> <?php // echo $form->textFieldRow($model, 'NRO_ESTUDIANTES') ?> <?php echo $form->dropDownListRow($model, 'CURSO_ID', array('' => ' -- Seleccione -- ') + CHtml::listData(Curso::model()->findAll(), 'ID', Curso::representingColumn()), array('placeholder' => null)); ?> <?php echo $form->textFieldRow($model, 'NRO_EDICION', array('maxlength' => 20)); ?> <?php echo $form->dropDownListRow($model, 'HORARIO_ID', array('' => ' -- Seleccione -- ') + CHtml::listData(Horario::model()->findAll(), 'ID', 'horario_formato'), array('placeholder' => null)); ?> <div class="form-actions"> <?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> <?php $this->endWidget();