private function akzioak($request, $que = false)
 {
     $this->yafirmado = $request->getParameter('yafirmado', 0);
     $this->sinatuta = $request->getParameter('sinatuta', 0);
     $id_fichero = $request->getParameter('id_fichero');
     $id_notificacion = $request->getParameter('id_notificacion', null);
     if (!is_null($id_notificacion)) {
         $notificacion_anterior = NotificacionesPeer::retrieveByPK($id_notificacion);
         $this->id_notificacion = $id_notificacion;
     } else {
         $notificacion_anterior = null;
     }
     if (!$que && $notificacion_anterior->getSoporte() == 'Internet firmado con certificado digital') {
         $pos = strrpos(UsuarioPeer::getRuta(), "https://");
         if ($pos === false) {
             header("location: " . str_replace("http://", "https://", UsuarioPeer::getRuta()) . '/notificaciones/enviar/id_notificacion/' . $notificacion_anterior->getNotId() . '/id_fichero/' . $notificacion_anterior->getIdFichero());
             exit;
         }
     }
     if ($que) {
         $con = Propel::getConnection();
         $query = "SELECT `notificaciones`.* FROM `notificaciones` WHERE `notificaciones`.`notid` != '" . $id_notificacion . "' AND `notificaciones`.`id_fichero` = '" . $id_fichero . "';";
         $statement = $con->prepare($query);
         $statement->execute();
         $anteriores_tipo = array();
         $anteriores_procesado = array();
         while ($notificaciones_anteriores = $statement->fetch(PDO::FETCH_OBJ)) {
             $anteriores_tipo[] = $notificaciones_anteriores->tipo;
             $anteriores_procesado[] = $notificaciones_anteriores->procesado;
         }
     }
     if ($que && in_array($que, $anteriores_tipo) && array_search($que, $anteriores_tipo) !== false && $anteriores_procesado[array_search($que, $anteriores_tipo)] == '0') {
         return sfView::ERROR;
     } else {
         $c = new Criteria();
         $c->addJoin(ItemPeer::ID_ITEM_BASE, ItemBasePeer::ID_ITEM_BASE, Criteria::JOIN);
         $c->addAnd(ItemPeer::ID_FORMULARIO, $id_fichero, Criteria::EQUAL);
         $c->addAnd(ItemBasePeer::ES_RESPONSABLE_FICHERO, true, Criteria::EQUAL);
         $item_encargado = ItemPeer::doSelectOne($c);
         if (is_null($item_encargado)) {
             return sfView::ERROR;
         } else {
             $this->id_fichero = $id_fichero;
             $this->empresa_actual = EmpresaPeer::retrieveByPK(sfContext::getInstance()->getUser()->getAttribute('idempresa', 0));
             $this->encargado = UsuarioPeer::retrieveByPk($item_encargado->getIdObjeto());
             $this->user_id = Usuario::getUsuarioActual()->getIdUsuario();
             $this->user = UsuarioPeer::retrieveByPk($this->user_id);
             return sfView::SUCCESS;
         }
     }
 }
Esempio n. 2
0
        <div style="width: 100%; border-bottom: 1px dotted black; font-weight: bold; font-size: 15px;">
        <?php 
echo __('Acceso a datos');
?>
        </div>

        <div style="clear: both; height: 6px;"></div>

        <div style="width: 100%; background-color: black; color: white; height: 20px; font-weight: bold; font-size: 12px; text-align: right; padding-top: 10px;">
        &nbsp;&nbsp;
        </div>
        
        <ul style="PADDING-RIGHT: 0px; PADDING-LEFT: 4px; FLOAT: left; PADDING-BOTTOM: 0px; MARGIN: 15px 0px; WIDTH: 100%; PADDING-TOP: 0px; LIST-STYLE-TYPE: none;">
          <?php 
/*$ruta=sfContext::getInstance()->getUser()->getAttribute('ruta_legedia',null);*/
$ruta = UsuarioPeer::getRuta();
$i = 1;
foreach ($tablas as $tabla) {
    $c = new Criteria();
    $c->addAnd(FormularioPeer::ID_TABLA, $tabla->getIdTabla(), Criteria::EQUAL);
    $c->addDescendingOrderByColumn(FormularioPeer::FECHA);
    $formularios = FormularioPeer::doSelect($c);
    if (sizeof($formularios) > 0) {
        $ult_mod = format_date($formularios[0]->getFecha(), "d");
    } else {
        $ult_mod = "-";
    }
    if ($i % 2 == 0) {
        $textalign = "right";
    } else {
        $textalign = "left";
function popUp($control_name, $formulario, $empresa = 0, $tabla = 0)
{
    use_helper('LightWindow');
    /*$ruta=sfContext::getInstance()->getUser()->getAttribute('ruta_ingema',null);*/
    $ruta = UsuarioPeer::getRuta();
    $ccontrol_name = str_replace("]", "", str_replace("[", "_", $control_name));
    $value = "";
    $value .= input_hidden_tag($control_name, $formulario->getIdFormulario(), array('control_name' => $control_name));
    $value .= "<a href=\"#\" align=\"right\" onclick=\"openPopup('','850','450','{$control_name}','" . $ruta . "/formularios/popup/?&control_name=" . $control_name . "&filters[id_empresa]=" . $empresa . "&filters[id_tabla]=" . $tabla . "&filter=filter',true);\" >" . image_tag("icons/application_view_columns", "border=0") . "</a>&nbsp;";
    $value .= input_tag($control_name . "_name", $formulario->__toString(), array("control_name" => $control_name, "disabled" => true, "size" => 15, "style" => "border: 0px; color: #000000; background-color : transparent; font-weight: bold;"));
    $value .= "<a href=\"#\" onclick=\"document.getElementById('" . $ccontrol_name . "').value = ''; document.getElementById('" . $ccontrol_name . "_name').value = '';\">" . image_tag("icons/close", "border=0") . "</a>&nbsp;";
    return $value;
}
Esempio n. 4
0
 public function __toString($to_file = false)
 {
     include_once SF_ROOT_DIR . "/lib/symfony/helper/DateHelper.php";
     if (!$this->getPrimaryKey()) {
         return null;
     }
     $campo = $this->getItemBase()->getCampo();
     $value = null;
     if (!$campo->esTipoLista()) {
         if ($campo->esTipoTextoLargo()) {
             $value = $this->getTextoLargo();
         } elseif ($campo->esTipoTextoCorto()) {
             $value = $this->getTextoCorto();
         } elseif ($campo->esTipoDocumento()) {
             if ($this->getTextoCorto() != "") {
                 $fname = explode("_", basename($this->getTextoCorto()));
                 if (sizeof($fname) > 1) {
                     $fname = substr(basename($this->getTextoCorto()), strlen($fname[0]) + 1);
                 } else {
                     $fname = $fname[0];
                 }
                 if ($to_file) {
                     $value = $fname;
                 } else {
                     $value = "<a href=\"" . dirname(UsuarioPeer::getRuta()) . "/index.php/formularios/download/?id_item=" . $this->getIdItem() . "&id_formulario=" . $this->getIdFormulario() . "\" target=\"_NEW\">" . $fname . "<a>";
                 }
             } else {
                 $value = "";
             }
         } elseif ($campo->esTipoNumero()) {
             $value = $this->getNumero();
         } elseif ($campo->esTipoFecha()) {
             $value = format_date($this->getFecha(), "D");
         } elseif ($campo->esTipoBooleano()) {
             if ($this->getSiNo()) {
                 $value = sfContext::getInstance()->getI18N()->__("SI");
             } else {
                 $value = sfContext::getInstance()->getI18N()->__("NO");
             }
         } elseif ($campo->esTipoSelectPeriodo()) {
             $value = nombre_periodo($campo->getTipoPeriodo(), $this->getNumero(), $this->getAnio());
         } elseif ($campo->esTipoTabla()) {
             $form = FormularioPeer::retrieveByPk($this->getIdTabla());
             if ($form != null) {
                 $value = $form->__toString();
             } else {
                 $value = "--";
             }
         } elseif ($campo->esTipoObjeto()) {
             eval("\$value = " . $campo->getValorObjeto() . "Peer::retrieveByPk(\$this->getIdObjeto());");
             if ($value != null) {
                 $value = $value->__toString();
             } else {
                 $value = "--";
             }
         }
     } else {
         //Obtener los items del mismo formulario cuyo campo id_campo coincida con el de nuestro id_item_base
         $c = new Criteria();
         $c->addAnd(ItemPeer::ID_FORMULARIO, $this->getIdFormulario(), Criteria::EQUAL);
         $c->addAnd(ItemPeer::SI_NO, 1, Criteria::EQUAL);
         $c->addJoin(ItemPeer::ID_ITEM_BASE, ItemBasePeer::ID_ITEM_BASE, Criteria::JOIN);
         $c->addAnd(ItemBasePeer::ID_CAMPO, $this->getItemBase()->getIdCampo(), Criteria::EQUAL);
         $items_base_seleccionados = ItemBasePeer::doSelect($c);
         if (sizeof($items_base_seleccionados)) {
             $value .= !$to_file ? "<ul class=\"sf_admin_checklist\">\n" : "";
             foreach ($items_base_seleccionados as $ibs) {
                 $value .= !$to_file ? "<li>" : "";
                 /****/
                 if ($campo->esListaTipoRangos()) {
                     //lista de rangos
                     $desde = null;
                     $hasta = null;
                     $unidad = CampoPeer::getHtmlTipoUnidad($campo->getUnidadRangos());
                     $unidad = $unidad ? "&nbsp;" . $unidad : '';
                     if ($ibs->getNumeroInferior() && $ibs->getNumeroInferior() != '') {
                         $desde = format_number($ibs->getNumeroInferior()) . $unidad;
                     }
                     if ($ibs->getNumeroSuperior() && $ibs->getNumeroSuperior() != '') {
                         $hasta = format_number($ibs->getNumeroSuperior()) . $unidad;
                     }
                     if ($desde && $hasta) {
                         $value .= __('desde %1% hasta %2%', array('%1%' => $desde, '%2%' => $hasta));
                     } else {
                         if ($desde) {
                             $value .= __('más de %1%', array('%1%' => $desde));
                         } elseif ($hasta) {
                             $value .= __('menos de %2%', array('%2%' => $hasta));
                         } else {
                             $value .= null;
                         }
                     }
                 } else {
                     $value .= $ibs->getTexto();
                 }
                 /****/
                 if ($ibs->getTextoAuxiliar()) {
                     $texto_auxiliar = $this->getTextoAuxiliar() ? $this->getTextoAuxiliar() : null;
                     $value .= isset($texto_auxiliar) ? "&nbsp;(" . $texto_auxiliar . ")" : '';
                 }
                 $value .= !$to_file ? "</li>" : " - ";
             }
             $value .= !$to_file ? "</ul>\n" : "";
             if (!$to_file) {
                 $value = substr($value, 0, strlen($value) - 3);
             }
         }
     }
     return $value;
 }
Esempio n. 5
0
</span>
    </div>
    <?php 
}
?>

        <div style="padding-top: 10px;">
            <div style="float: left; width: 80px;"><?php 
echo image_tag("dni.jpg", array("valign" => "middle"));
?>
</div>
            <div style="float: right; width: 190px; padding-top: 20px; font-size: 12px;"><?php 
echo __('Si lo desea, puede acceder con ');
?>
<a href="<?php 
echo str_replace("http://", "https://", UsuarioPeer::getRuta()) . "/login/loginDni";
?>
" style="font-weight: bold; color: #0612F4; font-size: 15px;"><?php 
echo __('DNI ELECTRÓNICO');
?>
</a></div>
        </div>
    </div>

    <div style="float: left; width: 350px; padding-left: 40px; border: 0px solid red;">

         <div>
            <div>
                <?php 
echo label_for('login[username]', __('Usuario') . ":", 'style="color: black; font-size: 13px;"');
?>
Esempio n. 6
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;
 }
            $objDSig->sign($objKey);
            /* Add associated public key */
            // $objDSig->add509Cert(file_get_contents(dirname(__FILE__) . '/mycert.pem'));
            // $objDSig->add509Cert(file_get_contents($user_cert_file_path));
            if (!file_exists($user_cert_file_path)) {
                die('File not found : ' . $user_cert_file_path);
            } else {
                $objDSig->add509Cert($user_cert_file_path);
            }
            $objDSig->appendSignature($doc->documentElement);
            $doc->save($target_file);
            ?>

            <h3>Por favor, apriete el botón "Enviar" para acabar con el registro del fichero en la Agencia de Proteccion de datos</h3>
            <?php 
            echo '<form id="formMyFirma" name="formMyFirma" method="post" onsubmit="document.getElementById(\'sinatuta\').value = signDigest(document.getElementById(\'sinatzeko\').value);" action="' . str_replace("http://", "https://", UsuarioPeer::getRuta()) . '/notificaciones/enviar/id_notificacion/' . $notificacion->notid . '/id_fichero/' . $notificacion->id_fichero . '/yafirmado/1">';
            echo '<input type="hidden" id="sinatzeko" name="sinatzeko" value="' . trim(strip_tags(_CANON_DATA)) . '">';
            echo '<input type="hidden" id="sinatuta" name="sinatuta" value="">';
            //echo '<input onclick="document.getElementById(\'sinatuta\').value = signDigest(document.getElementById(\'sinatzeko\').value);" value="Firmar documento con tarjeta" type="button"><br />';
            echo '<input type="submit" name="submit" value="Enviar" /><br />';
            echo '</form>';
            echo '<script type="text/javascript">';
            echo '/*document.getElementById(\'sinatuta\').value = signDigest(document.getElementById(\'sinatzeko\').value);*/';
            echo 'document.getElementById(\'formMyFirma\').submit();';
            echo '</script><br />';
            return true;
        }
    }
    ?>
        <fieldset>
            <label style="float:none; text-align:center; font-size: 12px" class="form1"><?php 
 function getThreeMonthHTML($m, $year)
 {
     $s = "";
     $anterior = $m - 1;
     $posterior = $m + 1;
     $yearAnterior = $year;
     $yearPosterior = $year;
     if ($m == 1) {
         $anterior = 12;
         $yearAnterior = $year - 1;
     } else {
         if ($m == 12) {
             $posterior = 1;
             $yearPosterior = $year + 1;
         }
     }
     $s .= "<table class=\"calendario\" cellspacing=\"0\" style=\"border:0px !important;\">\n";
     $s .= "<tr  >";
     $web = UsuarioPeer::getRuta();
     /*sfContext::getInstance()->getUser()->getAttribute('ruta');*/
     $ruta = $web . "/tareas";
     $s .= "<td class=\"calendarHeaderYear\" align=\"center\" rowspan=\"2\" >&nbsp;<a href='" . $ruta . "/list?mes=" . $anterior . "&year=" . $yearAnterior . "'><img  src='" . dirname($web) . "/images/icons/previous.png' alt='anterior' title='anterior'></a>&nbsp;&nbsp;&nbsp;</td>\n";
     $s .= "<td class=\"calendarHeaderYear\"><a href='" . $ruta . "/list?mes=" . date('m') . "&year=" . date('Y') . "'><img  src='" . dirname($web) . "/images/icons/calendar_view_day.png' alt='hoy' title='hoy'></a></td>";
     $s .= "<td class=\"calendarHeaderYear\" valign=\"top\" align=\"center\">" . $year . "</td>\n";
     $s .= "<td class=\"calendarHeaderYear\">&nbsp;</td>";
     $s .= "<td class=\"calendarHeaderYear\" align=\"center\" rowspan=\"2\" >&nbsp;&nbsp;&nbsp;<a href='" . $ruta . "/list?mes=" . $posterior . "&year=" . $yearPosterior . "'><img  src='" . dirname($web) . "/images/icons/next.png' alt='siguiente' title='siguiente'></a></td>\n";
     $s .= "</tr>\n";
     $s .= "<tr>";
     $s .= "<td class=\"month\" valign=\"top\">" . $this->getMonthHTML($anterior, $yearAnterior, 0) . "</td>\n";
     $this->lookSummary();
     $s .= "<td class=\"month\" valign=\"top\">" . $this->getMonthHTML($m, $year, 0) . "</td>\n";
     $this->lookSummary();
     $s .= "<td class=\"month\" valign=\"top\">" . $this->getMonthHTML($posterior, $yearPosterior, 0) . "</td>\n";
     $this->lookSummary();
     $s .= "</tr>\n";
     $s .= "</table>\n";
     $s .= "<script lang=\"Javascript\">";
     $s .= "function enviarFecha(fechahoy, fechamanana,mes,year) {";
     $s .= "\tdocument.getElementById(\"filters_fecha_inicio_from\").value= fechahoy;";
     $s .= "\tdocument.getElementById(\"filters_fecha_inicio_to\").value= fechamanana;";
     $s .= "\tdocument.getElementById(\"filtro_calendario\").value= 1;";
     $s .= "\tdocument.getElementById(\"mes\").value= mes;";
     $s .= "\tdocument.getElementById(\"year\").value= year;";
     $s .= "\tdocument.form_filtros.submit();";
     $s .= "}";
     $s .= "</script>";
     return $s;
 }
 public function executeEnviar_alarmas()
 {
     set_time_limit(0);
     $fecha = new Date();
     $fecha_uno = $fecha->toString(FMT_DATEMYSQL);
     $c1 = new Criteria();
     $crit0 = $c1->getNewCriterion(TareaPeer::FECHA_INICIO, $fecha_uno . " 00:00:00", Criteria::GREATER_EQUAL);
     $crit1 = $c1->getNewCriterion(TareaPeer::FECHA_INICIO, $fecha_uno . " 23:59:59", Criteria::LESS_EQUAL);
     $crit4 = $c1->getNewCriterion(TareaPeer::AVISAR_EMAIL, true, Criteria::EQUAL);
     $crit0->addAnd($crit1);
     $crit0->addAnd($crit4);
     $crit2 = $c1->getNewCriterion(TareaPeer::FECHA_VENCIMIENTO, $fecha_uno . " 00:00:00", Criteria::GREATER_EQUAL);
     $crit3 = $c1->getNewCriterion(TareaPeer::FECHA_VENCIMIENTO, $fecha_uno . " 23:59:59", Criteria::LESS_EQUAL);
     $crit5 = $c1->getNewCriterion(TareaPeer::AVISAR_EMAIL_FIN, true, Criteria::EQUAL);
     $crit2->addAnd($crit3);
     $crit2->addAnd($crit5);
     $crit0->addOr($crit2);
     $c1->add($crit0);
     $c1->setDistinct();
     $tareas_hoy = TareaPeer::doSelect($c1);
     foreach ($tareas_hoy as $tarea) {
         $asunto = $tarea->getResumen();
         $fecha_uno = $tarea->getFechaInicio('d/m/Y');
         $fecha_dos = $tarea->getFechaVencimiento('d/m/Y');
         if ($fecha_uno != $fecha_dos && $fecha_uno == date('d/m/Y')) {
             $cuerpo .= "<strong>Legedia</strong> - Inicio de ";
             $cuerpo .= $tarea->getEsEvento() ? "evento: " : "tarea: ";
         } elseif ($fecha_uno != $fecha_dos && $fecha_dos == date('d/m/Y')) {
             $cuerpo = "<strong>Legedia</strong> - Vencimiento de ";
             $cuerpo .= $tarea->getEsEvento() ? "evento: " : "tarea: ";
         } else {
             $cuerpo = "<strong>Legedia</strong> - " . $tarea->getEsEvento() ? "Evento:" : "Tarea: ";
         }
         $cuerpo .= $tarea->getResumen() . "<br />";
         $cuerpo .= "Inicio: " . $fecha_uno . "<br />";
         $cuerpo .= "Fin: " . $fecha_dos . "<br />";
         $cuerpo .= $tarea->getDescripcion();
         if ($tarea->getIdFormulario() != 0) {
             $form = FormularioPeer::retrieveByPK($tarea->getIdFormulario());
             if ($form instanceof Formulario) {
                 $cuerpo .= "Objeto relacionado: <a href=\"" . UsuarioPeer::getRuta() . "formularios/edit?id_formulario=" . $tarea->getIdFormulario() . "\">" . $form->__toString() . "</a>";
             }
         }
         $cuerpo .= "<br /><br />Muchas gracias<br /><br />Un Saludo<br />Administrador <strong>LEGEDIA</strong>\n";
         $mens = new Mensaje();
         $mens->setAsunto($asunto);
         $mens->setCuerpo($cuerpo);
         $mens->setEmail(true);
         $mens->setFecha(time());
         $mens->save();
         $c = new Criteria();
         $c->addAnd(MensajeDestinoPeer::ID_MENSAJE, $mens->getPrimaryKey());
         MensajeDestinoPeer::doDelete($c);
         $mensajeDestino = new MensajeDestino();
         $mensajeDestino->setIdMensaje($mens->getPrimaryKey());
         $mensajeDestino->setIdUsuario($tarea->getUsuario()->getIdUsuario());
         $mensajeDestino->save();
         echo $tarea->getUsuario()->getEmail() . "::" . $asunto . "<br />" . $cuerpo . "<br /><br />";
         if (trim($tarea->getUsuario()->getEmail()) != "") {
             $enviado = MensajePeer::enviarEmailDefault($tarea->getIdEmpresa(), $asunto, $cuerpo, array($tarea->getUsuario()->getEmail()));
         }
     }
     echo "ENVIADOS: " . $enviado;
     return sfView::NONE;
 }
 /**
  * Build and it gives format to the tabs or are main or secondary (sub tabs)
  * It makes use of following helpers
  * 
  * 1. link_to     (UrlHelper.php)
  * 2. content_tag (TagHelper.php)
  * 
  * @access private
  * @param  array   $tabs       The tabs to process
  * @param  string  $prefix     It can be "pt_" (main tabs) or "st_" (sub tabs)
  * @param  integer $levelTabs  The level of te tab: (1) main tab, (2) sub tab
  * @param  string  $parentTabs The name of the parent tab to whom the secondary ones belong
  * @return string The tabs with format surrounded between UL, LI & A
  */
 private function buildTabs($tabs, $prefix, $levelTabs, $parentTab = '')
 {
     $li = '';
     $otra_li = '';
     $internalUri = '';
     if (empty($parentTab)) {
         $actualModule = $this->actualModule;
     } else {
         $actualModule = $parentTab;
     }
     foreach ($tabs as $tab) {
         $actions = explode("/", $tab['action']);
         //neofis
         $action = $actions[0];
         //neofis
         if (Usuario::tienePermisos($tab['module'], $action)) {
             $options = "";
             if (!empty($this->actualAction) && $levelTabs == 2) {
                 if ($tab['module'] == $actualModule && $action == $this->actualAction) {
                     $tab['linkOptions'] += $this->configTabs[$prefix . 'a'];
                     $options = $this->configTabs[$prefix . 'li'];
                 }
             } elseif ($tab['module'] == $actualModule && $levelTabs == 2) {
                 $tab['linkOptions'] += $this->configTabs[$prefix . 'a'];
                 $options = $this->configTabs[$prefix . 'li'];
             } elseif ($tab['module'] == $actualModule && $levelTabs == 1) {
                 //neofis
                 if (isset($tab['link']) && ($tab['link'] = true)) {
                     $filters = sfContext::getInstance()->getUser()->getAttributeHolder()->getAll('sf/formulario/filters');
                     if (isset($filters['id_tabla']) && isset($tab['id_tabla']) && $filters['id_tabla'] == $tab['id_tabla']) {
                         $tab['linkOptions'] += $this->configTabs[$prefix . 'a'];
                     }
                 } else {
                     $tab['linkOptions'] += $this->configTabs[$prefix . 'a'];
                 }
                 $options = $this->configTabs[$prefix . 'li'];
             }
             // formando el URI
             if (isset($tab['action'])) {
                 $internalUri = $tab['module'] . '/' . $tab['action'];
             } else {
                 $internalUri = $tab['module'];
             }
             // formando el contenido de <a> y <li>
             //neofis
             if (isset($tab['link']) && ($tab['link'] = true)) {
                 $txt_options = "";
                 foreach ($tab['linkOptions'] as $option => $value) {
                     $txt_options .= $option . "=\"" . $value . "\" ";
                 }
                 /*$ruta=sfContext::getInstance()->getUser()->getAttribute('ruta_legedia',null);*/
                 $ruta = UsuarioPeer::getRuta();
                 $a = '<a href="' . $ruta . "/" . $internalUri . '" ' . $txt_options . '>' . $tab['label'] . '</a>';
             } else {
                 $a = link_to($tab['label'], $internalUri, $tab['linkOptions']);
             }
             //neofis
             if (isset($tab['otra_fila'])) {
                 $otra_li .= content_tag('li', $a, $options);
             } else {
                 $li .= content_tag('li', $a, $options);
             }
         }
     }
     if ($otra_li != "") {
         $otra_ulLi = content_tag('ul', $otra_li, $this->configTabs['mi_ul']);
     } else {
         $otra_ulLi = "";
     }
     $ulLi = content_tag('ul', $li, $this->configTabs[$prefix . 'ul']);
     return $otra_ulLi . $ulLi;
 }
Esempio n. 11
0
 public function executeDelete()
 {
     $id_formulario_proviene = $this->getRequestParameter('id_formulario_proviene', null);
     $this->formulario = FormularioPeer::retrieveByPk($this->getRequestParameter('id_formulario'));
     $this->forward404Unless($this->formulario);
     $id_empresa = $this->formulario->getTabla()->getIdEmpresa();
     $id_tabla = $this->formulario->getIdTabla();
     try {
         $this->deleteFormulario($this->formulario);
     } catch (PropelException $e) {
         $this->getRequest()->setError('delete', 'No ha podido borrarse la formulario. Asegúrese de que no tiene ningún objeto asociado.');
         return $this->forward('formularios', 'list');
     }
     if ($id_formulario_proviene != null) {
         return $this->redirect('formularios/edit?id_formulario=' . $id_formulario_proviene);
     } else {
         //return $this->redirect('formularios/list');
         /*$ruta=sfContext::getInstance()->getUser()->getAttribute('ruta_legedia',null);*/
         $ruta = UsuarioPeer::getRuta();
         $dir = $ruta . "/formularios/list/?filters[id_empresa]=" . $id_empresa . "&filters[id_tabla]=" . $id_tabla . "&filter=filter";
         header("location: {$dir}");
     }
     exit;
 }