Koha::Plugins::Base - Base Module for plugins
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 allows a plugin to read the values that were previously saved with store_data
usage: my $value = $self->retrieve_data( $key );
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:
The name of the plugin class.
Then name of the plugin method used. For example 'tool' or 'report'.
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.
The absolute pathname to the plugin directory. Necessary to include other templates from a template with the [% INCLUDE %] directive.
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' );
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();
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 is a quick redirect to the Koha plugins home page
$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
my $bundle_path = $self->bundle_path
Returns the directory in which bundled files are.
$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
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"; }
Method that returns wether the plugin is enabled or not
$plugin->enable
Method for enabling plugin
$plugin->enable
Method for disabling plugin
$plugin->disable
Kyle M Hall <kyle.m.hall@gmail.com>