X-Git-Url: https://git.llucax.com/mecon/intranet.git/blobdiff_plain/4f8bc31d20f46ddb617fc55800841d680337155b..2d8807f81f0af8e4c1d842d10daa946672d7fd0f:/sistema/local_lib/Servicios/Informes.php diff --git a/sistema/local_lib/Servicios/Informes.php b/sistema/local_lib/Servicios/Informes.php index c0e519b..3544639 100644 --- a/sistema/local_lib/Servicios/Informes.php +++ b/sistema/local_lib/Servicios/Informes.php @@ -27,7 +27,7 @@ // $Id: xmi2code.tpl.php 50 2003-08-12 19:00:38Z mmarre $ // -require_once 'DB.php'; +require_once 'intranetdb.php'; require_once 'MECON/HTML/Image.php'; require_once 'MECON/HTML/Link.php'; @@ -53,8 +53,7 @@ class Servicios_Informes extends HTML_Table { */ function getCSS() // ~X2C { - $css = '/sistemas/intranet/css/servicios_informes.css'; - return $css; + return '/sistemas/intranet/css/servicios_informes.css'; } // -X2C @@ -65,85 +64,85 @@ class Servicios_Informes extends HTML_Table { */ function toHtml() // ~X2C { - //Base de Datos - $dbh = DB::connect("mysql://mark:mark@intranet-db/MEconDAV"); - - //Imágenes - $IMG_l296 =& new MECON_HTML_Image('../../images/servicios_informes_l296.gif', '', array('height'=>'1', 'width'=>'296')); - $IMG_l24 =& new MECON_HTML_Image('../../images/servicios_informes_l296.gif', '', array('height'=>'1', 'width'=>'24')); - $IMG_l320 =& new MECON_HTML_Image('../../images/servicios_informes_l320.gif', '', array('height'=>'24', 'width'=>'320')); - $IMG_parl =& new MECON_HTML_Image('../../images/servicios_informes_parl.gif', '-', array('height'=>'24', 'width'=>'24')); - - //Informes - $SECCION = 53; - $sql= " SELECT headline, Articles.article_id, publication_date - FROM Articles, ArticlePublicationStates - WHERE section_id = $SECCION AND - Articles.article_publication_state_id=ArticlePublicationStates.article_publication_state_id AND - ArticlePublicationStates.publication_state_id=5 - ORDER BY publication_date desc, Articles.article_id desc"; - $informes = $dbh->getAll($sql); - - $cant_col2 = intval(count($informes)/2); - $cant_col1 = count($informes) - $cant_col2; - - $tabla_out =& new HTML_Table('border="0" cellPadding="0" cellSpacing="0" width="660" align="center"'); - - $tabla_col1 =& new HTML_Table('border="0" cellPadding="0" cellSpacing="0" width="320"'); - for ($i=0; $i<$cant_col1; $i++){ - $tabla_col1->addRow(array($informes[$i][0]), array('class'=>'servicios_informes_informe', 'colspan'=>'2')); - $tabla_col1->addRow(array($IMG_l24->toHtml(), $IMG_l296->toHtml())); - - //Obtener Adjuntos - $sql = "SELECT file_for_article_id, mimetype, filename, caption - FROM FilesForArticle - WHERE article_id = ". $informes[$i][1]. " AND - (oculto <> 1 OR oculto IS NULL) - ORDER BY file_for_article_id ASC"; - $adjuntos = $dbh->getAll($sql); - - foreach ($adjuntos as $item){ - $url = '/sistemas/intranet/servicios/informes/get_file.php'; - $link_adjunto = new MECON_HTML_Link($url, - $item[3], - array('id'=>$item[0]), - array('target'=>'_blank')); - $tabla_col1->addRow(array($IMG_parl->toHtml(), $link_adjunto->toHtml()), array('class'=>'servicios_informes_adjunto')); - } - - $tabla_col1->addRow(array($IMG_l320->toHtml()), array('colspan'=>'2')); - } - - $tabla_col2 =& new HTML_Table('border="0" cellPadding="0" cellSpacing="0" width="320"'); - for ($i=$cant_col1; $iaddRow(array($informes[$i][0]), array('class'=>'servicios_informes_informe', 'colspan'=>'2')); - $tabla_col2->addRow(array($IMG_l24->toHtml(), $IMG_l296->toHtml())); - - //Obtener Adjuntos - $sql = "SELECT file_for_article_id, mimetype, filename, caption - FROM FilesForArticle - WHERE article_id = ". $informes[$i][1]. " AND - (oculto <> 1 OR oculto IS NULL) - ORDER BY file_for_article_id ASC"; - $adjuntos = $dbh->getAll($sql); - - foreach ($adjuntos as $item){ - $url = '/sistemas/intranet/servicios/informes/get_file.php'; - $link_adjunto = new MECON_HTML_Link($url, - $item[3], - array('id'=>$item[0]), - array('target'=>'_blank')); - $tabla_col2->addRow(array($IMG_parl->toHtml(), $link_adjunto->toHtml()), array('class'=>'servicios_informes_adjunto')); - } - - $tabla_col2->addRow(array($IMG_l320->toHtml()), array('colspan'=>'2')); - } - - $tabla_out->addRow(array($tabla_col1->toHtml(), $tabla_col2->toHtml()), array('align'=>'center', 'valign'=>'top')); - - return $tabla_out->toHtml(); + //Base de Datos + $dbh = IntranetDB::connect(); + + //Imágenes + $IMG_l296 =& new MECON_HTML_Image('../../images/servicios_informes_l296.gif', '', array('height'=>'1', 'width'=>'296')); + $IMG_l24 =& new MECON_HTML_Image('../../images/servicios_informes_l296.gif', '', array('height'=>'1', 'width'=>'24')); + $IMG_l320 =& new MECON_HTML_Image('../../images/servicios_informes_l320.gif', '', array('height'=>'24', 'width'=>'320')); + $IMG_parl =& new MECON_HTML_Image('../../images/servicios_informes_parl.gif', '-', array('height'=>'24', 'width'=>'24')); + + //Informes + $SECCION = 53; + $sql= " SELECT headline, Articles.article_id, publication_date + FROM MEconDAV.Articles, MEconDAV.ArticlePublicationStates + WHERE section_id = $SECCION AND + Articles.article_publication_state_id=ArticlePublicationStates.article_publication_state_id AND + ArticlePublicationStates.publication_state_id=5 + ORDER BY publication_date desc, Articles.article_id desc"; + $informes = $dbh->getAll($sql); + + $cant_col2 = intval(count($informes)/2); + $cant_col1 = count($informes) - $cant_col2; + + $tabla_out =& new HTML_Table('border="0" cellPadding="0" cellSpacing="0" width="660" align="center"'); + + $tabla_col1 =& new HTML_Table('border="0" cellPadding="0" cellSpacing="0" width="320"'); + for ($i=0; $i<$cant_col1; $i++){ + $tabla_col1->addRow(array($informes[$i][0]), array('class'=>'servicios_informes_informe', 'colspan'=>'2')); + $tabla_col1->addRow(array($IMG_l24->toHtml(), $IMG_l296->toHtml())); + + //Obtener Adjuntos + $sql = "SELECT file_for_article_id, mimetype, filename, caption + FROM MEconDAV.FilesForArticle + WHERE article_id = ". $informes[$i][1]. " AND + (oculto <> 1 OR oculto IS NULL) + ORDER BY file_for_article_id ASC"; + $adjuntos = $dbh->getAll($sql); + + foreach ($adjuntos as $item){ + $url = '/sistemas/intranet/servicios/informes/get_file.php'; + $link_adjunto = new MECON_HTML_Link($url, + $item[3], + array('id'=>$item[0]), + array('target'=>'_blank')); + $tabla_col1->addRow(array($IMG_parl->toHtml(), $link_adjunto->toHtml()), array('class'=>'servicios_informes_adjunto')); + } + + $tabla_col1->addRow(array($IMG_l320->toHtml()), array('colspan'=>'2')); + } + + $tabla_col2 =& new HTML_Table('border="0" cellPadding="0" cellSpacing="0" width="320"'); + for ($i=$cant_col1; $iaddRow(array($informes[$i][0]), array('class'=>'servicios_informes_informe', 'colspan'=>'2')); + $tabla_col2->addRow(array($IMG_l24->toHtml(), $IMG_l296->toHtml())); + + //Obtener Adjuntos + $sql = "SELECT file_for_article_id, mimetype, filename, caption + FROM MEconDAV.FilesForArticle + WHERE article_id = ". $informes[$i][1]. " AND + (oculto <> 1 OR oculto IS NULL) + ORDER BY file_for_article_id ASC"; + $adjuntos = $dbh->getAll($sql); + + foreach ($adjuntos as $item){ + $url = '/sistemas/intranet/servicios/informes/get_file.php'; + $link_adjunto = new MECON_HTML_Link($url, + $item[3], + array('id'=>$item[0]), + array('target'=>'_blank')); + $tabla_col2->addRow(array($IMG_parl->toHtml(), $link_adjunto->toHtml()), array('class'=>'servicios_informes_adjunto')); + } + + $tabla_col2->addRow(array($IMG_l320->toHtml()), array('colspan'=>'2')); + } + + $tabla_out->addRow(array($tabla_col1->toHtml(), $tabla_col2->toHtml()), array('align'=>'center', 'valign'=>'top')); + + return $tabla_out->toHtml(); } // -X2C } // -X2C Class :Servicios_Informes -?> \ No newline at end of file +?>