Static helper class that provides methods for dealing with maps.

Provides several generally useful methods and also includes resource management.

package Client

 Methods

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.

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.

    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.

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

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

    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.

    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.

    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.

    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.

    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.

    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() 
    InheritedStatic
    inherited_from \helper_base::get_uploaded_image_folder()

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

    Outputs a map layer list panel which automatically integrates with the map_panel added to the same page.

    layer_list(array $options) 
    Static

    The list by default will behave like a map legend, showing an icon and caption for each visible layer, but can be configured to show all hidden layers and display a checkbox or radio button alongside each item, making it into a layer switcher panel.

    Parameters

    $options

    array

    Associative array of options to pass to the jQuery.indiciaMapPanel plugin. Has the following possible options:

    • id
      Optional CSS id for the output panel.
    • includeIcons
      Set to true to include icons alongside each layer item. Default true.
    • includeSwitchers/b>
      Set to true to include radio buttons and/or checkboxes for switching on or off the visible base layers and overlays. Default false.
    • includeHiddenLayers
      True or false to include layers that are not currently visible on the map. Default is false.
    • layerTypes
      Array of layer types to include, options are base or overlay. Default is both.
    • class
      Class to add to the outer div.

    Outputs a map panel.

    map_panel(array $options, array $olOptions) 
    Static

    The map panel can be augmented by adding any of the following controls which automatically link themselves to the map:

    To run JavaScript at the end of map initialisation, add a function to the global array called mapInitialisationHooks. Code cannot access the map at any previous point because maps may not be initialised when the page loads, e.g. if the map initialisation is delayed until the tab it is on is shown. To run JavaScript which updates any of the map settings, add a function to the mapSettingsHooks global array. For example this is used to configure the map by report parameters panels which need certain tools on the map.

    Parameters

    $options

    array

    Associative array of options to pass to the jQuery.indiciaMapPanel plugin. Has the following possible options:

    • indiciaSvc
    • indiciaGeoSvc
    • readAuth
      Provides read authentication tokens for the warehouse. Only required when there is a location control linked to the warehouse associated with this map.
    • height
      Height of the map panel, in pixels.
    • width
      Width of the map panel, in pixels or as a percentage if followed by a % symbol.
    • initial_lat
      Latitude of the centre of the initially displayed map, using WGS84.
    • initial_long
      Longitude of the centre of the initially displayed map, using WGS84.
    • initial_zoom
    • scroll_wheel_zoom
      Does the scroll wheel zoom the map in and out when over the map? Defaults to true. When using the scroll wheel to look up and down a data entry form it can be easy to inadvertantly scroll the map, so it may be desirable to disable this feature in some cases.
    • proxy
    • displayFormat
    • 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', 'osm' (for OpenStreetMap), 'osm_th' (for OpenStreetMap Tiles@Home).
    • tilecacheLayers
      Array of layer definitions for tilecaches, which are pre-cached background tiles. They are less flexible but much faster than typical WMS services. The array is associative, with the following keys: caption - The display name of the layer servers - array list of server URLs for the cache layerName - the name of the layer within the cache settings - any other settings that need to be passed to the tilecache, e.g. the server resolutions or file format.
    • indiciaWMSLayers
    • indiciaWFSLayers
    • layers
      An array of JavaScript variables which point to additional OpenLayers layer objects to add to the map. The JavaScript for creating these layers can be added to data_entry_helper::$onload_javascript before calling the map_panel method.
    • clickableLayers
      If support for clicking on a layer to provide info on the clicked objects is required, set this to an array containing the JavaScript variable names for the OpenLayers WMS layer objects you have created for the clickable layers. The JavaScript for creating these layers can be added to data_entry_helper::$onload_javascript before calling the map_panel method and they can be the same layers as those referred to in the layers parameter.
    • clickableLayersOutputMode
      Set to popup to display the information retrieved from a click operation on a popup window, set to div to display the information in a specified HTML div, or to customFunction to call a JavaScript function after the click operation allowing custom functionality such as navigation to another page. Default is popup.
    • clickableLayersOutputDiv
      ID of the HTML div to output information retrieved from a click operation into, if clickableLayersOutputMode is set to div.
    • customClickFn Set to the name of a global custom JavaScript function which will handle the event of clicking on the map if you want custom functionality. Provide this when clickableLayersOutputMode=customFunction. The function will receive a single parameter containing an array of features.
    • clickableLayersOutputFn
      Allows overridding of the appearance of the output when clicking on the map for WMS or vector layers. Should be set to a JavaScript function name which takes a list of features and the map div as parameters, then returns the HTML to output.
    • clickableLayersOutputColumns
      An associated array of column field names with column titles as the values which defines the columns that are output when clicking on a data point. If ommitted, then all columns are output using their original field names.
    • locationLayerName
      If using a location select or autocomplete control, then set this to the name of a feature type exposed on GeoServer which contains the id, name and boundary geometry of each location that can be selected. Then when the user clicks on the map the system is able to automatically populate the locations control with the clicked on location. Ensure that the feature type is styled on GeoServer to appear as required, though it will be added to the map with semi-transparency. To use this feature ensure that a proxy is set, e.g. by using the Indicia Proxy module in Drupal.
    • locationLayerFilter
      If using a location layer, then set this to a cql filter in order to select e.g. locations for a website or locations of a type. The filter can act on any fields in the feature type that locationLayerName refers to.
    • controls
    • toolbarDiv
      If set to 'map' then any required toolbuttons are output directly onto the map canvas (in the top right corner). Alternatively can be set to 'top', 'bottom' or the id of a div on the page to output them into.
    • toolbarPrefix
      Content to include at the beginning of the map toolbar. Not applicable when the toolbar is added directly to the map.
    • toolbarSuffix
      Content to include at the end of the map toolbar. Not applicable when the toolbar is added directly to the map.
    • helpDiv
      Set to 'bottom' to add a div containing help hints below the map. Set to the name of a div to output help hints into that div. Otherwise no help hints are displayed.
    • clickForSpatialRef
      Does clicking on the map set the spatial reference of the sample input controls on the form the map appears on (if any)? Defaults to true.
    • allowPolygonRecording
      If a drawPolygon or drawLine control is present, do these set the spatial reference of the sample input controls on the form the map appears on (if any)? The spatial ref is set to the polygon centroid and the sample geometry is set to the polygon itself allowing polygons for records.
    • editLayer
    • editLayerName
    • standardControls An array of predefined controls that are added to the map. Select from:
      layerSwitcher - a button in the corner of the map which opens a panel allowing selection of the visible layers.
      drawPolygon - a tool for drawing polygons onto the map edit layer.
      drawLine - a tool for drawing lines onto the map edit layer.
      drawPoint - a tool for drawing points onto the map edit layer.
      zoomBox - allow zooming to a bounding box, drawn whilst holding the shift key down. This functionality is provided by the panZoom and panZoomBar controls as well so is only relevant when they are not selected. panZoom - simple controls in the corner of the map for panning and zooming. panZoomBar - controls in the corner of the map for panning and zooming, including a slide bar for zooming. modifyFeature - a tool for selecting a feature on the map edit layer then editing the vertices of the feature. selectFeature - a tool for selecting a feature on the map edit layer. hoverFeatureHighlight - highlights the feature on the map edit layer which is under the mouse cursor position. Default is layerSwitcher, panZoom and graticule.
    • initialFeatureWkt
      Well known text for a geometry to load onto the map at startup, normally corresponding to the geometry of the record being edited.
    • initialBoundaryWkt
      Well known text for a geometry to load onto the map at startup, normally corresponding to the geometry of the boundary being edited (e.g. a site boundary).
    • defaultSystem
    • latLongFormat
      Override the format for display of lat long references. Select from D (decimal degrees, the default), DM (degrees and decimal minutes) or DMS (degrees, minutes and decimal seconds).
    • srefId
      Override the id of the control that has the grid reference value
    • srefSystemId
      Override the id of the control that has the spatial reference system value
    • geomId
    • clickedSrefPrecisionMin
      Specify the minimum precision allowed when clicking on the map to get a grid square. If not set then the grid square selected will increase to its maximum size as the map is zoomed out. E.g. specify 4 for a 1km British National Grid square.
    • clickedSrefPrecisionMax
      Specify the maximum precision allowed when clicking on the map to get a grid square. If not set then the grid square selected will decrease to its minimum size as the map is zoomed in. E.g. specify 4 for a 1km British National Grid square.
    • msgGeorefSelectPlace
    • msgGeorefNothingFound
    • msgSrefOutsideGrid
      Message displayed when point outside of grid reference range is clicked.
    • msgSrefNotRecognised
      Message displayed when a grid reference is typed that is not recognised.
    • maxZoom
      Limit the maximum zoom used when clicking on the map to set a point spatial reference. Use this to prevent over zooming on background maps.
    • 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 map when the tab is shown.
    • setupJs
      When there is JavaScript to run before the map is initialised, put the JavaScript into this option. This allows the map to run the setup JavaScript just in time, immediately before the map is created. This avoids problems where the setup JavaScript causes the OpenLayers library to be initialised too earlier if the map is on a div.
    • setupJs
      When there is JavaScript to run before the map is initialised, put the JavaScript into this option. This allows the map to run the setup JavaScript just in time, immediately before the map is created. This avoids problems where the setup JavaScript causes the OpenLayers library to be initialised too earlier if the map is on a div.
    • graticuleProjection
      EPSG code (including EPSG:) for the projection used for the graticule (grid overlay).
    • graticuleBounds
      Array of the bounding box coordinates for the graticule(W,S,E,N).
    • rememberPos
      Set to true to enable restoring the map position when the page is reloaded. Requires jquery.cookie plugin. As this feature requires cookies, you should notify your users in compliance with European cookie law if you use this option.

  • helpDiv
    Set to bottom to output a help div under the map, or set to the ID of a div to output into.
  • helpToPickPrecisionMin
    Set to a precision in metres (e.g. 10, 100, 1000) to provide help guiding the recorder to pick a grid square of at least that precision. Ensure that helpDiv is set when using this option.
  • helpToPickPrecisionMax
    Set to a precision in metres (e.g. 10, 100, 1000) that the help system will accept as not requiring further refinement when a grid square of this precision is picked.
  • helpToPickPrecisionSwitchAt
    Set to a precision in metres (e.g. 10, 100, 1000) that the map will switch to the satellite layer (if Google or Bing satellite layers active) when the recorder picks a grid square of at least that precision.
  • $olOptions

    array

    Optional array of settings for the OpenLayers map object. If overriding the projection or displayProjection settings, just pass the EPSG number, e.g. 27700.

    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

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

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

    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.

    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.

    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.

     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
     

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