function aff_paniers_empr($item = 0, $lien_origine = "./circ.php?", $action_click = "add_item", $titre = "", $restriction_panier = "", $lien_edition = 0, $lien_suppr = 0, $lien_creation = 1, $post_param_serialized = "") { global $msg; global $PMBuserid; global $charset; global $myCart; global $sub, $quoi; global $action; global $baselink; if ($lien_edition) { $lien_edition_panier_cst = "<input type=button class=bouton value='{$msg['caddie_editer']}' onclick=\"document.location='{$lien_origine}&action=edit_cart&idemprcaddie=!!idemprcaddie!!';\" />"; } else { $lien_edition_panier_cst = ""; } if ($sub != 'gestion' && $sub != 'action') { print "<form name='print_options' action='{$lien_origine}&action={$action_click}&item={$item}' method='post'>"; } $liste = empr_caddie::get_cart_list($restriction_panier); print "<script type='text/javascript' src='./javascript/tablist.js'></script>"; print "<hr />"; if ($lien_creation) { print "<div class='row'>"; if ($sub != 'gestion') { print $boutons_select . "<input class='bouton' type='button' value=' {$msg['new_cart']} ' onClick=\"this.form.action='{$lien_origine}&action=new_cart&item={$item}'; this.form.submit();\" />"; } else { print $boutons_select . "<input class='bouton' type='button' value=' {$msg['new_cart']} ' onClick=\"document.location='{$lien_origine}&action=new_cart&item={$item}'\" />"; } print "</div><br>"; } if (sizeof($liste)) { print pmb_bidi("<div class='row'><a href='javascript:expandAll()'><img src='./images/expand_all.gif' id='expandall' border='0'></a>\n\t\t\t\t<a href='javascript:collapseAll()'><img src='./images/collapse_all.gif' id='collapseall' border='0'></a>{$titre}</div>"); print confirmation_delete("{$lien_origine}&action=del_cart&item={$item}&idemprcaddie="); print "<script type='text/javascript'>\n\t\t\tfunction add_to_cart(form) {\n \t\tvar inputs = form.getElementsByTagName('input');\n \t\tvar count=0;\n \t\tfor(i=0;i<inputs.length;i++){\n\t\t\t\t\tif(inputs[i].type=='checkbox' && inputs[i].checked==true)\n \t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t\tif(count == 0){\n\t\t\t\t\talert(\"{$msg['no_emprcart_selected']}\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n \t\t\t}\n \t\t</script>"; if ($sub == "gestion" && $quoi == "panier") { print "<script src='./javascript/classementGen.js' type='text/javascript'></script>"; } $parity = 0; while (list($cle, $valeur) = each($liste)) { $rqt_autorisation = explode(" ", $valeur['autorisations']); if (array_search($PMBuserid, $rqt_autorisation) !== FALSE || $PMBuserid == 1) { $classementRow = $valeur['empr_caddie_classement']; if (!trim($classementRow)) { $classementRow = classementGen::getDefaultLibelle(); } $link = "{$lien_origine}&action={$action_click}&idemprcaddie=" . $valeur['idemprcaddie'] . "&item={$item}"; if ($parity = 1 - $parity) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $lien_edition_panier = str_replace('!!idemprcaddie!!', $valeur['idemprcaddie'], $lien_edition_panier_cst); $aff_lien = $lien_edition_panier; $myCart = new empr_caddie(0); $myCart->nb_item = $valeur['nb_item']; $myCart->nb_item_pointe = $valeur['nb_item_pointe']; $myCart->type = 'EMPR'; $print_cart[$classementRow]["titre"] = stripslashes($classementRow); $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" "; if ($item) { $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} ><td class='classement60'>"); if ($action != "transfert" && $action != "del_cart" && $action != "save_cart") { $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<input type='checkbox' id='id_" . $valeur['idemprcaddie'] . "' name='caddie[" . $valeur['idemprcaddie'] . "]' value='" . $valeur['idemprcaddie'] . "'> "); $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<a href='#' onClick='javascript:document.getElementById(\"id_" . $valeur['idemprcaddie'] . "\").checked=true; document.forms[\"print_options\"].submit();' /><strong>" . $valeur['name'] . "</strong>"); } else { $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<a href='{$link}' /><strong>" . $valeur['name'] . "</strong>"); } if ($valeur['comment']) { $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<br /><small>(" . $valeur['comment'] . ")</small>"); } $print_cart[$classementRow]["cart_list"] .= pmb_bidi("</td>\n\t \t\t" . aff_cart_nb_items_reduit($myCart) . "\n\t \t\t<td class='classement20'>{$aff_lien}</td>\n\t\t\t\t\t\t</tr>"); } else { $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} >"); $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<td class='classement60'>"); if ($sub != 'gestion' && $sub != 'action' && $action != "save_cart") { $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<input type='checkbox' id='id_" . $valeur['idemprcaddie'] . "' name='caddie[" . $valeur['idemprcaddie'] . "]' value='" . $valeur['idemprcaddie'] . "'> "); $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<a href='#' onClick='javascript:document.getElementById(\"id_" . $valeur['idemprcaddie'] . "\").checked=true; document.forms[\"print_options\"].submit();' /><strong>" . $valeur['name'] . "</strong>"); } else { $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<a href='{$link}' /><strong>" . $valeur['name'] . "</strong>"); } if ($valeur['comment']) { $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<br /><small>(" . $valeur['comment'] . ")</small>"); } $print_cart[$classementRow]["cart_list"] .= pmb_bidi("</a></td>"); $print_cart[$classementRow]["cart_list"] .= pmb_bidi(aff_cart_nb_items_reduit($myCart)); if ($sub == "gestion" && $quoi == "panier") { $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<td class='classement15'>" . $aff_lien . " " . empr_caddie::show_actions($valeur['idemprcaddie']) . "</td>"); $classementGen = new classementGen('empr_caddie', $valeur['idemprcaddie']); $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<td class='classement5'>" . $classementGen->show_selector($baselink, $PMBuserid) . "</td>"); } else { $print_cart[$classementRow]["cart_list"] .= pmb_bidi("<td class='classement20'>{$aff_lien}</td>"); } $print_cart[$classementRow]["cart_list"] .= pmb_bidi("</tr>"); } } } //on trie ksort($print_cart); //on remplace les clés à cause des accents $print_cart = array_values($print_cart); foreach ($print_cart as $key => $type) { print gen_plus($key, $type["titre"], "<table class='classementGen_tableau'>" . $type["cart_list"] . "</table>", 1); } } else { print $msg[398]; } if ($sub != 'gestion' && $sub != 'action' && $action != "del_cart") { $boutons_select = "<input type='submit' value='" . $msg["print_cart_add"] . "' class='bouton' onclick=\"return add_to_cart(this.form);\"/> <input type='button' value='" . $msg["print_cancel"] . "' class='bouton' onClick='self.close();'/> "; } if ($lien_creation) { print "<div class='row'><hr />"; if ($sub != 'gestion') { print $boutons_select . "<input class='bouton' type='button' value=' {$msg['new_cart']} ' onClick=\"this.form.action='{$lien_origine}&action=new_cart&item={$item}'; this.form.submit();\" />"; } else { print $boutons_select . "<input class='bouton' type='button' value=' {$msg['new_cart']} ' onClick=\"document.location='{$lien_origine}&action=new_cart&item={$item}'\" />"; } print "</div>"; } else { print "<div class='row'><hr />\n\t\t\t{$boutons_select}\n\t\t\t</div>"; } if ($post_param_serialized != "") { print unserialize($post_param_serialized); } if ($sub != 'gestion') { print "</form>"; } }
function aff_paniers($item = 0, $object_type = "NOTI", $lien_origine = "./cart.php?", $action_click = "add_item", $titre = "Cliquez sur le nom d'un panier pour y déposer la notice", $restriction_panier = "", $lien_edition = 0, $lien_suppr = 0, $lien_creation = 1, $nocheck = false, $lien_pointage = 0) { global $msg; global $PMBuserid; global $charset; global $myCart; global $action; global $baselink; if ($lien_edition) { $lien_edition_panier_cst = "<input type=button class=bouton value='{$msg['caddie_editer']}' onclick=\"document.location='{$lien_origine}&action=edit_cart&idcaddie=!!idcaddie!!';\" />"; } else { $lien_edition_panier_cst = ""; } $liste = caddie::get_cart_list($restriction_panier); print "<script type='text/javascript' src='./javascript/tablist.js'></script>"; if ($item && $nocheck) { print "<form name='print_options' action='{$lien_origine}&action={$action_click}&object_type=" . $object_type . "&item={$item}' method='post'>"; print "<input type='hidden' id='idcaddie' name='idcaddie' >"; if ($lien_pointage) { print "<input type='hidden' id='idcaddie_selected' name='idcaddie_selected' >"; } } if ($item && !$nocheck) { print "<form name='print_options' action='{$lien_origine}&action={$action_click}&object_type=" . $object_type . "&item={$item}' method='post'>"; if ($action != "save_cart") { print "<input type='checkbox' name='include_child' > " . $msg["cart_include_child"]; } } print "<hr />"; if ($lien_creation) { print "<div class='row'>\n\t\t{$boutons_select}<input class='bouton' type='button' value=' {$msg['new_cart']} ' onClick=\"document.location='{$lien_origine}&action=new_cart&object_type=" . $object_type . "&item={$item}'\" />\n\t\t</div><br>"; } if (sizeof($liste)) { print pmb_bidi("<div class='row'><a href='javascript:expandAll()'><img src='./images/expand_all.gif' id='expandall' border='0'></a>\n\t\t<a href='javascript:collapseAll()'><img src='./images/collapse_all.gif' id='collapseall' border='0'></a>{$titre}</div>"); print confirmation_delete("{$lien_origine}&action=del_cart&object_type=" . $object_type . "&item={$item}&idcaddie="); while (list($cle, $valeur) = each($liste)) { $rqt_autorisation = explode(" ", $valeur['autorisations']); if (array_search($PMBuserid, $rqt_autorisation) !== FALSE || $PMBuserid == 1) { $aff_lien = str_replace('!!idcaddie!!', $valeur['idcaddie'], $lien_edition_panier_cst); if (!$myCart) { $myCart = new caddie(0); } $myCart->nb_item = $valeur['nb_item']; $myCart->nb_item_pointe = $valeur['nb_item_pointe']; $myCart->type = $valeur['type']; $print_cart[$myCart->type]["titre"] = "<b>" . $msg["caddie_de_" . $myCart->type] . "</b><br />"; if (!trim($valeur["caddie_classement"])) { $valeur["caddie_classement"] = classementGen::getDefaultLibelle(); } $parity[$myCart->type] = 1 - $parity[$myCart->type]; if ($parity[$myCart->type]) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" "; if ($item && $action != "save_cart") { $rowPrint = pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} ><td class='classement60'>" . (!$nocheck ? "<input type='checkbox' id='id_" . $valeur['idcaddie'] . "' name='caddie[" . $valeur['idcaddie'] . "]' value='" . $valeur['idcaddie'] . "'>" : "") . " "); $link = "{$lien_origine}&action={$action_click}&object_type=" . $object_type . "&idcaddie=" . $valeur['idcaddie'] . "&item={$item}"; if (!$nocheck) { $rowPrint .= pmb_bidi("<a href='#' onclick='javascript:document.getElementById(\"id_" . $valeur['idcaddie'] . "\").checked=true;document.forms[\"print_options\"].submit();' /><strong>" . $valeur['name'] . "</strong>"); } else { if ($lien_pointage) { $rowPrint .= pmb_bidi("<a href='#' onclick='javascript:document.getElementById(\"idcaddie\").value=" . $item . ";document.getElementById(\"idcaddie_selected\").value=" . $valeur['idcaddie'] . ";document.forms[\"print_options\"].submit();' /><strong>" . $valeur['name'] . "</strong>"); } else { $rowPrint .= pmb_bidi("<a href='#' onclick='javascript:document.getElementById(\"idcaddie\").value=" . $valeur['idcaddie'] . ";document.forms[\"print_options\"].submit();' /><strong>" . $valeur['name'] . "</strong>"); } } if ($valeur['comment']) { $rowPrint .= pmb_bidi("<br /><small>(" . $valeur['comment'] . ")</small>"); } $rowPrint .= pmb_bidi("</td>\n\t \t\t" . aff_cart_nb_items_reduit($myCart) . "\n\t \t\t<td class='classement20'>{$aff_lien}</td>\n\t\t\t\t\t\t</tr>"); } else { $link = "{$lien_origine}&action={$action_click}&object_type=" . $object_type . "&idcaddie=" . $valeur['idcaddie'] . "&item={$item}"; $rowPrint = pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} >"); $rowPrint .= pmb_bidi("<td class='classement60'><a href='{$link}' /><strong>" . $valeur['name'] . "</strong>"); if ($valeur['comment']) { $rowPrint .= pmb_bidi("<br /><small>(" . $valeur['comment'] . ")</small>"); } $rowPrint .= pmb_bidi("</a></td>"); $rowPrint .= pmb_bidi(aff_cart_nb_items_reduit($myCart)); if ($lien_creation) { $classementGen = new classementGen('caddie', $valeur['idcaddie']); $rowPrint .= pmb_bidi("<td class='classement15'>" . $aff_lien . " " . caddie::show_actions($valeur['idcaddie'], $valeur['type']) . "</td>"); $rowPrint .= pmb_bidi("<td class='classement5'>" . $classementGen->show_selector($baselink, $PMBuserid) . "</td>"); } else { $rowPrint .= pmb_bidi("<td class='classement20'>{$aff_lien}</td>"); } $rowPrint .= pmb_bidi("</tr>"); } $print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["titre"] = stripslashes($valeur["caddie_classement"]); $print_cart[$myCart->type]["classement_list"][$valeur["caddie_classement"]]["cart_list"] .= $rowPrint; } } if ($lien_creation) { print "<script src='./javascript/classementGen.js' type='text/javascript'></script>"; } //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"], "<table border='0' cellspacing='0' width='100%' class='classementGen_tableau'>" . $cart_typeBis["cart_list"] . "</table>", 1); } print gen_plus($key, $cart_type["titre"], $contenu, 1); } } else { print $msg[398]; } if (!$nocheck) { if ($item && $action != "save_cart") { $boutons_select = "<input type='submit' value='" . $msg["print_cart_add"] . "' class='bouton'/> <input type='button' value='" . $msg["print_cancel"] . "' class='bouton' onClick='self.close();'/> "; } if ($lien_creation) { print "<div class='row'><hr />\n\t\t\t\t{$boutons_select}<input class='bouton' type='button' value=' {$msg['new_cart']} ' onClick=\"document.location='{$lien_origine}&action=new_cart&object_type=" . $object_type . "&item={$item}'\" />\n\t\t\t\t</div>"; } else { print "<div class='row'><hr />\n\t\t\t\t{$boutons_select}\n\t\t\t\t</div>"; } } else { if ($lien_creation) { print "<div class='row'><hr />\n\t\t\t{$boutons_select}<input class='bouton' type='button' value=' {$msg['new_cart']} ' onClick=\"document.location='{$lien_origine}&action=new_cart&object_type=" . $object_type . "&item={$item}'\" />\n\t\t\t</div>"; } } //if(($item)&&(!$nocheck)) print"</form>"; if ($item) { print "</form>"; } }
function aff_paniers_empr($item = 0, $lien_origine = "./circ.php?", $action_click = "add_item", $titre = "", $restriction_panier = "", $lien_edition = 0, $lien_suppr = 0, $lien_creation = 1, $post_param_serialized = "") { global $msg; global $PMBuserid; global $charset; global $myCart; global $sub; global $action; if ($lien_edition) { $lien_edition_panier_cst = "<input type=button class=bouton value='{$msg['caddie_editer']}' onclick=\"document.location='{$lien_origine}&action=edit_cart&idemprcaddie=!!idemprcaddie!!';\" />"; } else { $lien_edition_panier_cst = ""; } if ($sub != 'gestion' && $sub != 'action') { print "<form name='print_options' action='{$lien_origine}&action={$action_click}&item={$item}' method='post'>"; } $liste = empr_caddie::get_cart_list($restriction_panier); print "<hr />"; if (sizeof($liste)) { print "<div class='row'>{$titre}</div>"; print confirmation_delete("{$lien_origine}&action=del_cart&item={$item}&idemprcaddie="); print "<script type='text/javascript'>\n\t\t\tfunction add_to_cart(form) {\n \t\tvar inputs = form.getElementsByTagName('input');\n \t\tvar count=0;\n \t\tfor(i=0;i<inputs.length;i++){\n\t\t\t\t\tif(inputs[i].type=='checkbox' && inputs[i].checked==true)\n \t\t\t\tcount ++;\n\t\t\t\t}\n\t\t\t\tif(count == 0){\n\t\t\t\t\talert(\"{$msg['no_emprcart_selected']}\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\treturn true;\n \t\t\t}\n \t\t</script>"; print "<table border='0' cellspacing='0' width='100%'>"; $parity = 0; while (list($cle, $valeur) = each($liste)) { $rqt_autorisation = explode(" ", $valeur['autorisations']); if (array_search($PMBuserid, $rqt_autorisation) !== FALSE || $PMBuserid == 1) { $link = "{$lien_origine}&action={$action_click}&idemprcaddie=" . $valeur['idemprcaddie'] . "&item={$item}"; if ($parity = 1 - $parity) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $lien_edition_panier = str_replace('!!idemprcaddie!!', $valeur['idemprcaddie'], $lien_edition_panier_cst); $aff_lien = $lien_edition_panier; $myCart = new empr_caddie(0); $myCart->nb_item = $valeur['nb_item']; $myCart->nb_item_pointe = $valeur['nb_item_pointe']; $myCart->type = $valeur['type']; $print_cart[$myCart->type]["titre"] = "<b>" . $msg["caddie_de_" . $myCart->type] . "</b><br />"; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" "; if ($item) { $print_cart[$myCart->type]["cart_list"] .= pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} ><td>"); if ($action != "transfert" && $action != "del_cart" && $action != "save_cart") { $print_cart[$myCart->type]["cart_list"] .= pmb_bidi("<input type='checkbox' id='id_" . $valeur['idemprcaddie'] . "' name='caddie[" . $valeur['idemprcaddie'] . "]' value='" . $valeur['idemprcaddie'] . "'> "); $print_cart[$myCart->type]["cart_list"] .= pmb_bidi("<a href='#' onClick='javascript:document.getElementById(\"id_" . $valeur['idemprcaddie'] . "\").checked=true; document.forms[\"print_options\"].submit();' /><strong>" . $valeur['name'] . "</strong>"); // form_filters_cart //$print_cart[$myCart->type]["cart_list"].= pmb_bidi("<a href='#' onClick=\"if (document.forms.length) { if (document.forms['print_options'].elements.length) { document.forms['print_options'].idemprcaddie.value='".$valeur['idemprcaddie']."'; document.forms['form_filters_cart'].submit(); } }\"/><strong>".$valeur['name']."</strong>"); } else { $print_cart[$myCart->type]["cart_list"] .= pmb_bidi("<a href='{$link}' /><strong>" . $valeur['name'] . "</strong>"); } if ($valeur['comment']) { $print_cart[$myCart->type]["cart_list"] .= pmb_bidi("<br /><small>(" . $valeur['comment'] . ")</small>"); } $print_cart[$myCart->type]["cart_list"] .= pmb_bidi("</td>\n\t \t\t<td>" . aff_cart_nb_items_reduit($myCart) . "</td>\n\t \t\t<td>{$aff_lien}</td>\n\t\t\t\t\t\t</tr>"); } else { $print_cart[$myCart->type]["cart_list"] .= "<tr class='{$pair_impair}' {$tr_javascript} ><td>"; if ($sub != 'gestion' && $sub != 'action' && $action != "save_cart") { $print_cart[$myCart->type]["cart_list"] .= "<input type='checkbox' id='id_" . $valeur['idemprcaddie'] . "' name='caddie[" . $valeur['idemprcaddie'] . "]' value='" . $valeur['idemprcaddie'] . "'> "; $print_cart[$myCart->type]["cart_list"] .= "<a href='#' onClick='javascript:document.getElementById(\"id_" . $valeur['idemprcaddie'] . "\").checked=true; document.forms[\"print_options\"].submit();' /><strong>" . $valeur['name'] . "</strong>"; } else { $print_cart[$myCart->type]["cart_list"] .= "<a href='{$link}' /><strong>" . $valeur['name'] . "</strong>"; } if ($valeur['comment']) { $print_cart[$myCart->type]["cart_list"] .= "<br /><small>(" . $valeur['comment'] . ")</small>"; } $print_cart[$myCart->type]["cart_list"] .= "</a></td>\n\t\t \t\t<td>" . aff_cart_nb_items_reduit($myCart) . "</td>\n\t\t \t\t<td>{$aff_lien}</td>\n\t\t\t\t\t\t\t</tr>"; } } } // affichage des paniers par type foreach ($print_cart as $key => $cart_type) { print $cart_type["cart_list"]; } print "</table>"; } else { print $msg[398]; } if ($sub != 'gestion' && $sub != 'action' && $action != "del_cart") { $boutons_select = "<input type='submit' value='" . $msg["print_cart_add"] . "' class='bouton' onclick=\"return add_to_cart(this.form);\"/> <input type='button' value='" . $msg["print_cancel"] . "' class='bouton' onClick='self.close();'/> "; } if ($lien_creation) { print "<div class='row'><hr />"; if ($sub != 'gestion') { print $boutons_select . "<input class='bouton' type='button' value=' {$msg['new_cart']} ' onClick=\"this.form.action='{$lien_origine}&action=new_cart&item={$item}'; this.form.submit();\" />"; } else { print $boutons_select . "<input class='bouton' type='button' value=' {$msg['new_cart']} ' onClick=\"document.location='{$lien_origine}&action=new_cart&item={$item}'\" />"; } print "</div>"; } else { print "<div class='row'><hr />\n\t\t\t{$boutons_select}\n\t\t\t</div>"; } if ($post_param_serialized != "") { print unserialize($post_param_serialized); } if ($sub != 'gestion') { print "</form>"; } }