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).') ';
86 if(!is_null($antiguedad))
88 $hoy->subtractSeconds(60*60*24*$antiguedad);
89 $fecha_limite = $hoy->format('%Y-%m-%d');
90 $query .= "AND Articles.publication_date > '$fecha_limite' ";
92 $query .= "ORDER BY Articles.publication_date desc";
93 $result = $db->query($query);
94 $this->numero_noticias = $result->numRows();//FIXME no documentado
95 if(DB::isError($result))
96 die($result->getMessage("query mal hecho"));
97 $ht1 = new HTML_Table(array('width'=>'300', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
98 $ht2 = new HTML_Table(array('width'=>'300', 'border'=>'0', 'cellspacing'=>'0', 'cellpadding' => '0'));
100 while($row = $result->fetchRow())
102 $n = new noticia($row[0]);
103 if(!isset($this->primera_noticia)) $this->primera_noticia = $n;
104 if(!is_null($grupo_secciones)) $n->seccion = null;
105 $not = new HTML_Noticia($n);
106 $not->setLink("una_noticia.php?numero=$row[0]");
107 if(is_null($grupo_secciones))
109 //$n->getIdSeccion();
110 $not->setVerMas("noticias?grupo=".
111 AI_GrupoSecciones::getGrupo($n->getIdSeccion(), $db2));
113 if($row[1] == 'NUEVA')
114 $not->setNuevo(true);
118 $ht1->addRow(array($not));
123 $ht2->addRow(array($not));
127 $this->addRow(array($ht1,$ht2));
128 $this->updateCellAttributes(0,0,array('valign'=>'top'));
129 $this->updateCellAttributes(0,1,array('valign'=>'top'));
133 // +X2C Operation 196
138 function getCSS() // ~X2C
140 return "css/noticias.css";
144 } // -X2C Class :HTML_Titulares