";
else $lien_edition_panier_cst = "";
if($sub!='gestion' && $sub!='action') {
print "
";
}
// ********************************************************************************
function aff_empr_cart_titre ($myCart) {
global $msg;
if ($myCart->comment) $aff_tit_panier = $myCart->name." - ".$myCart->comment;
else $aff_tit_panier = $myCart->name;
return "";
}
// ********************************************************************************
function aff_empr_cart_nb_items ($myCart) {
global $msg;
return "
$msg[caddie_contient]
$msg[caddie_contient_total]
$msg[caddie_contient_nb_pointe]
$msg[caddie_contient_total]
$myCart->nb_item
$myCart->nb_item_pointe
";
}
// ****************************** aff_empr_cart_objects
function aff_empr_cart_objects ($idemprcaddie=0, $url_base="./circ.php?categ=caddie&sub=gestion&quoi=panier&idemprcaddie=0", $no_del=false,$rec_history=0 ) {
global $msg, $begin_result_liste;
global $dbh;
global $nbr_lignes, $page, $nb_per_page_search ;
global $url_base_suppr_empr_cart ;
$url_base_suppr_empr_cart = $url_base ;
// nombre de références par pages
if ($nb_per_page_search != "")
$nb_per_page = $nb_per_page_search ;
else $nb_per_page = 10;
// on récupére le nombre de lignes
if(!$nbr_lignes) {
$requete = "SELECT count(1) FROM empr_caddie_content where empr_caddie_id='".$idemprcaddie."' ";
$res = mysql_query($requete, $dbh);
$nbr_lignes = mysql_result($res, 0, 0);
}
if(!$page) $page=1;
$debut =($page-1)*$nb_per_page;
//Calcul des variables pour la suppression d'items
$modulo = $nbr_lignes%$nb_per_page;
if($modulo == 1){
$page_suppr = (!$page ? 1 : $page-1);
} else {
$page_suppr = $page;
}
$nb_after_suppr = ($nbr_lignes ? $nbr_lignes-1 : 0);
if($nbr_lignes) {
// on lance la vraie requête
$myCart = new empr_caddie($idemprcaddie);
$from = " empr_caddie_content left join empr on id_empr = object_id ";
$order_by = " empr_nom, empr_prenom " ;
$requete = "SELECT object_id, flag FROM $from where empr_caddie_id='".$idemprcaddie."' order by $order_by";
$requete.= " LIMIT $debut,$nb_per_page ";
$nav_bar = aff_pagination ($url_base, $nbr_lignes, $nb_per_page, $page, 10, false, true) ;
// l'affichage du résultat est fait après le else
} else {
print $msg[399];
return;
}
$liste=array();
$result = @mysql_query($requete, $dbh);
if(mysql_num_rows($result)) {
while ($temp = mysql_fetch_object($result))
$liste[] = array('object_id' => $temp->object_id, 'flag' => $temp->flag ) ;
}
if(!sizeof($liste) || !is_array($liste)) {
print $msg[399];
return;
} else {
print $begin_result_liste;
while(list($cle, $object) = each($liste)) {
// affichage de la liste des emprunteurs
$requete = "SELECT * FROM empr WHERE id_empr=$object[object_id] LIMIT 1";
$fetch = mysql_query($requete);
if(mysql_num_rows($fetch)) {
$empr = mysql_fetch_object($fetch);
// emprunteur
$link = './circ.php?categ=pret&form_cb='.rawurlencode($empr->empr_cb);
if ($object[flag]) $marque_flag ="" ;
else $marque_flag ="" ;
if (!$no_del) $lien_suppr_cart = " $marque_flag";
else $lien_suppr_cart = $marque_flag ;
$empr = new emprunteur($empr->id_empr, "", FALSE, 3);
$empr->fiche_consultation = str_replace('!!image_suppr_caddie_empr!!' , $lien_suppr_cart , $empr->fiche_consultation);
$empr->fiche_consultation = str_replace('!!lien_vers_empr!!' , $link , $empr->fiche_consultation);
print $empr->fiche_consultation;
}
} // fin de liste
}
print "
".$nav_bar ;
return;
}
//*********************************************************************************
function aff_empr_choix_quoi($action="", $action_cancel="", $titre_form="", $bouton_valider="",$onclick="") {
global $empr_cart_choix_quoi;
$empr_cart_choix_quoi = str_replace('!!action!!', $action, $empr_cart_choix_quoi);
$empr_cart_choix_quoi = str_replace('!!action_cancel!!', $action_cancel, $empr_cart_choix_quoi);
$empr_cart_choix_quoi = str_replace('!!titre_form!!', $titre_form, $empr_cart_choix_quoi);
$empr_cart_choix_quoi = str_replace('!!bouton_valider!!', $bouton_valider, $empr_cart_choix_quoi);
if ($onclick!="") $empr_cart_choix_quoi = str_replace('!!onclick_valider!!','onClick="'.$onclick.'"',$empr_cart_choix_quoi);
else $empr_cart_choix_quoi = str_replace('!!onclick_valider!!','',$empr_cart_choix_quoi);
return $empr_cart_choix_quoi;
}
// ********************************************************************************
function verif_droit_proc_empr_caddie($id) {
global $msg;
global $PMBuserid;
global $dbh;
if ($id) {
$requete = "SELECT autorisations FROM empr_caddie_procs WHERE idproc='$id' ";
$result = @mysql_query($requete, $dbh);
if(mysql_num_rows($result)) {
$temp = mysql_fetch_object($result);
$rqt_autorisation=explode(" ",$temp->autorisations);
if (array_search ($PMBuserid, $rqt_autorisation)!==FALSE || $PMBuserid == 1) return 1 ;
else return 0 ;
} else return 0;
} else return 0 ;
}
// ********************************************************************************
function verif_droit_empr_caddie($id) {
global $msg;
global $PMBuserid;
global $dbh ;
if ($id) {
$requete = "SELECT autorisations FROM empr_caddie WHERE idemprcaddie='$id' ";
$result = @mysql_query($requete, $dbh);
if(mysql_num_rows($result)) {
$temp = mysql_fetch_object($result);
$rqt_autorisation=explode(" ",$temp->autorisations);
if (array_search ($PMBuserid, $rqt_autorisation)!==FALSE || $PMBuserid == 1) return $id ;
else return 0 ;
} else return 0;
} else return 0 ;
}