本文整理汇总了PHP中data_entry_helper::link_default_stylesheet方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::link_default_stylesheet方法的具体用法?PHP data_entry_helper::link_default_stylesheet怎么用?PHP data_entry_helper::link_default_stylesheet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::link_default_stylesheet方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
echo data_entry_helper::hidden_text(array('fieldname' => 'location_medium:location_id', 'default' => html::initial_value($values, 'location_medium:location_id')));
?>
<legend>Media file details</legend>
<?php
$mediaTypeId = html::initial_value($values, 'location_medium:media_type_id');
$mediaType = $mediaTypeId ? $other_data['media_type_terms'][$mediaTypeId] : 'Image:Local';
if ($mediaType === 'Image:Local') {
echo '<label>Image:</label>';
echo html::sized_image(html::initial_value($values, 'occurrence_medium:path')) . '</br>';
echo data_entry_helper::hidden_text(array('fieldname' => 'location_medium:path', 'default' => html::initial_value($values, 'location_medium:path')));
echo data_entry_helper::image_upload(array('label' => 'Upload image file', 'fieldname' => 'image_upload', 'default' => html::initial_value($values, 'location_medium:path')));
} else {
echo data_entry_helper::text_input(array('label' => 'Path or URL', 'fieldname' => 'location_medium:path', 'default' => html::initial_value($values, 'location_medium:path'), 'class' => 'control-width-5'));
}
echo data_entry_helper::text_input(array('label' => 'Caption', 'fieldname' => 'location_medium:caption', 'default' => html::initial_value($values, 'location_medium:caption'), 'class' => 'control-width-5'));
if ($mediaTypeId && $mediaType !== 'Image:Local') {
echo data_entry_helper::select(array('label' => 'Media type', 'fieldname' => 'location_medium:media_type_id', 'default' => $mediaTypeId, 'lookupValues' => $other_data['media_type_terms'], 'blankText' => '<Please select>', 'class' => 'control-width-5'));
}
?>
</fieldset>
<?php
echo html::form_buttons($id != null, false, false);
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
data_entry_helper::enable_validation('location-medium-edit');
data_entry_helper::link_default_stylesheet();
echo data_entry_helper::dump_javascript();
?>
</form>
示例2: 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';
$language = iform_lang_iso_639_2($args['language']);
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('new-comments-form');
// don't care about ID itself, just want resources
$occID = '';
$smpID = '';
$userID = '';
$mode = 'FILTER';
if (array_key_exists('insect_id', $_GET)) {
$occID = $_GET['insect_id'];
$mode = 'INSECT';
} else {
if (array_key_exists('insect', $_GET)) {
$occID = $_GET['insect'];
$mode = 'INSECT';
} else {
if (array_key_exists('flower_id', $_GET)) {
$occID = $_GET['flower_id'];
$mode = 'FLOWER';
} else {
if (array_key_exists('flower', $_GET)) {
$occID = $_GET['flower'];
$mode = 'FLOWER';
} else {
if (array_key_exists('collection_id', $_GET)) {
$smpID = $_GET['collection_id'];
$mode = 'COLLECTION';
} else {
if (array_key_exists('collection', $_GET)) {
$smpID = $_GET['collection'];
$mode = 'COLLECTION';
} else {
if (array_key_exists('user_id', $_GET)) {
$userID = $_GET['user_id'];
} else {
if (array_key_exists('user', $_GET)) {
$userID = $_GET['user'];
}
}
}
}
}
}
}
}
// data_entry_helper::enable_validation('cc-1-collection-details'); // don't care about ID itself, just want resources
// 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 + array('orderby' => 'id'), 'lookUpListCtrl' => 'checkbox_group', 'lookUpKey' => 'meaning_id', 'booleanCtrl' => 'checkbox_group', 'sep' => ' ', 'language' => $language, 'suffixTemplate' => 'nosuffix', 'default' => '-1');
// 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 also packages the post into the correct format
// the controls for the filter include all taxa, not just the ones allowed for data entry, as does the one for checking the tool, just to be on the safe side.
$flower_ctrl_args = array('label' => lang::get('LANG_Flower_Species'), 'fieldname' => 'flower:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'blankText' => lang::get('LANG_Choose_Taxon'), 'extraParams' => $readAuth + array('taxon_list_id' => $args['flower_list_id'], 'view' => 'detail', 'orderby' => 'taxonomic_sort_order'), 'suffixTemplate' => 'nosuffix');
$focus_flower_ctrl_args = $flower_ctrl_args;
$focus_flower_ctrl_args['fieldname'] = 'determination:taxa_taxon_list_id';
$focus_flower_ctrl_args['extraParams'] = $readAuth + array('taxon_list_id' => $args['flower_list_id'], 'view' => 'detail', 'orderby' => 'taxonomic_sort_order', 'allow_data_entry' => 't');
$insect_ctrl_args = array('label' => lang::get('LANG_Insect_Species'), 'fieldname' => 'insect:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'blankText' => lang::get('LANG_Choose_Taxon'), 'extraParams' => $readAuth + array('taxon_list_id' => $args['insect_list_id'], 'view' => 'detail', 'orderby' => 'taxonomic_sort_order'), 'suffixTemplate' => 'nosuffix');
$focus_insect_ctrl_args = $insect_ctrl_args;
$focus_insect_ctrl_args['fieldname'] = 'determination:taxa_taxon_list_id';
$focus_insect_ctrl_args['extraParams'] = $readAuth + array('taxon_list_id' => $args['insect_list_id'], 'view' => 'detail', 'orderby' => 'taxonomic_sort_order', 'allow_data_entry' => 't');
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
// The maps internal projection will be left at its default of 900913.
$options['initialFeatureWkt'] = null;
$options['proxy'] = '';
$options['suffixTemplate'] = 'nosuffix';
if (lang::get('msgGeorefSelectPlace') != 'msgGeorefSelectPlace') {
//.........这里部分代码省略.........
示例3: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args, $node, $response = null)
{
global $user;
global $custom_terms;
$logged_in = $user->uid > 0;
$r = '';
// 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'];
$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');
$language = iform_lang_iso_639_2($args['language']);
if ($args['language'] != 'en') {
data_entry_helper::add_resource('jquery_ui_' . $args['language']);
}
// If not logged in: Display an information message.
// This form should only be called in POST mode when setting the location allocation.
// All other posting is now done via AJAX.
// When invoked by GET there are the following modes:
// No additional arguments: mode 0.
// Additional argument - new : mode 1.
// Additional argument - sample_id=<id> : mode 2.
// Additional argument - occurrence_id=<id> : mode 3.
// Additional arguments - merge_sample_id1=<id>&merge_sample_id2=<id> : mode 2.1
$mode = 0;
// default mode : output survey selector
// mode 1: output the main Data Entry page: occurrence list or add/edit occurrence tabs hidden. "Survey" tab active
// mode 2: output the main Data Entry page, display existing sample. Active tab determined by iform params. No occurence details filled in.
// mode 2.1: sample 2 has all its occurrences merged into sample 1. sample 2 is then flagged as deleted. sample 1 is then viewed as in normal mode 2.
// mode 3: output the main Data Entry page, display existing occurrence. "Edit Occurrence" tab active. Occurence details filled in.
$surveyReadOnly = false;
// On top of this, things can be flagged as readonly. RO mode 2+4 means no Add Occurrence tab.
if (!$logged_in) {
return lang::get('LANG_not_logged_in');
}
$parentSample = array();
$parentLoadID = null;
$childSample = array();
$childLoadID = null;
$thisOccID = -1;
// IDs have to be >0, so this is outside the valid range
// Load up attribute details
$sample_walk_direction_id = self::getAttrID($auth, $args, 'sample', self::ATTR_WALK);
$sample_reliability_id = self::getAttrID($auth, $args, 'sample', self::ATTR_RELIABILITY);
$sample_visit_number_id = self::getAttrID($auth, $args, 'sample', self::ATTR_VISIT);
$sample_wind_id = self::getAttrID($auth, $args, 'sample', self::ATTR_WIND);
$sample_precipitation_id = self::getAttrID($auth, $args, 'sample', self::ATTR_RAIN);
$sample_temperature_id = self::getAttrID($auth, $args, 'sample', self::ATTR_TEMP);
$sample_cloud_id = self::getAttrID($auth, $args, 'sample', self::ATTR_CLOUD);
$sample_start_time_id = self::getAttrID($auth, $args, 'sample', self::ATTR_START_TIME);
$sample_end_time_id = self::getAttrID($auth, $args, 'sample', self::ATTR_END_TIME);
$sample_closure_id = self::getAttrID($auth, $args, 'sample', self::ATTR_CLOSED);
$uid_attr_id = self::getAttrID($auth, $args, 'sample', self::ATTR_UID);
$email_attr_id = self::getAttrID($auth, $args, 'sample', self::ATTR_EMAIL);
$username_attr_id = self::getAttrID($auth, $args, 'sample', self::ATTR_USERNAME);
$occurrence_confidence_id = self::getAttrID($auth, $args, 'occurrence', self::ATTR_CONFIDENCE);
$occurrence_count_id = self::getAttrID($auth, $args, 'occurrence', self::ATTR_COUNT);
$occurrence_approximation_id = self::getAttrID($auth, $args, 'occurrence', self::ATTR_APPROXIMATION);
$occurrence_territorial_id = self::getAttrID($auth, $args, 'occurrence', self::ATTR_TERRITORIAL);
$occurrence_atlas_code_id = self::getAttrID($auth, $args, 'occurrence', self::ATTR_ATLAS_CODE);
$occurrence_overflying_id = self::getAttrID($auth, $args, 'occurrence', self::ATTR_OVERFLYING);
if (!$sample_closure_id) {
return '<p>This form must be used with a survey which has the "' . self::ATTR_CLOSED . '" sample attribute allocated to it. Survey_id = ' . $args['survey_id'];
}
if (!$uid_attr_id) {
return '<p>This form must be used with a survey which has the "' . self::ATTR_UID . '" sample attribute allocated to it. Survey_id = ' . $args['survey_id'];
}
if (!$email_attr_id) {
return '<p>This form must be used with a survey which has the "' . self::ATTR_EMAIL . '" sample attribute allocated to it. Survey_id = ' . $args['survey_id'];
}
if (!$username_attr_id) {
return '<p>This form must be used with a survey which has the "' . self::ATTR_USERNAME . '" sample attribute allocated to it. Survey_id = ' . $args['survey_id'];
}
if (!$sample_walk_direction_id) {
return '<p>This form must be used with a survey which has the "' . self::ATTR_WALK . '" sample attribute allocated to it. Survey_id = ' . $args['survey_id'];
}
if (!$sample_visit_number_id) {
return '<p>This form must be used with a survey which has the "' . self::ATTR_VISIT . '" sample attribute allocated to it. Survey_id = ' . $args['survey_id'];
}
if (!$occurrence_count_id) {
return '<p>This form must be used with a survey which has the "' . self::ATTR_COUNT . '" occurrence attribute allocated to it. Survey_id = ' . $args['survey_id'];
}
if (!$occurrence_territorial_id) {
return '<p>This form must be used with a survey which has the "' . self::ATTR_TERRITORIAL . '" occurrence attribute allocated to it. Survey_id = ' . $args['survey_id'];
}
if (!$occurrence_atlas_code_id) {
return '<p>This form must be used with a survey which has the "' . self::ATTR_ATLAS_CODE . '" occurrence attribute allocated to it. Survey_id = ' . $args['survey_id'];
}
if ($_POST) {
if (!array_key_exists('website_id', $_POST)) {
// non Indicia POST, in this case must be the location allocations. add check to ensure we don't corrept the data by accident
if (iform_loctools_checkaccess($node, 'admin') && array_key_exists('mnhnlbtw', $_POST)) {
iform_loctools_deletelocations($node);
foreach ($_POST as $key => $value) {
//.........这里部分代码省略.........
示例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');
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
//.........这里部分代码省略.........
示例5: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args, $node)
{
$r = '';
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('openlayers');
data_entry_helper::enable_validation('new-comments-form');
// don't care about ID itself, just want resources
data_entry_helper::add_resource('autocomplete');
global $user;
$uid = $user->uid;
$email = $user->mail;
$username = $user->name;
// 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';
// 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 also packages the post into the correct format
// Two insect lists:
// 1) list we are going to pick our old taxa from. This will only be those which data entry is no longer allowed.
// 2) list of new taxa: This will only be those which data entry is allowed
// the controls for the filter include all taxa, not just the ones allowed for data entry, just to be on the safe side.
$source_insect_ctrl_args = array('label' => lang::get('Insect Species'), 'id' => 'insect-taxa-taxon-list-id', 'fieldname' => 'insect:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'listCaptionSpecialChars' => true, 'valueField' => 'id', 'columns' => 2, 'blankText' => lang::get('Choose Taxon'), 'extraParams' => $readAuth + array('taxon_list_id' => $args['insect_list_id'], 'view' => 'detail', 'orderby' => 'taxonomic_sort_order', 'allow_data_entry' => 'f'));
$r .= '<h1 id="poll-banner"></h1>
<div id="refresh-message" style="display:none" ><p>' . lang::get('Please Refresh Page') . '</p></div>
<div id="filter" class="ui-accordion ui-widget ui-helper-reset">
<div id="filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-accordion-content-active ui-corner-top">
<div id="results-collections-title">
<span>' . lang::get('Filter') . '</span>
</div>
</div>
<div id="filter-spec" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active">
<div class="ui-accordion ui-widget ui-helper-reset">
<div id="insect-filter-header" class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
<div id="insect-filter-title">
<span>' . lang::get('Insect Filter') . '</span>
</div>
</div>
<div id="insect-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-all ui-accordion-content-active">
' . data_entry_helper::select($source_insect_ctrl_args) . '
<label >' . lang::get('Status') . ':</label>
<span class="control-box "><nobr>
<span><input type="checkbox" value="X" id="insect_id_status:0" name="insect_id_status[]"><label for="insect_id_status:0">' . lang::get('Unidentified') . '</label></span></nobr> <nobr>
<span><input type="checkbox" value="A" id="insect_id_status:1" name="insect_id_status[]"><label for="insect_id_status:1">' . lang::get('Initial') . '</label></span></nobr> <nobr>
<span><input type="checkbox" value="B" id="insect_id_status:2" name="insect_id_status[]"><label for="insect_id_status:2">' . lang::get('Doubt') . '</label></span></nobr> <nobr>
<span><input type="checkbox" value="C" id="insect_id_status:3" name="insect_id_status[]"><label for="insect_id_status:3">' . lang::get('Validated') . '</label></span></nobr>
</span>
<label >' . lang::get('Identification Type') . ':</label>
<span class="control-box "><nobr>
<span><input type="checkbox" value="seul" id="insect_id_type:0" name="insect_id_type[]"><label for="insect_id_type:0">' . lang::get('Single Taxon') . '</label></span></nobr> <nobr>
<span><input type="checkbox" value="multi" id="insect_id_type:1" name="insect_id_type[]"><label for="insect_id_type:1">' . lang::get('Multiple Taxa') . '</label></span></nobr>
</span>
</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('Search Insects') . '</div>
</div>
<div id="results-reassignment-taxon-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-top">
<div id="results-reassignment-taxon-title">
<span>' . lang::get('Actions To Be Taken') . '</span>
</div>
</div>
<div id="results-reassignment-taxon" class="ui-accordion-content ui-helper-reset ui-widget-content ui-accordion-content-active ui-corner-botton">
<label >' . lang::get('Single?') . '</label><input type="checkbox" value="invalid" id="do-only-one" name="do-only-one"><br/>
<label >' . lang::get('Becomes invalid?') . '</label><input type="checkbox" value="invalid" id="becomes-invalid" name="becomes-invalid"><br/>
<label>New Taxa : </label><table id="new-insect-id-list"><thead><tr><th>Species</th><th>ID</th><th>Remove</th></tr></thead><tbody id="new-insect-id-list-body" class="new-id-list-body"><tr id="insectAutocompleteRow1" class="autocompleteRow"><td>' . lang::get('Add') . ' <input name="insectAutocomplete1" id="insectAutocomplete1" /></td><td><input name="insect2" id="insect2" /></td><td></td></tr></tbody></table>
<form id="bulk-reassignment-form" action="' . iform_ajaxproxy_url($node, 'determination') . '" method="POST" >
<input type="hidden" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" name="determination:occurrence_id" value="" />
<input type="hidden" name="determination:cms_ref" value="' . $uid . '" />
<input type="hidden" name="determination:person_name" value="' . $username . '" />
<input type="hidden" name="determination:email_address" value="' . $email . '" />
<input type="hidden" name="determination:determination_type" value="C" />
<input type="hidden" name="determination:taxon_details" value="" />
<input type="hidden" name="determination:taxa_taxon_list_id" value="" />
<label >Comment : </label><textarea name="determination:comment" class=\\"taxon-comment\\" rows="3" style=\\"width: 480px;\\" />' . lang::get('Réaffectation majeure partie des taxons') . '</textarea>
<input type="hidden" name="determination:taxon_extra_info" value="" />
</form>
<div id="reassign-button" class="ui-state-default ui-corner-all reassign-button">' . lang::get('Reassign Taxon') . '</div>
<div id="reassign-progress"></div>
<div id="reassign-message"></div>
<div id="last-updated"></div>
<div id="cancel-reassign-taxon" class="ui-state-default ui-corner-all cancel-reassign-button">' . lang::get('Cancel') . '</div>
</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('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>
//.........这里部分代码省略.........
示例6: 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"/>
//.........这里部分代码省略.........
示例7: 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('new-comments-form');
// don't care about ID itself, just want resources
$occID = '';
$smpID = '';
$userID = '';
$mode = 'FILTER';
if (array_key_exists('insect_id', $_GET)) {
$occID = $_GET['insect_id'];
$mode = 'INSECT';
} else {
if (array_key_exists('insect', $_GET)) {
$occID = $_GET['insect'];
$mode = 'INSECT';
} else {
if (array_key_exists('flower_id', $_GET)) {
$occID = $_GET['flower_id'];
$mode = 'FLOWER';
} else {
if (array_key_exists('flower', $_GET)) {
$occID = $_GET['flower'];
$mode = 'FLOWER';
} else {
if (array_key_exists('collection_id', $_GET)) {
$smpID = $_GET['collection_id'];
$mode = 'COLLECTION';
} else {
if (array_key_exists('collection', $_GET)) {
$smpID = $_GET['collection'];
$mode = 'COLLECTION';
} else {
if (array_key_exists('user_id', $_GET)) {
$userID = $_GET['user_id'];
} else {
if (array_key_exists('user', $_GET)) {
$userID = $_GET['user'];
}
}
}
}
}
}
}
}
// data_entry_helper::enable_validation('cc-1-collection-details'); // don't care about ID itself, just want resources
// 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']));
$language = iform_lang_iso_639_2($args['language']);
$defAttrOptions = array('extraParams' => $readAuth, 'lookUpListCtrl' => 'checkbox_group', 'booleanCtrl' => 'checkbox', 'sep' => ' ', 'language' => $language, 'suffixTemplate' => 'nosuffix', 'default' => '-1');
// 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
$flower_ctrl_args = array('label' => lang::get('LANG_Flower_Species'), 'fieldname' => 'flower:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'blankText' => lang::get('LANG_Choose_Taxon'), 'extraParams' => $readAuth + array('taxon_list_id' => $args['flower_list_id'], 'orderby' => 'taxon'), 'suffixTemplate' => 'nosuffix');
$focus_flower_ctrl_args = $flower_ctrl_args;
$focus_flower_ctrl_args['fieldname'] = 'determination:taxa_taxon_list_id';
$insect_ctrl_args = array('label' => lang::get('LANG_Insect_Species'), 'fieldname' => 'insect:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'blankText' => lang::get('LANG_Choose_Taxon'), 'extraParams' => $readAuth + array('taxon_list_id' => $args['insect_list_id'], 'orderby' => 'taxon'), 'suffixTemplate' => 'nosuffix');
$focus_insect_ctrl_args = $insect_ctrl_args;
$focus_insect_ctrl_args['fieldname'] = 'determination:taxa_taxon_list_id';
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
// The maps internal projection will be left at its default of 900913.
$options['initialFeatureWkt'] = null;
$options['proxy'] = '';
$options['suffixTemplate'] = 'nosuffix';
$options2 = $options;
$options['searchLayer'] = 'true';
$options['editLayer'] = 'false';
$options['layers'] = array('polygonLayer');
$options2['divId'] = "map2";
$options2['layers'] = array('locationLayer');
// TBD Breadcrumb
//.........这里部分代码省略.........
示例8: 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'] . '" />
//.........这里部分代码省略.........
示例9: get_form
/**
*
*/
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';
$language = iform_lang_iso_639_2($args['language']);
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('new-comments-form');
// don't care about ID itself, just want resources
data_entry_helper::add_resource('autocomplete');
$occID = '';
$smpID = '';
$userID = '';
$mode = 'FILTER';
if (array_key_exists('insect_id', $_GET)) {
$occID = $_GET['insect_id'];
$mode = 'INSECT';
} else {
if (array_key_exists('insect', $_GET)) {
$occID = $_GET['insect'];
$mode = 'INSECT';
} else {
if (array_key_exists('flower_id', $_GET)) {
$occID = $_GET['flower_id'];
$mode = 'FLOWER';
} else {
if (array_key_exists('flower', $_GET)) {
$occID = $_GET['flower'];
$mode = 'FLOWER';
} else {
if (array_key_exists('collection_id', $_GET)) {
$smpID = $_GET['collection_id'];
$mode = 'COLLECTION';
} else {
if (array_key_exists('collection', $_GET)) {
$smpID = $_GET['collection'];
$mode = 'COLLECTION';
} else {
if (array_key_exists('user_id', $_GET)) {
$userID = $_GET['user_id'];
} else {
if (array_key_exists('user', $_GET)) {
$userID = $_GET['user'];
}
}
}
}
}
}
}
}
// The only things that will be editable after the collection is saved will be the identification 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']));
$uidAttrID = self::getAttrID($readAuth, $args, 'sample', 'CMS User ID');
$usernameAttrID = self::getAttrID($readAuth, $args, 'sample', 'CMS Username');
$frontPageAttrID = self::getAttrID($readAuth, $args, 'sample', 'FrontPage');
$startTimeAttrID = self::getAttrID($readAuth, $args, 'sample', 'Start Time');
$endTimeAttrID = self::getAttrID($readAuth, $args, 'sample', 'End Time');
$skyAttrID = self::getAttrID($readAuth, $args, 'sample', 'Sky');
$temperatureAttrID = self::getAttrID($readAuth, $args, 'sample', 'Temperature');
$shadeAttrID = self::getAttrID($readAuth, $args, 'sample', 'Shade');
$windAttrID = self::getAttrID($readAuth, $args, 'sample', 'Wind');
$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']));
$flowerTypeAttrID = self::getAttrID($readAuth, $args, 'occurrence', 'Flower Type');
$foragingAttrID = self::getAttrID($readAuth, $args, 'occurrence', 'Foraging');
$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']));
$habitatAttrID = self::getAttrID($readAuth, $args, 'location', 'Habitat');
$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>";
}
$defAttrOptions = array('extraParams' => $readAuth + array('orderby' => 'id'), 'lookUpListCtrl' => 'checkbox_group', 'lookUpKey' => 'meaning_id', 'booleanCtrl' => 'checkbox_group', 'sep' => ' ', 'language' => $language, 'default' => '-1');
// 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 also packages the post into the correct format
// the controls for the filter include all taxa, not just the ones allowed for data entry, as does the one for checking the tool, just to be on the safe side.
//.........这里部分代码省略.........
示例10: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args, $node, $response = null)
{
global $user;
global $custom_terms;
$logged_in = $user->uid > 0;
$r = '';
// Get authorisation tokens to update and read from the Warehouse.
$writeAuth = data_entry_helper::get_auth($args['website_id'], $args['password']);
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
$svcUrl = data_entry_helper::$base_url . '/index.php/services';
$presetLayers = array();
// read out the activated preset layers
if (isset($args['preset_layers'])) {
foreach ($args['preset_layers'] as $layer => $active) {
if ($active !== 0) {
$presetLayers[] = $layer;
}
}
}
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']);
}
// If not logged in: Display an information message.
// This form should only be called in POST mode when setting the location allocation.
// All other posting is now done via AJAX.
// When invoked by GET there are the following modes:
// No additional arguments: mode 0.
// Additional argument - newSample: mode 1.
// Additional argument - sample_id=<id>: mode 2.
// Additional argument - occurrence_id=<id>: mode 3.
$mode = 0;
// default mode : output survey selector
// mode 1: output the main Data Entry page: occurrence list or add/edit occurrence tabs hidden. "Survey" tab active
// mode 2: output the main Data Entry page, display existing sample. Active tab determined by iform params. No occurence details filled in.
// mode 3: output the main Data Entry page, display existing occurrence. "Edit Occurrence" tab active. Occurence details filled in.
$surveyReadOnly = false;
// On top of this, things can be flagged as readonly. RO mode 2+4 means no Add Occurrence tab.
if (!$logged_in) {
return lang::get('LANG_not_logged_in');
}
$parentSample = array();
$parentLoadID = null;
$childSample = array();
$childLoadID = null;
$thisOccID = -1;
// IDs have to be >0, so this is outside the valid range
if ($_POST) {
if (!array_key_exists('website_id', $_POST)) {
// non Indicia POST, in this case must be the location allocations. add check to ensure we don't corrept the data by accident
if (iform_loctools_checkaccess($node, 'admin') && array_key_exists('mnhnlbtw', $_POST)) {
iform_loctools_deletelocations($node);
foreach ($_POST as $key => $value) {
$parts = explode(':', $key);
if ($parts[0] == 'location' && $value) {
iform_loctools_insertlocation($node, $value, $parts[1]);
}
}
}
}
} else {
if (array_key_exists('sample_id', $_GET)) {
$mode = 2;
$parentLoadID = $_GET['sample_id'];
} else {
if (array_key_exists('occurrence_id', $_GET)) {
$mode = 3;
$childLoadID = $_GET['occurrence_id'];
$thisOccID = $childLoadID;
} else {
if (array_key_exists('newSample', $_GET)) {
$mode = 1;
}
}
}
// else default to mode 0
}
// define language strings so they can be used for validation translation.
data_entry_helper::$javascript .= "var translations = [\n";
foreach ($custom_terms as $key => $value) {
if (substr($key, 0, 4) != "LANG") {
data_entry_helper::$javascript .= " {key: \"" . $key . "\", translated: \"" . $value . "\"},\n";
}
}
data_entry_helper::$javascript .= "];\n";
// define layers for all maps.
// each argument is a comma separated list eg:
// "Name:Lux Outline,URL:http://localhost/geoserver/wms,LAYERS:indicia:nation2,SRS:EPSG:2169,FORMAT:image/png,minScale:0,maxScale:1000000,units:m";
$optionArray_1 = array();
$optionArray_2 = array();
$optionArray_Location = array();
$options = explode(',', $args['layer1']);
foreach ($options as $option) {
$parts = explode(':', $option);
//.........这里部分代码省略.........
示例11: get_form
/**
* Return the generated form output.
* @param array $args List of parameter values passed through to the form depending on how the form has been configured.
* This array always contains a value for language.
* @param object $node The Drupal node object.
* @param array $response When this form is reloading after saving a submission, contains the response from the service call.
* Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data).
* @return Form HTML.
* @todo: Implement this method
*/
public static function get_form($args, $node, $response = null)
{
require_once drupal_get_path('module', 'iform') . '/client_helpers/map_helper.php';
$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
$settings = array('locationTypes' => helper_base::get_termlist_terms($auth, 'indicia:location_types', array('Transect Section')), 'locationId' => isset($_GET['section_id']) ? $_GET['section_id'] : null, 'parentId' => isset($_GET['transect_id']) ? $_GET['transect_id'] : null);
if ($settings['parentId']) {
$parent = data_entry_helper::get_population_data(array('table' => 'location', 'extraParams' => $auth['read'] + array('view' => 'detail', 'id' => $settings['parentId'], 'deleted' => 'f'), 'nocache' => true));
$settings['parent'] = $parent[0];
} else {
return 'This form must be called with a parent transect_id parameter.';
}
$settings['sections'] = data_entry_helper::get_population_data(array('table' => 'location', 'extraParams' => $auth['read'] + array('view' => 'detail', 'parent_id' => $settings['parentId'], 'deleted' => 'f'), 'nocache' => true));
if ($settings['locationId']) {
data_entry_helper::load_existing_record($auth['read'], 'location', $settings['locationId']);
} else {
data_entry_helper::$entity_to_load['location:code'] = 'S' . (count($settings['sections']) + 1);
}
$settings['attributes'] = data_entry_helper::getAttributes(array('id' => $settings['locationId'], 'valuetable' => 'location_attribute_value', 'attrtable' => 'location_attribute', 'key' => 'location_id', 'fieldprefix' => 'locAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id'], 'location_type_id' => $settings['locationTypes'][0]['id']));
if (data_entry_helper::$entity_to_load['location:code']) {
$r = '<form method="post" id="input-form">';
}
$r .= $auth['write'];
$r .= '<div id="controls">';
$customAttributeTabs = array_merge(array('Section' => array('[*]')), get_attribute_tabs($settings['attributes']));
if (count($customAttributeTabs) > 1) {
$headerOptions = array('tabs' => array());
foreach ($customAttributeTabs as $tab => $content) {
$alias = preg_replace('/[^a-zA-Z0-9]/', '', strtolower($tab));
$headerOptions['tabs']['#' . $alias] = lang::get($tab);
}
$r .= data_entry_helper::tab_header($headerOptions);
data_entry_helper::enable_tabs(array('divId' => 'controls', 'style' => $args['interface'], 'progressBar' => isset($args['tabProgress']) && $args['tabProgress'] == true));
}
foreach ($customAttributeTabs as $tab => $content) {
if ($tab == 'Section') {
$r .= self::get_section_tab($auth, $args, $settings);
} else {
$alias = preg_replace('/[^a-zA-Z0-9]/', '', strtolower($tab));
$r .= "\n<div id=\"{$alias}\">\n";
$r .= get_attribute_html($settings['attributes'], $args, array('extraParams' => $auth['read']), $tab);
$r .= "</div>\n";
}
}
$r .= '</div>';
// controls
$r .= '</form>';
data_entry_helper::link_default_stylesheet();
if (function_exists('drupal_set_breadcrumb')) {
$breadcrumb = array();
$breadcrumb[] = l('Home', '<front>');
$breadcrumb[] = l('Sites', $args['sites_list_path']);
$breadcrumb[] = l($settings['parent']['name'], $args['transect_edit_path'], array('query' => array('id' => $settings['parentId'])));
$breadcrumb[] = $settings['locationId'] ? data_entry_helper::$entity_to_load['location:name'] : lang::get('new section');
drupal_set_breadcrumb($breadcrumb);
}
return $r;
}