<<

NAME

Koha::Plugins::Base - Base Module for plugins

store_data

store_data allows a plugin to store key value pairs in the database for future use.

usage: $self->store_data({ param1 => 'param1val', param2 => 'param2value' })

retrieve_data

retrieve_data allows a plugin to read the values that were previously saved with store_data

usage: my $value = $self->retrieve_data( $key );

get_template

get_template returns a Template object. Eventually this will probably be calling C4:Template, but at the moment, it does not.

The returned template contains 3 variables that can be used in the plugin templates:

CLASS

The name of the plugin class.

METHOD

Then name of the plugin method used. For example 'tool' or 'report'.

PLUGIN_PATH

The URL path to the plugin. It can be used in templates in order to localize ressources like images in html tags, or other templates.

PLUGIN_DIR

The absolute pathname to the plugin directory. Necessary to include other templates from a template with the [% INCLUDE %] directive.

get_qualified_table_name

To avoid naming conflict, each plugins tables should use a fully qualified namespace. To avoid hardcoding and make plugins more flexible, this method will return the proper fully qualified table name.

usage: my $table = $self->get_qualified_table_name( 'myTable' );

get_plugin_http_path

To access a plugin's own resources ( images, js files, css files, etc... ) a plugin will need to know what path to use in the template files. This method returns that path.

usage: my $path = $self->get_plugin_http_path();

get_plugin_dir

To [% INCLUDE %] another TT template from a template, an absolute path to the template is required. This method returns that absolute file system path.

usage: my $path = $self->get_plugin_dir();

go_home

   go_home is a quick redirect to the Koha plugins home page

output_html

    $self->output_html( $data, $status, $extra_options );

Outputs $data setting the right headers for HTML content.

Note: this is a wrapper function for C4::Output::output_with_http_headers

output

   $self->output( $data, $content_type[, $status[, $extra_options]]);

Outputs $data with the appropriate HTTP headers, the authentication cookie and a Content-Type specified in $content_type.

$content_type is one of the following: 'html', 'js', 'json', 'xml', 'rss', or 'atom'.

$status is an HTTP status message, like '403 Authentication Required'. It defaults to '200 OK'.

$extra_options is hashref. If the key 'force_no_caching' is present and has a true value, the HTTP headers include directives to force there to be no caching whatsoever.

Note: this is a wrapper function for C4::Output::output_with_http_headers

_version_compare

Utility method to compare two version numbers. Returns 1 if the first argument is the higher version Returns -1 if the first argument is the lower version Returns 0 if both versions are equal

if ( _version_compare( '2.6.26', '2.6.0' ) == 1 ) { print "2.6.26 is greater than 2.6.0\n"; }

enable

Method for enabling plugin

$plugin->enable

disable

Method for disabling plugin

$plugin->disable

AUTHOR

Kyle M Hall <kyle.m.hall@gmail.com>

<<