Zur Navigation | Zum Inhalt
Version 6.4 Released
See the changelog for details of this new release.
FVCML0208 10
Function Reference PDF Print E-mail

There is a growing list of functions that are available for use within plugins. These provide hooks into existing RocketDMS code and functionality and can be used within any of your plugins.

 

plugin::add_pick_list($code,$list)    [OBSOLETE, USE plugin::return_pick_list() instead]

Create a pick list. This will be a 1-tiered combo with all items listed.

Creates and populates a pick-list for use in document tags. This function will do the same thing that you can do via the Config program, Settings tab, Document tags sub-tab.


$code = String, Pick list code.

$list = Array, pick list contents :

$list = array();
foreach ( [some loop condition] ) {
$list[] = array(
'value'=>[value to store in document tag],
'label'=>[value to display in pick list]
);
}

 


plugin::add_pick_list_grouped($code,$list)  [OBSOLETE, USE plugin::return_pick_list() instead]

Create a grouped pick list. This will be a 2-tiered combo with all items grouped by the first character of the label.

Creates and populates a pick-list for use in document tags. This function will do the same thing that you can do via the Config program, Settings tab, Document tags sub-tab.

$code = String, Pick list code.

$list = Array, pick list contents :

$list = array();
foreach ( [some loop condition] ) {
$list[] = array(
'value'=>[value to store in document tag],
'label'=>[value to display in pick list]
);
}

 


plugin::alert($msg)

Message popup on the screen. User clicks OK to close the dialogue and continue.

 


plugin::choose_file($caption,$path,$filter)

File open dialogue. Returns empty string on cancel.

Returns: String or FALSE if cancelled.

 


plugin::clear_pick_list($code)

Clears the contents from a pick list of the given $code.

 


plugin::debug()

Displays debug information. Helpful for testing and development of plugins but should be removed or commented out when not being used. Also triggered by the Debug checkbox on the settings tab of the plugin workbench.

 


plugin::err($msg)

Creates a modal error message popup on the screen. User clicks OK to close the dialogue and continue.

 


plugin::explorer($file (optional))

Open a Windows explorer. If file specified then opens with that file selected.

 


plugin::file_list($path)

List of files in given path/folder.

Returns: Array

 


plugin::folder_add($docstore_path,$folder)

Add a new folder to the document store.

$docstore_path = String, Full path to an existing folder in the document store. Starts with forward slash, all forward slashes. eg. /Pikaia/Invoices

$folder = String, Name of folder to add under the given $docstore_path.

 


plugin::form($form_title, $fields, $field_size, $defaults, $comment,$types)

Design and present a pop-up form to get input from the user. Returns an array of entered data. Very handy!

$form_title = String, Title displayed in pop-up for window title bar.

$fields = Array of strings listing all of the form field labels. The array order sets the order of the form fields.

$field_size = Array of integers listing the size of each entry field.

$defaults = (optional) Array of mixed default values for each form field.

$types = (optional) Array of string giving the data type of each field. Can be on of 'string', 'password', 'checkbox'. Defaults to string.

$comment = (optional) String of text to display on the form.

Returns: Array of FALSE if cancelled

 Example:

$title = 'Credit while attending outside training/meeting.';

$comment = "\n\nThis form is good for one class, one day, one time frame.\n
You will get credit for all training and incidents within the time frame you specified
for that given day.\n\nA separate form will be requird for multiples times in one-day
or multiple days in a month.\n\n";

$fields = array(
'Date of Attendance',
'Time of Attendance (from)',
'Time of Attendance (to)',
'Type of Event',
'Location',
'Reason',
'Name'
);

$size = array(80, 80, 80, 400, 400, 400, 400);
$defaults = array('','','','','','','');
$types = array('string','string','string','string','string','string','string');

// Repeat until user cancels or we have validated input
while (TRUE) {

    // Form displayed
    $data = plugin::form($title, $fields, $size, $defaults,$comment,$types);

    // Returns FALSE if cancelled
    if ( $data === FALSE ) {
        // exit
        return;
    }

    // Validate returned data
    $date = $data[0];
    $time_from = $data[1];
    $time_to = $data[2];
    $type = $data[3];
    $location = $data[4];
    $reason = $data[5];
    $name = $data[6];
    
    // Set defaults to what was entered by the user.
//Ensures data that they entered is re-displyed for editing.
    $defaults = $data;
    
    if ( $date == '' ) {
        // Error message popup
        plugin::err('Date required');
        // Try again        
        continue;
    }

    // If we get to here then data is valid, break out of the loop
    break;

}
 

plugin::ini_read($var)

Arbitrary settings or values that can be saved and read locally on user pc. Used to save individual user settings.

Returns: Mixed


plugin::ini_write($var,$val)

Arbitrary settings or values that can be saved and read locally on user pc. Used to save individual user settings.

 


plugin::message($msg)

Creates a modal message popup on the screen. User clicks OK to close the dialogue and continue.

 


plugin::return_pick_list($list)

Create a pick list. This will be a 1-tiered combo with all items listed.

Creates and populates a pick-list for use in document tags.

To use this feature:

  1. Save/Edit a copy of the plugin using the Plugin Workbench. On the Settings tab ensure that 'Run for pick lists' is checked.
  2. Take a note of the plugin name.
  3. Open the Configuration Program, Settings Tab, Document Tags sub-tab.
  4. Select or add a document tag that will be a pick list.
  5. In the Pick List frame select the 'Plugin' radio button.
  6. Select this plugin in the 'Plugin Name' combo.
  7. Save.

You have now linked the plugin to that document tag. Whenever anyone edits the contents of that tag this plugin will be
called to generate a pick list of options that the user can choose from.

$list = Array, pick list contents.

Example:

$list = array();
foreach ( [some loop condition] ) {
$list[] = array(
'value'=>[value to store in document tag],
'label'=>[value to display in pick list]
);
}

 


plugin::set_order($list,$headings,$title,$win_name)

Pop-up dialogue to display a list of items and let the user manually sort the list into any order.

$list = Array of arrays . List of rows to sort. Each row may have multiple columns.

$headings = (optional) Array of strings used as column headings. 

$title = (optional) String for pop-up dialogue window title.

$win_name = (optional) String used internally as an identifier for the pop-up. Used to save and restore pop-up window size and position.

Returns: Array or FALSE if cancelled.

Example:

$headings = array('Value','Size','Code');      // Defines number of columns
$list = array();
$list[] =  array('A',345,'c1');
$list[] =  array('B',2,'c99');
$list[] =  array('C',99,'c1');
$list[] =  array('D',99,'c1');
$list[] =  array('E',99,'c1');
$list[] =  array('F',99,'c1');
$list[] =  array('G',99,'c1');
$ordered_list = plugin::set_order($list,$headings,'Sort those arrays');

 


plugin::set_statusbar($msg)

Place the $msg string into the main program status bar.

 

plugin::setting_read($var)

Arbitrary settings or values that can be saved and read across all users and plugins. Can be used as a way of sending data between plugins. See also ini_read.

Returns: Mixed

 


plugin::setting_write($var,$val)

Arbitrary settings or values that can be saved and read across all users and plugins. Can be used as a way of sending data between plugins. See also ini_read.

 


plugin::start_wait($cmd,$params)

Shell command and wait for completion.

$cmd = String command to run.

$params = (optional) String command line parameters.

 


plugin::start_no_wait($cmd,$params)

Shell command in background. Continue without waiting for completion.

$cmd = String command to run.

$params = (optional) String command line parameters.

 


plugin::string($title,$label,$prompt,$default,$err_msg,$width)

Get a string input from the user.

Returns: String

 


plugin::yes_no($question,$caption)

Ask user a Yes/No question. Returns TRUE/FALSE..

Returns: TRUE|FALSE

 


 

Last Updated on Thursday, 26 July 2012 20:21