");
$print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["titre"] = stripslashes($valeur["caddie_classement"]);
if(!isset($print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["cart_list"])) {
$print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["cart_list"] = '';
}
$print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["cart_list"] .= $rowPrint;
}
}
//Tri des classements
foreach($print_cart as $key => $cart_type) {
ksort($print_cart[$key]["classement_list"]);
}
// affichage des paniers par type
foreach($print_cart as $key => $cart_type) {
//on remplace les clés à cause des accents
$cart_type["classement_list"]=array_values($cart_type["classement_list"]);
$contenu="";
foreach($cart_type["classement_list"] as $keyBis => $cart_typeBis) {
$contenu.=gen_plus($key.$keyBis,$cart_typeBis["titre"],"
".$msg['etagere_caddie_inclus']."
".$msg['caddie_name']."
".$msg['etagere_caddie_filters']."
".$cart_typeBis["cart_list"]."
",1);
}
$ret .= gen_plus($key,$cart_type["titre"],$contenu,1);
}
} else {
$ret = $msg['398'];
}
return $ret;
}
public function get_filter($idcaddie, $name) {
if(!empty($this->caddies[$idcaddie]['filters'][$name])) {
return $this->caddies[$idcaddie]['filters'][$name];
}
return '';
}
public function is_visible_element($caddie_id, $flag=NULL) {
$elt_flag = $this->get_filter($caddie_id, 'elt_flag');
$elt_no_flag = $this->get_filter($caddie_id, 'elt_no_flag');
//Est-ce qu'il y a une règle de filtrage ?
if($elt_flag && !$elt_no_flag) {
//Seulement les pointés
if(empty($flag)) {
return false;
}
} elseif($elt_no_flag && !$elt_flag) {
//Seulement les non pointés
if(!empty($flag)) {
return false;
}
}
return true;
}
public function init_restricts() {
global $gestion_acces_active, $gestion_acces_empr_notice;
if(!isset($this->restricts)) {
$this->restricts = array();
$this->restricts['acces_j']='';
if ($gestion_acces_active==1 && $gestion_acces_empr_notice==1) {
$ac= new acces();
$dom_2= $ac->setDomain(2);
$this->restricts['acces_j'] = $dom_2->getJoin($_SESSION['id_empr_session'],4,'notice_id');
}
if($this->restricts['acces_j']) {
$this->restricts['statut_j']='';
$this->restricts['statut_r']='';
} else {
$this->restricts['statut_j']=',notice_statut';
$this->restricts['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($_SESSION["opac_view"] && $_SESSION["opac_view_query"] ){
$opac_view_restrict=" notice_id in (select opac_view_num_notice from opac_view_notices_".$_SESSION["opac_view"].") ";
$this->restricts['statut_r'].=" and ".$opac_view_restrict;
}
}
return $this->restricts;
}
public function get_sort_query($query='', $sort_name="notices") {
global $opac_etagere_notices_order;
if (!empty($_SESSION["last_sort$sort_name"])) {
$sort = new sort($sort_name, 'session');
$query = $sort->appliquer_tri($_SESSION["last_sort$sort_name"], $query, "notice_id");
} else {
$query .= "order by ".$opac_etagere_notices_order;
}
return $query;
}
public function get_sorted_filtered_notices($notices) {
$query = "select notice_id from notices where notice_id IN (".implode(',', $notices).")";
$query = $this->get_sort_query($query);
$result = pmb_mysql_query($query);
$sorted_filtered_notices = array();
if(pmb_mysql_num_rows($result)) {
while(($obj=pmb_mysql_fetch_object($result))) {
$sorted_filtered_notices[] = $obj->notice_id;
}
}
return $sorted_filtered_notices;
}
public function get_notices($start=0, $nb_per_page=0) {
$notices = array();
$this->init_restricts();
$query = "select distinct notice_id, caddie_content.caddie_id, caddie_content.flag from caddie_content, etagere_caddie, notices ".$this->restricts['acces_j']." ".$this->restricts['statut_j']." ";
$query.= "where etagere_id=".$this->idetagere." and caddie_content.caddie_id=etagere_caddie.caddie_id and notice_id=object_id ".$this->restricts['statut_r']." ";
$result = pmb_mysql_query($query);
if(pmb_mysql_num_rows($result)) {
while(($obj=pmb_mysql_fetch_object($result))) {
//Est-ce qu'il y a une règle de filtrage ?
if($this->is_visible_element($obj->caddie_id, $obj->flag)) {
$notices[] = $obj->notice_id;
}
}
}
if(count($notices)) {
$notices = $this->get_sorted_filtered_notices($notices);
}
if($nb_per_page) {
$notices = array_slice($notices, $start, $nb_per_page);
}
return $notices;
}
public function get_notices_count() {
$this->init_restricts();
$notices = $this->get_notices();
return count($notices);
}
public function get_typdocs() {
$typdocs = array();
$this->init_restricts();
$requete = "select distinct typdoc, caddie_content.caddie_id, caddie_content.flag FROM caddie_content, etagere_caddie, notices ".$this->restricts['acces_j']." ".$this->restricts['statut_j']." ";
$requete.= "where etagere_id=".$this->idetagere." and caddie_content.caddie_id=etagere_caddie.caddie_id and notice_id=object_id ".$this->restricts['statut_r']." ";
$res = pmb_mysql_query($requete);
if ($res) {
while ($tpd=pmb_mysql_fetch_object($res)) {
if($this->is_visible_element($tpd->caddie_id, $tpd->flag)) {
$typdocs[]=$tpd->typdoc;
}
}
}
return $typdocs;
}
public function get_notices_from_query($query, $with_filters=false) {
$notices = '';
$result = pmb_mysql_query($query);
if (pmb_mysql_num_rows($result)) {
$tab_notices=array();
while($row=pmb_mysql_fetch_object($result)) {
if($this->is_visible_element($row->caddie_id, $row->flag)) {
$tab_notices[]=$row->notice_id;
}
}
$notices=implode(',',$tab_notices);
}
if($notices && $with_filters) {
$fr = new filter_results($notices);
$notices = $fr->get_results();
}
return $notices;
}
}