Beispiel #1
0
 function listBannettesAuto($filtre_search = "", $id_classement = 0)
 {
     global $dbh;
     if (SESSrights & DSI_AUTH) {
         $result = array();
         //auto = 1 : bannettes automatiques sans contrôle de date
         $auto = 1;
         $filtre_search = str_replace("*", "%", $filtre_search);
         if ($filtre_search) {
             $clause = "WHERE nom_bannette like '{$filtre_search}%' and bannette_auto='{$auto}' ";
         } else {
             $clause = "WHERE bannette_auto='{$auto}' ";
         }
         //			if ($id_classement!=0) $clause.= " and num_classement=0 ";
         if ($id_classement > 0) {
             $clause .= " and num_classement='{$id_classement}' ";
         }
         $requete = "SELECT COUNT(1) FROM bannettes {$clause} ";
         $res = mysql_query($requete, $dbh);
         $nbr_lignes = mysql_result($res, 0, 0);
         if ($nbr_lignes) {
             $requete = "SELECT id_bannette, nom_bannette, date_last_remplissage, date_last_envoi, proprio_bannette, bannette_auto, nb_notices_diff FROM bannettes {$clause} ORDER BY nom_bannette, id_bannette ";
             $res = mysql_query($requete, $dbh);
             while ($row = mysql_fetch_assoc($res)) {
                 $result[] = array("id_bannette" => $row["id_bannette"], "nom_bannette" => utf8_normalize($row["nom_bannette"]), "date_last_remplissage" => $row["date_last_remplissage"], "date_last_envoi" => $row["date_last_envoi"], "proprio_bannette" => $row["proprio_bannette"], "bannette_auto" => $row["bannette_auto"], "nb_notices_diff" => $row["nb_notices_diff"]);
             }
         }
         return $result;
     } else {
         return array();
     }
 }
Beispiel #2
0
function donorm($str)
{
    # We exclude a few chars that ICU would not.
    $str = preg_replace('/[\\x00-\\x08\\x0b\\x0c\\x0e-\\x1f]/', UTF8_REPLACEMENT, $str);
    $str = str_replace(UTF8_FFFE, UTF8_REPLACEMENT, $str);
    $str = str_replace(UTF8_FFFF, UTF8_REPLACEMENT, $str);
    # UnicodeString constructor fails if the string ends with a head byte.
    # Add a junk char at the end, we'll strip it off
    return rtrim(utf8_normalize($str . "", UNORM_NFC), "");
}
 function list_agnostic_repositories($source_id, $notice)
 {
     $result = array();
     $sql = 'SELECT source_id, comment, name FROM connectors_sources WHERE id_connector = \'agnostic\'';
     $res = pmb_mysql_query($sql);
     while ($row = pmb_mysql_fetch_assoc($res)) {
         $result[] = array('id' => $row["source_id"], 'name' => utf8_normalize($row["name"]), 'comment' => utf8_normalize($row["comment"]));
     }
     return $result;
 }
 function getLinks($autTable, $id)
 {
     global $dbh;
     if ($autTable <= 0 || $autTable > 8) {
         return false;
     }
     $autlink = new aut_link($autTable, $id);
     $results = array();
     foreach ($autlink->aut_list as $alink) {
         $aresult = array('autlink_to' => utf8_normalize($alink['to']), 'autlink_to_id' => utf8_normalize($alink['to_num']), 'autlink_to_libelle' => utf8_normalize($alink['libelle']), 'autlink_type' => utf8_normalize($alink['type']), 'autlink_reciproc' => utf8_normalize($alink['reciproc']), 'autlink_comment' => utf8_normalize($alink['comment']));
         $results[] = $aresult;
     }
     return $results;
 }
Beispiel #5
0
 function listEntrepotSources()
 {
     global $dbh;
     if (SESSrights & ADMINISTRATION_AUTH) {
         $result = array();
         $requete = "select source_id, id_connector, comment, name from connectors_sources where repository=1";
         $res = mysql_query($requete) or die(mysql_error());
         while ($row = mysql_fetch_assoc($res)) {
             $result[] = array("source_id" => $row["source_id"], "id_connector" => utf8_normalize($row["id_connector"]), "comment" => utf8_normalize($row["comment"]), "name_connector_in" => utf8_normalize($row["name"]));
         }
         return $result;
     } else {
         return array();
     }
 }
 function get_publisher_information($publisher_id)
 {
     global $dbh;
     global $msg;
     $result = array();
     $publisher_id += 0;
     if (!$publisher_id) {
         throw new Exception("Missing parameter: publisher_id");
     }
     $sql = "SELECT * FROM publishers WHERE ed_id = " . $publisher_id;
     $res = pmb_mysql_query($sql);
     if (!$res) {
         throw new Exception("Not found: publisher_id = " . $publisher_id);
     }
     $row = pmb_mysql_fetch_assoc($res);
     $result = array("publisher_id" => $row["ed_id"], "publisher_name" => utf8_normalize($row["ed_name"]), "publisher_address1" => utf8_normalize($row["ed_adr1"]), "publisher_address2" => utf8_normalize($row["ed_adr2"]), "publisher_zipcode" => utf8_normalize($row["ed_cp"]), "publisher_city" => utf8_normalize($row["ed_ville"]), "publisher_country" => utf8_normalize($row["ed_pays"]), "publisher_web" => utf8_normalize($row["ed_web"]), "publisher_comment" => utf8_normalize($row["ed_comment"]), "publisher_links" => $this->proxy_parent->pmbesAutLinks_getLinks(3, $publisher_id));
     return $result;
 }
 function get_author_information($author_id)
 {
     global $dbh;
     global $msg;
     $result = array();
     $author_id += 0;
     if (!$author_id) {
         throw new Exception("Missing parameter: author_id");
     }
     $sql = "SELECT * FROM authors WHERE author_id = " . $author_id;
     $res = pmb_mysql_query($sql);
     if (!$res) {
         throw new Exception("Not found: author_id = " . $author_id);
     }
     $row = pmb_mysql_fetch_assoc($res);
     $result = array("author_id" => $row["author_id"], "author_type" => $row["author_type"], "author_name" => utf8_normalize($row["author_name"]), "author_rejete" => utf8_normalize($row["author_rejete"]), "author_see" => $row["author_see"], "author_date" => utf8_normalize($row["author_date"]), "author_web" => utf8_normalize($row["author_web"]), "author_comment" => utf8_normalize($row["author_comment"]), "author_lieu" => utf8_normalize($row["author_lieu"]), "author_ville" => utf8_normalize($row["author_ville"]), "author_pays" => utf8_normalize($row["author_pays"]), "author_subdivision" => utf8_normalize($row["author_subdivision"]), "author_numero" => utf8_normalize($row["author_numero"]));
     if (method_exists($this->proxy_parent, "pmbesAutLinks_getLinks")) {
         $result['author_links'] = $this->proxy_parent->pmbesAutLinks_getLinks(1, $author_id);
     } else {
         $result['author_links'] = array();
     }
     return $result;
 }
Beispiel #8
0
 /**
  * Check the libicu version
  */
 protected function envCheckLibicu()
 {
     $utf8 = function_exists('utf8_normalize');
     $intl = function_exists('normalizer_normalize');
     /**
      * This needs to be updated something that the latest libicu
      * will properly normalize.  This normalization was found at
      * http://www.unicode.org/versions/Unicode5.2.0/#Character_Additions
      * Note that we use the hex representation to create the code
      * points in order to avoid any Unicode-destroying during transit.
      */
     $not_normal_c = $this->unicodeChar("FA6C");
     $normal_c = $this->unicodeChar("242EE");
     $useNormalizer = 'php';
     $needsUpdate = false;
     /**
      * We're going to prefer the pecl extension here unless
      * utf8_normalize is more up to date.
      */
     if ($utf8) {
         $useNormalizer = 'utf8';
         $utf8 = utf8_normalize($not_normal_c, UtfNormal::UNORM_NFC);
         if ($utf8 !== $normal_c) {
             $needsUpdate = true;
         }
     }
     if ($intl) {
         $useNormalizer = 'intl';
         $intl = normalizer_normalize($not_normal_c, Normalizer::FORM_C);
         if ($intl !== $normal_c) {
             $needsUpdate = true;
         }
     }
     // Uses messages 'config-unicode-using-php', 'config-unicode-using-utf8', 'config-unicode-using-intl'
     if ($useNormalizer === 'php') {
         $this->showMessage('config-unicode-pure-php-warning');
     } else {
         $this->showMessage('config-unicode-using-' . $useNormalizer);
         if ($needsUpdate) {
             $this->showMessage('config-unicode-update-warning');
         }
     }
 }
Beispiel #9
0
 function command_waiting($id_tache, $cmd = '')
 {
     global $dbh, $msg;
     $requete_sql = "select status, commande from taches where id_tache='" . $id_tache . "' and end_at='0000-00-00 00:00:00'";
     $result = mysql_query($requete_sql);
     if (mysql_num_rows($result) == "1") {
         $status = mysql_result($result, 0, "status");
         $commande = mysql_result($result, 0, "commande");
     } else {
         $status = '';
         $commande = 0;
     }
     // une commande a déjà été envoyée auparavant...
     if ($commande != '0') {
         $cmd = $commande;
     }
     if ($cmd != '') {
         //check command - la commande envoyée est vérifié par rapport au status
         foreach ($this->types_taches as $type_tache) {
             foreach ($type_tache->states as $state) {
                 if ($state["id"] == $status) {
                     foreach ($state["nextState"] as $nextState) {
                         foreach ($type_tache->commands as $command) {
                             if ($nextState["command"] == $command["name"]) {
                                 if ($command["id"] == $cmd) {
                                     mysql_query("update taches set commande=" . $cmd . ", next_state='" . constant($nextState["value"]) . "' where id_tache=" . $id_tache, $dbh);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     $rs = mysql_query("select t.start_at, t.commande, p.calc_next_date_deb, p.calc_next_heure_deb \n\t\t\tfrom taches t , planificateur p \n\t\t\twhere t.num_planificateur = p.id_planificateur \n\t\t\tand id_tache=" . $id_tache);
     $tpl = "<td id='commande_tache_" . $id_tache . "'>";
     if ($rs) {
         $row = mysql_fetch_object($rs);
         if ($row->start_at == '0000-00-00 00:00:00') {
             $tpl .= htmlentities(formatdate($row->calc_next_date_deb), ENT_QUOTES, $charset) . " " . htmlentities($row->calc_next_heure_deb, ENT_QUOTES, $charset);
         } else {
             if ($row->start_at != '0000-00-00 00:00:00' && $row->commande != NULL) {
                 $tpl .= utf8_normalize($msg["planificateur_command_{$row->commande}"]);
             }
         }
     }
     $tpl .= "</td>";
     return $tpl;
 }
 function getInfoTaskPlanned($planificateur_id, $active = "")
 {
     global $dbh;
     $result = array();
     $planificateur_id += 0;
     if (!$planificateur_id) {
         throw new Exception("Missing parameter: planificateur_id");
     }
     if ($active != "") {
         $critere = " and statut=" . $active;
     } else {
         $critere = "";
     }
     $sql = "SELECT * FROM planificateur WHERE id_planificateur = " . $planificateur_id;
     $sql = $sql . $critere;
     $res = pmb_mysql_query($sql, $dbh);
     if (!$res) {
         throw new Exception("Not found: planificateur_id = " . $planificateur_id);
     }
     while ($row = pmb_mysql_fetch_assoc($res)) {
         $result[] = array("id_planificateur" => $row["id_planificateur"], "num_type_tache" => $row["num_type_tache"], "libelle_tache" => utf8_normalize($row["libelle_tache"]), "desc_tache" => utf8_normalize($row["desc_tache"]), "num_user" => $row["num_user"], "statut" => $row["statut"], "calc_next_date_deb" => utf8_normalize($row["calc_next_date_deb"]), "calc_next_heure_deb" => utf8_normalize($row["calc_next_heure_deb"]));
     }
     return $result;
 }
Beispiel #11
0
 function getPublicReadingLists($session_id)
 {
     if (!$session_id) {
         return array();
     }
     $session_info = $this->retrieve_session_information($session_id);
     $emprId = $session_info["empr_id"];
     if (!$emprId) {
         return array();
     }
     global $dbh;
     $sql = "select opac_liste_lecture.*, empr.empr_prenom, empr.empr_nom from opac_liste_lecture left join empr on empr.id_empr = opac_liste_lecture.num_empr where public=1";
     $res = mysql_query($sql);
     $results = array();
     while ($row = mysql_fetch_assoc($res)) {
         $aresult = array('reading_list_id' => $row['id_liste'], 'reading_list_name' => utf8_normalize($row['nom_liste']), 'reading_list_caption' => utf8_normalize($row['description']), 'reading_list_emprid' => $row['num_empr'], 'reading_list_empr_caption' => utf8_normalize($row['empr_nom'] . " " . $row['empr_prenom']), 'reading_list_confidential' => $row['confidential'], 'reading_list_public' => $row['public'], 'reading_list_readonly' => $row['read_only'], 'reading_list_notice_ids' => explode(',', $row['notices_associees']));
         $results[] = $aresult;
     }
     return $results;
 }
Beispiel #12
0
 function listExternalSources($OPACUserId = -1)
 {
     global $dbh, $msg;
     $sql = 'SELECT connectors_sources.source_id, connectors_sources.name, connectors_sources.comment, connectors_categ.connectors_categ_name FROM connectors_sources LEFT JOIN connectors_categ_sources ON (connectors_categ_sources.num_source = connectors_sources.source_id) LEFT JOIN connectors_categ ON (connectors_categ.connectors_categ_id = connectors_categ_sources.num_categ) WHERE 1 ' . ($OPACUserId != -1 ? 'AND connectors_sources.opac_allowed = 1' : '') . ' ORDER BY connectors_categ.connectors_categ_name, connectors_sources.name';
     $res = mysql_query($sql, $dbh);
     $results = array();
     $categs = array();
     while ($row = mysql_fetch_assoc($res)) {
         $categs[$row['connectors_categ_name'] ? $row['connectors_categ_name'] : $msg['source_no_category']][] = array('source_id' => $row['source_id'], 'source_caption' => utf8_normalize($row['name']), 'source_comment' => utf8_normalize($row['comment']));
     }
     foreach ($categs as $categ_name => $categ_content) {
         $results[] = array('category_caption' => utf8_normalize($categ_name), 'sources' => $categ_content);
     }
     return $results;
 }
Beispiel #13
0
 function fetch_item($item_cb = '', $item_id = '')
 {
     global $dbh;
     global $msg;
     global $charset;
     if ($this->proxy_parent->input_charset != 'utf-8' && $charset == 'utf-8') {
         $item_cb = utf8_encode($item_cb);
     } else {
         if ($this->proxy_parent->input_charset == 'utf-8' && $charset != 'utf-8') {
             $item_cb = utf8_decode($item_cb);
         }
     }
     $empty_result = array('id' => 0, 'cb' => '', 'cote' => '', 'location' => '', 'section' => '', 'support' => '', 'statut' => '', 'situation' => '');
     $item_id += 0;
     $wheres = array();
     if ($item_cb) {
         $wheres[] = "expl_cb = '" . addslashes($item_cb) . "'";
     }
     if ($item_id) {
         $wheres[] = "expl_id = " . $item_id . "";
     }
     $requete = "SELECT exemplaires.*, pret.*, docs_location.*, docs_section.*, docs_statut.*, tdoc_libelle, ";
     $requete .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
     $requete .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
     $requete .= " IF(pret_retour>sysdate(),0,1) as retard ";
     $requete .= " FROM exemplaires LEFT JOIN pret ON exemplaires.expl_id=pret.pret_idexpl ";
     $requete .= " left join docs_location on exemplaires.expl_location=docs_location.idlocation ";
     $requete .= " left join docs_section on exemplaires.expl_section=docs_section.idsection ";
     $requete .= " left join docs_statut on exemplaires.expl_statut=docs_statut.idstatut ";
     $requete .= " left join docs_type on exemplaires.expl_typdoc=docs_type.idtyp_doc  ";
     $requete .= " WHERE 1 and " . implode(' and ', $wheres);
     $res = mysql_query($requete, $dbh);
     if (!mysql_numrows($res)) {
         return $empty_result;
     }
     $row = mysql_fetch_assoc($res);
     //Je regarde si j'ai les bons droits d'accès
     if ($row["expl_notice"]) {
         //Si j'ai un exemplaire de monographie
         $notice_ids = $this->filter_tabl_notices(array($row["expl_notice"]), "exemplaire");
         if (!count($notice_ids) || $notice_ids[0]) {
             return $empty_result;
         }
     } elseif ($row["expl_bulletin"]) {
         $bulletin_ids = $this->filter_tabl_bulletins(array($row["expl_bulletin"]), "exemplaire");
         if (!count($bulletin_ids) || $bulletin_ids[0]) {
             return $empty_result;
         }
     }
     $expl_return = array();
     if ($this->expl_visible_opac($row["expl_id"])) {
         $expl = new exemplaire('', $row["expl_id"]);
         if ($row["pret_retour"]) {
             // exemplaire sorti
             $rqt_empr = "SELECT empr_nom, empr_prenom, id_empr, empr_cb FROM empr WHERE id_empr='" . $row["pret_idempr"] . "' ";
             $res_empr = mysql_query($rqt_empr, $dbh);
             $res_empr_obj = mysql_fetch_object($res_empr);
             $situation = "<strong>{$msg[358]} " . $row["aff_pret_retour"] . "</strong>";
         } else {
             // tester si réservé
             $result_resa = mysql_query("select 1 from resa where resa_cb='" . addslashes($row["expl_cb"]) . "' ", $dbh);
             $reserve = mysql_num_rows($result_resa);
             if ($reserve) {
                 $situation = $msg['expl_reserve'];
             } elseif ($row["pret_flag"]) {
                 $situation = "{$msg[359]}";
             } else {
                 $situation = "";
             }
         }
         $expl_return["id"] = $expl->expl_id;
         $expl_return["cb"] = $expl->cb;
         $expl_return["cote"] = $expl->cote;
         $expl_return["location_id"] = $expl->location_id;
         $expl_return["location_caption"] = utf8_normalize($row["location_libelle"]);
         $expl_return["section_id"] = $expl->section_id;
         $expl_return["section_caption"] = utf8_normalize($row["section_libelle"]);
         $expl_return["support"] = utf8_normalize($row["tdoc_libelle"]);
         $expl_return["statut"] = utf8_normalize($row["statut_libelle"]);
         $expl_return["situation"] = utf8_normalize($situation);
     }
     return $expl_return;
 }
Beispiel #14
0
 /**
  * Convert a UTF-8 string to normal form KD, compatibility decomposition.
  * This may cause irreversible information loss, use judiciously.
  * Fast return for pure ASCII strings.
  *
  * @param $string String: a valid UTF-8 string. Input is not validated.
  * @return string a UTF-8 string in normal form KD
  */
 static function toNFKD($string)
 {
     if (NORMALIZE_INTL) {
         return normalizer_normalize($string, Normalizer::FORM_KD);
     } elseif (NORMALIZE_ICU) {
         return utf8_normalize($string, UNORM_NFKD);
     } elseif (preg_match('/[\\x80-\\xff]/', $string)) {
         return UtfNormal::NFKD($string);
     } else {
         return $string;
     }
 }
 function get_all_locations_and_sections()
 {
     global $dbh;
     $results = array();
     $sql = "SELECT idlocation, location_libelle FROM docs_location WHERE location_visible_opac = 1";
     $res = pmb_mysql_query($sql, $dbh);
     while ($row = pmb_mysql_fetch_assoc($res)) {
         $aresult = array('location' => array("location_id" => $row["idlocation"], "location_caption" => utf8_normalize($row["location_libelle"])), 'sections' => array());
         $sql2 = "select idsection, section_libelle, section_pic from docs_section, exemplaires where expl_location=" . $row["idlocation"] . " and section_visible_opac=1 and expl_section=idsection group by idsection order by section_libelle ";
         $res2 = pmb_mysql_query($sql2);
         $n = 0;
         while ($r = pmb_mysql_fetch_object($res2)) {
             $asection = array();
             $asection["section_id"] = $r->idsection;
             $asection["section_location"] = $row["idlocation"];
             $asection["section_caption"] = utf8_normalize($r->section_libelle);
             $asection["section_image"] = $r->section_pic ? utf8_normalize($r->section_pic) : "images/rayonnage-small.png";
             $aresult['sections'][] = $asection;
         }
         $results[] = $aresult;
     }
     return $results;
 }
Beispiel #16
0
 function build_error($msg)
 {
     return array('status' => false, 'status_msg' => utf8_normalize($msg));
 }
 function fetchSerialList($OPACUserId = -1)
 {
     global $dbh;
     $sql = "\nSELECT n1.notice_id,\n       n1.tit1,\n       (SELECT COUNT(1)\n        FROM   notices n2\n               RIGHT JOIN bulletins b2\n                 ON ( n2.notice_id = b2.bulletin_notice )\n        WHERE  n2.notice_id = n1.notice_id) AS issue_count,\n       (SELECT COUNT(1)\n        FROM   notices n3\n               RIGHT JOIN bulletins b3\n                 ON ( n3.notice_id = b3.bulletin_notice )\n               RIGHT JOIN analysis a3\n                 ON ( b3.bulletin_id = a3.analysis_bulletin )\n        WHERE  n3.notice_id = n1.notice_id) AS analysis_count,\n       (SELECT COUNT(1)\n        FROM   notices n4\n               RIGHT JOIN bulletins b4\n                 ON ( n4.notice_id = b4.bulletin_notice )\n               RIGHT JOIN exemplaires e4\n                 ON ( b4.bulletin_id = e4.expl_bulletin )\n        WHERE  n4.notice_id = n1.notice_id) AS item_count\nFROM   notices n1\nWHERE  n1.niveau_biblio = 's'\n       AND n1.niveau_hierar = 1\nORDER  BY tit1  ";
     $res = pmb_mysql_query($sql, $dbh);
     $results = array();
     while ($row = pmb_mysql_fetch_assoc($res)) {
         //Je filtre les notices en fonction des droits
         $notice_ids = $this->filter_tabl_notices(array($row['notice_id']));
         if (count($notice_ids)) {
             $aresult = array('serial_id' => $row['notice_id'], 'serial_title' => utf8_normalize($row['tit1']), 'serial_issues_count' => $row['issue_count'], 'serial_items_count' => $row['item_count'], 'serial_analysis_count' => $row['analysis_count']);
             $results[] = $aresult;
         }
     }
     return $results;
 }
 function list_collection_subcollections($collection_id)
 {
     global $dbh;
     global $msg;
     $result = array();
     $collection_id += 0;
     if (!$collection_id) {
         throw new Exception("Missing parameter: collection_id");
     }
     $sql = "SELECT * FROM sub_collections WHERE sub_coll_parent = " . $collection_id;
     $res = pmb_mysql_query($sql, $dbh);
     if ($res) {
         while ($row = pmb_mysql_fetch_assoc($res)) {
             $aresult = array("sous_collection_id" => $row["sub_coll_id"], "sous_collection_name" => utf8_normalize($row["sub_coll_name"]), "sous_collection_parent" => $row["sub_coll_parent"], "sous_collection_issn" => utf8_normalize($row["sub_coll_issn"]), "sous_collection_web" => utf8_normalize($row["subcollection_web"]), "sous_collection_links" => $this->proxy_parent->pmbesAutLinks_getLinks(5, $collection_id));
             $result[] = $aresult;
         }
     }
     return $result;
 }
 function fetch_node($node_id, $OPACUserId = -1)
 {
     $node_id += 0;
     if (!$node_id) {
         return FALSE;
     }
     $node = new noeuds($node_id);
     $result = array('node_id' => $node->id_noeud, 'node_thesaurus' => $node->num_thesaurus, 'node_target_id' => 0, 'node_target_categories' => array());
     global $dbh;
     if ($node->num_renvoi_voir) {
         $result['node_target_id'] = $node->num_renvoi_voir;
         $q = "select * from categories where num_noeud = '" . $node->num_renvoi_voir . "'";
         $r = pmb_mysql_query($q, $dbh);
         $result['node_target_categories'] = array();
         while ($obj = pmb_mysql_fetch_object($r)) {
             $categ = array();
             $categ['node_id'] = $node_id;
             $categ['category_caption'] = utf8_normalize($obj->libelle_categorie);
             $categ['category_lang'] = utf8_normalize($obj->langue);
             $result['node_target_categories'][] = $categ;
         }
     }
     $q = "select * from categories where num_noeud = '" . $node_id . "'";
     $r = pmb_mysql_query($q, $dbh);
     $result['node_categories'] = array();
     while ($obj = pmb_mysql_fetch_object($r)) {
         $categ = array();
         $categ['node_id'] = $node_id;
         $categ['category_caption'] = utf8_normalize($obj->libelle_categorie);
         $categ['category_lang'] = utf8_normalize($obj->langue);
         $result['node_categories'][] = $categ;
     }
     $path_ids = noeuds::listAncestors($node_id);
     $result['node_path'] = array();
     if ($path_ids) {
         $q = "select * from categories where num_noeud IN(" . implode(',', $path_ids) . ") order by num_noeud";
         $r = pmb_mysql_query($q, $dbh);
         $result['node_path'] = array();
         $current_node_id = 0;
         $categs = array();
         while ($obj = pmb_mysql_fetch_object($r)) {
             if (!$current_node_id) {
                 $current_node_id = $obj->num_noeud;
             }
             if ($current_node_id != $obj->num_noeud) {
                 $result['node_path'][] = array('node_id' => $current_node_id, 'categories' => $categs);
                 $categs = array();
                 $current_node_id = $obj->num_noeud;
             }
             $categ = array();
             $categ['node_id'] = $current_node_id;
             $categ['category_caption'] = utf8_normalize($obj->libelle_categorie);
             $categ['category_lang'] = utf8_normalize($obj->langue);
             $categs[] = $categ;
         }
         if ($current_node_id) {
             $result['node_path'][] = array('node_id' => $current_node_id, 'categories' => $categs);
         }
     }
     $children = array();
     $children_res = noeuds::listChilds($node_id, 1);
     while ($row = pmb_mysql_fetch_assoc($children_res)) {
         $children[] = $row['id_noeud'];
     }
     $result['node_children'] = array();
     if ($children) {
         $q = "select noeuds.id_noeud, noeuds.num_renvoi_voir, categories.* from categories left join noeuds on (noeuds.id_noeud = categories.num_noeud) where noeuds.id_noeud IN(" . implode(',', $children) . ") order by num_noeud, libelle_categorie";
         $r = pmb_mysql_query($q, $dbh);
         $result['node_children'] = array();
         $current_node_id = 0;
         $current_islink = false;
         $categs = array();
         while ($obj = pmb_mysql_fetch_object($r)) {
             if (!$current_node_id) {
                 $current_node_id = $obj->num_noeud;
             }
             if ($current_node_id != $obj->num_noeud) {
                 $result['node_children'][] = array('node_id' => $current_node_id, 'categories' => $categs, 'is_link' => $current_islink);
                 $categs = array();
                 $current_node_id = $obj->num_noeud;
                 $current_islink = $obj->num_renvoi_voir > 0 ? true : false;
             }
             $categ = array();
             $categ['node_id'] = $current_node_id;
             $categ['category_caption'] = utf8_normalize($obj->libelle_categorie);
             $categ['category_lang'] = utf8_normalize($obj->langue);
             $categs[] = $categ;
         }
         if ($current_node_id) {
             $result['node_children'][] = array('node_id' => $current_node_id, 'categories' => $categs, 'is_link' => $current_islink);
         }
     }
     $result['node_seealso'] = array();
     $q = "select voir_aussi.num_noeud_dest, categories.* from voir_aussi left join categories on (voir_aussi.num_noeud_dest = categories.num_noeud) where num_noeud_orig = " . $node_id . " order by voir_aussi.num_noeud_dest";
     $r = pmb_mysql_query($q, $dbh);
     $current_node_id = 0;
     $categs = array();
     while ($obj = pmb_mysql_fetch_object($r)) {
         if (!$current_node_id) {
             $current_node_id = $obj->num_noeud;
         }
         if ($current_node_id != $obj->num_noeud) {
             $result['node_seealso'][] = array('node_id' => $current_node_id, 'categories' => $categs);
             $categs = array();
             $current_node_id = $obj->num_noeud;
         }
         $categ = array();
         $categ['node_id'] = $current_node_id;
         $categ['category_caption'] = utf8_normalize($obj->libelle_categorie);
         $categ['category_lang'] = utf8_normalize($obj->langue);
         $categs[] = $categ;
     }
     if ($current_node_id) {
         $result['node_seealso'][] = array('node_id' => $current_node_id, 'categories' => $categs);
     }
     return $result;
 }
 function listLoansGroups($loan_type = 0, $limite_mysql = '', $limite_page = '')
 {
     global $dbh, $msg;
     if (SESSrights & CIRCULATION_AUTH) {
         $results = array();
         $critere_requete = "";
         if ($loan_type) {
             switch ($loan_type) {
                 case LIST_LOAN_LATE:
                     $critere_requete .= "And pret_retour < curdate()";
                     break;
                 case LIST_LOAN_CURRENT:
                     $critere_requete .= "";
                     break;
             }
         }
         //REQUETE SQL
         $sql = "SELECT id_groupe, libelle_groupe, resp_groupe, ";
         $sql .= "id_empr, empr_cb, empr_nom, empr_prenom, empr_mail, ";
         $sql .= "pret_idexpl, pret_date, pret_retour, ";
         $sql .= "expl_cote, expl_id, expl_cb, ";
         $sql .= " date_format(pret_date, '" . $msg["format_date"] . "') as aff_pret_date, ";
         $sql .= " date_format(pret_retour, '" . $msg["format_date"] . "') as aff_pret_retour, ";
         $sql .= " IF(pret_retour>=curdate(),0,1) as retard, ";
         $sql .= " expl_notice, expl_bulletin, notices_m.notice_id as idnot, trim(concat(ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit ";
         $sql .= "FROM (((exemplaires LEFT JOIN notices AS notices_m ON expl_notice = notices_m.notice_id ) ";
         $sql .= "        LEFT JOIN bulletins ON expl_bulletin = bulletins.bulletin_id) ";
         $sql .= "        LEFT JOIN notices AS notices_s ON bulletin_notice = notices_s.notice_id), ";
         $sql .= "        empr,pret,empr_groupe, groupe ";
         $sql .= "WHERE pret.pret_idempr = empr.id_empr AND pret.pret_idexpl = exemplaires.expl_id AND empr_groupe.empr_id = empr.id_empr AND groupe.id_groupe = empr_groupe.groupe_id ";
         $sql .= $critere_requete;
         if ($limite_mysql && $limite_page) {
             $sql = $sql . " LIMIT " . $limite_mysql . ", " . $limite_page;
         }
         // on lance la requête (mysql_query)
         $res = pmb_mysql_query($sql, $dbh);
         if (!$res) {
             throw new Exception("Not found: Error");
         }
         while ($row = pmb_mysql_fetch_assoc($res)) {
             $result = array("id_groupe" => utf8_normalize($row["id_groupe"]), "libelle_groupe" => utf8_normalize($row["libelle_groupe"]), "resp_groupe" => utf8_normalize($row["resp_groupe"]), "id_empr" => $row["id_empr"], "empr_cb" => $row["empr_cb"], "empr_nom" => utf8_normalize($row["empr_nom"]), "empr_prenom" => utf8_normalize($row["empr_prenom"]), "empr_mail" => utf8_normalize($row["empr_mail"]), "pret_idexpl" => utf8_normalize($row["pret_idexpl"]), "pret_date" => utf8_normalize($row["pret_date"]), "pret_retour" => utf8_normalize($row["pret_retour"]), "expl_cote" => utf8_normalize($row["expl_cote"]), "expl_id" => utf8_normalize($row["expl_id"]), "expl_cb" => utf8_normalize($row["expl_cb"]), "aff_pret_date" => utf8_normalize($row["aff_pret_date"]), "aff_pret_retour" => utf8_normalize($row["aff_pret_retour"]), "retard" => utf8_normalize($row["retard"]), "expl_notice" => utf8_normalize($row["expl_notice"]), "expl_bulletin" => utf8_normalize($row["expl_bulletin"]), "idnot" => utf8_normalize($row["idnot"]), "tit" => utf8_normalize($row["tit"]));
             $results[] = $result;
         }
         return $results;
     } else {
         return array();
     }
 }
Beispiel #21
0
 function listSauvPerformed()
 {
     global $dbh;
     if (SESSrights & SAUV_AUTH) {
         $result = array();
         $requete = "select sauv_log_id,sauv_log_start_date,sauv_log_file,sauv_log_succeed,sauv_log_messages,concat(prenom,' ',nom) as name from sauv_log,users where sauv_log_userid=userid";
         //   	 	if (count($this->date_saving)!=0) {
         //    			$dates=implode("','",$this->date_saving);
         //    			$dates="'".$dates."'";
         //  	  		$requete.=" and sauv_log_start_date in (".$dates.")";
         //	    	}
         $requete .= " order by sauv_log_start_date desc";
         $resultat = mysql_query($requete, $dbh);
         while ($row = mysql_fetch_assoc($res)) {
             $result[] = array("sauv_log_id" => $row["sauv_log_id"], "sauv_log_start_date" => utf8_normalize($row["sauv_log_start_date"]), "sauv_log_file" => utf8_normalize($row["sauv_log_file"]), "sauv_log_succeed" => utf8_normalize($row["sauv_log_succeed"]), "sauv_log_messages" => utf8_normalize($row["sauv_log_messages"]), "name" => utf8_normalize($row["name"]));
         }
         return $result;
     } else {
         return array();
     }
 }