public function action_search()
 {
     $urlparams = array('search' => optional_param('search', null, PARAM_TEXT), 'group' => optional_param('group', 0, PARAM_INT), 'page' => optional_param('page', 1, PARAM_INT), 'role' => optional_param('role', 0, PARAM_INT), 'type' => optional_param('type', base::TYPE_ALL, PARAM_INT));
     if (optional_param('resetbutton', 0, PARAM_ALPHA)) {
         redirect(new \moodle_url('/mod/mediagallery/view.php', array('action' => 'search', 'id' => $this->cm->id)));
     }
     $params = array_merge($urlparams, array('collection' => $this->collection, 'courseid' => $this->course->id, 'context' => $this->context));
     $search = new search($params);
     $results = $search->get_results();
     if (optional_param('exportbutton', 0, PARAM_ALPHA)) {
         return $search->download_csv();
     }
     $form = new form\search(null, array('context' => $this->context, 'collection' => $this->collection), 'post', '', array('id' => 'searchform'));
     $pageurl = new \moodle_url('/mod/mediagallery/search.php', $urlparams);
     $perpage = 0;
     $totalcount = 0;
     $renderable = new output\searchresults\renderable($results, $pageurl, $totalcount, $params['page'], $perpage);
     return $this->renderer->search_page($form, $renderable);
 }
Exemple #2
0
switch ($sub) {
    case "launch":
        if ((string) $page == "") {
            $_SESSION["CURRENT"] = count($_SESSION["session_history"]);
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["URI"] = "./catalog.php?categ=search&mode=8";
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["POST"] = $_POST;
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["GET"] = $_GET;
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["GET"]["sub"] = "";
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["POST"]["sub"] = "";
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["HUMAN_QUERY"] = $sc->make_human_query();
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["HUMAN_TITLE"] = $msg["search_exemplaire"];
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["SEARCH_TYPE"] = "EXPL";
            $_POST["page"] = 0;
            $page = 0;
        }
        $table = $sc->get_results("./catalog.php?categ=search&mode=8&sub=launch", "./catalog.php?categ=search&mode=8&option_show_notice_fille={$option_show_notice_fille}&option_show_expl={$option_show_expl}", true);
        print_results($sc, $table, "./catalog.php?categ=search&mode=8&sub=launch&option_show_notice_fille={$option_show_notice_fille}&option_show_expl={$option_show_expl}", "./catalog.php?categ=search&mode=8&option_show_notice_fille={$option_show_notice_fille}&option_show_expl={$option_show_expl}", true);
        if ($_SESSION["CURRENT"] !== false) {
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["URI"] = "./catalog.php?categ=search&mode=8";
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["POST"] = $_POST;
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["GET"] = $_GET;
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["PAGE"] = $page + 1;
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["HUMAN_QUERY"] = $sc->make_human_query();
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["SEARCH_TYPE"] = "expl";
            $_SESSION["session_history"][$_SESSION["CURRENT"]]["EXPL"]["TEXT_QUERY"] = "";
        }
        break;
    default:
        print $sc->show_form("./catalog.php?categ=search&mode=8&option_show_notice_fille={$option_show_notice_fille}&option_show_expl={$option_show_expl}", "./catalog.php?categ=search&mode=8&sub=launch");
        break;
}
Exemple #3
0
     $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["POST"]["sub"] = "";
     $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["HUMAN_QUERY"] = $sc->make_human_query();
     $_SESSION["session_history"][$_SESSION["CURRENT"]]["QUERY"]["HUMAN_TITLE"] = $msg["search_emprunteur"];
     $_POST["page"] = 0;
     $page = 0;
 }
 if ($_SESSION["CURRENT"] !== false) {
     $_SESSION["session_history"][$_SESSION["CURRENT"]]["EMPR"]["URI"] = "./circ.php?categ=search&sub=launch";
     $_SESSION["session_history"][$_SESSION["CURRENT"]]["EMPR"]["POST"] = $_POST;
     $_SESSION["session_history"][$_SESSION["CURRENT"]]["EMPR"]["GET"] = $_GET;
     $_SESSION["session_history"][$_SESSION["CURRENT"]]["EMPR"]["PAGE"] = $page + 1;
     $_SESSION["session_history"][$_SESSION["CURRENT"]]["EMPR"]["HUMAN_QUERY"] = $sc->make_human_query();
     $_SESSION["session_history"][$_SESSION["CURRENT"]]["EMPR"]["SEARCH_TYPE"] = "empr";
     $_SESSION["session_history"][$_SESSION["CURRENT"]]["EMPR"]["TEXT_QUERY"] = "";
 }
 $table = $sc->get_results("./circ.php?categ=search&sub=launch", "./circ.php?categ=search", true);
 $sc->link = './circ.php?categ=empr_saisie&id=!!id!!';
 $url = "./circ.php?categ=search&sub=launch";
 $url_to_search_form = "./circ.php?categ=search";
 $search_target = "";
 if (!$page) {
     $page = 1;
 }
 $debut = ($page - 1) * $nb_per_page;
 $requete = "select count(1) from {$table}";
 $res = mysql_query($requete);
 if ($res) {
     $nbr_lignes = mysql_result($res, 0, 0);
 } else {
     $nbr_lignes = 0;
 }