本文整理汇总了PHP中data_entry_helper::species_checklist方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::species_checklist方法的具体用法?PHP data_entry_helper::species_checklist怎么用?PHP data_entry_helper::species_checklist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::species_checklist方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args)
{
data_entry_helper::enable_tabs(array('divId' => 'controls'));
$r = "<form method=\"post\">\n";
// Get authorisation tokens to update and read from the Warehouse.
$r .= data_entry_helper::get_auth($args['website_id'], $args['password']);
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
$r .= "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
$r .= "<input type=\"hidden\" id=\"record_status\" name=\"record_status\" value=\"C\" />\n";
$r .= "<div id=\"controls\">\n";
// Create a list which jQuery can parse to create the tabs.
$r .= "<ul>\r\n <li><a href=\"#recorder\"><span>Recorder</span></a></li>\r\n <li><a href=\"#site\"><span>Site</span></a></li>\r\n <li><a href=\"#species_tab_1\"><span>" . $args['tab_title_1'] . "</span></a></li>\n";
if ($args['list_id_2']) {
$r .= "<li><a href=\"#species_tab_2\"><span>" . $args['tab_title_2'] . "</span></a></li>\n";
}
if ($args['list_id_3']) {
$r .= "<li><a href=\"#species_tab_3\"><span>" . $args['tab_title_3'] . "</span></a></li>\n";
}
if ($args['list_id_4']) {
$r .= "<li><a href=\"#species_tab_4\"><span>" . $args['tab_title_4'] . "</span></a></li>\n";
}
$r .= "</ul>\n";
$r .= "<div id=\"recorder\">\n";
$r .= data_entry_helper::select(array('label' => 'Title', 'fieldname' => 'smpAttr:5', 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'extraParams' => $readAuth + array('termlist_external_key' => 'indicia:titles')));
$r .= data_entry_helper::text_input(array('label' => 'First name', 'fieldname' => 'smpAttr:6'));
$r .= data_entry_helper::text_input(array('label' => 'Last name', 'fieldname' => 'smpAttr:7'));
$r .= data_entry_helper::text_input(array('label' => 'Email', 'fieldname' => 'smpAttr:8'));
// Postcode before address since entering the postcode auto-populates part of the address.
$r .= data_entry_helper::postcode_textbox(array('label' => 'Postcode', 'fieldname' => 'smpAttr:10', 'linkedAddressBoxId' => 'address', 'hiddenFields' => false));
$r .= data_entry_helper::textarea(array('label' => 'Address', 'fieldname' => 'smpAttr:9', 'id' => 'address'));
$r .= "</div>\n";
$r .= "<div id=\"site\">\n";
$r .= data_entry_helper::map();
$r .= data_entry_helper::date_picker(array('label' => 'Date', 'fieldname' => 'sample:date'));
$r .= "</div>\n";
$r .= "<div id=\"species_tab_1\">\n";
$species_list_args = array('label' => 'Species', 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'extraParams' => $readAuth + array('taxon_list_id' => $args['list_id_1']));
$r .= data_entry_helper::species_checklist($species_list_args);
$r .= "</div>\n";
$r .= "</div>\n";
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"Save\" />\n";
$r .= "</form>";
return $r;
}
示例2: get_control_species
/**
* Get the control for species input, either a grid or a single species input control.
*/
private static function get_control_species($auth, $args, $tabalias, $options)
{
$extraParams = $auth['read'];
if ($args['species_names_filter'] == 'preferred') {
$extraParams += array('preferred' => 't');
}
if ($args['species_names_filter'] == 'language') {
$extraParams += array('language' => iform_lang_iso_639_2($user->lang));
}
if (self::getGridMode($args)) {
// multiple species being input via a grid
$species_ctrl_opts = array_merge(array('listId' => $args['list_id'], 'label' => lang::get('occurrence:taxa_taxon_list_id'), 'columns' => 1, 'extraParams' => $extraParams, 'survey_id' => $args['survey_id'], 'occurrenceComment' => $args['occurrence_comment'], 'occurrenceImages' => $args['occurrence_images'], 'PHPtaxonLabel' => true), $options);
if ($args['extra_list_id']) {
$species_ctrl_opts['lookupListId'] = $args['extra_list_id'];
}
if (isset($args['col_widths']) && $args['col_widths']) {
$species_ctrl_opts['colWidths'] = explode(',', $args['col_widths']);
}
self::build_grid_taxon_label_function($args);
self::build_grid_autocomplete_function($args);
// Start by outputting a hidden value that tells us we are using a grid when the data is posted,
// then output the grid control
return '<input type="hidden" value="true" name="gridmode" />' . data_entry_helper::species_checklist($species_ctrl_opts);
} else {
// A single species entry control of some kind
if (count(self::$occurrenceIds) == 1) {
// output a hidden input to contain the occurrence id
$r .= '<input type="hidden" name="occurrence:id" value="' . self::$occurrenceIds[0] . '" />' . "\n";
}
if ($args['extra_list_id'] == '') {
$extraParams['taxon_list_id'] = $args['list_id'];
} elseif ($args['species_ctrl'] == 'autocomplete') {
$extraParams['taxon_list_id'] = $args['extra_list_id'];
} else {
$extraParams['taxon_list_id'] = array($args['list_id'], $args['extra_list_id']);
}
$species_ctrl_opts = array_merge(array('label' => lang::get('occurrence:taxa_taxon_list_id'), 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'parentField' => 'parent_id', 'extraParams' => $extraParams), $options);
if ($args['species_ctrl'] == 'tree_browser') {
// change the node template to include images
global $indicia_templates;
$indicia_templates['tree_browser_node'] = '<div>' . '<img src="' . data_entry_helper::$base_url . '/upload/thumb-{image_path}" alt="Image of {caption}" width="80" /></div>' . '<span>{caption}</span>';
}
// Dynamically generate the species selection control required.
return call_user_func(array('data_entry_helper', $args['species_ctrl']), $species_ctrl_opts);
}
}
示例3: get_control_species_checklist
/**
* Returns the species checklist input control.
* @param array $auth Read authorisation tokens
* @param array $args Form configuration
* @param array $extraParams Extra parameters array, pre-configured with filters for taxa and name types.
* @param array $options additional options for the control, e.g. those configured in the form structure.
* @return HTML for the species_checklist control.
*/
protected static function get_control_species_checklist($auth, $args, $extraParams, $options)
{
global $user;
// Build the configuration options
if (isset($options['view'])) {
$extraParams['view'] = $options['view'];
}
// There may be options in the form occAttr:n|param => value targetted at specific attributes
$occAttrOptions = array();
$optionToUnset = array();
foreach ($options as $option => $value) {
// split the id of the option into the attribute name and option name.
$optionParts = explode('|', $option);
if ($optionParts[0] != $option) {
// an occurrence attribute option was found
$attrName = $optionParts[0];
$optName = $optionParts[1];
// split the attribute name into the type and id (type will always be occAttr)
$attrParts = explode(':', $attrName);
$attrId = $attrParts[1];
if (!isset($occAttrOptions[$attrId])) {
$occAttrOptions[$attrId] = array();
}
$occAttrOptions[$attrId][$optName] = apply_user_replacements($value);
$optionToUnset[] = $option;
}
}
// tidy up options array
foreach ($optionToUnset as $value) {
unset($options[$value]);
}
// make sure that if extraParams is specified as a config option, it does not replace the essential stuff
if (isset($options['extraParams'])) {
$options['extraParams'] = array_merge($extraParams, $options['extraParams']);
}
$species_ctrl_opts = array_merge(array('occAttrOptions' => $occAttrOptions, 'listId' => $args['list_id'], 'label' => lang::get('occurrence:taxa_taxon_list_id'), 'columns' => 1, 'extraParams' => $extraParams, 'survey_id' => $args['survey_id'], 'occurrenceComment' => $args['occurrence_comment'], 'occurrenceSensitivity' => isset($args['occurrence_sensitivity']) ? $args['occurrence_sensitivity'] : false, 'occurrenceImages' => $args['occurrence_images'], 'PHPtaxonLabel' => true, 'language' => iform_lang_iso_639_2(hostsite_get_user_field('language')), 'cacheLookup' => $args['cache_lookup'], 'speciesNameFilterMode' => self::getSpeciesNameFilterMode($args), 'userControlsTaxonFilter' => isset($args['user_controls_taxon_filter']) ? $args['user_controls_taxon_filter'] : false, 'subSpeciesColumn' => $args['sub_species_column'], 'copyDataFromPreviousRow' => !empty($args['copy_species_row_data_to_new_rows']) && $args['copy_species_row_data_to_new_rows'], 'previousRowColumnsToInclude' => empty($args['previous_row_columns_to_include']) ? '' : $args['previous_row_columns_to_include'], 'editTaxaNames' => !empty($args['edit_taxa_names']) && $args['edit_taxa_names'], 'includeSpeciesGridLinkPage' => !empty($args['include_species_grid_link_page']) && $args['include_species_grid_link_page'], 'speciesGridPageLinkUrl' => $args['species_grid_page_link_url'], 'speciesGridPageLinkParameter' => $args['species_grid_page_link_parameter'], 'speciesGridPageLinkTooltip' => $args['species_grid_page_link_tooltip']), $options);
if ($groups = hostsite_get_user_field('taxon_groups')) {
$species_ctrl_opts['usersPreferredGroups'] = unserialize($groups);
}
if ($args['extra_list_id']) {
$species_ctrl_opts['lookupListId'] = $args['extra_list_id'];
}
//We only do the work to setup the filter if the user has specified a filter in the box
if (!empty($args['taxon_filter_field']) && !empty($args['taxon_filter'])) {
$species_ctrl_opts['taxonFilterField'] = $args['taxon_filter_field'];
$filterLines = helper_base::explode_lines($args['taxon_filter']);
$species_ctrl_opts['taxonFilter'] = $filterLines;
}
if (isset($args['col_widths']) && $args['col_widths']) {
$species_ctrl_opts['colWidths'] = explode(',', $args['col_widths']);
}
call_user_func(array(self::$called_class, 'build_grid_taxon_label_function'), $args, $options);
if (self::$mode == self::MODE_CLONE) {
$species_ctrl_opts['useLoadedExistingRecords'] = true;
}
// Start by outputting a hidden value that tells us we are using a grid when the data is posted,
// then output the grid control
return '<input type="hidden" value="true" name="gridmode" />' . data_entry_helper::species_checklist($species_ctrl_opts);
}
示例4: get_control_species
/**
* Get the control for species input, either a grid or a single species input control.
*/
protected static function get_control_species($auth, $args, $tabalias, $options)
{
global $user;
$extraParams = $auth['read'];
$fieldPrefix = !empty($options['fieldprefix']) ? $options['fieldprefix'] : '';
if (!empty($args['taxon_filter_field']) && !empty($args['taxon_filter'])) {
$filterLines = helper_base::explode_lines($args['taxon_filter']);
if ($args['multiple_subject_observation_mode'] !== 'single' && $args['taxon_filter_field'] !== 'taxon_group' && count($filterLines) === 1) {
// The form is configured for filtering by taxon name or meaning id. If there is only one specified then the form
// cannot display a species checklist, as there is no point. So, convert our preferred taxon name or meaning ID to find the
// preferred taxa_taxon_list_id from the selected checklist, and then output a hidden ID.
if (empty($args['list_id'])) {
throw new exception(lang::get('Please configure the Initial Species List parameter to define which list the species to record is selected from.'));
}
$filter = array('preferred' => 't', 'taxon_list_id' => $args['list_id']);
if ($args['taxon_filter_field'] == 'preferred_name') {
$filter['taxon'] = $filterLines[0];
} else {
$filter[$args['taxon_filter_field']] = $filterLines[0];
}
$options = array('table' => 'taxa_taxon_list', 'extraParams' => $auth['read'] + $filter);
$response = data_entry_helper::get_population_data($options);
if (count($response) === 0) {
throw new exception(lang::get('Failed to find the single species that this form is setup to record in the defined list.'));
}
if (count($response) > 1) {
throw new exception(lang::get('This form is setup for single species recording, but more than one species with the same name exists in the list.'));
}
return '<input type="hidden" name="' . $fieldPrefix . 'occurrence:taxa_taxon_list_id" value="' . $response[0]['id'] . "\"/>\n";
}
}
if (call_user_func(array(get_called_class(), 'getGridMode'), $args)) {
// multiple species being input via a grid
$species_ctrl_opts = array_merge(array('listId' => $args['list_id'], 'label' => lang::get('occurrence:taxa_taxon_list_id'), 'columns' => 1, 'extraParams' => $extraParams, 'survey_id' => $args['survey_id'], 'occurrenceComment' => $args['occurrence_comment'], 'occurrenceSensitivity' => isset($args['subject_observation_confidential']) ? $args['subject_observation_confidential'] : false, 'occurrenceImages' => $args['observation_images'], 'PHPtaxonLabel' => true, 'language' => iform_lang_iso_639_2(hostsite_get_user_field('language')), 'cacheLookup' => isset($args['cache_lookup']) && $args['cache_lookup'], 'speciesNameFilterMode' => self::getSpeciesNameFilterMode($args)), $options);
if ($args['extra_list_id']) {
$species_ctrl_opts['lookupListId'] = $args['extra_list_id'];
}
if (!empty($args['taxon_filter_field']) && !empty($args['taxon_filter'])) {
$species_ctrl_opts['taxonFilterField'] = $args['taxon_filter_field'];
$species_ctrl_opts['taxonFilter'] = $filterLines;
}
if (isset($args['col_widths']) && $args['col_widths']) {
$species_ctrl_opts['colWidths'] = explode(',', $args['col_widths']);
}
call_user_func(array(get_called_class(), 'build_grid_taxon_label_function'), $args);
call_user_func(array(get_called_class(), 'build_grid_autocomplete_function'), $args);
// Start by outputting a hidden value that tells us we are using a grid when the data is posted,
// then output the grid control
return '<input type="hidden" value="true" name="gridmode" />' . data_entry_helper::species_checklist($species_ctrl_opts);
} else {
// A single species entry control of some kind
if ($args['extra_list_id'] == '') {
$extraParams['taxon_list_id'] = $args['list_id'];
} elseif ($args['species_ctrl'] == 'autocomplete') {
$extraParams['taxon_list_id'] = empty($args['extra_list_id']) ? $args['list_id'] : $args['extra_list_id'];
} else {
$extraParams['taxon_list_id'] = array($args['list_id'], $args['extra_list_id']);
}
if (!empty($args['taxon_filter_field']) && !empty($args['taxon_filter'])) {
// filter the taxa available to record
$query = array('in' => array($args['taxon_filter_field'], helper_base::explode_lines($args['taxon_filter'])));
} else {
$query = array();
}
// Apply the species names filter to the single species picker control
if (isset($args['species_names_filter'])) {
$languageFieldName = isset($args['cache_lookup']) && $args['cache_lookup'] ? 'language_iso' : 'language';
switch ($args['species_names_filter']) {
case 'preferred':
$extraParams += array('preferred' => 't');
break;
case 'currentLanguage':
if (isset($options['language'])) {
$extraParams += array($languageFieldName => $options['language']);
}
break;
case 'excludeSynonyms':
$query['where'] = array("(preferred='t' OR {$languageFieldName}<>'lat')");
break;
}
}
if (count($query)) {
$extraParams['query'] = json_encode($query);
}
$species_ctrl_opts = array_merge(array('label' => lang::get('occurrence:taxa_taxon_list_id'), 'fieldname' => $fieldPrefix . 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'parentField' => 'parent_id', 'extraParams' => $extraParams, 'blankText' => 'Please select'), $options);
if (isset($args['cache_lookup']) && $args['cache_lookup']) {
$species_ctrl_opts['extraParams']['view'] = 'cache';
}
global $indicia_templates;
if (isset($args['species_include_both_names']) && $args['species_include_both_names']) {
if ($args['species_names_filter'] == 'all') {
$indicia_templates['species_caption'] = '{taxon}';
} elseif ($args['species_names_filter'] == 'language') {
$indicia_templates['species_caption'] = '{taxon} - {preferred_name}';
} else {
$indicia_templates['species_caption'] = '{taxon} - {common}';
}
//.........这里部分代码省略.........
示例5: 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)
{
global $indicia_templates, $user;
data_entry_helper::enable_validation('entry_form');
$url = !empty($_SERVER['HTTPS']) ? "https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$r = data_entry_helper::loading_block_start();
$r .= "<form method=\"post\" id=\"entry_form\" action=\"{$url}\">\n";
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
$r .= "<div id=\"controls\">\n";
if ($args['interface'] != 'one_page') {
$r .= "<ul>\n";
if ($user->uid == 0) {
$r .= ' <li><a href="#about_you"><span>' . lang::get('about you') . "</span></a></li>\n";
}
$r .= ' <li><a href="#species"><span>' . lang::get('what did you see') . "</span></a></li>\n";
$r .= ' <li><a href="#place"><span>' . lang::get('where was it') . "</span></a></li>\n";
$r .= ' <li><a href="#other"><span>' . lang::get('other information') . "</span></a></li>\n";
$r .= "</ul>\n";
data_entry_helper::enable_tabs(array('divId' => 'controls', 'style' => $args['interface']));
}
if ($user->uid == 0) {
$r .= "<fieldset id=\"about_you\">\n";
if ($args['interface'] == 'one_page') {
$r .= '<legend>' . lang::get('about you') . '</legend>';
}
$r .= data_entry_helper::text_input(array('label' => lang::get('first name'), 'fieldname' => 'smpAttr:' . $args['first_name_attr_id'], 'class' => 'control-width-4', 'validation' => array('required')));
$r .= data_entry_helper::text_input(array('label' => lang::get('surname'), 'fieldname' => 'smpAttr:' . $args['surname_attr_id'], 'class' => 'control-width-4', 'validation' => array('required')));
$r .= data_entry_helper::text_input(array('label' => lang::get('phone number'), 'fieldname' => 'smpAttr:' . $args['phone_attr_id'], 'class' => 'control-width-4'));
$r .= data_entry_helper::text_input(array('label' => lang::get('email'), 'fieldname' => 'smpAttr:' . $args['email_attr_id'], 'class' => 'control-width-4 optional', 'validation' => array('email')));
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'first'));
}
$r .= "</fieldset>\n";
}
// Species tab
$r .= "<fieldset id=\"species\">\n";
if ($args['interface'] == 'one_page') {
$r .= '<legend>' . lang::get('what did you see') . '</legend>';
}
$species_list_args = array('label' => lang::get('Species'), 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'listId' => $args['species_list_id'], 'columns' => 1, 'parentField' => 'parent_id', 'checkboxCol' => false, 'occAttrs' => array($args['abundance_attr_id']), 'extraParams' => $readAuth + array('view' => 'detail', 'orderby' => 'taxonomic_sort_order'), 'survey_id' => $args['survey_id'], 'header' => false, 'view' => 'detail', 'PHPtaxonLabel' => true);
// Build a nice template to show a picture of each species, with fancybox.
data_entry_helper::add_resource('fancybox');
data_entry_helper::$javascript .= "jQuery('a.fancybox').fancybox();\n";
$indicia_templates['taxon_label'] = 'return \'<div class="taxon-cell">' . '<a href="' . data_entry_helper::$base_url . 'upload/{image_path}" class="fancybox" >' . '<img alt="{taxon}" src="' . data_entry_helper::$base_url . 'upload/med-{image_path}" width="250"/></a>' . '<div>{taxon}</div></div>' . '<div class="taxon-desc"><ul><li>\'.str_replace("\\n", "</li><li>","{description_in_list}").\'</li></ul>' . '<a href="http://www.marine-life.org.uk/northeastcetaceans/?q=\'.
strtolower(str_replace(array(" ", "\\\'"), array("-", ""), "{taxon}")).
\'" target="_blank" class="ui-state-default ui-corner-all indicia-button">' . lang::get('More Info') . '...</a></div>\';';
// Template the taxon label cell
$indicia_templates['taxon_label_cell'] = "\n<td class='scTaxonCell'>{content}</td>";
// Also template the attribute controls to show the label in place.
$indicia_templates['attribute_cell'] = "\n<td class='scOccAttrCell'><label>{label}:</label><br/>{content}</td>";
$r .= data_entry_helper::species_checklist($species_list_args);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $user->uid == 0 ? 'middle' : 'first'));
}
$r .= "</fieldset>";
// --Place tab--
$r .= "<fieldset id=\"place\">\n";
if ($args['interface'] == 'one_page') {
$r .= '<legend>' . lang::get('where was it') . '</legend>';
}
$r .= data_entry_helper::radio_group(array('label' => 'Where were you when you made the sighting?', 'fieldname' => 'smpAttr:' . $args['platform_attr_id'], 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'extraParams' => $readAuth + array('termlist_id' => $args['platform_termlist_id']), 'sep' => '<br />', 'labelClass' => 'auto', 'class' => 'inline sighting-platform', 'validation' => array('required')));
$r .= '<div id="place_wrapper" class="hidden">';
// Some instructions only visible when entering data from a boat
$r .= '<p class="boat_mode page-notice ui-state-highlight ui-corner-all">' . lang::get('Instructions for when on boat') . '</p>';
// Some instructions only visible when entering data from the shore
$r .= '<p class="shore_mode page-notice ui-state-highlight ui-corner-all">' . lang::get('Instructions for clicking on map') . '</p>';
$r .= '<div class="boat_mode">';
// Add help examples to the lat and long boxes
$indicia_templates['sref_textbox_latlong'] = '<label for="{idLat}">{labelLat}:</label>' . '<input type="text" id="{idLat}" name="{fieldnameLat}" {class} {disabled} value="{default}" /> <p class="helpText">e.g. 55:12.345N</p>' . '<label for="{idLong}">{labelLong}:</label>' . '<input type="text" id="{idLong}" name="{fieldnameLong}" {class} {disabled} value="{default}" /> <p class="helpText">e.g. 0:45.678W</p>' . '<input type="hidden" id="imp-geom" name="{table}:geom" value="{defaultGeom}" />' . '<input type="text" id="{id}" name="{fieldname}" style="display:none" value="{default}" />';
$r .= data_entry_helper::sref_and_system(array('systems' => array(4326 => lang::get('Latitude, Longitude')), 'splitLatLong' => true, 'helpText' => lang::get('Instructions for latlong')));
$r .= '</div>';
// Initially, we hide the map. Only show it when the user selects the sighting was from the shore,
// as a click on the map for boat recordings will not be accurate.
$r .= '<div class="shore_mode">';
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
$options['maxZoom'] = 9;
// Switch to degrees and decimal minutes for lat long.
$options['latLongFormat'] = 'DM';
$r .= data_entry_helper::map_panel($options, $olOptions);
// Now, add some JavaScript to show or hide the map. Show it for when the sighting was from the shore.
// Hide it for boat based sightings as we want a GPS coordinate in this case. The JavaScript looks for the
// checked radio button to see the value
data_entry_helper::$javascript .= 'jQuery(".sighting-platform input").click(
function() {
var platformId = jQuery("input[name=smpAttr\\\\:' . $args['platform_attr_id'] . ']:checked").val();
if (platformId == ' . $args['platform_mapped_term_id'] . ') {
jQuery("#place_wrapper").removeClass("hidden");
jQuery(".shore_mode").removeClass("hidden");
jQuery(".boat_mode").addClass("hidden");
//.........这里部分代码省略.........
示例6: get_form
//.........这里部分代码省略.........
$r .= "<div id=\"controls\">\n";
if ($args['interface'] != 'one_page') {
$r .= "<ul>\n";
if (!$logged_in) {
$r .= ' <li><a href="#about_you"><span>' . lang::get('LANG_About_You_Tab') . "</span></a></li>\n";
}
$r .= ' <li><a href="#species"><span>' . lang::get('LANG_Species_Tab') . "</span></a></li>\n";
$r .= ' <li><a href="#place"><span>' . lang::get('LANG_Place_Tab') . "</span></a></li>\n";
$r .= ' <li><a href="#other"><span>' . lang::get('LANG_Other_Information_Tab') . "</span></a></li>\n";
$r .= "</ul>\n";
data_entry_helper::enable_tabs(array('divId' => 'controls', 'style' => $args['interface']));
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (!$logged_in) {
$r .= "<div id=\"about_you\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_About_You_Tab_Instructions') . "</p>";
$defAttrOptions['class'] = 'control-width-4';
$r .= data_entry_helper::outputAttribute($attributes[$args['first_name_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['surname_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['email_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['phone_attr_id']], $defAttrOptions);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'first'));
}
unset($defAttrOptions['class']);
$r .= "</div>\n";
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
global $indicia_templates;
$indicia_templates['taxon_label'] = '<div class="biota"><span class="nobreak sci binomial"><em>{taxon}</em></span> {authority}</div>';
$r .= "<div id=\"species\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_Species_Tab_Instructions') . "</p>";
$extraParams = $readAuth + array('taxon_list_id' => $args['list_id']);
$species_list_args = array('label' => lang::get('occurrence:taxa_taxon_list_id'), 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 1, 'view' => 'detail', 'parentField' => 'parent_id', 'occAttrs' => explode(',', $args['checklist_attributes']), 'extraParams' => $extraParams, 'survey_id' => $args['survey_id']);
$r .= data_entry_helper::species_checklist($species_list_args);
$r .= "<label for=\"sample:comment\">" . lang::get('LANG_Sample_Comment_Label') . "</label><input type=\"text\" id=\"sample:comment\" name=\"sample:comment\" value=\"" . data_entry_helper::$entity_to_load['sample:comment'] . "\" />\n";
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $user->id == 0 ? 'first' : 'middle'));
}
$r .= "</div>\n";
////////////////////////////////////////////////////////////////////////////////////////////////////////////
$r .= "<div id=\"place\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_Place_Tab_Instructions') . "</p>";
// Build the array of spatial reference systems into a format Indicia can use.
$systems = array();
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
$r .= data_entry_helper::sref_and_system(array('label' => lang::get('LANG_SRef_Label'), 'systems' => $systems));
$location_list_args = array('label' => lang::get('LANG_Location_Label'), 'view' => 'detail', 'extraParams' => array_merge(array('view' => 'detail', 'orderby' => 'name'), $extraParams));
$r .= call_user_func(array('data_entry_helper', $args['location_ctrl']), $location_list_args);
$r .= data_entry_helper::georeference_lookup(array('label' => lang::get('LANG_Georef_Label'), 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language']));
$options = iform_map_get_map_options($args, $readAuth);
$options['layers'][] = 'locationLayer';
$olOptions = iform_map_get_ol_options($args);
$r .= data_entry_helper::map_panel($options, $olOptions);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls'));
}
$r .= "</div>\n";
////////////////////////////////////////////////////////////////////////////////////////////////////////////
$r .= "<div id=\"other\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_Other_Information_Tab_Instructions') . "</p>";
$r .= data_entry_helper::date_picker(array('label' => lang::get('LANG_Date'), 'fieldname' => 'sample:date'));
$r .= data_entry_helper::outputAttribute($attributes[$args['biotope_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['voucher_attr_id']], $defAttrOptions);
$values = array('I', 'C');
// not initially doing V=Verified
$r .= '<label for="occurrence:record_status">' . lang::get('LANG_Record_Status_Label') . '</label><select id="occurrence:record_status" name="occurrence:record_status">';
foreach ($values as $value) {
$r .= '<option value="' . $value . '"';
if (isset(data_entry_helper::$entity_to_load['occurrence:record_status'])) {
if (data_entry_helper::$entity_to_load['occurrence:record_status'] == $value) {
$r .= ' selected="selected"';
}
}
$r .= '>' . lang::get('LANG_Record_Status_' . $value) . '</option>';
}
$r .= '</select>';
// TODO image upload - not sure how to do this as images are attached to occurrences, and occurrences
// are embedded in the species list.
// $r .= "<label for='occurrence:image'>".lang::get('LANG_Image_Label')."</label>\n".
// data_entry_helper::image_upload('occurrence:image');
$r .= '<br/><br/>';
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'last'));
} else {
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save') . "\" />\n";
}
$r .= "</div>\n";
$r .= "</div>\n";
if (!empty(data_entry_helper::$validation_errors)) {
$r .= data_entry_helper::dump_remaining_errors();
}
$r .= "</form>";
// may need to keep following code for location change functionality
data_entry_helper::$onload_javascript .= "\n \nlocationChange = function(obj){\n\tlocationLayer.destroyFeatures();\n\tif(obj.value != ''){\n\t\tjQuery.getJSON(\"" . $svcUrl . "\" + \"/data/location/\"+obj.value +\n\t\t\t\"?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"] . "\" +\n\t\t\t\"&callback=?\", function(data) {\n if (data.length>0) {\n \tvar parser = new OpenLayers.Format.WKT();\n \tfor (var i=0;i<data.length;i++)\n\t\t\t\t{\n\t \t\t\tif(data[i].centroid_geom){\n\t\t\t\t\t\tfeature = parser.read(data[i].centroid_geom);\n\t\t\t\t\t\tcentre = feature.geometry.getCentroid();\n\t\t\t\t\t\tcentrefeature = new OpenLayers.Feature.Vector(centre, {}, {label: data[i].name});\n\t\t\t\t\t\tlocationLayer.addFeatures([feature, centrefeature]); \n\t\t\t\t\t}\n\t\t\t\t\tif(data[i].boundary_geom){\n\t\t\t\t\t\tfeature = parser.read(data[i].boundary_geom);\n\t\t\t\t\t\tfeature.style = {strokeColor: \"Blue\",\n \t \tstrokeWidth: 2,\n \t\t\t\t\t\t\tlabel: (data[i].centroid_geom ? \"\" : data[i].name)};\n\t\t\t\t\t\tlocationLayer.addFeatures([feature]);\n \t\t\t\t\t}\n \t\t\t\tlocationLayer.map.zoomToExtent(locationLayer.getDataExtent());\n \t\t\t\t}\n\t\t\t}\n\t\t});\n }\n};\njQuery('#imp-location').unbind('change');\njQuery('#imp-location').change(function(){\n\tlocationChange(this);\n});\n// upload location & sref initial values into map.\njQuery('#imp-location').change();\njQuery('#imp-sref').change();\n\n";
return $r;
}
示例7: get_control_species_checklist
/**
* Returns the species checklist input control.
* @param array $auth Read authorisation tokens
* @param array $args Form configuration
* @param array $extraParams Extra parameters array, pre-configured with filters for taxa and name types.
* @param array $options additional options for the control, e.g. those configured in the form structure.
* @return HTML for the species_checklist control.
*/
protected static function get_control_species_checklist($auth, $args, $extraParams, $options)
{
global $user;
// Build the configuration options
if (isset($options['view'])) {
$extraParams['view'] = $options['view'];
}
// make sure that if extraParams is specified as a config option, it does not replace the essential stuff
if (isset($options['extraParams'])) {
$options['extraParams'] = array_merge($extraParams, $options['extraParams']);
}
$species_ctrl_opts = array_merge(array('occAttrOptions' => array(), 'listId' => '', 'label' => lang::get('occurrence:taxa_taxon_list_id'), 'columns' => 1, 'extraParams' => $extraParams, 'survey_id' => $args['survey_id'], 'occurrenceComment' => $args['occurrence_comment'], 'occurrenceSensitivity' => isset($args['occurrence_sensitivity']) ? $args['occurrence_sensitivity'] : false, 'occurrenceImages' => $args['occurrence_images'], 'PHPtaxonLabel' => true, 'language' => iform_lang_iso_639_2(hostsite_get_user_field('language')), 'cacheLookup' => $args['cache_lookup'], 'speciesNameFilterMode' => self::getSpeciesNameFilterMode($args), 'userControlsTaxonFilter' => false, 'subSpeciesColumn' => false, 'copyDataFromPreviousRow' => false, 'editTaxaNames' => !empty($args['edit_taxa_names']) && $args['edit_taxa_names']), $options);
if ($groups = hostsite_get_user_field('taxon_groups')) {
$species_ctrl_opts['usersPreferredGroups'] = unserialize($groups);
}
if ($args['map_taxon_list_id']) {
$species_ctrl_opts['lookupListId'] = $args['map_taxon_list_id'];
}
//We only do the work to setup the filter if the user has specified a filter in the box
if (!empty($args['map_taxon_filter_field']) && !empty($args['map_taxon_filter'])) {
$species_ctrl_opts['taxonFilterField'] = $args['map_taxon_filter_field'];
$filterLines = helper_base::explode_lines($args['map_taxon_filter']);
$species_ctrl_opts['taxonFilter'] = $filterLines;
}
if (isset($args['col_widths']) && $args['col_widths']) {
$species_ctrl_opts['colWidths'] = explode(',', $args['col_widths']);
}
self::build_grid_taxon_label_function($args, $options);
// Start by outputting a hidden value that tells us we are using a grid when the data is posted,
// then output the grid control
return '<input type="hidden" value="true" name="gridmode" />' . data_entry_helper::species_checklist($species_ctrl_opts);
}
示例8:
$readAuth = $auth['read'];
?>
<input type='hidden' name='website_id' value='<?php
echo $config['website_id'];
?>
' />
<input type='hidden' name='survey_id' value='<?php
echo $config['survey_id'];
?>
' />
<input type='hidden' name='occurrence:record_status' value='C' />
<?php
echo data_entry_helper::date_picker(array('label' => 'Date', 'fieldname' => 'sample:date'));
echo data_entry_helper::sref_and_system(array('label' => 'Grid Ref', 'fieldname' => 'sample:entered_sref'));
?>
<div class="smaller">
<?php
echo data_entry_helper::species_checklist(array('listId' => $config['species_checklist_taxon_list'], 'lookupListId' => $config['species_checklist_alt_list'], 'extraParams' => $readAuth, 'survey_id' => $config['survey_id']));
?>
</div>
<br />
<input type='submit' value='Save' />
</form>
</div>
</body>
<?php
echo data_entry_helper::dump_javascript();
?>
</html>
示例9:
<body>
<div id="wrap">
<h1>Species Checklist</h1>
<p>Now please enter details of the list of species you observed in this sample.</p>
<form action="save.php" method="post">
<fieldset>
<legend>Species List</legend>
<?php
echo data_entry_helper::get_auth($config['website_id'], $config['password']);
?>
<input type="hidden" class="auto" name="website_id" id="website_id" value="<?php
echo $config['website_id'];
?>
" />
<input type="hidden" class="auto" name="survey_id" id="website_id" value="<?php
echo $config['survey_id'];
?>
" />
<?php
echo data_entry_helper::species_checklist($config['species_checklist_taxon_list'], $config['species_checklist_occ_attributes'], $readAuth, null, $config['species_checklist_alt_list']);
?>
<br />
<input type="submit" value="Save" class="auto" />
</fieldset>
</form>
</div>
<?php
echo data_entry_helper::dump_javascript();
?>
</body>
</html>
示例10: tab_species_npms_paths
protected static function tab_species_npms_paths($args, $auth, $offset, $limit, $tabNum, $numSpeciesTabs)
{
$r = '';
//Get user configured instruction if it is available.
if (!empty($args['species_tab_instruction'])) {
$r .= '<p>' . $args['species_tab_instruction'] . '</p>';
} else {
$r .= '<p>Please select the percentage cover of each species that is present in each plot from the list below.</p>';
}
global $indicia_templates;
$indicia_templates['taxon_label'] = '<div class="biota nobreak"><span class="vernacular">{common}</span>' . '<br/><span class="sci binomial"><em>{taxon}</em></span> {authority}</div>';
$r .= data_entry_helper::species_checklist(array('id' => "species-{$offset}", 'label' => 'Species', 'listId' => $args['list_id'], 'columns' => 2, 'rowInclusionCheck' => 'hasData', 'class' => 'checklist', 'survey_id' => $args['survey_id'], 'extraParams' => $auth['read'] + array('taxon_list_id' => $args['list_id'], 'limit' => $limit, 'offset' => $offset, 'orderby' => 'common', 'sortdir' => 'ASC', 'view' => 'detail'), 'occAttrClasses' => array('coverage'), 'speciesNameFilterMode' => 'preferred', 'language' => 'eng', 'useLoadedExistingRecords' => $offset > 0));
//If the last tab, then use a submit button, otherwise we have Previous/Next Step
if ($tabNum == $numSpeciesTabs) {
$r .= '<p class="highlight">' . lang::get('Please review all tabs of the form before submitting the survey.') . '</p>';
$r .= data_entry_helper::wizard_buttons(array('divId' => 'tabs', 'page' => 'last', 'captionSave'));
} else {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'tabs', 'page' => 'middle'));
}
return $r;
}
示例11: tab_other_species
protected static function tab_other_species($args, $auth)
{
$r = '';
$indicia_templates['taxon_label'] = '<div class="biota nobreak"><span class="vernacular">{common}</span>' . '<br/><span class="sci binomial"><em>{taxon}</em></span> {authority}</div>';
$extraParams = $auth['read'];
$species_ctrl_opts = array('id' => "species-other", 'label' => 'Species', 'lookupListId' => $args['other_list_id'], 'cacheLookup' => isset($args['cache_lookup']) && $args['cache_lookup'], 'PHPtaxonLabel' => true, 'class' => 'checklist', 'survey_id' => $args['survey_id'], 'extraParams' => $extraParams, 'language' => 'eng', 'occAttrClasses' => array('coverage'), 'reloadExtraParams' => array('taxon_list_id' => $args['other_list_id']), 'speciesNameFilterMode' => 'excludeSynonyms', 'helpText' => 'Please provide details of any additional species you would like to record that you observed during your wildflower count. ' . 'Type the species name into the box on the left of the grid then select the correct name from the drop-down list of suggestions. ' . 'Make sure you input the information about whether the species was recorded on the path or linear/square transect.');
if (!empty($args['taxon_filter_field']) && !empty($args['taxon_filter'])) {
$filterLines = helper_base::explode_lines($args['taxon_filter']);
$species_ctrl_opts['taxonFilterField'] = $args['taxon_filter_field'];
$species_ctrl_opts['taxonFilter'] = $filterLines;
}
self::build_grid_taxon_label_function($args);
self::build_grid_autocomplete_function($args);
$r .= data_entry_helper::species_checklist($species_ctrl_opts);
$r .= '<p class="highlight">' . lang::get('Please review all tabs of the form before submitting the survey.') . '</p>';
$r .= data_entry_helper::wizard_buttons(array('divId' => 'tabs', 'page' => 'last', 'captionSave' => 'Submit'));
return $r;
}