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 // +--------------------------------------------------------------------+
27 // $Id: xmi2code.tpl.php 1 2003-06-23 18:29:20Z gmeray $
30 require_once '../../lib/noticia.php';
31 require_once '../local_lib/HTML_Noticia.php';
32 require_once '../../lib/mecondavdb.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 $db2 = DB::Connect('mysql://intranet:intranet@bal747f/intranet');//FIXME
70 $db = MEconDAVDB::Connect();
72 $fecha_nuevo = $hoy->format('%Y-%m-%d');
73 $query = "SELECT Articles.article_id,
74 IF(Articles.publication_date > '$fecha_nuevo', 'NUEVA', null)
75 FROM Articles, ArticlePublicationStates
76 WHERE Articles.article_publication_state_id =
77 ArticlePublicationStates.article_publication_state_id
78 AND ArticlePublicationStates.publication_state_id=5 ";
79 if(!is_null($grupo_secciones))
81 $gs = new AI_GrupoSecciones($grupo_secciones);
83 if(count($gs->secciones) > 0)
84 $query .= ' AND Articles.section_id IN('.implode(',', $gs->secciones).') ';
87 $censuradas = $db2->getCol('SELECT seccion FROM secciones_censuradas');
88 $query .= ' AND Articles.section_id NOT IN('.implode(',', $censuradas).') ';
92 if(!is_null($antiguedad))
94 $hoy->subtractSeconds(60*60*24*$antiguedad);
95 $fecha_limite = $hoy->format('%Y-%m-%d');
96 $query .= "AND Articles.publication_date > '$fecha_limite' ";
98 $query .= "ORDER BY Articles.publication_date desc";
99 $result = $db->query($query);
100 $this->numero_noticias = $result->numRows();//FIXME no documentado
101 if(DB::isError($result))
102 die($result->getMessage("query mal hecho"));
103 $ht1 = new HTML_Table(array('width'=>'280', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
104 $ht2 = new HTML_Table(array('width'=>'280', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
106 while($row = $result->fetchRow())
108 $n = new noticia($row[0]);
109 if(!isset($this->primera_noticia)) $this->primera_noticia = $n;
110 if(!is_null($grupo_secciones)) $n->seccion = null;
111 $not = new HTML_Noticia($n);
112 $not->setLink("una_noticia.php?numero=$row[0]");
113 if(is_null($grupo_secciones))
115 //$n->getIdSeccion();
116 $not->setVerMas("noticias?grupo=".
117 AI_GrupoSecciones::getGrupo($n->getIdSeccion(), $db2));
119 if($row[1] == 'NUEVA')
120 $not->setNuevo(true);
124 $ht1->addRow(array($not));
129 $ht2->addRow(array($not));
133 $this->addRow(array($ht1,$ht2));
134 $this->updateCellAttributes(0,0,array('valign'=>'top'));
135 $this->updateCellAttributes(0,1,array('valign'=>'top'));
139 // +X2C Operation 196
144 function getCSS() // ~X2C
146 return "css/noticias.css";
150 } // -X2C Class :HTML_Titulares