2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
3 // +--------------------------------------------------------------------+
4 // | Ministerio de EconomÃa |
6 // +--------------------------------------------------------------------+
7 // | This file is part of Intranet. |
9 // | Intranet is free software; you can redistribute it and/or modify |
10 // | it under the terms of the GNU General Public License as published |
11 // | by the Free Software Foundation; either version 2 of the License, |
12 // | or (at your option) any later version. |
14 // | Intranet is distributed in the hope that it will be useful, but |
15 // | WITHOUT ANY WARRANTY; without even the implied warranty of |
16 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
17 // | General Public License for more details. |
19 // | You should have received a copy of the GNU General Public License |
20 // | along with Hooks; if not, write to the Free Software Foundation, |
21 // | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
22 // +--------------------------------------------------------------------+
23 // | Creado: Tue Jul 8 12:37:27 2003 |
24 // | Autor: Gonzalo Merayo <gmeray@mecon.gov.ar> |
25 // +--------------------------------------------------------------------+
30 require_once 'noticia.php';
31 require_once 'HTML_Noticia.php';
32 require_once 'intranetdb.php';
33 require_once 'AI/GrupoSecciones.php';
36 require_once 'HTML/Table.php';
39 // +X2C Class 187 :HTML_Titulares
43 class HTML_Titulares extends HTML_Table {
45 * @var int $antiguedad
48 var $antiguedad = null;
51 * @var int $grupo_secciones
60 * @param int $grupo_secciones
61 * @param int $antiguedad
66 function HTML_Titulares($grupo_secciones = null, $antiguedad = null) // ~X2C
68 parent::HTML_Table(array('width'=>'600', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
69 $db = IntranetDB::Connect();
71 $fecha_nuevo = $hoy->format('%Y-%m-%d');
72 $query = "SELECT Articles.article_id,
73 IF(Articles.publication_date > '$fecha_nuevo', 'NUEVA', null)
74 FROM MEconDAV.Articles, MEconDAV.ArticlePublicationStates
75 WHERE Articles.article_publication_state_id =
76 ArticlePublicationStates.article_publication_state_id
77 AND ArticlePublicationStates.publication_state_id=5 ";
78 $gs = new AI_GrupoSecciones($grupo_secciones);
79 if(!is_null($grupo_secciones))
82 if(count($gs->secciones) > 0)
83 $query .= ' AND Articles.section_id IN('.implode(',', $gs->secciones).') ';
86 $censuradas = $gs->getSeccionesOcultasArray($db);
87 $query .= ' AND Articles.section_id NOT IN('.implode(',', $censuradas).') ';
91 if(!is_null($antiguedad))
93 $hoy->subtractSeconds(60*60*24*$antiguedad);
94 $fecha_limite = $hoy->format('%Y-%m-%d');
95 $query .= "AND Articles.publication_date > '$fecha_limite' ";
97 $query .= "ORDER BY Articles.publication_date desc";
98 $result = $db->query($query);
99 $this->numero_noticias = $result->numRows();//FIXME no documentado
100 if(DB::isError($result))
101 trigger_error($result->getMessage('query mal hecho'), E_USER_ERROR);
102 $ht1 = new HTML_Table(array('width'=>'280', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
103 $ht2 = new HTML_Table(array('width'=>'280', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
105 while($row = $result->fetchRow())
107 $n = new noticia($row[0]);
108 if(!isset($this->primera_noticia)) $this->primera_noticia = $n;
109 if(!is_null($grupo_secciones)) $n->seccion = null;
110 $not = new HTML_Noticia($n);
111 $not->setLink("una_noticia?numero=$row[0]");
112 if(is_null($grupo_secciones))
114 //$n->getIdSeccion();
115 $not->setVerMas("noticias?grupo=".
116 AI_GrupoSecciones::getGrupo($n->getIdSeccion(), $db));
118 if($row[1] == 'NUEVA')
119 $not->setNuevo(true);
123 $ht1->addRow(array($not));
128 $ht2->addRow(array($not));
132 $this->addRow(array($ht1,$ht2));
133 $this->updateCellAttributes(0,0,array('valign'=>'top'));
134 $this->updateCellAttributes(0,1,array('valign'=>'top'));
138 // +X2C Operation 196
143 function getCSS() // ~X2C
145 return 'css/noticias.css';
149 } // -X2C Class :HTML_Titulares