C4::Koha - Perl Module containing convenience functions for Koha scripts
use C4::Koha;
Koha.pm provides many functions for Koha scripts.
$categories = GetItemTypesCategorized();
Returns a hashref containing search categories. A search category will be put in the hash if at least one of its itemtypes is visible in OPAC. The categories must be part of Authorized Values (ITEMTYPECAT)
my $directory = getitemtypeimagedir( 'opac' );
pass in 'opac' or 'intranet'. Defaults to 'opac'.
returns the full path to the appropriate directory containing images.
Find all of the image files in a directory in the filesystem
parameters: a directory name
returns: a list of images in that directory.
Notes: this does not traverse into subdirectories. See _getSubdirectoryNames for help with that. Images are assumed to be files with .gif or .png file extensions. The image names returned do not have the directory name on them.
Find all of the directories in a directory in the filesystem
parameters: a directory name
returns: a list of subdirectories in that directory.
Notes: this does not traverse into subdirectories. Only the first level of subdirectories are returned. The directory names returned don't have the parent directory name on them.
returns: a listref of hashrefs. Each hash represents another collection of images.
{ imagesetname => 'npl', # the name of the image set (npl is the original one) images => listref of image hashrefs }
each image is represented by a hashref like this:
{ KohaImage => 'npl/image.gif', StaffImageUrl => '/intranet-tmpl/prog/img/itemtypeimg/npl/image.gif', OpacImageURL => '/opac-tmpl/prog/itemtypeimg/npl/image.gif' checked => 0 or 1: was this the image passed to this method? Note: I'd like to remove this somehow. }
Returns the number of pages to display in a pagination bar, given the number of items and the number of items per page.
(@themes) = &getallthemes('opac'); (@themes) = &getallthemes('intranet');
Returns an array of all available themes.
$authvalues = GetAuthorisedValues([$category]);
This function returns all authorised values from the'authorised_value' table in a reference to array of hashrefs.
$category
returns authorised values for just one category (optional).
$opac
If set to a true value, displays OPAC descriptions rather than normal ones when they exist.
my $escaped_string = C4::Koha::xml_escape($string);
Convert &, <, >, ', and " in a string to XML entities
my $display_form = C4::Koha::display_marc_indicators($field);
$field
is a MARC::Field object
Generate a display form of the indicators of a variable MARC field, replacing any blanks with '#'.
my $isbns = NormalizeISBN({ isbn => $isbn, strip_hyphens => [0,1], format => ['ISBN-10', 'ISBN-13'] }); Returns an isbn validated by Business::ISBN. Optionally strips hyphens and/or forces the isbn to be of the specified format. If the string cannot be validated as an isbn, it returns nothing unless return_invalid param is passed. #FIXME This routine (and others?) should be moved to Koha::Util::Normalize
my @isbns = GetVariationsOfISBN( $isbn ); Returns a list of variations of the given isbn in both ISBN-10 and ISBN-13 formats, with and without hyphens. In a scalar context, the isbns are returned as a string delimited by ' | '.
my @isbns = GetVariationsOfISBNs( @isbns ); Returns a list of variations of the given isbns in both ISBN-10 and ISBN-13 formats, with and without hyphens. In a scalar context, the isbns are returned as a string delimited by ' | '.
my $issns = NormalizedISSN({ issn => $issn, strip_hyphen => [0,1] }); Returns an issn validated by Business::ISSN. Optionally strips hyphen. If the string cannot be validated as an issn, it returns nothing.
my @issns = GetVariationsOfISSN( $issn ); Returns a list of variations of the given issn in with and without a hyphen. In a scalar context, the issns are returned as a string delimited by ' | '.
my @issns = GetVariationsOfISSNs( @issns ); Returns a list of variations of the given issns in with and without a hyphen. In a scalar context, the issns are returned as a string delimited by ' | '.
Koha Team