本文整理汇总了PHP中data_entry_helper::georeference_lookup方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::georeference_lookup方法的具体用法?PHP data_entry_helper::georeference_lookup怎么用?PHP data_entry_helper::georeference_lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::georeference_lookup方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_control_placesearch
/**
* Get the location search control.
*/
private static function get_control_placesearch($auth, $args, $tabalias, $options)
{
$georefOpts = iform_map_get_georef_options($args);
if ($georefOpts['driver'] == 'geoplanet' && empty(helper_config::$geoplanet_api_key) || $georefOpts['driver'] == 'google_search_api' && empty(helper_config::$google_search_api_key)) {
// can't use place search without the driver API key
return '';
}
return data_entry_helper::georeference_lookup(array_merge($georefOpts, $options));
}
示例2: get_form
//.........这里部分代码省略.........
$r .= "<div id=\"controls\">\n";
if ($args['interface'] != 'one_page') {
$r .= "<ul>\n";
if (!$logged_in) {
$r .= ' <li><a href="#about_you"><span>' . lang::get('LANG_About_You_Tab') . "</span></a></li>\n";
}
$r .= ' <li><a href="#species"><span>' . lang::get('LANG_Species_Tab') . "</span></a></li>\n";
$r .= ' <li><a href="#place"><span>' . lang::get('LANG_Place_Tab') . "</span></a></li>\n";
$r .= ' <li><a href="#other"><span>' . lang::get('LANG_Other_Information_Tab') . "</span></a></li>\n";
$r .= "</ul>\n";
data_entry_helper::enable_tabs(array('divId' => 'controls', 'style' => $args['interface']));
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (!$logged_in) {
$r .= "<div id=\"about_you\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_About_You_Tab_Instructions') . "</p>";
$defAttrOptions['class'] = 'control-width-4';
$r .= data_entry_helper::outputAttribute($attributes[$args['first_name_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['surname_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['email_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['phone_attr_id']], $defAttrOptions);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'first'));
}
unset($defAttrOptions['class']);
$r .= "</div>\n";
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
global $indicia_templates;
$indicia_templates['taxon_label'] = '<div class="biota"><span class="nobreak sci binomial"><em>{taxon}</em></span> {authority}</div>';
$r .= "<div id=\"species\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_Species_Tab_Instructions') . "</p>";
$extraParams = $readAuth + array('taxon_list_id' => $args['list_id']);
$species_list_args = array('label' => lang::get('occurrence:taxa_taxon_list_id'), 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 1, 'view' => 'detail', 'parentField' => 'parent_id', 'occAttrs' => explode(',', $args['checklist_attributes']), 'extraParams' => $extraParams, 'survey_id' => $args['survey_id']);
$r .= data_entry_helper::species_checklist($species_list_args);
$r .= "<label for=\"sample:comment\">" . lang::get('LANG_Sample_Comment_Label') . "</label><input type=\"text\" id=\"sample:comment\" name=\"sample:comment\" value=\"" . data_entry_helper::$entity_to_load['sample:comment'] . "\" />\n";
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $user->id == 0 ? 'first' : 'middle'));
}
$r .= "</div>\n";
////////////////////////////////////////////////////////////////////////////////////////////////////////////
$r .= "<div id=\"place\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_Place_Tab_Instructions') . "</p>";
// Build the array of spatial reference systems into a format Indicia can use.
$systems = array();
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
$r .= data_entry_helper::sref_and_system(array('label' => lang::get('LANG_SRef_Label'), 'systems' => $systems));
$location_list_args = array('label' => lang::get('LANG_Location_Label'), 'view' => 'detail', 'extraParams' => array_merge(array('view' => 'detail', 'orderby' => 'name'), $extraParams));
$r .= call_user_func(array('data_entry_helper', $args['location_ctrl']), $location_list_args);
$r .= data_entry_helper::georeference_lookup(array('label' => lang::get('LANG_Georef_Label'), 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language']));
$options = iform_map_get_map_options($args, $readAuth);
$options['layers'][] = 'locationLayer';
$olOptions = iform_map_get_ol_options($args);
$r .= data_entry_helper::map_panel($options, $olOptions);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls'));
}
$r .= "</div>\n";
////////////////////////////////////////////////////////////////////////////////////////////////////////////
$r .= "<div id=\"other\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_Other_Information_Tab_Instructions') . "</p>";
$r .= data_entry_helper::date_picker(array('label' => lang::get('LANG_Date'), 'fieldname' => 'sample:date'));
$r .= data_entry_helper::outputAttribute($attributes[$args['biotope_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['voucher_attr_id']], $defAttrOptions);
$values = array('I', 'C');
// not initially doing V=Verified
$r .= '<label for="occurrence:record_status">' . lang::get('LANG_Record_Status_Label') . '</label><select id="occurrence:record_status" name="occurrence:record_status">';
foreach ($values as $value) {
$r .= '<option value="' . $value . '"';
if (isset(data_entry_helper::$entity_to_load['occurrence:record_status'])) {
if (data_entry_helper::$entity_to_load['occurrence:record_status'] == $value) {
$r .= ' selected="selected"';
}
}
$r .= '>' . lang::get('LANG_Record_Status_' . $value) . '</option>';
}
$r .= '</select>';
// TODO image upload - not sure how to do this as images are attached to occurrences, and occurrences
// are embedded in the species list.
// $r .= "<label for='occurrence:image'>".lang::get('LANG_Image_Label')."</label>\n".
// data_entry_helper::image_upload('occurrence:image');
$r .= '<br/><br/>';
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'last'));
} else {
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save') . "\" />\n";
}
$r .= "</div>\n";
$r .= "</div>\n";
if (!empty(data_entry_helper::$validation_errors)) {
$r .= data_entry_helper::dump_remaining_errors();
}
$r .= "</form>";
// may need to keep following code for location change functionality
data_entry_helper::$onload_javascript .= "\n \nlocationChange = function(obj){\n\tlocationLayer.destroyFeatures();\n\tif(obj.value != ''){\n\t\tjQuery.getJSON(\"" . $svcUrl . "\" + \"/data/location/\"+obj.value +\n\t\t\t\"?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"] . "\" +\n\t\t\t\"&callback=?\", function(data) {\n if (data.length>0) {\n \tvar parser = new OpenLayers.Format.WKT();\n \tfor (var i=0;i<data.length;i++)\n\t\t\t\t{\n\t \t\t\tif(data[i].centroid_geom){\n\t\t\t\t\t\tfeature = parser.read(data[i].centroid_geom);\n\t\t\t\t\t\tcentre = feature.geometry.getCentroid();\n\t\t\t\t\t\tcentrefeature = new OpenLayers.Feature.Vector(centre, {}, {label: data[i].name});\n\t\t\t\t\t\tlocationLayer.addFeatures([feature, centrefeature]); \n\t\t\t\t\t}\n\t\t\t\t\tif(data[i].boundary_geom){\n\t\t\t\t\t\tfeature = parser.read(data[i].boundary_geom);\n\t\t\t\t\t\tfeature.style = {strokeColor: \"Blue\",\n \t \tstrokeWidth: 2,\n \t\t\t\t\t\t\tlabel: (data[i].centroid_geom ? \"\" : data[i].name)};\n\t\t\t\t\t\tlocationLayer.addFeatures([feature]);\n \t\t\t\t\t}\n \t\t\t\tlocationLayer.map.zoomToExtent(locationLayer.getDataExtent());\n \t\t\t\t}\n\t\t\t}\n\t\t});\n }\n};\njQuery('#imp-location').unbind('change');\njQuery('#imp-location').change(function(){\n\tlocationChange(this);\n});\n// upload location & sref initial values into map.\njQuery('#imp-location').change();\njQuery('#imp-sref').change();\n\n";
return $r;
}
示例3: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args)
{
global $user;
$logged_in = $user->uid > 0;
$r = "\n<form method=\"post\" id=\"entry_form\">\n";
// Get authorisation tokens to update and read from the Warehouse.
$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
$readAuth = $auth['read'];
// request automatic JS validation
data_entry_helper::enable_validation('entry_form');
$r .= "<div id=\"controls\">\n";
if ($args['interface'] != 'one_page') {
$r .= "<ul>\n";
if (!$logged_in) {
$r .= ' <li><a href="#about_you"><span>' . lang::get('about you') . "</span></a></li>\n";
}
$r .= ' <li><a href="#species"><span>' . lang::get('what did you see') . "</span></a></li>\n";
$r .= ' <li><a href="#place"><span>' . lang::get('where was it') . "</span></a></li>\n";
$r .= ' <li><a href="#other"><span>' . lang::get('other information') . "</span></a></li>\n";
$r .= "</ul>\n";
data_entry_helper::enable_tabs(array('divId' => 'controls', 'style' => $args['interface']));
}
if ($user->uid == 0) {
$r .= "<div id=\"about_you\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('about you tab instructions') . "</p>";
$r .= data_entry_helper::text_input(array('label' => lang::get('first name'), 'fieldname' => 'smpAttr:' . $args['first_name_attr_id'], 'class' => 'control-width-4'));
$r .= data_entry_helper::text_input(array('label' => lang::get('surname'), 'fieldname' => 'smpAttr:' . $args['surname_attr_id'], 'class' => 'control-width-4'));
$r .= data_entry_helper::text_input(array('label' => lang::get('email'), 'fieldname' => 'smpAttr:' . $args['email_attr_id'], 'class' => 'control-width-4'));
$r .= data_entry_helper::text_input(array('label' => lang::get('phone number'), 'fieldname' => 'smpAttr:' . $args['phone_attr_id'], 'class' => 'control-width-4'));
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'first'));
}
$r .= "</div>\n";
}
$r .= "<div id=\"species\">\n";
// Output all our hidden data here
$r .= $auth['write'];
if ($logged_in) {
// If logged in, output some hidden data about the user
$r .= iform_user_get_hidden_inputs($args);
}
$r .= "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
$r .= "<input type=\"hidden\" id=\"survey_id\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />\n";
$r .= "<input type=\"hidden\" id=\"record_status\" name=\"record_status\" value=\"C\" />\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('species tab instructions') . "</p>";
$extraParams = $readAuth + array('taxon_list_id' => $args['list_id']);
if ($args['preferred']) {
$extraParams += array('preferred' => 't');
}
if ($args['restrict_species_to_users_lang']) {
$extraParams += array('language_iso' => iform_lang_iso_639_2($user->lang));
}
$species_list_args = array('label' => lang::get('occurrence:taxa_taxon_list_id'), 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'view' => 'detail', 'parentField' => 'parent_id', 'extraParams' => $extraParams);
if ($args['species_ctrl'] == 'tree_browser') {
// change the node template to include images
global $indicia_templates;
$indicia_templates['tree_browser_node'] = '<div>' . '<img src="' . data_entry_helper::$base_url . '/upload/thumb-{image_path}" alt="Image of {caption}" width="80" /></div>' . '<span>{caption}</span>';
}
// Dynamically generate the species selection control required.
$r .= call_user_func(array('data_entry_helper', $args['species_ctrl']), $species_list_args);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $user->id == 0 ? 'first' : 'middle'));
}
$r .= "</div>\n";
$r .= "<div id=\"place\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('place tab instructions') . "</p>";
// Build the array of spatial reference systems into a format Indicia can use.
$systems = array();
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
$r .= data_entry_helper::sref_and_system(array('label' => lang::get('sample:entered_sref'), 'systems' => $systems));
$r .= data_entry_helper::georeference_lookup(array('label' => lang::get('search for place on map'), 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language']));
// retrieve options for the IndiciaMapPanel, and optionally options for OpenLayers.
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
$r .= data_entry_helper::map_panel($options, $olOptions);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls'));
}
$r .= "</div>\n";
$r .= "<div id=\"other\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('other tab instructions') . "</p>";
$r .= data_entry_helper::date_picker(array('label' => lang::get('Date'), 'fieldname' => 'sample:date'));
$r .= data_entry_helper::file_box(array('caption' => 'Upload your photos', 'resizeWidth' => 1024, 'resizeHeight' => 768, 'table' => 'occurrence_image'));
// Dynamically create a control for the abundance
$abundance_args = array('label' => lang::get('abundance'), 'fieldname' => 'occAttr:' + $args['abundance_attr_id'], 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'extraParams' => $readAuth + array('termlist_id' => $args['abundance_termlist_id']), 'size' => 6, 'sep' => '<br/>');
$r .= call_user_func(array('data_entry_helper', $args['abundance_ctrl']), $abundance_args);
$r .= data_entry_helper::textarea(array('label' => lang::get('sample:comment'), 'fieldname' => 'sample:comment', 'class' => 'wide'));
$r .= '<div class="footer">' . data_entry_helper::checkbox(array('label' => lang::get('happy for contact'), 'labelClass' => 'auto', 'fieldname' => 'smpAttr:' . $args['contact_attr_id'])) . '</div>';
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'last'));
} else {
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"Save\" />\n";
}
//.........这里部分代码省略.........
示例4: get_site_tab
private static function get_site_tab($auth, $args, $settings)
{
$r = '<div id="site-details" class="ui-helper-clearfix">';
$r .= '<form method="post" id="input-form">';
$r .= $auth['write'];
$r .= '<div id="cols" class="ui-helper-clearfix"><div class="left" style="width: 54%">';
$r .= '<fieldset><legend>' . lang::get('Transect Details') . '</legend>';
$r .= "<input type=\"hidden\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
$r .= "<input type=\"hidden\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />\n";
$r .= "<input type=\"hidden\" name=\"location:location_type_id\" value=\"" . $settings['locationTypes'][0]['id'] . "\" />\n";
if ($settings['locationId']) {
$r .= '<input type="hidden" name="location:id" id="location:id" value="' . $settings['locationId'] . "\" />\n";
}
$r .= data_entry_helper::text_input(array('fieldname' => 'location:name', 'label' => lang::get('Transect Name'), 'class' => 'control-width-4 required', 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '));
if (!$settings['canEditBody']) {
$r .= '<p>' . lang::get('This site cannot be edited because there are walks recorded on it. Please contact the site administrator if you think there are details which need changing.') . '</p>';
} else {
if (count($settings['walks']) > 0) {
// can edit it
$r .= '<p>' . lang::get('This site has walks recorded on it. Please do not change the site details without considering the impact on the existing data.') . '</p>';
}
}
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
$r .= data_entry_helper::sref_and_system(array('fieldname' => 'location:centroid_sref', 'geomFieldname' => 'location:centroid_geom', 'label' => 'Grid Ref.', 'systems' => $systems, 'class' => 'required', 'helpText' => lang::get('Click on the map to set the central grid reference.'), 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '));
if ($settings['locationId'] && data_entry_helper::$entity_to_load['location:code'] != '' && data_entry_helper::$entity_to_load['location:code'] != null) {
$r .= data_entry_helper::text_input(array('fieldname' => 'location:code', 'label' => lang::get('Site Code'), 'class' => 'control-width-4', 'disabled' => ' readonly="readonly" '));
} else {
$r .= "<p>" . lang::get('The Site Code will be allocated by the Administrator.') . "</p>";
}
// setup the map options
$options = iform_map_get_map_options($args, $auth['read']);
// find the form blocks that need to go below the map.
$bottom = '';
$bottomBlocks = explode("\n", isset($args['bottom_blocks']) ? $args['bottom_blocks'] : '');
foreach ($bottomBlocks as $block) {
$bottom .= get_attribute_html($settings['attributes'], $args, array('extraParams' => $auth['read'], 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '), $block);
}
// other blocks to go at the top, next to the map
if (isset($args['site_help']) && $args['site_help'] != '') {
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . t($args['site_help']) . '</p>';
}
$r .= get_attribute_html($settings['attributes'], $args, array('extraParams' => $auth['read']));
$r .= '</fieldset>';
$r .= "</div>";
// left
$r .= '<div class="right" style="width: 44%">';
if (!$settings['locationId']) {
$help = t('Use the search box to find a nearby town or village, then drag the map to pan and click on the map to set the centre grid reference of the transect. ' . 'Alternatively if you know the grid reference you can enter it in the Grid Ref box on the left.');
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . $help . '</p>';
$r .= data_entry_helper::georeference_lookup(array('label' => lang::get('Search for place'), 'driver' => $args['georefDriver'], 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language'], 'readAuth' => $auth['read']));
}
if (isset($args['maxPrecision']) && $args['maxPrecision'] != '') {
$options['clickedSrefPrecisionMax'] = $args['maxPrecision'];
}
if (isset($args['minPrecision']) && $args['minPrecision'] != '') {
$options['clickedSrefPrecisionMin'] = $args['minPrecision'];
}
$olOptions = iform_map_get_ol_options($args);
$options['clickForSpatialRef'] = $settings['canEditBody'];
$r .= map_helper::map_panel($options, $olOptions);
$r .= '</div></div>';
// right
if (!empty($bottom)) {
$r .= $bottom;
}
if ($args['branch_assignment_permission'] != '') {
if ($settings['canAllocBranch'] || $settings['locationId']) {
$r .= self::get_branch_assignment_control($auth['read'], $settings['branchCmsUserAttr'], $args, $settings);
}
}
if ($args['allow_user_assignment']) {
if ($settings['canAllocUser']) {
$r .= self::get_user_assignment_control($auth['read'], $settings['cmsUserAttr'], $args);
} else {
if (!$settings['locationId']) {
// for a new record, we need to link the current user to the location if they are not admin.
global $user;
$r .= '<input type="hidden" name="locAttr:' . self::$cmsUserAttrId . '" value="' . $user->uid . '">';
}
}
}
if ($settings['canEditBody']) {
$r .= '<button type="submit" class="indicia-button right">' . lang::get('Save') . '</button>';
}
if ($settings['canEditBody'] && $settings['locationId']) {
$r .= '<button type="button" class="indicia-button right" id="delete-transect">' . lang::get('Delete') . '</button>';
}
$r .= '</form>';
$r .= '</div>';
// site-details
// This must go after the map panel, so it has created its toolbar
data_entry_helper::$onload_javascript .= "\$('#current-section').change(selectSection);\n";
if ($settings['canEditBody'] && $settings['locationId']) {
$walkIDs = array();
foreach ($settings['walks'] as $walk) {
$walkIDs[] = $walk['id'];
}
//.........这里部分代码省略.........
示例5: get_control_placesearch
/**
* Get the location search control.
*/
private static function get_control_placesearch($auth, $args, $tabalias, $options)
{
return data_entry_helper::georeference_lookup(array_merge(iform_map_get_georef_options($args), $options));
}
示例6: get_form
//.........这里部分代码省略.........
}
$r .= "</fieldset>\n";
}
// the species tab is ommitted if the page is called with a taxon in the querystring parameters
if (isset($taxa_taxon_list_id)) {
$r .= "<input type=\"hidden\" name=\"occurrence:taxa_taxon_list_id\" value=\"{$taxa_taxon_list_id}\"/>\n";
} else {
$r .= "<fieldset id=\"species\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('species tab instructions') . "</p>";
$extraParams = $readAuth + array('taxon_list_id' => $args['list_id']);
if ($args['preferred']) {
$extraParams += array('preferred' => 't');
}
if ($args['restrict_species_to_users_lang']) {
$extraParams += array('language_iso' => iform_lang_iso_639_2($user->lang));
}
$species_list_args = array('label' => lang::get('occurrence:taxa_taxon_list_id'), 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'view' => 'detail', 'parentField' => 'parent_id', 'extraParams' => $extraParams);
if ($args['species_ctrl'] == 'tree_browser') {
// change the node template to include images
global $indicia_templates;
$indicia_templates['tree_browser_node'] = '<div>' . '<img src="' . data_entry_helper::$base_url . '/upload/thumb-{image_path}" alt="Image of {caption}" width="80" /></div>' . '<span>{caption}</span>';
}
// Dynamically generate the species selection control required.
$r .= call_user_func(array('data_entry_helper', $args['species_ctrl']), $species_list_args);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $user->id == 0 ? 'first' : 'middle'));
}
$r .= "</fieldset>\n";
}
$r .= "<fieldset id=\"place\">\n";
// Output all our hidden data here, because this tab is always present
$r .= $auth['write'];
if ($logged_in) {
// If logged in, output some hidden data about the user
$r .= iform_user_get_hidden_inputs($args);
}
// if the species being recorded is a fixed species defined in the URL, then output a hidden
if (isset($taxa_taxon_list_id)) {
$r .= "<input type=\"hidden\" name=\"occurrence:taxa_taxon_list_id'\" value=\"" . $taxa_taxon_list_id . "\" />\n";
}
$r .= "<input type=\"hidden\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
$r .= "<input type=\"hidden\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />\n";
$r .= "<input type=\"hidden\" name=\"record_status\" value=\"" . $args['record_status'] . "\" />\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('place tab instructions') . "</p>";
// Build the array of spatial reference systems into a format Indicia can use.
$systems = array();
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
$r .= data_entry_helper::georeference_lookup(iform_map_get_georef_options($args, $auth['read']));
$r .= data_entry_helper::sref_and_system(array('label' => lang::get('sample:entered_sref'), 'systems' => $systems));
// retrieve options for the IndiciaMapPanel, and optionally options for OpenLayers.
$options = iform_map_get_map_options($args, $readAuth);
$options['tabDiv'] = 'place';
$olOptions = iform_map_get_ol_options($args);
$options['scroll_wheel_zoom'] = false;
$r .= data_entry_helper::map_panel($options, $olOptions);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $user->id == 0 && isset($taxa_taxon_list_id) ? 'first' : 'middle'));
}
$r .= "</fieldset>\n";
$r .= "<fieldset id=\"other\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('other tab instructions') . "</p>";
$r .= data_entry_helper::date_picker(array('label' => lang::get('Date'), 'fieldname' => 'sample:date'));
$r .= data_entry_helper::file_box(array('caption' => 'Upload your photos', 'readAuth' => $readAuth, 'resizeWidth' => 1024, 'resizeHeight' => 768, 'table' => 'occurrence_image', 'tabDiv' => 'other', 'runtimes' => array('html5', 'html4')));
// Dynamically create a control for the abundance, unless overridden for this species
if (isset($species) && count($species) > 0 && trim($args['abundance_overrides']) !== '') {
$overrides = explode("\n", $args['abundance_overrides']);
foreach ($overrides as $override) {
$tokens = explode(':', $override);
if ($tokens[0] == $species[0]['taxon']) {
// remove the default abundance attribute behaviour
$args['abundance_attr_id'] = '';
if (trim($tokens[1]) !== '') {
$attrIds = explode(',', $tokens[1]);
$attributes = data_entry_helper::getAttributes(array('id' => null, 'valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => "occAttr", 'extraParams' => $readAuth + array('query' => urlencode(json_encode(array('in' => array('id', $attrIds))))), 'survey_id' => $args['survey_id']));
foreach ($attributes as $attribute) {
$r .= data_entry_helper::outputAttribute($attribute, array('language' => iform_lang_iso_639_2($user->lang), 'booleanCtrl' => 'checkbox'));
}
}
}
}
}
if (!empty($args['abundance_attr_id'])) {
$abundance_args = array('label' => lang::get('abundance'), 'fieldname' => 'occAttr:' . $args['abundance_attr_id'], 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'extraParams' => $readAuth + array('termlist_id' => $args['abundance_termlist_id']), 'size' => 6, 'sep' => '<br/>');
$r .= call_user_func(array('data_entry_helper', $args['abundance_ctrl']), $abundance_args);
}
$r .= data_entry_helper::textarea(array('label' => lang::get('sample:comment'), 'fieldname' => 'sample:comment', 'class' => 'wide'));
$r .= '<div class="footer">' . data_entry_helper::checkbox(array('label' => lang::get('happy for contact'), 'labelClass' => 'auto', 'fieldname' => 'smpAttr:' . $args['contact_attr_id'])) . '</div>';
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'last'));
} else {
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"Save\" />\n";
}
$r .= "</fieldset>\n";
$r .= "</div>\n";
$r .= "</form>";
return $r;
}
示例7: get_form
//.........这里部分代码省略.........
</div>
<div id="insect-filter-header" class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
<div id="fold-insect-button" class="ui-state-default ui-corner-all fold-button fold-button-folded"> </div>
<div id="reset-insect-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="insect-filter-title">
<span>' . lang::get('LANG_Insect_Filter_Title') . '</span>
</div>
</div>
<div id="insect-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-all">
' . data_entry_helper::select($insect_ctrl_args) . '
<input type="text" name="insect:taxon_extra_info" class="taxon-info" value="' . lang::get('LANG_More_Precise') . '"
onclick="if(this.value==\'' . lang::get('LANG_More_Precise') . '\'){this.value=\'\'; this.style.color=\'#000\'}"
onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_More_Precise') . '\'; this.style.color=\'#555\'}" />
</div>
<div id="conditions-filter-header" class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
<div id="fold-conditions-button" class="ui-state-default ui-corner-all fold-button fold-button-folded"> </div>
<div id="reset-conditions-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="conditions-filter-title">
<span>' . lang::get('LANG_Conditions_Filter_Title') . '</span>
</div>
</div>
<div id="conditions-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-all">
' . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['sky_state_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['temperature_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['wind_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['shade_attr_id']], $defAttrOptions)) . '
</div>
<div id="location-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="fold-location-button" class="ui-state-default ui-corner-all fold-button"> </div>
<div id="reset-location-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="location-filter-title">
<span>' . lang::get('LANG_Location_Filter_Title') . '</span>
</div>
</div>
<div id="location-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
<div id="location-entry">
' . data_entry_helper::georeference_lookup(iform_map_get_georef_options($args)) . '
<span id="location-georef-notes" >' . lang::get('LANG_Georef_Notes') . '</span>
<label for="place:INSEE">' . lang::get('LANG_Or') . '</label>
<input type="text" id="place:INSEE" name="place:INSEE" value="' . lang::get('LANG_INSEE') . '"
onclick="if(this.value==\'' . lang::get('LANG_INSEE') . '\'){this.value=\'\'; this.style.color=\'#000\'}"
onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_INSEE') . '\'; this.style.color=\'#555\'}" />
<input type="button" id="search-insee-button" class="ui-corner-all ui-widget-content ui-state-default search-button" value="' . lang::get('search') . '" />
</div>';
// this is a bit of a hack, because the apply_template method is not public in data entry helper.
$tempScript = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = '';
$r .= data_entry_helper::map_panel($options, $olOptions);
$map1JS = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = $tempScript;
$r .= '
</div>
</div>
</div>
<div id="filter-footer" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
<div id="search-insects-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Insects') . '</div>
<div id="search-collections-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Collections') . '</div>
</div>
<div id="results-collections-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-collections-title">
<span>' . lang::get('LANG_Collections_Search_Results') . '</span>
</div>
</div>
<div id="results-collections-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
</div>
<div id="results-insects-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-insects-title">
<span>' . lang::get('LANG_Insects_Search_Results') . '</span>
</div>
示例8: get_sample_form
public static function get_sample_form($args, $node, $response)
{
global $user;
iform_load_helpers(array('map_helper'));
$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
// either looking at existing, creating a new one, or an error occurred: no successful posts...
// first check some conditions are met
$sampleMethods = helper_base::get_termlist_terms($auth, 'indicia:sample_methods', array('Timed Count'));
if (count($sampleMethods) == 0) {
return 'The sample method "Timed Count" must be defined in the termlist in order to use this form.';
}
$sampleId = isset($_GET['sample_id']) ? $_GET['sample_id'] : null;
if ($sampleId && !isset(data_entry_helper::$validation_errors)) {
data_entry_helper::load_existing_record($auth['read'], 'sample', $sampleId);
}
$r = '<form method="post" id="sample">' . $auth['write'];
// we pass through the read auth. This makes it possible for the get_submission method to authorise against the warehouse
// without an additional (expensive) warehouse call, so it can get location details.
$r .= '<input type="hidden" name="read_nonce" value="' . $auth['read']['nonce'] . '"/>';
$r .= '<input type="hidden" name="read_auth_token" value="' . $auth['read']['auth_token'] . '"/>';
if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
$r .= '<input type="hidden" name="sample:id" value="' . data_entry_helper::$entity_to_load['sample:id'] . '"/>';
}
// pass a param that sets the next page to display
$r .= "<input type=\"hidden\" name=\"website_id\" value=\"" . $args['website_id'] . "\"/>\n<input type=\"hidden\" name=\"sample:survey_id\" value=\"" . $args['survey_id'] . "\"/>\n<input type=\"hidden\" name=\"page\" value=\"site\"/>";
$attributes = data_entry_helper::getAttributes(array('id' => $sampleId, 'valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => 'smpAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id'], 'sample_method_id' => $sampleMethods[0]['id']));
$r .= get_user_profile_hidden_inputs($attributes, $args, '', $auth['read']) . data_entry_helper::text_input(array('label' => lang::get('Site Name'), 'fieldname' => 'sample:location_name', 'validation' => array('required')));
$help = lang::get('The Year field is read-only, and is calculated automatically from the date(s) of the Counts.');
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . $help . '</p>';
if ($sampleId == null) {
if (isset($_GET['date'])) {
data_entry_helper::$entity_to_load['C1:sample:date'] = $_GET['date'];
}
$r .= data_entry_helper::date_picker(array('label' => lang::get('Date of first count'), 'fieldname' => 'C1:sample:date', 'validation' => array('required', 'date')));
data_entry_helper::$javascript .= "jQuery('#C1\\\\:sample\\\\:date').change(function(){\n jQuery('#sample\\\\:date').val(jQuery(this).val() == '' ? '' : jQuery(this).datepicker('getDate').getFullYear());\n});\nif(jQuery('#C1\\\\:sample\\\\:date').val() != '') jQuery('#sample\\\\:date').val(jQuery('#C1\\\\:sample\\\\:date').datepicker('getDate').getFullYear());\n";
}
if (isset(data_entry_helper::$entity_to_load['sample:date']) && preg_match('/^(\\d{4})/', data_entry_helper::$entity_to_load['sample:date'])) {
// Date has 4 digit year first (ISO style) - only interested in Year.
$d = new DateTime(data_entry_helper::$entity_to_load['sample:date']);
data_entry_helper::$entity_to_load['sample:date'] = $d->format('Y');
}
unset(data_entry_helper::$default_validation_rules['sample:date']);
$r .= data_entry_helper::text_input(array('label' => lang::get('Year'), 'fieldname' => 'sample:date', 'readonly' => ' readonly="readonly" '));
// are there any option overrides for the custom attributes?
if (isset($args['custom_attribute_options']) && $args['custom_attribute_options']) {
$blockOptions = get_attr_options_array_with_user_data($args['custom_attribute_options']);
} else {
$blockOptions = array();
}
$r .= get_attribute_html($attributes, $args, array('extraParams' => $auth['read']), null, $blockOptions);
$r .= '<input type="hidden" name="sample:sample_method_id" value="' . $sampleMethods[0]['id'] . '" />';
$help = lang::get('Now draw the flight area for the timed count on the map below. The Grid Reference is filled in automatically when the site is drawn.');
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . $help . '</p>';
$options = iform_map_get_map_options($args, $auth['read']);
$options['allowPolygonRecording'] = true;
$options['clickForSpatialRef'] = false;
if (isset($args['precision']) && $args['precision'] != '') {
$options['clickedSrefPrecisionMin'] = $args['precision'];
$options['clickedSrefPrecisionMax'] = $args['precision'];
}
$olOptions = iform_map_get_ol_options($args);
if (!in_array('drawPolygon', $options['standardControls'])) {
$options['standardControls'][] = 'drawPolygon';
}
if (!in_array('modifyFeature', $options['standardControls'])) {
$options['standardControls'][] = 'modifyFeature';
}
$systems = array();
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
$r .= "<label for=\"imp-sref\">" . lang::get('Grid Reference') . ":</label> <input type=\"text\" id=\"imp-sref\" name=\"sample:entered_sref\" value=\"" . data_entry_helper::$entity_to_load['sample:entered_sref'] . "\" readonly=\"readonly\" class=\"required\" />";
$r .= "<input type=\"hidden\" id=\"imp-geom\" name=\"sample:geom\" value=\"" . data_entry_helper::$entity_to_load['sample:geom'] . "\" />";
if (count($systems) == 1) {
// Hidden field for the system
$keys = array_keys($systems);
$r .= "<input type=\"hidden\" id=\"imp-sref-system\" name=\"sample:entered_sref_system\" value=\"" . $keys[0] . "\" />\n";
} else {
$r .= self::sref_system_select(array('fieldname' => 'sample:entered_sref_system'));
}
$r .= '<br />' . data_entry_helper::georeference_lookup(iform_map_get_georef_options($args, $auth['read']));
$r .= data_entry_helper::map_panel($options, $olOptions);
// switch off the sref functionality.
data_entry_helper::$javascript .= "mapInitialisationHooks.push(function(div){\n \$('#imp-sref').unbind('change');\n // Programatic activation does not rippleout, so deactivate Nav first, which is actibve by default.\n for(var i=0; i<div.map.controls.length; i++)\n if(div.map.controls[i].CLASS_NAME == \"OpenLayers.Control.Navigation\")\n div.map.controls[i].deactivate();\n activeCtrl = false;\n for(var i=0; i<div.map.controls.length; i++){\n if(div.map.controls[i].CLASS_NAME == \"" . (isset(data_entry_helper::$entity_to_load['sample:id']) ? "OpenLayers.Control.ModifyFeature" : "OpenLayers.Control.DrawFeature") . "\"){\n div.map.controls[i].activate();\n activeCtrl = div.map.controls[i];\n break;\n }}\n" . (isset(data_entry_helper::$entity_to_load['sample:id']) ? " if(activeCtrl && div.map.editLayer.features.length>0) activeCtrl.selectFeature(div.map.editLayer.features[0]);\n" : "") . "});\n";
$r .= data_entry_helper::textarea(array('label' => 'Comment', 'fieldname' => 'sample:comment', 'class' => 'wide'));
$r .= '<input type="submit" value="' . lang::get('Next') . '" />';
$r .= '<a href="' . $args['summary_page'] . '"><button type="button" class="ui-state-default ui-corner-all" />' . lang::get('Cancel') . '</button></a>';
// allow deletes if sample id is present: i.e. existing sample.
if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
$r .= '<button id="delete-button" type="button" class="ui-state-default ui-corner-all" />' . lang::get('Delete') . '</button>';
// note we only require bare minimum in order to flag a sample as deleted.
$r .= '</form><form method="post" id="delete-form" style="display: none;">';
$r .= $auth['write'];
$r .= '<input type="hidden" name="page" value="delete"/>';
$r .= '<input type="hidden" name="website_id" value="' . $args['website_id'] . '"/>';
$r .= '<input type="hidden" name="sample:id" value="' . data_entry_helper::$entity_to_load['sample:id'] . '"/>';
$r .= '<input type="hidden" name="sample:deleted" value="t"/>';
data_entry_helper::$javascript .= "jQuery('#delete-button').click(function(){\n if(confirm(\"" . lang::get('Are you sure you want to delete this timed count?') . "\"))\n jQuery('#delete-form').submit();\n});\n";
}
//.........这里部分代码省略.........
示例9: get_site_tab
private static function get_site_tab($auth, $args, $settings)
{
$r = '<div id="site-details" class="ui-helper-clearfix">';
$r .= '<form method="post" id="input-form">';
$r .= $auth['write'];
$r .= '<fieldset><legend>' . lang::get('Site Details') . '</legend>';
$r .= "<input type=\"hidden\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
$r .= "<input type=\"hidden\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />\n";
$r .= "<input type=\"hidden\" name=\"location:location_type_id\" value=\"" . $settings['SiteLocationType'][0]['id'] . "\" />\n";
if ($settings['locationId']) {
$r .= '<input type="hidden" name="location:id" id="location:id" value="' . $settings['locationId'] . "\" />\n";
}
$r .= data_entry_helper::text_input(array('fieldname' => 'location:name', 'label' => lang::get('Site Name'), 'class' => 'control-width-4 required'));
$r .= data_entry_helper::sref_and_system(array('fieldname' => 'location:centroid_sref', 'geomFieldname' => 'location:centroid_geom', 'label' => 'Site Central Grid Ref', 'systems' => array('4326' => '4326'), 'class' => 'required', 'disabled' => ' readonly="readonly" ', 'helpText' => lang::get('The following field is filled in automatically when the site is drawn on the map.')));
$r .= '<input type="hidden" name="location:boundary_geom" id="imp-boundary-geom" value="' . data_entry_helper::$entity_to_load['location:boundary_geom'] . '"/>';
// setup the map options
$options = iform_map_get_map_options($args, $auth['read']);
$r .= get_attribute_html($settings['attributes'], $args, array('extraParams' => $auth['read']));
$r .= '</fieldset>';
if (!$settings['locationId']) {
$help = lang::get('Use the search box to find a nearby town or village, then drag the map to pan and zoom in or out to find your site.');
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . $help . '</p>';
$r .= data_entry_helper::georeference_lookup(array('label' => lang::get('Search for place'), 'driver' => $args['georefDriver'], 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language'], 'readAuth' => $auth['read']));
}
$help = '<p>' . lang::get('Draw your site by selecting the appropriate tool in the top right of the map') . ':</p>' . '<ol><li>' . lang::get('Navigation Tool. This allows you to navigate around the map by dragging.') . '</li>' . '<li>' . lang::get('Draw Site Tool. This tool allows you to draw your site on the map. Click on the map to start drawing, and click each time you wish to fix a point on the outline of your site. <b>Double click the last fixed point to finish drawing</b>. Double clicking will replace any previously drawn site outline.') . '</li>' . '<li>' . lang::get('Modify Site Tool. This tool allows you to change the shape of a previously drawn site. Click on the existing site outline to add grab points (circles) along it. You can then click and drag these points to change the shape of the site. To remove a fixed point, hover your mouse over the point and press the "Delete" button on your keyboard.') . '</li></ol>';
if ($args['allow_user_assignment']) {
if ($settings['canAllocUser']) {
$help .= '<p>' . lang::get('You, as a scheme administrator, have the option of changing who the site is assigned to, using control under the map. If you so wish, the site may be assigned to more than one person at a time.') . '</p>';
}
}
$r .= '<div class="page-notice ui-state-highlight ui-corner-all">' . $help . '</div>';
if (isset($args['maxPrecision']) && $args['maxPrecision'] != '') {
$options['clickedSrefPrecisionMax'] = $args['maxPrecision'];
}
if (isset($args['minPrecision']) && $args['minPrecision'] != '') {
$options['clickedSrefPrecisionMin'] = $args['minPrecision'];
}
$olOptions = iform_map_get_ol_options($args);
$options['clickForSpatialRef'] = false;
$options['allowPolygonRecording'] = true;
$options['latLongFormat'] = 'DMS';
$options['autoFillInCentroid'] = true;
$options['initialFeatureWkt'] = false;
$options['initialBoundaryWkt'] = data_entry_helper::$entity_to_load['location:boundary_geom'];
$options['hintModifyFeature'] = lang::get('Modify Site Tool.');
$options['hintDrawPolygonHint'] = lang::get('Draw Site Tool.');
$options['hintNavigation'] = lang::get('Navigation Tool.');
$options['searchDisplaysPoint'] = false;
// with multiple maps can't use built in method on tabshow, so do here...
$divId = preg_replace('/[^a-zA-Z0-9]/', '', 'site-details');
$javascript = "var mapTabHandler = function(event, ui) { \n";
$javascript .= " panel = typeof ui.newPanel==='undefined' ? ui.panel : ui.newPanel[0];\n if (panel.id=='site-details' && typeof indiciaData.mapdiv !== 'undefined') {\n var map = jQuery('#map')[0].map;\n map.updateSize();\n var layerBounds = map.editLayer.getDataExtent().clone(); // use a clone\n map.zoomToExtent(layerBounds);\n }\n};\nindiciaFns.bindTabsActivate(jQuery(jQuery('#site-details').parent()), mapTabHandler);\n";
// Insert this script at the beginning, because it must be done before the tabs are initialised or the
// first tab cannot fire the event
data_entry_helper::$javascript = $javascript . data_entry_helper::$javascript;
$r .= map_helper::map_panel($options, $olOptions);
if ($args['allow_user_assignment']) {
if ($settings['canAllocUser']) {
$r .= self::get_user_assignment_control($auth['read'], $settings['cmsUserAttr'], $args);
} else {
if (!$settings['locationId']) {
// for a new record, we need to link the current user to the location if they are not admin.
global $user;
self::get_user_assignment_control($auth['read'], $settings['cmsUserAttr'], $args);
// this will populate the recorder list.
$r .= '<input type="hidden" name="locAttr:' . self::$cmsUserAttrId . '" value="' . $user->uid . '">';
}
}
}
$r .= '<button type="submit" class="indicia-button right">' . lang::get('Save') . '</button>';
if ($settings['locationId']) {
$r .= '<button type="button" class="indicia-button right" id="delete-site">' . lang::get('Delete') . '</button>';
}
$r .= '</form>';
$r .= '</div>';
// site-details
if ($settings['locationId']) {
$treeIDs = array();
foreach ($settings['trees'] as $id => $tree) {
$treeIDs[] = $tree['id'];
}
data_entry_helper::$javascript .= "\ndeleteSite = function(){\n if(confirm(\"" . lang::get('Are you sure you wish to delete this location?') . "\")){\n deleteTrees([" . implode(',', $treeIDs) . "]);\n \$('#delete-site').html('Deleting Site');\n deleteLocation(" . $settings['locationId'] . ");\n \$('#delete-site').html('Done');\n window.location='" . url($args['sites_list_path']) . "';\n };\n};\n\$('#delete-site').click(deleteSite);\n";
}
return $r;
}
示例10: tab_your_square
protected static function tab_your_square($args, $auth, $attrs)
{
$r = '<fieldset class="ui-corner-all" >';
$r .= '<legend>Place on map</legend>';
$r .= '<div class="two columns"><div class="column">';
$r .= data_entry_helper::georeference_lookup(array('label' => 'Enter the nearest place name', 'labelClass' => 'control-width-5', 'helpText' => 'Enter the name of a nearby town or village then click Search to quickly find the correct region on the map. ' . 'Or if you know the grid reference, type it into the following box.'));
$r .= data_entry_helper::sref_and_system(array('label' => 'Your 1km grid reference', 'labelClass' => 'control-width-5', 'fieldname' => 'sample:entered_sref', 'systems' => array('OSGB' => 'British National Grid', 'OSIE' => 'Irish Grid'), 'class' => 'ui-state-highlight'));
$sq_error = data_entry_helper::check_errors('smpAttr:' . $args['attr_surveyed_square']);
$r .= '<fieldset class="ui-state-highlight ui-corner-all' . ($sq_error ? ' ui-state-error' : '') . '">';
$r .= "<legend>Please also select one of the 3 choices below</legend>\n";
if ($sq_error) {
$r .= "{$sq_error}<br/>\n";
}
// manual output of radio buttons since data_entry_helper::radio_group does not support splicing in the textarea.
$whichSqrAttr = $attrs['smpAttr:' . $args['attr_surveyed_square']];
$reasonAttr = $attrs['smpAttr:' . $args['attr_surveyed_other_square_reason']];
$fieldname = $whichSqrAttr['fieldname'];
$value = $whichSqrAttr['default'];
$r .= '<label class="auto">';
$r .= '<input ';
if ($value == $args['term_surveyed_given_square']) {
$r .= 'checked="checked" ';
}
$r .= 'type="radio" id="attr_surveyed_given_square" value="' . $args['term_surveyed_given_square'] . '" name="' . $whichSqrAttr['fieldname'] . '"/> ';
$r .= "I have surveyed the random square that I was given</label><br/>\n";
$r .= '<label class="auto">';
$r .= '<input ';
if ($value == $args['term_surveyed_other_square']) {
$r .= 'checked="checked" ';
}
$r .= 'type="radio" id="attr_surveyed_other_square" value="' . $args['term_surveyed_other_square'] . '" name="' . $whichSqrAttr['fieldname'] . '"/> ';
$r .= "I have not surveyed the random square because</label><br/>\n";
$r .= data_entry_helper::textarea(array('fieldname' => $reasonAttr['fieldname'], 'class' => 'indented reason', 'default' => $reasonAttr['default'], 'cols' => 50));
$r .= "\n<label class=\"auto\">";
$r .= '<input ';
if ($value == $args['term_surveyed_same_square']) {
$r .= 'checked="checked" ';
}
$r .= 'type="radio" id="attr_surveyed_same_square" value="' . $args['term_surveyed_same_square'] . '" name="' . $whichSqrAttr['fieldname'] . '"/> ';
$r .= "I have resurveyed the same square as before</label>\n";
$r .= '</fieldset>';
$r .= '</div><div class="column">';
$r .= data_entry_helper::map_panel(array('presetLayers' => array('google_hybrid'), 'readAuth' => $auth, 'class' => 'ui-widget-content', 'clickedSrefPrecisionMin' => 4, 'clickedSrefPrecisionMax' => 4, 'initial_lat' => 54, 'initial_long' => -1, 'initial_zoom' => 5, 'width' => '100%', 'tabDiv' => 'your-square'));
$r .= "</div></div></fieldset>\n";
$r .= data_entry_helper::wizard_buttons(array('divId' => 'tabs', 'page' => 'middle'));
return $r;
}
示例11: array
<html>
<head>
<title>Map helper test</title>
<link rel="stylesheet" href="demo.css" type="text/css" media="screen">
<link rel="stylesheet" href="../../media/css/default_site.css" type="text/css" media="screen">
</head>
<body>
<div id="wrap">
<h1>Data Entry Helper Map</h1>
<?php
include '../../client_helpers/data_entry_helper.php';
require 'data_entry_config.php';
$readAuth = data_entry_helper::get_read_auth($config['website_id'], $config['password']);
echo data_entry_helper::sref_and_system(array('label' => 'Spatial Reference'));
echo data_entry_helper::location_select(array('label' => 'Select a known place', 'extraParams' => $readAuth));
echo data_entry_helper::georeference_lookup(array('label' => 'Search for place'));
echo data_entry_helper::postcode_textbox(array('label' => 'Enter postcode', 'hiddenFields' => false, 'fieldname' => 'sample:location_name'));
echo data_entry_helper::map_panel(array('readAuth' => $readAuth));
/*
If you have a GeoServer instance set up and running with your Indicia data as a data source, you can add WMS layers
to the map_panel. In this example the GeoServer instance has a feature type setup to point to the grids_osgb_100k table
as well as a second one setup to point to the samples table. The namespace the feature types are in is called indicia.
echo data_entry_helper::map_panel(array(
'readAuth' => $readAuth,
'indiciaWMSLayers' => array('indicia:grids_osgb_100k', 'indicia:samples')
));
*/
echo data_entry_helper::dump_javascript();
?>
</div>
</body>
示例12: iform_mnhnl_locModTool
function iform_mnhnl_locModTool($auth, $args, $node)
{
global $indicia_templates;
if (!isset($args['clientSideValidation']) || $args['clientSideValidation']) {
data_entry_helper::enable_validation('entry_form');
}
if ($args['locationMode'] == 'multi') {
$args['locationMode'] = 'parent';
}
data_entry_helper::$entity_to_load = array();
$retVal = "<div id=\"locations\">";
if ($args['shpFileDownloadURL'] != "") {
$request = $args['shpFileDownloadURL'] . "/geoserver/wfs?request=GetFeature&service=wfs&version=1.0.0&outputformat=SHAPE-ZIP&srsName=EPSG:2169";
if ($args['LocationTypeTerm'] == '' && isset($args['loctoolsLocTypeID'])) {
$args['LocationTypeTerm'] = $args['loctoolsLocTypeID'];
}
$primary = iform_mnhnl_getTermID($auth, 'indicia:location_types', $args['LocationTypeTerm']);
$request .= "&cql_filter=website_id=" . $args['website_id'] . " AND ";
if ($args['SecondaryLocationTypeTerm'] != '') {
$secondary = iform_mnhnl_getTermID($auth, 'indicia:location_types', $args['SecondaryLocationTypeTerm']);
$request .= "(type_id=" . $primary . "OR type_id=" . $secondary . ")";
} else {
$request .= "type_id=" . $primary;
}
$request .= "&typename=" . $args['shpFileFeaturePrefix'] . ':';
$filedetails = "&format_options=filename:" . $args['reportFilenamePrefix'];
$retValList = "";
if ($args['usePoints'] != 'none' || isset($args['shpDownloadPoints']) && $args['shpDownloadPoints']) {
$retValList .= "<a href=\"" . $request . "point_locations" . $filedetails . "_Points.zip\">" . lang::get('Points') . "</a>";
}
if ($args['useLines'] != 'none' || isset($args['shpDownloadLines']) && $args['shpDownloadLines']) {
$retValList .= ($retValList == "" ? "" : " : ") . "<a href=\"" . $request . "line_locations" . $filedetails . "_Lines.zip\">" . lang::get('Lines') . "</a>";
}
if ($args['usePolygons'] != 'none' || isset($args['shpDownloadPolygons']) && $args['shpDownloadPolygons']) {
$retValList .= ($retValList == "" ? "" : " : ") . "<a href=\"" . $request . "polygon_locations" . $filedetails . "_Polygons.zip\">" . lang::get('Polygons') . "</a>";
}
$retVal .= "<fieldset><legend>" . lang::get('LANG_SHP_Download_Legend') . "</legend>\n <p>" . lang::get('LANG_Shapefile_Download') . " " . $retValList . "</p></fieldset>";
}
$includeOutsideSquare = $args['locationMode'] == 'parent';
// includes multi - see above
// filtered
if ($args['locationMode'] == 'filtered') {
$filterAttrs = explode(',', $args['filterAttrs']);
foreach ($filterAttrs as $idx => $filterAttr) {
$filterAttr = explode(':', $filterAttr);
if ($filterAttr[0] == 'Parent' && $filterAttr[1] == "true") {
$includeOutsideSquare = true;
}
}
}
if ($includeOutsideSquare) {
$confirmedLocationTypeID = iform_mnhnl_getTermID($auth, 'indicia:location_types', $args['SecondaryLocationTypeTerm']);
if (is_null($confirmedLocationTypeID)) {
$confirmedLocationTypeID = "0";
}
$submittedLocationTypeID = iform_mnhnl_getTermID($auth, 'indicia:location_types', $args['LocationTypeTerm']);
$retVal .= "<fieldset><legend>" . lang::get('LANG_Outside_Square_Reports') . "</legend>\n \t<form method='post' action='" . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/luxbio_outside_squares_1.xml&reportSource=local&auth_token=' . $auth['read']['auth_token'] . '&nonce=' . $auth['read']['nonce'] . '&mode=csv&filename=' . $args['reportFilenamePrefix'] . "CentreOutsideSquaresReport'>\n <label style='width:auto;'>" . lang::get('LANG_Outside_Square_Download_1') . ":</label>\n <input type='hidden' name='params' value='{\"website_id\":" . $args['website_id'] . ", \"survey_id\":" . $args['survey_id'] . ", \"primary_loc_type_id\":" . $submittedLocationTypeID . ", \"secondary_loc_type_id\":" . $confirmedLocationTypeID . "}' />\n <input type='submit' class='ui-state-default ui-corner-all' value='" . lang::get('Download') . "'>\n </form>\n \t<form method='post' action='" . data_entry_helper::$base_url . '/index.php/services/report/requestReport?report=reports_for_prebuilt_forms/MNHNL/luxbio_outside_squares_2.xml&reportSource=local&auth_token=' . $auth['read']['auth_token'] . '&nonce=' . $auth['read']['nonce'] . '&mode=csv&filename=' . $args['reportFilenamePrefix'] . "BoundaryCutsSquaresReport'>\n <label style='width:auto;'>" . lang::get('LANG_Outside_Square_Download_2') . ":</label>\n <input type='hidden' name='params' value='{\"website_id\":" . $args['website_id'] . ", \"survey_id\":" . $args['survey_id'] . ", \"primary_loc_type_id\":" . $submittedLocationTypeID . ", \"secondary_loc_type_id\":" . $confirmedLocationTypeID . "}' />\n <input type='submit' class='ui-state-default ui-corner-all' value='" . lang::get('Download') . "'>\n </form>\n </fieldset>";
}
$retVal .= "<form method=\"post\" id=\"entry_form\">" . $auth['write'] . "<input type=\"hidden\" id=\"source\" name=\"source\" value=\"iform_mnhnl_locModTool\" />" . "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />" . "<input type=\"hidden\" id=\"survey_id\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />";
$retVal .= iform_mnhnl_lux5kgridControl($auth, $args, $node, array('Instructions2' => lang::get('LANG_LocModTool_Instructions2'), 'MainFieldLabel' => lang::get('LANG_LocModTool_IDLabel'), 'NameLabel' => lang::get('LANG_LocModTool_NameLabel'), 'ParentLabel' => lang::get('LANG_LocModTool_ParentLabel'), 'AdminMode' => true));
$retVal .= "<label for=\"location-delete\">" . lang::get("LANG_LocModTool_DeleteLabel") . ":</label> <input type=checkbox id=\"location-delete\" name=\"location:deleted\" value='t'><br />\n <p>" . lang::get("LANG_LocModTool_DeleteInstructions") . "</p>";
// location comments are included as a separate control on the main form.
if (isset($args['includeLocationComment']) && $args['includeLocationComment']) {
$retVal .= data_entry_helper::textarea(array('id' => 'location-comment', 'fieldname' => 'location:comment', 'label' => lang::get("LANG_LocationModTool_CommentLabel"))) . "<br />";
}
$laArgs = array("lookUpKey" => "meaning_id", "sep" => " ", "class" => "wide", "tabNameFilter" => "", "numValues" => 10000);
$defs = array();
if (isset($args['siteTabSplitAttrs']) && $args['siteTabSplitAttrs'] != "") {
$defs = explode(':', $args['siteTabSplitAttrs']);
$defs1 = explode(',', $defs[0]);
$laArgs["tabNameFilter"] = $defs1[0];
$laArgs["class"] = $defs1[1];
}
$retVal .= iform_mnhnl_locationattributes($auth, $args, '', $laArgs);
$retVal .= iform_mnhnl_SrefFields($auth, $args, true);
if (count($defs) > 1) {
$defs1 = explode(',', $defs[1]);
$laArgs["tabNameFilter"] = $defs1[0];
$laArgs["class"] = $defs1[1];
$retVal .= iform_mnhnl_locationattributes($auth, $args, '', $laArgs);
}
$args['interface'] = 'Tabs';
$mapOptions = iform_map_get_map_options($args, $auth['read']);
$olOptions = iform_map_get_ol_options($args);
if ($args['locationMode'] != 'parent') {
// this includes multi as well (see above)
// can't call the protested control function
$georefOpts = iform_map_get_georef_options($args, $auth['read']);
// can't use place search without the driver API key
if ($georefOpts['driver'] == 'geoplanet' && empty(helper_config::$geoplanet_api_key)) {
$retVal .= '<p>The form structure includes a [place search] control but needs a geoplanet api key.</p>';
} else {
$retVal .= data_entry_helper::georeference_lookup($georefOpts);
}
$mapOptions['searchLayer'] = true;
$mapOptions['searchUpdatesSref'] = false;
$mapOptions['searchDisplaysPoint'] = false;
}
// For main page we force to Tabs to ensure map drawn correctly
$mapOptions['tabDiv'] = 'locations';
//.........这里部分代码省略.........
示例13: get_control_placesearch
/**
* Get the location search control.
*/
protected static function get_control_placesearch($auth, $args, $tabalias, $options)
{
$georefOpts = iform_map_get_georef_options($args, $auth['read']);
if ($georefOpts['driver'] == 'geoplanet' && empty(helper_config::$geoplanet_api_key)) {
// can't use place search without the driver API key
return 'The form structure includes a [place search] control but needs a geoplanet api key.<br/>';
}
return data_entry_helper::georeference_lookup(array_merge($georefOpts, $options));
}
示例14: get_form
//.........这里部分代码省略.........
<input type="text" size="10" id="start_date" name="start_date" value="' . lang::get('click here') . '" />
<label for="start_date" >' . lang::get('LANG_And') . ':</label>
<input type="text" size="10" id="end_date" name="end_date" value="' . lang::get('click here') . '" />
</div>
<div id="flower-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="fold-flower-button" class="ui-state-default ui-corner-all fold-button"> </div>
<div id="reset-flower-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="flower-filter-title">
<span>' . lang::get('LANG_Flower_Filter_Title') . '</span>
</div>
</div>
<div id="flower-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
' . data_entry_helper::select($flower_ctrl_args) . data_entry_helper::outputAttribute($occurrence_attributes[$args['flower_type_attr_id']], $defAttrOptions) . data_entry_helper::outputAttribute($location_attributes[$args['habitat_attr_id']], $defAttrOptions) . '
</div>
<div id="insect-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="fold-insect-button" class="ui-state-default ui-corner-all fold-button"> </div>
<div id="reset-insect-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="insect-filter-title">
<span>' . lang::get('LANG_Insect_Filter_Title') . '</span>
</div>
</div>
<div id="insect-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
' . data_entry_helper::select($insect_ctrl_args) . data_entry_helper::outputAttribute($sample_attributes[$args['sky_state_attr_id']], $defAttrOptions) . data_entry_helper::outputAttribute($sample_attributes[$args['temperature_attr_id']], $defAttrOptions) . data_entry_helper::outputAttribute($sample_attributes[$args['wind_attr_id']], $defAttrOptions) . data_entry_helper::outputAttribute($sample_attributes[$args['shade_attr_id']], $defAttrOptions) . '
</div>
<div id="location-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="fold-location-button" class="ui-state-default ui-corner-all fold-button"> </div>
<div id="reset-location-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
<div id="location-filter-title">
<span>' . lang::get('LANG_Location_Filter_Title') . '</span>
</div>
</div>
<div id="location-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
<div id="location-entry">
' . data_entry_helper::georeference_lookup(array('label' => lang::get('LANG_Georef_Label'), 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language'], 'suffixTemplate' => 'nosuffix')) . '
<label for="place:INSEE">' . lang::get('LANG_Or') . '</label>
<input type="text" id="place:INSEE" name="place:INSEE" value="' . lang::get('LANG_INSEE') . '"
onclick="if(this.value==\'' . lang::get('LANG_INSEE') . '\'){this.value=\'\'; this.style.color=\'#000\'}"
onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_INSEE') . '\'; this.style.color=\'#555\'}" />
<input type="button" id="search-insee-button" class="ui-corner-all ui-widget-content ui-state-default search-button" value="Search" />
</div>
' . data_entry_helper::map_panel($options, $olOptions) . '
</div>
</div>
</div>
<div id="filter-footer" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
<div id="search-insects-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Insects') . '</div>
<div id="search-collections-button" class="ui-state-default ui-corner-all search-button">' . lang::get('LANG_Search_Collections') . '</div>
</div>
<div id="results-collections-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-collections-title">
<span>' . lang::get('LANG_Collections_Search_Results') . '</span>
</div>
</div>
<div id="results-collections-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
</div>
<div id="results-insects-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-insects-title">
<span>' . lang::get('LANG_Insects_Search_Results') . '</span>
</div>
</div>
<div id="results-insects-results" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
</div>
</div>
<div id="focus-collection" class="ui-accordion ui-widget ui-helper-reset">
<div id="collection-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
<div id="collection-title">
示例15: get_site_tab
private static function get_site_tab($auth, $args, $settings)
{
$r = '<div id="site-details" class="ui-helper-clearfix">';
$r .= '<form method="post" id="input-form">';
$r .= $auth['write'];
$r .= '<div id="cols" class="ui-helper-clearfix"><div class="left" style="width: 54%">';
$r .= '<fieldset><legend>' . lang::get('Site Details') . '</legend>';
$r .= "<input type=\"hidden\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
$typeTerms = array();
if (!empty($args['main_type_term_1'])) {
$typeTerms[] = $args['main_type_term_1'];
}
if (!empty($args['main_type_term_2'])) {
$typeTerms[] = $args['main_type_term_2'];
}
if (!empty($args['main_type_term_3'])) {
$typeTerms[] = $args['main_type_term_3'];
}
$typeTermIDs = helper_base::get_termlist_terms($auth, 'indicia:location_types', $typeTerms);
$lookUpValues = array('' => '<' . lang::get('please select') . '>');
foreach ($typeTermIDs as $termDetails) {
$lookUpValues[$termDetails['id']] = $termDetails['term'];
}
// if location is predefined, can not change unless a 'managerPermission'
$canEditType = !$settings['locationId'] || isset($args['managerPermission']) && $args['managerPermission'] != '' && function_exists('user_access') && user_access($args['managerPermission']);
if ($canEditType) {
$r .= data_entry_helper::select(array('label' => lang::get('Site Type'), 'id' => 'location_type_id', 'fieldname' => 'location:location_type_id', 'lookupValues' => $lookUpValues));
data_entry_helper::$javascript .= "\$('#location_type_id').change(function(){\r\n switch(\$(this).val()){\n";
for ($i = 1; $i < 4; $i++) {
if (!empty($args['main_type_term_' . $i])) {
$type = helper_base::get_termlist_terms($auth, 'indicia:location_types', array($args['main_type_term_' . $i]));
data_entry_helper::$javascript .= " case \"" . $type[0]['id'] . "\":\n";
if (!isset($args['can_change_section_number_' . $i]) || !$args['can_change_section_number_' . $i]) {
if ($settings['locationId']) {
// not saved yet, so no sections yet created, hence no need to worry about existing value. make number attribute readonly. set value. min value will be 1.
data_entry_helper::$javascript .= " var minValue = \$('[name=" . str_replace(':', '\\\\:', $settings['numSectionsAttr']) . "]').attr('min');\r\n if(minValue > " . $args['section_number_' . $i] . ") { // existing value is greater than one we want to set\r\n alert('You are reducing the number of sections below that already existing. Please use the Remove Section button on the Your Route tab to reduce the number of sections to " . $args['section_number_' . $i] . " before changing the Site type');\r\n return false;\r\n }\r\n \$('[name=" . str_replace(':', '\\\\:', $settings['numSectionsAttr']) . "]').val(" . $args['section_number_' . $i] . ").attr('readonly','readonly').css('color','graytext');\n";
} else {
// not saved yet, so no sections yet created, hence no need to worry about existing value. make number attribute readonly. set value. min value will be 1.
data_entry_helper::$javascript .= " \$('[name=" . str_replace(':', '\\\\:', $settings['numSectionsAttr']) . "]').val(" . $args['section_number_' . $i] . ").attr('readonly','readonly').css('color','graytext');\n";
}
} else {
// user modifiable number of sections. value of attribute is left alone: don't have to worry att his point whether existing data.
data_entry_helper::$javascript .= " \$('[name=" . str_replace(':', '\\\\:', $settings['numSectionsAttr']) . "]').removeAttr('readonly').css('color','');\n";
}
data_entry_helper::$javascript .= " break;\n";
}
}
data_entry_helper::$javascript .= " default: break;\r\n };\r\n return true;\r\n});\n";
}
if ($settings['locationId']) {
$r .= '<input type="hidden" name="location:id" id="location:id" value="' . $settings['locationId'] . "\" />\n";
}
$r .= data_entry_helper::text_input(array('fieldname' => 'location:name', 'label' => lang::get('Site Name'), 'class' => 'control-width-4 required', 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '));
if (!$settings['canEditBody']) {
$r .= '<p>' . lang::get('This site cannot be edited because there are walks recorded on it. Please contact the site administrator if you think there are details which need changing.') . '</p>';
} else {
if (count($settings['walks']) > 0) {
// can edit it
$r .= '<p>' . lang::get('This site has walks recorded on it. Please do not change the site details without considering the impact on the existing data.') . '</p>';
}
}
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
if (isset(data_entry_helper::$entity_to_load['location:centroid_sref_system']) && in_array(data_entry_helper::$entity_to_load['location:centroid_sref_system'], array('osgb', 'osie'))) {
data_entry_helper::$entity_to_load['location:centroid_sref_system'] = strtoupper(data_entry_helper::$entity_to_load['location:centroid_sref_system']);
}
$r .= data_entry_helper::sref_and_system(array('fieldname' => 'location:centroid_sref', 'geomFieldname' => 'location:centroid_geom', 'label' => 'Grid Ref.', 'systems' => $systems, 'class' => 'required', 'helpText' => lang::get('Click on the map to set the central grid reference.'), 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '));
if ($settings['locationId'] && data_entry_helper::$entity_to_load['location:code'] != '' && data_entry_helper::$entity_to_load['location:code'] != null) {
$r .= data_entry_helper::text_input(array('fieldname' => 'location:code', 'label' => lang::get('Site Code'), 'class' => 'control-width-4', 'disabled' => ' readonly="readonly" '));
} else {
$r .= "<p>" . lang::get('The Site Code will be allocated by the Administrator.') . "</p>";
}
// setup the map options
$options = iform_map_get_map_options($args, $auth['read']);
// find the form blocks that need to go below the map.
$bottom = '';
$bottomBlocks = explode("\n", isset($args['bottom_blocks']) ? $args['bottom_blocks'] : '');
foreach ($bottomBlocks as $block) {
$bottom .= get_attribute_html($settings['attributes'], $args, array('extraParams' => $auth['read'], 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '), $block);
}
// other blocks to go at the top, next to the map
if (isset($args['site_help']) && $args['site_help'] != '') {
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . t($args['site_help']) . '</p>';
}
$r .= get_attribute_html($settings['attributes'], $args, array('extraParams' => $auth['read']));
$r .= '</fieldset>';
$r .= "</div>";
// left
$r .= '<div class="right" style="width: 44%">';
if (!$settings['locationId']) {
$help = t('Use the search box to find a nearby town or village, then drag the map to pan and click on the map to set the centre grid reference of the transect. ' . 'Alternatively if you know the grid reference you can enter it in the Grid Ref box on the left.');
$r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . $help . '</p>';
$r .= data_entry_helper::georeference_lookup(array('label' => lang::get('Search for place'), 'driver' => $args['georefDriver'], 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language'], 'readAuth' => $auth['read']));
}
if (isset($args['maxPrecision']) && $args['maxPrecision'] != '') {
$options['clickedSrefPrecisionMax'] = $args['maxPrecision'];
}
if (isset($args['minPrecision']) && $args['minPrecision'] != '') {
//.........这里部分代码省略.........