예제 #1
0
 /**
  * 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));
 }
예제 #2
0
<?php

$this->pageTitle = 'Modificar horario ' . Horarios::getDiaSemana($model->dia_semana) . ' ' . Horarios::hora($model->hora_inicio);
$bc = array();
$bc['Padre'] = $this->createUrl('programas/view', array('id' => $model->pgPrograma->pagina->micrositio->id));
$bc[] = 'Editar';
$this->breadcrumbs = $bc;
?>
<div class="col-sm-12">
<?php 
echo $this->renderPartial('_form', array('model' => $model));
?>
</div>
예제 #3
0
<?php

$this->pageTitle = 'Modificar horario ' . Horarios::getDiaSemana($model->dia_semana) . ' ' . Horarios::hora($model->hora_inicio);
?>
<h1>Modificar horario <?php 
echo Horarios::getDiaSemana($model->dia_semana) . ' ' . Horarios::hora($model->hora_inicio) . ' a ' . Horarios::hora($model->hora_fin);
?>
</h1>

<?php 
echo $this->renderPartial('_form', array('model' => $model));
예제 #4
0
파일: _form.php 프로젝트: Telemedellin/tm
            <input name="Horario[hora_inicio]" type="text" value="<?php 
echo $model->hora_inicio ? Horarios::hora($model->hora_inicio, true) : '';
?>
" class="hora_inicio form-control" />
        </div>
		<?php 
echo $form->error($model, 'hora_inicio');
?>
	</div>
	<div class="form-group">
		<?php 
echo $form->label($model, 'hora_fin', array('class' => 'col-sm-2 control-label'));
?>
		<div class="col-sm-2">
            <input name="Horario[hora_fin]" type="text" value="<?php 
echo $model->hora_fin ? Horarios::hora($model->hora_fin, true) : '';
?>
" class="hora_fin form-control" />
        </div>
		<?php 
echo $form->error($model, 'hora_fin');
?>
	</div>
	<div class="form-group">
        <?php 
echo $form->label($model, 'tipo_emision_id', array('class' => 'col-sm-2 control-label'));
?>
        <div class="col-sm-2">
            <?php 
echo $form->dropDownList($model, 'tipo_emision_id', CHtml::listData(TipoEmision::model()->findAll(), 'id', 'nombre'), array('class' => 'form-control'));
?>
예제 #5
0
 public static function fecha_especial($fechas)
 {
     date_default_timezone_set('America/Bogota');
     setlocale(LC_ALL, 'es_ES.UTF-8');
     $datos = array();
     $html = '';
     foreach ($fechas as $fecha) {
         $datos[] = array('fecha' => $fecha->fecha, 'hora_inicio' => $fecha->hora_inicio, 'hora_fin' => $fecha->hora_fin);
     }
     $te = 0;
     $previous = null;
     $c = count($datos);
     foreach ($datos as $dato) {
         $dant = $previous;
         $f = strtotime($dato['fecha']);
         $da = date('z', $f);
         $fant = strtotime($dant['fecha']);
         if (is_null($previous)) {
             $flag = true;
             $dan = $da - 1;
         } else {
             $flag = false;
             $dan = date('z', $fant);
         }
         $dp = $da - 1;
         if ($c == 1) {
             $html .= ucfirst(strftime('%A', $f)) . ' ' . date('d', $f) . ' de ' . ucfirst(strftime('%B', $f));
             $html .= ' de ' . '<time>' . Horarios::hora($dato['hora_inicio']) . '</time>';
             $html .= ' a ' . '<time>' . Horarios::hora($dato['hora_fin']) . '</time>';
             break;
         }
         if ($flag) {
             $html .= ucfirst(strftime('%A', $f)) . ' ' . date('d', $f) . ' de ' . ucfirst(strftime('%B', $f));
             if ($f !== $fant) {
                 $html .= ' de ' . '<time>' . Horarios::hora($dato['hora_inicio']) . '</time>';
                 $html .= ' a ' . '<time>' . Horarios::hora($dato['hora_fin']) . '</time>';
             }
         }
         if ($dp != $dan) {
             if ($f !== $fant) {
                 $html .= " al ";
                 $html .= ucfirst(strftime('%A', $fant)) . ' ' . date('d', $fant) . ' de ' . ucfirst(strftime('%B', $fant));
                 $html .= ' de ' . '<time>' . Horarios::hora($dato['hora_inicio']) . '</time>';
                 $html .= ' a ' . '<time>' . Horarios::hora($dato['hora_fin']) . '</time>';
                 $html .= "<br/><br/>";
                 $html .= ucfirst(strftime('%A', $f)) . ' ' . date('d', $f) . ' de ' . ucfirst(strftime('%B', $f));
             }
         }
         if ($dato === end($datos)) {
             if ($f !== $fant) {
                 $html .= " al ";
                 $html .= ucfirst(strftime('%A', $f)) . ' ' . date('d', $f) . ' de ' . ucfirst(strftime('%B', $f));
                 $html .= ' de ' . '<time>' . Horarios::hora($dato['hora_inicio']) . '</time>';
                 $html .= ' a ' . '<time>' . Horarios::hora($dato['hora_fin']) . '</time>';
             } else {
                 $html .= " y ";
                 $html .= ' de ' . '<time>' . Horarios::hora($dato['hora_inicio']) . '</time>';
                 $html .= ' a ' . '<time>' . Horarios::hora($dato['hora_fin']) . '</time>';
             }
         }
         $previous = $dato;
     }
     //$html = substr($html, 0, -2);
     $html = ucfirst(strtolower($html));
     return $html;
 }