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';
35 require_once 'HTML/Table.php';
38 // +X2C Class 187 :HTML_Titulares
42 class HTML_Titulares extends HTML_Table {
44 * @var int $antiguedad
47 var $antiguedad = null;
50 * @var int $grupo_secciones
59 * @param int $grupo_secciones
60 * @param int $antiguedad
65 function HTML_Titulares($grupo_secciones = null, $antiguedad = null) // ~X2C
67 parent::HTML_Table(array('width'=>'600', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
68 $db = MEconDAVDB::Connect();
70 $fecha_nuevo = $hoy->format('%Y-%m-%d');
71 $query = "SELECT Articles.article_id,
72 IF(Articles.publication_date > '$fecha_nuevo', 'NUEVA', null)
73 FROM Articles, ArticlePublicationStates
74 WHERE Articles.article_publication_state_id =
75 ArticlePublicationStates.article_publication_state_id
76 AND ArticlePublicationStates.publication_state_id=5 ";
77 if(!is_null($antiguedad))
79 $hoy->subtractSeconds(60*60*24*$antiguedad);
80 $fecha_limite = $hoy->format('%Y-%m-%d');
81 $query .= "AND Articles.publication_date > '$fecha_limite' ";
83 $query .= "ORDER BY Articles.publication_date desc";
84 $result = $db->query($query);
85 if(DB::isError($result))
86 die($result->getMessage("query mal hecho"));
87 $ht1 = new HTML_Table(array('width'=>'300', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
88 $ht2 = new HTML_Table(array('width'=>'300', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
90 while($row = $result->fetchRow())
92 $n = new noticia($row[0]);
93 $not = new HTML_Noticia($n);
94 $not->setLink("una_noticia.php?numero=$row[0]");
95 $not->setVerMas("noticias?grupo=TODO");
96 if($row[1] == 'NUEVA')
101 $ht1->addRow(array($not));
106 $ht2->addRow(array($not));
110 $this->addRow(array($ht1,$ht2));
111 $this->updateCellAttributes(0,0,array('valign'=>'top'));
112 $this->updateCellAttributes(0,1,array('valign'=>'top'));
116 } // -X2C Class :HTML_Titulares