Exemplo n.º 1
0
        $p_perso = new parametres_perso($prefix, "./fichier.php?categ=gerer&mode=champs", $option_visibilite);
        $p_perso->proceed();
        break;
    case 'reindex':
        $fiche = new fiche();
        switch ($act) {
            case 'run':
                $fiche->reindex_all();
                break;
            default:
                $fiche->show_reindex_form();
                break;
        }
        break;
    case 'display':
        $fiche = new fiche();
        switch ($sub) {
            case 'position':
                $fichier_menu_display = str_replace("!!menu_sous_rub!!", htmlentities($msg['fichier_display_position'], ENT_QUOTES, $charset), $fichier_menu_display);
                print $fichier_menu_display;
                break;
            case 'list':
                $fiche->show_search_list($act, "./fichier.php?categ=consult&mode=search&perso_word={$perso_word}", $page);
                break;
            default:
                $fichier_menu_display = str_replace("!!menu_sous_rub!!", "", $fichier_menu_display);
                print $fichier_menu_display;
                break;
        }
        break;
}
Exemplo n.º 2
0
 function show_results_fichier($url, $url_to_search_form, $hidden_form = true, $search_target = "", $acces = false)
 {
     global $dbh;
     global $begin_result_liste;
     global $nb_per_page_search;
     global $page, $dest;
     global $charset;
     global $search;
     global $msg;
     global $pmb_nb_max_tri;
     global $affich_tris_result_liste;
     global $pmb_allow_external_search;
     global $debug;
     global $gestion_acces_active, $gestion_acces_user_notice, $PMBuserid, $pmb_allow_external_search;
     global $link_bulletin;
     $start_page = $nb_per_page_search * $page;
     //Y-a-t-il des champs ?
     if (count($search) == 0) {
         error_message_history($msg["search_empty_field"], $msg["search_no_fields"], 1);
         exit;
     }
     //Verification des champs vides
     for ($i = 0; $i < count($search); $i++) {
         $op = "op_" . $i . "_" . $search[$i];
         global ${$op};
         $field_ = "field_" . $i . "_" . $search[$i];
         global ${$field_};
         $field = ${$field_};
         $s = explode("_", $search[$i]);
         $bool = false;
         if ($s[0] == "f") {
             $champ = $this->fixedfields[$s[1]]["TITLE"];
             if ((string) $field[0] == "") {
                 $bool = true;
             }
         } elseif (array_key_exists($s[0], $this->pp)) {
             $champ = $this->pp[$s[0]]->t_fields[$s[1]]["TITRE"];
             if ((string) $field[0] == "") {
                 $bool = true;
             }
         } elseif ($s[0] == "s") {
             $champ = $this->specialfields[$s[1]]["TITLE"];
             $type = $this->specialfields[$s[1]]["TYPE"];
             for ($is = 0; $is < count($this->tableau_speciaux["TYPE"]); $is++) {
                 if ($this->tableau_speciaux["TYPE"][$is]["NAME"] == $type) {
                     $sf = $this->specialfields[$s[1]];
                     global $include_path;
                     require_once $include_path . "/search_queries/specials/" . $this->tableau_speciaux["TYPE"][$is]["PATH"] . "/search.class.php";
                     $specialclass = new $this->tableau_speciaux["TYPE"][$is]["CLASS"]($s[1], $sf, $i, $this);
                     $bool = $specialclass->is_empty($field);
                     break;
                 }
             }
         }
         if ($bool && !$this->op_empty[${$op}]) {
             error_message_history($msg["search_empty_field"], sprintf($msg["search_empty_error_message"], $champ), 1);
             exit;
         }
     }
     $table = $this->make_search();
     if ($acces == true && $gestion_acces_active == 1 && $gestion_acces_user_notice == 1) {
         $this->filter_searchtable_from_accessrights($table, $PMBuserid);
     }
     $requete = "select count(1) from {$table}";
     $nb_results = pmb_mysql_result(pmb_mysql_query($requete), 0, 0);
     //Y-a-t-il une erreur lors de la recherche ?
     if ($this->error_message) {
         error_message_history("", $this->error_message, 1);
         exit;
     }
     if (!$dest && $hidden_form) {
         print $this->make_hidden_search_form($url, "search_form", "", false);
         print "<input type='hidden' name='dest' value='' />\n";
         print "</form>\n";
     }
     if ($dest != "TABLEAU") {
         $human_requete = $this->make_human_query();
         print "<strong>" . $msg["search_search_extended"] . "</strong> : " . $human_requete;
         if ($debug) {
             print "<br />" . $this->serialize_search();
         }
         if ($nb_results) {
             print " => " . $nb_results . " " . $msg["fiche_found"] . "<br />\n";
         } else {
             print "<br />" . $msg["1915"] . " ";
         }
     }
     $requete = "select {$table}.* from " . $table . ",fiche where fiche.id_fiche={$table}.id_fiche";
     if (!$dest) {
         $requete .= " limit " . $start_page . "," . $nb_per_page_search;
     }
     $resultat = pmb_mysql_query($requete, $dbh);
     if (pmb_mysql_num_rows($resultat)) {
         $result_fic = array();
         $fic = new fiche();
         while ($r = pmb_mysql_fetch_object($resultat)) {
             $result_fic[$r->id_fiche] = $fic->get_values($r->id_fiche, 1);
         }
         if ($result_fic) {
             if ($dest == "TABLEAUHTML") {
                 print "<div class='row'>" . $fic->display_results_tableau($result_fic, "", 0, true) . "</div>";
             } elseif ($dest == "TABLEAU") {
                 $fic->print_results_tableau($result_fic);
             } else {
                 print "<div class='row'>" . $fic->display_results_tableau($result_fic) . "</div>";
             }
         }
     }
     if ($this->limited_search) {
         $limit_script = "&limited_search=1";
     } else {
         $limit_script = "";
     }
     if (!$dest) {
         print "<div class='row'><input type='button' class='bouton' onClick=\"document.search_form.dest.value=''; document.search_form.action='{$url_to_search_form}{$limit_script}'; document.search_form.target='{$search_target}'; document.search_form.submit(); return false;\" value=\"" . $msg["search_back"] . "\"/>";
         print "<font size='4'>&nbsp;&nbsp;&nbsp;&nbsp;</font>\n\t\t\t<input type='image' src='./images/tableur.gif' border='0' onClick=\"document.search_form.dest.value='TABLEAU'; document.search_form.submit(); \" alt='" . htmlentities($msg["fiche_export_excel"], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg["fiche_export_excel"], ENT_QUOTES, $charset) . "' />\n\t\t\t<font size='4'>&nbsp;&nbsp;&nbsp;&nbsp;</font>\n\t\t\t<input type='image' src='./images/tableur_html.gif' border='0' onClick=\"document.search_form.dest.value='TABLEAUHTML'; document.search_form.submit(); \" alt='" . htmlentities($msg["fiche_export_tableau"], ENT_QUOTES, $charset) . "' title='" . htmlentities($msg["fiche_export_tableau"], ENT_QUOTES, $charset) . "' /></div>";
     }
     //Gestion de la pagination
     if ($nb_results && !$dest) {
         $n_max_page = ceil($nb_results / $nb_per_page_search);
         if (!$page) {
             $page_en_cours = 0;
         } else {
             $page_en_cours = $page;
         }
         // affichage du lien precedent si necessaire
         if ($page > 0) {
             $nav_bar .= "<a href='#' onClick='document.search_form.dest.value=\"\"; document.search_form.page.value-=1; ";
             if (!$hidden_form) {
                 $nav_bar .= "document.search_form.launch_search.value=1; ";
             }
             $nav_bar .= "document.search_form.submit(); return false;'>";
             $nav_bar .= "<img src='./images/left.gif' border='0'  title='" . $msg[48] . "' alt='[" . $msg[48] . "]' hspace='3' align='middle'/>";
             $nav_bar .= "</a>";
         }
         $deb = $page_en_cours - 10;
         if ($deb < 0) {
             $deb = 0;
         }
         for ($i = $deb; $i < $n_max_page && $i < $page_en_cours + 10; $i++) {
             if ($i == $page_en_cours) {
                 $nav_bar .= "<strong>" . ($i + 1) . "</strong>";
             } else {
                 $nav_bar .= "<a href='#' onClick=\"if ((isNaN(document.search_form.page.value))||(document.search_form.page.value=='')) document.search_form.page.value=1; else document.search_form.page.value=" . $i . "; ";
                 if (!$hidden_form) {
                     $nav_bar .= "document.search_form.launch_search.value=1; ";
                 }
                 $nav_bar .= "document.search_form.dest.value=''; document.search_form.submit(); return false;\">";
                 $nav_bar .= $i + 1;
                 $nav_bar .= "</a>";
             }
             if ($i < $n_max_page) {
                 $nav_bar .= " ";
             }
         }
         if ($page + 1 < $n_max_page) {
             $nav_bar .= "<a href='#' onClick=\"if ((isNaN(document.search_form.page.value))||(document.search_form.page.value=='')) document.search_form.page.value=1; else document.search_form.page.value=parseInt(document.search_form.page.value)+parseInt(1); ";
             if (!$hidden_form) {
                 $nav_bar .= "document.search_form.launch_search.value=1; ";
             }
             $nav_bar .= "document.search_form.dest.value=''; document.search_form.submit(); return false;\">";
             $nav_bar .= "<img src='./images/right.gif' border='0' title='" . $msg[49] . "' alt='[" . $msg[49] . "]' hspace='3' align='middle'>";
             $nav_bar .= "</a>";
         } else {
             $nav_bar .= "";
         }
         $nav_bar = "<div align='center'>{$nav_bar}</div>";
         echo $nav_bar;
     }
 }
Exemplo n.º 3
0
 function remove()
 {
     if ($this->id >= 500000) {
         throw new Exception(_('Catégorie verrouillée '));
     }
     $remain = 0;
     /* get all the card */
     $aFiche = fiche::get_fiche_def($this->cn, $this->id);
     if ($aFiche != null) {
         /* check if the card is used */
         foreach ($aFiche as $dfiche) {
             $fiche = new Fiche($this->cn, $dfiche['f_id']);
             /* if the card is not used then remove it otherwise increment remains */
             if ($fiche->is_used() == false) {
                 $fiche->delete();
             } else {
                 $remain++;
             }
         }
     }
     /* if remains == 0 then remove cat */
     if ($remain == 0) {
         $sql = 'delete from jnt_fic_attr where fd_id=$1';
         $this->cn->exec_sql($sql, array($this->id));
         $sql = 'delete from fiche_def where fd_id=$1';
         $this->cn->exec_sql($sql, array($this->id));
     }
     return $remain;
 }
Exemplo n.º 4
0
function update_notice($idfiche)
{
    $fic = new fiche($idfiche);
    ajax_http_send_response($fic->show_edit_form());
}
Exemplo n.º 5
0
<?php

// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: fichier_saisie.inc.php,v 1.3 2012-02-09 12:47:51 dbellamy Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/fiche.class.php";
$fiche = new fiche($idfiche);
switch ($act) {
    case 'save_and_new':
        $p_perso = new parametres_perso('gestfic0');
        $nberrors = $p_perso->check_submited_fields();
        if ($nberrors) {
            error_message_history($msg['notice_champs_perso'], $p_perso->error_message, 1);
        } else {
            $fiche->save();
            print $fiche->show_edit_form();
        }
        break;
    case 'update':
        $p_perso = new parametres_perso('gestfic0');
        $nberrors = $p_perso->check_submited_fields();
        if ($nberrors) {
            error_message_history($msg['notice_champs_perso'], $p_perso->error_message, 1);
        } else {
            $fiche->save();
        }
        break;
Exemplo n.º 6
0
 function get_by_category($p_offset = -1, $p_search = "", $p_order = '')
 {
     return fiche::GetByDef($this->fiche_def_ref, $p_offset, $p_search, $p_order);
 }
Exemplo n.º 7
0
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: fichier_consult.inc.php,v 1.4 2012-02-09 12:47:51 dbellamy Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . "/search.class.php";
require_once $class_path . "/parametres_perso.class.php";
require_once $class_path . "/fiche.class.php";
$sc = new search(false, "search_fields", $include_path . "/fichier/");
$sc->isfichier = true;
switch ($mode) {
    case 'search':
        $fiche = new fiche($idfiche);
        $sc->limited_search = true;
        switch ($sub) {
            case 'view':
                print $fiche->show_fiche_form();
                break;
            case 'edit':
                print $fiche->show_edit_form();
                break;
            case 'update':
                $fiche->save();
                print $fiche->show_fiche_form();
                break;
            case 'del':
                $fiche->delete();
                $fiche->show_search_list($act, "./fichier.php?categ=consult&mode=search&perso_word=" . rawurlencode(stripslashes($perso_word)), $page);