/** * A report showing a chart of incoming records per week. */ public static function records_by_week_chart($auth, $args, $tabalias, $options, $path) { iform_load_helpers(array('report_helper')); $args = array_merge(array('report_name' => 'library/weeks/filterable_records_by_week'), $args); $reportOptions = array_merge(iform_report_get_report_options($args, $auth['read']), array('id' => 'records-by-week-chart', 'width' => 900, 'height' => 500, 'chartType' => 'line', 'yValues' => array('processed', 'total'), 'xLabels' => 'week', 'legendOptions' => array('show' => true), 'seriesOptions' => array(array('label' => 'Processed by verifiers', 'color' => '#00FF00'), array('label' => 'All records', 'color' => '#FF9900')), 'axesOptions' => array('yaxis' => array('min' => 0, 'tickOptions' => array('formatString' => '%d')), 'xaxis' => array('label' => 'Weeks ago'))), $options); return report_helper::report_chart($reportOptions); }
/** * Return the Indicia form code * @param array $args Input parameters. * @param array $node Drupal node object * @param array $response Response from Indicia services after posting. * @return HTML string */ public static function get_form($args, $node, $response) { iform_load_helpers(array('report_helper', 'map_helper')); $auth = report_helper::get_read_auth($args['website_id'], $args['password']); $reportOptions = iform_report_get_report_options($args, $auth); $r = '<div class="ui-helper-clearfix">'; $reportOptions['geoserverLayer'] = $args['geoserver_layer']; $reportOptions['geoserverLayerStyle'] = $args['geoserver_layer_style']; $reportOptions['cqlTemplate'] = $args['cql_template']; $reportOptions['clickable'] = $args['click_on_map_mode'] != 'none'; $reportOptions['clickableLayersOutputDiv'] = $args['click_on_map_div']; if (!empty($args['click_on_map_columns'])) { $reportOptions['clickableLayersOutputColumns'] = helper_base::explode_lines_key_value_pairs($args['click_on_map_columns']); } if ($args['click_on_map_mode'] != 'none') { $reportOptions['clickableLayersOutputMode'] = $args['click_on_map_mode']; } // Use the proxy module if enabled, to get round limitations in URL length for // filtered WMS requests. if (defined('DRUPAL_BOOTSTRAP_CONFIGURATION') && module_exists('iform_proxy')) { global $base_url; $reportOptions['proxy'] = $base_url . '/?q=' . variable_get('iform_proxy_path', 'proxy') . '&url='; } $r .= '<br/>' . report_helper::report_map($reportOptions); $options = iform_map_get_map_options($args, $readAuth); $olOptions = iform_map_get_ol_options($args); // This is used for drawing, so need an editlayer, but not used for input $options['editLayer'] = true; $options['editLayerInSwitcher'] = true; $options['clickForSpatialRef'] = false; if ($args['layer_picker'] != 'none') { $picker = array('id' => 'map-layer-picker', 'includeIcons' => false, 'includeSwitchers' => true, 'includeHiddenLayers' => true); if ($args['layer_picker'] == 'before') { $r .= map_helper::layer_list($picker); } // as we have a layer picker, we can drop the layerSwitcher from the OL map. if (array_search('layerSwitcher', $options['standardControls']) !== false) { unset($options['standardControls'][array_search('layerSwitcher', $options['standardControls'])]); } } if ($args['legend'] != 'none') { $legend = array('id' => 'map-legend', 'includeIcons' => true, 'includeSwitchers' => false, 'includeHiddenLayers' => false); if ($args['legend'] == 'before') { $r .= map_helper::layer_list($legend); } } if (isset($args['map_toolbar_pos'])) { $options['toolbarDiv'] = $args['map_toolbar_pos']; } $r .= map_helper::map_panel($options, $olOptions); if ($args['layer_picker'] == 'after') { $r .= map_helper::layer_list($picker); } if ($args['legend'] == 'after') { $r .= map_helper::layer_list($legend); } $r .= '</div>'; return $r; }
/** * Return the generated form output. * @param array $args List of parameter values passed through to the form depending on how the form has been configured. * This array always contains a value for language. * @param object $node The Drupal node object. * @param array $response When this form is reloading after saving a submission, contains the response from the service call. * Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data). * @return Form HTML. * @todo: Implement this method */ public static function get_form($args, $node, $response = null) { iform_load_helpers(array('report_helper', 'map_helper')); $conn = iform_get_connection_details($node); $readAuth = report_helper::get_read_auth($conn['website_id'], $conn['password']); $r = '<div id="leftcol">'; $reportOptions = iform_report_get_report_options($args, $readAuth); iform_report_apply_explore_user_own_preferences($reportOptions); $reportOptions = array_merge(array('rowId' => 'external_key', 'columns' => array(), 'callback' => 'grid_load', 'rememberParamsReportGroup' => 'explore', 'paramsFormButtonCaption' => lang::get('Filter')), $reportOptions); $reportOptions['rowId'] = 'external_key'; $imgPath = empty(report_helper::$images_path) ? report_helper::relative_client_helper_path() . "../media/images/" : report_helper::$images_path; $reportOptions['columns'][] = array('actions' => array(array('img' => "{$imgPath}/add.png", 'caption' => 'Click to add this species to the map'))); $r .= report_helper::report_grid($reportOptions); $r .= '</div>'; $args['indicia_species_layer_slds'] = report_helper::explode_lines($args['indicia_species_layer_slds']); $r .= '<div id="rightcol">'; $r .= '<div id="layerbox">'; $r .= '<p id="instruct">' . lang::get('Click on the + buttons in the grid to add species layers to the map. You can add up to {1} layers at a time.', count($args['indicia_species_layer_slds'])); $r .= '<p id="instruct2" style="display: none">' . lang::get('Use the - buttons to permanently remove layers, or untick the box in the legend to temporarily hide them.'); $mapOptions = iform_map_get_map_options($args, $readAuth); $mapOptions['clickForSpatialRef'] = false; $olOptions = iform_map_get_ol_options($args, $readAuth); $r .= map_helper::layer_list(array('layerTypes' => array('overlay'), 'includeSwitchers' => true, 'includeHiddenLayers' => true)); $r .= '</div>'; $r .= map_helper::map_panel($mapOptions, $olOptions); $r .= '</div>'; $websiteIds = iform_get_allowed_website_ids($readAuth); if (!empty($args['indicia_species_layer_feature_type']) && !empty(report_helper::$geoserver_url)) { $training = function_exists('hostsite_get_user_field') && hostsite_get_user_field('training') ? 't' : 'f'; $cql = 'website_id IN (' . implode(',', $websiteIds) . ') AND ' . $args['indicia_species_layer_filter_field'] . "='{filterValue}' AND record_status NOT IN ('R', 'I', 'T') AND training='{$training}'"; if (isset($_POST[$reportOptions['reportGroup'] . '-quality'])) { $quality = $_POST[$reportOptions['reportGroup'] . '-quality']; } else { $quality = $reportOptions['extraParams']['quality']; } // logic here must match the quality_check function logic on the database. switch ($quality) { case 'V': $cql .= " AND record_status='V'"; break; case 'C': $cql .= " AND (record_status='V' OR certainty='C')"; break; case 'L': $cql .= " AND (record_status='V' OR ((certainty <> 'U' OR certainty IS NULL) AND record_status <> 'D'))"; break; case '!D': $cql .= " AND record_status<>'D'"; break; case '!R': // nothing to add - rejects are always excluded } report_helper::$javascript .= "indiciaData.indiciaSpeciesLayer = {\n" . ' "title":"' . lang::get('{1}') . "\",\n" . ' "myRecords":"' . lang::get('my records') . "\",\n" . ' "userId":"' . hostsite_get_user_field('indicia_user_id') . "\",\n" . ' "featureType":"' . $args['indicia_species_layer_feature_type'] . "\",\n" . ' "wmsUrl":"' . data_entry_helper::$geoserver_url . "wms\",\n" . " \"cqlFilter\":\"{$cql}\",\n" . " \"filterField\":\"taxon_meaning_id\",\n" . ' "slds":' . json_encode($args['indicia_species_layer_slds']) . "\n" . "};\n"; } return $r; }
/** * Return the generated form output. * @param array $args List of parameter values passed through to the form depending on how the form has been configured. * This array always contains a value for language. * @param object $node The Drupal node object. * @param array $response When this form is reloading after saving a submission, contains the response from the service call. * Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data). * @return Form HTML. * @todo: Implement this method */ public static function get_form($args, $node, $response = null) { require_once drupal_get_path('module', 'iform') . '/client_helpers/report_helper.php'; $auth = report_helper::get_read_write_auth($args['website_id'], $args['password']); $reportOptions = iform_report_get_report_options($args, $auth); $reportOptions['header'] = $args['header']; $reportOptions['footer'] = $args['footer']; $reportOptions['bands'] = json_decode($args['bands'], true); return report_helper::freeform_report($reportOptions); }
/** * Return the generated form output. * @param array $args List of parameter values passed through to the form depending on how the form has been configured. * This array always contains a value for language. * @param object $node The Drupal node object. * @param array $response When this form is reloading after saving a submission, contains the response from the service call. * Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data). * @return Form HTML. * @todo: Implement this method */ public static function get_form($args, $node, $response = null) { iform_load_helpers(array('report_helper')); $auth = report_helper::get_read_auth($args['website_id'], $args['password']); $reportOptions = iform_report_get_report_options($args, $auth); $reportOptions['header'] = $args['header']; $reportOptions['footer'] = $args['footer']; $reportOptions['bands'] = json_decode($args['bands'], true); return report_helper::freeform_report($reportOptions); }
/** * Return the Indicia form code * @param array $args Input parameters. * @param array $node Drupal node object * @param array $response Response from Indicia services after posting a verification. * @return HTML string */ public static function get_form($args, $node, $response) { require_once drupal_get_path('module', 'iform') . '/client_helpers/report_helper.php'; require_once drupal_get_path('module', 'iform') . '/client_helpers/map_helper.php'; $auth = report_helper::get_read_write_auth($args['website_id'], $args['password']); $chartOptions = iform_report_get_report_options($args, $auth); $chartOptions = array_merge($chartOptions, array('id' => 'chart-div', 'width' => $args['width'], 'height' => $args['height'], 'chartType' => $args['chart_type'], 'yValues' => explode(',', $args['y_values']))); $xLabels = trim($args['x_labels']); if (empty($xLabels)) { $chartOptions['xValues'] = explode(',', $args['x_values']); } else { $chartOptions['xLabels'] = explode(',', $args['x_labels']); } // advanced options $rendererOptions = trim($args['renderer_options']); if (!empty($rendererOptions)) { $chartOptions['rendererOptions'] = json_decode($rendererOptions, true); } $legendOptions = trim($args['legend_options']); if (!empty($legendOptions)) { $chartOptions['legendOptions'] = json_decode($legendOptions, true); } $seriesOptions = trim($args['series_options']); if (!empty($seriesOptions)) { $chartOptions['seriesOptions'] = json_decode($seriesOptions, true); } $axesOptions = trim($args['axes_options']); if (!empty($axesOptions)) { $chartOptions['axesOptions'] = json_decode($axesOptions, true); } // now the chart itself $r .= '<br/>' . report_helper::report_chart($chartOptions); return $r; }
protected static function get_control_reportchartparams($auth, $args, $tabalias, $options) { if (!isset($options['yValues']) || !isset($options['dataSource']) || !isset($options['chartType'])) { $r = '<h4>Please fill in the following options for the chart parameters control: yValues, dataSource, chartType</h4>'; return $r; } iform_load_helpers(array('report_helper')); $sharing = empty($args['sharing']) ? 'reporting' : $args['sharing']; $args['report_name'] = ''; $options = array_merge(iform_report_get_report_options($args, $auth), $options, array('reportGroup' => 'dynamic', 'paramsOnly' => true, 'sharing' => $sharing, 'paramsFormButtonCaption' => lang::get('Filter'), 'yValues' => explode(',', $options['yValues']), 'readAuth' => $auth['read'], 'dataSource' => $options['dataSource'])); $r = '<br/>' . report_helper::report_chart($options); return $r; }
/** * Return the generated output. * @param array $args List of parameter values passed through to the form depending on how the form has been configured. * This array always contains a value for language. * @param object $node The Drupal node object. * @param array $response When this form is reloading after saving a submission, contains the response from the service call. * Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data). * @return Form HTML. */ public static function get_form($args, $node, $response = null) { iform_load_helpers(array('report_helper', 'map_helper')); $readAuth = report_helper::get_read_auth($args['website_id'], $args['password']); $sharing = 'reporting'; $reportOptions = array_merge(iform_report_get_report_options($args, $readAuth), array('reportGroup' => 'explore', 'rememberParamsReportGroup' => 'explore', 'paramsOnly' => true, 'paramsInMapToolbar' => true, 'sharing' => $sharing, 'paramsFormButtonCaption' => lang::get('Filter'), 'rowId' => 'occurrence_id')); iform_report_apply_explore_user_own_preferences($reportOptions); $reportOptions['extraParams']['limit'] = 3000; $r = report_helper::report_grid($reportOptions); $r .= report_helper::report_map(array('readAuth' => $readAuth, 'dataSource' => $args['report_name'], 'extraParams' => $reportOptions['extraParams'], 'paramDefaults' => $reportOptions['paramDefaults'], 'autoParamsForm' => false, 'reportGroup' => 'explore', 'rememberParamsReportGroup' => 'explore', 'clickableLayersOutputMode' => 'report', 'sharing' => $sharing, 'rowId' => 'occurrence_id', 'ajax' => TRUE)); $options = array_merge(iform_map_get_map_options($args, $readAuth), array('featureIdField' => 'occurrence_id', 'clickForSpatialRef' => false, 'reportGroup' => 'explore', 'toolbarDiv' => 'top')); $olOptions = iform_map_get_ol_options($args); $r .= map_helper::map_panel($options, $olOptions); $allowDownload = !isset($args['downloadOwnDataOnly']) || !$args['downloadOwnDataOnly'] || isset($reportOptions['extraParams']['ownData']) && $reportOptions['extraParams']['ownData'] === 1 || isset($_POST['explore-ownData']) && $_POST['explore-ownData'] === '1' || !(isset($_POST['explore-ownData']) || $_POST['explore-ownData'] === '0') && isset($reportOptions['paramDefaults']['ownData']) && $reportOptions['paramDefaults']['ownData'] === 1; $reportOptions = array_merge($reportOptions, array('id' => 'explore-records', 'paramsOnly' => false, 'autoParamsForm' => false, 'downloadLink' => $allowDownload, 'rowClass' => 'certainty{certainty}')); if (isset($args['includeEditLink']) && $args['includeEditLink'] && !empty($args['includeEditLinkPath'])) { $reportOptions['columns'][] = array('display' => 'Actions', 'actions' => array(array('caption' => 'edit', 'url' => url($args['includeEditLinkPath']), 'urlParams' => array('occurrence_id' => '{occurrence_id}'), 'visibility_field' => 'belongs_to_user'))); } $r .= report_helper::report_grid($reportOptions); return $r; }
/** * Hierarchy map control, which can be added to user interface form configurations using [site_hierarchy_navigator.map]. * * Display a map with polygons loaded onto it of a particular location type. When the user clicks on one, reloads the map layer * to show the intersecting polygons from the next location type. Continues down the locations hierarchy in a supplied sequence of * location types (e.g. you might set the location type sequence to Country, County, Parish, Site). * * Supply an option @layerLocationTypes with a comma separated array of the location types ID to load in top down order. */ public function map($auth, $args, $tabalias, $options, $path) { global $base_root; //Setup the path to the cudi information sheets. //Include the parameter on the end of the path, but leave off the parameter values //as these will change for each path used. iform_load_helpers(array('map_helper', 'report_helper')); $informationSheetLinkParts = explode('|', $options['informationSheetLink']); $path = $base_root . base_path() . (variable_get('clean_url', 0) ? '' : '?q=') . $informationSheetLinkParts[0] . (variable_get('clean_url', 0) ? '?' : '&') . $informationSheetLinkParts[1] . '='; map_helper::$javascript .= "indiciaData.informationSheetLink='" . $path . "';\n"; if (empty($options['layerLocationTypes'])) { return '<p>Please provide a @layerLocationTypes option for the [site_hierarchy_navigator.map] map control on the edit tab</p>'; } $msg = self::check_format($options, 'layerLocationTypes', 'location_type_id (from the termlists term table)', '/^([0-9]*,\\s*)*[0-9]*\\s*$/'); if ($msg !== true) { return $msg; } //This option is optional, so don't need to check if it isn't present $msg = self::check_format($options, 'showCountUnitsForLayers', 'location_type_id (from the termlists term table)', '/^([0-9]*,\\s*)*[0-9]*\\s*$/'); if ($msg !== true) { return $msg; } drupal_add_js(iform_client_helpers_path() . 'prebuilt_forms/extensions/site_hierarchy_navigator.js'); //The location types are supplied by the user in a comma seperated list. //The first number is used as the initial location type to display. //The second number is used after the user clicks the first time on a feature and so on $layerLocationTypes = explode(',', $options['layerLocationTypes']); //Comma seperated list of location types which signify which layers should also display the Count Unit location type. //This should be a subset of $layerLocationTypes. $showCountUnitsForLayers = explode(',', $options['showCountUnitsForLayers']); $locationTypesWithSymbols = explode(',', $options['locationTypesWithSymbols']); //Annotation location types as defined on edit tab $annotationTypeIds = explode(',', $options['annotationTypeIds']); $mapOptions = iform_map_get_map_options($args, $auth); $olOptions = iform_map_get_ol_options($args); $mapOptions['readAuth'] = $mapOptions['readAuth']['read']; $mapOptions['clickForSpatialRef'] = false; //When user clicks on map, run specified Javascript function $mapOptions['clickableLayersOutputMode'] = 'customFunction'; $mapOptions['customClickFn'] = 'move_to_new_layer'; $mapOptions['clickableLayersOutputDiv'] = ''; //Tell the system which layers we to be clickable. $mapOptions['clickableLayers'] = array('indiciaData.reportlayer'); $r .= map_helper::map_panel($mapOptions, $olOptions); map_helper::$javascript .= "indiciaData.layerLocationTypes=" . json_encode($layerLocationTypes) . ";\n"; $reportOptions = array('dataSource' => 'reports_for_prebuilt_forms/CUDI/get_layer_list_names', 'readAuth' => $auth['read'], 'mode' => 'report', 'extraParams' => array('layer_ids' => $options['layerLocationTypes'])); //Return a list of location type names for the location type id layers list //provided by the user in the form structure. $locationTypeNamesDirty = data_entry_helper::get_report_data($reportOptions); //The data returned by the database is not a simple array of names, so convert the data and put into correct order foreach ($layerLocationTypes as $originalLayerIndex => $layerLocationTypeFromOriginalList) { foreach ($locationTypeNamesDirty as $locationTypeNamesData) { if ($locationTypeNamesData['id'] === $layerLocationTypeFromOriginalList) { $locationTypeNamesClean[$originalLayerIndex] = $locationTypeNamesData['name']; } } } //Send the array of names to javascript map_helper::$javascript .= "indiciaData.layerLocationTypesNames=" . json_encode($locationTypeNamesClean) . ";\n"; //Send the user supplied options for layers to display count units to Javascript map_helper::$javascript .= "indiciaData.showCountUnitsForLayers=" . json_encode($showCountUnitsForLayers) . ";\n"; map_helper::$javascript .= "indiciaData.countUnitBoundaryTypeId=" . $options['countUnitBoundaryTypeId'] . ";\n"; map_helper::$javascript .= "indiciaData.annotationTypeIds=" . json_encode($annotationTypeIds) . ";\n"; map_helper::$javascript .= "indiciaData.deactivateSiteAttributeId=" . $options['deactivateSiteAttributeId'] . ";\n"; //Get translatable label for top-level breadcrub item. map_helper::$javascript .= "indiciaData.allSitesLabel='" . lang::get('All Sites') . "';\n"; $reportOptions = array('linkOnly' => 'true', 'dataSource' => 'reports_for_prebuilt_forms/cudi/get_boundaries_and_locations_for_cudi_map', 'readAuth' => $auth['read']); //Get the report options such as the Preset Parameters on the Edit Tab $reportOptions = array_merge(iform_report_get_report_options($args, $readAuth), $reportOptions); //Run the report that shows the locations (features) to the user when the map loads the first time. map_helper::$javascript .= "indiciaData.layerReportRequest='" . report_helper::get_report_data($reportOptions) . "';\n"; //Options for the report that is used to draw the map breadcrumb $reportOptions = array('linkOnly' => 'true', 'dataSource' => 'reports_for_prebuilt_forms/CUDI/get_map_hierarchy_for_current_position', 'readAuth' => $auth['read']); //Get the report options such as the Preset Parameters on the Edit Tab $reportOptions = array_merge(iform_report_get_report_options($args, $readAuth), $reportOptions); //Run the report that builds the map breadcrumb. map_helper::$javascript .= "indiciaData.breadcrumbReportRequest='" . report_helper::get_report_data($reportOptions) . "';\n"; return $r; }
/** * Return the Indicia form code * @param array $args Input parameters. * @param array $node Drupal node object * @param array $response Response from Indicia services after posting a verification. * @return HTML string */ public static function get_form($args, $node, $response) { iform_load_helpers(array('report_helper', 'map_helper')); $auth = report_helper::get_read_auth($args['website_id'], $args['password']); $chartOptions = iform_report_get_report_options($args, $auth); $chartOptions = array_merge($chartOptions, array('id' => 'chart-div', 'width' => $args['width'], 'height' => $args['height'], 'chartType' => $args['chart_type'], 'yValues' => explode(',', $args['y_values']), 'output' => $args['output'])); $xLabels = trim($args['x_labels']); if (empty($xLabels)) { $chartOptions['xValues'] = explode(',', $args['x_values']); } else { $chartOptions['xLabels'] = explode(',', $args['x_labels']); } // advanced options if (!empty($args['renderer_options'])) { $rendererOptions = trim($args['renderer_options']); $chartOptions['rendererOptions'] = json_decode($rendererOptions, true); } if (!empty($args['legend_options'])) { $legendOptions = trim($args['legend_options']); $chartOptions['legendOptions'] = json_decode($legendOptions, true); } if (!empty($args['axes_options'])) { $seriesOptions = trim($args['series_options']); $chartOptions['seriesOptions'] = json_decode($seriesOptions, true); } if (!empty($args['series_options'])) { $axesOptions = trim($args['axes_options']); $chartOptions['axesOptions'] = json_decode($axesOptions, true); } //User has elected for parameters form only if ($args['output'] === 'form') { $chartOptions['paramsOnly'] = true; } else { if (isset($chartOptions['paramsOnly'])) { unset($chartOptions['paramsOnly']); } } //User has elected for parameters form only or //both the chart and parameters form together if ($args['output'] === 'form' || $args['output'] === 'default') { $chartOptions['completeParamsForm'] = true; } else { if (isset($chartOptions['completeParamsForm'])) { unset($chartOptions['completeParamsForm']); } } //User has elected for the chart only if ($args['output'] === 'output') { $chartOptions['autoParamsForm'] = false; } $r = '<br/>' . report_helper::report_chart($chartOptions); return $r; }
/** * Return the Indicia form code * @param array $args Input parameters. * @param array $node Drupal node object * @param array $response Response from Indicia services after posting a verification. * @return HTML string */ public static function get_form($args, $node, $response) { iform_load_helpers(array('report_helper')); data_entry_helper::add_resource('jquery_form'); $auth = report_helper::get_read_auth($args['website_id'], $args['password']); $reportOptions = iform_report_get_report_options($args, $auth); // get the grid output before outputting the download link, so we can check if the download link is needed. $reportOptions['id'] = 'grid-' . $node->nid; if (isset($args['footer'])) { $reportOptions['footer'] = $args['footer']; } $reportOptions['downloadLink'] = !isset($args['download_link']) || $args['download_link']; $grid = report_helper::report_grid($reportOptions); return $grid; }
public static function unallocated_squares_grid($auth, $args, $tabalias, $options, $path) { if (!isset($options['reportGridNumber'])) { drupal_set_message('Please fill in the report grid number option for the unallocated_squares_grid control, starting with 0 for the first grid on the page'); return false; } iform_load_helpers(array('report_helper')); $args['report_name'] = ''; $sharing = empty($args['sharing']) ? 'reporting' : $args['sharing']; $reportOptions = array_merge(iform_report_get_report_options($args, $auth['read']), array('reportGroup' => 'dynamic', 'autoParamsForm' => false, 'sharing' => $sharing, 'ajax' => true, 'id' => 'report-grid-' . $options['reportGridNumber']), $options); if (!empty($_GET['dynamic-post_code_geom']) && !empty($_GET['dynamic-distance_from_post_code'])) { $reportOptions['sendOutputToMap'] = true; $reportOptions['zoomMapToOutput'] = true; } return report_helper::report_grid($reportOptions); }
/** * Return the Indicia form code * @param array $args Input parameters. * @param array $node Drupal node object * @param array $response Response from Indicia services after posting. * @return HTML string */ public static function get_form($args, $node, $response) { $r = ""; data_entry_helper::add_resource('jquery_ui'); if (isset($args['advancedUI']) && $args['advancedUI']) { // TODO Sort out // data_entry_helper::$resource_list['jquery_ui_slider'] = // array('deps' => array('jquery_ui'), 'javascript' => array('/misc/ui/jquery.ui.slider.js')); // data_entry_helper::add_resource('jquery_ui_slider'); // drupal_add_js(drupal_get_path('module', 'jquery_update') .'/replace/ui/ui/jquery.ui.slider.js'); // drupal_add_js('/misc/ui/jquery.ui.slider.min.js'); drupal_add_js('/misc/ui/jquery.ui.slider.js'); // drupal_add_js('/misc/ui/jquery.ui.button.min.js'); } $readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']); $now = new DateTime('now'); $year = isset($_REQUEST['year']) ? $_REQUEST['year'] : ($year = $now->format('Y')); iform_load_helpers(array('report_helper', 'map_helper')); $options = iform_report_get_report_options($args, $readAuth); $currentParamValues = array(); if (isset($options['extraParams'])) { foreach ($options['extraParams'] as $key => $value) { // trim data to ensure blank lines are not handled. $key = trim($key); $value = trim($value); // We have found a parameter, so put it in the request to the report service if (!empty($key)) { $currentParamValues[$key] = $value; } } } $extras = '&wantColumns=1&wantParameters=1&' . report_helper::array_to_query_string($currentParamValues, true); $canIDuser = false; // Report record should have location_id, sample_id, occurrence_id, sample_date, species ttl_id, attributes, geometry. created_by_id is optional // Event definition: Name|attribute_id|attribute_values // Loop through event definitions /* $events = array(array('type'=>'arrayVal', 'name'=>'Budburst', 'attr'=>'289', 'values'=>array(3904,3961,3905,3906,3962,3907)), array('type'=>'arrayVal', 'name'=>'Leaf', 'attr'=>'289', 'values'=>array(3906,3962,3907)), array('type'=>'arrayVal', 'name'=>'Flowering', 'attr'=>'291', 'values'=>array(3912,3913,3914,3916,3917,3918)), array('type'=>'presence', 'name'=>'Presence')); */ $events = str_replace("\r\n", "\n", $args['triggerEvents']); $events = str_replace("\r", "\n", $events); $events = explode("\n", trim($events)); foreach ($events as $idx => $event) { $events[$idx] = explode(':', $event); } $triggerEvents = array(); $SpeciesEventSelections = array(); $Species = array(); $r .= '<div id="errorMsg"></div>' . '<table class="ui-widget ui-widget-content ui-corner-all controls-table" id="controls-table">' . '<thead class="ui-widget-header">' . '<tr><th><label for="yearControl">' . lang::get("Year") . ' : </label><select id="yearControl" name="year">'; for ($i = $now->format('Y'); $i >= $args['first_year']; $i--) { $r .= '<option value="' . $i . '">' . $i . '</option>'; } $r .= '</select></th>' . '<th><label for="speciesControl">' . lang::get("Species") . ' : </label><select id="speciesControl"><option value="">' . lang::get("Please select species") . '</option></select></th>' . '<th><label for="eventControl">' . lang::get("Event") . ' : </label><select id="eventControl"><option value="">' . lang::get("Please select event") . '</option>'; foreach ($events as $index => $event) { $r .= '<option value="' . $index . '">' . $event[0] . '</option>'; $triggerEvents[] = '{"name":"' . $event[0] . '","type":"' . $event[1] . '"' . (count($event) > 2 ? ',"attr":' . $event[2] . ',"values":[' . $event[3] . ']' : '') . '}'; } $r .= "</select></th>\n"; if (isset($args['twinMaps']) && $args['twinMaps']) { $r .= '<th><label for="rhsCtrl">' . lang::get("Compare") . ' : </label><select id="rhsCtrl" name="rhsCtrl"><option value="">' . lang::get("Please select.") . '</option><option value="Test">' . lang::get("Test.") . "</option></select></th>\n"; } $r .= '</tr></thead></table>' . "\n"; $args['map_width'] = "auto"; $options = iform_map_get_map_options($args, $readAuth); $olOptions = iform_map_get_ol_options($args); $options['editLayer'] = false; $options['clickForSpatialRef'] = false; $options['scroll_wheel_zoom'] = false; $r .= '<div class="leftMap mapContainers leftMapOnly">' . map_helper::map_panel($options, $olOptions) . '</div>'; $options['divId'] = 'map2'; if (isset($args['twinMaps']) && $args['twinMaps']) { $r .= '<div class="rightMap mapContainers leftMapOnly">' . map_helper::map_panel($options, $olOptions) . '</div>'; } $r .= '<div class="ui-helper-clearfix"></div><div id="timeControls">' . (isset($args['advancedUI']) && $args['advancedUI'] ? '<div id="timeSlider"></div>' : '') . '<div id="toolbar">' . '<span id="dotControlLabel">' . lang::get('Dot Size') . ' :</span>' . (isset($args['advancedUI']) && $args['advancedUI'] ? '<div id="dotSlider"></div>' : '<select id="dotSelect"><option>2</option><option>3</option><option>4</option><option>5</option></select>') . '<button id="beginning">go to beginning</button><button id="playMap">play</button><button id="end">go to end</button>' . '<span id="dateControlLabel">' . lang::get("Date Currently displayed") . ' : ' . (isset($args['advancedUI']) && $args['advancedUI'] ? '<span id="displayDate" ></span>' : '<select id="timeSelect"><option value="">' . lang::get("Please select date") . '</option></select>') . '</span>' . '</div>'; $imgPath = empty(data_entry_helper::$images_path) ? data_entry_helper::relative_client_helper_path() . "../media/images/" : data_entry_helper::$images_path; data_entry_helper::$javascript .= "\ninitTreeMap2({\n advanced_UI: " . (isset($args['advancedUI']) && $args['advancedUI'] ? "true" : "false") . ",\n dotSize: " . $args['dotSize'] . ",\n lat: " . $args['map_centroid_lat'] . ",\n long: " . $args['map_centroid_long'] . ",\n zoom: " . $args['map_zoom'] . ",\n triggerEvents: [" . implode(',', $triggerEvents) . "],\n base_url: '" . data_entry_helper::$base_url . "',\n report_name: '" . $args['report_name'] . "',\n auth_token: '" . $readAuth['auth_token'] . "',\n nonce: '" . $readAuth['nonce'] . "',\n reportExtraParams: '" . $extras . "',\n indicia_user_id: " . (hostsite_get_user_field('indicia_user_id') ? hostsite_get_user_field('indicia_user_id') : 'false') . ",\n timeControlSelector: '" . (isset($args['advancedUI']) && $args['advancedUI'] ? '#timeSlider' : '#timeSelect') . "',\n dotControlSelector: '" . (isset($args['advancedUI']) && $args['advancedUI'] ? '#dotSlider' : '#dotSelect') . "',\n timerDelay: " . (int) 1000 / $args['frameRate'] . ",\n twinMaps: " . (isset($args['twinMaps']) && $args['twinMaps'] ? 'true' : 'false') . ",\n imgPath: '" . $imgPath . "'\n});\n"; $r .= '</div>'; return $r; }
/** * Return the Indicia form code * @param array $args Input parameters. * @param array $node Drupal node object * @param array $response Response from Indicia services after posting a verification. * @return HTML string */ public static function get_form($args, $node, $response) { require_once drupal_get_path('module', 'iform') . '/client_helpers/report_helper.php'; $auth = report_helper::get_read_write_auth($args['website_id'], $args['password']); $reportOptions = iform_report_get_report_options($args, $auth); // get the grid output before outputting the download link, so we can check if the download link is needed. $reportOptions['id'] = 'grid-' . $node->nid; if (isset($args['footer'])) { $reportOptions['footer'] = $args['footer']; } $reportOptions['downloadLink'] = !isset($args['download_link']) || $args['download_link']; $grid = report_helper::report_grid($reportOptions); return $grid; }
private static function league_table_position($auth, $args, $options, $report, $label) { $userId = hostsite_get_user_field('indicia_user_id'); if (!$userId) { return ''; } iform_load_helpers(array('report_helper')); $reportOptions = array_merge(iform_report_get_report_options($args, $auth['read']), array('dataSource' => $report, 'autoParamsForm' => false), $options); if (hostsite_get_user_field('training')) { $reportOptions['extraParams']['training'] = 'true'; } $reportOptions['extraParams']['user_id'] = $userId; $rows = report_helper::get_report_data($reportOptions); if (count($rows)) { $r = self::output_title($options); $r .= '<div>'; $r .= '<div class="totals">' . lang::get('Position {1}', $rows[0]['position']) . '</div>'; $r .= '<div class="totals">' . lang::get('{1} species', $rows[0]['value']) . '</div>'; $r .= '</div>'; } return $r; }
/** * Return the Indicia form code. * Expects there to be a sample attribute with caption 'Email' containing the email * address. * @param array $args Input parameters. * @param array $node Drupal node object * @param array $response Response from Indicia services after posting a verification. * @return string HTML */ public static function get_form($args, $node, $response) { if (!self::check_prerequisites()) { return ''; } iform_load_helpers(array('data_entry_helper', 'map_helper', 'report_helper')); $auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']); //Clear Verifier Tasks automatically when they open the screen if the option is set. if ($args['clear_verification_task_notifications'] && hostsite_get_user_field('indicia_user_id')) { self::clear_verifier_task_notifications($auth); } // set some defaults, applied when upgrading from a form configured on a previous form version. if (empty($args['email_subject_send_to_recorder'])) { $args['email_subject_send_to_recorder'] = 'Sample requires confirmation (ID:%id%)'; } if (empty($args['email_body_send_to_recorder'])) { $args['email_body_send_to_recorder'] = 'The following record requires confirmation. Please could you reply to this email stating how confident you are that the record is correct ' . 'and any other information you have which may help to confirm this.' . "\n\n%record%"; } if (isset($_POST['enable'])) { module_enable(array('iform_ajaxproxy')); drupal_set_message(lang::get('The Indicia AJAX Proxy module has been enabled.', 'info')); } elseif (!defined('IFORM_AJAXPROXY_PATH')) { $r = '<p>' . lang::get('The Indicia AJAX Proxy module must be enabled to use this form. This lets the form save verifications to the ' . 'Indicia Warehouse without having to reload the page.') . '</p>'; $r .= '<form method="post">'; $r .= '<input type="hidden" name="enable" value="t"/>'; $r .= '<input type="submit" value="' . lang::get('Enable Indicia AJAX Proxy') . '"/>'; $r .= '</form>'; return $r; } if (function_exists('drupal_add_js')) { drupal_add_js('misc/collapse.js'); } // fancybox for popup comment forms etc data_entry_helper::add_resource('fancybox'); data_entry_helper::add_resource('validation'); $indicia_user_id = self::get_indicia_user_id($args); data_entry_helper::$js_read_tokens = $auth['read']; // Find a list of websites we are allowed verify if (function_exists('module_exists') && module_exists('easy_login')) { if (strpos($args['param_presets'] . $args['param_defaults'], 'expertise_location') === false) { $args['param_presets'] .= "\nexpertise_location={profile_location_expertise}"; } if (strpos($args['param_presets'] . $args['param_defaults'], 'expertise_taxon_groups') === false) { $args['param_presets'] .= "\nexpertise_taxon_groups={profile_taxon_groups_expertise}"; } if (strpos($args['param_presets'] . $args['param_defaults'], 'expertise_surveys') === false) { $args['param_presets'] .= "\nexpertise_surveys={profile_surveys_expertise}"; } } $args['sharing'] = 'verification'; $opts = array_merge(iform_report_get_report_options($args, $auth['read']), array('id' => 'verification-grid', 'reportGroup' => 'verification', 'rowId' => 'sample_id', 'paramsFormButtonCaption' => lang::get('Filter'), 'paramPrefix' => '<div class="report-param">', 'paramSuffix' => '</div>', 'sharing' => 'verification', 'ajax' => TRUE, 'callback' => 'verificationGridLoaded')); $opts['columns'][] = array('display' => '', 'template' => '<div class="nowrap">' . '<input type="hidden" class="row-input-form" value="{rootFolder}{input_form}"/><input type="hidden" class="row-belongs-to-site" value="{belongs_to_site}"/>' . '<input type="checkbox" class="check-row no-select" style="display: none" value="{occurrence_id}" /></div>'); $params = self::report_filter_panel($args, $auth['read']); $opts['zoomMapToOutput'] = false; $grid = report_helper::report_grid($opts); $r = str_replace(array('{grid}', '{paramsForm}'), array($grid, $params), self::get_template_with_map($args, $auth['read'], $opts['extraParams'], $opts['paramDefaults'])); $link = data_entry_helper::get_reload_link_parts(); global $user; data_entry_helper::$js_read_tokens = $auth['read']; data_entry_helper::$javascript .= 'indiciaData.nid = "' . $node->nid . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.username = "******"\";\n"; data_entry_helper::$javascript .= 'indiciaData.userId = "' . $indicia_user_id . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.rootUrl = "' . $link['path'] . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.website_id = ' . $args['website_id'] . ";\n"; data_entry_helper::$javascript .= 'indiciaData.ajaxFormPostUrl="' . iform_ajaxproxy_url($node, 'sample') . "&user_id={$indicia_user_id}&sharing=verification\";\n"; data_entry_helper::$javascript .= 'indiciaData.ajaxUrl="' . url('iform/ajax/verification_samples') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.autoDiscard = ' . $args['auto_discard_rows'] . ";\n"; $imgPath = empty(data_entry_helper::$images_path) ? data_entry_helper::relative_client_helper_path() . "../media/images/" : data_entry_helper::$images_path; data_entry_helper::$javascript .= 'indiciaData.imgPath = "' . $imgPath . "\";\n"; // output some translations for JS to use // @todo: Check list for unused (e.g. query stuff) data_entry_helper::$javascript .= "indiciaData.popupTranslations = {};\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.title="' . lang::get('Add comment regarding setting status to {1}') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.save="' . lang::get('Save and {1}') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.verbV="' . lang::get('accept') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.verbR="' . lang::get('don\'t accept') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.verbC3="' . lang::get('mark as plausible') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.V="' . lang::get('accepted') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.R="' . lang::get('not accepted') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.sub1="' . lang::get('correct') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.sub2="' . lang::get('considered correct') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.sub3="' . lang::get('plausible') . "\";\n"; // @todo: Should this term be unable to accept data_entry_helper::$javascript .= 'indiciaData.popupTranslations.sub4="' . lang::get('unable to verify') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.sub5="' . lang::get('incorrect') . "\";\n"; // IS THIS REQUIRED data_entry_helper::$javascript .= 'indiciaData.popupTranslations.D="' . lang::get('Query') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.tab_email="' . lang::get('Send query as email') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.tab_comment="' . lang::get('Save query to comments log') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.emailTitle="' . lang::get('Email record details') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.emailInstruction="' . lang::get('Use this form to send an email a copy of the record, for example when you would ' . 'like to get the opinion of another expert.') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.sendEmail="' . lang::get('Send Email') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.emailSent="' . lang::get('The email was sent successfully.') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.requestManualEmail="' . lang::get('The webserver is not correctly configured to send emails. Please send the following email usual your email client:') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.multipleWarning="' . lang::get('You are about to process multiple records. Please note that this comment will apply to all the ticked records. ' . 'If you did not intend to do this, please close this box and turn off the Select Records tool before proceeding.') . "\";\n"; // translations for querying data_entry_helper::$javascript .= 'indiciaData.popupTranslations.queryProbablyCantContact="' . lang::get('The record does not have sufficient information for us to be able to contact the recorder. You can leave a query ' . 'in the box below but we cannot guarantee that they will see it.') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.queryNeedsEmail="' . lang::get('The recorder can be contacted by email. If you prefer you can just leave the query as a comment on the ' . 'record but it is unlikely that they will see it as they haven\'t previously checked their notifications.') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.queryProbablyNeedsEmailNo="' . lang::get('The recorder can be contacted by email. If you prefer you can just leave the query as a comment on the ' . 'record but it they are not known to check their notifications so may not spot the query.') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.queryProbablyNeedsEmailUnknown="' . lang::get('The recorder can be contacted by email. If you prefer you can just leave the query as a comment on the ' . 'record though we don\'t have any information to confirm that they will receive the associated notification.') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.queryProbablyWillGetNotified="' . lang::get('The recorder normally checks their notifications so your query can be posted as a comment ' . 'against the record. If you prefer, you can send a direct email.') . "\";\n"; self::translateStatusTerms(); data_entry_helper::$javascript .= "indiciaData.statusTranslations = " . json_encode(self::$statusTerms) . ";\n"; data_entry_helper::$javascript .= "indiciaData.commentTranslations = {};\n"; data_entry_helper::$javascript .= 'indiciaData.commentTranslations.emailed = "' . lang::get('I emailed this sample to {1} for checking.') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.commentTranslations.recorder = "' . lang::get('the recorder') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.commentTranslations.expert = "' . lang::get('an expert') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.email_subject_send_to_verifier = "' . $args['email_subject_send_to_verifier'] . "\";\n"; $body = str_replace(array("\r", "\n", '"'), array('', '\\n', '\\"'), $args['email_body_send_to_verifier']); data_entry_helper::$javascript .= 'indiciaData.email_body_send_to_verifier = "' . $body . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.email_subject_send_to_recorder = "' . $args['email_subject_send_to_recorder'] . "\";\n"; $body = str_replace(array("\r", "\n"), array('', '\\n'), $args['email_body_send_to_recorder']); data_entry_helper::$javascript .= 'indiciaData.email_body_send_to_recorder = "' . $body . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.str_month = "' . lang::get('month') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.expertise_location = "' . $opts['extraParams']['expertise_location'] . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.expertise_surveys = "' . $opts['extraParams']['expertise_surveys'] . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.expertise_taxon_groups = "' . $opts['extraParams']['expertise_taxon_groups'] . "\";\n"; data_entry_helper::add_resource('jqplot'); data_entry_helper::add_resource('jqplot_bar'); return $r; }
protected static function getAnnotationsList($args, $locationId, $auth) { iform_load_helpers(array('report_helper')); $extraParams = array('count_unit_id' => $locationId, 'count_unit_boundary_location_type_id' => $args['count_unit_boundary_location_type_id']); $optionsForAnnotationsReport = array('dataSource' => 'reports_for_prebuilt_forms/CUDI/get_count_unit_annotations', 'readAuth' => $auth['read'], 'extraParams' => $extraParams); //Get the report options such as the Preset Parameters on the Edit Tab $optionsForAnnotationsReport = array_merge(iform_report_get_report_options($args, $readAuth), $optionsForAnnotationsReport); //Collect the annotations from a report. $annotations = report_helper::get_report_data($optionsForAnnotationsReport); return $annotations; }
/** * Return the Indicia form code. * Expects there to be a sample attribute with caption 'Email' containing the email * address. * @param array $args Input parameters. * @param array $node Drupal node object * @param array $response Response from Indicia services after posting a verification. * @return HTML string */ public static function get_form($args, $node, $response) { iform_load_helpers(array('data_entry_helper', 'map_helper', 'report_helper')); $auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']); //Clear Verifier Tasks automatically when they open the screen if the option is set. if ($args['clear_verification_task_notifications'] && hostsite_get_user_field('indicia_user_id')) { self::clear_verifier_task_notifications($auth); } // set some defaults, applied when upgrading from a form configured on a previous form version. if (empty($args['email_subject_send_to_recorder'])) { $args['email_subject_send_to_recorder'] = 'Record of %taxon% requires confirmation (ID:%id%)'; } if (empty($args['email_body_send_to_recorder'])) { $args['email_body_send_to_recorder'] = 'The following record requires confirmation. Please could you reply to this email stating how confident you are that the record is correct ' . 'and any other information you have which may help to confirm this.' . "\n\n%record%"; } if (isset($_POST['enable'])) { module_enable(array('iform_ajaxproxy')); drupal_set_message(lang::get('The Indicia AJAX Proxy module has been enabled.', 'info')); } elseif (!defined('IFORM_AJAXPROXY_PATH')) { $r = '<p>' . lang::get('The Indicia AJAX Proxy module must be enabled to use this form. This lets the form save verifications to the ' . 'Indicia Warehouse without having to reload the page.') . '</p>'; $r .= '<form method="post">'; $r .= '<input type="hidden" name="enable" value="t"/>'; $r .= '<input type="submit" value="' . lang::get('Enable Indicia AJAX Proxy') . '"/>'; $r .= '</form>'; return $r; } if (function_exists('drupal_add_js')) { drupal_add_js('misc/collapse.js'); } // fancybox for popup comment forms etc data_entry_helper::add_resource('fancybox'); data_entry_helper::add_resource('validation'); global $user, $indicia_templates; $indicia_user_id = self::get_indicia_user_id($args); data_entry_helper::$js_read_tokens = $auth['read']; // Find a list of websites we are allowed verify $websiteIds = iform_get_allowed_website_ids($auth['read'], 'verification'); if (function_exists('module_exists') && module_exists('easy_login')) { if (strpos($args['param_presets'] . $args['param_defaults'], 'expertise_location') === false) { $args['param_presets'] .= "\nexpertise_location={profile_location_expertise}"; } if (strpos($args['param_presets'] . $args['param_defaults'], 'expertise_taxon_groups') === false) { $args['param_presets'] .= "\nexpertise_taxon_groups={profile_taxon_groups_expertise}"; } if (strpos($args['param_presets'] . $args['param_defaults'], 'expertise_surveys') === false) { $args['param_presets'] .= "\nexpertise_surveys={profile_surveys_expertise}"; } } $args['sharing'] = 'verification'; $opts = array_merge(iform_report_get_report_options($args, $auth['read']), array('id' => 'verification-grid', 'reportGroup' => 'verification', 'rowId' => 'occurrence_id', 'paramsFormButtonCaption' => lang::get('Filter'), 'paramPrefix' => '<div class="report-param">', 'paramSuffix' => '</div>', 'sharing' => 'verification', 'ajax' => TRUE, 'callback' => 'verificationGridLoaded', 'rowClass' => 'zero-{zero_abundance}')); $opts['columns'][] = array('display' => '', 'template' => '<div class="nowrap"><button class="default-button quick-verify tools-btn" type="button" id="quick-{occurrence_id}" title="Record tools">...</button>' . '<input type="hidden" class="row-input-form" value="{rootFolder}{input_form}"/><input type="hidden" class="row-belongs-to-site" value="{belongs_to_site}"/><ul class="verify-tools"><li><a href="#" class="quick-verify-tool">Bulk verify similar records</a></li>' . '<li><a href="#" class="trust-tool">Recorder\'s trust settings</a></li><li><a href="#" class="edit-record">Edit record</a></li></ul>' . '<input type="checkbox" class="check-row no-select" style="display: none" value="{occurrence_id}" /></div>'); $params = self::report_filter_panel($args, $auth['read']); $opts['zoomMapToOutput'] = false; $grid = report_helper::report_grid($opts); $r = str_replace(array('{grid}', '{paramsForm}'), array($grid, $params), self::get_template_with_map($args, $auth['read'], $opts['extraParams'], $opts['paramDefaults'])); $link = data_entry_helper::get_reload_link_parts(); global $user; data_entry_helper::$js_read_tokens = $auth['read']; data_entry_helper::$javascript .= 'indiciaData.nid = "' . $node->nid . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.username = "******"\";\n"; data_entry_helper::$javascript .= 'indiciaData.userId = "' . $indicia_user_id . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.rootUrl = "' . $link['path'] . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.website_id = ' . $args['website_id'] . ";\n"; data_entry_helper::$javascript .= 'indiciaData.ajaxFormPostUrl="' . iform_ajaxproxy_url($node, 'occurrence') . "&user_id={$indicia_user_id}&sharing=verification\";\n"; data_entry_helper::$javascript .= 'indiciaData.ajaxUrl="' . url('iform/ajax/verification_4') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.autoDiscard = ' . $args['auto_discard_rows'] . ";\n"; if (!empty($args['indicia_species_layer_feature_type']) && !empty(data_entry_helper::$geoserver_url)) { data_entry_helper::$javascript .= "indiciaData.indiciaSpeciesLayer = {\n" . ' "title":"' . lang::get('Online recording data for this species') . "\",\n" . ' "featureType":"' . $args['indicia_species_layer_feature_type'] . "\",\n" . ' "wmsUrl":"' . data_entry_helper::$geoserver_url . "wms\",\n" . ' "cqlFilter":"website_id IN (' . implode(',', $websiteIds) . ') AND ' . $args['indicia_species_layer_filter_field'] . "='{filterValue}'\",\n" . ' "filterField":"' . $args['indicia_species_layer_ds_filter_field'] . "\",\n" . ' "sld":"' . (isset($args['indicia_species_layer_sld']) ? $args['indicia_species_layer_sld'] : '') . "\"\n" . "};\n"; } if (!empty($args['additional_wms_species_layer_title'])) { data_entry_helper::$javascript .= 'indiciaData.wmsSpeciesLayers = [{"title":"' . $args['additional_wms_species_layer_title'] . '",' . '"url":"' . $args['additional_wms_species_layer_url'] . '",' . '"settings":' . $args['additional_wms_species_layer_settings'] . ',' . '"olSettings":' . $args['additional_wms_species_layer_ol_settings'] . "}];\n"; } // output some translations for JS to use data_entry_helper::$javascript .= "indiciaData.popupTranslations = {};\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.title="' . lang::get('Add {1} comment') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.save="' . lang::get('Save and {1}') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.verbV="' . lang::get('verify') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.verbR="' . lang::get('reject') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.verbD="' . lang::get('query') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.V="' . lang::get('Verification') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.R="' . lang::get('Rejection') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.D="' . lang::get('Query') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.emailTitle="' . lang::get('Email record details for checking') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.sendEmail="' . lang::get('Send Email') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.emailSent="' . lang::get('The email was sent successfully.') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.requestManualEmail="' . lang::get('The webserver is not correctly configured to send emails. Please send the following email usual your email client:') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.popupTranslations.multipleWarning="' . lang::get('You are about to verify multiple records. Please note that this comment will apply to all the ticked records. ' . 'If you did not intend to do this, please close this box and turn off the Select Records tool before proceeding.') . "\";\n"; data_entry_helper::$javascript .= "indiciaData.statusTranslations = {};\n"; data_entry_helper::$javascript .= 'indiciaData.statusTranslations.V = "' . lang::get('Verified') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.statusTranslations.R = "' . lang::get('Rejected') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.statusTranslations.D = "' . lang::get('Query') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.statusTranslations.I = "' . lang::get('In progress') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.statusTranslations.T = "' . lang::get('Test record') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.statusTranslations.S = "' . lang::get('Sent for verification') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.statusTranslations.C = "' . lang::get('Awaiting verification') . "\";\n"; data_entry_helper::$javascript .= "indiciaData.commentTranslations = {};\n"; data_entry_helper::$javascript .= 'indiciaData.commentTranslations.emailed = "' . lang::get('I emailed this record to {1} for checking.') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.commentTranslations.recorder = "' . lang::get('the recorder') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.commentTranslations.expert = "' . lang::get('an expert') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.email_subject_send_to_verifier = "' . $args['email_subject_send_to_verifier'] . "\";\n"; $body = str_replace(array("\r", "\n"), array('', '\\n'), $args['email_body_send_to_verifier']); data_entry_helper::$javascript .= 'indiciaData.email_body_send_to_verifier = "' . $body . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.email_subject_send_to_recorder = "' . $args['email_subject_send_to_recorder'] . "\";\n"; $body = str_replace(array("\r", "\n"), array('', '\\n'), $args['email_body_send_to_recorder']); data_entry_helper::$javascript .= 'indiciaData.email_body_send_to_recorder = "' . $body . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.str_month = "' . lang::get('month') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.expertise_location = "' . $opts['extraParams']['expertise_location'] . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.expertise_surveys = "' . $opts['extraParams']['expertise_surveys'] . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.expertise_taxon_groups = "' . $opts['extraParams']['expertise_taxon_groups'] . "\";\n"; data_entry_helper::add_resource('jqplot'); data_entry_helper::add_resource('jqplot_bar'); return $r; }
private static function league_table($auth, $args, $options, $report, $label) { iform_load_helpers(array('report_helper')); $reportOptions = array_merge(iform_report_get_report_options($args, $auth['read']), array('dataSource' => $report, 'limit' => 20), $options); if (hostsite_get_user_field('training')) { $reportOptions['extraParams']['training'] = 'true'; } $reportOptions['extraParams']['limit'] = $reportOptions['limit']; $rows = report_helper::get_report_data($reportOptions); $r = "<table class=\"league\"><thead><th>Pos</th><th>{$label}</th><th>Species</th></thead><tbody>"; if (count($rows)) { $pos = 1; $lastVal = $rows[0]['value']; foreach ($rows as $idx => $row) { if ($row['value'] < $lastVal) { $pos = $idx + 1; // +1 because zero indexed $idx $lastVal = $row['value']; } $r .= "<tr><td>{$pos}</td><td>{$row[name]}</td><td>{$row[value]}</td></tr>\n"; } } else { $r .= '<td colspan="3">' . lang::get('No results yet') . '</td>'; } $r .= '</tbody></table>'; return $r; }