Exemple #1
0
 function show_form($param = '')
 {
     global $dbh, $PMBuserid;
     //paramètres pré-enregistré
     if ($param['mailtpl_id']) {
         $id_sel = $param['mailtpl_id'];
     } else {
         $id_sel = 0;
     }
     if ($param['empr_caddie']) {
         $idemprcaddie_sel = $param['empr_caddie'];
     } else {
         $idemprcaddie_sel = 0;
     }
     $mailtpl = new mailtpls();
     //Choix du template de mail
     $form_task .= "\n\t\t<div class='row'>\n\t\t\t<div class='colonne3'>\n\t\t\t\t<label for='mailing_template'>" . $this->msg["planificateur_mailing_template"] . "</label>\n\t\t\t</div>\n\t\t\t<div class='colonne_suite' >\n\t\t\t\t" . $mailtpl->get_sel('mailtpl_id', $id_sel) . "\n\t\t\t</div>\n\t\t</div>\n\t\t<div class='row' >&nbsp;</div>";
     $liste = empr_caddie::get_cart_list();
     $gen_select_empr_caddie = "<select name='empr_caddie' id='empr_caddie'>";
     if (sizeof($liste)) {
         while (list($cle, $valeur) = each($liste)) {
             $rqt_autorisation = explode(" ", $valeur['autorisations']);
             if (array_search($PMBuserid, $rqt_autorisation) !== FALSE || $PMBuserid == 1) {
                 if ($valeur['idemprcaddie'] == $idemprcaddie_sel) {
                     $gen_select_empr_caddie .= "<option value='" . $valeur['idemprcaddie'] . "' selected='selected'>" . $valeur['name'] . "</option>";
                 } else {
                     $gen_select_empr_caddie .= "<option value='" . $valeur['idemprcaddie'] . "'>" . $valeur['name'] . "</option>";
                 }
             }
         }
     }
     $gen_select_empr_caddie .= "</select>";
     //Choix du panier d'emprunteurs
     $form_task .= "<div class='row'>\n\t\t\t<div class='colonne3'>\n\t\t\t\t<label for='mailing_caddie'>" . $this->msg["planificateur_mailing_caddie_empr"] . "</label>\n\t\t\t</div>\n\t\t\t<div class='colonne_suite'>\n\t\t\t\t" . $gen_select_empr_caddie . "\n\t\t\t</div>\n\t\t</div>";
     return $form_task;
 }
 function group_form($id_diff = 0)
 {
     global $serialcirc_diff_form_group, $msg, $charset;
     global $serialcirc_diff_form_group_empr, $serialcirc_diff_form_group_empr_0;
     $form = $serialcirc_diff_form_group;
     if ($id_diff) {
         $form_title = $msg["serialcirc_diff_edit_title"];
         $form = str_replace('!!group_name!!', $this->diffusion[$id_diff]['empr_name'], $form);
         $form = str_replace('!!duration!!', $this->diffusion[$id_diff]['duration'], $form);
     } else {
         $form_title = $msg["serialcirc_diff_add_title"];
         $form = str_replace('!!group_name!!', '', $form);
     }
     $checked = "";
     if ($this->diffusion[$id_diff]['type_diff']) {
         $checked = " checked='checked' ";
     }
     $form = str_replace('!!type_diff_checked!!', $checked, $form);
     $caddie_list = empr_caddie::get_cart_list();
     $caddie_sel = "";
     foreach ($caddie_list as $caddie) {
         $caddie_sel .= "<option value=" . $caddie['idemprcaddie'] . " onchange=''>" . htmlentities($caddie['name'], ENT_QUOTES, $charset) . "</option>";
     }
     $group_empr_sel = "";
     $requete = "select id_groupe, libelle_groupe from groupe";
     $result = pmb_mysql_query($requete);
     if (pmb_mysql_num_rows($result)) {
         while ($grp_temp = pmb_mysql_fetch_object($result)) {
             $group_empr_sel .= "<option value=" . $grp_temp->id_groupe . " onchange=''>" . htmlentities($grp_temp->libelle_groupe, ENT_QUOTES, $charset) . "</option>";
         }
     }
     $empr_form_list = "";
     $empr_form = $serialcirc_diff_form_group_empr_0;
     $empr_count = count($this->diffusion[$id_diff]['group']);
     if (!$empr_count) {
         // Pas de lecteur associés
         $empr_form = str_replace('!!empr_libelle!!', "", $empr_form);
         $empr_form = str_replace('!!empr_cpt!!', "0", $empr_form);
         $empr_form = str_replace('!!id_empr!!', "0", $empr_form);
         $empr_form = str_replace('!!checked!!', "", $empr_form);
         $empr_form_list = $empr_form;
     }
     if ($empr_count) {
         $cpt = 0;
         foreach ($this->diffusion[$id_diff]['group'] as $empr) {
             $empr_form = str_replace('!!id_empr!!', $empr['num_empr'], $empr_form);
             $empr_form = str_replace('!!empr_libelle!!', $empr['empr']['empr_libelle'], $empr_form);
             $checked = "";
             if ($empr['responsable']) {
                 $checked = " checked='checked' ";
             }
             $empr_form = str_replace('!!checked!!', $checked, $empr_form);
             $empr_form = str_replace('!!empr_cpt!!', $cpt, $empr_form);
             $empr_form_list .= $empr_form;
             $empr_form = $serialcirc_diff_form_group_empr;
             $cpt++;
         }
     }
     $form = str_replace('!!group_empr_list!!', $empr_form_list, $form);
     $form = str_replace('!!empr_count!!', $empr_count, $form);
     $form = str_replace('!!caddie_select!!', $caddie_sel, $form);
     $form = str_replace('!!group_circ_select!!', $group_empr_sel, $form);
     $form = str_replace('!!id_diff!!', $id_diff, $form);
     $form = str_replace('!!form_title!!', $form_title, $form);
     return $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, $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'] . "'>&nbsp;");
                        $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'] . "'>&nbsp;");
                        $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 . "&nbsp;" . 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);\"/>&nbsp;<input type='button' value='" . $msg["print_cancel"] . "' class='bouton' onClick='self.close();'/>&nbsp;";
    }
    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>";
    }
}
Exemple #4
0
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'] . "'>&nbsp;");
                        $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'] . "'>&nbsp;";
                        $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);\"/>&nbsp;<input type='button' value='" . $msg["print_cancel"] . "' class='bouton' onClick='self.close();'/>&nbsp;";
    }
    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>";
    }
}