Beispiel #1
0
 function get()
 {
     $explnum = new \explnum($this->explnum_id);
     return $explnum->get_file_content();
 }
Beispiel #2
0
 function export_doc_num($item = 0, $chemin)
 {
     global $dbh, $charset, $msg;
     $pattern_nom_fichier_doc_num = "!!explnumid!!_!!idnotice!!_!!idbulletin!!_!!indicedocnum!!_!!nomdoc!!";
     if ($this->type == "NOTI") {
         $requete = "select explnum_id, explnum_notice as numnotice, explnum_bulletin, explnum_data, explnum_extfichier, explnum_nomfichier, length(explnum_data) as taille ";
         $requete .= " FROM explnum WHERE ";
         $requete .= " explnum_notice={$item} ";
     } elseif ($this->type == "BULL") {
         $requete = "select explnum_id, bulletin_notice as numnotice, explnum_bulletin, explnum_data, explnum_extfichier, explnum_nomfichier, length(explnum_data) as taille ";
         $requete .= " FROM explnum JOIN bulletins on bulletin_id=explnum_bulletin WHERE ";
         $requete .= " explnum_bulletin={$item} ";
     } else {
         return;
     }
     // pas encore de document numérique attaché à un exemplaire
     $requete .= " and ((explnum_data is not null and explnum_data!='') OR (explnum_nomfichier is not null and explnum_nomfichier!=''))";
     $result = pmb_mysql_query($requete, $dbh) or die(pmb_mysql_error() . "<br />{$requete}");
     for ($i = 0; $i < pmb_mysql_num_rows($result); $i++) {
         $t = pmb_mysql_fetch_object($result);
         $t->explnum_id = str_pad($t->explnum_id, 6, "0", STR_PAD_LEFT);
         $t->numnotice = str_pad($t->numnotice, 6, "0", STR_PAD_LEFT);
         $t->explnum_bulletin = str_pad($t->explnum_bulletin, 6, "0", STR_PAD_LEFT);
         $nomfic = $pattern_nom_fichier_doc_num;
         $nomfic = str_replace("!!explnumid!!", str_pad($t->explnum_id, 6, "0", STR_PAD_LEFT), $nomfic);
         $nomfic = str_replace("!!idnotice!!", str_pad($t->numnotice, 6, "0", STR_PAD_LEFT), $nomfic);
         $nomfic = str_replace("!!idbulletin!!", str_pad($t->explnum_bulletin, 6, "0", STR_PAD_LEFT), $nomfic);
         $nomfic = str_replace("!!indicedocnum!!", str_pad($i, 3, "0", STR_PAD_LEFT), $nomfic);
         $nomfic = str_replace("!!nomdoc!!", $t->explnum_nomfichier, $nomfic);
         $hf = fopen($chemin . $nomfic, "w");
         if ($hf) {
             $explnum = new explnum($t->explnum_id);
             fwrite($hf, $explnum->get_file_content());
             fclose($hf);
             $ret .= "<li>" . $msg[caddie_expdocnum_wtrue] . " <a href=\"" . $chemin . $nomfic . "\">" . htmlentities($nomfic, ENT_QUOTES, $charset) . "</a></li>";
         } else {
             $ret .= "<li><i>" . $msg[caddie_expdocnum_wfalse] . " " . htmlentities($nomfic, ENT_QUOTES, $charset) . "</i></li>";
         }
     }
     if ($ret) {
         return "<blockquote>" . $msg[caddie_expdocnum_dir] . " " . htmlentities($chemin, ENT_QUOTES, $charset) . "<br /><ul>" . $ret . "</ul></blockquote>";
     } else {
         return;
     }
 }