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 //FIXME Agregado provisorio para cargar por herramienta lo que no es noticia
89 $gs = new AI_GrupoSecciones($grupo_secciones);
91 if(count($gs->secciones) > 0)
92 $query .= ' AND Articles.section_id NOT IN(53) ';
94 //FIXME Fin Agregado provisorio
96 if(!is_null($antiguedad))
98 $hoy->subtractSeconds(60*60*24*$antiguedad);
99 $fecha_limite = $hoy->format('%Y-%m-%d');
100 $query .= "AND Articles.publication_date > '$fecha_limite' ";
102 $query .= "ORDER BY Articles.publication_date desc";
103 $result = $db->query($query);
104 $this->numero_noticias = $result->numRows();//FIXME no documentado
105 if(DB::isError($result))
106 die($result->getMessage("query mal hecho"));
107 $ht1 = new HTML_Table(array('width'=>'280', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
108 $ht2 = new HTML_Table(array('width'=>'280', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
110 while($row = $result->fetchRow())
112 $n = new noticia($row[0]);
113 if(!isset($this->primera_noticia)) $this->primera_noticia = $n;
114 if(!is_null($grupo_secciones)) $n->seccion = null;
115 $not = new HTML_Noticia($n);
116 $not->setLink("una_noticia.php?numero=$row[0]");
117 if(is_null($grupo_secciones))
119 //$n->getIdSeccion();
120 $not->setVerMas("noticias?grupo=".
121 AI_GrupoSecciones::getGrupo($n->getIdSeccion(), $db2));
123 if($row[1] == 'NUEVA')
124 $not->setNuevo(true);
128 $ht1->addRow(array($not));
133 $ht2->addRow(array($not));
137 $this->addRow(array($ht1,$ht2));
138 $this->updateCellAttributes(0,0,array('valign'=>'top'));
139 $this->updateCellAttributes(0,1,array('valign'=>'top'));
143 // +X2C Operation 196
148 function getCSS() // ~X2C
150 return "css/noticias.css";
154 } // -X2C Class :HTML_Titulares