<<

NAME

C4::Search::History - Manage search history

DESCRIPTION

This module provides some routines for the search history management. It deals with session or database.

ROUTINES

add

    C4::Search::History::add({
        userid => $userid,
        sessionid => $cgi->cookie("CGIESSID"),
        query_desc => $query_desc,
        query_cgi => $query_cgi,
        total => $total,
        type => $type,
    });

type is "biblio" or "authority".

Add a new search to the user's history.

add_to_session

    my $value = C4::Search::History::add_to_session({
        cgi => $cgi,
        query_desc => $query_desc,
        query_cgi => $query_cgi,
        total => $total,
        type => $type,
    });

Add a search to the session. The number of searches to keep is hardcoded to 15.

delete

    C4::Search::History::delete({
        userid => $loggedinuser,
        sessionid => $sessionid,
        type => $type,
        previous => $previous
    });

Delete searches in the database. If the sessionid is missing all searches for all sessions will be deleted. It is possible to delete searches for current session or all previous sessions using the previous flag. If the type ("biblio" or "authority") is missing, all type will be deleted. To delete *all* searches for a given userid, just pass a userid.

get

    my $searches C4::Search::History::get({
        userid => $userid,
        sessionsid => $sessionid,
        type => $type,
        previous => $previous
    });

Return a list of searches for a given userid. If a sessionid is given, searches are limited to the matching session. type and previous follow the same behavior as the delete routine.

get_from_session

    my $searches = C4::Search::History::get_from_session({
        cgi => $cgi
    });

Return all searches present for the given session.

set_to_session

    C4::Search::History::set_to_session({
        cgi => $cgi,
        search_history => $search_history
    });

Store searches into the session.

AUTHORS

Jonathan Druart <jonathan.druart@biblibre.com>

LICENSE

This file is part of Koha.

Copyright 2013 BibLibre SARL

Koha is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.

Koha is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with Koha; if not, see <http://www.gnu.org/licenses>.

<<