本文整理汇总了PHP中iform_lang_iso_639_2函数的典型用法代码示例。如果您正苦于以下问题:PHP iform_lang_iso_639_2函数的具体用法?PHP iform_lang_iso_639_2怎么用?PHP iform_lang_iso_639_2使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了iform_lang_iso_639_2函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: 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'];
$extraParams['preferred'] = "true";
// 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();
// 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'], 'language' => iform_lang_iso_639_2(hostsite_get_user_field('language'))), $options);
if ($groups = hostsite_get_user_field('taxon_groups')) {
$species_ctrl_opts['usersPreferredGroups'] = unserialize($groups);
}
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" />' . self::my_species_checklist($species_ctrl_opts);
}
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:33,代码来源:ofs_pollinator_2013.php
示例2: get_form
/**
* Return the generated form output.
* @return Form HTML.
* @todo: Implement this method
*/
public static function get_form($args)
{
global $user;
$lang = isset($user) ? iform_lang_iso_639_2($user->lang) : 'eng';
if (function_exists('iform_load_helpers')) {
iform_load_helpers(array('map_helper'));
} else {
require_once dirname(dirname(__FILE__)) . '/map_helper.php';
}
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
$r = '';
// setup the map options
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
if (array_key_exists('table', $_GET) && $_GET['table'] == 'sample') {
// Use a cUrl request to get the data from Indicia which contains the value we need to filter against
// Read the record that was just posted.
$fetchOpts = array('dataSource' => 'reports_for_prebuilt_forms/my_dot_map/occurrences_list', 'mode' => 'report', 'readAuth' => $readAuth, 'extraParams' => array('sample_id' => $_GET['id'], 'language' => $lang));
// @todo Error handling on the response
$occurrence = data_entry_helper::get_report_data($fetchOpts);
self::prepare_layer_titles($args, $occurrence);
// Add the 3 distribution layers if present. Reverse the order so 1st layer is topmost
$layerName = self::build_distribution_layer(3, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
}
$layerName = self::build_distribution_layer(2, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
}
$layerName = self::build_distribution_layer(1, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
}
if ($layerName) {
$options['layers'][] = $layerName;
}
// This is not a map used for input
$options['editLayer'] = false;
if ($args['hide_grid'] == false) {
// Now output a grid of the occurrences that were just saved.
$r .= "<table class=\"submission\"><thead><tr><th>" . lang::get('Species') . "</th><th>" . lang::get('Latin Name') . "</th><th>" . lang::get('Date') . "</th><th>" . lang::get('Spatial Ref') . "</th></tr></thead>\n";
$r .= "<tbody>\n";
foreach ($occurrence as $record) {
$r .= '<tr class="biota"><td>' . $record['lt4_taxon'] . '</td><td class="binomial"><em>' . $record['lt7_taxon'] . '</em></td><td>' . $record['lt0_date_start'] . '</td><td>' . $record['lt0_entered_sref'] . "</td></tr>\n";
}
$r .= "</tbody></table>\n";
}
}
$r .= '<div id="mapandlegend">';
$r .= map_helper::layer_list(array('id' => 'legend', 'includeSwitchers' => false, 'includeHiddenLayers' => false, 'includeIcons' => true, 'layerTypes' => array('overlay')));
$r .= map_helper::map_panel($options, $olOptions);
$r .= '</div>';
return $r;
}
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:60,代码来源:my_dot_map.php
示例3: get_form
/**
* Return the generated form output.
* @return Form HTML.
* @todo: Implement this method
*/
public static function get_form($args)
{
global $user;
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
// setup the map options
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
if (array_key_exists('table', $_GET) && $_GET['table'] == 'sample') {
// Use a cUrl request to get the data from Indicia which contains the value we need to filter against
// Read the record that was just posted.
$fetchOpts = array('dataSource' => 'reports_for_prebuilt_forms/my_dot_map/occurrences_list', 'mode' => 'report', 'readAuth' => $readAuth, 'extraParams' => array('sample_id' => $_GET['id'], 'language' => iform_lang_iso_639_2($user->lang)));
// @todo Error handling on the response
$occurrence = data_entry_helper::get_report_data($fetchOpts);
$legend = '';
self::prepare_layer_titles($args, $occurrence);
// Add the 3 distribution layers if present. Reverse the order so 1st layer is topmost
$layerName = self::build_distribution_layer(3, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
$legend = '<div><img src="' . data_entry_helper::$geoserver_url . 'wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=detail_occurrences&Format=image/jpeg' . '&STYLE=' . $args["wms_dist_3_style"] . '" alt=""/>' . $args["wms_dist_3_title"] . '</div>' . $legend;
}
$layerName = self::build_distribution_layer(2, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
$legend = '<div><img src="' . data_entry_helper::$geoserver_url . 'wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=detail_occurrences&Format=image/jpeg' . '&STYLE=' . $args["wms_dist_2_style"] . '" alt=""/>' . $args["wms_dist_2_title"] . '</div>' . $legend;
}
$layerName = self::build_distribution_layer(1, $args, $occurrence);
if ($layerName) {
$options['layers'][] = $layerName;
$legend = '<div><img src="' . data_entry_helper::$geoserver_url . 'wms?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetLegendGraphic&LAYER=detail_occurrences&Format=image/png' . '&STYLE=' . $args["wms_dist_1_style"] . '" alt=""/>' . $args["wms_dist_1_title"] . '</div>' . $legend;
}
if ($layerName) {
$options['layers'][] = $layerName;
}
// This is not a map used for input
$options['editLayer'] = false;
// Now output a grid of the occurrences that were just saved.
$r .= "<table class=\"submission\"><thead><tr><th>" . lang::get('Species') . "</th><th>" . lang::get('Latin Name') . "</th><th>" . lang::get('Date') . "</th><th>" . lang::get('Spatial Ref') . "</th></tr></thead>\n";
$r .= "<tbody>\n";
foreach ($occurrence as $record) {
$r .= '<tr class="biota"><td>' . $record['lt4_taxon'] . '</td><td class="binomial"><em>' . $record['lt7_taxon'] . '</em></td><td>' . $record['lt0_date_start'] . '</td><td>' . $record['lt0_entered_sref'] . "</td></tr>\n";
}
$r .= "</tbody></table>\n";
$r .= '<div id="legend" class="ui-widget ui-widget-content ui-corner-all">' . $legend . '</div>';
}
$r .= data_entry_helper::map_panel($options, $olOptions);
return $r;
}
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:53,代码来源:my_dot_map.php
示例4: 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);
}
}
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:49,代码来源:mnhnl_dynamic_1.php
示例5: 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}';
}
//.........这里部分代码省略.........
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:101,代码来源:wwt_colour_marked_report.php
示例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::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
//.........这里部分代码省略.........
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:101,代码来源:pollenators.php
示例7: parse_species_name_filter_mode
/**
* Private utility function to extract the fields which need filtering against, plus any complex
* SQL where clauses, required to do a species name filter according to the current mode (e.g.
* preferred names only, all names etc).
* @param array $options Species_checklist options array.
* @param array $filterFields Pass an array in - this will be populated with the keys and values
* of any fields than need to be filtered.
* @param array $filterWheres Pass an array in - this will be populated with a list of any complex
* where clauses (to put into a service request's query parameter).
*/
private static function parse_species_name_filter_mode($options, &$filterFields, &$filterWheres)
{
if (isset($options['speciesNameFilterMode'])) {
$colLanguage = $options['cacheLookup'] ? 'language_iso' : 'language';
switch ($options['speciesNameFilterMode']) {
case 'preferred':
$filterFields += array('preferred' => 't');
break;
case 'currentLanguage':
// look for Drupal user variable. Will degrade gracefully if it doesn't exist
global $user;
if (isset($options['language'])) {
$filterFields += array($colLanguage => $options['language']);
} elseif (isset($user) && function_exists('hostsite_get_user_field')) {
// if in Drupal we can use the user's language
require_once 'prebuilt_forms/includes/language_utils.php';
$filterFields += array($colLanguage => iform_lang_iso_639_2(hostsite_get_user_field('language')));
}
break;
case 'excludeSynonyms':
$filterWheres[] = "(preferred='t' or {$colLanguage}<>'lat')";
break;
}
}
}
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:35,代码来源:data_entry_helper.php
示例8: 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) {
//.........这里部分代码省略.........
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:101,代码来源:mnhnl_bird_transect_walks.php
示例9: get_control_locationattributes
/**
* Get the block of custom attributes at the location level
*/
protected static function get_control_locationattributes($auth, $args, $tabalias, $options)
{
$attrArgs = array('valuetable' => 'location_attribute_value', 'attrtable' => 'location_attribute', 'key' => 'location_id', 'fieldprefix' => 'locAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id']);
$tabName = isset($options['tabNameFilter']) ? $options['tabNameFilter'] : null;
if (array_key_exists('location:id', data_entry_helper::$entity_to_load) && data_entry_helper::$entity_to_load['location:id'] != "") {
// if we have location Id to load, use it to get attribute values
$attrArgs['id'] = data_entry_helper::$entity_to_load['location:id'];
}
$locationAttributes = data_entry_helper::getAttributes($attrArgs, false);
$defAttrOptions = array_merge(array('extraParams' => array_merge($auth['read'], array('view' => 'detail')), 'language' => iform_lang_iso_639_2($args['language'])), $options);
$r = self::bats_get_attribute_html($locationAttributes, $args, $defAttrOptions, $tabName);
return $r;
}
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:16,代码来源:mnhnl_bats.php
示例10: 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)
{
data_entry_helper::$javascript .= "\n// Main table existing entries\njQuery('.scCommentLabelCell').each(function(idx,elem){\n jQuery(this).css('width',jQuery(this).find('label').css('width'));\n});\nspeciesRows = jQuery('.mnhnl-species-grid > tbody').find('tr');\n";
if (self::$mode !== self::MODE_EXISTING_RO) {
data_entry_helper::$javascript .= "\nfor(var j=0; j<speciesRows.length; j++){\n occAttrs = jQuery(speciesRows[j]).find('.scOccAttrCell');\n occAttrs.find('input').not(':hidden').addClass('fillgroup');\n occAttrs.find('select').addClass('required').after('<span class=\"deh-required\">*</span>');\n}\nhook_species_checklist_pre_delete_row=function(e) {\n return confirm(\"" . lang::get('Are you sure you want to delete this row?') . "\");\n};\n";
}
$extraParams = $auth['read'];
// we want all languages, so dont filter
// multiple species being input via a grid
$myLanguage = iform_lang_iso_639_2($args['language']);
if ($myLanguage != 'fra') {
$myLanguage = 'eng';
}
// forced, used for termlists in attributes
$species_ctrl_opts = array_merge(array("extra_list_id" => $args["extra_list_id"], '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, 'language' => $myLanguage, "max_species_ids" => $args["max_species_ids"]), $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']);
}
call_user_func(array(get_called_class(), 'build_grid_taxon_label_function'), $args, array());
// 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" />' . self::mnhnl_bats_species_checklist($species_ctrl_opts);
}
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:29,代码来源:mnhnl_bats.php
示例11: get_control_species
/**
* Get the control for species input, either a grid or a single species input control.
* User Interface options:
* speciesListID
* mapPosition = [top|side]
* maxSpeciesIDs = The maximum number of taxa to be returned by the autocomplete drop down at any one time: OPTIONAL, default 25
* includeOccurrenceComment = boolean to determine if occurrence_comments are included in the species grid, on a separate line
*/
protected static function get_control_species($auth, $args, $tabalias, $options)
{
global $indicia_templates;
$indicia_templates['check_or_radio_group'] = '<span {class}>{items}</span>';
$indicia_templates['check_or_radio_group_item'] = '<span><input type="{type}" name="{fieldname}" id="{itemId}" value="{value}"{class}{checked} {disabled}/><label for="{itemId}">{caption}</label></span>{sep}';
// $indicia_templates['check_or_radio_group'] = self::$check_or_radio_group_template;
// $indicia_templates['check_or_radio_group_item'] = self::$check_or_radio_group_item_template;
data_entry_helper::$javascript .= "\n// Main table existing entries\nspeciesRows = jQuery('.mnhnl-species-grid > tbody').find('tr');\nfor(var j=0; j<speciesRows.length; j++){\n\toccAttrs = jQuery(speciesRows[j]).find('.scOccAttrCell');\n";
if (isset($options['unitSpeciesMeaning'])) {
data_entry_helper::$javascript .= "\n\tif(jQuery(speciesRows[j]).hasClass('scMeaning-" . $options['unitSpeciesMeaning'] . "')){\n\t\tvar units = occAttrs.find('.scUnits');\n\t\tif(units.length > 0){\n\t\t if(units.find('option').filter(':selected')[0].text=='m2')\n\t\t occAttrs.find('.scNumber').removeClass('integer').attr('min',0);\n\t\t units.change(function(){\n\t\t jQuery('.ui-state-error').removeClass('ui-state-error');\n\t\t jQuery('.inline-error').remove();\n\t\t if(jQuery(this).find('option').filter(':selected')[0].text=='m2')\n\t\t jQuery(this).closest('tr').find('.scNumber').removeClass('integer').attr('min',0);\n\t\t else\n\t\t jQuery(this).closest('tr').find('.scNumber').addClass('integer').attr('min',1);\n\t\t });\n\t\t}\n\t} else {\n\t\toccAttrs.find('.scNumber').addClass('integer');\n\t\toccAttrs.find('.scUnits').find('option').each(function(index, elem){\n\t\t if(elem.text == 'm2' || elem.value == '') jQuery(elem).remove();\n\t\t});\n\t}\n";
}
data_entry_helper::$javascript .= "\n}\nhook_species_checklist_pre_delete_row=function(e) {\n return confirm(\"" . lang::get('Are you sure you want to delete this row?') . "\");\n};\n";
$extraParams = $auth['read'];
// multiple species being input via a grid
$myLanguage = iform_lang_iso_639_2($args['language']);
$species_ctrl_opts = array_merge(array('speciesListID' => $options['speciesListID'], 'label' => lang::get('occurrence:taxa_taxon_list_id'), 'columns' => 1, 'extraParams' => $extraParams, 'readAuth' => $extraParams, 'survey_id' => $args['survey_id'], 'includeSubSample' => isset($options['includeSubSample']), 'subsample_method_id' => $args['subsample_method_id'], 'separateCells' => isset($options['separateCells']), 'useCaptionsInHeader' => isset($options['useCaptionsInHeader']) && $options['useCaptionsInHeader'] == 'true', 'useCaptionsInPreRow' => isset($options['useCaptionsInPreRow']) && $options['useCaptionsInPreRow'] == 'true', 'resizeRadioGroup' => isset($options['resizeRadioGroup']) && $options['resizeRadioGroup'] == 'true', 'includeOccurrenceComment' => isset($options['includeOccurrenceComment']) && $options['includeOccurrenceComment'] == 'true', 'PHPtaxonLabel' => true, 'language' => $myLanguage, 'args' => $args), $options);
$species_ctrl_opts['mapPosition'] = isset($options['mapPosition']) ? $options['mapPosition'] : 'top';
call_user_func(array(get_called_class(), 'build_grid_taxon_label_function'), $args, $options);
return self::species_checklist($species_ctrl_opts);
}
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:28,代码来源:mnhnl_dynamic_2.php
示例12: get_form
//.........这里部分代码省略.........
$r .= "<input type=\"hidden\" id=\"sample:survey_id\" name=\"sample:survey_id\" value=\"" . $args['survey_id'] . "\" />\n";
$r .= iform_user_get_hidden_inputs($args);
if (array_key_exists('sample:id', data_entry_helper::$entity_to_load)) {
$r .= "<input type=\"hidden\" id=\"sample:id\" name=\"sample:id\" value=\"" . data_entry_helper::$entity_to_load['sample:id'] . "\" />\n";
}
$defAttrOptions['validation'] = array('required');
$defAttrOptions['suffixTemplate'] = 'requiredsuffix';
if ($locations == 'all') {
$locOptions = array_merge(array('label' => lang::get('LANG_Transect')), $defAttrOptions);
$locOptions['extraParams'] = array_merge(array('parent_id' => 'NULL', 'view' => 'detail', 'orderby' => 'name'), $locOptions['extraParams']);
$r .= data_entry_helper::location_select($locOptions);
} else {
// can't use location select due to location filtering.
$r .= "<label for=\"imp-location\">" . lang::get('LANG_Transect') . ":</label>\n<select id=\"imp-location\" name=\"sample:location_id\" " . $disabled_text . " class=\" \" >";
$url = $svcUrl . '/data/location';
$url .= "?mode=json&view=detail&parent_id=NULL&orderby=name&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"];
$session = curl_init($url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$entities = json_decode(curl_exec($session), true);
if (!empty($entities)) {
foreach ($entities as $entity) {
if (in_array($entity["id"], $locations)) {
if
|
请发表评论