Static helper class that provides automatic HTML and JavaScript generation for Indicia online recording website data entry controls.
Examples include auto-complete text boxes that are populated by Indicia species lists, maps for spatial reference selection and date pickers. All controls in this class support the following entries in their $options array parameter:
package | Client |
---|
add_post_to_session()
Call this method when arriving at the second and subsequent pages of a data entry wizard to keep the previous page's data available for saving later.
link | http://code.google.com/p/indicia/wiki/TutorialDataEntryWizard |
---|
add_resource(string $resource)
This is normally called internally by the control methods to ensure the required files are linked into the page so does not need to be called directly. However it can be useful when writing custom code that uses one of these standard libraries such as jQuery. Ensures each file is only linked once.
inherited_from | \helper_base::add_resource() |
---|
string
Name of resource to link. The following options are available:
apply_template(string $template, array $options)
Outputs the prefix template, a label (if in the options), a control, the control's errors and a suffix template.
inherited_from | \helper_base::apply_template() |
---|
string
Name of the control template, from the global $indicia_templates variable.
array
Options array containing the control replacement values for the templates. Options can contain a setting for prefixTemplate or suffixTemplate to override the standard templates.
array_to_query_string(array $array, boolean $encodeValues) : string
This is like http_build_query but it does not url encode the & separator, and gives control over urlencoding the array values.
inherited_from | \helper_base::array_to_query_string() |
---|
array
Associative array to convert.
boolean
Default false. Set to true to URL encode the values being added to the string.
string
The query string.autocomplete(array $options) : string
Because this generates a hidden ID control as well as a text input control, if you are outputting your own HTML label then the label you associate with this control should be of the form "$id:$caption" rather than just the $id which is normal for other controls. For example:
'occurrence:taxa_taxon_list_id',
'table' => 'taxa_taxon_list',
'captionField' => 'taxon',
'valueField' => 'id',
'extraParams' => $readAuth
)); ?>
Of course if you use the built in label option in the options array then this is handled for you. The output of this control can be configured using the following templates:
link | http://code.google.com/p/indicia/wiki/DataModel |
---|
array
Options array with the following possibilities:
string
HTML to insert into the page for the autocomplete control.build_params_form(array $options, boolean $hasVisibleContent)
Returns the HTML required for a parameters form, e.g. the form defined for input of report parameters or the default values for a csv import.
array
Options array with the following possibilities:
<
ul>
boolean
On completion, this is set to true if there are visible controls in the params form. If not, then it may be appropriate to skip the displaying of this params form since it is not necessary.
build_sample_occurrence_submission(array $values)
array
List of the posted values to create the submission from. Each entry's key should be occurrence:fieldname, sample:fieldname, occAttr:n, smpAttr:n, taxAttr:n or psnAttr:n to be correctly identified.
build_sample_occurrences_list_submission(array $values, boolean $include_if_any_data, array $zero_attrs, array $zero_values) : array
array
List of the posted values to create the submission from.
boolean
If true, then any list entry which has any data set will be included in the submission. Set this to true when hiding the select checkbox in the grid.
array
Set to an array of abundance attribute field IDs that can be treated as abundances. Alternatively set to true to treat all occurrence custom attributes as possible zero abundance indicators.
array
Set to an array of values which are considered to indicate a zero abundance record if found for one of the zero_attrs. Values are case-insensitive. Defaults to array('0','None','Absent'). of values that can be treated as meaning a zero abundance record. E.g. array('
array
Sample submission arraybuild_submission(array $values, array $structure)
Does simple submissions that do not involve species checklist grids.
array
List of the posted values to create the submission from.
array
Describes the structure of the submission. The form should be: array( 'model' => 'main model name', 'subModels' => array('child model name' => array( 'fieldPrefix'=>'Optional prefix for HTML form fields in the sub model. If not specified then the sub model name is used.', 'fk' => 'foreign key name', 'image_entity' => 'name of image entity if present' )), 'superModels' => array('child model name' => array( 'fieldPrefix'=>'Optional prefix for HTML form fields in the sub model. If not specified then the sub model name is used.', 'fk' => 'foreign key name', 'image_entity' => 'name of image entity if present' )), 'metaFields' => array('fieldname1', 'fieldname2', ...) )
check_default_value(string $id)
The default value is taken as either the $_POST value for this control, or the first of the remaining arguments which contains a non-empty value.
string
Id of the control to select the default for. $param [string, [string ...]] Variable list of possible default values. The first that is not empty is used.
check_errors(string $fieldname, boolean $plaintext)
inherited_from | \helper_base::check_errors() |
---|
string
Fieldname of the control to retrieve errors for.
boolean
Set to true to return just the error text, otherwise it is wrapped in a span.
check_upload_size(array $file) : bool
File sizes are obtained from the helper_config maxUploadSize, and defined as: SB, where S is the size (1, 15, 300, etc) and B is the byte modifier: (B)ytes, (K)ilobytes, (M)egabytes, (G)igabytes. Eg: to limit the size to 1MB or less, you would use "1M".
array
Item from the $_FILES array.
bool
True if the file size is acceptable, otherwise false.checkbox(array $options) : string
This includes re-loading of existing values and displaying of validation error messages. The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the checkbox control.checkbox_group(array $options) : string
array
Options array with the following possibilities:
The output of this control can be configured using the following templates:
string
HTML to insert into the page for the group of checkboxes.clear_cache()
clear_session()
client_helper_path()
inherited_from | \helper_base::client_helper_path() |
---|
date_picker(array $options) : string
The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the date picker control.dump_errors(string $response, boolean $inline)
see | \global\forward_post_to() |
---|---|
link | http://code.google.com/p/indicia/wiki/TutorialBuildingBasicPage#Build_a_data_entry_page |
string
Return value from a call to forward_post_to().
boolean
Set to true if the errors are to be placed alongside the controls rather than at the top of the page. Default is true.
dump_header(\$resources $resources) : string
The advantage of dump_javascript is that it intelligently builds the required links depending on what is on your form. dump_header is not intelligent because the form is not built yet, but placing links in the header leads to cleaner code which validates better.
inherited_from | \helper_base::dump_header() |
---|
\$resources
List of resources to include in the header. The available options are described in the documentation for the add_resource method. The default for this is jquery_ui and defaultStylesheet.
string
Text to place in the head section of the html file.dump_javascript() : string
Should be called at the end of each HTML page which uses the data entry helper so output all JavaScript required by previous calls.
link | http://code.google.com/p/indicia/wiki/TutorialBuildingBasicPage#Build_a_data_entry_page |
---|---|
inherited_from | \helper_base::dump_javascript() |
string
JavaScript to insert into the page for all the controls added to the page so far.dump_remaining_errors() : string
This is useful when added to the bottom of a form, because occasionally an error can be returned which is not associated with a form control, so calling dump_errors with the inline option set to true will not emit the errors onto the page.
string
HTML block containing the error information, built by concatenating the
validation_message template for each error.enable_tabs(array $options)
The jQuery documentation describes how to specify a list within the div which defines the tabs that are present. This method also automatically selects the first tab that contains validation errors if the form is being reloaded after a validation attempt.
link | http://docs.jquery.com/UI/Tabs |
---|
array
Options array with the following possibilities:
enable_validation(string $form_id)
To specify validation on each control, set the control's options array to contain a 'validation' entry. This must be set to an array of validation rules in Indicia validation format. For example, 'validation' => array('required', 'email').
inherited_from | \helper_base::enable_validation() |
---|
string
@form_id Id of the form the validation is being attached to.
explode_lines(string $value) : array
Tolerates any line ending.
inherited_from | \helper_base::explode_lines() |
---|
string
A multi-line string to be split.
array
An array with one entry per line in $value.explode_lines_key_value_pairs(string $value) : array
Tolerates any line ending.
inherited_from | \helper_base::explode_lines_key_value_pairs() |
---|
string
A multi-line string to be split.
array
An associative array with one entry per line in $value. Array keys are the items before the = on each line,
and values are the data after the = on each line.extract_image_data(array $values, string $modelName, boolean $simpleFileInputs, boolean $moveSimpleFiles)
array
Pass the $_POST data or other array of form values in this parameter.
string
The singular name of the image table, e.g. location_image or occurrence_image etc. If null, then any image model will be used.
boolean
If true, then allows a file input with name=occurrence:image (or similar) to be used to point to an image file. The file is uploaded to the interim image folder to ensure that it can be handled in the same way as a pre-uploaded file.
boolean
If true, then any file uploaded by normal means to the server (via multipart form submission for a field named occurrence:image[:n] or similar) will be moved to the interim image upload folder.
extract_session_array()
file_box(array $options)
The control allows selection of multiple files, and depending on the browser functionality it gives progress feedback. The control uses Google Gears, Flash, Silverlight, Browserplus or HTML5 to enhance the functionality where available. The output of the control can be configured by changing the content of the templates called file_box, file_box_initial_file_info, file_box_uploaded_image and button.
todo | select file button pointer overriden by the flash shim |
---|---|
todo | flickr |
todo | if using a normal file input, after validation, the input needs to show that the file upload has worked. |
todo | Cleanup uploaded files that never got submitted because of validation failure elsewhere. |
array
Options array with the following possibilities:
The output of this control can be configured using the following templates:
forward_post_to(string $entity, array $submission, array $writeTokens)
string
Name of the top level entity being submitted, e.g. sample or occurrence.
array
The wrapped submission structure. If null, then this is automatically constructer from the form data in $_POST.
array
Array containing auth_token and nonce for the write operation, plus optionally persist_auth=true to prevent the authentication tokens from expiring after use. If null then the values are read from $_POST.
georeference_lookup(array $options) : string
The control is automatically linked to any map panel added to the page. The output of this control can be configured using the following templates:
link | Google AJAX Search API Terms of Use. |
---|---|
link | Documentation for the driver architecture. |
array
Options array with the following possibilities:
string
HTML to insert into the page for the georeference lookup control.getAttributes(array $options, \optional $indexedArray, string $sharing) : \Associative
This can be used to auto-generated the forum structure for a survey for example.
array
Options array with the following possibilities:
\optional
boolean $indexedArray default true. Determines whether the return value is an array indexed by PK, or whether it is ordered as it comes from the database (ie block weighting). Needs to be set false if data is to be used by get_attribute_html.
string
Set to verification, peer_review, moderation, data_flow or reporting to indicate the task being performed, if sharing data with other websites. If not set then only data from the current website is available.
\Associative
array of attributes, keyed by the attribute ID (multiValue=false) or getRootFolder()
inherited_from | \helper_base::getRootFolder() |
---|
get_auth(string $website_id, string $password)
inherited_from | \helper_base::get_auth() |
---|
string
Indicia ID for the website.
string
Indicia password for the website.
get_browser_info(\$agent $agent) : array
\$agent
Agent string, optional. If not suplied, then the http user agent is used.
array
Browser information array. Contains name and version elements.get_from_session(string $name, string $default)
link | http://code.google.com/p/indicia/wiki/TutorialDataEntryWizard |
---|
string
Name of the session value to retrieve
string
Default value to return if not set or empty
get_population_data(array $options)
The response will be cached locally unless the caching option is set to false.
array
Options array with the following possibilities:
get_read_auth(string $website_id, string $password)
inherited_from | \helper_base::get_read_auth() |
---|
string
Indicia ID for the website.
string
Indicia password for the website.
get_read_write_auth(string $website_id, string $password) : \Returns
inherited_from | \helper_base::get_read_write_auth() |
---|
string
Indicia ID for the website.
string
Indicia password for the website.
\Returns
an array containing:
'read' => the read authorisation array,
'write' => the write authorisation input controls to insert into your form.
'write_tokens' => the write authorisation array, if needed as separate tokens rather than just placing in form.get_reload_link_parts() : array
inherited_from | \helper_base::get_reload_link_parts() |
---|
array
Associative array containing path and params (itself a key/value paired associative array).get_remembered_fields() : Array
Accessor for the $remembered_fields variable. This is a list of the fields on the form which are to be remembered the next time the form is loaded, e.g. for values that do not change much from record to record. This creates the list on demand, by calling a hook indicia_define_remembered_fields if it exists. indicia_define_remembered_fields should call data_entry_helper::set_remembered_fields to give it an array of field names. Note that this hook architecture is required to allow the list of remembered fields to be made available before the form is constructed, since it is used by the code which saves a submitted form to store the remembered field values in a cookie.
Array
List of the fields to remember.get_report_data(array $options, string $extra)
deprecated | , use report_helper::get_report_data instead. |
---|
array
Refer to documentation for report_helper::get_report_data.
string
Refer to documentation for report_helper::get_report_data.
get_resources()
inherited_from | \helper_base::get_resources() |
---|
get_scripts(string $javascript, string $late_javascript, string $onload_javascript, bool $includeWrapper)
Can optionally include the script tags wrapper around the script generated.
inherited_from | \helper_base::get_scripts() |
---|
string
JavaScript to run when the page is ready, i.e. in $(document).ready.
string
JavaScript to run at the end of $(document).ready.
string
JavaScript to run in the window.onLoad handler which comes later in the page load process.
bool
If true then includes script tags around the script.
get_species_checklist_clonable_row(array $options, array $occAttrControls, array $attributes)
As this happens, a hidden table is used to store a clonable row which provides the template for new rows to be added to the grid.
array
Options array passed to the species grid.
array
List of the occurrence attribute controls, keyed by attribute ID.
array
List of attribute definitions loaded from the database.
get_species_checklist_header(array $options, array $occAttrs) : string
array
Control options array.
array
Array of custom attributes included in the grid.
string
Html for the element.
get_species_lookup_db_definition(boolean $cached)
Used for both species checklist and species autocompletes.
boolean
Set to true to use the cached taxon search tables rather than standard taxa in taxon list views.
get_species_names_filter(array $options)
how it accepts searches for common names and synonyms.
array
Options array as passed to the species grid.
get_termlist_terms(array $auth, mixed $termlist, array $filter) : array
inherited_from | \helper_base::get_termlist_terms() |
---|
array
Read authorisation array.
mixed
Either the id or external_key of the termlist to load.
array
List of the terms that are required, or null for all terms.
array
Output of the Warehouse data services request for the terms.get_uploaded_image_folder()
hidden_text(array $options) : string
This includes re-loading of existing values. Hidden fields should not have any validation. No Labels allowed, no suffix. The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the hidden text control.hierarchical_select(array $options)
array
Options array with the following possibilities:
The output of this control can be configured using the following templates:
http_post(string $url, string $postargs, boolean $output_errors) : array
inherited_from | \helper_base::http_post() |
---|
string
The URL the POST request is sent to.
string
Arguments to include in the POST data.
boolean
Set to false to prevent echoing of errors. Defaults to true.
array
An array with a result element set to true or false for successful or failed posts respectively.
The output is returned in an output element in the array. If there is an error, then an errorno element gives the
cUrl error number (as generated by the cUrl library used for the post).image_upload(array $options) : string
Note that when using this control, it is essential that the form's HTML enctype attribute is set to enctype="multipart/form-data" so that the image file is included in the form data. For multiple image support and more advanced options, see the file_box control. The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the file upload control.link_default_stylesheet()
This gives a basic form layout. This also adds default JavaScript to the page to cause buttons to highlight when you hover the mouse over them.
inherited_from | \helper_base::link_default_stylesheet() |
---|
list_in_template(array $options) : string
As an example, the following outputs an unordered list of surveys:
echo data_entry_helper::list_in_template(array( 'label'=>'template', 'table'=>'survey', 'extraParams' => $readAuth, 'template'=>'
The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the generated list.listbox(array $options) : string
Options can be either populated from a web-service call to the Warehouse, e.g. the contents of a termlist, or can be populated from a fixed supplied array. The list box can be linked to populate itself when an item is selected in another control by specifying the parentControlId and filterField options. The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the listbox control.load_existing_record(array $readAuth, string $entity, integer $id, string $view, boolean $sharing)
Useful when reloading data to edit.
link | https://indicia-docs.readthedocs.org/en/latest/administrating/warehouse/website-agreements.html |
---|
array
Read authorisation tokens
string
Name of the entity to load data from.
integer
ID of the database record to load
string
Name of the view to load attributes from, normally 'list' or 'detail'.
boolean
Defaults to false. If set to the name of a sharing task (reporting, peer_review, verification, data_flow or moderation), then the record can be loaded from another client website if a sharing agreement is in place.
loading_block_end() : string
string
HTML and JavaScript to insert into the page at the start of the block
which is replaced by a loading panel while the page is loading.loading_block_start() : string
Note that hiding the block is achieved by setting it's left to move it off the page, rather than display: none. This is because OpenLayers won't initialise properly on a div that is display none.
Warning. To use this function, always insert a call to dump_header in the
element of your HTML page to ensure that JQuery is loaded first. Otherwise this will not work.string
HTML and JavaScript to insert into the page at the start of the block
which is replaced by a loading panel while the page is loading.location_autocomplete(array $options) : string
Although it is possible to set all the options of a normal autocomplete, generally the table, valueField, captionField, id should be left uninitialised and the fieldname will default to the sample's location_id field so can normally also be left. The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the location select control.location_select(array $options) : string
Although it is possible to set all the options of a normal select control, generally the table, valueField, captionField, id should be left uninitialised and the fieldname will default to the sample's location_id field so can normally also be left. If you need to use a report to populate the list of locations, for example when filtering by a custom attribute, then set the report option to the report name (e.g. library/reports/locations_list) and provide report parameters in extraParams. You can also override the captionField and valueField if required.
array
Options array with the following possibilities:
The output of this control can be configured using the following templates:
string
HTML to insert into the page for the location select control.map(array $options)
This is just a shortcut to building a control using a map_panel and the associated controls.
array
Options array with the following possibilities:
The output of this control can be configured using the following templates:
map_panel(array $options, array $olOptions)
deprecated | Use map_helper::map_panel instead. |
---|
array
Refer to map_helper::map_panel documentation.
array
Refer to map_helper::map_panel documentation.
mergeParamsIntoTemplate(array $params, string $template, boolean $useTemplateAsIs, boolean $allowHtml, boolean $allowEscapeQuotes) : string
This is used to build the output for each item in a list, such as a species checklist grid or a radio group.
inherited_from | \helper_base::mergeParamsIntoTemplate() |
---|
array
Array holding the parameters to merge into the template.
string
Name of the template to use, or actual template text if $useTemplateAsIs is set to true.
boolean
If true then the template parameter contains the actual template text, otherwise it is the name of a template in the $indicia_templates array. Default false.
boolean
If true then HTML is emitted as is from the parameter values inserted into the template, otherwise they are escaped.
boolean
If true then parameter names can be suffixes -esape-quote, -escape-dblquote, -escape-htmlquote or -escape-htmldblquote to insert backslashes or html entities into the replacements for string escaping.
string
HTML for the item labeloutputAttribute(array $item, array $options) : string
todo | full handling of the control_type. Only works for text data at the moment. |
---|
array
Attribute definition as returned by a call to getAttributes. The caption of the attribute will be translated then output as the label.
array
Additional options for the attribute to be output. Array entries can be: disabled suffixTemplate default class validation noBlankText extraParams booleanCtrl - radio or checkbox for boolean attribute output, default is checkbox. Can also be a checkbox_group, used to allow selection of both yes and no, e.g. on a filter form. language - iso 639:3 code for the language to output for terms in a termlist. If not set no language filter is used.
string
HTML to insert into the page for the control.password_input(array $options) : string
For security reasons, this does not re-load existing values or display validation error messages and no default can be set. The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the text input control.postcode_textbox(array $options) : string
The textbox optionally includes hidden fields for the latitude and longitude and can link to an address control for automatic generation of address information. When the focus leaves the textbox, the Google AJAX Search API is used to obtain the latitude and longitude so they can be saved with the record.
The following example displays a postcode box and an address box, which is auto-populated when a postcode is given. The spatial reference controls are "hidden" from the user but are available to post into the database.
'Postcode',
'fieldname'=>'smpAttr:8',
'linkedAddressBoxId'=>'address'
);
echo data_entry_helper::textarea(array(
'label' => 'Address',
'id' => 'address',
'fieldname' => 'smpAttr:9'
));?>
The output of this control can be configured using the following templates:
<
ul>
array
Options array with the following possibilities:
string
HTML to insert into the page for the postcode control.preload_species_checklist_occurrences(int $sampleId, array $readAuth, boolean $loadImages, boolean $extraParams) : array
However, when a form needs access to occurrence data before loading the species checklist, this method can be called to preload the data. The data is loaded into data_entry_helper::$entity_to_load and an array of occurrences loaded is returned.
int
ID of the sample to load
array
Read authorisation array
boolean
If set to true, then image information is loaded as well.
boolean
Extra params to pass to the web service call for filtering.
array
Array with key of occurrence_id and value of $taxonInstance.radio_group(array $options) : string
array
Options array with the following possibilities:
The output of this control can be configured using the following templates:
string
HTML to insert into the page for the group of radio buttons.relative_client_helper_path()
inherited_from | \helper_base::relative_client_helper_path() |
---|
remembered_fields_optin(array $options) : string
Helper function to output an HTML checkbox control. Defaults to false unless values are loaded from cookie.
array
Options array with the following possibilities:
string
HTML to insert into the page for the cookie optin control.report_chart(array $options)
deprecated | Use report_helper::report_chart. |
---|
array
Refer to report_helper::report_chart documentation.
report_download_link(array $options)
The options arguments supported are the same as for the report_grid method. Pagination information will be ignored (e.g. itemsPerPage).
deprecated | Use report_helper::report_download_link. |
---|
array
Refer to report_helper::report_download_link documentation.
report_grid(array $options)
deprecated | Use report_helper::report_grid. |
---|
array
Refer to report_helper::report_grid documentation.
select(array $options) : string
The select control can be linked to populate itself when an item is selected in another control by specifying the parentControlId and filterField options. The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML code for a select control.set_remembered_fields(\$arr $arr)
Should only be called by the hook method indicia_define_remembered_fields.
see | \global\get_rememebered_fields |
---|
\$arr
Array of field names
setup_jquery_validation_js()
This JavaScript must be added at the end of form preparation otherwise we would not know all the control messages. It will normally be called by dump_javascript automatically, but is exposed here as a public method since the iform Drupal module does not call dump_javascript, but is responsible for adding JavaScript to the page via drupal_add_js.
inherited_from | \helper_base::setup_jquery_validation_js() |
---|
species_autocomplete(\type $options) : string
The output of this control can be configured using the following templates:
\type
Array of configuration options with the following possible entries.
string
Html for the species autocomplete control.species_checklist(array $options) : string
This function will generate a flexible grid control with one row for each species in the specified list. For each row, the control will display the list preferred term for that species, a checkbox to indicate its presence, and a series of cells for a set of occurrence attributes passed to the control.
Further, the control will incorporate the functionality to add extra terms to the control from the parent list of the one given. This will take the form of an autocomplete box against the parent list which will add an extra row to the control upon selection.
To change the format of the label displayed for each taxon in the grid rows that are pre-loaded into the grid, use the global $indicia_templates variable to set the value for the entry 'taxon_label'. The tags available in the template are {taxon}, {preferred_name}, {authority} and {common}. This can be a PHP snippet if PHPtaxonLabel is set to true.
To change the format of the label displayed for each taxon in the autocomplete used for searching for species to add to the grid, use the global $indicia_templates variable to set the value for the entry 'format_species_autocomplete_fn'. This must be a JavaScript function which takes a single parameter. The parameter is the item returned from the database with attributes taxon, preferred ('t' or 'f'), preferred_name, common, authority, taxon_group, language. The function must return the string to display in the autocomplete list.
To perform an action on the event of a new row being added to the grid, write a JavaScript function called hook_species_checklist_new_row(data), where data is an object containing the details of the taxon row as loaded from the data services.
array
Options array with the following possibilities:
The output of this control can be configured using the following templates:
string
HTML for the species checklist input grid.species_checklist_prepare_attributes(array $options, array $attributes, array $occAttrControls, array $occAttrs)
array
Options array as passed to the species checklist grid control.
array
Array of custom attributes as loaded from the database.
array
Empty array which will be populated with the controls required for each custom attribute.
array
Empty array which will be populated with the captions for each custom attribute.
sref_and_system(array $options) : string
If there is only 1 system available then the system drop down is ommitted since it is not required. The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the spatial reference and system selection control.sref_hidden(array $options) : string
This is intended for use when sample positions are to be selected from predefined locations and they are automatically populated when a location shown on a map_panel is clicked or a selection is made in a location control. Use in conjunction with a map_panel with, e.g. clickForSpatialRef=false locationLayerName=indicia:detail_locations locationLayerFilter=website_id=n and a location_select with e.g. searchUpdatesSref=true validation="required" blankText="Select..." The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the location sref control.sref_system_select(array $options) : string
The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the spatial reference systems selection control.sref_textbox(array $options) : string
Also generates the hidden geom field required to properly post spatial data. The box is automatically linked to a map_panel if one is added to the page. The output of this control can be configured using the following templates:
todo | This does not work for reloading data at the moment, when using split lat long mode. |
---|
array
Options array with the following possibilities:
string
HTML to insert into the page for the spatial reference control.sub_list(array $options) : string
This control allows a user to create a new list by selecting some items from the caption 'field' of an existing database table while adding some new items. The resulting list is submitted and the new items are added to the existing table as skeleton entries while the id values for the items are stored as a custom attribute.
An example usage would be to associate a list of people with a sample or location.
array
(deprecated argument list not supported). Options array with the following possibilities:
The output of this control can be configured using the following templates:
string
HTML to insert into the page for the sub_list control.system_check(boolean $fullInfo)
Currently, tests the PHP version and that the cUrl library is installed.
boolean
If true, then successful checks are also output.
tab_header(array $options)
This is required for wizard interfaces as well.
array
Options array with the following possibilities:
<
ul>
text_input(array $options) : string
This includes re-loading of existing values and displaying of validation error messages.
array
Options array with the following possibilities:
The output of this control can be configured using the following templates:
string
HTML to insert into the page for the text input control.textarea(array $options) : string
This includes re-loading of existing values and displaying of validation error messages. The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
string
HTML to insert into the page for the textarea control.time_input(array $options)
Provides a text input with a spin control that allows the time to be input. Reverts to a standard text input when JavaScript disabled.
array
Options array with the following possibilities:
The output of this control can be configured using the following templates:
tree_browser(array $options)
The browser behaves similarly to a treeview, except that the child lists are appended to the control rather than inserted as list children. This allows controls to be created which allow selection of an item, then the control is updated with the new list of options after each item is clicked. The output of this control can be configured using the following templates:
array
Options array with the following possibilities:
TODO Need to do initial value.
treeview(array $options)
array
Options array with the following possibilities:
TODO Need to do initial value.
verification_panel(array $options) : \type
When clicked, the contents of the current form are sent to the warehouse and run through any data cleaner verification rules. The results are then displayed in the panel allowing the user to provide more details for records of interest before submitting the form. Requires the data_cleaner module to be enabled on the warehouse. The output of this control can be configured using the following templates:
global | type $indicia_templates |
---|
array
Options array with the following possibilities:
\type
HTML to insert onto the page for the verification panel.wrap(array $array, string $entity)
Post or Session data generated by a form) into a structure suitable for submission.
The attributes in the array are all included, unless they named using the form entity:attribute (e.g. sample:date) in which case they are only included if wrapping the matching entity. This allows the content of the wrap to be limited to only the appropriate information.
Do not prefix the survey_id or website_id attributes being posted with an entity name as these IDs are used by Indicia for all entities.
array
Array of data generated from data entry controls.
string
Name of the entity to wrap data for.
wrap_species_checklist(array $arr, boolean $include_if_any_data, array $zero_attrs, array $zero_values)
This will return an array of submodel entries which can be dropped directly into the subModel section of the submission array. If there is a field occurrence:determiner_id or occurrence:record_status in the main form data, then these values are applied to each occurrence created from the grid. For example, place a hidden field in the form named "occurrence:record_status" with a value "C" to set all occurrence records to completed as soon as they are entered.
array
Array of data generated by data_entry_helper::species_checklist method.
boolean
If true, then any list entry which has any data set will be included in the submission. This defaults to false, unless the grid was created with rowInclusionCheck=hasData in the grid options.
array
Set to an array of abundance attribute field IDs that can be treated as abundances. Alternatively set to true to treat all occurrence custom attributes as possible zero abundance indicators.
array
Set to an array of values which are considered to indicate a zero abundance record if found for one of the zero_attrs. Values are case-insensitive. Defaults to array('0','None','Absent').
wrap_with_attrs(array $values, string $modelName)
deprecated |
---|
array
Array of form data (e.g. $_POST).
string
Name of the model to wrap data for. If this is sample, occurrence or location then custom attributes will also be wrapped. Furthermore, any attribute called $modelName:image can contain an image upload (as long as a suitable entity is available to store the image in).
_cacheResponse(string $file, array $response, array $options)
inherited_from | \helper_base::_cacheResponse() |
---|
string
Cache file to be removed, includes path - will be false if no caching to take place
array
http_post return value
array
Options array : contents used to tag what this data is.
_getCacheFileName(string $path, array $options, \number $timeout) : string
inherited_from | \helper_base::_getCacheFileName() |
---|
string
directory path for file
array
Options array : contents are used along with md5 to generate the filename.
\number
string
filename, else FALSE if data is not to be cached._getCacheTimeOut(array $options) : \Timeout
inherited_from | \helper_base::_getCacheTimeOut() |
---|
array
Options array with the following possibilities:
\Timeout
in number of seconds, else FALSE if data is not to be cached._getCachedResponse(string $file, \number $timeout, array $options) : array
inherited_from | \helper_base::_getCachedResponse() |
---|
string
Cache file to be used, includes path
\number
array
Options array : contents used to confirm what this data is.
array
equivalent of call to http_post, else FALSE if data is not to be cached._timeOutCacheFile(string $file, \number $timeout)
inherited_from | \helper_base::_timeOutCacheFile() |
---|
string
Cache file to be removed, includes path
\number
apply_replacements_to_template(string $template, string $options)
<
div id="{id}">) and replaces the tokens with the equivalent values looked up from the $options array.
inherited_from | \helper_base::apply_replacements_to_template() |
---|
string
The templatable string.
string
The array of items which can be merged into the template.
apply_static_template(string $name, array $options) : string
inherited_from | \helper_base::apply_static_template() |
---|
string
The static template type. e.g. prefix or suffix.
array
Array of options which may contain a template name.
string
Template value.build_validation_class(\$options. $options) : string
inherited_from | \helper_base::build_validation_class() |
---|
\$options.
Control options array. For validation to be applied should contain a validation entry, containing a single validation string or an array of strings.
string
The validation rules formatted as a class.get_help_text(array $options, string $pos) : string
inherited_from | \helper_base::get_help_text() |
---|
array
Control's options array. Can specify the class for the help text item using option helpTextClass.
string
Either before or after. Defines the position that is being requested.
string
Templated help text, or nothing.internal_dump_resources(array $resources)
access | private |
---|---|
inherited_from | \helper_base::internal_dump_resources() |
array
List of resources to include.
jq_esc(string $name) : string
inherited_from | \helper_base::jq_esc() |
---|
string
The string to be escaped.
string
escaped name.send_file_to_warehouse(string $path, boolean $persist_auth, array $readAuth, string $service) : string
inherited_from | \helper_base::send_file_to_warehouse() |
---|
string
Path to the file to upload, relative to the interim image path folder (normally the client_helpers/upload folder.
boolean
Allows the write nonce to be preserved after sending the file, useful when several files are being uploaded.
array
readAuth Read authorisation tokens, if not supplied then the $_POST array should contain them.
string
Path to the service URL used. Default is data/handle_media, but could be import/upload_csv.
string
Error message, or true if successful.DateCmp(int $a, int $b)
The sorted array normally contains a list of files, with the first element of each array entry being the file path and the second the file date stamp.
int
Datestamp of the first file to compare.
int
Datestamp of the second file to compare.
_purgeCache()
_purgeImages()
apply_error_template(string $error, string $fieldname)
inherited_from | \helper_base::apply_error_template() |
---|
string
The error message.
string
The name of the field which the error is being attached to.
attachOccurrenceImagesToModel(array $occ, array $record)
If found they are attached to the occurrence model as sub-models.
array
Occurrence submission structure.
array
Record information from the form post, which may contain images.
attributes_get_default(array $item)
todo | Handle vague dates. At the moment we just use the start date. |
---|
array
The attribute's definition array.
boolean_attribute(string $ctrl, array $options)
string
The control type, should be radio or checkbox.
array
The control's options array.
check_config(string $name, boolean $isset, boolean $empty, array $missing_configs, array $blank_configs)
If it is missing or blank then it is added to an array so that the caller can decide what to do.
string
Name of the configuration parameter.
boolean
Is the parameter set?
boolean
Is the parameter empty?
array
Configuration settings that are missing are added to this array.
array
Configuration settings that are empty are added to this array.
check_or_radio_group(array $options, string $type)
array
Control options array
string
Name of the input element's type attribute, e.g. radio or checkbox.
convert_to_bytes(string $size) : integer
1K, 1M) into the number of bytes.
string
Size string to convert. Valid suffixes as G (gigabytes), M (megabytes), K (kilobytes) or nothing.
integer
Number of bytes.get_params_form_control(string $key, array $info, array $options, array $tools) : string
inherited_from | \helper_base::get_params_form_control() |
---|
string
The unique identifier of this control.
array
Configuration options for the parameter as defined in the report, including the description, display (label), default and datatype.
array
Control options array
array
Any tools to be embedded in the map toolbar are returned in this parameter rather than as the return result of the function.
string
The HTML for the form parameter.get_preset_param(array $options, string $name)
Returns empty string if not defined.
inherited_from | \helper_base::get_preset_param() |
---|
array
The options array, containing a presetParams entry that the parameter should be found in.
string
The key identifying the preset parameter to look for.
get_species_checklist_col_header(string $id, string $caption, integer $colIdx, array $colWidths, string $attrs)
Skips any columns which are display: none.
string
The HTML ID to use.
string
The caption to insert.
integer
The index of the current column. Incremented only if the header is output (so hidden columns are excluded).
array
List of column percentage widths.
string
CSS attributes to attach.
get_species_checklist_taxa_list(array $options, array $taxonRows) : array
array
Options array for the control
array
Array that is modified by this method to contain a list of the rows to load onto the grid. Each row contains a sub-array with ttlId entry plus occId if the row represents an existing record
array
The taxon list to use in the grid.include_sref_handler_js(array $systems)
If a handler file does not exist then the transform is handled by a web-service request to the warehouse. Handlers are only required for grid systems, not for coordinate systems that are entirely described by an EPSG code.
array
List of spatial reference system codes.
init_linked_lists(array $options)
array
Options array of the child linked list.
load_parent_species(array $taxalist, array $options)
So load them up...
array
List of taxon definitions we are loading parents for.
array
Options array as passed to the species grid. Provides the read authorisation tokens.
purgeFiles(integer $chanceOfPurge, string $folder, integer $timeout, integer $allowedFileCount)
integer
Indicates the chance of a purge happening. 1 causes a purge every time the function is called, 10 means there is a 1 in 10 chance, etc.
string
Path to the folder to purge cache files from.
integer
Age of files in seconds before they will be considered for purging.
integer
Number of most recent files to not bother purging from the cache.
select_or_listbox(array $options)
access | private |
---|
array
Control options array
species_checklist_filter_popup(array $options, array $nameFilter)
array
Options array as passed to the species checklist grid.
array
array of optional name filtering modes, with the actual filter to apply as the value.
species_checklist_get_subsp_cell(array $taxon, integer $txIdx, integer $existing_record_id, array $options)
array
Taxon definition as loaded from the database.
integer
Index of the taxon row we are operating on.
integer
If an existing record, then the record's occurrence ID.
array
Options array for the species grid. Used to obtain the row inclusion check mode, read authorisation and lookup list's ID.
species_checklist_occ_attr_class(array $options, integer $idx, string $caption)
array
Options array which contains the occAttrClasses item, an array of classes configured for each attribute control.
integer
Index of the custom attribute.
string
Caption of the attribute used to construct a suitable CSS class.
validate_inputs_on_current_tab(string $msg)
string
Message to display if a failure to validate occurs
$cache_allowed_file_count : integer
inherited_from | \helper_base::$$cache_allowed_file_count |
---|
$cache_chance_purge : integer
inherited_from | \helper_base::$$cache_chance_purge |
---|
$cache_chance_refresh_file : integer
inherited_from | \helper_base::$$cache_chance_refresh_file |
---|
$cache_timeout : integer
inherited_from | \helper_base::$$cache_timeout |
---|
$css_path : string
inherited_from | \helper_base::$$css_path |
---|
$default_validation_rules : Array
inherited_from | \helper_base::$$default_validation_rules |
---|
$dumped_resources : array
inherited_from | \helper_base::$$dumped_resources |
---|
$entity_to_load : array
E.g. set it to the content of $_POST after submitting a form that needs to reload.
$form_mode : string
inherited_from | \helper_base::$$form_mode |
---|
$helpTextPos : string
inherited_from | \helper_base::$$helpTextPos |
---|
$images_path : string
inherited_from | \helper_base::$$images_path |
---|
$interim_image_chance_purge : integer
$interim_image_expiry : integer
$is_ajax : boolean
inherited_from | \helper_base::$$is_ajax |
---|
$javascript : string
inherited_from | \helper_base::$$javascript |
---|
$js_path : string
inherited_from | \helper_base::$$js_path |
---|
$late_javascript : string
inherited_from | \helper_base::$$late_javascript |
---|
$nocache : boolean
inherited_from | \helper_base::$$nocache |
---|
$onload_javascript : string
inherited_from | \helper_base::$$onload_javascript |
---|
$required_resources : Array
inherited_from | \helper_base::$$required_resources |
---|
$resource_list : Array
inherited_from | \helper_base::$$resource_list |
---|
$validated_form_id : array
inherited_from | \helper_base::$$validated_form_id |
---|
$validation_errors : array
inherited_from | \helper_base::$$validation_errors |
---|
$validation_mode : array
Options are message, message, hint, icon, colour, inline. The inline option specifies that the message should appear on the same line as the control. Otherwise it goes on the next line, indented by the label width. Because in many cases, controls on an Indicia form occupy the full available width, it is often more appropriate to place error messages on the next line so this is the default behaviour.
inherited_from | \helper_base::$$validation_mode |
---|
$warehouse_proxy : string
inherited_from | \helper_base::$$warehouse_proxy |
---|
$default_styles : Boolean
inherited_from | \helper_base::$$default_styles |
---|
$displayed_errors : array
inherited_from | \helper_base::$$displayed_errors |
---|
$html_attributes
When replacing items in a template, these get automatically wrapped. E.g. a template replacement for the class will be converted to class="value". The key is the parameter name, and the value is the html attribute it will be wrapped into.
inherited_from | \helper_base::$$html_attributes |
---|
$using_locking : Boolean
inherited_from | \helper_base::$$using_locking |
---|
$website_id : integer
inherited_from | \helper_base::$$website_id |
---|
$remembered_fields : Array