/** * Override the get_form_html function. * getForm in dynamic.php will now call this. * Vary the display of the page based on the interface type * * @package Client * @subpackage PrebuiltForms */ protected static function get_form_html($args, $auth, $attributes) { if (empty($_GET['occurrence_id'])) { return 'This form requires an occurrence_id parameter in the URL.'; } else { data_entry_helper::$javascript .= 'indiciaData.username = "******"\";\n"; data_entry_helper::$javascript .= 'indiciaData.user_id = "' . hostsite_get_user_field('indicia_user_id') . "\";\n"; data_entry_helper::$javascript .= 'indiciaData.website_id = ' . $args['website_id'] . ";\n"; data_entry_helper::$javascript .= 'indiciaData.ajaxFormPostUrl="' . iform_ajaxproxy_url(null, 'occurrence') . "&sharing=reporting\";\n"; return parent::get_form_html($args, $auth, $attributes); } }
/** * Override get_form_html so we can store the remembered argument in a global, to make * it available to a hook function which exists outside the form. */ protected static function get_form_html($args, $auth, $attributes) { group_authorise_form($args, $auth['read']); // We always want an autocomplete formatter function for species lookups. The form implementation can // specify its own if required if (method_exists(self::$called_class, 'build_grid_autocomplete_function')) { call_user_func(array(self::$called_class, 'build_grid_autocomplete_function'), $args); } else { $opts = array('cacheLookup' => $args['cache_lookup'], 'speciesIncludeBothNames' => $args['species_include_both_names'], 'speciesIncludeTaxonGroup' => $args['species_include_taxon_group'], 'speciesIncludeIdDiff' => $args['species_include_id_diff']); data_entry_helper::build_species_autocomplete_item_function($opts); } global $remembered; $remembered = isset($args['remembered']) ? $args['remembered'] : ''; if (empty(data_entry_helper::$entity_to_load['sample:group_id']) && !empty($_GET['group_id'])) { data_entry_helper::$entity_to_load['sample:group_id'] = $_GET['group_id']; } if (!empty(data_entry_helper::$entity_to_load['sample:group_id'])) { self::$group = data_entry_helper::get_population_data(array('table' => 'group', 'extraParams' => $auth['read'] + array('view' => 'detail', 'id' => data_entry_helper::$entity_to_load['sample:group_id']))); self::$group = self::$group[0]; $filterdef = json_decode(self::$group['filter_definition']); // does the group filter define a site or boundary for the recording? If so we need to show it and limit the map extent $locationIDToLoad = empty($filterdef->location_id) ? empty($filterdef->indexed_location_id) ? false : $filterdef->indexed_location_id : $filterdef->location_id; if ($locationIDToLoad) { $response = data_entry_helper::get_population_data(array('table' => 'location', 'extraParams' => $auth['read'] + array('id' => $locationIDToLoad, 'view' => 'detail'))); $geom = $response[0]['boundary_geom'] ? $response[0]['boundary_geom'] : $response[0]['centroid_geom']; iform_map_zoom_to_geom($geom, lang::get('Boundary of {1} for the {2} group', $response[0]['name'], self::$group['title']), true); self::hide_other_boundaries($args); } elseif (!empty($filterdef->searchArea)) { iform_map_zoom_to_geom($filterdef->searchArea, lang::get('Recording area for the {1} group', self::$group['title']), true); self::hide_other_boundaries($args); } if (!empty($filterDef->taxon_group_names)) { $args['taxon_filter'] = implode("\n", array_values((array) $filterdef->taxon_group_names)); $args['taxon_filter_field'] = 'taxon_group'; } // @todo Consider other types of species filter, e.g. family or species list? } return parent::get_form_html($args, $auth, $attributes); }
/** * Override get_form_html so we can store the remembered argument in a global, to make * it available to a hook function which exists outside the form. */ protected static function get_form_html($args, $auth, $attributes) { // We always want an autocomplete formatter function for species lookups.. call_user_func(array(self::$called_class, 'build_grid_autocomplete_function'), $args); global $remembered; $remembered = isset($args['remembered']) ? $args['remembered'] : ''; return parent::get_form_html($args, $auth, $attributes); }
/** * Override the get_form_html function. * getForm in dynamic.php will now call this. * Vary the display of the page based on the interface type * * @package Client * @subpackage PrebuiltForms */ protected static function get_form_html($args, $auth, $attributes) { if (isset($_POST['enable'])) { module_enable(array('iform_ajaxproxy')); drupal_set_message(lang::get('The Indicia AJAX Proxy module has been enabled.', 'info')); } if (!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 (empty($_GET['taxa_taxon_list_id']) && empty($_GET['taxon_meaning_id'])) { return 'This form requires a taxa_taxon_list_id or taxon_meaning_id parameter in the URL.'; } self::get_names($auth); hostsite_set_page_title(lang::get('Summary details for {1}', self::$preferred)); return parent::get_form_html($args, $auth, $attributes); }