Exemplo n.º 1
0
 function generate_RTF()
 {
     global $base_path, $charset, $msg, $biblio_logo;
     global $biblio_name, $biblio_logo, $biblio_adr1, $biblio_adr2, $biblio_cp, $biblio_town, $biblio_state, $biblio_country, $biblio_phone, $biblio_email, $biblio_website;
     global $madame_monsieur;
     //Format des fonts
     $fontHead = new Font(12, 'Arial', '#0E298A');
     $fontHead->setBold();
     $fontSmall = new Font(1);
     $fontComment = new Font(10, 'Arial');
     $fontComment->setItalic();
     $fontChapter = new Font(10, 'Arial');
     $fontSubChapter = new Font(10, 'Arial');
     $fontSubChapter->setUnderline();
     //Format des paragraphes
     $parPmb = new ParFormat();
     $parPmb->setIndentRight(12.5);
     $parPmb->setBackColor('#0E298A');
     $parPmb->setSpaceAfter(8);
     $parHead = new ParFormat();
     $parHead->setSpaceBefore(5);
     $parChapter = new ParFormat();
     $parChapter->setSpaceBefore(2);
     $parChapter->setSpaceAfter(1);
     $parComment = new ParFormat();
     $parComment->setIndentLeft(1);
     $parComment->setIndentRight(0.5);
     $parContenu = new ParFormat('justify');
     $parContenu->setIndentLeft(1);
     $parSubChapter = new ParFormat();
     $parSubChapter->setIndentLeft(0.5);
     $parInfo = new ParFormat();
     $parInfo->setIndentLeft(0, 5);
     $parInfo->setSpaceAfter(1.5);
     $parInfoBib = new ParFormat();
     $parInfoBib->setIndentLeft(0);
     $parInfoBib->setSpaceAfter(1.5);
     //Document
     $rtf = new Rtf();
     $rtf->setMargins(1, 1, 1, 1);
     foreach ($this->liste_rel as $id_fournisseur => $info_fournisseur) {
         $rtf->setMargins(1, 1, 1, 1);
         $sect =& $rtf->addSection();
         $table =& $sect->addTable();
         $table->addRows(1, 2);
         $table->addColumnsList(array(15, 4));
         //$table->addImageToCell(1,1,$base_path."/images/".$biblio_logo,new ParFormat('center'),0,0);
         // Info biblio
         $cell =& $table->getCell(1, 1);
         $cell->writeText($this->to_utf8($biblio_name), new Font(14, 'Arial', '#0E298A'), new ParFormat('left'));
         if ($biblio_adr1) {
             $cell->writeText($this->to_utf8($biblio_adr1), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         }
         if ($biblio_adr2) {
             $cell->writeText($this->to_utf8($biblio_adr2), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         }
         if ($biblio_cp || $biblio_town) {
             $cell->writeText($this->to_utf8($biblio_cp . " " . $biblio_town), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         }
         if ($biblio_phone) {
             $cell->writeText($this->to_utf8($biblio_phone), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         }
         if ($biblio_email) {
             $cell->writeText($this->to_utf8($biblio_email), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         }
         // Info date de génération
         $cell =& $table->getCell(1, 2);
         if ($biblio_email) {
             $cell->writeText($this->to_utf8("\n" . $msg['fpdf_edite'] . " " . formatdate(date("Y-m-d", time())), ENT_QUOTES, $charset), new Font(12, 'Arial', '#0E298A'), new ParFormat('right'));
         }
         if ($id_fournisseur) {
             $fou = new entites($id_fournisseur);
             $coord_fou = entites::get_coordonnees($id_fournisseur, 1);
             $coord_fou = pmb_mysql_fetch_object($coord_fou);
             if ($fou->raison_sociale != '') {
                 $libelle = $fou->raison_sociale;
             } else {
                 $libelle = $coord_fou->libelle;
             }
             $table =& $sect->addTable();
             $table->addRows(2, 2);
             $table->addColumnsList(array(9, 10));
             $cell =& $table->getCell(1, 2);
             $cell->writeText($this->to_utf8($libelle), new Font(14, 'Arial', '#0E298A'), new ParFormat('left'));
             if ($coord_fou->adr1) {
                 $cell->writeText($this->to_utf8($coord_fou->adr1), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
             }
             if ($coord_fou->adr2) {
                 $cell->writeText($this->to_utf8($coord_fou->adr2), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
             }
             if ($coord_fou->cp) {
                 $cell->writeText($this->to_utf8($coord_fou->cp), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
             }
             if ($coord_fou->ville) {
                 $cell->writeText($this->to_utf8($coord_fou->ville), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
             }
             if ($coord_fou->contact != '') {
                 $cell =& $table->getCell(2, 2);
                 $cell->writeText($this->to_utf8($msg['acquisition_act_formule'] . " " . $coord_fou->contact), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
             }
         }
         $sect->writeText($this->to_utf8($msg["abts_gestion_retard_lettre_monsieur"] . "<br />"), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
         foreach ($info_fournisseur as $num_notice => $info_notice) {
             //print $num_notice; print_r($info_notice) ;exit;
             $perio = new serial_display($num_notice);
             $sect->writeText($this->to_utf8($perio->notice->tit1), $fontHead, $parHead);
             $sect->emptyParagraph($fontSmall, $parPmb);
             foreach ($info_notice as $abt_num => $info_abt) {
                 //$sect->writeText($this->to_utf8($doc), new Font(10,'Arial'), $parInfo);
                 foreach ($info_abt as $rel_id => $rel_info) {
                     $date = "<u>" . $rel_info["rel_libelle_numero"] . "</u> : " . formatdate($rel_info["rel_date_parution"]);
                     $sect->writeText($this->to_utf8($date), new Font(10, 'Arial'), $parInfo);
                     $sect->writeText($this->to_utf8($rel_info["rel_comment_gestion"]), new Font(10, 'Arial'), $parSubChapter);
                 }
             }
         }
         $sect->insertPageBreak();
     }
     $rtf->sendRtf("rapport");
 }
Exemplo n.º 2
0
 function generate_RTF()
 {
     global $pmb_gestion_devise, $base_path, $msg, $biblio_logo;
     //Format des fonts
     $fontHead = new Font(12, 'Arial', '#0E298A');
     $fontHead->setBold();
     $fontSmall = new Font(1);
     $fontComment = new Font(10, 'Arial');
     $fontComment->setItalic();
     $fontChapter = new Font(10, 'Arial');
     $fontChapter->setBold();
     $fontSubChapter = new Font(10, 'Arial');
     $fontSubChapter->setUnderline();
     //Format des paragraphes
     $parPmb = new ParFormat();
     $parPmb->setIndentRight(12.5);
     $parPmb->setBackColor('#0E298A');
     $parPmb->setSpaceAfter(8);
     $parHead = new ParFormat();
     $parHead->setSpaceBefore(5);
     //$parHead->setSpaceAfter(8);
     $parChapter = new ParFormat();
     $parChapter->setSpaceBefore(2);
     $parChapter->setSpaceAfter(1);
     $parComment = new ParFormat();
     $parComment->setIndentLeft(1);
     $parComment->setIndentRight(0.5);
     $parContenu = new ParFormat('justify');
     $parContenu->setIndentLeft(1);
     $parSubChapter = new ParFormat();
     $parSubChapter->setIndentLeft(0.5);
     $parInfo = new ParFormat();
     $parInfo->setIndentLeft(0.5);
     $parInfo->setSpaceAfter(1.5);
     //Document
     $rtf = new Rtf();
     $rtf->setMargins(1, 1, 1, 1);
     $sect =& $rtf->addSection();
     $table =& $sect->addTable();
     $table->addRows(2, 2);
     $table->addColumnsList(array(5, 15));
     $table->addImageToCell(1, 1, $base_path . "/images/" . $biblio_logo, new ParFormat('center'), 0, 0);
     $cell =& $table->getCell(1, 2);
     $titre_general = reg_diacrit($this->intro[0]['TITLE'][0]['value']);
     $cell->writeText($this->to_utf8(strtoupper($titre_general)), new Font(14, 'Arial', '#0E298A'), new ParFormat('left'));
     $table->setVerticalAlignmentOfCells('center', 1, 1, 2, 2);
     $table->writeToCell(2, 1, $this->to_utf8("<u>" . $msg['demandes_rapport_abstract'] . "</u> : "), new Font(12, 'Arial', '#0E298A'), new ParFormat('center'));
     $cell =& $table->getCell(2, 2);
     $cell->writeText($this->to_utf8($this->intro[0]['ABSTRACT'][0]['value']), new Font(12, 'Arial', '#0E298A'), new ParFormat('left'));
     $sect->writeText($msg['demandes_rapport_intro'], $fontHead, $parHead);
     $sect->emptyParagraph($fontSmall, $parPmb);
     $date = "<u>" . $msg['demandes_rapport_date'] . "</u> : " . $this->intro[0]['DATE'][0]['value'];
     $deadline = "<u>" . $msg['demandes_rapport_deadline'] . "</u> : " . $this->intro[0]['DEADLINE'][0]['value'];
     //$resume = "<u>".$msg['demandes_rapport_abstract']."</u> : ".$this->intro[0]['ABSTRACT'][0]['value'];
     $doc = "<u>" . $msg['demandes_rapport_documentaliste'] . "</u> : " . $this->intro[0]['DOCUMENTALISTE'][0]['value'];
     $dmde = "<u>" . $msg['demandes_rapport_demandeur'] . "</u> : " . $this->intro[0]['DEMANDEUR'][0]['value'];
     $time = "<u>" . $msg['demandes_action_time_elapsed'] . "</u> : " . $this->intro[0]['TIME'][0]['value'] . $msg['demandes_action_time_unit'];
     $cout = "<u>" . $msg['demandes_action_cout'] . "</u> : " . $this->intro[0]['COST'][0]['value'];
     $sect->writeText($this->to_utf8($doc), new Font(10, 'Arial'), $parInfo);
     $sect->writeText($this->to_utf8($dmde), new Font(10, 'Arial'), $parInfo);
     $sect->writeText($this->to_utf8($date), new Font(10, 'Arial'), $parInfo);
     $sect->writeText($this->to_utf8($deadline), new Font(10, 'Arial'), $parInfo);
     $sect->writeText($this->to_utf8($time), new Font(10, 'Arial'), $parInfo);
     $sect->writeText($this->to_utf8($cout) . html_entity_decode($pmb_gestion_devise, ENT_QUOTES, 'utf-8'), new Font(10, 'Arial'), $parInfo);
     //$sect->writeText($this->to_utf8($resume), new Font(10,'Arial'), $parInfo);
     $sect->writeText($this->to_utf8($msg['demandes_rapport']), $fontHead, $parHead);
     $sect->emptyParagraph($fontSmall, $parPmb);
     $indice = 1;
     for ($i = 0; $i < count($this->notes); $i++) {
         $chapter = "";
         $comment = "";
         if ($this->notes[$i]['TITRE'] == 'yes') {
             $chapter = $this->notes[$i]['CONTENT'][0]['value'];
             $sect->writeText("<br>" . $indice . " - " . $this->to_utf8($chapter) . "<br>", $fontChapter, $parChapter);
             $indice++;
             $sujet_old = "";
         } else {
             if ($this->notes[$i]['COMMENTAIRE'] == 'yes') {
                 $comment = $this->notes[$i]['CONTENT'][0]['value'];
                 $sect->writeText($this->to_utf8($comment), $fontComment, $parComment);
             } else {
                 $sujet = $this->notes[$i]['SUJET'][0]['value'];
                 $contenu = $this->notes[$i]['CONTENT'][0]['value'];
                 if ($sujet != $sujet_old) {
                     $sect->writeText($this->to_utf8($sujet), $fontSubChapter, $parSubChapter);
                 }
                 if ($contenu) {
                     $sect->writeText($this->to_utf8($contenu), new Font(10, 'Arial'), $parContenu);
                 }
                 $sujet_old = $sujet;
             }
         }
     }
     $rtf->sendRtf("rapport");
 }