public function get_datas() { //on commence par récupérer l'identifiant retourné par le sélecteur... if ($this->parameters['selector'] != "") { for ($i = 0; $i < count($this->selectors); $i++) { if ($this->selectors[$i]['name'] == $this->parameters['selector']) { $selector = new $this->parameters['selector']($this->selectors[$i]['id']); break; } } $shelves = $selector->get_value(); if (is_array($shelves) && count($shelves)) { foreach ($shelves as $shelve_id) { $query = "select id_tri from etagere where idetagere =" . $shelve_id; $result = mysql_query($query); $records = $notices = array(); if ($result && mysql_num_rows($result)) { while ($row = mysql_fetch_object($result)) { notices_caddie($shelve_id, $notices, '', '', '', 0, $row->id_tri); } } foreach ($notices as $id => $niv) { $records[] = $id; } } } $records = $this->filter_datas("notices", $records); $records = array_slice($records, 0, $this->parameters['nb_max_elements']); $return = array('title' => 'Liste de Notices', 'records' => $records); return $return; } return false; }
function contenu_etagere($idetagere, $aff_notices_nb = 0, $mode_aff_notice = AFF_ETA_NOTICES_BOTH, $depliable = AFF_ETA_NOTICES_DEPLIABLES_OUI, $link_to_etagere = "", $link) { global $charset, $msg; global $gestion_acces_active, $gestion_acces_empr_notice; global $class_path; //droits d'acces emprunteur/notice $acces_j = ''; if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) { require_once "{$class_path}/acces.class.php"; $ac = new acces(); $dom_2 = $ac->setDomain(2); $acces_j = $dom_2->getJoin($_SESSION['id_empr_session'], 4, 'notice_id'); } if ($acces_j) { $statut_j = ''; $statut_r = ''; } else { $statut_j = ',notice_statut'; $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")"; } if (!$idetagere) { return ""; } $notices = array(); //petit check rapide pour récupérer le tri imposé sur l'étagère... $idetagere += 0; $rqt = "select id_tri from etagere where idetagere=" . $idetagere; $res = mysql_query($rqt); if (mysql_num_rows($res)) { $id_tri = mysql_result($res, 0, 0); } else { $id_tri = 0; } //On récupère les notices associées à l'étagère notices_caddie($idetagere, $notices, $acces_j, $statut_j, $statut_r, $aff_notices_nb, $id_tri); if ($aff_notices_nb > 0) { $limite_notices = min($aff_notices_nb, count($notices)); } elseif ($aff_notices_nb < 0) { $limite_notices = min($aff_notices_nb, count($notices)); } else { $limite_notices = count($notices); } reset($notices); $limit = 0; while ((list($idnotice, $niveau_biblio) = each($notices)) && $limit < $limite_notices) { $limit++; $retour_aff .= aff_notice($idnotice, 0, 1, 0, $mode_aff_notice, $depliable); } if (count($notices) > $limite_notices && $link_to_etagere) { $retour_aff .= "<a href=\"" . str_replace("!!id!!", $idetagere, $link) . "\">"; $retour_aff .= "<span class='etagere-suite'>" . $msg['etagere_suite'] . "</span>"; $retour_aff .= "</a>"; } return $retour_aff; }