X-Git-Url: https://git.llucax.com/mecon/intranet.git/blobdiff_plain/f5f3a1c3c7197cc0baa49fc15f96a27054c49f64..f05f1b7fbe5df248ba7f3b9506dfa313fad063bb:/sistema/www/noticias.php?ds=inline diff --git a/sistema/www/noticias.php b/sistema/www/noticias.php index 90f5331..464b105 100644 --- a/sistema/www/noticias.php +++ b/sistema/www/noticias.php @@ -1,73 +1,60 @@ - toHTML(); -?> - - - - - -
- addTitle('Noticias'); + + $noticias = new HTML_Table(array('width' => '760', 'border' => '0')); + if(isset($_GET['grupo'])) + { + $grupo = $_GET['grupo']; + $dias = null; + } + else + { + $grupo = null; + $dias = 7; + } + //Esto va a cambiar... + $db = IntranetDB::connect(); + $dbdata = array( 'db' => $db, 'tabla' => 'grupo_secciones', 'id' => 'grupo', + 'id_activo' => $grupo, 'nombre' => 'nombre', + 'habilitado' => 'habilitado', 'id_padre' => 'grupo_padre', + 'order' => '', 'prepend_link' => 'noticias.php?grupo='); - $arbol = new HTML_ArbolDB($dbdata, '/MECON/images/arbol_noticias.gif'); - echo $arbol->toHTML(); - ?> - - format('%Y-%m-%d'); - $hoy->subtractSeconds(60*60*24*7);//7 dias - $fecha_limite = $hoy->format('%Y-%m-%d'); - $query = "SELECT Articles.article_id, - IF(Articles.publication_date > '$fecha_nuevo', 'NUEVA', null) - FROM Articles, ArticlePublicationStates - WHERE Articles.article_publication_state_id = - ArticlePublicationStates.article_publication_state_id - AND ArticlePublicationStates.publication_state_id=5 - AND Articles.publication_date > '$fecha_limite' - ORDER BY Articles.publication_date desc"; - $result = $db->query($query); - if(DB::isError($result)) - die($result->getMessage("query mal hecho")); - $ht1 = new HTML_Table(array('width'=>'300', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0')); - $ht2 = new HTML_Table(array('width'=>'300', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0')); - $impar = true; - while($row = $result->fetchRow()) - { - $n = new noticia($row[0]); - $not = new HTML_Noticia($n); - if($row[1] == 'NUEVA') - $not->setNuevo(true); - if($impar) - { - $impar = false; - $ht1->addRow(array($not)); - } - else - { - $impar = true; - $ht2->addRow(array($not)); - } - } - $ht = new HTML_Table(array('width'=>'300', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0')); - $ht->addRow(array($ht1,$ht2)); - $ht->display(); - ?> -
- + $arbol = new MECON_HTML_ArbolDB($dbdata, 'NOTICIAS'); + $titulares = new HTML_Titulares($grupo, $dias); + if($titulares->numero_noticias > 1){ + $noticias->addRow(array($arbol,$titulares)); + $m->addStyleSheet($titulares->getCSS()); + $noticias->updateCellAttributes(0, 1, array('valign'=>'top', 'width'=>'600')); + }elseif($titulares->numero_noticias == 1){ + $noticia = new HTML_Noticia($titulares->primera_noticia); + $noticia->setVolver('noticias.php'); + $noticia->setCompleta(true); + $noticias->addRow(array($arbol,$noticia)); + $m->addStyleSheet($noticia->getCSS()); + $noticias->updateCellAttributes(0, 1, array('valign'=>'top', 'width'=>'600')); + }else//No hay ninguna + { + $mensaje = new HTML_Mensaje('alerta', 'No hay Noticias en esta Seccion', 300); + $noticias->addRow(array($arbol,$mensaje)); + $m->addStyleSheet($mensaje->getCSS()); + $noticias->updateCellAttributes(0, 1, array('valign'=>'middle', 'align'=>'center','width'=>'600')); + } + + $m->addStyleSheet($arbol->getCSS()); + $noticias->updateCellAttributes(0, 0, array('valign'=>'top', 'width'=>'160')); + + $m->addBodyContent($noticias); + $m->display(); +?>