return false;
        });
        // Hook up the print link.
        jQuery('.print-button').click(function() {  // Print the DIV.
            jQuery('#printable').css({'margin-left' : '1%'});
            jQuery('#printable').css({'margin-right' : '1%'});
            jQuery('head').append('<link rel="stylesheet" href="<?php 
echo substr(Notificaciones::selfURL(), 0, strpos(Notificaciones::selfURL(), 'web/') + 4) . '/css/principal.css';
?>
" type="text/css" media="print" />');
            jQuery('head').append('<link rel="stylesheet" href="<?php 
echo substr(Notificaciones::selfURL(), 0, strpos(Notificaciones::selfURL(), 'web/') + 4) . '/css/sfCssTabs.css';
?>
" type="text/css" media="print" />');
            jQuery('head').append('<link rel="stylesheet" href="<?php 
echo substr(Notificaciones::selfURL(), 0, strpos(Notificaciones::selfURL(), 'web/') + 4) . '/css/notificaciones.css';
?>
" type="text/css" media="print" />');
            jQuery('#printable').print();
            // Cancel click event.
            return false;
        });
    });
-->
</script>

<?php 
$dir = sfConfig::get('sf_upload_dir') . DIRECTORY_SEPARATOR . $id_fichero . '-' . $id_notificacion . '.xml';
$con = Propel::getConnection();
$query = "SELECT `notificaciones`.* FROM `notificaciones` WHERE `notificaciones`.`notid` = '" . $id_notificacion . "' AND `notificaciones`.`id_fichero` = '" . $id_fichero . "';";
$statement = $con->prepare($query);
 public function executeEdit()
 {
     if ($this->getRequestParameter('layout', '')) {
         $this->setLayout('popup');
     }
     $this->tablaFicheros = TablaPeer::getTablaFicheros();
     $this->id_formulario_proviene = $this->getRequestParameter('id_formulario_proviene', null);
     $this->id_tabla_proviene = $this->getRequestParameter('id_tabla_proviene', null);
     $this->formulario = $this->getFormularioOrCreate();
     $this->items = $this->formulario->getArrayItems();
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         //GENERAMOS EL ID DEL FORMULARIO PARA QUE LO PUEDA COGER LA TAREA AL GUARDALA
         if ($this->formulario->getIdFormulario() == 0) {
             $this->saveFormulario($this->formulario);
         }
         $this->updateFormularioFromRequest();
         $this->saveFormulario($this->formulario);
         $this->getUser()->setFlash('notice', 'Las modificaciones se han guardado');
         if ($this->getRequestParameter('save_and_add')) {
             if ($this->id_formulario_proviene != null) {
                 return $this->redirect('formularios/create/?id_tabla=' . $this->formulario->getIdTabla() . "&id_formulario_proviene=" . $this->id_formulario_proviene);
             } else {
                 return $this->redirect('formularios/create/?id_tabla=' . $this->formulario->getIdTabla());
             }
         } else {
             if ($this->getRequestParameter('save_and_list')) {
                 /*$ruta=sfContext::getInstance()->getUser()->getAttribute('ruta_legedia',null);*/
                 $ruta = UsuarioPeer::getRuta();
                 if ($this->id_formulario_proviene != null) {
                     return $this->redirect('formularios/edit?id_formulario=' . $this->id_formulario_proviene);
                 } else {
                     $dir = $ruta . "/formularios/list/?filters[id_empresa]=" . $this->formulario->getTabla()->getIdEmpresa() . "&filters[id_tabla]=" . $this->formulario->getIdTabla() . "&filter=filter";
                     header("location: {$dir}");
                 }
                 exit;
                 //return $this->redirect('formularios/list');
             } else {
                 if ($this->id_formulario_proviene != null) {
                     return $this->redirect('formularios/edit?id_formulario=' . $this->id_formulario_proviene);
                 } else {
                     $pre = str_replace('formularios/edit', 'notificaciones/inscribir/id_fichero/', Notificaciones::selfURL());
                     if (isset($_POST['modelo']) && isset($_POST['sistema']) && isset($_POST['tip'])) {
                         header('Location: ' . $pre . $this->formulario->getIdFormulario() . '?model=' . $_POST['modelo'] . '&type=' . $_POST['tip'] . '&system=' . $_POST['sistema'] . '&redirect=1');
                     } elseif (isset($_POST['modelo']) && isset($_POST['sistema'])) {
                         header('Location: ' . $pre . $this->formulario->getIdFormulario() . '?model=' . $_POST['modelo'] . '&system=' . $_POST['sistema'] . '&redirect=1');
                     } else {
                         //echo "--".$this->formulario->getIdFormulario();exit();
                         return $this->redirect('formularios/edit?id_formulario=' . $this->formulario->getIdFormulario());
                     }
                 }
             }
         }
     } else {
         $this->tablas_auxiliares = array();
         if ($this->formulario->getIdFormulario() != 0) {
             //Obtengo si hay un campo de tipo Tabla cuya tabla sea esta y tenga el mostrar_en_padre
             $c = new Criteria();
             $c->AddJoin(CampoPeer::ID_CAMPO, RelCampoTablaPeer::ID_CAMPO, Criteria::JOIN);
             $c->AddJoin(RelCampoTablaPeer::ID_TABLA, TablaPeer::ID_TABLA, Criteria::JOIN);
             $id_empresa = sfContext::getInstance()->getUser()->getAttribute('idempresa', 0);
             $c->addAnd(TablaPeer::ID_EMPRESA, $id_empresa, Criteria::EQUAL);
             $c->addAnd(CampoPeer::TIPO, CampoPeer::ID_TABLA, Criteria::EQUAL);
             $c->addAnd(CampoPeer::MOSTRAR_EN_PADRE, 1, Criteria::EQUAL);
             $c->addAnd(CampoPeer::VALOR_TABLA, $this->formulario->getIdTabla(), Criteria::EQUAL);
             $campos_rel = CampoPeer::doSelect($c);
             foreach ($campos_rel as $campo_rel) {
                 //DEL CAMPO OBTENEMOS LA TABLA
                 $tablas_rel = $campo_rel->getRelCampoTablas();
                 $tabla_rel = $tablas_rel[0];
                 unset($tablas_rel);
                 $c = $this->getCriterio();
                 $c->addJoin(FormularioPeer::ID_FORMULARIO, ItemPeer::ID_FORMULARIO, Criteria::JOIN);
                 $c->addJoin(ItemPeer::ID_ITEM_BASE, ItemBasePeer::ID_ITEM_BASE, Criteria::JOIN);
                 $c->addAnd(ItemBasePeer::ID_CAMPO, $campo_rel->getIdCampo(), Criteria::EQUAL);
                 $c->addAnd(ItemPeer::ID_TABLA, $this->formulario->getIdFormulario(), Criteria::EQUAL);
                 $c->addAnd(FormularioPeer::ID_TABLA, $tabla_rel->getIdTabla(), Criteria::EQUAL);
                 $this->processSort(false);
                 $this->addSortCriteria($c);
                 $c->setDistinct();
                 $pager = new sfPropelPager('Formulario', sfConfig::get('app_listas_formularios'));
                 $pager->setPeerMethod('doSelectJoinTabla');
                 $pager->setCriteria($c);
                 $pager->setPage($this->getRequestParameter('page', 1));
                 $pager->init();
                 $this->tablas_auxiliares[] = array("forms" => $pager, "id_tabla" => $tabla_rel->getIdTabla());
             }
         }
         $this->labels = $this->getLabels();
     }
 }
    echo '<div id="_4">' . get_partial('04', array('action' => $action, 'notificacion' => $notificacion)) . '</div>';
    echo '<div id="_5">' . get_partial('05', array('action' => $action, 'notificacion' => $notificacion)) . '</div>';
    echo '<div id="_6">' . get_partial('06', array('action' => $action, 'notificacion' => $notificacion)) . '</div>';
    echo '<div id="_7">' . get_partial('07', array('action' => $action, 'notificacion' => $notificacion)) . '</div>';
    echo '<div id="_8">' . get_partial('08', array('notificacion' => $notificacion)) . '</div>';
    echo '<div id="_9">' . get_partial('09', array('action' => $action, 'notificacion' => $notificacion)) . '</div>';
    echo '<div id="_10">' . get_partial('10', array('action' => $action, 'notificacion' => $notificacion)) . '</div>';
    if ($notificacion->tipo == 'Supresion') {
        echo '<div id="_11">' . get_partial('11', array('action' => $action, 'notificacion' => $notificacion, 'codigo_agencia' => $codigo_agencia)) . '</div>';
    }
    ?>
</div>
        <div id="sf_admin_container"><div id="sf_admin_bar"><div class="sf_admin_filters">
            <ul class="sf_admin_actions"><?php 
    if (isset($insert) && $insert || $notificacion->procesado == '0') {
        $o = substr(Notificaciones::selfURL(), 0, strpos(Notificaciones::selfURL(), '/notificaciones'));
        $u = substr($o, 0, strrpos($o, '/')) . '/images/icons/';
        echo '<li>' . link_to(__('Enviar a la APD'), 'notificaciones/enviar?id_fichero=' . $id_fichero . '&id_notificacion=' . $notid, array('class' => 'sf_admin_action_save', 'style' => '
                                    text-decoration:none;
                                    float:right;
                                    background-color:#E3E3E3;
                                    border-color:-moz-use-text-color #999999 -moz-use-text-color -moz-use-text-color;
                                    border-style:none solid none none;
                                    border-width:0 4px 0 0;
                                    color:#333333;
                                    cursor:pointer;
                                    font-family:Arial,sans-serif;
                                    font-size:11px;
                                    padding:4px 3px 3px 20px;
                                    -moz-background-clip:border;
                                    -moz-background-inline-policy:continuous;
<?php 
echo input_hidden_tag('id_file', $formulario->getPrimaryKey());
if ($formulario->getTabla()->getEsFicheros() && trim($formulario->getPrimaryKey()) != "") {
    ?>
        <div id="sf_admin_bar"><div class="sf_admin_filters"><fieldset id="notis_widget">
            <h2><?php 
    echo __('Notificaciones a la APD');
    ?>
</h2><?php 
    $c = new Criteria();
    $c->addAscendingOrderByColumn(NotificacionesPeer::FECHA);
    $notificaciones = $formulario->getNotificacioness($c);
    foreach ($notificaciones as $noti) {
        $date = substr($noti->getFecha(), 4, 4) . '-' . substr($noti->getFecha(), 2, 2) . '-' . substr($noti->getFecha(), 0, 2);
        $time = substr($noti->getHoraProceso(), 0, 2) . ':' . substr($noti->getHoraProceso(), 2, 2) . ':' . substr($noti->getHoraProceso(), 4, 2);
        $o = substr(Notificaciones::selfURL(), 0, strpos(Notificaciones::selfURL(), '/formularios'));
        $u = substr($o, 0, strrpos($o, '/')) . '/images/icons/';
        ?>
                <ul style="margin-left: 7%; clear: both">
                    <li style="list-style-image: url(<?php 
        echo $u . 'bullet_green.png';
        ?>
)">
                        <label style="float: none"><?php 
        echo format_date($date, 'p', 'es') . ', ' . format_date($time, 't') . ':';
        ?>
</label>
                        <label style="float: left; color: black"><?php 
        echo link_to($noti->getTipo(), 'notificaciones/consultar?id_fichero=' . $formulario->getIdFormulario() . '&id_notificacion=' . $noti->getNotid()) . '</label>';
        if (!$noti->getProcesado()) {
            ?>
                if (jQuery(this).attr('checked') == true) {
                    tipo = this.value;
                    return false;
                } else  tipo = '';
            });
            var sistema;
            jQuery('.docu').each(function() {
                if (jQuery(this).attr('checked') == true) {
                    sistema = this.value;
                    return false;
                } else  sistema = '';
            });
            for(var i = 0; i < c.length; i++) { jQuery(c[i]).hide(); }
            jQuery('#formulario').show();
            jQuery.get("<?php 
echo Notificaciones::selfURL();
?>
", { model: modelo, type: tipo, system: sistema },
                function (data) { jQuery('#append').append(data); });
            return false;
        });
    });
--></script>
<br />
<div style="width:50%; padding-left:25%;">
    <table class="quitar_borde">
        <tr>
            <td class="quitar_borde"><?php 
echo image_tag('nota.png');
?>
</td>
?>
</h1>

<div id="sf_admin_header">
<?php 
include_partial('formularios/list_header', array('pager' => $pager));
include_partial('formularios/list_messages', array('pager' => $pager));
?>
</div>

<div id="sf_admin_content"><?php 
if ($formulario->getTabla() == 'Ficheros') {
    if (isset($_GET['i'])) {
        $pre = substr(Notificaciones::selfURL(), 0, strpos(Notificaciones::selfURL(), '&i'));
    } else {
        $pre = Notificaciones::selfURL();
    }
    ?>
    <ul class='sf_admin_actions' style="padding-bottom: 2%"><?php 
    echo "<li>" . button_to(__('Notificados'), $pre . '&i=1', array('class' => 'sf_admin_action_list', 'style' => 'float:left')) . "</li>";
    echo "<li>" . button_to(__('No Procesados'), $pre . '&i=0', array('class' => 'sf_admin_action_list', 'style' => 'float:left')) . "</li>";
    echo "<li>" . button_to(__('No Notificados'), $pre . '&i=2', array('class' => 'sf_admin_action_list', 'style' => 'float:left')) . "</li>";
    echo "<li>" . button_to(__('Todos'), $pre, array('class' => 'sf_admin_action_list', 'style' => 'float:left')) . "</li>";
    ?>
    </ul><?php 
}
if (!$pager->getNbResults()) {
    ?>
<blockquote class="warning"><p>
<?php 
    echo __('no hay resultados');