From: Gonzalo Merayo Date: Mon, 7 Jul 2003 15:41:32 +0000 (+0000) Subject: corrijo noticia para que la fecha sea un Date X-Git-Tag: svn_import~246 X-Git-Url: https://git.llucax.com/mecon/intranet.git/commitdiff_plain/707e1370e56a9a9536a81aab72b530c48e3d361e?ds=sidebyside;hp=e54c0e22cd808855fdc1171d1bc70d00175e1ad0 corrijo noticia para que la fecha sea un Date corrijo HTML_Noticia para que muestre bien la fecha --- diff --git a/doc/noticias.xmi b/doc/noticias.xmi index 94fc8eb..4beeecd 100644 --- a/doc/noticias.xmi +++ b/doc/noticias.xmi @@ -10,7 +10,7 @@ +" uniqueid="186" /> @@ -20,6 +20,7 @@ + @@ -37,7 +38,9 @@ - + @@ -52,8 +55,8 @@ - - + + @@ -61,14 +64,14 @@ - + - - + + @@ -91,6 +94,7 @@ + diff --git a/lib/noticia.php b/lib/noticia.php index 6a07def..96ba6b2 100644 --- a/lib/noticia.php +++ b/lib/noticia.php @@ -28,6 +28,7 @@ // require_once 'mecondavdb.php'; +require_once 'Date.php'; // +X2C Class 161 :noticia @@ -52,9 +53,9 @@ class noticia { */ function noticia($noticia) // ~X2C { - $this->noticia; + $this->noticia = $noticia; $db = MEconDAVDB::Connect(); - $query = "SELECT headline, title, abstract, article + $query = "SELECT headline, title, abstract, article, publication_date FROM Articles WHERE Article_id = $noticia"; $result = $db->query($query); @@ -63,6 +64,7 @@ class noticia { $this->titulo = $row[1]; $this->abstracto = $row[2]; $this->texto = $row[3]; + $this->fecha = new Date($row[4]); } // -X2C @@ -110,5 +112,16 @@ class noticia { } // -X2C + // +X2C Operation 186 + /** + * @return string + * @access public + */ + function getFecha() // ~X2C + { + return $this->fecha; + } + // -X2C + } // -X2C Class :noticia -?> \ No newline at end of file +?> diff --git a/sistema/local_lib/HTML_Noticia.php b/sistema/local_lib/HTML_Noticia.php index ad25c41..7477fe9 100644 --- a/sistema/local_lib/HTML_Noticia.php +++ b/sistema/local_lib/HTML_Noticia.php @@ -31,7 +31,6 @@ // +X2C includes require_once 'HTML/Table.php'; -require_once 'HTML/Image.php'; // ~X2C // +X2C Class 162 :HTML_Noticia @@ -66,15 +65,16 @@ class HTML_Noticia extends HTML_Table { */ function toHTML() // ~X2C { - $this->addRow(array('Subtítulo'), array('class' => 'subtitulo')); + $this->addRow(array($this->noticia->getTitulo2()), array('class' => 'subtitulo')); $img_str = null; if($this->nuevo) { $nuevo = new HTML_Image('images/nuevo.gif'); $img_str = $nuevo->toHTML(); } - $this->addRow(array('Título de la noticia que nos vincula con su texto completo.'.$img_str), array('class' => 'titulo_noticia')); - $this->addRow(array('(10/02/03)'), + $this->addRow(array($this->noticia->getTitulo().$img_str), array('class' => 'titulo_noticia')); + $tmp = $this->noticia->getFecha(); + $this->addRow(array($tmp->format('(%d/%m/%Y)')), array('class' => 'fecha_noticia')); $mas = new HTML_Image('images/mas.gif'); $this->addRow(array($mas->toHTML().'ver más'), diff --git a/sistema/www/noticias.php b/sistema/www/noticias.php index 9cc65a2..9bc004f 100644 --- a/sistema/www/noticias.php +++ b/sistema/www/noticias.php @@ -27,13 +27,14 @@ require_once '../../lib/noticia.php'; require_once '../local_lib/HTML_Noticia.php'; - $not = new HTML_Noticia(1); - $not->setNuevo(true); - $ht = new HTML_Table(array('width'=>'600', 'border'=>'0', 'cellspacing'=>'0')); - $ht->addRow(array($not, $not)); - $ht->addRow(array($not, $not)); - $ht->addRow(array($not, $not)); - $ht->display(); + $n = new noticia(1294); + $not = new HTML_Noticia($n); + $not->setNuevo(true); + $ht = new HTML_Table(array('width'=>'600', 'border'=>'0', 'cellspacing'=>'0')); + $ht->addRow(array($not, $not)); + $ht->addRow(array($not, $not)); + $ht->addRow(array($not, $not)); + $ht->display(); ?>