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:

  • label
    Optional. If specified, then an HTML label containing this value is prefixed to the control HTML.
  • helpText
    Optional. Defines help text to be displayed alongside the control. The position of the text is defined by helper_base::$helpTextPos, which can be set to before or after (default). The template is defined by global $indicia_templates['helpText'] and can be replaced on an instance by instance basis by specifying an option 'helpTextTemplate' for the control.
  • helpTextTemplate If helpText is supplied but you need to change the template for this control only, set this to refer to the name of an alternate template you have added to the $indicia_templates array. The template should contain a {helpText} replacement string.
  • helpTextClass Specify helpTextClass to override the class normally applied to control help texts, which defaults to helpText.
  • prefixTemplate If you need to change the prefix for this control only, set this to refer to the name of an alternate template you have added to the global $indicia_templates array. To change the prefix for all controls, you can update the value of $indicia_templates['prefix'] before building the form.
  • suffixTemplate If you need to change the suffix for this control only, set this to refer to the name of an alternate template you have added to the global $indicia_templates array. To change the suffix for all controls, you can update the value of $indicia_templates['suffix'] before building the form.
  • afterControl Allows a piece of HTML to be specified which is inserted immediately after the control, before the suffix and helpText. Ideal for inserting buttons that are to be displayed alongside a control such as a Go button for a search box.
  • lockable Adds a padlock icon after the control which can be used to lock the control's value. The value will then be remembered and redisplayed in the control each time the form is shown until the control is unlocked or the end of the browser session. This option will not work for password controls.
package Client

 Methods

Adds the data from the $_POST array into the session.

add_post_to_session() 
Static

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

Method to link up the external css or js files associated with a set of code.

add_resource(string $resource) 
InheritedStatic

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()

Parameters

$resource

string

Name of resource to link. The following options are available:

  • jquery
  • openlayers
  • graticule
  • clearLayer
  • addrowtogrid
  • indiciaMapPanel
  • indiciaMapEdit
  • georeference_google_search_api
  • google_search
  • locationFinder
  • createPersonalSites
  • autocomplete
  • indicia_locks
  • jquery_cookie
  • jquery_ui
  • jquery_ui_fr
  • jquery_form
  • json
  • reportPicker
  • treeview
  • treeview_async
  • googlemaps
  • multimap
  • virtualearth
  • google_search
  • fancybox
  • flickr
  • treeBrowser
  • defaultStylesheet
  • validation
  • plupload
  • jqplot
  • jqplot_bar
  • jqplot_pie
  • jqplot_category_axis_renderer
  • jqplot_trendline
  • reportgrid
  • tabs
  • wizardprogress
  • spatialReports
  • jsonwidget
  • timeentry
  • verification

Internal method to build a control from its options array and its template.

apply_template(string $template, array $options) 
InheritedStatic

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()

Parameters

$template

string

Name of the control template, from the global $indicia_templates variable.

$options

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.

Takes an associative array and converts it to a list of params for a query string.

array_to_query_string(array $array, boolean $encodeValues) : string
InheritedStatic

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()

Parameters

$array

array

Associative array to convert.

$encodeValues

boolean

Default false. Set to true to URL encode the values being added to the string.

Returns

stringThe query string.

Helper function to generate an autocomplete box from an Indicia core service query.

autocomplete(array $options) : string
Static

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:

  • autocomplete
    Defines a hidden input and a visible input, to hold the underlying database ID and to allow input and display of the text search string respectively.
  • autocomplete_javascript
    Defines the JavaScript which will be inserted onto the page in order to activate the autocomplete control.
link http://code.google.com/p/indicia/wiki/DataModel

Parameters

$options

array

Options array with the following possibilities:

  • fieldname
    Required. The name of the database field this control is bound to.
  • id
    Optional. The id to assign to the HTML control. This should be left to its default value for integration with other mapping controls to work correctly.
  • default
    Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
  • defaultCaption
    Optional. The default caption to assign to the control. This is overridden when reloading a record with existing data for this control.
  • class
    Optional. CSS class names to add to the control.
  • table
    Required. Table name to get data from for the autocomplete options.
  • captionField
    Required. Field to draw values to show in the control from.
  • valueField
    Optional. Field to draw values to return from the control from. Defaults to the value of captionField.
  • extraParams
    Optional. Associative array of items to pass via the query string to the service. This should at least contain the read authorisation array.
  • template
    Optional. Name of the template entry used to build the HTML for the control. Defaults to autocomplete.
  • numValues
    Optional. Number of returned values in the drop down list. Defaults to 10.
  • duplicateCheckFields
    Optional. Provide an array of field names from the dataset returned from the warehouse. Any duplicates based values from this list of fields will not be added to the output.
  • simplify
    Set to true to simplify the search term by removing punctuation and spaces. Use when the field being searched against is also simplified.
  • warnIfNoMatch Should the autocomplete control warn the user if they leave the control whilst searching and then nothing is matched? Default true.

Returns

stringHTML to insert into the page for the autocomplete control.

Parameters forms are a quick way of specifying a simple form used to specify the input parameters for a process.

build_params_form(array $options, boolean $hasVisibleContent) 
InheritedStatic

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.

link used for report output, id of the report instance on the page if relevant, so that controls can be given unique ids. </li> <li><b>form</b><br/> Associative array defining the form content. </li> <li><b>readAuth</b><br/> Read authorisation array. </li> <li><b>fieldNamePrefix</b><br/> Optional prefix for form field names. </li> <li><b>defaults</b><br/> Associative array of default values for each form element. </li> <li><b>paramsToHide</b><br/> An optional array of parameter names for parameters that should be added to the form output as hidden inputs rather than visible controls. <li><b>paramsToExclude</b><br/> An optional array of parameter names for parameters that should be skipped in the form output despite being in the form definition. </li> <li><b>presetParams</b><br/> Optional array of param names and values that have a fixed value and are therefore output only as a hidden control. </li> <li><b>inlineMapTools</b><br/> Defaults to false. If true, then map drawing parameter tools are embedded into the report parameters form. If false, then the map drawing tools are added to a toolbar at the top of the map. </li> <li><b>helpText</b><br/> Defaults to true. Set to false to disable helpText being displayed alongside controls, useful for building compact versions of simple parameter forms. </li> <li><b>nocache</b><br/> Set to true to disable caching of lookups. </li> </ul>
inherited_from \helper_base::build_params_form()

Parameters

$options

array

Options array with the following possibilities:

<

ul>

  • form
    Associative array defining the form structure. The structure is the same as described for fixed_values_form in a Warehouse model.

  • $hasVisibleContent

    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.

    Helper function to simplify building of a submission that contains a single sample and occurrence record.

    build_sample_occurrence_submission(array $values) 
    Static

    Parameters

    $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.

    Helper function to simplify building of a submission that contains a single sample and multiple occurrences records generated by a species_checklist control.

    build_sample_occurrences_list_submission(array $values, boolean $include_if_any_data, array $zero_attrs, array $zero_values) : array
    Static

    Parameters

    $values

    array

    List of the posted values to create the submission from.

    $include_if_any_data

    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.

    $zero_attrs

    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.

    $zero_values

    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('

    Returns

    arraySample submission array

    Helper function to simplify building of a submission.

    build_submission(array $values, array $structure) 
    Static

    Does simple submissions that do not involve species checklist grids.

    Parameters

    $values

    array

    List of the posted values to create the submission from.

    $structure

    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', ...) )

    Returns the default value for the control with the supplied Id.

    check_default_value(string $id) 
    Static

    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.

    Parameters

    $id

    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.

    Returns a span containing any validation errors active on the form for the control with the supplied ID.

    check_errors(string $fieldname, boolean $plaintext) 
    InheritedStatic
    inherited_from \helper_base::check_errors()

    Parameters

    $fieldname

    string

    Fieldname of the control to retrieve errors for.

    $plaintext

    boolean

    Set to true to return just the error text, otherwise it is wrapped in a span.

    Validation rule to test if an uploaded file is allowed by file size.

    check_upload_size(array $file) : bool
    Static

    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".

    Parameters

    $file

    array

    Item from the $_FILES array.

    Returns

    boolTrue if the file size is acceptable, otherwise false.

    Helper function to output an HTML checkbox control.

    checkbox(array $options) : string
    Static

    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:

    • checkbox
      HTML template for the checkbox.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • template
      Optional. Name of the template entry used to build the HTML for the control. Defaults to checkbox.

    Returns

    stringHTML to insert into the page for the checkbox control.

    Helper function to generate a list of checkboxes from a Indicia core service query.

    checkbox_group(array $options) : string
    Static

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • table
      Required. Table name to get data from for the select options.
    • captionField
      Optional. Field to draw values to show in the control from. Required unless lookupValues is specified.
    • valueField
      Optional. Field to draw values to return from the control from. Defaults to the value of captionField.
    • extraParams
      Optional. Associative array of items to pass via the query string to the service. This should at least contain the read authorisation array.
    • lookupValues
      If the group is to be populated with a fixed list of values, rather than via a service call, then the values can be passed into this parameter as an associated array of key=>caption.
    • cachetimeout
      Optional. Specifies the number of seconds before the data cache times out - i.e. how long after a request for data to the Indicia Warehouse before a new request will refetch the data, rather than use a locally stored (cached) copy of the previous request. This speeds things up and reduces the loading on the Indicia Warehouse. Defaults to the global website-wide value: if this is not specified then 1 hour.
    • template
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for the outer control.
    • itemTemplate
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for each item in the control.
    • captionTemplate
      Optional and only relevant when loading content from a data service call. Specifies the template used to build the caption, with each database field represented as {fieldname}.

    The output of this control can be configured using the following templates:

    • check_or_radio_group
      Container element for the group of checkboxes.
    • check_or_radio_group_item
      Template for the HTML element used for each item in the group.

    Returns

    stringHTML to insert into the page for the group of checkboxes.

    Helper function to clear the Indicia cache files.

    clear_cache() 

    Removes any data entry values persisted into the $_SESSION by Indicia.

    clear_session() 
    Static

    Returns the client helper folder path, relative to the root folder.

    client_helper_path() 
    InheritedStatic
    inherited_from \helper_base::client_helper_path()

    Helper function to insert a date picker control.

    date_picker(array $options) : string
    Static

    The output of this control can be configured using the following templates:

    • date_picker
      HTML The output of this controlfor the text input element used for the date picker. Other functionality is added using JavaScript.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to, for example 'sample:date'.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • allowFuture
      Optional. If true, then future dates are allowed. Default is false.
    • dateFormat
      Optional. Allows the date format string to be set, which must match a date format that can be parsed by the JavaScript Date object. Default is dd/mm/yy.
    • allowVagueDates
      Optional. Set to true to enable vague date input, which disables client side validation for standard date input formats.
    • showButton
      Optional. Set to true to show a button which must be clicked to drop down the picker. Defaults to false unless allowVagueDates is true as inputting a vague date without the button is confusing.
    • buttonText
      Optional. if showButton is true, this text will be shown as the 'alt' text for the buttom image.

    Returns

    stringHTML to insert into the page for the date picker control.

    Takes a response from a call to forward_post_to() and outputs any errors from it onto the screen.

    dump_errors(string $response, boolean $inline) 
    Static
    see \global\forward_post_to()
    link http://code.google.com/p/indicia/wiki/TutorialBuildingBasicPage#Build_a_data_entry_page

    Parameters

    $response

    string

    Return value from a call to forward_post_to().

    $inline

    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.

    This method allows JavaScript and CSS links to be created and placed in the <head> of the HTML file rather than using dump_javascript which must be called after the form is built.

    dump_header(\$resources $resources) : string
    InheritedStatic

    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()

    Parameters

    $resources

    \$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.

    Returns

    stringText to place in the head section of the html file.

    Helper function to collect javascript code in a single location.

    dump_javascript() : string
    InheritedStatic

    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()

    Returns

    stringJavaScript to insert into the page for all the controls added to the page so far.

    Retrieves any errors that have not been emitted alongside a form control and adds them to the page.

    dump_remaining_errors() : string
    Static

    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.

    Returns

    stringHTML block containing the error information, built by concatenating the validation_message template for each error.

    Helper method to enable the support for tabbed interfaces for a div.

    enable_tabs(array $options) 
    Static

    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

    Parameters

    $options

    array

    Options array with the following possibilities:

    • divId
      Optional. The id of the div which will be tabbed. If not specified then the caller is responsible for calling the jQuery tabs plugin - this method just links the appropriate jQuery files.
    • style
      Optional. Possible values are tabs (default) or wizard. If set to wizard, then the tab header is not displayed and the navigation should be provided by the tab_button control. This must be manually added to each tab page div.
    • navButtons Are Next and Previous buttons used to move between pages? Always true for wizard style otherwise navigation is impossible and defaults to false for tabs style.
    • progressBar
      Optional. Set to true to output a progress header above the tabs/wizard which shows which stage the user is on out of the sequence of steps in the wizard.

    Call the enable_validation method to turn on client-side validation for any controls with validation rules defined.

    enable_validation(string $form_id) 
    InheritedStatic

    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()

    Parameters

    $form_id

    string

    @form_id Id of the form the validation is being attached to.

    Explodes a value on several lines into an array split on the lines.

    explode_lines(string $value) : array
    InheritedStatic

    Tolerates any line ending.

    inherited_from \helper_base::explode_lines()

    Parameters

    $value

    string

    A multi-line string to be split.

    Returns

    arrayAn array with one entry per line in $value.

    Explodes a value with key=value several lines into an array split on the lines.

    explode_lines_key_value_pairs(string $value) : array
    InheritedStatic

    Tolerates any line ending.

    inherited_from \helper_base::explode_lines_key_value_pairs()

    Parameters

    $value

    string

    A multi-line string to be split.

    Returns

    arrayAn 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.

    Retrieves an array of just the image data from a $_POST or set of control values.

    extract_image_data(array $values, string $modelName, boolean $simpleFileInputs, boolean $moveSimpleFiles) 
    Static

    Parameters

    $values

    array

    Pass the $_POST data or other array of form values in this parameter.

    $modelName

    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.

    $simpleFileInputs

    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.

    $moveSimpleFiles

    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.

    Returns an array constructed from all the indicia variables that have previously been stored in the session.

    extract_session_array() 
    Static

    Outputs a file upload control suitable for linking images to records.

    file_box(array $options) 
    Static

    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.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • table
      Name of the image table to upload images into, e.g. occurrence_image, location_image, sample_image or taxon_image. Defaults to occurrence_image.
    • loadExistingRecordKey
      Optional prefix for the information in the data_entry_helper::$entity_to_load to use for loading any existing images. Defaults to use the table option.
    • id
      Optional. Provide a unique identifier for this image uploader control if more than one are required on the page.
    • caption
      Caption to display at the top of the uploader box. Defaults to the translated string for "Files".
    • uploadSelectBtnCaption
      Set this to override the caption for the button for selecting files to upload.
    • flickrSelectBtnCaption
      Set this to override the caption for the button for selecting files from Flickr.
    • uploadStartBtnCaption
      Set this to override the caption for the start upload button, which is only visible if autoUpload is false.
    • useFancybox
      Defaults to true. If true, then image previews use the Fancybox plugin to display a "lightbox" effect when clicked on.
    • imageWidth
      Defaults to 200. Number of pixels wide the image previews should be.
    • resizeWidth
      If set, then the file will be resized before upload using this as the maximum pixels width.
    • resizeHeight
      If set, then the file will be resized before upload using this as the maximum pixels height.
    • resizeQuality
      Defines the quality of the resize operation (from 1 to 100). Has no effect unless either resizeWidth or resizeHeight are non-zero.
    • upload
      Boolean, defaults to true. Set to false when implementing a Flickr image control without file upload capability.
    • flickr
      Not implemented.
    • maxFileCount
      Maximum number of files to allow upload for. Defaults to 4. Set to false to allow unlimited files.
    • autoupload
      Defaults to true. If false, then a button is displayed which the user must click to initiate upload of the files currently in the queue.
    • msgUploadError
      Use this to override the message displayed for a generic file upload error.
    • msgFileTooBig
      Use this to override the message displayed when the file is larger than the size limit allowed on the Warehouse.
    • msgTooManyFiles
      Use this to override the message displayed when attempting to upload more files than the maxFileCount allows. Use a replacement string [0] to specify the maxFileCount value.
    • uploadScript
      Specify the script used to handle image uploads on the server (relative to the client_helpers folder). You should not normally need to change this. Defaults to upload.php.
    • runtimes
      Array of runtimes that the file upload component will use in order of priority. Defaults to array('html5','silverlight','flash','gears','browserplus','html4'), though flash is removed for Internet Explorer 6. You should not normally need to change this.
    • destinationFolder
      Override the destination folder for uploaded files. You should not normally need to change this.
    • swfAndXapFolder
      Override the folder which the Plupload Flash (swf) and Silverlight (xap) files are loaded from. You should not normally need to change this.
    • codeGenerated If set to all (default), then this returns the HTML required and also inserts JavaScript in the document onload event. However, if you need to delay the loading of the control until a certain event, e.g. when a radio button is checked, then this can be set to php to return just the php and ignore the JavaScript, or js to return the JavaScript instead of inserting it into document onload, in which case the php is ignored. this allows you to attach the JavaScript to any event you need to.
    • tabDiv
      If loading this control onto a set of tabs, specify the tab control's div ID here. This allows the control to automatically generate code which only generates the uploader when the tab is shown, reducing problems in certain runtimes. This has no effect if codeGenerated is not left to the default state of all.

    The output of this control can be configured using the following templates:

    • file_box
      Outputs the HTML container which will contain the upload button and images.
    • file_box_initial_file_info
      HTML which provides the outer container for each displayed image, including the header and remove file button. Has an element with class set to photo-wrapper into which images themselves will be inserted.
    • file_box_uploaded_image
      Template for the HTML for each uploaded image, including the image, caption input and hidden inputs to define the link to the database. Will be inserted into the file_box_initial_file_info template's photo-wrapper element.
    • button
      Template for the buttons used.

    Either takes the passed in submission, or creates it from the post data if this is null, and forwards it to the data services for saving as a member of the entity identified.

    forward_post_to(string $entity, array $submission, array $writeTokens) 
    Static

    Parameters

    $entity

    string

    Name of the top level entity being submitted, e.g. sample or occurrence.

    $submission

    array

    The wrapped submission structure. If null, then this is automatically constructer from the form data in $_POST.

    $writeTokens

    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.

    Generates a text input control with a search button that looks up an entered place against a georeferencing web service.

    georeference_lookup(array $options) : string
    Static

    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:

    • georeference_lookup
      Template which outputs the HTML for the georeference search input, button placehold and container for the list of search results. The default template uses JavaScript to write the output, so that this control is removed from the page if JavaScript is disabled as it will have no functionality.
    • button
      HTML template for the buttons used.
    link Google AJAX Search API Terms of Use.
    link Documentation for the driver architecture.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Optional. The name of the database field this control is bound to if any.
    • class
      Optional. CSS class names to add to the control.
    • georefPreferredArea
      Optional. Hint provided to the locality search service as to which area to look for the place name in. Any example usage of this would be to set it to the name of a region for a survey based in that region. Note that this is only a hint, and the search service may still return place names outside the region. Defaults to gb.
    • georefCountry
      Optional. Hint provided to the locality search service as to which country to look for the place name in. Defaults to United Kingdom.
    • georefLang
      Optional. Language to request place names in. Defaults to en-EN for English place names.
    • readAuth
      Optional. Read authentication tokens for the Indicia warehouse if using the indicia_locations driver setting.
    • driver
      Optional. Driver to use for the georeferencing operation. Supported options are:
      geoplanet - uses the Yahoo! GeoPlanet place search. This is the default.
      google_search_api - uses the Google AJAX API LocalSearch service. This method requires both a georefPreferredArea and georefCountry to work correctly. Note that the Google AJAX API is deprecated so its future support is not guaranteed.
      geoportal_lu - Use the Luxembourg specific place name search provided by geoportal.lu. indicia_locations - Use the list of locations available to the current website in Indicia as a search list.
    • public
      Optional. If using the indicia_locations driver, then set this to true to include public (non-website specific) locations in the search results. Defaults to false.
    • autoCollapseResults
      Optional. If a list of possible matches are found, does selecting a match automatically fold up the results? Defaults to false.

    Returns

    stringHTML to insert into the page for the georeference lookup control.

    Helper function to fetch details of attributes associated with a survey.

    getAttributes(array $options, \optional $indexedArray, string $sharing) : \Associative
    Static

    This can be used to auto-generated the forum structure for a survey for example.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • survey_id
      Optional. The survey that custom attributes are to be loaded for.
    • website_ids
      Optional. Used instead of survey_id, allows retrieval of all possible custom attributes for a set of websites.
    • sample_method_id
      Optional. Can be set to the id of a sample method when loading just the attributes that are restricted to that sample method or are unrestricted, otherwise only loads unrestricted attributes. Ignored unless loading sample attributes.
    • location_type_id
      Optional. Can be set to the id of a location_type when loading just the attributes that are restricted to that type or are unrestricted, otherwise only loads unrestricted attributes. Ignored unless loading location attributes.
    • attrtable
      Required. Singular name of the table containing the attributes, e.g. sample_attribute.
    • valuetable
      Required. Singular name of the table containing the attribute values, e.g. sample_attribute_value.
    • fieldprefix
      Required. Prefix to be given to the returned control names, e.g. locAttr:
    • extraParams
      Required. Additional parameters used in the web service call, including the read authorisation.
    • multiValue
      Defaults to false, in which case this assumes that each attribute only allows one value, and the response array is keyed by attribute ID. If set to true, multiple values are enabled and the response array is keyed by : in the cases where there is any data for the attribute.

    $indexedArray

    \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.

    $sharing

    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.

    Returns

    \Associativearray of attributes, keyed by the attribute ID (multiValue=false) or : if multiValue=true.

    Internal function to find the path to the root of the site, including the trailing slash.

    getRootFolder() 
    InheritedStatic
    inherited_from \helper_base::getRootFolder()

    Retrieves a token and inserts it into a data entry form which authenticates that the form was submitted by this website.

    get_auth(string $website_id, string $password) 
    InheritedStatic
    inherited_from \helper_base::get_auth()

    Parameters

    $website_id

    string

    Indicia ID for the website.

    $password

    string

    Indicia password for the website.

    Returns the browser name and version information

    get_browser_info(\$agent $agent) : array
    Static

    Parameters

    $agent

    \$agent

    Agent string, optional. If not suplied, then the http user agent is used.

    Returns

    arrayBrowser information array. Contains name and version elements.

    Retrieves a data value from the Indicia Session data

    get_from_session(string $name, string $default) 
    Static
    link http://code.google.com/p/indicia/wiki/TutorialDataEntryWizard

    Parameters

    $name

    string

    Name of the session value to retrieve

    $default

    string

    Default value to return if not set or empty

    Issue a post request to get the population data required for a control either from direct access to a data entity (table) or via a report query.

    get_population_data(array $options) 
    Static

    The response will be cached locally unless the caching option is set to false.

    link https://indicia-docs.readthedocs.org/en/latest/developing/web-services/data-services-entity-list.html
    link https://indicia-docs.readthedocs.org/en/latest/administrating/warehouse/website-agreements.html

    Parameters

    $options

    array

    Options array with the following possibilities:

    • table
      Singular table name used when loading from a database entity.
    • view
      Optional. Use to specify which database view to load for an entity (e.g. list, details, gv or cache). Defaults to list.
    • report
      Path to the report file to use when loading data from a report, e.g. "library/occurrences/explore_list", exc;uding the .xml extension.
    • orderby
      Optional. For a non-default sort order, provide the field name to sort by. Can be comma separated to sort by several fields in descending order of precedence.
    • sortdir
      Optional. Specify ASC or DESC to define ascending or descending sort order respectively. Can be comma separated if several sort fields are specified in the orderby parameter.
    • extraParams
      Array of extra URL parameters to send with the web service request. Should include key value pairs for the field filters (for table data) or report parameters (for the report data) as well as the read authorisation tokens. Can also contain a parameter for: orderby - for a non-default sort order, provide the field name to sort by. Can be comma separated to sort by several fields in descending order of precedence. sortdir - specify ASC or DESC to define ascending or descending sort order respectively. Can be comma separated if several sort fields are specified in the orderby parameter. limit - number of records to return. offset - number of records to offset by into the dataset, useful when paginating through the records.
    • nocache
      Optional, if set to true then the results will always be loaded from the warehouse not from the local cache.
    • sharing
      Optional. Set to verification, reporting, peer_review, moderation or data_flow to request data sharing with other websites for the task. Further information is given in the link below.

    Retrieves a read token and passes it back as an array suitable to drop into the 'extraParams' options for an Ajax call.

    get_read_auth(string $website_id, string $password) 
    InheritedStatic
    inherited_from \helper_base::get_read_auth()

    Parameters

    $website_id

    string

    Indicia ID for the website.

    $password

    string

    Indicia password for the website.

    Retrieves read and write nonce tokens from the warehouse.

    get_read_write_auth(string $website_id, string $password) : \Returns
    InheritedStatic
    inherited_from \helper_base::get_read_write_auth()

    Parameters

    $website_id

    string

    Indicia ID for the website.

    $password

    string

    Indicia password for the website.

    Returns

    \Returnsan 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.

    Provides access to a list of remembered field values from the last time the form was used.

    get_remembered_fields() : Array
    Static

    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.

    Returns

    ArrayList of the fields to remember.

    Method that retrieves the data from a report or a table/view, ready to display in a chart or grid.

    get_report_data(array $options, string $extra) 
    Static
    deprecated , use report_helper::get_report_data instead.

    Parameters

    $options

    array

    Refer to documentation for report_helper::get_report_data.

    $extra

    string

    Refer to documentation for report_helper::get_report_data.

    List of external resources including stylesheets and js files used by the data entry helper class.

    get_resources() 
    InheritedStatic
    inherited_from \helper_base::get_resources()

    A utility function for building the inline script content which should be inserted into a page from the javaascript, late javascript and onload javascript.

    get_scripts(string $javascript, string $late_javascript, string $onload_javascript, bool $includeWrapper) 
    InheritedStatic

    Can optionally include the script tags wrapper around the script generated.

    inherited_from \helper_base::get_scripts()

    Parameters

    $javascript

    string

    JavaScript to run when the page is ready, i.e. in $(document).ready.

    $late_javascript

    string

    JavaScript to run at the end of $(document).ready.

    $onload_javascript

    string

    JavaScript to run in the window.onLoad handler which comes later in the page load process.

    $includeWrapper

    bool

    If true then includes script tags around the script.

    When the species checklist grid has a lookup list associated with it, this is a secondary checklist which you can pick species from to add to the grid.

    get_species_checklist_clonable_row(array $options, array $occAttrControls, array $attributes) 
    Static

    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.

    Parameters

    $options

    array

    Options array passed to the species grid.

    $occAttrControls

    array

    List of the occurrence attribute controls, keyed by attribute ID.

    $attributes

    array

    List of attribute definitions loaded from the database.

    Retrieve the grid header row for the species checklist grid control.

    get_species_checklist_header(array $options, array $occAttrs) : string
    Static

    Parameters

    $options

    array

    Control options array.

    $occAttrs

    array

    Array of custom attributes included in the grid.

    Returns

    stringHtml for the element.

    Internal method to prepare the options array for a species_checklist control.

    get_species_checklist_options(array $options) : array
    Static

    Parameters

    $options

    array

    Options array passed to the control

    Returns

    arrayOptions array prepared with defaults and other values required by the control.

    Returns an array defining various database object names and values required for the species lookup filtering, depending on whether this is a cached lookup or a standard lookup.

    get_species_lookup_db_definition(boolean $cached) 

    Used for both species checklist and species autocompletes.

    Parameters

    $cached

    boolean

    Set to true to use the cached taxon search tables rather than standard taxa in taxon list views.

    Builds an array to filter for the appropriate selection of species names, e.g.

    get_species_names_filter(array $options) 
    Static

    how it accepts searches for common names and synonyms.

    Parameters

    $options

    array

    Options array as passed to the species grid.

    Utility function to load a list of terms from a termlist.

    get_termlist_terms(array $auth, mixed $termlist, array $filter) : array
    InheritedStatic
    inherited_from \helper_base::get_termlist_terms()

    Parameters

    $auth

    array

    Read authorisation array.

    $termlist

    mixed

    Either the id or external_key of the termlist to load.

    $filter

    array

    List of the terms that are required, or null for all terms.

    Returns

    arrayOutput of the Warehouse data services request for the terms.

    Calculates the folder that submitted images end up in according to the helper_config.

    get_uploaded_image_folder() 
    Static

    Helper function to output an HTML hidden text input.

    hidden_text(array $options) : string
    Static

    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:

    • hidden_text
      HTML template used to generate the hidden input element.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.

    Returns

    stringHTML to insert into the page for the hidden text control.

    A version of the select control which supports hierarchical termlist data by adding new selects to the next line populated with the child terms when a parent term is selected.

    hierarchical_select(array $options) 
    Static

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • *
    • table
      Table name to get data from for the select options. Should be termlists_term for termlist data.
    • report
      Report name to get data from for the select options if the select is being populated by a service call using a report. Mutually exclusive with the table option. The report should return a parent_id field.
    • captionField
      Field to draw values to show in the control from if the select is being populated by a service call.
    • valueField
      Field to draw values to return from the control from if the select is being populated by a service call. Defaults to the value of captionField.
    • extraParams
      Optional. Associative array of items to pass via the query string to the service. This should at least contain the read authorisation array if the select is being populated by a service call. It can also contain view=cache to use the cached termlists entries or view=detail for the uncached version.

    The output of this control can be configured using the following templates:

    • select
      Template used for the HTML select element.
    • select_item
      Template used for each option item placed within the select element.
    • hidden_text
      HTML used for a hidden input that will hold the value to post to the database.

    Sends a POST using the cUrl library.

    http_post(string $url, string $postargs, boolean $output_errors) : array
    InheritedStatic
    inherited_from \helper_base::http_post()

    Parameters

    $url

    string

    The URL the POST request is sent to.

    $postargs

    string

    Arguments to include in the POST data.

    $output_errors

    boolean

    Set to false to prevent echoing of errors. Defaults to true.

    Returns

    arrayAn 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).

    Simple file upload control suitable for uploading images to attach to occurrences.

    image_upload(array $options) : string
    Static

    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:

    • image_upload
      HTML template for the file input control.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to, e.g. occurrence:image.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • class
      Optional. CSS class names to add to the control.

    Returns

    stringHTML to insert into the page for the file upload control.

    A control for building JSON strings, based on http://robla.net/jsonwidget/.

    jsonwidget(array $options) : \HTML
    Static

    Dynamically generates an input form for the JSON depending on a defined schema. This control is not normally used for typical Indicia forms, but is used by the prebuilt forms parameter entry forms for complex parameter structures such as the options available for a chart.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      The name of the database or form parameter field this control is bound to, e.g. series_options.
    • if The HTML id of the output div.
    • schema Must be supplied with a schema string that defines the allowable structure of the JSON output. Schemas can be automatically built using the schema generator at http://robla.net/jsonwidget/example.php?sample=byexample

    Returns

    \HTMLstring to insert in the form.

    Helper function to list the output from a request against the data services, using an HTML template for each item.

    list_in_template(array $options) : string
    Static

    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'=>'
  • |title|
  • ' ));

    The output of this control can be configured using the following templates:

    • list_in_template
      HTML template used to generate the outer container.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • class
      Optional. CSS class names to add to the control.
    • table
      Required. Table name to get data from for the select options.
    • extraParams
      Optional. Associative array of items to pass via the query string to the service. This should at least contain the read authorisation array.
    • template
      Required. HTML template which will be emitted for each item. Fields from the data are identified by wrapping them in ||. For example, |term| would result in the field called term's value being placed inside the HTML.
    • cachetimeout
      Optional. Specifies the number of seconds before the data cache times out - i.e. how long after a request for data to the Indicia Warehouse before a new request will refetch the data, rather than use a locally stored (cached) copy of the previous request. This speeds things up and reduces the loading on the Indicia Warehouse. Defaults to the global website-wide value: if this is not specified then 1 hour.

    Returns

    stringHTML to insert into the page for the generated list.

    An HTML list box control.

    listbox(array $options) : string
    Static

    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:

    • listbox
      HTML template used to generate the select element.
    • listbox_item
      HTML template used to generate each option element with the select element.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • table
      Table name to get data from for the select options if the select is being populated by a service call.
    • captionField
      Field to draw values to show in the control from if the select is being populated by a service call.
    • valueField
      Field to draw values to return from the control from if the select is being populated by a service call. Defaults to the value of captionField.
    • extraParams
      Optional. Associative array of items to pass via the query string to the service. This should at least contain the read authorisation array if the select is being populated by a service call.
    • lookupValues
      If the select is to be populated with a fixed list of values, rather than via a service call, then the values can be passed into this parameter as an associated array of key=>caption.
    • size
      Optional. Number of lines to display in the listbox. Defaults to 3.
    • multiselect
      Optional. Allow multi-select in the list box. Defaults to false.
    • parentControlId}
      Optional. Specifies a parent control for linked lists. If specified then this control is not populated until the parent control's value is set. The parent control's value is used to filter this control's options against the field specified by filterField.
    • parentControlLabel
      Optional. Specifies the label of the parent control in a set of linked lists. This allows the child list to display information about selecting the parent first.
    • filterField
      Optional. Specifies the field to filter this control's content against when using a parent control value to set up linked lists. Defaults to parent_id though this is not active unless a parentControlId is specified.
    • cachetimeout
      Optional. Specifies the number of seconds before the data cache times out - i.e. how long after a request for data to the Indicia Warehouse before a new request will refetch the data, rather than use a locally stored (cached) copy of the previous request. This speeds things up and reduces the loading on the Indicia Warehouse. Defaults to the global website-wide value: if this is not specified then 1 hour.
    • template
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for the outer control.
    • itemTemplate
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for each item in the control.
    • captionTemplate
      Optional and only relevant when loading content from a data service call. Specifies the template used to build the caption, with each database field represented as {fieldname}.
    • listCaptionSpecialChars
      Optional and only relevant when loading content from a data service call. Specifies whether to run the caption through htmlspecialchars. In some cases there may be format info in the caption, and in others we may wish to keep those characters as literal.
    • selectedItemTemplate
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for the selected item in the control.

    Returns

    stringHTML to insert into the page for the listbox control.

    Method which populates data_entry_helper::$entity_to_load with the values from an existing record.

    load_existing_record(array $readAuth, string $entity, integer $id, string $view, boolean $sharing) 
    Static

    Useful when reloading data to edit.

    link https://indicia-docs.readthedocs.org/en/latest/administrating/warehouse/website-agreements.html

    Parameters

    $readAuth

    array

    Read authorisation tokens

    $entity

    string

    Name of the entity to load data from.

    $id

    integer

    ID of the database record to load

    $view

    string

    Name of the view to load attributes from, normally 'list' or 'detail'.

    $sharing

    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.

    Allows the demarcation of the end of a region of the page HTML to be declared which will be replaced by a loading message whilst the page is loading.

    loading_block_end() : string
    Static

    Returns

    stringHTML 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.

    <p>Allows the demarcation of the start of a region of the page HTML to be declared which will be replaced by a loading message whilst the page is loading.</p> <p>If JavaScript is disabled then this has no effect.

    loading_block_start() : string
    Static

    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.

    Returns

    stringHTML 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.

    Outputs an autocomplete control that is dedicated to listing locations and which is bound to any map panel added to the page.

    location_autocomplete(array $options) : string
    Static

    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:

    • autocomplete
      Defines a hidden input and a visible input, to hold the underlying database ID and to allow input and display of the text search string respectively.
    • autocomplete_javascript
      Defines the JavaScript which will be inserted onto the page in order to activate the autocomplete control.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Optional. The name of the database field this control is bound to.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • extraParams
      Required. Associative array of items to pass via the query string to the service. This should at least contain the read authorisation array.
    • cachetimeout
      Optional. Specifies the number of seconds before the data cache times out - i.e. how long after a request for data to the Indicia Warehouse before a new request will refetch the data, rather than use a locally stored (cached) copy of the previous request. This speeds things up and reduces the loading on the Indicia Warehouse. Defaults to the global website-wide value: if this is not specified then 1 hour.
    • useLocationName Optional. If true, then inputting a place name which does not match to an existing place gets stored in the location_name field. Defaults to false.
    • searchUpdatesSref Optional. If true, then when a location is found in the autocomplete, the location's centroid spatial reference is loaded into the spatial_ref control on the form if any exists. Defaults to false.
    • allowcreate Optional. If true, if the user has typed in a non-existing location name and also supplied a spatial reference, a button is displayed which lets them save a location for future personal use. Defaults to false. For this to work, you must either allow the standard Indicia code to handle the submission for you, or your code must handle the presence of a value called save-site-flag in the form submission data and if true, it must first save the site information to the locations table database then attach the location_id returned to the submitted sample data.

    Returns

    stringHTML to insert into the page for the location select control.

    Outputs a select control that is dedicated to listing locations and which is bound to any map panel added to the page.

    location_select(array $options) : string
    Static

    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.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Optional. The name of the database field this control is bound to.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • extraParams
      Required. Associative array of items to pass via the query string to the service. This should at least contain the read authorisation array.
    • cachetimeout
      Optional. Specifies the number of seconds before the data cache times out - i.e. how long after a request for data to the Indicia Warehouse before a new request will refetch the data, rather than use a locally stored (cached) copy of the previous request. This speeds things up and reduces the loading on the Indicia Warehouse. Defaults to the global website-wide value: if this is not specified then 1 hour.
    • searchUpdatesSref Optional. If true, then when a location is selected, the location's centroid spatial reference is loaded into the spatial_ref control on the form if any exists. Defaults to false.

    The output of this control can be configured using the following templates:

    • select
      HTML template used to generate the select element.
    • select_item
      HTML template used to generate each option element with the select element.

    Returns

    stringHTML to insert into the page for the location select control.

    Generates a map control, with optional data entry fields and location finder powered by the Yahoo! geoservices API.

    map(array $options) 
    Static

    This is just a shortcut to building a control using a map_panel and the associated controls.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • presetLayers
      Array of preset layers to include. Options are 'google_physical', 'google_streets', 'google_hybrid', 'google_satellite', 'openlayers_wms', 'nasa_mosaic', 'virtual_earth' (deprecated, use bing_aerial), 'bing_aerial', 'bing_hybrid, 'bing_shaded', 'multimap_default', 'multimap_landranger', 'osm' (for OpenStreetMap), 'osm_th' (for OpenStreetMap Tiles@Home).
    • edit
      True or false to include the edit controls for picking spatial references.
    • locate
      True or false to include the geolocate controls.
    • wkt
      Well Known Text of a spatial object to add to the map at startup.
    • tabDiv
      If the map is on a tab or wizard interface, specify the div the map loads on.

    The output of this control can be configured using the following templates:

    • georeference_lookup
      Template which outputs the HTML for the georeference search input, button placehold and container for the list of search results. The default template uses JavaScript to write the output, so that this control is removed from the page if JavaScript is disabled as it will have no functionality.
    • button
      HTML template for the buttons used for the georeference_lookup.
    • sref_textbox
      HTML template for the spatial reference input control.
    • sref_textbox_latlong
      HTML template for the spatial reference input control used when inputting latitude and longitude into separate inputs.
    • select
      HTML template used by the select control for picking a spatial reference system, if there is one.
    • select_item
      HTML template used by the option items in the select control for picking a spatial reference system, if there is one.

    Outputs a map panel.

    map_panel(array $options, array $olOptions) 
    Static
    deprecated Use map_helper::map_panel instead.

    Parameters

    $options

    array

    Refer to map_helper::map_panel documentation.

    $olOptions

    array

    Refer to map_helper::map_panel documentation.

    Applies a output template to an array.

    mergeParamsIntoTemplate(array $params, string $template, boolean $useTemplateAsIs, boolean $allowHtml, boolean $allowEscapeQuotes) : string
    InheritedStatic

    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()

    Parameters

    $params

    array

    Array holding the parameters to merge into the template.

    $template

    string

    Name of the template to use, or actual template text if $useTemplateAsIs is set to true.

    $useTemplateAsIs

    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.

    $allowHtml

    boolean

    If true then HTML is emitted as is from the parameter values inserted into the template, otherwise they are escaped.

    $allowEscapeQuotes

    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.

    Returns

    stringHTML for the item label

    Helper function to output an attribute.

    outputAttribute(array $item, array $options) : string
    Static
    todo full handling of the control_type. Only works for text data at the moment.

    Parameters

    $item

    array

    Attribute definition as returned by a call to getAttributes. The caption of the attribute will be translated then output as the label.

    $options

    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.

    Returns

    stringHTML to insert into the page for the control.

    Helper function to output an HTML password input.

    password_input(array $options) : string
    Static

    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:

    • password_input
      Template which outputs the HTML for a password input control.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name by which the password will be passed to the authentication system.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • class
      Optional. CSS class names to add to the control.

    Returns

    stringHTML to insert into the page for the text input control.

    Helper function to output a textbox for determining a locality from an entered postcode.

    postcode_textbox(array $options) : string
    Static

    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>

  • postcode_textbox
    Template which outputs the HTML for the text input control used. Must have an onblur event handler which calls the JavaScript required to search for the post code.
  • Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to.
    • id
      Optional. The id to assign to the HTML control. This should be left to its default value for integration with other mapping controls to work correctly.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • hiddenFields
      Optional. Set to true to insert hidden inputs to receive the latitude and longitude. Otherwise there should be separate sref_textbox and sref_system_textbox controls elsewhere on the page. Defaults to true.
    • srefField
      Optional. Name of the spatial reference hidden field that will be output by this control if hidddenFields is true.
    • systemField
      Optional. Name of the spatial reference system hidden field that will be output by this control if hidddenFields is true.
    • linkedAddressBoxId
      Optional. Id of the separate textarea control that will be populated with an address when a postcode is looked up.

    Returns

    stringHTML to insert into the page for the postcode control.

    Normally, the species checklist will handle loading the list of occurrences from the database automatically.

    preload_species_checklist_occurrences(int $sampleId, array $readAuth, boolean $loadImages, boolean $extraParams) : array
    Static

    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.

    Parameters

    $sampleId

    int

    ID of the sample to load

    $readAuth

    array

    Read authorisation array

    $loadImages

    boolean

    If set to true, then image information is loaded as well.

    $extraParams

    boolean

    Extra params to pass to the web service call for filtering.

    Returns

    arrayArray with key of occurrence_id and value of $taxonInstance.

    Helper function to generate a radio group from a Indicia core service query.

    radio_group(array $options) : string
    Static

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • table
      Optional. Table name to get data from for the select options. Required unless lookupValues is specified.
    • captionField
      Optional. Field to draw values to show in the control from. Required unless lookupValues is specified.
    • valueField
      Optional. Field to draw values to return from the control from. Defaults to the value of captionField.
    • extraParams
      Optional. Associative array of items to pass via the query string to the service. This should at least contain the read authorisation array.
    • lookupValues
      If the group is to be populated with a fixed list of values, rather than via a service call, then the values can be passed into this parameter as an associated array of key=>caption.
    • cachetimeout
      Optional. Specifies the number of seconds before the data cache times out - i.e. how long after a request for data to the Indicia Warehouse before a new request will refetch the data, rather than use a locally stored (cached) copy of the previous request. This speeds things up and reduces the loading on the Indicia Warehouse. Defaults to the global website-wide value: if this is not specified then 1 hour.
    • template
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for the outer control.
    • itemTemplate
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for each item in the control.
    • captionTemplate
      Optional and only relevant when loading content from a data service call. Specifies the template used to build the caption, with each database field represented as {fieldname}.

    The output of this control can be configured using the following templates:

    • check_or_radio_group
      Container element for the group of checkboxes.
    • check_or_radio_group_item
      Template for the HTML element used for each item in the group.

    Returns

    stringHTML to insert into the page for the group of radio buttons.

    Calculates the relative path to the client_helpers folder from wherever the current PHP script is.

    relative_client_helper_path() 
    InheritedStatic
    inherited_from \helper_base::relative_client_helper_path()

    While cookies may be offered for the convenience of clients, an option to prevent the saving of personal data should also be present.

    remembered_fields_optin(array $options) : string
    Static

    Helper function to output an HTML checkbox control. Defaults to false unless values are loaded from cookie.

    Parameters

    $options

    array

    Options array with the following possibilities:

      record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • template
      Optional. Name of the template entry used to build the HTML for the control. Defaults to checkbox.

    Returns

    stringHTML to insert into the page for the cookie optin control.

    Outputs a chart that loads the content of a report or Indicia table.

    report_chart(array $options) 
    Static
    deprecated Use report_helper::report_chart.

    Parameters

    $options

    array

    Refer to report_helper::report_chart documentation.

    Outputs a grid that loads the content of a report or Indicia table.

    report_grid(array $options) 
    Static
    deprecated Use report_helper::report_grid.

    Parameters

    $options

    array

    Refer to report_helper::report_grid documentation.

    Helper function to generate a select control from a Indicia core service query.

    select(array $options) : string
    Static

    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:

    • select
      HTML template used to generate the select element.
    • select_item
      HTML template used to generate each option element with the select elements.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • *
    • table
      Table name to get data from for the select options if the select is being populated by a service call.
    • report
      Report name to get data from for the select options if the select is being populated by a service call using a report. Mutually exclusive with the table option.
    • captionField
      Field to draw values to show in the control from if the select is being populated by a service call.
    • valueField
      Field to draw values to return from the control from if the select is being populated by a service call. Defaults to the value of captionField.
    • extraParams
      Optional. Associative array of items to pass via the query string to the service. This should at least contain the read authorisation array if the select is being populated by a service call.
    • lookupValues
      If the select is to be populated with a fixed list of values, rather than via a service call, then the values can be passed into this parameter as an associated array of key=>caption.
    • parentControlId
      Optional. Specifies a parent control for linked lists. If specified then this control is not populated until the parent control's value is set. The parent control's value is used to filter this control's options against the field specified by filterField.
    • parentControlLabel
      Optional. Specifies the label of the parent control in a set of linked lists. This allows the child list to display information about selecting the parent first.
    • filterField
      Optional. Specifies the field to filter this control's content against when using a parent control value to set up linked lists. Defaults to parent_id though this is not active unless a parentControlId is specified.
    • cachetimeout
      Optional. Specifies the number of seconds before the data cache times out - i.e. how long after a request for data to the Indicia Warehouse before a new request will refetch the data, rather than use a locally stored (cached) copy of the previous request. This speeds things up and reduces the loading on the Indicia Warehouse. Defaults to the global website-wide value: if this is not specified then 1 hour.
    • blankText
      Optional. If specified then the first option in the drop down is the blank text, used when there is no value.
    • template
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for the outer control.
    • itemTemplate
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for each item in the control.
    • captionTemplate
      Optional and only relevant when loading content from a data service call. Specifies the template used to build the caption, with each database field represented as {fieldname}.
    • listCaptionSpecialChars
      Optional and only relevant when loading content from a data service call. Specifies whether to run the caption through htmlspecialchars. In some cases there may be format info in the caption, and in others we may wish to keep those characters as literal.
    • selectedItemTemplate
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for the selected item in the control.

    Returns

    stringHTML code for a select control.

    Accessor to set the list of remembered fields.

    set_remembered_fields(\$arr $arr) 
    Static

    Should only be called by the hook method indicia_define_remembered_fields.

    see \global\get_rememebered_fields

    Parameters

    $arr

    \$arr

    Array of field names

    If required, setup jQuery validation.

    setup_jquery_validation_js() 
    InheritedStatic

    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()

    A version of the autocomplete control preconfigured for species lookups.

    species_autocomplete(\type $options) : string

    The output of this control can be configured using the following templates:

    • autocomplete
      Defines a hidden input and a visible input, to hold the underlying database ID and to allow input and display of the text search string respectively.
    • autocomplete_javascript
      Defines the JavaScript which will be inserted onto the page in order to activate the autocomplete control.

    Parameters

    $options

    \type

    Array of configuration options with the following possible entries.

    • cacheLookup Defaults to false. Set to true to lookup species against cache_taxon_searchterms rather than detail_taxa_taxon_lists.
    • speciesNameFilterMode
      Optional. Method of filtering the available species names (both for initial population into the grid and additional rows). Options are preferred - only preferred names currentLanguage - only names in the language identified by the language option are included excludeSynonyms - all names except synonyms (non-preferred latin names) are included.
    • extraParams Should contain the read authorisation array and taxon_list_id to filter against.
    • warnIfNoMatch Should the autocomplete control warn the user if they leave the control whilst searching and then nothing is matched? Default true.

    Returns

    stringHtml for the species autocomplete control.

    Helper function to generate a species checklist from a given taxon list.

    species_checklist(array $options) : string
    Static

    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.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • listId
      Optional. The ID of the taxon_lists record which is to be used to obtain the species or taxon list. This is required unless lookupListId is provided.
    • occAttrs
      Optional integer array, where each entry corresponds to the id of the desired attribute in the occurrence_attributes table. If omitted, then all the occurrence attributes for this survey are loaded.
    • occAttrClasses
      String array, where each entry corresponds to the css class(es) to apply to the corresponding attribute control (i.e. there is a one to one match with occAttrs). If this array is shorter than occAttrs then all remaining controls re-use the last class.
    • extraParams
      Associative array of items to pass via the query string to the service calls used for taxon names lookup. This should at least contain the read authorisation array.
    • lookupListId
      Optional. The ID of the taxon_lists record which is to be used to select taxa from when adding rows to the grid. If specified, then an autocomplete text box and Add Row button are generated automatically allowing the user to pick a species to add as an extra row.
    • cacheLookup
    • Optional. Set to true to select to use a cached version of the lookup list when searching for species names using the autocomplete control, or set to false to use the live version (default). The latter is slower and places more load on the warehouse so should only be used during development or when there is a specific need to reflect taxa that have only just been added to the list.
    • taxonFilterField
      If the list of species to be made available for recording is to be limited (either by species or taxon group), allows selection of the field to filter against. Options are none (default), preferred_name, taxon_meaning_id, taxon_group. If filtering for a large list of taxa then taxon_meaning_id is more efficient.
    • taxonFilter
      If taxonFilterField is not set to none, then pass an array of values to filter against, i.e. an array of taxon preferred names, taxon meaning ids or taxon group titles.
    • usersPreferredGroups
      If the user has defined a list of taxon groups they like to record, then supply an array of the taxon group IDs in this parameter. This lets the user easily opt to record against their chosen groups.
    • userControlsTaxonFilter
      If set to true, then a filter button in the title of the species input column allows the user to configure the filter applied to which taxa are available to select from, e.g. which taxon groups can be picked from. Only applies when lookupListId is set.
    • speciesNameFilterMode
      Optional. Method of filtering the available species names (both for initial population into the grid and additional rows). Options are preferred - only preferred names currentLanguage - only names in the language identified by the language option are included excludeSynonyms - all names except synonyms (non-preferred latin names) are included.
    • header
      Include a header row in the grid? Defaults to true.
    • columns
      Number of repeating columns of output. For example, a simple grid of species checkboxes could be output in 2 or 3 columns. Defaults to 1.
    • rowInclusionCheck
      Defines how the system determines whether a row in the grid actually contains an occurrence or not. There are 4 options:
      checkbox - a column is included in the grid containing a presence checkbox. If checked then an occurrence is created for the row. This is the default unless listId is not set.
      alwaysFixed - occurrences are created for all rows in the grid. Rows cannot be removed from the grid apart from newly added rows.
      alwaysRemovable - occurrences are created for all rows in the grid. Rows can always be removed from the grid. Best used with no listId so there are no default taxa in the grid, otherwise editing an existing sample will re-add all the existing taxa. This is the default when listId is not set, but lookupListId is set.
      hasData - occurrences are created for any row which has a data value specified in at least one of its columns.
      This option supercedes the checkboxCol option which is still recognised for backwards compatibility.
    • class
      Optional. CSS class names to add to the control.
    • cachetimeout
      Optional. Specifies the number of seconds before the data cache times out - i.e. how long after a request for data to the Indicia Warehouse before a new request will refetch the data, rather than use a locally stored (cached) copy of the previous request. This speeds things up and reduces the loading on the Indicia Warehouse. Defaults to the global website-wide value: if this is not specified then 1 hour.
    • survey_id
      Optional. Used to determine which attributes are valid for this website/survey combination
    • occurrenceComment
      Optional. If set to true, then an occurrence comment input field is included on each row.
    • occurrenceConfidential
      Optional. If set to true, then an occurrence confidential checkbox is included on each row.
    • occurrenceImages
      Optional. If set to true, then images can be uploaded for each occurrence row. Currently not supported for multi-column grids.
    • resizeWidth
      If set, then the image files will be resized before upload using this as the maximum pixels width.
    • resizeHeight
      If set, then the image files will be resized before upload using this as the maximum pixels height.
    • resizeQuality
      Defines the quality of the resize operation (from 1 to 100). Has no effect unless either resizeWidth or resizeHeight are non-zero.
    • colWidths
      Optional. Array containing percentage values for each visible column's width, with blank entries for columns that are not specified. If the array is shorter than the actual number of columns then the remaining columns use the default width determined by the browser.
    • attrCellTemplate
      Optional. If specified, specifies the name of the template (in global $indicia_templates) to use for each cell containing an attribute input control. Valid replacements are {label}, {class} and {content}. Default is attribute_cell.
    • language
      Language used to filter lookup list items in attributes. ISO 639:3 format.
    • PHPtaxonLabel
    • If set to true, then the taxon_label template should contain a PHP statement that returns the HTML to display for each taxon's label. Otherwise the template should be plain HTML. Defaults to false.
    • useLoadedExistingRecords
    • Optional. Defaults to false. Set to true to prevent a grid from making a web service call to load existing occurrence data when reloading a sample. This can be useful if there are more than one species checklist on the page such as when species input is split across several tabs - the first can load all the data and subsequent grids just display the appropriate records depending on the species they are configured to show.
    • reloadExtraParams
    • Set to an array of additional parameters such as filter criteria to pass to the service request used to load existing records into the grid when reloading a sample. Especially useful when there are more than one species checklist on a single form, so that each grid can display the appropriate output.
    • subSpeciesColumn If true and doing grid based data entry with lookupListId set so allowing the recorder to add species they choose to the bottom of the grid, subspecies will be displayed in a separate column so the recorder picks the species first then the subspecies. The species checklist must be configured as a simple 2 level list so that species are parents of the subspecies. For performance reasons, this option forces the cacheLookup option to be set to true therefore it requires the cache_builder module to be running on the warehouse. Defaults to false.
    • subSpeciesRemoveSspRank Set to true to force the displayed subspecies names to remove the rank (var., forma, ssp) etc. Useful if all subspecies are the same rank.

    The output of this control can be configured using the following templates:

    • file_box
      When image upload for records is enabled, outputs the HTML container which will contain the upload button and images.
    • file_box_initial_file_info
      When image upload for records is enabled, this template provides the HTML for the outer container for each displayed image, including the header and remove file button. Has an element with class set to photo-wrapper into which images themselves will be inserted.
    • file_box_uploaded_image
      Template for the HTML for each uploaded image, including the image, caption input and hidden inputs to define the link to the database. Will be inserted into the file_box_initial_file_info template's photo-wrapper element.
    • taxon_label_cell
      Generates the label shown for the taxon name for each added row.
    • format_species_autocomplete_fn
      Can be set to an optional JavaScript function which formats the contents of the species autocomplete's search list items.
    • taxon_label
      If format_species_autocomplete_fn is not set, then this provides an HTML template for the contents of the species autocomplete's search list items.
    • attribute_cell
      HTML wrapper for cells containing attribute inputs.

    Returns

    stringHTML for the species checklist input grid.

    Internal function to prepare the list of occurrence attribute columns for a species_checklist control.

    species_checklist_prepare_attributes(array $options, array $attributes, array $occAttrControls, array $occAttrs) 
    Static

    Parameters

    $options

    array

    Options array as passed to the species checklist grid control.

    $attributes

    array

    Array of custom attributes as loaded from the database.

    $occAttrControls

    array

    Empty array which will be populated with the controls required for each custom attribute.

    $occAttrs

    array

    Empty array which will be populated with the captions for each custom attribute.

    Outputs a spatial reference input box and a drop down select control populated with a list of spatial reference systems for the user to select from.

    sref_and_system(array $options) : string
    Static

    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:

    • sref_textbox
      Template used for the text input box for the spatial reference.
    • sref_textbox_latlong
      Template used for the latitude and longitude input boxes when the splitLatLong option is set to true.
    • select
      Template used for the select element which contains the spatial reference system options available for input.
    • select_item
      Template used for the option elements in the select list of spatial reference system options available for input.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. Name of the database field that spatial reference will be posted to. Defaults to sample:entered_sref. The system field is automatically constructed from this.
    • systems Optional. List of spatial reference systems to display. Associative array with the key being the EPSG code for the system or the notation abbreviation (e.g. OSGB), and the value being the description to display.
    • defaultSystem Optional. Code for the default system value to load.
    • defaultGeom Optional. WKT value for the default geometry to load (hidden).

    Returns

    stringHTML to insert into the page for the spatial reference and system selection control.

    Outputs hidden controls for entered_sref and sref_system.

    sref_hidden(array $options) : string
    Static

    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:

    • hidden_input
      Template used for the hidden text HTML element.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldame
      Required. The name of the database field the sref control is bound to. Defaults to sample:entered_sref. The system field and geom field is automatically constructed from this.
    • default
      Optional. The default spatial reference to assign to the control. This is overridden when reloading a record with existing data for this control.
    • defaultSys
      Optional. The default spatial reference system to assign to the control. This is overridden when reloading a record with existing data for this control.

    Returns

    stringHTML to insert into the page for the location sref control.

    Outputs a drop down select control populated with a list of spatial reference systems for the user to select from.

    sref_system_select(array $options) : string
    Static

    The output of this control can be configured using the following templates:

    • select
      Template used for the select element which contains the spatial reference system options available for input.
    • select_item
      Template used for the option elements in the select list of spatial reference system options available for input.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to. Defaults to sample:entered_sref_system.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • systems Optional. List of spatial reference systems to display. Associative array with the key being the EPSG code for the system or the notation abbreviation (e.g. OSGB), and the value being the description to display.

    Returns

    stringHTML to insert into the page for the spatial reference systems selection control.

    Creates a textbox for entry of a spatial reference.

    sref_textbox(array $options) : string
    Static

    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:

    • sref_textbox
      Template used for the text input box for the spatial reference.
    • sref_textbox_latlong
      Template used for the latitude and longitude input boxes when the splitLatLong option is set to true.
    todo This does not work for reloading data at the moment, when using split lat long mode.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldName
      Required. The name of the database field this control is bound to. Defaults to sample:entered_sref.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • defaultGeom
      Optional. The default geom (wkt) to store in a hidden input posted with the form data.
    • class
      Optional. CSS class names to add to the control.
    • splitLatLong
      Optional. If set to true, then 2 boxes are created, one for the latitude and one for the longitude.
    • geomFieldname
      Optional. Fieldname to use for the geom (table:fieldname format) where the geom field is not just called geom, e.g. location:centroid_geom.

    Returns

    stringHTML to insert into the page for the spatial reference control.

    Helper function to generate a sub list UI control.

    sub_list(array $options) : string
    Static

    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.

    Parameters

    $options

    array

    (deprecated argument list not supported). Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to. This must be a custom attributes field of type integer which supports multiple values
    • table
      Required. Table name to get data from for the autocomplete options. The control will use the captionField from this table
    • captionField
      Required if addToTable is false. Field to draw values from to show in the control from. If addToTable is true, this setting will be ignored and 'caption' will always be used.
    • extraParams
      Required. Associative array of items to pass via the query string to the service. This should at least contain the read authorisation array.
    • id
      Optional. The id to assign to the HTML control. Base value defaults to fieldname, but this is a compound control and the many sub-controls have id values with additiobnal suffixes.
    • default
      Optional. An associative array of default keys and captions. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • numValues
      Optional. Number of returned values in the drop down list. Defaults to 10.
    • hide
      Optional. Mixed, controls how quickly the add bar is hidden. May be 'slow', 'normal', 'fast', a number (in milliseconds) or 'none'. The latter indicates the add bar should not be hideable. Defaults to 'normal'.
    • addOnSelect TODO
      Optional. Boolean, if true, matched items from the autocomplete control are automatically added to the list when selected. Defaults to false.
    • addToTable
      Optional. Boolean, if false, only existing items from the table can be selected, and no rows can be added. The control then acts like a multi-value autocomplete and submits a list of ID values for the chosen items. If true, the control allows new values to be added and inserts them into the source table. Defaults to true.

    The output of this control can be configured using the following templates:

    • sub_list
      Defines the search input, plus container element for the list of items which will be added.
    • sub_list_item
      Defines the template for a single item added to the list.
    • sub_list_add
      Defines hidden inputs to insert onto the page which contain the items to add to the sublist, when loading existing records.
    • sub_list_javascript
      Defines the JavaScript added to the page to implement the click handling for the various butons.

    Returns

    stringHTML to insert into the page for the sub_list control.

    Output a DIV which lists configuration problems and is useful for diagnostics.

    system_check(boolean $fullInfo) 
    Static

    Currently, tests the PHP version and that the cUrl library is installed.

    Parameters

    $fullInfo

    boolean

    If true, then successful checks are also output.

    Outputs the ul element that needs to go inside a tabified div control to define the header tabs.

    tab_header(array $options) 
    Static

    This is required for wizard interfaces as well.

    Parameters

    $options

    array

    Options array with the following possibilities:

    <

    ul>

  • tabs
    Array of tabs, with each item being the tab title, keyed by the tab ID including the #.
  • Insert a button which, when clicked, displays the previous tab.

    tab_prev_button(array $options) 
    Static

    Insert this inside the tab divs on each tab you want to have a next button, excluding the first tab.

    link http://docs.jquery.com/UI/Tabs

    Parameters

    $options

    array

    Options array with the following possibilities:

    <

    ul>

  • divId
    The id of the div which is tabbed and whose next tab should be selected.
  • caption
    Optional. The untranslated caption of the button. Defaults to previous step.
  • Helper function to output an HTML text input.

    text_input(array $options) : string
    Static

    This includes re-loading of existing values and displaying of validation error messages.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • readonly
      Optional. can be set to 'readonly="readonly"' to set this control as read only.

    The output of this control can be configured using the following templates:

    • text_input
      HTML template used to generate the input element.

    Returns

    stringHTML to insert into the page for the text input control.

    Helper function to output an HTML textarea.

    textarea(array $options) : string
    Static

    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:

    • textareat
      HTML template used to generate the textarea element.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to, e.g. occurrence:image.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • rows
      Optional. HTML rows attribute. Defaults to 4.
    • cols
      Optional. HTML cols attribute. Defaults to 80.

    Returns

    stringHTML to insert into the page for the textarea control.

    A control for inputting a time value.

    time_input(array $options) 
    Static

    Provides a text input with a spin control that allows the time to be input. Reverts to a standard text input when JavaScript disabled.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to.
    • id
      Optional. The id to assign to the HTML control. If not assigned the fieldname is used.
    • default
      Optional. The default value to assign to the control. This is overridden when reloading a record with existing data for this control.
    • class
      Optional. CSS class names to add to the control.
    • beforeSetTime
      Optional. Set this to the name of a JavaScript function which is called when the user tries to set a time value. This can be used, for example, to display a warning label when an out of range time value is input. See jQuery Time Entry then click on the Restricting tab for more information.
    • timeSteps
      Optional. An array containing 3 values for the allowable increments in time for hours, minutes and seconds respectively. Defaults to 1, 15, 0 meaning that the increments allowed are in 15 minute steps and seconds are ignored.

    The output of this control can be configured using the following templates:

    • text_input
      HTML template used to generate the input element. Time management aspects of this are managed by JavaScript.

    Helper function to generate a browser control from a given list.

    tree_browser(array $options) 
    Static

    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:

    • tree_browser
      HTML template used to generate container element for the browser.
    • tree_browser_node
      HTML template used to generate each node that appears in the browser.

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to, for example 'occurrence:taxa_taxon_list_id'. NB the tree itself will have an id of "tr$fieldname".
    • id
      Optional. ID of the hidden input which contains the value. Defaults to the fieldname.
    • divId
      Optional. ID of the outer div. Defaults to div_ plus the fieldname.
    • table
      Required. Name (Kohana-style) of the database entity to be queried.
    • view
      Name of the view of the table required (list, detail).
    • captionField
      Field to draw values to show in the control from.
    • valueField
      Field to draw values to return from the control from. Defaults to the value of $captionField.
    • parentField
      Field used to indicate parent within tree for a record.
    • default
      Initial value to set the control to (not currently used).
    • extraParams
      Array of key=>value pairs which will be passed to the service as GET parameters. Needs to specify the read authorisation key/value pair, needed for making queries to the data services.
    • outerClass
      Class to be added to the control's outer div.
    • class
      Class to be added to the input control (hidden).
    • default
      Optional. The default value for the underlying control.

    TODO Need to do initial value.

    Helper function to generate a treeview from a given list

    treeview(array $options) 
    Static

    Parameters

    $options

    array

    Options array with the following possibilities:

    • fieldname
      Required. The name of the database field this control is bound to, for example 'occurrence:taxa_taxon_list_id'. NB the tree itself will have an id of "tr$fieldname".
    • id
      Optional. ID of the control. Defaults to the fieldname.
    • table
      Required. Name (Kohana-style) of the database entity to be queried.
    • view
      Name of the view of the table required (list, detail).
    • captionField
      Field to draw values to show in the control from.
    • valueField
      Field to draw values to return from the control from. Defaults to the value of $captionField.
    • parentField
      Field used to indicate parent within tree for a record.
    • default
      Initial value to set the control to (not currently used).
    • extraParams
      Array of key=>value pairs which will be passed to the service as GET parameters. Needs to specify the read authorisation key/value pair, needed for making queries to the data services.
    • extraClass
      main class to be added to UL tag - currently can be treeview, treeview-red, treeview_black, treeview-gray. The filetree class although present, does not work properly.

    TODO Need to do initial value.

    Outputs a panel and "Precheck my records" button.

    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:

    • verification_panel
      HTML template used to generate container element for the verification panel.
    global type $indicia_templates

    Parameters

    $options

    array

    Options array with the following possibilities:

    • readAuth
      Read authorisation tokens

  • panelOnly
    Default false. If true, then the button is ommited and the button's functionality must be included elsewhere on the page.
  • Returns

    \typeHTML to insert onto the page for the verification panel.

    Insert buttons which, when clicked, displays the next or previous tab.

    wizard_buttons(array $options) 
    Static

    Insert this inside the tab divs on each tab you want to have a next or previous button, excluding the last tab. The output of this control can be configured using the following templates:

    <

    ul>

  • button
    HTML template used for buttons other than the form submit button.
  • submit_button
    HTML template used for the submit button.
  • link http://docs.jquery.com/UI/Tabs

    Parameters

    $options

    array

    Options array with the following possibilities:

    • divId
      The id of the div which is tabbed and whose next tab should be selected.
    • captionNext
      Optional. The untranslated caption of the next button. Defaults to next step.
    • captionPrev
      Optional. The untranslated caption of the previous button. Defaults to prev step.
    • class
      Optional. Additional classes to add to the div containing the buttons. Use left, right or centre to position the div, making sure the containing element is either floated, or has overflow: auto applied to its style. Default is right.
    • buttonClass
      Class to add to the button elements.
    • page
      Specify first, middle or last to indicate which page this is for. Use middle (the default) for all pages other than the first or last.
    • includeVerifyButton Defaults to false. If set to true, then a Precheck my records button is added to the button set. There must be a verification_panel control added to the page somewhere with the panelOnly option set to true. When this button is clicked, the verification panel will be populated with the output of the automated verification check run against the proposed records on the form.

    Wraps an array (e.g.

    wrap(array $array, string $entity) 
    Static

    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.

    Parameters

    $array

    array

    Array of data generated from data entry controls.

    $entity

    string

    Name of the entity to wrap data for.

    Wraps data from a species checklist grid (generated by data_entry_helper::species_checklist) into a suitable format for submission.

    wrap_species_checklist(array $arr, boolean $include_if_any_data, array $zero_attrs, array $zero_values) 
    Static

    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.

    Parameters

    $arr

    array

    Array of data generated by data_entry_helper::species_checklist method.

    $include_if_any_data

    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.

    $zero_attrs

    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.

    $zero_values

    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').

    Wraps a set of values for a model into JSON suitable for submission to the Indicia data services, and also grabs the custom attributes (if there are any) and links them to the model.

    wrap_with_attrs(array $values, string $modelName) 
    Static
    deprecated

    Parameters

    $values

    array

    Array of form data (e.g. $_POST).

    $modelName

    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).

    Protected function to create a cache file provided it does not already exist.

    _cacheResponse(string $file, array $response, array $options) 
    InheritedStatic
    inherited_from \helper_base::_cacheResponse()

    Parameters

    $file

    string

    Cache file to be removed, includes path - will be false if no caching to take place

    $response

    array

    http_post return value

    $options

    array

    Options array : contents used to tag what this data is.

    Protected function to generate a filename to be used as the cache file for this data

    _getCacheFileName(string $path, array $options, \number $timeout) : string
    InheritedStatic
    inherited_from \helper_base::_getCacheFileName()

    Parameters

    $path

    string

    directory path for file

    $options

    array

    Options array : contents are used along with md5 to generate the filename.

    $timeout

    \number
    • will be false if no caching to take place

    Returns

    stringfilename, else FALSE if data is not to be cached.

    Protected function to fetch a validated timeout value from passed in options array

    _getCacheTimeOut(array $options) : \Timeout
    InheritedStatic
    inherited_from \helper_base::_getCacheTimeOut()

    Parameters

    $options

    array

    Options array with the following possibilities:

    • cachetimeout
      Optional. The length in seconds before the cache times out and is refetched.

    Returns

    \Timeoutin number of seconds, else FALSE if data is not to be cached.

    Protected function to return the cached data stored in the specified local file.

    _getCachedResponse(string $file, \number $timeout, array $options) : array
    InheritedStatic
    inherited_from \helper_base::_getCachedResponse()

    Parameters

    $file

    string

    Cache file to be used, includes path

    $timeout

    \number
    • will be false if no caching to take place

    $options

    array

    Options array : contents used to confirm what this data is.

    Returns

    arrayequivalent of call to http_post, else FALSE if data is not to be cached.

    Protected function to remove a cache file if it has timed out.

    _timeOutCacheFile(string $file, \number $timeout) 
    InheritedStatic
    inherited_from \helper_base::_timeOutCacheFile()

    Parameters

    $file

    string

    Cache file to be removed, includes path

    $timeout

    \number
    • will be false if no caching to take place

    Takes a template string (e.g.

    apply_replacements_to_template(string $template, string $options) 
    InheritedStatic

    <

    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()

    Parameters

    $template

    string

    The templatable string.

    $options

    string

    The array of items which can be merged into the template.

    Returns a static template which is either a default template or one specified in the options

    apply_static_template(string $name, array $options) : string
    InheritedStatic
    inherited_from \helper_base::apply_static_template()

    Parameters

    $name

    string

    The static template type. e.g. prefix or suffix.

    $options

    array

    Array of options which may contain a template name.

    Returns

    stringTemplate value.

    Converts the validation rules in an options array into a string that can be used as the control class, to trigger the jQuery validation plugin.

    build_validation_class(\$options. $options) : string
    InheritedStatic
    inherited_from \helper_base::build_validation_class()

    Parameters

    $options

    \$options.

    Control options array. For validation to be applied should contain a validation entry, containing a single validation string or an array of strings.

    Returns

    stringThe validation rules formatted as a class.

    Returns templated help text for a control, but only if the position matches the $helpTextPos value, and the $options array contains a helpText entry.

    get_help_text(array $options, string $pos) : string
    InheritedStatic
    inherited_from \helper_base::get_help_text()

    Parameters

    $options

    array

    Control's options array. Can specify the class for the help text item using option helpTextClass.

    $pos

    string

    Either before or after. Defines the position that is being requested.

    Returns

    stringTemplated help text, or nothing.

    Internal implementation of the dump_javascript method which takes the javascript and resources list as flexible parameters, rather that using the globals.

    internal_dump_resources(array $resources) 
    InheritedStatic
    access private
    inherited_from \helper_base::internal_dump_resources()

    Parameters

    $resources

    array

    List of resources to include.

    Returns a string where characters have been escaped for use in jQuery selectors

    jq_esc(string $name) : string
    InheritedStatic
    inherited_from \helper_base::jq_esc()

    Parameters

    $name

    string

    The string to be escaped.

    Returns

    stringescaped name.

    Takes a file that has been uploaded to the client website upload folder, and moves it to the warehouse upload folder using the data services.

    send_file_to_warehouse(string $path, boolean $persist_auth, array $readAuth, string $service) : string
    InheritedStatic
    inherited_from \helper_base::send_file_to_warehouse()

    Parameters

    $path

    string

    Path to the file to upload, relative to the interim image path folder (normally the client_helpers/upload folder.

    $persist_auth

    boolean

    Allows the write nonce to be preserved after sending the file, useful when several files are being uploaded.

    $readAuth

    array

    readAuth Read authorisation tokens, if not supplied then the $_POST array should contain them.

    $service

    string

    Path to the service URL used. Default is data/handle_media, but could be import/upload_csv.

    Returns

    stringError message, or true if successful.

    A custom PHP sorting function which uses the 2nd element in the compared array to sort by.

    DateCmp(int $a, int $b) 
    Static

    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.

    Parameters

    $a

    int

    Datestamp of the first file to compare.

    $b

    int

    Datestamp of the second file to compare.

    Internal function to ensure old cache files are purged periodically.

    _purgeCache() 
    Static

    Internal function to ensure old image files are purged periodically.

    _purgeImages() 
    Static

    Method to format a control error message inside a templated span.

    apply_error_template(string $error, string $fieldname) 
    InheritedStatic
    inherited_from \helper_base::apply_error_template()

    Parameters

    $error

    string

    The error message.

    $fieldname

    string

    The name of the field which the error is being attached to.

    When wrapping a species checklist submission, scan the contents of the data for a single grid row to look for attached images.

    attachOccurrenceImagesToModel(array $occ, array $record) 
    Static

    If found they are attached to the occurrence model as sub-models.

    Parameters

    $occ

    array

    Occurrence submission structure.

    $record

    array

    Record information from the form post, which may contain images.

    For a single sample or occurrence attribute array loaded from the database, find the appropriate default value depending on the data type.

    attributes_get_default(array $item) 
    Static
    todo Handle vague dates. At the moment we just use the start date.

    Parameters

    $item

    array

    The attribute's definition array.

    Returns the control required to implement a boolean custom attribute.

    boolean_attribute(string $ctrl, array $options) 
    Static

    Parameters

    $ctrl

    string

    The control type, should be radio or checkbox.

    $options

    array

    The control's options array.

    Checks a configuration setting in the helper_config.php file.

    check_config(string $name, boolean $isset, boolean $empty, array $missing_configs, array $blank_configs) 
    Static

    If it is missing or blank then it is added to an array so that the caller can decide what to do.

    Parameters

    $name

    string

    Name of the configuration parameter.

    $isset

    boolean

    Is the parameter set?

    $empty

    boolean

    Is the parameter empty?

    $missing_configs

    array

    Configuration settings that are missing are added to this array.

    $blank_configs

    array

    Configuration settings that are empty are added to this array.

    Checks that an Id is supplied, if not, uses the fieldname as the id.

    check_options(array $options) 
    Static

    Also checks if a captionField is supplied, and if not uses a valueField if available. Finally, gets the control's default value. If the control is set to be remembered, then adds it to the list of remembered fields.

    Parameters

    $options

    array

    Control's options array.

    Internal method to output either a checkbox group or a radio group.

    check_or_radio_group(array $options, string $type) 
    Static

    Parameters

    $options

    array

    Control options array

    $type

    string

    Name of the input element's type attribute, e.g. radio or checkbox.

    Utility method to convert a memory size string (e.g.

    convert_to_bytes(string $size) : integer
    Static

    1K, 1M) into the number of bytes.

    Parameters

    $size

    string

    Size string to convert. Valid suffixes as G (gigabytes), M (megabytes), K (kilobytes) or nothing.

    Returns

    integerNumber of bytes.

    When populating a list control (select, listbox, checkbox or radio group), use either the table, captionfield and valuefield to build the list of values as an array, or if lookupValues is in the options array use that instead of making a database call.

    get_list_items_from_options(array $options) : array
    Static

    Parameters

    $options

    array

    Options array for the control.

    Returns

    arrayAssociative array of the lookup values and captions.

    Returns a control to insert onto a parameters form.

    get_params_form_control(string $key, array $info, array $options, array $tools) : string
    InheritedStatic
    inherited_from \helper_base::get_params_form_control()

    Parameters

    $key

    string

    The unique identifier of this control.

    $info

    array

    Configuration options for the parameter as defined in the report, including the description, display (label), default and datatype.

    $options

    array

    Control options array

    $tools

    array

    Any tools to be embedded in the map toolbar are returned in this parameter rather than as the return result of the function.

    Returns

    stringThe HTML for the form parameter.

    Internal method to safely find the value of a preset parameter.

    get_preset_param(array $options, string $name) 
    InheritedStatic

    Returns empty string if not defined.

    inherited_from \helper_base::get_preset_param()

    Parameters

    $options

    array

    The options array, containing a presetParams entry that the parameter should be found in.

    $name

    string

    The key identifying the preset parameter to look for.

    Returns a th element for the top of a species checklist grid column.

    get_species_checklist_col_header(string $id, string $caption, integer $colIdx, array $colWidths, string $attrs) 
    Static

    Skips any columns which are display: none.

    Parameters

    $id

    string

    The HTML ID to use.

    $caption

    string

    The caption to insert.

    $colIdx

    integer

    The index of the current column. Incremented only if the header is output (so hidden columns are excluded).

    $colWidths

    array

    List of column percentage widths.

    $attrs

    string

    CSS attributes to attach.

    Private method to build the list of taxa to add to a species checklist grid.

    get_species_checklist_taxa_list(array $options, array $taxonRows) : array
    Static

    Parameters

    $options

    array

    Options array for the control

    $taxonRows

    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

    Returns

    arrayThe taxon list to use in the grid.

    Includes any spatial reference handler JavaScript files that exist for the codes selected for picking spatial references.

    include_sref_handler_js(array $systems) 
    Static

    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.

    Parameters

    $systems

    array

    List of spatial reference system codes.

    Where there are 2 linked lists on a page, initialise the JavaScript required to link the lists.

    init_linked_lists(array $options) 
    Static

    Parameters

    $options

    array

    Options array of the child linked list.

    If using a subspecies column then the list of taxa we have loaded will have a parent species that must be displayed in the grid.

    load_parent_species(array $taxalist, array $options) 

    So load them up...

    Parameters

    $taxalist

    array

    List of taxon definitions we are loading parents for.

    $options

    array

    Options array as passed to the species grid. Provides the read authorisation tokens.

    Performs a periodic purge of cached files.

    purgeFiles(integer $chanceOfPurge, string $folder, integer $timeout, integer $allowedFileCount) 
    Static

    Parameters

    $chanceOfPurge

    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.

    $folder

    string

    Path to the folder to purge cache files from.

    $timeout

    integer

    Age of files in seconds before they will be considered for purging.

    $allowedFileCount

    integer

    Number of most recent files to not bother purging from the cache.

    Internal function to output either a select or listbox control depending on the templates passed.

    select_or_listbox(array $options) 
    Static
    access private

    Parameters

    $options

    array

    Control options array

    Adds javascript to popup a config box for the current filter on the species you can add to the grid.

    species_checklist_filter_popup(array $options, array $nameFilter) 
    Static

    Parameters

    $options

    array

    Options array as passed to the species checklist grid.

    $nameFilter

    array

    array of optional name filtering modes, with the actual filter to apply as the value.

    Private function to retrieve the subspecies selection cell for a species_checklist, when the subspeciesColumn option is enabled.

    species_checklist_get_subsp_cell(array $taxon, integer $txIdx, integer $existing_record_id, array $options) 

    Parameters

    $taxon

    array

    Taxon definition as loaded from the database.

    $txIdx

    integer

    Index of the taxon row we are operating on.

    $existing_record_id

    integer

    If an existing record, then the record's occurrence ID.

    $options

    array

    Options array for the species grid. Used to obtain the row inclusion check mode, read authorisation and lookup list's ID.

    Returns the class to apply to a control for an occurrence attribute, identified by an index.

    species_checklist_occ_attr_class(array $options, integer $idx, string $caption) 
    Static

    Parameters

    $options

    array

    Options array which contains the occAttrClasses item, an array of classes configured for each attribute control.

    $idx

    integer

    Index of the custom attribute.

    $caption

    string

    Caption of the attribute used to construct a suitable CSS class.

    Validates the inputs on the current tab and prevents going to the next tab if not all valid.

    validate_inputs_on_current_tab(string $msg) 
    Static

    Parameters

    $msg

    string

    Message to display if a failure to validate occurs

     Properties

     

    <p>Number of recent files allowed in the cache which the cache will not bother clearing during a deletion operation. They will be refreshed occasionally when requested anyway.</p>

    $cache_allowed_file_count : integer
    Inherited
    inherited_from \helper_base::$$cache_allowed_file_count
     

    <p>On average, every 1 in $cache_chance_purge times the Warehouse is called for data, all files older than 5 times the cache_timeout will be purged, apart from the most recent $cache_allowed_file_count files.</p>

    $cache_chance_purge : integer
    Inherited
    inherited_from \helper_base::$$cache_chance_purge
     

    <p>On average, every 1 in $cache_chance_expire times the Warehouse is called for data which is cached but older than the cache timeout, the cached data will be refreshed. This introduces a random element to cache refreshes so that no single form load event is responsible for refreshing all cached content.</p>

    $cache_chance_refresh_file : integer
    Inherited
    inherited_from \helper_base::$$cache_chance_refresh_file
     

    <p>Length of time in seconds after which cached Warehouse responses will start to expire.</p>

    $cache_timeout : integer
    Inherited
    inherited_from \helper_base::$$cache_timeout
     

    <p>Path to Indicia CSS folder. If not specified, then it is calculated from the Warehouse $base_url. This path should be a full path on the server (starting with '/' exluding the domain).</p>

    $css_path : string
    Inherited
    inherited_from \helper_base::$$css_path
     

    <p>of default validation rules to apply to the controls on the form if the built in client side validation is used (with the jQuery validation plugin). This array can be replaced if required.</p>

    $default_validation_rules : Array
    Inherited
    inherited_from \helper_base::$$default_validation_rules
     

    <p>List of resources that have already been dumped out, so we don't duplicate them. For example, if the site template includes JQuery set $dumped_resources[]='jquery'.</p>

    $dumped_resources : array
    Inherited
    inherited_from \helper_base::$$dumped_resources
     

    When reloading a form, this can be populated with the list of values to load into the controls.

    $entity_to_load : array

    E.g. set it to the content of $_POST after submitting a form that needs to reload.

     

    <p>Form Mode. Initially unset indicating new input, but can be set to ERRORS or RELOAD.</p>

    $form_mode : string
    Inherited
    inherited_from \helper_base::$$form_mode
     

    <p>Helptext positioning. Determines where the information is displayed when helpText is defined for a control. Options are before, after.</p>

    $helpTextPos : string
    Inherited
    inherited_from \helper_base::$$helpTextPos
     

    <p>Path to Indicia Images folder.</p>

    $images_path : string
    Inherited
    inherited_from \helper_base::$$images_path
     

    <p>On average, every 1 in $interim_image_chance_purge times the Warehouse is called for data, all interim images older than $interim_image_expiry seconds will be deleted. These are images that should have uploaded to the warehouse but the form was not finally submitted.</p>

    $interim_image_chance_purge : integer
     

    <p>On average, every 1 in $cache_chance_expire times the Warehouse is called for data which is</p>

    $interim_image_expiry : integer
     

    <p>Flag set to true if returning content for an AJAX request. This allows the javascript to be returned direct rather than embedding in document.ready and window.onload handlers.</p>

    $is_ajax : boolean
    Inherited
    inherited_from \helper_base::$$is_ajax
     

    <p>JavaScript text to be emitted after the data entry form. Each control that needs custom JavaScript can append the script to this variable.</p>

    $javascript : string
    Inherited
    inherited_from \helper_base::$$javascript
     

    <p>Path to Indicia JavaScript folder. If not specified, then it is calculated from the Warehouse $base_url. This path should be a full path on the server (starting with '/' exluding the domain).</p>

    $js_path : string
    Inherited
    inherited_from \helper_base::$$js_path
     

    <p>JavaScript text to be emitted after the data entry form and all other JavaScript.</p>

    $late_javascript : string
    Inherited
    inherited_from \helper_base::$$late_javascript
     

    <p>Setting to completely disable loading from the cache</p>

    $nocache : boolean
    Inherited
    inherited_from \helper_base::$$nocache
     

    <p>JavaScript text to be emitted during window.onload.</p>

    $onload_javascript : string
    Inherited
    inherited_from \helper_base::$$onload_javascript
     

    <p>List of resources that have been identified as required by the controls used. This defines the JavaScript and stylesheets that must be added to the page. Each entry is an array containing stylesheets and javascript sub-arrays. This has public access so the Drupal module can perform Drupal specific resource output.</p>

    $required_resources : Array
    Inherited
    inherited_from \helper_base::$$required_resources
     

    <p>List of all available resources known. Each resource is named, and contains a sub array of deps (dependencies), stylesheets and javascripts.</p>

    $resource_list : Array
    Inherited
    inherited_from \helper_base::$$resource_list
     

    <p>Name of the form which has been set up for jQuery validation, if any.</p>

    $validated_form_id : array
    Inherited
    inherited_from \helper_base::$$validated_form_id
     

    <p>List of all error messages returned from an attempt to save.</p>

    $validation_errors : array
    Inherited
    inherited_from \helper_base::$$validation_errors
     

    <p>List of messages defined to pass to the validation plugin.</p>

    $validation_messages : array
    Inherited
    inherited_from \helper_base::$$validation_messages
     

    List of methods used to report a validation failure.

    $validation_mode : array
    Inherited

    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
     

    <p>Path to proxy script for calls to the warehouse (optional, allows the warehouse to sit behind a firewall only accessible from the server).</p>

    $warehouse_proxy : string
    Inherited
    inherited_from \helper_base::$$warehouse_proxy
     

    <p>Are we linking in the default stylesheet? Handled sligtly different to the others so it can be added to the end of the list, allowing our CSS to override other stuff.</p>

    $default_styles : Boolean
    Inherited
    inherited_from \helper_base::$$default_styles
     

    <p>List of error messages that have been displayed, so we don't duplicate them when dumping any remaining ones at the end.</p>

    $displayed_errors : array
    Inherited
    inherited_from \helper_base::$$displayed_errors
     

    Array of html attributes.

    $html_attributes 
    Inherited

    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
     

    <p>indicates if any form controls have specified the lockable option. If so, we will need to output some javascript.</p>

    $using_locking : Boolean
    Inherited
    inherited_from \helper_base::$$using_locking
     

    <p>Website ID, stored here to assist with caching.</p>

    $website_id : integer
    Inherited
    inherited_from \helper_base::$$website_id
     

    <p>List of fields that are to be stored in a cookie and reloaded the next time a form is accessed. These are populated by implementing a hook function called indicia_define_remembered_fields which calls set_remembered_fields.</p>

    $remembered_fields : Array