Example #1
0
    ?>
 form-error<?php 
}
?>
">
  <?php 
if ($sf_request->hasError('tarea{id_estado_tarea}')) {
    ?>
    <?php 
    echo form_error('tarea{id_estado_tarea}', array('class' => 'form-error-msg'));
    ?>
  <?php 
}
?>
  <?php 
$opciones = TareaPeer::getAllEstadosTareas();
$value = select_tag('tarea[id_estado_tarea]', objects_for_select($opciones, 'getPrimaryKey', '__toString', $tarea->getIdEstadoTarea(), array('include_blank' => false, 'control_name' => 'tarea[id_estado_tarea]')));
echo $value ? $value : "&nbsp";
?>
  </div>
</div>

<div class="form-row">
  <?php 
echo label_for('tarea[fecha_inicio]', __($labels['tarea{fecha_inicio}']) . ":", '');
?>
  <div class="content<?php 
if ($sf_request->hasError('tarea{fecha_inicio}')) {
    ?>
 form-error<?php 
}
Example #2
0
    $html .= label_for("filters[estado_" . $i . "]", $estado->__toString() ? __($estado->__toString()) : '-');
    $html .= "</li>\n";
}
$html .= "</ul>\n";
echo $html;
?>
    </div>
  </div>
    
    <div class="form-row">
    <?php 
echo label_for("filters[estado_evento]", __('estado evento') . ":");
?>
    <div class="content">
    <?php 
$opciones = TareaPeer::getAllEstadosEventos();
$html = "";
$html .= "<ul class=\"sf_admin_checklist\">\n";
foreach ($opciones as $estado) {
    $i = $estado->getPrimaryKey();
    $es_seleccionado = isset($filters['estado_' . $i]) ? true : false;
    $html .= "<li>";
    $html .= checkbox_tag('filters[estado_' . $i . ']', true, $es_seleccionado);
    $html .= label_for("filters[estado_" . $i . "]", $estado->__toString() ? __($estado->__toString()) : '-');
    $html .= "</li>\n";
}
$html .= "</ul>\n";
echo $html;
?>
    </div>
  </div>
Example #3
0
 /**
  * Populates the object using an array.
  *
  * This is particularly useful when populating an object from one of the
  * request arrays (e.g. $_POST).  This method goes through the column
  * names, checking to see whether a matching key exists in populated
  * array. If so the setByName() method is called for that column.
  *
  * You can specify the key type of the array by additionally passing one
  * of the class type constants BasePeer::TYPE_PHPNAME, BasePeer::TYPE_STUDLYPHPNAME,
  * BasePeer::TYPE_COLNAME, BasePeer::TYPE_FIELDNAME, BasePeer::TYPE_NUM.
  * The default key type is the column's phpname (e.g. 'AuthorId')
  *
  * @param      array  $arr     An array to populate the object from.
  * @param      string $keyType The type of keys the array uses.
  * @return     void
  */
 public function fromArray($arr, $keyType = BasePeer::TYPE_PHPNAME)
 {
     $keys = TareaPeer::getFieldNames($keyType);
     if (array_key_exists($keys[0], $arr)) {
         $this->setIdTarea($arr[$keys[0]]);
     }
     if (array_key_exists($keys[1], $arr)) {
         $this->setIdEmpresa($arr[$keys[1]]);
     }
     if (array_key_exists($keys[2], $arr)) {
         $this->setIdEstadoTarea($arr[$keys[2]]);
     }
     if (array_key_exists($keys[3], $arr)) {
         $this->setIdUsuario($arr[$keys[3]]);
     }
     if (array_key_exists($keys[4], $arr)) {
         $this->setAvisarEmail($arr[$keys[4]]);
     }
     if (array_key_exists($keys[5], $arr)) {
         $this->setAvisarEmailFin($arr[$keys[5]]);
     }
     if (array_key_exists($keys[6], $arr)) {
         $this->setEsEvento($arr[$keys[6]]);
     }
     if (array_key_exists($keys[7], $arr)) {
         $this->setFechaInicio($arr[$keys[7]]);
     }
     if (array_key_exists($keys[8], $arr)) {
         $this->setFechaVencimiento($arr[$keys[8]]);
     }
     if (array_key_exists($keys[9], $arr)) {
         $this->setResumen($arr[$keys[9]]);
     }
     if (array_key_exists($keys[10], $arr)) {
         $this->setDescripcion($arr[$keys[10]]);
     }
     if (array_key_exists($keys[11], $arr)) {
         $this->setIdCampo($arr[$keys[11]]);
     }
     if (array_key_exists($keys[12], $arr)) {
         $this->setIdFormulario($arr[$keys[12]]);
     }
     if (array_key_exists($keys[13], $arr)) {
         $this->setCreatedAt($arr[$keys[13]]);
     }
     if (array_key_exists($keys[14], $arr)) {
         $this->setUpdatedAt($arr[$keys[14]]);
     }
 }
 /**
  * If this collection has already been initialized with
  * an identical criteria, it returns the collection.
  * Otherwise if this Usuario is new, it will return
  * an empty collection; or if this Usuario has previously
  * been saved, it will retrieve related Tareas from storage.
  *
  * This method is protected by default in order to keep the public
  * api reasonable.  You can provide public methods for those you
  * actually need in Usuario.
  */
 public function getTareasJoinEmpresa($criteria = null, $con = null, $join_behavior = Criteria::LEFT_JOIN)
 {
     if ($criteria === null) {
         $criteria = new Criteria(UsuarioPeer::DATABASE_NAME);
     } elseif ($criteria instanceof Criteria) {
         $criteria = clone $criteria;
     }
     if ($this->collTareas === null) {
         if ($this->isNew()) {
             $this->collTareas = array();
         } else {
             $criteria->add(TareaPeer::ID_USUARIO, $this->id_usuario);
             $this->collTareas = TareaPeer::doSelectJoinEmpresa($criteria, $con, $join_behavior);
         }
     } else {
         // the following code is to determine if a new query is
         // called for.  If the criteria is the same as the last
         // one, just return the collection.
         $criteria->add(TareaPeer::ID_USUARIO, $this->id_usuario);
         if (!isset($this->lastTareaCriteria) || !$this->lastTareaCriteria->equals($criteria)) {
             $this->collTareas = TareaPeer::doSelectJoinEmpresa($criteria, $con, $join_behavior);
         }
     }
     $this->lastTareaCriteria = $criteria;
     return $this->collTareas;
 }
Example #5
0
 public static function createCalendario($modo)
 {
     //include_once('CalendarShow.class.php');
     $cal = new CalendarShow();
     $diasEvento = array();
     $diasTareas = array();
     $c1 = TareaPeer::getCriterioAlcance();
     $c1->addAnd(TareaPeer::getCriterionPendientesConFuturo());
     $dias = TareaPeer::doSelect($c1);
     $ruta = UsuarioPeer::getRuta();
     foreach ($dias as $dia) {
         $fecha_inicio = $dia->getFechaInicio('Y-m-d');
         $fecha_fin = $dia->getFechaVencimiento('Y-m-d');
         if ($fecha_inicio == $fecha_fin) {
             if ($dia->getEsEvento() == '1') {
                 if (!isset($diasEvento[$fecha_inicio])) {
                     $diasEvento[$fecha_inicio] = "";
                 }
                 //$diasEvento[$fecha_inicio] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
                 $diasEvento[$fecha_inicio] .= $dia->getResumen();
             } else {
                 if (!isset($diasTareas[$fecha_inicio])) {
                     $diasTareas[$fecha_inicio] = "";
                 }
                 //$diasTareas[$fecha_inicio] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
                 $diasTareas[$fecha_inicio] .= $dia->getResumen();
             }
         } else {
             if ($dia->getEsEvento() == '1') {
                 if (!isset($diasEvento[$fecha_inicio])) {
                     $diasEvento[$fecha_inicio] = "";
                 }
                 if (!isset($diasEvento[$fecha_fin])) {
                     $diasEvento[$fecha_fin] = "";
                 }
                 //$diasEvento[$fecha_inicio] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Inicio Evento: ".$dia->getResumen()."</a></div>";
                 $diasEvento[$fecha_inicio] .= $dia->getResumen();
                 //$diasEvento[$fecha_fin] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Vencimiento Evento: ".$dia->getResumen()."</a></div>";
                 $diasEvento[$fecha_fin] .= $dia->getResumen();
             } else {
                 if (!isset($diasTareas[$fecha_inicio])) {
                     $diasTareas[$fecha_inicio] = "";
                 }
                 if (!isset($diasTareas[$fecha_fin])) {
                     $diasTareas[$fecha_fin] = "";
                 }
                 //$diasTareas[$fecha_inicio] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Inicio Tarea: ".$dia->getResumen()."</a></div>";
                 $diasTareas[$fecha_inicio] .= $dia->getResumen();
                 //$diasTareas[$fecha_fin] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">Vencimiento Tarea: ".$dia->getResumen()."</a></div>";
                 $diasTareas[$fecha_fin] .= $dia->getResumen();
             }
         }
         /*
         		 if ($dia->getEsEvento() == '1') {	 	
         		 	
         		 	if (isset($diasEvento[$fecha])) 
         		 		$diasEvento[$fecha] .= "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
         		 	else 
         		 		$diasEvento[$fecha] = "<div style=\"background-color: #4078B5; color: #ffffff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";
         		 		
         		 }	
         		 else { 	
         		 
         		 	if (isset($diasTareas[$fecha])) 
         		 		$diasTareas[$fecha] .= "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";		 	
         		 	else 
         		 		$diasTareas[$fecha] = "<div style=\"background-color: #76BB5F; color: #fff;\"><a href=\"".$ruta."/tareas/show/?id_tarea=".$dia->getIdTarea()."\" style=\"color: #ffffff;\">".$dia->getResumen()."</a></div>";		 	
         		 	
         		 }
         */
         $filters = array();
         $filters['fecha_inicio']['from'] = $dia->getFechaInicio('d/m/Y');
         $filters['fecha_inicio']['to'] = $dia->getFechaInicio('d/m/Y');
         if ($modo) {
             if ($fecha_inicio != $fecha_fin) {
                 $cal->setDateLink($fecha_inicio, "tareas/list?mes=" . $dia->getFechaInicio('m') . "&year=" . $dia->getFechaInicio('Y') . "&filters=" . $filters);
                 $cal->setDateLink($fecha_fin, "tareas/list?mes=" . $dia->getFechaInicio('m') . "&year=" . $dia->getFechaInicio('Y') . "&filters=" . $filters);
             } else {
                 $cal->setDateLink($fecha_inicio, "tareas/list?mes=" . $dia->getFechaInicio('m') . "&year=" . $dia->getFechaInicio('Y') . "&filters=" . $filters);
             }
         } else {
             if ($fecha_inicio != $fecha_fin) {
                 $cal->setDateLink($fecha_inicio, "1");
                 $cal->setDateLink($fecha_fin, "1");
             } else {
                 $cal->setDateLink($fecha_inicio, "1");
             }
         }
         /*
         		if ($modo) $cal->setDateLink($fecha,  "tareas/list?mes=".$dia->getFechaInicio('m')."&year=".$dia->getFechaInicio('Y')."&filters=".$filters);	 
         		else $cal->setDateLink($fecha, "1");
         */
     }
     $cal->setDaysInColor($diasEvento);
     $cal->setDaysFree($diasTareas);
     return $cal;
 }
 protected function getCriterio()
 {
     return TareaPeer::getCriterioAlcance();
 }
 /**
  * Retrieve multiple objects by pkey.
  *
  * @param      array $pks List of primary keys
  * @param      PropelPDO $con the connection to use
  * @throws     PropelException Any exceptions caught during processing will be
  *		 rethrown wrapped into a PropelException.
  */
 public static function retrieveByPKs($pks, PropelPDO $con = null)
 {
     if ($con === null) {
         $con = Propel::getConnection(TareaPeer::DATABASE_NAME, Propel::CONNECTION_READ);
     }
     $objs = null;
     if (empty($pks)) {
         $objs = array();
     } else {
         $criteria = new Criteria(TareaPeer::DATABASE_NAME);
         $criteria->add(TareaPeer::ID_TAREA, $pks, Criteria::IN);
         $objs = TareaPeer::doSelect($criteria, $con);
     }
     return $objs;
 }
 protected function updateItemsFormularioFromRequest($empresa, $id_tabla = null)
 {
     //parametros obtenidos de la formulario_modelo.
     if (!$empresa) {
         return null;
     }
     $campos = $empresa->getCamposFormularioOrdenadosAlcancetablas($id_tabla);
     foreach ($campos as $campo) {
         $name_campo = "campo_" . $campo->getIdCampo();
         $datos_campo = $this->getRequestParameter($name_campo);
         if (!$campo->esTipoLista()) {
             $item_base = $campo->getElementoUnico();
             $name_item = "item_base_" . $item_base->getIdItemBase() . "";
             $item = $this->getItemOrCreate($item_base->getIdItemBase());
             $item->setIdFormulario($this->formulario->getIdFormulario());
             if ($campo->esTipoTextoCorto()) {
                 $item->setTextoCorto(isset($datos_campo[$name_item]) && $datos_campo[$name_item] != '' ? $datos_campo[$name_item] : null);
             } elseif ($campo->esTipoTextoLargo()) {
                 $item->setTextoLargo(isset($datos_campo[$name_item]) && $datos_campo[$name_item] != '' ? $datos_campo[$name_item] : null);
             } elseif ($campo->esTipoNumero()) {
                 $item->setNumero(isset($datos_campo[$name_item]) && $datos_campo[$name_item] != '' ? $datos_campo[$name_item] : null);
             } elseif ($campo->esTipoFecha()) {
                 if (isset($datos_campo[$name_item]) && $datos_campo[$name_item] != "") {
                     $value = sfContext::getInstance()->getI18N()->getTimestampForCulture($datos_campo[$name_item], $this->getUser()->getCulture());
                     $mi_date = new Date($value);
                     $item->setFecha($mi_date->getTimestamp());
                     //BORRAMOS LAS TAREAS QUE EXISTAN PARA ESTE ITEM, AUNQUE SEA UN CAMPO SIN ALARMA, POR SI ACASO
                     if ($item->getIdItem() != 0) {
                         $c = new Criteria();
                         $c->addAnd(TareaPeer::ID_CAMPO, $campo->getIdCampo(), Criteria::EQUAL);
                         $c->addAnd(TareaPeer::ID_FORMULARIO, $this->formulario->getIdFormulario(), Criteria::EQUAL);
                         TareaPeer::doDelete($c);
                     }
                     //CAMPOS CON ALARMA
                     if ($campo->getMostrarEnPadre() && isset($datos_campo["tiene_alarma"])) {
                         $item->setSiNo(true);
                         $item->setNumero($datos_campo['usuario_avisar']);
                         if (!isset($datos_campo['cuando_alarma'])) {
                             $datos_campo['cuando_alarma'] = array();
                         }
                         if (!is_array($datos_campo['cuando_alarma'])) {
                             $datos_campo['cuando_alarma'] = array($datos_campo['cuando_alarma']);
                         }
                         $cuando = implode("##", $datos_campo['cuando_alarma']);
                         $item->setTextoCorto($cuando);
                         //CREAMOS TAREAS
                         foreach ($datos_campo['cuando_alarma'] as $cu) {
                             if ($cu == "1") {
                                 $fecha_avisar = new Date($mi_date->getTimestamp());
                                 $fecha_avisar->addMonths(-1);
                                 $txt_avisar = "Falta un mes para";
                             } else {
                                 if ($cu == "2") {
                                     $fecha_avisar = new Date($mi_date->getTimestamp());
                                     $fecha_avisar->addWeeks(-2);
                                     $txt_avisar = "Faltan dos semanas para";
                                 } else {
                                     if ($cu == "3") {
                                         $fecha_avisar = new Date($mi_date->getTimestamp());
                                         $fecha_avisar->addWeeks(-1);
                                         $txt_avisar = "Falta una semana para";
                                     } else {
                                         if ($cu == "4") {
                                             $fecha_avisar = new Date($mi_date->getTimestamp());
                                             $fecha_avisar->addDays(-1);
                                             $txt_avisar = "Falta un día para";
                                         } else {
                                             if ($cu == "5") {
                                                 $fecha_avisar = new Date($mi_date->getTimestamp());
                                                 //$fecha_avisar->addMonths(-1);
                                                 $txt_avisar = "";
                                             }
                                         }
                                     }
                                 }
                             }
                             $hoy = new Date();
                             if ($fecha_avisar->getTimestamp() < $hoy->getTimestamp()) {
                                 continue;
                             }
                             $tarea = new Tarea();
                             $tarea->setIdCampo($campo->getIdCampo());
                             $tarea->setIdFormulario($this->formulario->getIdFormulario());
                             $tarea->setIdEmpresa(sfContext::getInstance()->getUser()->getAttribute('idempresa'));
                             if ($item->getNumero() != "" || $item->getNumero() != "0") {
                                 $tarea->setAvisarEmail(true);
                                 $tarea->setIdUsuario($item->getNumero());
                             } else {
                                 $tarea->setAvisarEmail(false);
                             }
                             $mtabla = TablaPeer::retrieveByPK($id_tabla);
                             if (!$mtabla instanceof Tabla) {
                                 $mtabla = new Tabla();
                             }
                             $txt = $txt_avisar . " el " . $item->__toString() . ", '" . strtolower($campo->getNombre()) . "' de '" . strtolower($mtabla->getNombre()) . "' para '" . $this->formulario->__toString() . "'";
                             $tarea->setResumen($txt);
                             $tarea->setEsEvento(false);
                             $tarea->setIdEstadoTarea(TareaPeer::ID_ESTADO_TAREA_PLANEADO);
                             $fecha_avisar->setHours(8);
                             $fecha_avisar->setMinutes(0);
                             $tarea->setFechaInicio($fecha_avisar->getTimestamp());
                             $fecha_avisar->setHours(20);
                             $fecha_avisar->setMinutes(0);
                             $tarea->setFechaVencimiento($fecha_avisar->getTimestamp());
                             $tarea->save();
                             //$mis_tareas[] = $tarea->getIdTarea();
                         }
                     } else {
                         $item->setSiNo(false);
                         $item->setTextoCorto("");
                     }
                 } else {
                     $item->setFecha(null);
                 }
             } elseif ($campo->esTipoBooleano()) {
                 $item->setSiNo(isset($datos_campo[$name_item]) ? true : false);
             } elseif ($campo->esTipoSelectPeriodo()) {
                 $name_item_year = "item_base_year_" . $item_base->getIdItemBase();
                 //hace falta nuevo campo en "item", para almacenar el tipo de periodo.
                 $item->setNumero(isset($datos_campo[$name_item]) ? $datos_campo[$name_item] : null);
                 $item->setAnio(isset($datos_campo[$name_item_year]) && $datos_campo[$name_item_year] != '' ? $datos_campo[$name_item_year] : null);
             } elseif ($campo->esTipoTabla()) {
                 $item->setIdTabla(isset($datos_campo[$name_item]) && $datos_campo[$name_item] != '' ? $datos_campo[$name_item] : null);
             } elseif ($campo->esTipoObjeto()) {
                 $item->setIdObjeto(isset($datos_campo[$name_item]) && $datos_campo[$name_item] != '' ? $datos_campo[$name_item] : null);
             } elseif ($campo->esTipoDocumento()) {
                 $fileName = $this->getRequest()->getFileName($name_campo);
                 if (isset($fileName) && $fileName != '') {
                     $filePath = $this->getRequest()->getFilePath($name_campo);
                     if (is_uploaded_file($filePath)) {
                         if (!file_exists(sfConfig::get('app_directorio_upload') . '/docs/')) {
                             mkdir(sfConfig::get('app_directorio_upload') . '/docs/');
                         }
                         if ($item->getTextoCorto() != "") {
                             @unlink(sfConfig::get('app_directorio_upload') . '/docs/' . $item->getTextoCorto());
                         }
                         move_uploaded_file($filePath, sfConfig::get('app_directorio_upload') . '/docs/' . $item->getIdItem() . "_" . $fileName);
                         $item->setTextoCorto($item->getIdItem() . "_" . $fileName);
                     }
                 }
             } else {
                 //?
             }
             if (!$item->isDeleted()) {
                 //$this->formulario->addItem($item)
                 $item->save();
             }
         } else {
             //es una lista
             $id_item_base_radio_seleccionado = isset($datos_campo['item_base']) ? $datos_campo['item_base'] : null;
             $items_base = $campo->getItemsBaseOrdenados();
             foreach ($items_base as $item_base) {
                 $name_item = "item_base_" . $item_base->getIdItemBase() . "";
                 $name_item_texto_auxiliar = "item_base_texto_" . $item_base->getIdItemBase();
                 if ($campo->getSeleccionMultiple()) {
                     $item = $this->getItemOrCreate($item_base->getIdItemBase());
                     $item->setIdFormulario($this->formulario->getIdFormulario());
                     if (isset($datos_campo[$name_item])) {
                         $item->setSiNo(true);
                         $item->setTextoAuxiliar(isset($datos_campo[$name_item_texto_auxiliar]) ? $datos_campo[$name_item_texto_auxiliar] : '');
                     } else {
                         if (!$item->isNew()) {
                             $item->setSiNo(false);
                             $item->setTextoAuxiliar(null);
                         }
                         //anteriormente lo borraba.
                     }
                     if (!$item->isDeleted()) {
                         //$this->formulario->addItem($item);
                         $item->save();
                     }
                 } else {
                     //solo puede haber uno.
                     $item_radio = $this->getItemOrCreate($item_base->getIdItemBase());
                     $item_radio_anterior = $item_radio;
                     if ($item_base->getIdItemBase() == $id_item_base_radio_seleccionado) {
                         $item_radio_seleccionado = $this->getItemOrCreate($item_base->getIdItemBase());
                         $item_radio_seleccionado->setIdFormulario($this->formulario->getIdFormulario());
                         $item_radio_seleccionado->setSiNo(true);
                         $item_radio_seleccionado->setTextoAuxiliar(isset($datos_campo[$name_item_texto_auxiliar]) ? $datos_campo[$name_item_texto_auxiliar] : '');
                         //$this->formulario->addItem($item_radio_seleccionado);
                         $item_radio_seleccionado->save();
                     } else {
                         $item_radio_no_seleccionado = $this->getItemOrCreate($item_base->getIdItemBase());
                         if ($item_radio_no_seleccionado->getIdItem()) {
                             $item_radio_no_seleccionado->delete();
                         }
                     }
                 }
             }
         }
         //fin lista
     }
     //die();
 }
 function executeCambiarcalendario()
 {
     $mes = $this->getRequestParameter('mes');
     $year = $this->getRequestParameter("year");
     //include_once('CalendarShow.class.php');
     $cal = TareaPeer::createCalendarioMes($mes, $year, 0);
     $this->calendarioMes = $cal->getMonthView($mes, $year);
     $this->sumario = $cal->getTxtSummary();
     $this->mes = $mes;
     $this->year = $year;
 }