本文整理汇总了PHP中data_entry_helper::sref_textbox方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::sref_textbox方法的具体用法?PHP data_entry_helper::sref_textbox怎么用?PHP data_entry_helper::sref_textbox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::sref_textbox方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args, $node)
{
global $user;
// There is a language entry in the args parameter list: this is derived from the $language DRUPAL global.
// It holds the 2 letter code, used to pick the language file from the lang subdirectory of prebuilt_forms.
// There should be no explicitly output text in this file.
// We must translate any field names and ensure that the termlists and taxonlists use the correct language.
// For attributes, the caption is automatically translated by data_entry_helper.
$logged_in = $user->uid > 0;
$uid = $user->uid;
$email = $user->mail;
$username = $user->name;
if (!user_access('IForm n' . $node->nid . ' access')) {
return "<p>" . lang::get('LANG_Insufficient_Privileges') . "</p>";
}
$r = '';
// Get authorisation tokens to update and read from the Warehouse.
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
$svcUrl = data_entry_helper::$base_url . '/index.php/services';
drupal_add_js(drupal_get_path('module', 'iform') . '/media/js/jquery.form.js', 'module');
data_entry_helper::link_default_stylesheet();
data_entry_helper::add_resource('jquery_ui');
data_entry_helper::add_resource('autocomplete');
if ($args['language'] != 'en') {
data_entry_helper::add_resource('jquery_ui_' . $args['language']);
}
data_entry_helper::enable_validation('cc-1-collection-details');
// don't care about ID itself, just want resources
if ($args['help_module'] != '' && $args['help_inclusion_function'] != '' && module_exists($args['help_module']) && function_exists($args['help_inclusion_function'])) {
$use_help = true;
data_entry_helper::$javascript .= call_user_func($args['help_inclusion_function']);
} else {
$use_help = false;
}
// The only things that will be editable after the collection is saved will be the identifiaction of the flower/insects.
// no id - just getting the attributes, rest will be filled in using AJAX
$sample_attributes = data_entry_helper::getAttributes(array('valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => 'smpAttr', 'extraParams' => $readAuth, 'survey_id' => $args['survey_id']));
$occurrence_attributes = data_entry_helper::getAttributes(array('valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => 'occAttr', 'extraParams' => $readAuth, 'survey_id' => $args['survey_id']));
$location_attributes = data_entry_helper::getAttributes(array('valuetable' => 'location_attribute_value', 'attrtable' => 'location_attribute', 'key' => 'location_id', 'fieldprefix' => 'locAttr', 'extraParams' => $readAuth, 'survey_id' => $args['survey_id']));
$taxon_attributes = data_entry_helper::getAttributes(array('valuetable' => 'taxa_taxon_list_attribute_value', 'attrtable' => 'taxa_taxon_list_attribute', 'key' => 'taxa_taxon_list_id', 'fieldprefix' => 'taxAttr', 'extraParams' => $readAuth), false);
if (count($taxon_attributes) != 1 || $taxon_attributes[0][caption] != "XPER ID") {
return "<p>Internal error: Expected 1 taxon attribute (XPER ID), got " . count($taxon_attributes) . "</p>Dump:<br/>" . print_r($taxon_attributes, true);
}
$defNRAttrOptions = array('extraParams' => $readAuth + array('orderby' => 'id'), 'lookUpListCtrl' => 'radio_group', 'lookUpKey' => 'meaning_id', 'language' => iform_lang_iso_639_2($args['language']), 'booleanCtrl' => 'radio', 'containerClass' => 'group-control-box', 'sep' => ' ');
$defAttrOptions = $defNRAttrOptions;
$defAttrOptions['validation'] = array('required');
$checkOptions = $defNRAttrOptions;
$checkOptions['lookUpListCtrl'] = 'checkbox_group';
$language = iform_lang_iso_639_2($args['language']);
global $indicia_templates;
$indicia_templates['sref_textbox_latlong'] = '<div class="latLongDiv"><label for="{idLat}">{labelLat}:</label>' . '<input type="text" id="{idLat}" name="{fieldnameLat}" {class} {disabled} value="{default}" /></div>' . '<div class="latLongDiv"><label for="{idLong}">{labelLong}:</label>' . '<input type="text" id="{idLong}" name="{fieldnameLong}" {class} {disabled} value="{default}" /></div>';
$base = base_path();
if (substr($base, -1) != '/') {
$base .= '/';
}
$r .= '<script type="text/javascript">
/* <![CDATA[ */
document.write("<div class=\\"ui-widget ui-widget-content ui-corner-all loading-panel\\" ><img src=\\"' . $base . drupal_get_path('module', 'iform') . '/media/images/ajax-loader2.gif\\" />' . lang::get('loading') . '...<span class=\\"poll-loading-extras\\">0</span></div>");
document.write("<div class=\\"poll-loading-hide\\" style=\\"display:none;\\">");
/* ]]> */</script>
';
data_entry_helper::$javascript .= "var flowerTaxa = [";
$extraParams = $readAuth + array('taxon_list_id' => $args['flower_list_id'], 'view' => 'list');
$species_data_def = array('table' => 'taxa_taxon_list', 'extraParams' => $extraParams);
$taxa = data_entry_helper::get_population_data($species_data_def);
$first = true;
// Flowers do not have XPER ID. Flowers list still required to do multiple selection list conversion.
foreach ($taxa as $taxon) {
data_entry_helper::$javascript .= ($first ? '' : ',') . "{id: " . $taxon['id'] . ", taxon: \"" . str_replace('"', '\\"', $taxon['taxon']) . "\"}\n";
$first = false;
}
data_entry_helper::$javascript .= "];\nvar insectTaxa = [";
$extraParams = $readAuth + array('taxon_list_id' => $args['insect_list_id'], 'view' => 'list');
$taxa_attribute_values_data_def = array('table' => 'taxa_taxon_list_attribute_value', 'extraParams' => $extraParams);
$taxa_attribute_values = data_entry_helper::get_population_data($taxa_attribute_values_data_def);
// full list : no allow_data_entry filter.
$extraParams['taxon_list_id'] = $args['insect_list_id'];
$species_data_def['extraParams'] = $extraParams;
$taxa = data_entry_helper::get_population_data($species_data_def);
$first = true;
foreach ($taxa as $taxon) {
// TODO this is not the most performance orientated, but it works.
$xperID = "NoXPERID";
foreach ($taxa_attribute_values as $xperRecord) {
if ($xperRecord["id"] != NULL && $xperRecord['taxa_taxon_list_id'] == $taxon['id']) {
$xperID = $xperRecord['value'];
break;
}
}
data_entry_helper::$javascript .= ($first ? '' : ',') . '{id: ' . $taxon['id'] . ', taxon: "' . str_replace('"', '\\"', $taxon['taxon']) . '", xperID: "' . $xperID . '"}' . "\n";
$first = false;
}
data_entry_helper::$javascript .= "];";
// note we have to proxy the post. Every time a write transaction is carried out, the write nonce is trashed.
// For security reasons we don't want to give the user the ability to generate their own nonce, so we use
// the fact that the user is logged in to drupal as the main authentication/authorisation/identification
//.........这里部分代码省略.........
示例2: get_form
//.........这里部分代码省略.........
<div id="fc-header-buttons">';
if (user_access('IForm n' . $node->nid . ' add preferred collection')) {
$r .= '<span id="fc-add-preferred" class="ui-state-default ui-corner-all preferred-button">' . lang::get('LANG_Add_Preferred_Collection') . '</span>';
}
$r .= '
<span id="fc-prev-button" class="ui-state-default ui-corner-all previous-button">' . lang::get('LANG_Previous') . '</span>
<span id="fc-next-button" class="ui-state-default ui-corner-all next-button">' . lang::get('LANG_Next') . '</span>
<span id="fc-filter-button" class="ui-state-default ui-corner-all collection-button">' . lang::get('LANG_List') . '</span>
</div>
</div>
<div id="collection-details" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-bottom">
<div id="flower-image-container" ><div id="flower-image" class="flower-image"></div>
<div id="show-flower-button" class="ui-state-default ui-corner-all display-button">' . lang::get('LANG_Display') . '</div>
</div>
<div id="environment-image" class="environment-image"></div>
<div id="collection-description">
<p id="collection-date"></p>
<p id="collection-flower-name"></p>
<p>' . lang::get($occurrence_attributes[$args['flower_type_attr_id']]['caption']) . ': <span id="collection-flower-type" class=\\"collection-value\\"></span></p>
<p>' . lang::get($location_attributes[$args['habitat_attr_id']]['caption']) . ': <span id="collection-habitat" class=\\"collection-value\\"></span></p>
<br />
<p id="collection-user-name"></p>
<a id="collection-user-link">' . lang::get('LANG_User_Link') . '</a>
<br />
<p>' . lang::get('LANG_INSEE_Localisation') . '</p><p id="collection-locality"></p>
<div id="fc-new-location">
<p id="fc-new-location-desc">' . lang::get('LANG_Localisation_Desc') . '</p>
<form id="fc-new-location-form" action="' . iform_ajaxproxy_url($node, 'location') . '" method="POST">
<input type="hidden" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" name="survey_id" value="' . $args['survey_id'] . '" />
<input type="hidden" id="imp-sref-system" name="location:centroid_sref_system" value="4326" />
<input type="hidden" name="location:name" value="" />
<input type="hidden" id="location-id" name="location:id" value=""/>
' . data_entry_helper::sref_textbox(array('srefField' => 'location:centroid_sref', 'systemfield' => 'location:centroid_sref_system', 'fieldname' => 'location:centroid_sref', 'splitLatLong' => true, 'labelLat' => lang::get('Latitude'), 'fieldnameLat' => 'place:lat', 'labelLong' => lang::get('Longitude'), 'fieldnameLong' => 'place:long', 'idLat' => 'imp-sref-lat', 'idLong' => 'imp-sref-long', 'suffixTemplate' => 'nosuffix')) . '
<input type="submit" id="fc_location_submit_button" class="ui-state-default ui-corner-all submit-button" value="' . lang::get('LANG_Submit_Location') . '" />
</form>
</div>
</div>
<div id="map2_container">';
// 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($options2, $olOptions);
$map2JS = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = $tempScript;
$r .= '</div>
<div id="fc-new-location-message"></div>
</div>';
if (user_access('IForm n' . $node->nid . ' add to front page')) {
$r .= '<div id="fc-front-page" class="ui-widget-content ui-corner-all">
<form id="fc-front-page-form" action="' . iform_ajaxproxy_url($node, 'sample') . '" method="POST">
<input type="hidden" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" name="survey_id" value="' . $args['survey_id'] . '" />
<input type="hidden" name="sample:id" value="" />
<input type="hidden" name="sample:date_start" value="2010-01-01"/>
<input type="hidden" name="sample:date_end" value="2010-01-01"/>
<input type="hidden" name="sample:date_type" value="D"/>
<input type="hidden" name="sample:location_id" value="" />
<label>' . lang::get('LANG_Front Page') . '</label><div class="control-box "><nobr><span><input type="radio" id="smpAttr:' . $args['front_page_attr_id'] . ':0" name="smpAttr:' . $args['front_page_attr_id'] . '" value="0" checked="checked" /><label for="smpAttr:' . $args['front_page_attr_id'] . ':0">' . lang::get('No') . '</label></span></nobr> <nobr><span><input type="radio" id="smpAttr:' . $args['front_page_attr_id'] . ':1" name="smpAttr:' . $args['front_page_attr_id'] . '" value="1" /><label for="smpAttr:' . $args['front_page_attr_id'] . ':1">' . lang::get('Yes') . '</label></span></nobr></div>
<input type="submit" id="fc_front_page_submit_button" class="ui-state-default ui-corner-all submit-button" value="' . lang::get('LANG_Submit_Front_Page') . '" />
</form>
<div id="fc-front-page-message"></div>
</div>';
}
$r .= '
<div id="collection-insects">
示例3: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args, $node)
{
global $user;
// There is a language entry in the args parameter list: this is derived from the $language DRUPAL global.
// It holds the 2 letter code, used to pick the language file from the lang subdirectory of prebuilt_forms.
// There should be no explicitly output text in this file.
// We must translate any field names and ensure that the termlists and taxonlists use the correct language.
// For attributes, the caption is automatically translated by data_entry_helper.
$logged_in = $user->uid > 0;
$uid = $user->uid;
$email = $user->mail;
$username = $user->name;
if (!user_access('IForm n' . $node->nid . ' access')) {
return "<p>" . lang::get('LANG_Insufficient_Privileges') . "</p>";
}
$r = '';
// Get authorisation tokens to update and read from the Warehouse.
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
$svcUrl = data_entry_helper::$base_url . '/index.php/services';
drupal_add_js(drupal_get_path('module', 'iform') . '/media/js/jquery.form.js', 'module');
data_entry_helper::link_default_stylesheet();
data_entry_helper::add_resource('jquery_ui');
data_entry_helper::enable_validation('cc-1-collection-details');
// don't care about ID itself, just want resources
if ($args['help_module'] != '' && $args['help_inclusion_function'] != '' && module_exists($args['help_module']) && function_exists($args['help_inclusion_function'])) {
$use_help = true;
data_entry_helper::$javascript .= call_user_func($args['help_inclusion_function']);
} else {
$use_help = false;
}
if ($args['ID_tool_module'] != '' && $args['ID_tool_inclusion_function'] != '' && module_exists($args['ID_tool_module']) && function_exists($args['ID_tool_inclusion_function'])) {
$use_ID_tool = true;
data_entry_helper::$javascript .= call_user_func($args['ID_tool_inclusion_function']);
} else {
$use_ID_tool = false;
}
// The only things that will be editable after the collection is saved will be the identifiaction of the flower/insects.
// no id - just getting the attributes, rest will be filled in using AJAX
$sample_attributes = data_entry_helper::getAttributes(array('valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => 'smpAttr', 'extraParams' => $readAuth, 'survey_id' => $args['survey_id']));
$occurrence_attributes = data_entry_helper::getAttributes(array('valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => 'occAttr', 'extraParams' => $readAuth, 'survey_id' => $args['survey_id']));
$location_attributes = data_entry_helper::getAttributes(array('valuetable' => 'location_attribute_value', 'attrtable' => 'location_attribute', 'key' => 'location_id', 'fieldprefix' => 'locAttr', 'extraParams' => $readAuth, 'survey_id' => $args['survey_id']));
$defAttrOptions = array('extraParams' => $readAuth, 'lookUpListCtrl' => 'radio_group', 'validation' => array('required'), 'language' => iform_lang_iso_639_2($args['language']), 'containerClass' => 'group-control-box', 'suffixTemplate' => 'nosuffix');
$language = iform_lang_iso_639_2($args['language']);
global $indicia_templates;
$indicia_templates['sref_textbox_latlong'] = '<label for="{idLat}">{labelLat}:</label>' . '<input type="text" id="{idLat}" name="{fieldnameLat}" {class} {disabled} value="{default}" />' . '<label for="{idLong}">{labelLong}:</label>' . '<input type="text" id="{idLong}" name="{fieldnameLong}" {class} {disabled} value="{default}" />';
$r .= data_entry_helper::loading_block_start();
// note we have to proxy the post. Every time a write transaction is carried out, the write nonce is trashed.
// For security reasons we don't want to give the user the ability to generate their own nonce, so we use
// the fact that the user is logged in to drupal as the main authentication/authorisation/identification
// process for the user. The proxy packages the post into the correct format
//
// There are 2 types of submission:
// When a user validates a panel using the validate button, the following panel is opened on success
// When a user presses a modify button, the open panel gets validated, and the panel to be modified is opened.
$r .= '
<div id="cc-1" class="poll-section">
<div id="cc-1-title" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top poll-section-title">
<span id="cc-1-title-details">' . lang::get('LANG_Collection_Details') . '</span>
<div class="right">
<div>
<span id="cc-1-reinit-button" class="ui-state-default ui-corner-all reinit-button">' . lang::get('LANG_Reinitialise') . '</span>
<span id="cc-1-mod-button" class="ui-state-default ui-corner-all mod-button">' . lang::get('LANG_Modify') . '</span>
</div>
</div>
</div>
<div id="cc-1-details" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active">
<span id="cc-1-protocol-details"></span>
</div>
<div id="cc-1-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active poll-section-body">
<form id="cc-1-collection-details" action="' . iform_ajaxproxy_url($node, 'loc-sample') . '" method="POST">
<input type="hidden" id="website_id" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" id="imp-sref" name="location:centroid_sref" value="" />
<input type="hidden" id="imp-geom" name="location:centroid_geom" value="" />
<input type="hidden" id="imp-sref-system" name="location:centroid_sref_system" value="4326" />
<input type="hidden" id="sample:survey_id" name="sample:survey_id" value="' . $args['survey_id'] . '" />
' . iform_pollenators::help_button($use_help, "collection-help-button", $args['help_function'], $args['help_collection_arg']) . '
<label for="location:name">' . lang::get('LANG_Collection_Name_Label') . '</label>
<input type="text" id="location:name" name="location:name" value="" class="required"/>
<input type="hidden" id="sample:location_name" name="sample:location_name" value=""/>
' . data_entry_helper::outputAttribute($sample_attributes[$args['protocol_attr_id']], $defAttrOptions) . ' <input type="hidden" name="sample:date" value="2010-01-01"/>
<input type="hidden" id="smpAttr:' . $args['complete_attr_id'] . '" name="smpAttr:' . $args['complete_attr_id'] . '" value="0" />
<input type="hidden" id="smpAttr:' . $args['uid_attr_id'] . '" name="smpAttr:' . $args['uid_attr_id'] . '" value="' . $uid . '" />
<input type="hidden" id="smpAttr:' . $args['email_attr_id'] . '" name="smpAttr:' . $args['email_attr_id'] . '" value="' . $email . '" />
<input type="hidden" id="smpAttr:' . $args['username_attr_id'] . '" name="smpAttr:' . $args['username_attr_id'] . '" value="' . $username . '" />
<input type="hidden" id="locations_website:website_id" name="locations_website:website_id" value="' . $args['website_id'] . '" />
<input type="hidden" id="location:id" name="location:id" value="" disabled="disabled" />
<input type="hidden" id="sample:id" name="sample:id" value="" disabled="disabled" />
</form>
<div id="cc-1-valid-button" class="ui-state-default ui-corner-all save-button">' . lang::get('LANG_Validate') . '</div>
</div>
<div style="display:none" />
<form id="cc-1-delete-collection" action="' . iform_ajaxproxy_url($node, 'sample') . '" method="POST">
<input type="hidden" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" name="sample:survey_id" value="' . $args['survey_id'] . '" />
<input type="hidden" name="sample:id" value="" />
<input type="hidden" name="sample:date" value="2010-01-01"/>
//.........这里部分代码省略.........
示例4: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args, $node)
{
global $user;
// There is a language entry in the args parameter list: this is derived from the $language DRUPAL global.
// It holds the 2 letter code, used to pick the language file from the lang subdirectory of prebuilt_forms.
// There should be no explicitly output text in this file.
// We must translate any field names and ensure that the termlists and taxonlists use the correct language.
// For attributes, the caption is automatically translated by data_entry_helper.
$logged_in = $user->uid > 0;
$uid = $user->uid;
$email = $user->mail;
$username = $user->name;
if (!user_access('IForm n' . $node->nid . ' access')) {
return "<p>" . lang::get('LANG_Insufficient_Privileges') . "</p>";
}
$r = '';
// Get authorisation tokens to update and read from the Warehouse.
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
$svcUrl = data_entry_helper::$base_url . '/index.php/services';
drupal_add_js(drupal_get_path('module', 'iform') . '/media/js/jquery.form.js', 'module');
data_entry_helper::link_default_stylesheet();
data_entry_helper::add_resource('jquery_ui');
if ($args['language'] != 'en') {
data_entry_helper::add_resource('jquery_ui_' . $args['language']);
}
data_entry_helper::enable_validation('cc-1-collection-details');
// don't care about ID itself, just want resources
if ($args['help_module'] != '' && $args['help_inclusion_function'] != '' && module_exists($args['help_module']) && function_exists($args['help_inclusion_function'])) {
$use_help = true;
data_entry_helper::$javascript .= call_user_func($args['help_inclusion_function']);
} else {
$use_help = false;
}
// The only things that will be editable after the collection is saved will be the identifiaction of the flower/insects.
// no id - just getting the attributes, rest will be filled in using AJAX
$sample_attributes = data_entry_helper::getAttributes(array('valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => 'smpAttr', 'extraParams' => $readAuth, 'survey_id' => $args['survey_id']));
$occurrence_attributes = data_entry_helper::getAttributes(array('valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => 'occAttr', 'extraParams' => $readAuth, 'survey_id' => $args['survey_id']));
$location_attributes = data_entry_helper::getAttributes(array('valuetable' => 'location_attribute_value', 'attrtable' => 'location_attribute', 'key' => 'location_id', 'fieldprefix' => 'locAttr', 'extraParams' => $readAuth, 'survey_id' => $args['survey_id']));
$defNRAttrOptions = array('extraParams' => $readAuth + array('orderby' => 'id'), 'lookUpListCtrl' => 'radio_group', 'lookUpKey' => 'meaning_id', 'language' => iform_lang_iso_639_2($args['language']), 'containerClass' => 'group-control-box', 'sep' => ' ', 'suffixTemplate' => 'nosuffix');
$defAttrOptions = $defNRAttrOptions;
$defAttrOptions['validation'] = array('required');
$checkOptions = $defNRAttrOptions;
$checkOptions['lookUpListCtrl'] = 'checkbox_group';
$language = iform_lang_iso_639_2($args['language']);
global $indicia_templates;
$indicia_templates['sref_textbox_latlong'] = '<div class="latLongDiv"><label for="{idLat}">{labelLat}:</label>' . '<input type="text" id="{idLat}" name="{fieldnameLat}" {class} {disabled} value="{default}" /></div>' . '<div class="latLongDiv"><label for="{idLong}">{labelLong}:</label>' . '<input type="text" id="{idLong}" name="{fieldnameLong}" {class} {disabled} value="{default}" /></div>';
$r .= data_entry_helper::loading_block_start();
data_entry_helper::$javascript .= "var flowerTaxa = [";
$extraParams = $readAuth + array('taxon_list_id' => $args['flower_list_id'], 'view' => 'list');
$species_data_def = array('table' => 'taxa_taxon_list', 'extraParams' => $extraParams);
$taxa = data_entry_helper::get_population_data($species_data_def);
$first = true;
foreach ($taxa as $taxon) {
data_entry_helper::$javascript .= ($first ? '' : ',') . "{id: " . $taxon['id'] . ", taxon: \"" . htmlSpecialChars($taxon['taxon']) . "\"}\n";
$first = false;
}
data_entry_helper::$javascript .= "];\nvar insectTaxa = [";
$extraParams['taxon_list_id'] = $args['insect_list_id'];
$species_data_def['extraParams'] = $extraParams;
$taxa = data_entry_helper::get_population_data($species_data_def);
$first = true;
foreach ($taxa as $taxon) {
data_entry_helper::$javascript .= ($first ? '' : ',') . "{id: " . $taxon['id'] . ", taxon: \"" . htmlSpecialChars($taxon['taxon']) . "\"}\n";
$first = false;
}
data_entry_helper::$javascript .= "];";
// note we have to proxy the post. Every time a write transaction is carried out, the write nonce is trashed.
// For security reasons we don't want to give the user the ability to generate their own nonce, so we use
// the fact that the user is logged in to drupal as the main authentication/authorisation/identification
// process for the user. The proxy packages the post into the correct format
//
// There are 2 types of submission:
// When a user validates a panel using the validate button, the following panel is opened on success
// When a user presses a modify button, the open panel gets validated, and the panel to be modified is opened.
$r .= '
<div id="refresh-message" style="display:none" ><p>' . lang::get('LANG_Please_Refresh_Page') . '</p></div>
<div id="cc-1" class="poll-section">
<div id="cc-1-title" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top poll-section-title">
<span id="cc-1-title-details">' . lang::get('LANG_Collection_Details') . '</span>
<div class="right">
<div>
<span id="cc-1-reinit-button" class="ui-state-default ui-corner-all reinit-button">' . lang::get('LANG_Reinitialise') . '</span>
<span id="cc-1-mod-button" class="ui-state-default ui-corner-all mod-button">' . lang::get('LANG_Modify') . '</span>
</div>
</div>
</div>
<div id="cc-1-details" class="ui-accordion-content ui-helper-reset ui-widget-content">
<span id="cc-1-protocol-details"></span>
</div>
<div id="cc-1-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active poll-section-body">
<form id="cc-1-collection-details" action="' . iform_ajaxproxy_url($node, 'loc-sample') . '" method="POST">
<input type="hidden" id="website_id" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" id="imp-sref" name="location:centroid_sref" value="" />
<input type="hidden" id="imp-geom" name="location:centroid_geom" value="" />
<input type="hidden" id="imp-sref-system" name="location:centroid_sref_system" value="4326" />
<input type="hidden" id="sample:survey_id" name="sample:survey_id" value="' . $args['survey_id'] . '" />
//.........这里部分代码省略.........
示例5: get_form
//.........这里部分代码省略.........
$r .= ' <div id="collection-details" class="ui-accordion-content ui-helper-reset ui-widget-content ' . (user_access('IForm n' . $node->nid . ' add preferred collection') ? '' : 'ui-corner-bottom') . ' ui-accordion-content-active" ' . (user_access('IForm n' . $node->nid . ' add preferred collection') ? 'style="border-bottom:none;"' : '') . '>
<div id="flower-image-container" ><div id="flower-image" class="flower-image"></div>
<div id="show-flower-button" class="ui-state-default ui-corner-all display-button">' . lang::get('LANG_Display') . '</div>
</div>
<div id="environment-image" class="environment-image"></div>
<div id="collection-description">
<p id="collection-date"></p>
<p id="collection-flower-name"></p>
<p>' . lang::get($occurrence_attributes[$flowerTypeAttrID]['caption']) . ': <span id="collection-flower-type" class="collection-value"></span></p>
<p>' . lang::get($location_attributes[$habitatAttrID]['caption']) . ': <span id="collection-habitat" class="collection-value"></span></p>
<br />
<p id="collection-user-name"></p>
<a id="collection-user-link">' . lang::get('LANG_User_Link') . '</a>
<br /><br />
<p>' . lang::get('LANG_INSEE_Localisation') . ': <span id="collection-locality"></span></p>
<br /><p id="fc-new-location-desc">' . lang::get('LANG_Localisation_Desc') . '</p>
</div>
<div id="map2_container">';
// 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($options2, $olOptions);
$map2JS = data_entry_helper::$onload_javascript;
data_entry_helper::$onload_javascript = $tempScript;
data_entry_helper::$javascript .= "\njQuery('#fc-new-location').find('br').remove();\n";
$r .= '</div>
<div id="fc-new-location">
<form id="fc-new-location-form" action="' . iform_ajaxproxy_url($node, 'location') . '" method="POST">
<input type="hidden" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" name="survey_id" value="' . $args['survey_id'] . '" />
<input type="hidden" id="imp-sref-system" name="location:centroid_sref_system" value="4326" />
<input type="hidden" name="location:name" value="" />
<input type="hidden" id="location-id" name="location:id" value=""/>
' . data_entry_helper::sref_textbox(array('srefField' => 'location:centroid_sref', 'systemfield' => 'location:centroid_sref_system', 'fieldname' => 'location:centroid_sref', 'splitLatLong' => true, 'labelLat' => lang::get('Latitude'), 'fieldnameLat' => 'place:lat', 'labelLong' => lang::get('Longitude'), 'fieldnameLong' => 'place:long', 'idLat' => 'imp-sref-lat', 'idLong' => 'imp-sref-long')) . '
<input type="submit" id="fc_location_submit_button" class="ui-state-default ui-corner-all submit-button" value="' . lang::get('LANG_Submit_Location') . '" />
</form>
</div>
<div id="fc-new-location-message"></div></div>';
if (user_access('IForm n' . $node->nid . ' add preferred collection')) {
$r .= '<div id="preferred-button-container" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content-active"><span id="fc-add-preferred" class="ui-state-default ui-corner-all preferred-button">' . lang::get('LANG_Add_Preferred_Collection') . '</span></div>';
}
if (user_access('IForm n' . $node->nid . ' add to front page')) {
$r .= '<div id="fc-front-page" class="ui-widget-content ui-corner-all">
<form id="fc-front-page-form" action="' . iform_ajaxproxy_url($node, 'sample') . '" method="POST">
<input type="hidden" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" name="survey_id" value="' . $args['survey_id'] . '" />
<input type="hidden" name="sample:id" value="" />
<input type="hidden" name="sample:date_start" value="2010-01-01"/>
<input type="hidden" name="sample:date_end" value="2010-01-01"/>
<input type="hidden" name="sample:date_type" value="D"/>
<input type="hidden" name="sample:location_id" value="" />
<label>' . lang::get('LANG_Front Page') . '</label><div class="control-box "><nobr><span><input type="radio" id="smpAttr:' . $frontPageAttrID . ':0" name="smpAttr:' . $frontPageAttrID . '" value="0" checked="checked" /><label for="smpAttr:' . $frontPageAttrID . ':0">' . lang::get('No') . '</label></span></nobr> <nobr><span><input type="radio" id="smpAttr:' . $frontPageAttrID . ':1" name="smpAttr:' . $frontPageAttrID . '" value="1" /><label for="smpAttr:' . $frontPageAttrID . ':1">' . lang::get('Yes') . '</label></span></nobr></div>
<input type="submit" id="fc_front_page_submit_button" class="ui-state-default ui-corner-all submit-button" value="' . lang::get('LANG_Submit_Front_Page') . '" />
</form>
<div id="fc-front-page-message"></div>
</div>
';
}
$r .= '<div id="collection-insects"></div>';
if (user_access('IForm n' . $node->nid . ' insect expert')) {
$r .= '
<div id="results-validate-collection" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-all">
<div id="validate-collection-button" class="ui-state-default ui-corner-all validate-collection-button">' . lang::get('LANG_Validate_Collection') . '</div>
<div id="validate-collection-progress"></div>
<div id="validate-collection-message"></div>
<div id="cancel-validate-collection" class="ui-state-default ui-corner-all cancel-validate-button">' . lang::get('LANG_Cancel') . '</div>
示例6: get_site_trees_tab
private static function get_site_trees_tab($auth, $args, $settings)
{
global $indicia_templates;
$r = '<div id="site-trees" class="ui-helper-clearfix">';
$r .= '<form method="post" id="tree-form" action="' . self::$ajaxFormUrl . '">';
$help = '<p>' . lang::get('To add a tree, click on the "Add Tree" button. You can then use the map\'s Location Tool to select the approximate location of your tree on the map. A new tree will then appear on the map.') . '</p>' . '<p>' . lang::get('To select a tree from the existing list of trees at this site you can either:') . '</p>' . '<ol><li>' . lang::get('Click on the button for the tree you wish to view, or') . '</li>' . '<li>' . lang::get('Use the map\'s Query Tool to click on the tree you wish to view on the map.') . '</li></ol>' . '<p>' . lang::get('To remove a tree, first select the tree you wish to remove, then click on the "Remove Tree" button. It will remove the current tree you are viewing completely.') . '</p>';
$r .= '<div class="ui-state-highlight page-notice ui-corner-all">' . $help . '</div>';
$r .= self::tree_selector($settings);
$r .= '<input type="button" value="' . lang::get('Remove Tree') . '" class="remove-tree form-button right" title="' . lang::get('Completely remove the highlighted tree. The total number of tree will be reduced by one. The form will be reloaded after the tree is deleted.') . '">';
$r .= '<input type="button" value="' . lang::get('Add Tree') . '" class="insert-tree form-button right" title="' . lang::get('This inserts an extra tree.') . '">';
$r .= '<div id="cols" class="ui-helper-clearfix"><div class="left" style="width: ' . (98 - (isset($args['percent_width']) ? $args['percent_width'] : 50)) . '%">';
$r .= '<fieldset><legend>' . lang::get('Tree Details') . '</legend>';
$r .= '<input type="hidden" name="location:id" value="" id="tree-location-id" />';
$r .= '<input type="hidden" name="locations_website:website_id" value="' . $args['website_id'] . '" id="locations-website-website-id" />';
$r .= '<input type="hidden" name="location:parent_id" value="' . $settings['locationId'] . '" />';
$r .= '<input type="hidden" name="location:location_type_id" value="' . $settings['TreeLocationType'][0]['id'] . '" />';
$r .= '<input type="hidden" name="website_id" value="' . $args['website_id'] . "\" />\n";
$r .= data_entry_helper::text_input(array('fieldname' => 'location:name', 'label' => lang::get('Tree ID'), 'class' => 'control-width-4 required'));
$systems = array();
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
$srefOptions = array('id' => 'imp-sref-tree', 'fieldname' => 'location:centroid_sref', 'geomid' => 'imp-geom-tree', 'geomFieldname' => 'location:centroid_geom', 'label' => 'Grid Ref', 'labelClass' => 'auto', 'class' => 'required', 'helpText' => lang::get('You can also click on the map to set the grid reference. If directly entering the coordinates from a GPS device, set the format to "Lat/Long" first. To enter an OS Grid square, choose the "OSGB" or "OSIE" formats.'));
data_entry_helper::$javascript .= "\n\$('#imp-sref-tree').attr('title',\n '" . lang::get("When directly entering coordinates as a GPS Lat/Long reading, there should be no spaces between the numbers and the letter. " . "The degrees, minutes and seconds must all be separated by a colon (:). The direction letter can be placed at the start or the end of the number (e.g. N56.532 or 56.532N). " . "The figures may be entered as decimal degrees (e.g. 56.532), degrees and decimal minutes (e.g. 56:31.92), or degrees, minutes and decimal seconds (e.g. 56:31:55.2). " . "You can mix the formats of the Latitude and Longitude, provided they each follow the previous guidelines and a space separates them (e.g. N56.532 2:30W).") . " " . lang::get("When directly entering an OS map reference, there should be no spaces between any of the characters. " . "An OSGB reference should comprise of 2 letters followed by an even number of digits (e.g. NT274628). " . "An OSIE reference should comprise of of 1 letter followed by an even number of digits (e.g. J081880).") . "');\n";
// Output the sref control
$r .= data_entry_helper::sref_textbox($srefOptions);
$srefOptions = array('id' => 'imp-sref-system-tree', 'fieldname' => 'location:centroid_sref_system', 'class' => 'required', 'systems' => $systems);
// Output the system control
if (count($systems) < 2) {
// Hidden field for the system
$keys = array_keys($options['systems']);
$r .= "<input type=\"hidden\" id=\"imp-sref-system-tree\" name=\"" . $options['fieldname'] . "\" value=\"" . $keys[0] . "\" />\n";
// TODO self::include_sref_handler_js($options['systems']);
} else {
$r .= data_entry_helper::sref_system_select($srefOptions);
}
$r .= '<input type="hidden" name="survey_id" value="' . $args['survey_id'] . '" />';
$r .= '<input type="hidden" name="sample:survey_id" value="' . $args['survey_id'] . '" />';
$r .= '<input type="hidden" name="sample:id" value="" />';
// this sample will reference the location id.
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) - convert date to expected output format
// @todo The date format should be a global configurable option. It should also be applied to reloading of custom date attributes.
$d = new DateTime(data_entry_helper::$entity_to_load['sample:date']);
data_entry_helper::$entity_to_load['sample:date'] = $d->format('d/m/Y');
}
$r .= data_entry_helper::date_picker(array('label' => lang::get('Date Tree Selected'), 'fieldname' => 'sample:date', 'class' => 'control-width-2 required'));
$r .= '<input type="hidden" id="sample:sample_method_id" value="' . $settings['treeSampleMethod']['id'] . '" name="sample:sample_method_id">';
$r .= '<input type="hidden" id="sample:location_name" value="" name="sample:location_name">';
$r .= '<input type="hidden" name="occurrence:id" value="" id="occurrence:id" />';
$r .= '<input type="hidden" name="occurrence:record_status" value="C" id="occurrence:record_status" />';
$extraParams = $auth['read'];
$extraParams['taxon_list_id'] = $args['taxon_list_id'];
$options = array('speciesNameFilterMode' => $args['speciesNameFilterMode']);
$ctrl = $args['species_ctrl'];
$species_ctrl_opts = array_merge(array('fieldname' => 'occurrence:taxa_taxon_list_id', 'label' => lang::get('Tree Species'), 'columns' => 1, 'parentField' => 'parent_id', 'blankText' => lang::get('Please select'), 'cacheLookup' => false), $options);
if (isset($species_ctrl_opts['extraParams'])) {
$species_ctrl_opts['extraParams'] = array_merge($extraParams, $species_ctrl_opts['extraParams']);
} else {
$species_ctrl_opts['extraParams'] = $extraParams;
}
if (!empty($args['taxon_filter'])) {
$species_ctrl_opts['taxonFilterField'] = $args['taxon_filter_field'];
// applies to autocompletes
$species_ctrl_opts['taxonFilter'] = helper_base::explode_lines($args['taxon_filter']);
// applies to autocompletes
}
// obtain table to query and hence fields to use
$db = data_entry_helper::get_species_lookup_db_definition(false);
// get local vars for the array
extract($db);
if ($ctrl !== 'species_autocomplete') {
// The species autocomplete has built in support for the species name filter.
// For other controls we need to apply the species name filter to the params used for population
if (!empty($species_ctrl_opts['taxonFilter']) || $options['speciesNameFilterMode']) {
$species_ctrl_opts['extraParams'] = array_merge($species_ctrl_opts['extraParams'], data_entry_helper::get_species_names_filter($species_ctrl_opts));
}
// for controls which don't know how to do the lookup, we need to tell them
$species_ctrl_opts = array_merge(array('table' => $tblTaxon, 'captionField' => $colTaxon, 'valueField' => $colId), $species_ctrl_opts);
}
// if using something other than an autocomplete, then set the caption template to include the appropriate names. Autocompletes
// use a JS function instead.
if ($ctrl !== 'autocomplete' && isset($args['species_include_both_names']) && $args['species_include_both_names']) {
if ($args['speciesNameFilterMode'] === 'all') {
$indicia_templates['species_caption'] = "{{$colTaxon}}";
} elseif ($args['speciesNameFilterMode'] === 'language') {
$indicia_templates['species_caption'] = "{{$colTaxon}} - {{$colPreferred}}";
} else {
$indicia_templates['species_caption'] = "{{$colTaxon}} - {{$colCommon}}";
}
$species_ctrl_opts['captionTemplate'] = 'species_caption';
}
if ($ctrl == 'tree_browser') {
// change the node template to include images
$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', $ctrl), $species_ctrl_opts);
$ctrlOptions = array('extraParams' => $auth['read']);
//.........这里部分代码省略.........