X-Git-Url: https://git.llucax.com/mecon/intranet.git/blobdiff_plain/99cee4fba7d5581e7d7f447c6bb54916cc8a7db3..22697d7dcb9c700a75c795c618d8a2fe3e51a9bd:/sistema/local_lib/HTML_Titulares.php diff --git a/sistema/local_lib/HTML_Titulares.php b/sistema/local_lib/HTML_Titulares.php index e45d0e6..bd3470e 100644 --- a/sistema/local_lib/HTML_Titulares.php +++ b/sistema/local_lib/HTML_Titulares.php @@ -2,16 +2,16 @@ // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4: // +--------------------------------------------------------------------+ // | Ministerio de Economía | -// | Intranet | +// | Intranet | // +--------------------------------------------------------------------+ -// | This file is part of Intranet. | +// | This file is part of Intranet. | // | | -// | Intranet is free software; you can redistribute it and/or modify | +// | Intranet is free software; you can redistribute it and/or modify | // | it under the terms of the GNU General Public License as published | // | by the Free Software Foundation; either version 2 of the License, | // | or (at your option) any later version. | // | | -// | Intranet is distributed in the hope that it will be useful, but | +// | Intranet is distributed in the hope that it will be useful, but | // | WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | // | General Public License for more details. | @@ -24,12 +24,12 @@ // | Autor: Gonzalo Merayo | // +--------------------------------------------------------------------+ // -// $Id: xmi2code.tpl.php 1 2003-06-23 18:29:20Z gmeray $ +// $Id$ // -require_once '../../lib/noticia.php'; -require_once '../local_lib/HTML_Noticia.php'; -require_once '../../lib/mecondavdb.php'; +require_once 'noticia.php'; +require_once 'HTML_Noticia.php'; +require_once 'intranetdb.php'; require_once 'AI/GrupoSecciones.php'; // +X2C includes @@ -66,23 +66,28 @@ class HTML_Titulares extends HTML_Table { function HTML_Titulares($grupo_secciones = null, $antiguedad = null) // ~X2C { parent::HTML_Table(array('width'=>'600', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0')); - $db2 = DB::Connect('mysql://intranet:intranet@bal747f/intranet');//FIXME - $db = MEconDAVDB::Connect(); + $db = IntranetDB::Connect(); $hoy = new Date(); $fecha_nuevo = $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 "; + FROM MEconDAV.Articles, MEconDAV.ArticlePublicationStates + WHERE Articles.article_publication_state_id = + ArticlePublicationStates.article_publication_state_id + AND ArticlePublicationStates.publication_state_id=5 "; + $gs = new AI_GrupoSecciones($grupo_secciones); if(!is_null($grupo_secciones)) { - $gs = new AI_GrupoSecciones($grupo_secciones); - $gs->cargar($db2); - if(count($gs->secciones) > 0) - $query .= 'AND Articles.section_id IN('.implode(',', $gs->secciones).') '; + $gs->cargar($db); + if(count($gs->secciones) > 0) + $query .= ' AND Articles.section_id IN('.implode(',', $gs->secciones).') '; } + else{ + $censuradas = $gs->getSeccionesOcultasArray($db); + $query .= ' AND Articles.section_id NOT IN('.implode(',', $censuradas).') '; + + } + if(!is_null($antiguedad)) { $hoy->subtractSeconds(60*60*24*$antiguedad); @@ -93,7 +98,7 @@ class HTML_Titulares extends HTML_Table { $result = $db->query($query); $this->numero_noticias = $result->numRows();//FIXME no documentado if(DB::isError($result)) - die($result->getMessage("query mal hecho")); + trigger_error($result->getMessage('query mal hecho'), E_USER_ERROR); $ht1 = new HTML_Table(array('width'=>'280', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0')); $ht2 = new HTML_Table(array('width'=>'280', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0')); $impar = true; @@ -103,12 +108,12 @@ class HTML_Titulares extends HTML_Table { if(!isset($this->primera_noticia)) $this->primera_noticia = $n; if(!is_null($grupo_secciones)) $n->seccion = null; $not = new HTML_Noticia($n); - $not->setLink("una_noticia.php?numero=$row[0]"); + $not->setLink("una_noticia?numero=$row[0]"); if(is_null($grupo_secciones)) { //$n->getIdSeccion(); $not->setVerMas("noticias?grupo=". - AI_GrupoSecciones::getGrupo($n->getIdSeccion(), $db2)); + AI_GrupoSecciones::getGrupo($n->getIdSeccion(), $db)); } if($row[1] == 'NUEVA') $not->setNuevo(true); @@ -137,7 +142,7 @@ class HTML_Titulares extends HTML_Table { */ function getCSS() // ~X2C { - return "css/noticias.css"; + return 'css/noticias.css'; } // -X2C