]> git.llucax.com Git - mecon/intranet.git/commitdiff
Ahora muestra todas las noticias
authorGonzalo Merayo <merayo@gmail.com>
Mon, 7 Jul 2003 16:21:06 +0000 (16:21 +0000)
committerGonzalo Merayo <merayo@gmail.com>
Mon, 7 Jul 2003 16:21:06 +0000 (16:21 +0000)
sistema/www/noticias.php

index 9bc004fccbc622efc6fbdbbb2ef56b364696bf0d..16e2119c7a7b88570ccfdf48f62c0043fbbbe8fa 100644 (file)
     <?
        require_once '../../lib/noticia.php';
        require_once '../local_lib/HTML_Noticia.php';
-       $n = new noticia(1294);
-       $not = new HTML_Noticia($n);
-       $not->setNuevo(true);
+       require_once '../../lib/mecondavdb.php';
+       $db = MEconDAVDB::Connect();
+       $fecha_limite = '2003-07-01';
+       $fecha_nuevo  = '2003-07-07';
+       $query = "SELECT Articles.article_id,
+                        IF(Articles.publication_date > '$fecha_nuevo', 'NUEVA', null)
+                 FROM Articles, ArticlePublicationStates
+                WHERE Articles.article_publication_state_id =
+                       ArticlePublicationStates.article_publication_state_id
+                AND ArticlePublicationStates.publication_state_id=5
+                AND Articles.publication_date > '$fecha_limite' 
+                ORDER BY Articles.publication_date desc";
+       $result = $db->query($query);
+       if(DB::isError($result))
+         die($result->getMessage("query mal hecho"));
        $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));
+       $not1 = $not2 = null;
+       while($row = $result->fetchRow())
+       {
+         
+         $n = new noticia($row[0]);
+         $not = new HTML_Noticia($n);
+        if($row[1] == 'NUEVA')
+             $not->setNuevo(true);
+        if(is_null($not1)) $not1 = $not;
+        elseif(is_null($not2))
+        {
+          $not2 = $not;
+           $ht->addRow(array($not1, $not2));
+        }
+        else
+        {
+          $not1 = $not;
+          $not2 = null;
+        }
+       }
+       if(is_null($not2)) $ht->addRow(array($not1));
        $ht->display();
     ?>
     </td>