Danio Library
From PikaDocs
This is my attempt to keep some practical notes on the use of the Danio library in Pika and contrast it with other Pika libraries.
Danio is the current Pika library file to use for reports, possibly other functions although I'm not sure. The previous library seems to have been code named Gila.
If you are like me, you write new reports or new functionality in Pika by starting from something already written. In my case, most of what I started with was using Gila library files, so many of the custom reports I've written are still using those old libraries. At some point I think we can assume Pika Software will get rid of or stop supporting the old library files and we will need to have everything using Danio. So this page is to help understand how to do things in Danio.
Reports using the Danio library probably begin with something like this:
chdir('../../');
require_once('pika-danio.php');
pika-danio.php is found in the root directory of your Pika install. In turn, it calls app/lib/pl.php Some of the helpful functions there include:
function pl_date_unmogrify($date) - replaces the old pl_mogrify_date
function pl_date_unmogrify($date) - replaces the old pl_unmogrify_date
function pl_grab_get($var_name, $default_value = null, $filter_mode='nomode')
function pl_grab_post($var_name, $default_value = null, $filter_mode='nomode')
function pl_html_address($data)
function pl_html_checkbox($name
, $val) - make $val a 1 for the checkbox to be checked
function pl_html_menu($a, $field_name, $field_value, $add_blank='1', $ti='1') - $field_value should be the selected value in the menu
function pl_html_multiselect($a, $field_name, $field_values, $ti='1') - multi-select, not sure how this is generally used
function pl_menu_get($menu_name, $key = null)
function pl_text_address($data) - interesting, not sure how this is used. Appears to be used for putting address, city, state, and zip all together
function pl_time_mogrify($time)
function pl_time_unmogrify($time)
The way to get the base url of the site for constructing links is like this:
$base_url = pl_settings_get('base_url');
Whereas you used to have to do something along the lines of:
$base_url = $plSettings['base_url'];
All pages that use the Danio library should have as the first 2 lines of code:
require_once ('pika-danio.php');
pika_init();
Also they should end with a call to the pika_exit function. Here is an example:
$buffer = pl_template($plTemplate, 'templates/default.html'); pika_exit($buffer);
original entry by Andrew Cameron
Legal Services Lawline of Vermont (http://www.lawlinevt.org/) and Vermont Legal Aid (http://www.vtlegalaid.org/)
December 18, 2006
