Example #1
0
         }
         $browser_header ? $browser_header .= '&gt;<strong>' : ($browser_header = '<strong>');
         $browser_header .= $tcateg->path_table[sizeof($tcateg->path_table) - 1]['libelle'];
         $browser_header .= '</strong>';
     }
 }
 $browser_content .= "<tr>\n\t\t\t<th></th>\n\t\t\t<th>" . $msg[103] . "</th>\n\t\t\t<!--!!col_num_autorite!!-->\n\t\t\t<th>" . $msg["count_notices_assoc"] . "</th>\n\t\t\t</tr>";
 $num_auth_present = false;
 $req = "SELECT id_authority_source FROM authorities_sources WHERE authority_type='category' AND TRIM(authority_number) !='' LIMIT 1";
 $res_aut = pmb_mysql_query($req, $dbh);
 if ($res_aut && pmb_mysql_num_rows($res_aut)) {
     $browser_content = str_replace("<!--!!col_num_autorite!!-->", "<th>" . $msg["authorities_number"] . "</th>", $browser_content);
     $num_auth_present = true;
 }
 $odd_even = 0;
 pmb_mysql_data_seek($result, 0);
 while ($cat = pmb_mysql_fetch_row($result)) {
     $tcateg = new category($cat[0]);
     if ($odd_even == 0) {
         $browser_content .= "\t<tr class='odd'>";
         $odd_even = 1;
     } else {
         if ($odd_even == 1) {
             $browser_content .= "\t<tr class='even'>";
             $odd_even = 0;
         }
     }
     $notice_count = $tcateg->notice_count(false);
     $browser_content .= "<td style='text-align:center; width:25px;'>\n        \t\t\t\t\t\t\t<a title='" . $msg['authority_list_see_label'] . "' href='./autorites.php?categ=see&sub=category&id=" . $tcateg->id . "'>\n        \t\t\t\t\t\t\t\t<i class='fa fa-eye'></i>\n        \t\t\t\t\t\t\t</a>\n        \t\t    \t  \t\t</td>";
     $browser_content .= "<td>";
     if ($tcateg->has_child) {
Example #2
0
function planning_list($idnotice = 0, $idbulletin = 0, $idempr = 0, $order = '', $where = '', $info_gestion = NO_INFO_GESTION, $url_gestion = '', $ancre = '')
{
    global $dbh, $msg, $charset;
    global $montrerquoi, $f_loc_empr, $f_loc_ret;
    global $current_module;
    global $pdflettreresa_priorite_email_manuel;
    global $pmb_lecteurs_localises, $deflt2docs_location;
    global $pmb_location_resa_planning, $pmb_location_reservation, $deflt_docs_location, $deflt_resas_location;
    global $tdoc;
    $q_loc = 'select idlocation, location_libelle FROM docs_location order by location_libelle';
    $r_loc = pmb_mysql_query($q_loc, $dbh);
    //Tableau + selecteur de localisations emprunteurs / nb de previsions
    $tab_loc_empr = array();
    $sel_loc_empr = '';
    if (!isset($f_loc_empr)) {
        $f_loc_empr = $deflt2docs_location;
    }
    if ($pmb_lecteurs_localises) {
        $sel_loc_empr = '<select name="f_loc_empr" onchange="document.check_resa_planning.submit();">';
        $sel_loc_empr .= '<option value="0"' . (!$f_loc_empr ? ' selected="selected"' : '') . '>' . $msg['all_location'] . '</option>';
        if (pmb_mysql_num_rows($r_loc)) {
            pmb_mysql_data_seek($r_loc, 0);
            while ($o = pmb_mysql_fetch_object($r_loc)) {
                $tab_loc_empr[$o->idlocation] = htmlentities($o->location_libelle, ENT_QUOTES, $charset);
                $sel_loc_empr .= '<option value="' . $o->idlocation . '"' . ($f_loc_empr == $o->idlocation ? ' selected="selected"' : '') . '>' . $tab_loc_empr[$o->idlocation] . '</option>';
            }
        }
        $sel_loc_empr .= '</select>';
    }
    //Tableau + selecteur de localisation de retrait / nb de previsions
    $tab_loc_ret = array();
    $sel_loc_ret = '';
    if (!isset($f_loc_ret)) {
        if ($deflt_resas_location) {
            $f_loc_ret = $deflt_resas_location;
        } else {
            $f_loc_ret = $deflt_docs_location;
        }
    }
    if ($pmb_location_resa_planning) {
        $sel_loc_ret = '<select name="f_loc_ret" onchange="document.check_resa_planning.submit();">';
        $sel_loc_ret .= '<option value="0"' . (!$f_loc_ret ? ' selected="selected"' : '') . '>' . $msg['all_location'] . '</option>';
        if (pmb_mysql_num_rows($r_loc)) {
            pmb_mysql_data_seek($r_loc, 0);
            while ($o = pmb_mysql_fetch_object($r_loc)) {
                $tab_loc_ret[$o->idlocation] = htmlentities($o->location_libelle, ENT_QUOTES, $charset);
                $sel_loc_ret .= '<option value="' . $o->idlocation . '"' . ($f_loc_ret == $o->idlocation ? ' selected="selected"' : '') . '>' . $tab_loc_ret[$o->idlocation] . '</option>';
            }
        }
        $sel_loc_ret .= '</select>';
    }
    $aff_final = "<script type='text/javascript'>\n\t\tvar ajax_func_to_call=new http_request();\n\t\tvar f_caller='';\n\t\tvar param1='';\n\t\tvar param2='';\n\t\tvar id;\n\t\tfunction func_callback(p_caller,p_id,p_date,p_param1,p_param2) {\n\t\t\tf_caller = p_caller;\n\t\t\tparam1 = p_param1;\n\t\t\tparam2 = p_param2;\n\t\t\tid = p_id;\n\t\t\tvar url_func = './ajax.php?module=circ&categ=resa_planning&sub=update_resa_planning&id='+p_id+'&date='+p_date+'&param1='+p_param1;\n\t\t\tajax_func_to_call.request(url_func,0,'',1,func_callback_ret,0,0);\n\t\t}\n\n\t\tfunction func_callback_ret() {\n\t\t\tif (param1 == '1') document.forms[f_caller].elements['resa_date_debut['+id+']'].value = ajax_func_to_call.get_text();\n\t\t\tif (param1 == '2') document.forms[f_caller].elements['resa_date_debut['+id+']'].value = ajax_func_to_call.get_text();\n\t\t\tdocument.forms[f_caller].elements[param2].value = ajax_func_to_call.get_text();\n\t\t}\n\t</script>";
    switch ($info_gestion) {
        case GESTION_INFO_GESTION:
            $url_gestion = "./circ.php?categ=resa_planning";
            break;
        case EDIT_INFO_GESTION:
            $url_gestion = "./edit.php?categ=notices&sub=resa_planning";
            break;
    }
    switch ($info_gestion) {
        case GESTION_INFO_GESTION:
        case EDIT_INFO_GESTION:
            if (!$montrerquoi) {
                $montrerquoi = 'all';
            }
            $aff_final .= "<form class='form-" . $current_module . "' name='check_resa_planning' action='" . $url_gestion . "' method='post' ><div class='left' >";
            $aff_final .= "<input type='hidden' name='resa_action' value='' />";
            //Selecteur previsions validees/confirmees
            $aff_final .= "<span class='usercheckbox'><input type='radio' name='montrerquoi' value='all' id='all' onclick='this.form.submit();' ";
            if ($montrerquoi == 'all') {
                $aff_final .= "checked='checked'";
                $clause = "and resa_remaining_qty!=0 ";
            }
            $aff_final .= " /><label for='all'>" . htmlentities($msg['resa_planning_show_all'], ENT_QUOTES, $charset) . "</label></span>&nbsp;";
            $aff_final .= "<span class='usercheckbox'><input type='radio' name='montrerquoi' value='validees' id='validees' onclick='this.form.submit();' ";
            if ($montrerquoi == 'validees') {
                $aff_final .= "checked='checked'";
                $clause = "and resa_validee='1' ";
            }
            $aff_final .= " /><label for='validees'>" . htmlentities($msg['resa_planning_show_validees'], ENT_QUOTES, $charset) . "</label></span>&nbsp;";
            $aff_final .= "<span class='usercheckbox'><input type='radio' name='montrerquoi' value='invalidees' id='invalidees' onclick='this.form.submit();' ";
            if ($montrerquoi == 'invalidees') {
                $aff_final .= "checked='checked'";
                $clause = "and resa_validee='0' ";
            }
            $aff_final .= " /><label for='invalidees'>" . htmlentities($msg['resa_planning_show_invalidees'], ENT_QUOTES, $charset) . "</label></span>&nbsp;";
            $aff_final .= "<span class='usercheckbox'><input type='radio' name='montrerquoi' value='valid_noconf' id='valid_noconf' onclick='this.form.submit();' ";
            if ($montrerquoi == 'valid_noconf') {
                $aff_final .= "checked='checked'";
                $clause = "and resa_validee='1' and resa_confirmee='0' ";
            }
            $aff_final .= " /><label for='valid_noconf'>" . htmlentities($msg['resa_planning_show_non_confirmees'], ENT_QUOTES, $charset) . "</label></span>&nbsp;";
            $aff_final .= "<span class='usercheckbox'><input type='radio' name='montrerquoi' value='toresa' id='toresa' onclick='this.form.submit();' ";
            if ($montrerquoi == 'toresa') {
                $aff_final .= "checked='checked'";
                $clause = "and resa_remaining_qty=0 ";
            }
            $aff_final .= " /><label for='toresa'>" . htmlentities($msg['resa_planning_show_toresa'], ENT_QUOTES, $charset) . "</label></span></div>";
            //Selecteur de localisation des emprunteurs
            if ($pmb_lecteurs_localises) {
                $aff_final .= '<div class="row">&nbsp;</div><div class="row"><div class="colonne10">' . $msg['resa_planning_loc_empr'] . '</div>';
                $aff_final .= '<div class="colonne_suite">' . $sel_loc_empr . '</div><div class="row">&nbsp;</div>';
                if ($f_loc_empr) {
                    $clause .= " AND empr_location='" . $f_loc_empr . "' ";
                }
            }
            //Selecteur de localisation de retrait
            if ($pmb_location_resa_planning) {
                $aff_final .= '<div class="row"><div class="colonne10">' . $msg['resa_planning_loc_retrait'] . '</div>';
                $aff_final .= '<div class="colonne_suite">' . $sel_loc_ret . '</div></div><div class="row">&nbsp;</div>';
                if ($f_loc_ret) {
                    $clause .= " AND resa_loc_retrait='" . $f_loc_ret . "' ";
                }
            }
            break;
        case LECTEUR_INFO_GESTION:
            $aff_final .= "<form class='form-" . $current_module . "' name='check_resa_planning' action='' method='post' >";
            $clause .= " AND resa_remaining_qty!=0 ";
            break;
        case NO_INFO_GESTION:
        default:
            $clause .= " AND resa_remaining_qty!=0 ";
            break;
    }
    if (!$order) {
        $order = "empr_nom, empr_prenom, tit, resa_idnotice, resa_date ";
    }
    $nb_prev = 0;
    $q = "select id_resa, resa_idnotice, resa_idbulletin, resa_date, resa_date_debut, resa_date_fin, resa_validee, resa_confirmee, resa_idempr, resa_qty, resa_loc_retrait, ";
    $q .= "trim(concat(if(series_m.serie_name <>'', if(notices_m.tnvol <>'', concat(series_m.serie_name,', ',notices_m.tnvol,'. '), concat(series_m.serie_name,'. ')), if(notices_m.tnvol <>'', concat(notices_m.tnvol,'. '),'')), if(series_s.serie_name <>'', if(notices_s.tnvol <>'', concat(series_s.serie_name,', ',notices_s.tnvol,'. '), series_s.serie_name), if(notices_s.tnvol <>'', concat(notices_s.tnvol,'. '),'')), ifnull(notices_m.tit1,''),ifnull(notices_s.tit1,''),' ',ifnull(bulletin_numero,''), if (mention_date, concat(' (',mention_date,')') ,''))) as tit, ";
    $q .= "concat(empr_nom,', ',empr_prenom) as empr_nom_prenom, id_empr, empr_cb, empr_location, ";
    $q .= "if(resa_date_fin>=sysdate() or resa_date_fin='0000-00-00',0,1) as perimee, ";
    $q .= "date_format(resa_date_debut, '" . $msg['format_date'] . "') as aff_resa_date_debut, ";
    $q .= "if(resa_date_fin='0000-00-00', '', date_format(resa_date_fin, '" . $msg['format_date'] . "')) as aff_resa_date_fin, ";
    $q .= "date_format(resa_date, '" . $msg['format_date'] . "') as aff_resa_date, ";
    $q .= "ifnull(notices_m.typdoc,notices_s.typdoc) as typdoc ";
    $q .= "FROM resa_planning ";
    $q .= "LEFT JOIN notices as notices_m on resa_idnotice = notices_m.notice_id ";
    $q .= "LEFT JOIN series as series_m on notices_m.tparent_id = series_m.serie_id ";
    $q .= "LEFT JOIN bulletins on resa_idbulletin = bulletins.bulletin_id ";
    $q .= "LEFT JOIN notices as notices_s on bulletin_notice = notices_s.notice_id ";
    $q .= "LEFT JOIN series as series_s on notices_s.tparent_id = series_s.serie_id, ";
    $q .= "empr ";
    $q .= "WHERE resa_idempr = id_empr ";
    if ($clause) {
        $q .= $clause;
    }
    if ($idnotice) {
        $q .= "and notices_m.notice_id = '" . $idnotice . "' ";
    }
    if ($idbulletin) {
        $q .= "and bulletin_id = '" . $idbulletin . "' ";
    }
    if ($idempr) {
        $q .= "and id_empr = '" . $idempr . "' ";
    }
    $q .= "order by " . $order;
    $r = pmb_mysql_query($q, $dbh) or die("Erreur SQL !={$q}");
    $nb_prev = pmb_mysql_num_rows($r);
    if (!$nb_prev) {
        switch ($info_gestion) {
            case GESTION_INFO_GESTION:
                $aff_final .= "</form>";
                break;
        }
        return $aff_final;
    }
    //Entete Tableau
    $aff_final .= "\t<script type='text/javascript' src='./javascript/sorttable.js'></script>\n\t\t\t\t<table width='100%' class='sortable'>\n\t\t\t\t\t<tr>";
    switch ($info_gestion) {
        case GESTION_INFO_GESTION:
        case EDIT_INFO_GESTION:
            $aff_final .= '<th>' . htmlentities($msg['233'], ENT_QUOTES, $charset) . '</th>
				<th>' . htmlentities($msg['empr_nom_prenom'], ENT_QUOTES, $charset) . '</th>
				' . ($pmb_lecteurs_localises ? '<th>' . htmlentities($msg['resa_planning_loc_empr'], ENT_QUOTES, $charset) . '</th>' : '');
            break;
        case LECTEUR_INFO_GESTION:
            $aff_final .= '<th>' . htmlentities($msg['233'], ENT_QUOTES, $charset) . '</th>';
            break;
        case NO_INFO_GESTION:
        default:
            $aff_final .= '<th>' . htmlentities($msg['empr_nom_prenom'], ENT_QUOTES, $charset) . '</th>
				' . ($pmb_lecteurs_localises ? '<th>' . htmlentities($msg['resa_planning_loc_empr'], ENT_QUOTES, $charset) . '</th>' : '');
            break;
    }
    $aff_final .= '<th>' . htmlentities($msg['374'], ENT_QUOTES, $charset) . '</th>
		<th>' . htmlentities($msg['resa_planning_date_debut'], ENT_QUOTES, $charset) . '</th>
		<th>' . htmlentities($msg['resa_planning_date_fin'], ENT_QUOTES, $charset) . '</th>';
    switch ($info_gestion) {
        case GESTION_INFO_GESTION:
            $aff_final .= '<th class="sorttable_nosort">' . htmlentities($msg['resa_planning_tab_qty'], ENT_QUOTES, $charset) . '</th>
 				<th class="sorttable_nosort">' . htmlentities($msg['resa_validee'], ENT_QUOTES, $charset) . '</th>
				<th class="sorttable_nosort">' . htmlentities($msg['resa_confirmee'], ENT_QUOTES, $charset) . '</th>';
            if ($pmb_location_resa_planning == '1') {
                $aff_final .= '<th>' . $msg['resa_planning_loc_retrait'] . '</th>';
            }
            $aff_final .= '<th class="sorttable_nosort">' . htmlentities($msg['resa_selectionner'], ENT_QUOTES, $charset) . '</th>';
            break;
        case EDIT_INFO_GESTION:
            $aff_final .= '<th class="sorttable_nosort">' . htmlentities($msg['resa_planning_tab_qty'], ENT_QUOTES, $charset) . '</th>
 				<th class="sorttable_nosort">' . htmlentities($msg['resa_validee'], ENT_QUOTES, $charset) . '</th>
				<th class="sorttable_nosort">' . htmlentities($msg['resa_confirmee'], ENT_QUOTES, $charset) . '</th>';
            if ($pmb_location_resa_planning == '1') {
                $aff_final .= '<th>' . $msg['resa_planning_loc_retrait'] . '</th>';
            }
            break;
        case LECTEUR_INFO_GESTION:
            $aff_final .= '<th class="sorttable_nosort">' . htmlentities($msg['resa_planning_tab_qty'], ENT_QUOTES, $charset) . '</th>
 				<th class="sorttable_nosort">' . htmlentities($msg['resa_validee'], ENT_QUOTES, $charset) . '</th>
				<th class="sorttable_nosort">' . htmlentities($msg['resa_confirmee'], ENT_QUOTES, $charset) . '</th>';
            if ($pmb_location_resa_planning == '1') {
                $aff_final .= '<th>' . $msg['resa_planning_loc_retrait'] . '</th>';
            }
            $aff_final .= '<th class="sorttable_nosort">' . $msg["resa_suppr_th"] . '</th>';
            break;
        case NO_INFO_GESTION:
        default:
            break;
    }
    $aff_final .= '</tr>';
    $odd_even = 0;
    //Contenu tableau
    while ($data = pmb_mysql_fetch_object($r)) {
        if ($odd_even == 0) {
            $aff_final .= "<tr class='odd' onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='odd'\">";
            $odd_even = 1;
        } else {
            if ($odd_even == 1) {
                $aff_final .= "<tr class='even' onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='even'\">";
                $odd_even = 0;
            }
        }
        $link = '';
        $type_doc_aff = "alt='" . htmlentities($tdoc->table[$data->typdoc], ENT_QUOTES, $charset) . "' title='" . htmlentities($tdoc->table[$data->typdoc], ENT_QUOTES, $charset) . "' ";
        switch ($info_gestion) {
            case GESTION_INFO_GESTION:
            case EDIT_INFO_GESTION:
                //Titre document
                if (SESSrights & CATALOGAGE_AUTH) {
                    if ($data->resa_idnotice) {
                        $link = "<a href='./catalog.php?categ=isbd&id=" . $data->resa_idnotice . "' {$type_doc_aff}>" . htmlentities($data->tit, ENT_QUOTES, $charset) . '</a>';
                    } else {
                        if ($data->resa_idbulletin) {
                            $link = "<a href='./catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=" . $data->resa_idbulletin . "' {$type_doc_aff}>" . htmlentities($data->tit, ENT_QUOTES, $charset) . "</a>";
                        } else {
                            $link = htmlentities($data->tit, ENT_QUOTES, $charset);
                        }
                    }
                } else {
                    $link = htmlentities($data->tit, ENT_QUOTES, $charset);
                }
                $aff_final .= '<td><b>' . $link . '</b></td>';
                //Nom lecteur
                if (SESSrights & CIRCULATION_AUTH) {
                    $aff_final .= "<td><a href=\"./circ.php?categ=pret&form_cb=" . rawurlencode($data->empr_cb) . "\">" . htmlentities($data->empr_nom_prenom, ENT_QUOTES, $charset) . "</a></td>";
                } else {
                    $aff_final .= '<td>' . htmlentities($data->empr_nom_prenom, ENT_QUOTES, $charset) . '</td>';
                }
                //Localisation lecteur
                if ($pmb_lecteurs_localises) {
                    $aff_final .= '<td>' . $tab_loc_empr[$data->empr_location] . '</td>';
                }
                break;
            case LECTEUR_INFO_GESTION:
                //Titre document
                if (SESSrights & CATALOGAGE_AUTH) {
                    if ($data->resa_idnotice) {
                        $link = "<a href='./catalog.php?categ=isbd&id=" . $data->resa_idnotice . "' {$type_doc_aff}>" . htmlentities($data->tit, ENT_QUOTES, $charset) . "</a>";
                    } else {
                        if ($data->resa_idbulletin) {
                            $link = "<a href='./catalog.php?categ=serials&sub=bulletinage&action=view&bul_id=" . $data->resa_idbulletin . "' {$type_doc_aff}>" . htmlentities($data->tit, ENT_QUOTES, $charset) . "</a>";
                        } else {
                            $link = htmlentities($data->tit, ENT_QUOTES, $charset);
                        }
                    }
                } else {
                    $link = htmlentities($data->tit, ENT_QUOTES, $charset);
                }
                $aff_final .= '<td><b>' . $link . '</b></td>';
                break;
            case NO_INFO_GESTION:
            default:
                //Nom lecteur
                if (SESSrights & CIRCULATION_AUTH) {
                    $aff_final .= "<td><a href=\"./circ.php?categ=pret&form_cb=" . rawurlencode($data->empr_cb) . "\">" . htmlentities($data->empr_nom_prenom, ENT_QUOTES, $charset) . "</a></td>";
                } else {
                    $aff_final .= '<td>' . htmlentities($data->empr_nom_prenom, ENT_QUOTES, $charset) . '</td>';
                }
                //Localisation lecteur
                if ($pmb_lecteurs_localises) {
                    $aff_final .= '<td>' . $tab_loc_empr[$data->idlocation] . '</td>';
                }
                break;
        }
        //Date prevision
        $aff_final .= '<td style="text-align:center;">' . $data->aff_resa_date . '</td>';
        switch ($info_gestion) {
            case GESTION_INFO_GESTION:
            case LECTEUR_INFO_GESTION:
                //id emprunteur
                $aff_final .= "<input type='hidden' id='id_empr[" . $data->id_resa . "]' name='id_empr[" . $data->id_resa . "]' value='" . $data->id_empr . "' />";
                //Date debut/fin prevision
                if ($data->resa_validee) {
                    $aff_final .= "<td class='sorttable_mmdd' style='text-align:center;'>" . $data->aff_resa_date_debut . '</td>';
                    $aff_final .= "<td class='sorttable_mmdd' style='text-align:center;'>" . $data->aff_resa_date_fin . " </td>";
                    $aff_final .= "<td style='text-align:center;'>" . $data->resa_qty . '</td>';
                    $aff_final .= "<td style='text-align:center;'><strong>X</strong></td>";
                } else {
                    $aff_final .= "<td style='text-align:center;'>";
                    $aff_final .= "<input type='hidden' id='resa_date_debut[" . $data->id_resa . "]' name='resa_date_debut[" . $data->id_resa . "]' value='" . $data->aff_resa_date_debut . "' />";
                    $resa_date_debut = str_replace("-", "", $data->resa_date_debut);
                    $aff_final .= "<input type='hidden' id='form_resa_date_debut_" . $data->id_resa . "' name='form_resa_date_debut_" . $data->id_resa . "' value='" . $resa_date_debut . "' />";
                    $aff_final .= "<input type='button' class='bouton' sorttable_customkey='" . $data->aff_resa_date_debut . "' onclick=\"openPopUp('./select.php?what=calendrier&caller=check_resa_planning&date_caller=" . $resa_date_debut . "&param1=form_resa_date_debut_" . $data->id_resa . "&param2=form_resa_date_debut_lib_" . $data->id_resa . "&auto_submit=NO&date_anterieure=YES&func_to_call=func_callback&id=" . $data->id_resa . "&sub_param1=1', 'resa_date_debut', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes'); \" value='" . $data->aff_resa_date_debut . "' name='form_resa_date_debut_lib_" . $data->id_resa . "'>";
                    $aff_final .= '</td>';
                    $aff_final .= "<td style='text-align:center;'>";
                    $aff_final .= "<input type='hidden' id='resa_date_fin[" . $data->id_resa . "]' name='resa_date_fin[" . $data->id_resa . "]' value='" . $data->aff_resa_date_fin . "' />";
                    $resa_date_fin = str_replace("-", "", $data->resa_date_fin);
                    $aff_final .= "<input type='hidden' id='form_resa_date_fin_" . $data->id_resa . "' name='form_resa_date_fin_" . $data->id_resa . "' value='" . $resa_date_fin . "' />";
                    $aff_final .= "<input type='button' class='bouton' sorttable_customkey='" . $data->aff_resa_date_fin . "' onclick=\"openPopUp('./select.php?what=calendrier&caller=check_resa_planning&date_caller=" . $resa_date_fin . "&param1=form_resa_date_fin_" . $data->id_resa . "&param2=form_resa_date_fin_lib_" . $data->id_resa . "&auto_submit=NO&date_anterieure=YES&func_to_call=func_callback&id=" . $data->id_resa . "&sub_param1=2', 'resa_date_fin', 250, 300, -2, -2, 'toolbar=no, dependent=yes, resizable=yes')\" value='" . $data->aff_resa_date_fin . "' name='form_resa_date_fin_lib_" . $data->id_resa . "'>";
                    $aff_final .= '</td>';
                    $aff_final .= "<td style='text-align:center;'>" . $data->resa_qty . '</td>';
                    $aff_final .= '<td></td>';
                }
                //Resa confirmee
                if ($data->resa_confirmee) {
                    $aff_final .= "<td style='text-align:center;'><strong>X</strong></td>";
                } else {
                    $aff_final .= '<td></td>';
                }
                //Localisation retrait
                if ($pmb_location_resa_planning == "1") {
                    $aff_final .= '<td>' . $tab_loc_ret[$data->resa_loc_retrait] . '</td>';
                }
                break;
            case EDIT_INFO_GESTION:
                $aff_final .= "<td class='sorttable_mmdd' style='text-align:center;'>" . $data->aff_resa_date_debut . '</td>';
                $aff_final .= "<td class='sorttable_mmdd' style='text-align:center;'>" . $data->aff_resa_date_fin . " </td>";
                $aff_final .= "<td style='text-align:center;'>" . $data->resa_qty . '</td>';
                if ($data->resa_validee) {
                    $aff_final .= "<td style='text-align:center;'><strong>X</strong></td>";
                } else {
                    $aff_final .= '<td></td>';
                }
                if ($data->resa_confirmee) {
                    $aff_final .= "<td style='text-align:center;'><strong>X</strong></td>";
                } else {
                    $aff_final .= '<td></td>';
                }
                //Localisation retrait
                if ($pmb_location_resa_planning == '1') {
                    $aff_final .= '<td>' . $tab_loc_ret[$data->resa_loc_retrait] . '</td>';
                }
                break;
            case NO_INFO_GESTION:
            default:
                $aff_final .= "<td style='text-align:center;'>" . $data->aff_resa_date_debut . '</td>';
                $aff_final .= "<td style='text-align:center;'>" . $data->aff_resa_date_fin . " </td>";
                break;
        }
        switch ($info_gestion) {
            case GESTION_INFO_GESTION:
                $aff_final .= "\n<td style='text-align:center;'><input type='checkbox' id='resa_check[" . $data->id_resa . "]' name='resa_check[]' value='" . $data->id_resa . "' /></td>";
                break;
            case LECTEUR_INFO_GESTION:
                $aff_final .= "\n<td style='text-align:center;'><input type='button' id='resa_supp' name='resa_supp' class='bouton' value='X' onclick=\"document.location='./circ.php?categ=pret&sub=suppr_resa_planning_from_fiche&action=suppr_resa&id_resa=" . $data->id_resa . "&id_empr=" . $idempr . "';\" /></td>";
                break;
            case EDIT_INFO_GESTION:
                break;
            case NO_INFO_GESTION:
            default:
                break;
        }
        $aff_final .= "</tr>";
    }
    $aff_final .= "</table>";
    $aff_final .= "<div class='row'></div>";
    //Affichage boutons
    switch ($info_gestion) {
        case GESTION_INFO_GESTION:
            $aff_final .= "\t<div class='right'>\n\t\t\t\t\t\t<input type='button' id='bt_chk' class='bouton' value='" . $msg['resa_tout_cocher'] . "' onClick=\"checkAll('check_resa_planning', 'resa_check', check); return false;\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='row'>&nbsp;</div>\n\t\t\t\t\t<div class='left' >\n\t\t\t\t\t\t<input type='button' class='bouton' value='" . $msg['resa_planning_bt_val'] . "' onclick=\"this.form.resa_action.value='val_resa'; this.form.submit();\"/>&nbsp;\n\t\t\t\t\t\t<input type='button' class='bouton' value='" . $msg['resa_planning_bt_raz_val'] . "' onclick=\"this.form.resa_action.value='raz_val_resa'; this.form.submit();\"/>&nbsp;\n\t\t\t\t\t\t<input type='button' class='bouton' value='" . $msg['resa_planning_bt_conf'] . "' onclick=\"this.form.resa_action.value='conf_resa'; this.form.submit();\"/>&nbsp;\n\t\t\t\t\t\t<input type='button' class='bouton' value='" . $msg['resa_planning_bt_raz_conf'] . "' onclick=\"this.form.resa_action.value='raz_conf_resa'; this.form.submit();\"/>&nbsp;\n\t\t\t\t\t\t<input type='button' class='bouton' value='" . $msg['resa_planning_bt_to_resa'] . "' onclick=\"this.form.resa_action.value='to_resa'; this.form.submit();\"/>&nbsp;\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<div class='right' >\n\t\t\t\t\t\t<input type='button' class='bouton' value='" . $msg['resa_valider_suppression'] . "'  onclick=\"this.form.resa_action.value='suppr_resa'; this.form.submit();\" />\n\t\t\t\t\t</div>\n\t\t\t\t\t<div class='row'></div>\n\t\t\t\t</form>";
            $aff_final .= "\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\tvar check = true;\n\n\t\t\t\t\t//Coche et décoche les éléments de la liste\n\t\t\t\t\tfunction checkAll(the_form, the_objet, do_check) {\n\n\t\t\t\t\t\tvar elts = document.forms[the_form].elements[the_objet+'[]'] ;\n\t\t\t\t\t\tvar elts_cnt  = (typeof(elts.length) != 'undefined')\n\t\t\t\t\t              ? elts.length\n\t\t\t\t\t              : 0;\n\n\t\t\t\t\t\tif (elts_cnt) {\n\t\t\t\t\t\t\tfor (var i = 0; i < elts_cnt; i++) {\n\t\t\t\t\t\t\t\telts[i].checked = do_check;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\telts.checked = do_check;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (check == true) {\n\t\t\t\t\t\t\tcheck = false;\n\t\t\t\t\t\t\tdocument.getElementById('bt_chk').value = '" . $msg['acquisition_sug_uncheckAll'] . "';\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcheck = true;\n\t\t\t\t\t\t\tdocument.getElementById('bt_chk').value = '" . $msg['acquisition_sug_checkAll'] . "';\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\n\t\t\t\t</script>";
            break;
        case LECTEUR_INFO_GESTION:
            break;
        case EDIT_INFO_GESTION:
            $aff_final .= '</form>';
            break;
        case NO_INFO_GESTION:
        default:
            break;
    }
    return $aff_final;
}
Example #3
0
 /**
  * Fetches the next result
  * @return array
  */
 public function fetch()
 {
     if ($row = pmb_mysql_fetch_array($this->query)) {
         return $row;
     } else {
         if ($this->size() > 0) {
             pmb_mysql_data_seek($this->query, 0);
             return false;
         } else {
             return false;
         }
     }
 }
Example #4
0
             if ($empr_location_id != 0) {
                 $restrict_localisation = " AND empr_location='{$empr_location_id}' ";
             } else {
                 $restrict_localisation = "";
             }
         }
         $requete = "SELECT id_empr FROM empr where empr_date_expiration >= now() {$restrict_localisation}";
         $res_rqt = pmb_mysql_query($requete);
         foreach ($caddie as $id_caddie => $coche) {
             if ($coche) {
                 $myCart = new empr_caddie($id_caddie);
                 while ($r = pmb_mysql_fetch_object($res_rqt)) {
                     $myCart->add_item($r->id_empr);
                 }
                 // fin while
                 pmb_mysql_data_seek($res_rqt, 0);
             }
         }
         print "<script type='text/javascript'>window.close();</script>";
     } else {
         // 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) {
         aff_paniers_empr(0, "./cart.php?object_type={$object_type}&sub_action=add&empr_location_id={$empr_location_id}", "add_empr_encours", $msg["caddie_add_emprs"], "", 0, 0, 0);
     }
     break;
 default:
     //		print "<h1>".$msg["fonct_no_accessible"]."</h1>";
     if ($object_type == "GROUP") {
         aff_paniers_empr($item, "./cart.php?object_type=GROUP", "add_item", $msg["caddie_add_GROUP"], "", 0, 0, 1);
     } else {
         aff_paniers_empr($item, "./cart.php?object_type=EMPR", "add_item", $msg["caddie_add_EMPR"], "", 0, 0, 1);
     }
Example #5
0
 function executeProc($procedure, $idProc, $tparams)
 {
     global $msg, $dbh, $charset, $PMBuserid;
     global $pmb_procedure_server_credentials, $pmb_procedure_server_address;
     if (SESSrights & ADMINISTRATION_AUTH) {
         $name = '';
         $report = '';
         if ($tparams['envt']) {
             foreach ($tparams['envt'] as $aparam => $vparam) {
                 global ${$aparam};
                 ${$aparam} = $vparam;
             }
         }
         switch ($procedure) {
             case INTERNAL:
                 $hp = new parameters($idProc, 'procs');
                 $hp->get_final_query();
                 $code_sql = $hp->final_query;
                 $autorisations = $hp->proc->autorisations;
                 break;
             case EXTERNAL:
                 $pmb_procedure_server_credentials_exploded = explode("\n", $pmb_procedure_server_credentials);
                 if ($pmb_procedure_server_address && count($pmb_procedure_server_credentials_exploded) == 2) {
                     $aremote_procedure_client = new remote_procedure_client($pmb_procedure_server_address, trim($pmb_procedure_server_credentials_exploded[0]), trim($pmb_procedure_server_credentials_exploded[1]));
                     $procedure = $aremote_procedure_client->get_proc($idProc, "AP");
                     $the_procedure = $procedure['procedure'];
                     if ($procedure['error_message']) {
                         $report = htmlentities($msg['remote_procedures_error_server'], ENT_QUOTES, $charset) . ':<br /><i>' . $procedure['error_message'] . '</i>';
                         $result = array('name' => $the_procedure->name, 'report' => $report);
                         return $result;
                     } else {
                         if ($the_procedure->params && $the_procedure->params != 'NULL') {
                             $sql = 'CREATE TEMPORARY TABLE remote_proc LIKE procs';
                             pmb_mysql_query($sql, $dbh) or die(pmb_mysql_error());
                             $sql = "INSERT INTO remote_proc (idproc, name, requete, comment, autorisations, parameters, num_classement) VALUES (0, '" . pmb_mysql_escape_string($the_procedure->name) . "', '" . pmb_mysql_escape_string($the_procedure->sql) . "', '" . pmb_mysql_escape_string($the_procedure->comment) . "', '', '" . pmb_mysql_escape_string($the_procedure->params) . "', 0)";
                             pmb_mysql_query($sql, $dbh) or die(pmb_mysql_error());
                             $idproc = pmb_mysql_insert_id($dbh);
                             $hp = new parameters($idproc, 'remote_proc');
                             $hp->get_final_query();
                             $the_procedure->sql = $hp->final_query;
                             $name = $the_procedure->name;
                             $code_sql = $the_procedure->sql;
                             $commentaire = $the_procedure->comment;
                         }
                     }
                 }
                 break;
         }
         $linetemp = explode(';', $code_sql);
         if ($autorisations) {
             $temp_autorisation = explode(' ', $autorisations);
         }
         $allow = false;
         if ($temp_autorisation) {
             foreach ($temp_autorisation as $userid) {
                 if ($userid == $PMBuserid) {
                     $allow = true;
                 }
             }
             if (!$allow) {
                 $report = $msg[11];
                 //					throw new Exception($message, $code);
                 $result = array('name' => $name, 'report' => $report);
                 return $result;
             }
         }
         $line = array();
         for ($i = 0; $i < count($linetemp); $i++) {
             if (trim($linetemp[$i])) {
                 $line[] = trim($linetemp[$i]);
             }
         }
         while (list($cle, $valeur) = each($line)) {
             if ($valeur) {
                 $report .= "<strong>" . $msg['procs_ligne'] . " {$cle} </strong>:&nbsp;{$valeur}<br /><br />";
                 $er = explain_requete($valeur);
                 if ($er) {
                     $res = @pmb_mysql_query($valeur, $dbh);
                     $report .= pmb_mysql_error();
                     $nbr_lignes = @pmb_mysql_num_rows($res);
                     $nbr_champs = @pmb_mysql_num_fields($res);
                     if ($nbr_lignes) {
                         $report .= "<table >";
                         for ($i = 0; $i < $nbr_champs; $i++) {
                             $fieldname = pmb_mysql_field_name($res, $i);
                             $report .= "<th>{$fieldname}</th>";
                         }
                         for ($i = 0; $i < $nbr_lignes; $i++) {
                             $row = pmb_mysql_fetch_row($res);
                             $report .= "<tr>";
                             foreach ($row as $dummykey => $col) {
                                 if (trim($col) == '') {
                                     $col = '&nbsp;';
                                 }
                                 $report .= '<td >' . $col . '</td>';
                             }
                             $report .= "</tr>";
                         }
                         $report .= "</table><hr />";
                         $report .= "<font color='#ff0000'>" . $msg['admin_misc_lignes'] . " " . pmb_mysql_affected_rows($dbh) . "</font>";
                     } else {
                         $report .= "<br /><font color='#ff0000'>" . $msg['admin_misc_lignes'] . " " . pmb_mysql_affected_rows($dbh);
                         $err = pmb_mysql_error($dbh);
                         if ($err) {
                             $report .= "<br />{$err}";
                         }
                         $report .= "</font><hr />";
                     }
                 } else {
                     // erreur explain_requete
                     $report .= $valeur . "<br /><br />" . $msg['proc_param_explain_failed'] . "<br /><br />" . $erreur_explain_rqt;
                 }
             }
         }
         // fin while
         //Export CSV sur le resultat de la derniere requete
         if ($er && $nbr_lignes && $tparams['tocsv']['checked'] == '1' && $tparams['tocsv']['filepath']) {
             if (!$tparams['tocsv']['sep']) {
                 $tparams['tocsv']['sep'] = ',';
             }
             $trow = array();
             if ($tparams['tocsv']['enclosure']) {
                 for ($i = 0; $i < $nbr_champs; $i++) {
                     $trow[] = addcslashes(pmb_mysql_field_name($res, $i), $tparams['tocsv']['enclosure']);
                 }
                 $row = $tparams['tocsv']['enclosure'] . implode($tparams['tocsv']['enclosure'] . $tparams['tocsv']['sep'] . $tparams['tocsv']['enclosure'], $trow) . $tparams['tocsv']['enclosure'] . "\r\n";
             } else {
                 $row = implode($tparams['tocsv']['sep'], $trow) . "\r\n";
             }
             file_put_contents($tparams['tocsv']['filepath'], $row);
             pmb_mysql_data_seek($res, 0);
             for ($i = 0; $i < $nbr_lignes; $i++) {
                 $trow = pmb_mysql_fetch_row($res);
                 if ($tparams['tocsv']['enclosure']) {
                     foreach ($trow as $k => $v) {
                         $trow[$k] = addcslashes($v, $tparams['tocsv']['enclosure']);
                     }
                     $row = $tparams['tocsv']['enclosure'] . implode($tparams['tocsv']['enclosure'] . $tparams['tocsv']['sep'] . $tparams['tocsv']['enclosure'], $trow) . $tparams['tocsv']['enclosure'] . "\r\n";
                 } else {
                     $row = implode($tparams['tocsv']['sep'], $trow) . "\r\n";
                 }
                 file_put_contents($tparams['tocsv']['filepath'], $row, FILE_APPEND);
             }
         }
         $result = array('name' => $name, 'report' => $report);
         return $result;
     }
     return array();
 }
Example #6
0
function show_res_prf_list($id, $maj = false)
{
    global $dbh, $msg, $charset;
    global $dom;
    global $res_prf_list_form, $used_list_form, $maj_form;
    $form = $res_prf_list_form;
    $form = str_replace('!!form_title!!', htmlentities($dom->getComment('res_prf_lib'), ENT_QUOTES, $charset), $form);
    //affichage lien roles utilisateurs
    $txt = htmlentities($dom->getComment('user_prf_lib'), ENT_QUOTES, $charset);
    $row = "<tr style=\"cursor: pointer;\" onmousedown=\"document.location='./admin.php?categ=acces&sub=user_prf&action=list&id={$id}';\" ";
    $row .= "onmouseout=\"this.className='even'\" onmouseover=\"this.className='surbrillance'\" class=\"even\"><td><strong>{$txt}</strong></td></tr>";
    //affichage lien profils ressources
    $txt = htmlentities($dom->getComment('res_prf_lib'), ENT_QUOTES, $charset);
    $row .= "<tr style=\"cursor: pointer;\" onmousedown=\"document.location='./admin.php?categ=acces&sub=res_prf&action=list&id={$id}';\" ";
    $row .= "onmouseout=\"this.className='odd'\" onmouseover=\"this.className='surbrillance'\" class=\"odd\"><td><strong>{$txt}</strong></td></tr>";
    $form = str_replace('<!-- rows -->', $row, $form);
    $t = $dom->getResourceProperties();
    if (count($t)) {
        $p_form = "";
        foreach ($t as $k => $v) {
            $p_form .= "<div class='row'>";
            $p_form .= "<input type='checkbox' id='chk_prop[{$k}]' name='chk_prop[]' value='" . $k . "' />";
            $p_form .= "&nbsp;<label class='etiquette' for='chk_prop[{$k}]'>" . htmlentities($v['lib'], ENT_QUOTES, $charset) . "</label>";
            $p_form .= "</div>";
        }
        $form = str_replace('<!-- properties -->', $p_form, $form);
    }
    $rows = "<tr><th>" . htmlentities($msg['dom_prf_name'], ENT_QUOTES, $charset) . "</th><th>" . htmlentities($msg['dom_prf_use'], ENT_QUOTES, $charset) . "</th><th>" . htmlentities($msg['dom_prf_rule'], ENT_QUOTES, $charset) . "</th></tr>";
    $parity = 1;
    $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='odd'\" ";
    $rows .= "<tr class='odd' " . $tr_javascript . ">";
    $rows .= "<td>" . htmlentities($dom->getComment('res_prf_def_lib'), ENT_QUOTES, $charset) . "</td>";
    $rows .= "<td></td>";
    $rows .= "<td></td>";
    $rows .= "</tr>";
    $q = $dom->loadResourceProfiles();
    $r = pmb_mysql_query($q, $dbh);
    if (pmb_mysql_num_rows($r)) {
        //generation selecteur
        $selector = "<select name='!!sel_name!!' id='!!sel_name!!'>";
        $selector .= "<option value=\"0\" >" . htmlentities($dom->getComment('res_prf_def_lib'), ENT_QUOTES, $charset) . "</option>";
        while ($row = pmb_mysql_fetch_object($r)) {
            $selector .= "<option value=\"" . $row->prf_id . "\" >";
            $selector .= htmlentities($row->prf_name, ENT_QUOTES, $charset) . "</option>";
        }
        $selector .= "</select>";
        $selector .= "<script type=\"text/javascript\">!!sel_script!!</script>";
        pmb_mysql_data_seek($r, 0);
        while ($row = pmb_mysql_fetch_object($r)) {
            if ($parity % 2) {
                $pair_impair = 'even';
            } else {
                $pair_impair = 'odd';
            }
            $parity += 1;
            $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='" . $pair_impair . "'\" ";
            $rows .= "<tr class='" . $pair_impair . "' " . $tr_javascript . ">";
            $rows .= "<td><input type='text' class='in_cell' id='prf_lib[" . $row->prf_id . "]' name='prf_lib[" . $row->prf_id . "]' value='" . htmlentities($row->prf_name, ENT_QUOTES, $charset) . "' /></td>";
            $rows .= "<td>";
            $rows .= $selector;
            $rows = str_replace('!!sel_name!!', "prf_used[" . $row->prf_id . "]", $rows);
            $rows = str_replace('!!sel_script!!', "document.getElementById(\"prf_used[" . $row->prf_id . "]\").value=\"" . $row->prf_used . "\";", $rows);
            $rows .= "</td>";
            $rows .= "<td>";
            $rows .= nl2br(htmlentities($row->prf_hrule, ENT_QUOTES, $charset));
            $rows .= "<input type=hidden id='prf_hrule[" . $row->prf_id . "]' name='prf_hrule[" . $row->prf_id . "]' value='" . $row->prf_hrule . "' />";
            $rows .= "</td>";
            $rows .= "<input type='hidden' id='prf_id[" . $row->prf_id . "]' name='prf_id[" . $row->prf_id . "]' value='" . $row->prf_id . "' />";
            $rows .= "<input type='hidden' id='prf_rule[" . $row->prf_id . "]' name='prf_rule[" . $row->prf_id . "]' value='" . $row->prf_rule . "' />";
            $rows .= "</tr>";
        }
    }
    $used_list_form = str_replace('!!used_list_lib!!', htmlentities($dom->getComment('res_prf_used_list_lib'), ENT_QUOTES, $charset), $used_list_form);
    $used_list_form = str_replace('<!-- used_profiles -->', $rows, $used_list_form);
    $form = str_replace('<!-- used_list_form -->', $used_list_form, $form);
    $bt_calc = "<input type='button' onclick=\"\n\t\tthis.form.action='./admin.php?categ=acces&sub=res_prf&action=calc&id={$id}'; \n\t\tthis.form.submit();return false;\" \n\t\tvalue=\"" . $dom->getComment('res_prf_bt_calc') . "\" class='bouton' />";
    $form = str_replace('<!-- bt_calc -->', $bt_calc, $form);
    $bt_enr = "<input type='button' onclick=\"\n\t\tthis.form.action='./admin.php?categ=acces&sub=res_prf&action=update&id={$id}'; \n\t\tthis.form.submit();return false;\" \n\t\tvalue=\"" . addslashes($msg['77']) . "\" class='bouton' />";
    $form = str_replace('<!-- bt_enr -->', $bt_enr, $form);
    $bt_sup = "<input type='button' onclick=\"\n\t\tdocument.location='./admin.php?categ=acces&sub=res_prf&action=delete&id={$id}';return false;\" \n\t\tvalue=\"" . addslashes($msg['63']) . "\" class='bouton' />";
    $form = str_replace('<!-- bt_sup -->', $bt_sup, $form);
    if ($maj) {
        $form = str_replace('<!-- maj -->', $maj_form, $form);
    }
    print $form;
}