本文整理汇总了PHP中data_entry_helper::enable_tabs方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::enable_tabs方法的具体用法?PHP data_entry_helper::enable_tabs怎么用?PHP data_entry_helper::enable_tabs使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::enable_tabs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_controls
/**
* Define the HTML required for this filter's UI panel.
*/
public function get_controls($readAuth, $options)
{
$r = "<p id=\"what-filter-instruct\">" . lang::get('You can either filter by species group (first tab) or a selection of individual species (second tab)') . "</p>\n" . '<div id="what-tabs">' . "\n";
// data_entry_helper::tab_header breaks inside fancybox. So output manually.
$r .= '<ul class="ui-helper-hidden"><li id="species-group-tab-tab"><a href="#species-group-tab" rel="address:species-group-tab"><span>Species groups</span></a></li>' . '<li id="species-tab-tab"><a href="#species-tab" rel="address:species-tab"><span>Species and other taxa</span></a></li></ul>';
$r .= '<div id="species-group-tab">' . "\n";
$myGroupIds = hostsite_get_user_field('taxon_groups', '');
if ($myGroupIds) {
$r .= '<h3>' . lang::get('My groups') . '</h3>';
$myGroupsData = data_entry_helper::get_population_data(array('table' => 'taxon_group', 'extraParams' => $readAuth + array('query' => json_encode(array('in' => array('id', unserialize($myGroupIds)))))));
$myGroupNames = array();
data_entry_helper::$javascript .= "indiciaData.myGroups = [];\n";
foreach ($myGroupsData as $group) {
$myGroupNames[] = $group['title'];
data_entry_helper::$javascript .= "indiciaData.myGroups.push([{$group['id']},'{$group['title']}']);\n";
}
$r .= '<button type="button" id="my_groups">' . lang::get('Include my groups') . '</button>';
$r .= '<ul class="inline"><li>' . implode('</li><li>', $myGroupNames) . '</li></ul>';
$r .= '<h3>' . lang::get('Build a list of groups') . '</h3>';
}
$r .= '<p>' . lang::get('Search for and build a list of species groups to include') . '</p>' . ' <div class="context-instruct messages warning">' . lang::get('Please note that your access permissions are limiting the groups available to choose from.') . '</div>';
$r .= data_entry_helper::sub_list(array('fieldname' => 'taxon_group_list', 'table' => 'taxon_group', 'captionField' => 'title', 'valueField' => 'id', 'extraParams' => $readAuth, 'addToTable' => false));
$r .= "</div>\n";
$r .= '<div id="species-tab">' . "\n";
$r .= '<p>' . lang::get('Search for and build a list of species to include') . '</p>' . ' <div class="context-instruct messages warning">' . lang::get('Please note that your access permissions will limit the records returned to the species you are allowed to see.') . '</div>';
if (empty($options['taxon_list_id'])) {
$r .= '<p>Please specify a @taxon_list_id option in the page configuration.</p>';
}
$r .= data_entry_helper::sub_list(array('fieldname' => 'taxa_taxon_list_list', 'table' => 'cache_taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'extraParams' => $readAuth + array('taxon_list_id' => $options['taxon_list_id'], 'preferred' => 't'), 'addToTable' => false));
$r .= "</div>\n";
$r .= "</div>\n";
data_entry_helper::enable_tabs(array('divId' => 'what-tabs'));
return $r;
}
示例2: 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 $errors 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.
*/
public static function get_form($args, $node, $errors = null)
{
$r = '';
$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
// variables to tracks which parts of the plots grid are not completed, so we can display a correct message
$someGridRefsMissing = false;
$someHabitatsMissing = false;
$someSqTypesMissing = false;
data_entry_helper::$validation_mode = array('colour', 'hint', 'message');
if (isset($_GET['sample_id'])) {
data_entry_helper::load_existing_record($auth['read'], 'sample', $_GET['sample_id']);
if (isset(data_entry_helper::$entity_to_load['sample:date']) && preg_match('/^(\\d{4})/', data_entry_helper::$entity_to_load['sample:date'])) {
// Date has 4 digit year first (ISO style) - convert date to expected output format
// @todo The date format should be a global configurable option. It should also be applied to reloading of custom date attributes.
$d = new DateTime(data_entry_helper::$entity_to_load['sample:date']);
data_entry_helper::$entity_to_load['sample:date'] = $d->format('d/m/Y');
}
$topSampleAttrs = self::load_top_sample_attrs($auth, $args, $_GET['sample_id']);
} else {
$topSampleAttrs = self::load_top_sample_attrs($auth, $args);
}
global $indicia_templates;
$indicia_templates['starredSuffix'] = "*<br/>\n";
$indicia_templates['validation_message'] = "<span class=\"ui-state-error-text\">{error}</span>\n";
data_entry_helper::enable_validation('entry-form');
$r .= '<form method="post" action="" id="entry-form">';
$r .= '<div id="tabs">';
data_entry_helper::enable_tabs(array('divId' => 'tabs', 'navButtons' => true));
$r .= data_entry_helper::tab_header(array('tabs' => array('#your-square' => 'Find Place', '#your-plots' => 'Your Plots', '#species_1' => 'Species Page 1', '#species_2' => 'Species Page 2', '#species_3' => 'Species Page 3', '#species_other' => 'Other Species')));
$r .= '<div id="your-square">';
$r .= self::get_hiddens($args, $auth);
$r .= self::tab_your_square($args, $auth['read'], $topSampleAttrs);
$r .= '</div>';
// your-square
$r .= '<div id="your-plots">';
$r .= self::tab_your_plots($args, $auth['read']);
$r .= '</div>';
// your-plots
$r .= '<div id="species_1">';
$r .= self::tab_species($args, $auth, 0, 34);
$r .= '</div>';
// species-1
$r .= '<div id="species_2">';
$r .= self::tab_species($args, $auth, 34, 34);
$r .= '</div>';
// species-2
$r .= '<div id="species_3">';
$r .= self::tab_species($args, $auth, 68, 34);
$r .= '</div>';
// species-3
$r .= '<div id="species_other">';
$r .= self::tab_other_species($args, $auth);
$r .= '</div>';
// species-3
$r .= '</div>';
// tabs
$r .= '</form>';
return $r;
}
示例3: 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.
*/
public static function get_form($args, $node, $response = null)
{
global $indicia_templates;
iform_load_helpers(array('map_helper', 'report_helper'));
// apply defaults
$args = array_merge(array(), $args);
$reloadPath = self::getReloadPath();
data_entry_helper::$website_id = $args['website_id'];
$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
if (!empty($_GET['user_trust_id'])) {
self::loadExistingUserTrust($_GET['user_trust_id'], $auth, $args);
}
$r = "<form method=\"post\" id=\"entry_form\" action=\"{$reloadPath}\">\n";
$r .= $auth['write'] . "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
$r .= data_entry_helper::hidden_text(array('fieldname' => 'user_trust:id'));
$r .= data_entry_helper::autocomplete(array('label' => lang::get('Recorder to trust'), 'fieldname' => 'user_trust:user_id', 'table' => 'user', 'valueField' => 'id', 'captionField' => 'person_name', 'extraParams' => $auth['read'] + array('view' => 'detail'), 'class' => 'control-width-4'));
$col1 = '<p>Define the combination of survey, taxon group and/or location that this recorder is trusted for below.</p>';
$col1 .= '<fieldset><legend>' . lang::get('Trust settings') . '</legend>';
$col1 .= data_entry_helper::autocomplete(array('label' => lang::get('Trust records in this survey'), 'fieldname' => 'user_trust:survey_id', 'table' => 'survey', 'valueField' => 'id', 'captionField' => 'title', 'blankText' => '<' . lang::get('any') . '>', 'extraParams' => $auth['read'] + array('sharing' => 'verification'), 'class' => 'control-width-4'));
$col1 .= data_entry_helper::autocomplete(array('label' => lang::get('Trust records in this taxon group'), 'fieldname' => 'user_trust:taxon_group_id', 'table' => 'taxon_group', 'valueField' => 'id', 'captionField' => 'title', 'blankText' => '<' . lang::get('any') . '>', 'extraParams' => $auth['read'], 'class' => 'control-width-4'));
$col1 .= data_entry_helper::autocomplete(array('label' => lang::get('Trust records in this location'), 'fieldname' => 'user_trust:location_id', 'table' => 'location', 'valueField' => 'id', 'captionField' => 'name', 'blankText' => '<' . lang::get('any') . '>', 'extraParams' => $auth['read'] + array('location_type_id' => variable_get('indicia_profile_location_type_id', '')), 'class' => 'control-width-4'));
$col2 = '<p>' . lang::get('Review this recorder\'s experience in the tabs below') . '</p>';
$col2 .= '<div id="summary-tabs">';
$col2 .= data_entry_helper::tab_header(array('tabs' => array('#tab-surveys' => lang::get('Surveys'), '#tab-taxon-groups' => lang::get('Taxon groups'), '#tab-locations' => lang::get('Locations'))));
data_entry_helper::enable_tabs(array('divId' => 'summary-tabs'));
$col2 .= '<div id="tab-surveys">';
$col2 .= report_helper::report_grid(array('id' => 'surveys-summary', 'readAuth' => $auth['read'], 'dataSource' => 'library/surveys/filterable_surveys_verification_breakdown', 'ajax' => TRUE, 'autoloadAjax' => FALSE, 'extraParams' => array('my_records' => 1)));
$col2 .= '</div>';
$col2 .= '<div id="tab-taxon-groups">';
$col2 .= report_helper::report_grid(array('id' => 'taxon-groups-summary', 'readAuth' => $auth['read'], 'dataSource' => 'library/taxon_groups/filterable_taxon_groups_verification_breakdown', 'ajax' => TRUE, 'autoloadAjax' => FALSE, 'extraParams' => array('my_records' => 1)));
$col2 .= '</div>';
$col2 .= '<div id="tab-locations">';
$col2 .= report_helper::report_grid(array('id' => 'locations-summary', 'readAuth' => $auth['read'], 'dataSource' => 'library/locations/filterable_locations_verification_breakdown', 'ajax' => TRUE, 'autoloadAjax' => FALSE, 'extraParams' => array('my_records' => 1, 'location_type_id' => variable_get('indicia_profile_location_type_id', ''))));
$col2 .= '</div>';
$col2 .= '</div>';
$r .= str_replace(array('{col-1}', '{col-2}'), array($col1, $col2), $indicia_templates['two-col-50']);
$r .= '</fieldset>';
$r .= '<input type="submit" class="indicia-button" id="save-button" value="' . (empty(data_entry_helper::$entity_to_load['user_trust_id:id']) ? lang::get('Grant trust') : lang::get('Update trust settings')) . "\" />\n";
if (!empty($_GET['user_trust_id'])) {
$r .= '<input type="submit" class="indicia-button" id="delete-button" name="delete-button" value="' . lang::get('Revoke this trust') . "\" />\n";
data_entry_helper::$javascript .= "\$('#delete-button').click(function(e) {\n if (!confirm(\"Are you sure you want to revoke this trust?\")) {\n e.preventDefault();\n return false;\n }\n });\n";
}
$r .= '</form>';
data_entry_helper::enable_validation('entry_form');
return $r;
}
示例4: 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;
}
示例5: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args)
{
$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";
if ($args['tabs']) {
$r .= "<ul>\n <li><a href=\"#species\"><span>Species</span></a></li>\n <li><a href=\"#place\"><span>Place</span></a></li>\n <li><a href=\"#other\"><span>Other Information</span></a></li>\n </ul>\n";
data_entry_helper::enable_tabs(array('divId' => 'controls'));
}
$r .= "<div id=\"species\">\n";
$extraParams = $readAuth + array('taxon_list_id' => $args['list_id']);
if ($args['preferred']) {
$extraParams += array('preferred' => 't');
}
$species_list_args = array('label' => 'Species', 'itemTemplate' => 'select_species', 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'extraParams' => $extraParams);
// Dynamically generate the species selection control required.
$r .= call_user_func(array('data_entry_helper', $args['species_ctrl']), $species_list_args);
$r .= "</div>\n";
$r .= "<div id=\"place\">\n";
// for this form, use bing and no geoplanet lookup, since then it requires no API keys so is a good
// quick demo of how things work.
$mapOptions = array('presetLayers' => array('bing_aerial'), 'locate' => false);
if ($args['tabs']) {
$mapOptions['tabDiv'] = 'place';
}
$r .= data_entry_helper::map($mapOptions);
$r .= "</div>\n";
$r .= "<div id=\"other\">\n";
$r .= data_entry_helper::date_picker(array('label' => 'Date', 'fieldname' => 'sample:date'));
$r .= data_entry_helper::select(array('label' => 'Survey', 'fieldname' => 'sample:survey_id', 'table' => 'survey', 'captionField' => 'title', 'valueField' => 'id', 'extraParams' => $readAuth));
$r .= data_entry_helper::textarea(array('label' => 'Comment', 'fieldname' => 'sample:comment', 'class' => 'wide'));
$r .= "</div>\n";
$r .= "</div>\n";
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"Save\" />\n";
$r .= "</form>";
return $r;
}
示例6: 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;
}
示例7: get_form
//.........这里部分代码省略.........
// Get authorisation tokens to update and read from the Warehouse.
$r .= $writeAuth;
$r .= "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
$r .= "<input type=\"hidden\" id=\"sample:survey_id\" name=\"sample:survey_id\" value=\"" . $args['survey_id'] . "\" />\n";
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";
}
// request automatic JS validation
data_entry_helper::enable_validation('entry_form');
$attributes = data_entry_helper::getAttributes(array('id' => data_entry_helper::$entity_to_load['sample:id'], 'valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => 'smpAttr', 'extraParams' => $readAuth, 'survey_id' => $args['survey_id']));
if ($logged_in) {
// If logged in, output some hidden data about the user
$uid = $user->uid;
$email = $user->mail;
$username = $user->name;
$uid_attr_id = $args['uid_attr_id'];
$email_attr_id = $args['email_attr_id'];
$username_attr_id = $args['username_attr_id'];
// This assumes that we have the following attributes : no built in error checking.
$r .= "<input type=\"hidden\" name=\"" . $attributes[$uid_attr_id]['fieldname'] . "\" value=\"{$uid}\" />\n";
$r .= "<input type=\"hidden\" name=\"" . $attributes[$email_attr_id]['fieldname'] . "\" value=\"{$email}\" />\n";
$r .= "<input type=\"hidden\" name=\"" . $attributes[$username_attr_id]['fieldname'] . "\" value=\"{$username}\" />\n";
}
$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>";
示例8: get_form
//.........这里部分代码省略.........
$attribute['value'] = $user->uid;
}
$attribute['handled'] = true;
// user id attribute is never displayed
} elseif (strcasecmp($attribute['caption'], 'cms username') == 0) {
if ($logged_in) {
$attribute['value'] = $user->name;
}
$attribute['handled'] = true;
// username attribute is never displayed
} elseif (strcasecmp($attribute['caption'], 'email') == 0) {
if ($logged_in) {
$attribute['value'] = $user->mail;
$attribute['handled'] = true;
// email attribute is displayed unless logged in
}
} elseif ((strcasecmp($attribute['caption'], 'first name') == 0 || strcasecmp($attribute['caption'], 'last name') == 0 || strcasecmp($attribute['caption'], 'surname') == 0) && $logged_in) {
$attribute['handled'] = true;
}
// name attributes are displayed unless logged in
if (isset($attribute['value'])) {
$hiddens .= '<input type="hidden" name="' . $attribute['fieldname'] . '" value="' . $attribute['value'] . '" />' . "\n";
}
}
$customAttributeTabs = self::get_attribute_tabs($attributes);
$tabs = self::get_all_tabs($args['structure'], $customAttributeTabs);
$r .= "<div id=\"controls\">\n";
// Output the dynamic tab headers
if ($args['interface'] != 'one_page') {
$r .= "<ul>\n";
foreach ($tabs as $tab => $tabContent) {
$alias = preg_replace('/[^a-zA-Z0-9]/', '', strtolower($tab));
$tabtitle = lang::get("LANG_Tab_{$alias}");
if ($tabtitle == "LANG_Tab_{$alias}") {
// if no translation provided, we'll just use the standard heading
$tabtitle = $tab;
}
$r .= ' <li><a href="#' . $alias . '"><span>' . $tabtitle . "</span></a></li>\n";
}
$r .= "</ul>\n";
data_entry_helper::enable_tabs(array('divId' => 'controls', 'style' => $args['interface']));
}
// Output the dynamic tab content
$pageIdx = 0;
foreach ($tabs as $tab => $tabContent) {
// get a machine readable alias for the heading
$tabalias = preg_replace('/[^a-zA-Z0-9]/', '', strtolower($tab));
$r .= '<div id="' . $tabalias . '">' . "\n";
if ($pageIdx == 0) {
// output the hidden inputs on the first tab
$r .= $hiddens;
}
// Now output the content of the tab. Use a for loop, not each, so we can treat several rows as one object
for ($i = 0; $i < count($tabContent); $i++) {
$component = $tabContent[$i];
if (preg_match('/\\A\\?[^¬]*\\?\\z/', trim($component)) === 1) {
// Component surrounded by ? so represents a help text
$helpText = substr(trim($component), 1, -1);
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get($helpText) . "</p>";
} elseif (preg_match('/\\A\\[[^¬]*\\]\\z/', trim($component)) === 1) {
// Component surrounded by [] so represents a control
$method = 'get_control_' . preg_replace('/[^a-zA-Z0-9]/', '', strtolower($component));
// Anything following the component that starts with @ is an option to pass to the control
$options = array();
while ($i < count($tabContent) - 1 && substr($tabContent[$i + 1], 0, 1) == '@') {
$i++;
$option = explode('=', substr($tabContent[$i], 1));
$options[$option[0]] = $option[1];
}
if (method_exists('iform_mnhnl_dynamic_1', $method)) {
$r .= self::$method($auth, $args, $tabalias, $options);
} elseif (trim($component) === '[*]') {
$r .= self::get_attribute_html($attributes, $defAttrOptions, $tab);
} else {
$r .= "The form structure includes a control called {$component} which is not recognised.<br/>";
}
}
}
// Add any buttons required at the bottom of the tab
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $pageIdx === 0 ? 'first' : ($pageIdx == count($tabs) - 1 ? 'last' : 'middle')));
} elseif ($pageIdx == count($tabs) - 1 && !($args['interface'] == 'tabs' && $args['save_button_below_all_pages'])) {
// last part of a non wizard interface must insert a save button, unless it is tabbed interface with save button beneath all pages
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save') . "\" />\n";
}
$pageIdx++;
$r .= "</div>\n";
}
$r .= "</div>\n";
if ($args['interface'] == 'tabs' && $args['save_button_below_all_pages']) {
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save') . "\" />\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=" . $auth['read']['auth_token'] . "&nonce=" . $auth['read']["nonce"] . "\" +\n\t\t\t\"&callback=?\", function(data) {\n if (data.length>0) {\n var parser = new OpenLayers.Format.WKT();\n for (var i=0;i<data.length;i++) {\n if(data[i].centroid_geom){\n feature = parser.read(data[i].centroid_geom);\n centre = feature.geometry.getCentroid();\n centrefeature = new OpenLayers.Feature.Vector(centre, {}, {label: data[i].name});\n locationLayer.addFeatures([feature, centrefeature]); \n }\n if (data[i].boundary_geom){\n feature = parser.read(data[i].boundary_geom);\n feature.style = {strokeColor: \"Blue\",\n strokeWidth: 2,\n label: (data[i].centroid_geom ? \"\" : data[i].name)};\n locationLayer.addFeatures([feature]);\n }\n }\n var extent=locationLayer.getDataExtent();\n if (extent!==null) {\n locationLayer.map.zoomToExtent(extent);\n }\n }\n\t\t }\n );\n }\n};\njQuery('#imp-location').unbind('change');\njQuery('#imp-location').change(function(){\n\tlocationChange(this);\n});\n\nvar updatePlaceTabHandler = function(event, ui) { \n if (ui.panel.id=='place') {\n // upload location & sref initial values into map.\n jQuery('#imp-location').change();\n jQuery('#imp-sref').change();\n jQuery('#controls').unbind('tabsshow', updatePlaceTabHandler);\n }\n}\njQuery('#controls').bind('tabsshow', updatePlaceTabHandler);\n\n";
return $r;
}
示例9: get_form
//.........这里部分代码省略.........
foreach ($options as $option) {
$parts = explode(':', $option);
$optionName = $parts[0];
unset($parts[0]);
$optionsArray_Location[$optionName] = implode(':', $parts);
}
// Work out list of locations this user can see.
$locations = iform_loctools_listlocations($node);
if ($locations != 'all') {
data_entry_helper::$javascript .= "var locationList = [" . implode(',', $locations) . "];\n";
}
drupal_add_js(drupal_get_path('module', 'iform') . '/media/js/hasharray.js', 'module');
drupal_add_js(drupal_get_path('module', 'iform') . '/media/js/jquery.datagrid.js', 'module');
if (method_exists(get_called_class(), 'getHeaderHTML')) {
$r .= call_user_func(array(get_called_class(), 'getHeaderHTML'), $args);
}
// Work out list of locations this user can see.
// $locations = iform_loctools_listlocations($node);
///////////////////////////////////////////////////////////////////
// default mode 0 : display a page with tabs for survey selector,
// locations allocator and reports (last two require permissions)
///////////////////////////////////////////////////////////////////
if ($mode == 0) {
// If the user has permissions, add tabs so can choose to see
// locations allocator
$tabs = array('#surveyList' => lang::get('LANG_Surveys'));
if (iform_loctools_checkaccess($node, 'admin')) {
$tabs['#setLocations'] = lang::get('LANG_Allocate_Locations');
}
if (iform_loctools_checkaccess($node, 'superuser')) {
$tabs['#downloads'] = lang::get('LANG_Download');
}
if (count($tabs) > 1) {
$r .= "<div id=\"controls\">" . data_entry_helper::enable_tabs(array('divId' => 'controls', 'active' => '#surveyList')) . "<div id=\"temp\"></div>";
$r .= data_entry_helper::tab_header(array('tabs' => $tabs));
}
if ($locations == 'all') {
$useloclist = 'NO';
$loclist = '-1';
} else {
// an empty list will cause an sql error, lids must be > 0, so push a -1 to prevent the error.
if (empty($locations)) {
$locations[] = -1;
}
$useloclist = 'YES';
$loclist = implode(',', $locations);
}
// Create the Survey list datagrid for this user.
drupal_add_js("jQuery(document).ready(function(){\n \$('div#smp_grid').indiciaDataGrid('rpt:reports_for_prebuilt_forms/MNHNL/mnhnl_btw_list_samples', {\n indiciaSvc: '" . $svcUrl . "',\n dataColumns: ['location_name', 'date', 'num_visit', 'num_occurrences', 'num_taxa'],\n reportColumnTitles: {location_name : '" . lang::get('LANG_Transect') . "', date : '" . lang::get('LANG_Date') . "', num_visit : '" . lang::get('LANG_Visit_No') . "', num_occurrences : '" . lang::get('LANG_Num_Occurrences') . "', num_taxa : '" . lang::get('LANG_Num_Species') . "'},\n actionColumns: {" . lang::get('LANG_Show') . " : \"" . url('node/' . $node->nid, array('query' => 'sample_id=£id£')) . "\"},\n auth : { nonce : '" . $readAuth['nonce'] . "', auth_token : '" . $readAuth['auth_token'] . "'},\n parameters : { survey_id : '" . $args['survey_id'] . "', visit_attr_id : '" . $sample_visit_number_id . "', closed_attr_id : '" . $sample_closure_id . "', use_location_list : '" . $useloclist . "', locations : '" . $loclist . "'},\n itemsPerPage : 12,\n condCss : {field : 'closed', value : '0', css: 'mnhnl-btw-highlight'},\n cssOdd : ''\n });\n});\n ", 'inline');
data_entry_helper::$javascript .= "\n// Create Layers.\nvar locationListLayer;\nmapInitialisationHooks.push(function (div) {\n \"use strict\";";
if ($locations == 'all' || $loclist != '-1') {
data_entry_helper::$javascript .= "\n var WMSoptions = {SERVICE: 'WMS', VERSION: '1.1.0', STYLES: '',\n SRS: div.map.projection.proj.srsCode, /* Now takes it from map */\n FORMAT: '" . $optionsArray_Location['FORMAT'] . "',\n TRANSPARENT: 'true', ";
if ($locations != 'all') {
// when given a restricted feature list we have to use the feature id to filter in order to not go over 2000 char limit on the URL
// Can only generate the feature id if we access a table directly, not through a view. Go direct to the locations table.
// don't need to worry about parent_id in this case as we know exactly which features we want.
// need to use btw_transects view for unrestricted so we can filter by parent_id=NULL.
$locFeatures = array();
foreach ($locations as $location) {
$locFeatures[] = "locations." . $location;
}
data_entry_helper::$javascript .= "\n LAYERS: 'indicia:locations',\n FEATUREID: '" . implode(',', $locFeatures) . "'";
} else {
data_entry_helper::$javascript .= " LAYERS: '" . $optionsArray_Location['LAYERS'] . "', CQL_FILTER: 'website_id=" . $args['website_id'] . "'";
}
data_entry_helper::$javascript .= "\n };\n locationListLayer = new OpenLayers.Layer.WMS('" . $optionsArray_Location['Name'] . "',\n '" . (function_exists(iform_proxy_url) ? iform_proxy_url($optionsArray_Location['URL']) : $optionsArray_Location['URL']) . "',\n WMSoptions, {\n minScale: " . $optionsArray_Location['minScale'] . ",\n maxScale: " . $optionsArray_Location['maxScale'] . ",\n units: '" . $optionsArray_Location['units'] . "',\n isBaseLayer: false,\n singleTile: true\n });\n div.map.addLayer(locationListLayer);\n});\n";
示例10: get_template_grid_left
private static function get_template_grid_left($args, $auth)
{
$r .= '<div id="outer" class="ui-helper-clearfix">';
$r .= '<div id="grid" class="left">{grid}</div>';
$r .= '<div id="record-details-wrap" class="right ui-widget ui-widget-content">';
$r .= '<div id="click-record-notice">' . t('Click on a record to view the details') . '</div>';
$r .= '<div id="record-details-content" style="display: none">';
$r .= '<div id="record-details-toolbar">';
$r .= '<button type="button" id="btn-verify">' . lang::get('Verify') . '</button>';
$r .= '<button type="button" id="btn-reject">' . lang::get('Reject') . '</button>';
$r .= '<button type="button" id="btn-email" class="default-button">' . lang::get('Email') . '</button>';
$r .= '</div>';
$r .= '<div id="record-details-tabs">';
$r .= data_entry_helper::tab_header(array('tabs' => array('#details-tab' => 'Details', '#map-tab' => 'Map', '#images-tab' => 'Images', '#comments-tab' => 'Comments')));
data_entry_helper::enable_tabs(array('divId' => 'record-details-tabs'));
$r .= '<div id="details-tab"></div>';
$r .= '<div id="map-tab">';
$options = iform_map_get_map_options($args, $auth);
$options['tabDiv'] = 'map-tab';
$r .= map_helper::map_panel($options, iform_map_get_ol_options($args));
$r .= '</div>';
$r .= '<div id="images-tab"></div>';
$r .= '<div id="comments-tab"></div>';
$r .= '</div></div></div></div>';
return $r;
}
示例11: get_occurrences_form
//.........这里部分代码省略.........
data_entry_helper::$javascript .= "indiciaData.existingOccurrences = " . json_encode($occurrences) . ";\n";
} else {
data_entry_helper::$javascript .= "indiciaData.existingOccurrences = {};\n";
}
$occ_attributes = data_entry_helper::getAttributes(array('valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => 'occAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id'], 'multiValue' => false));
data_entry_helper::$javascript .= "indiciaData.occurrence_totals = [];\n";
data_entry_helper::$javascript .= "indiciaData.occurrence_attribute = [];\n";
data_entry_helper::$javascript .= "indiciaData.occurrence_attribute_ctrl = [];\n";
$defAttrOptions = array('extraParams' => $auth['read'] + array('orderby' => 'id'), 'suffixTemplate' => 'nosuffix');
$occ_attributes_captions = array();
foreach (explode(',', $args['occurrence_attribute_ids']) as $idx => $attr) {
$occ_attributes_captions[$idx] = $occ_attributes[$attr]['caption'];
unset($occ_attributes[$attr]['caption']);
$ctrl = data_entry_helper::outputAttribute($occ_attributes[$attr], $defAttrOptions);
data_entry_helper::$javascript .= "indiciaData.occurrence_totals[" . $idx . "] = [];\n";
data_entry_helper::$javascript .= "indiciaData.occurrence_attribute[" . $idx . "] = {$attr};\n";
data_entry_helper::$javascript .= "indiciaData.occurrence_attribute_ctrl[" . $idx . "] = jQuery('" . str_replace("\n", "", $ctrl) . "');\n";
}
// $r = "<h2>".$location[0]['name']." on ".$date."</h2>\n";
$r = '<div id="tabs">';
$tabs = array('#grid1' => t($args['species_tab_1']));
// tab 1 is required.
if (isset($args['taxon_list_id_2']) && $args['taxon_list_id_2'] != '') {
$tabs['#grid2'] = t(isset($args['species_tab_2']) && $args['species_tab_2'] != '' ? $args['species_tab_2'] : 'Species Tab 2');
}
if (isset($args['taxon_list_id_3']) && $args['taxon_list_id_3'] != '') {
$tabs['#grid3'] = t(isset($args['species_tab_3']) && $args['species_tab_3'] != '' ? $args['species_tab_3'] : 'Species Tab 3');
}
if (isset($args['taxon_list_id_4']) && $args['taxon_list_id_4'] != '') {
$tabs['#grid4'] = t(isset($args['species_tab_4']) && $args['species_tab_4'] != '' ? $args['species_tab_4'] : 'Species Tab 4');
}
$tabs['#notes'] = lang::get('Notes');
$r .= data_entry_helper::tab_header(array('tabs' => $tabs));
data_entry_helper::enable_tabs(array('divId' => 'tabs', 'style' => 'Tabs'));
// will assume that first table is based on abundance count, so do totals
$r .= '<div id="grid1"><table id="observation-input1" class="ui-widget species-grid"><thead class="table-header"><tr><th class="ui-widget-header"></th>';
foreach (explode(',', $args['occurrence_attribute_ids']) as $idx => $attr) {
$r .= '<th class="ui-widget-header col-' . ($idx + 1) . '">' . $occ_attributes_captions[$idx] . '</th>';
}
$r .= '<th class="ui-widget-header">' . lang::get('Total') . '</th></tr></thead>';
$r .= '<tbody class="ui-widget-content occs-body"></tbody><tfoot><tr><td>Total</td>';
foreach (explode(',', $args['occurrence_attribute_ids']) as $idx => $attr) {
$r .= '<td class="col-' . ($idx + 1) . ' ' . ($idx % 5 == 0 ? 'first' : '') . ' col-total"></td>';
}
$r .= '<td class="ui-state-disabled first"></td></tr></tfoot></table><br /><a href="' . $args['my_obs_page'] . '" class="button">' . lang::get('Finish') . '</a></div>';
$extraParams = array_merge($auth['read'], array('taxon_list_id' => $args['taxon_list_id_1'], 'preferred' => 't', 'allow_data_entry' => 't', 'view' => 'cache', 'orderby' => 'taxonomic_sort_order'));
if (!empty($args['taxon_filter_field_1']) && !empty($args['taxon_filter_1'])) {
$extraParams[$args['taxon_filter_field_1']] = helper_base::explode_lines($args['taxon_filter_1']);
}
$taxa = data_entry_helper::get_population_data(array('table' => 'taxa_taxon_list', 'extraParams' => $extraParams));
data_entry_helper::$javascript .= "indiciaData.speciesList1List = [";
$first = true;
foreach ($taxa as $taxon) {
data_entry_helper::$javascript .= ($first ? "\n" : ",\n") . "{'id':" . $taxon['id'] . ",'taxon_meaning_id':" . $taxon['taxon_meaning_id'] . ",'preferred_language_iso':'" . $taxon["preferred_language_iso"] . "','default_common_name':'" . str_replace("'", "\\'", $taxon["default_common_name"]) . "'}";
$first = false;
}
data_entry_helper::$javascript .= "];\n";
data_entry_helper::$javascript .= "indiciaData.allTaxonMeaningIdsAtSample = [" . implode(',', $allTaxonMeaningIdsAtSample) . "];\n";
if (isset($args['taxon_list_id_2']) && $args['taxon_list_id_2'] != '') {
$r .= '<div id="grid2"><p id="grid2-loading">' . lang::get('Loading - Please Wait') . '</p><table id="observation-input2" class="ui-widget species-grid"><thead class="table-header"><tr><th class="ui-widget-header"></th>';
foreach (explode(',', $args['occurrence_attribute_ids']) as $idx => $attr) {
$r .= '<th class="ui-widget-header col-' . ($idx + 1) . '">' . $occ_attributes_captions[$idx] . '</th>';
}
$r .= '<th class="ui-widget-header">' . lang::get('Total') . '</th></tr></thead><tbody class="ui-widget-content occs-body"></tbody><tfoot><tr><td>Total</td>';
foreach (explode(',', $args['occurrence_attribute_ids']) as $idx => $attr) {
$r .= '<td class="col-' . ($idx + 1) . ' ' . ($idx % 5 == 0 ? 'first' : '') . ' col-total"></td>';
示例12: get_template_with_map
private static function get_template_with_map($args, $readAuth, $extraParams, $paramDefaults)
{
$r = '<div id="outer-with-map" class="ui-helper-clearfix">';
$r .= '<div id="grid" class="left" style="width:65%">{paramsForm}{grid}';
// Insert a button to verify all visible, only available if viewing the clean records.
if (isset($_POST['verification-rule']) && $_POST['verification-rule'] === 'none' && empty($_POST['verification-id'])) {
$r .= '<button type="button" id="btn-verify-all">' . lang::get('Verify all visible') . '</button>';
}
$r .= '</div>';
$r .= '<div id="map-and-record" class="right" style="width: 34%"><div id="summary-map">';
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
// This is used for drawing, so need an editlayer, but not used for input
$options['editLayer'] = true;
$options['editLayerInSwitcher'] = true;
$options['clickForSpatialRef'] = false;
$options['featureIdField'] = 'occurrence_id';
$r .= map_helper::map_panel($options, $olOptions);
$reportMapOpts = array('dataSource' => !empty($args['mapping_report_name']) ? $args['mapping_report_name'] : $args['report_name'], 'mode' => 'report', 'readAuth' => $readAuth, 'autoParamsForm' => false, 'extraParams' => $extraParams, 'paramDefaults' => $paramDefaults, 'reportGroup' => 'verification', 'clickableLayersOutputMode' => 'report', 'rowId' => 'occurrence_id', 'sharing' => 'verification', 'ajax' => TRUE);
if (!empty($args['mapping_report_name_lores'])) {
$reportMapOpts['dataSourceLoRes'] = $args['mapping_report_name_lores'];
}
$r .= report_helper::report_map($reportMapOpts);
$r .= '</div>';
global $user;
if (function_exists('hostsite_get_user_field') && ($locationId = hostsite_get_user_field('location_expertise', false))) {
iform_map_zoom_to_location($locationId, $readAuth);
}
$r .= '<div id="record-details-wrap" class="ui-widget ui-widget-content">';
$r .= self::instructions('grid on the left');
$r .= '<div id="record-details-content" style="display: none">';
$r .= '<div id="record-details-toolbar">';
$r .= '<label>Set status:</label>';
$r .= '<button type="button" id="btn-verify">' . lang::get('Verify') . '</button>';
$r .= '<button type="button" id="btn-reject">' . lang::get('Reject') . '</button>';
$r .= '<button type="button" id="btn-query">' . lang::get('Query') . '</button>';
$r .= '<button type="button" id="btn-multiple" title="' . lang::get('Select this tool to tick off a list of records and action all of the ticked records in one go') . '">' . lang::get('Select records') . '</button>';
$r .= '<br/><label>Contact:</label>';
$r .= '<button type="button" id="btn-email-expert" class="default-button">' . lang::get('Another expert') . '</button>';
$r .= '<button type="button" id="btn-email-recorder" class="default-button">' . lang::get('Recorder') . '</button>';
$r .= '</div>';
$r .= '<div id="record-details-tabs">';
// note - there is a dependency in the JS that comments is the last tab and images the 2nd to last.
$r .= data_entry_helper::tab_header(array('tabs' => array('#details-tab' => lang::get('Details'), '#experience-tab' => lang::get('Experience'), '#phenology-tab' => lang::get('Phenology'), '#images-tab' => lang::get('Images'), '#comments-tab' => lang::get('Comments'))));
data_entry_helper::$javascript .= "indiciaData.detailsTabs = ['details','experience','phenology','images','comments'];\n";
data_entry_helper::enable_tabs(array('divId' => 'record-details-tabs'));
$r .= '<div id="details-tab"></div>';
$r .= self::other_tab_html();
$r .= '</div></div></div></div></div>';
return $r;
}
示例13: get_form_html
protected static function get_form_html($args, $auth, $attributes)
{
$r = call_user_func(array(self::$called_class, 'getHeader'), $args);
$params = array($args, $auth, &$attributes);
if (self::$mode === self::MODE_CLONE) {
call_user_func_array(array(self::$called_class, 'cloneEntity'), $params);
}
$firstTabExtras = method_exists(self::$called_class, 'getFirstTabAdditionalContent') ? call_user_func_array(array(self::$called_class, 'getFirstTabAdditionalContent'), $params) : '';
$customAttributeTabs = get_attribute_tabs($attributes);
$tabs = self::get_all_tabs($args['structure'], $customAttributeTabs);
if (isset($tabs['-'])) {
$hasControls = false;
$r .= self::get_tab_content($auth, $args, '$tab' - '', $tabs['-'], 'above-tabs', $attributes, $hasControls);
unset($tabs['-']);
}
$r .= "<div id=\"controls\">\n";
// Build a list of the tabs that actually have content
$tabHtml = self::get_tab_html($tabs, $auth, $args, $attributes, $firstTabExtras);
// Output the dynamic tab headers
if ($args['interface'] != 'one_page') {
$headerOptions = array('tabs' => array());
foreach ($tabHtml as $tab => $tabContent) {
$alias = preg_replace('/[^a-zA-Z0-9]/', '', strtolower($tab));
$tabtitle = lang::get("LANG_Tab_{$alias}");
if ($tabtitle == "LANG_Tab_{$alias}") {
// if no translation provided, we'll just use the standard heading
$tabtitle = $tab;
}
$headerOptions['tabs']['#tab-' . $alias] = $tabtitle;
}
$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));
}
// Output the dynamic tab content
$pageIdx = 0;
$singleSpeciesLabel = self::$singleSpeciesName;
foreach ($tabHtml as $tab => $tabContent) {
// get a machine readable alias for the heading
$tabalias = 'tab-' . preg_replace('/[^a-zA-Z0-9]/', '', strtolower($tab));
$r .= "<div id=\"{$tabalias}\">\n";
//We only want to show the single species message to the user if they have selected the option and we are in single species mode.
//We also want to only show it on the species tab otherwise in 'All one page' mode it will appear multple times.
if (isset($args['single_species_message']) && $args['single_species_message'] && $tabalias == 'tab-species' && isset($singleSpeciesLabel)) {
$r .= '<div class="page-notice ui-state-highlight ui-corner-all">You are submitting a record of ' . "{$singleSpeciesLabel}</div>";
}
// For wizard include the tab title as a header.
if ($args['interface'] == 'wizard') {
$r .= '<h1>' . $headerOptions['tabs']['#' . $tabalias] . '</h1>';
}
$r .= $tabContent;
if (isset($args['verification_panel']) && $args['verification_panel'] && $pageIdx == count($tabHtml) - 1) {
$r .= data_entry_helper::verification_panel(array('readAuth' => $auth['read'], 'panelOnly' => true));
}
// Add any buttons required at the bottom of the tab
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $pageIdx === 0 ? 'first' : ($pageIdx == count($tabHtml) - 1 ? 'last' : 'middle'), 'includeVerifyButton' => isset($args['verification_panel']) && $args['verification_panel'] && $pageIdx == count($tabHtml) - 1, 'includeSubmitButton' => self::$mode !== self::MODE_EXISTING_RO, 'includeDeleteButton' => self::$mode === self::MODE_EXISTING));
} elseif ($pageIdx == count($tabHtml) - 1) {
// We need the verify button as well if this option is enabled
if (isset($args['verification_panel']) && $args['verification_panel']) {
$r .= '<button type="button" class="indicia-button" id="verify-btn">' . lang::get('Precheck my records') . "</button>\n";
}
if (call_user_func(array(self::$called_class, 'include_save_buttons')) && !($args['interface'] == 'tabs' && isset($args['save_button_below_all_pages']) && $args['save_button_below_all_pages']) && method_exists(self::$called_class, 'getSubmitButtons')) {
// last part of a non wizard interface must insert a save button, unless it is tabbed
// interface with save button beneath all pages
$r .= call_user_func(array(self::$called_class, 'getSubmitButtons'), $args);
}
}
$pageIdx++;
$r .= "</div>\n";
}
$r .= "</div>\n";
if (method_exists(self::$called_class, 'getFooter')) {
$r .= call_user_func(array(self::$called_class, 'getFooter'), $args);
}
if (method_exists(self::$called_class, 'link_species_popups')) {
$r .= call_user_func(array(self::$called_class, 'link_species_popups'), $args);
}
return $r;
}
示例14: get_occurrences_form
//.........这里部分代码省略.........
} else {
data_entry_helper::$javascript .= "indiciaData.existingOccurrences = {};\n";
}
$occ_attributes = data_entry_helper::getAttributes(array('valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => 'occAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id'], 'multiValue' => false));
data_entry_helper::$javascript .= "indiciaData.occurrence_attribute = [];\n";
data_entry_helper::$javascript .= "indiciaData.occurrence_attribute_ctrl = [];\n";
$defAttrOptions = array('extraParams' => $auth['read'] + array('orderby' => 'id'), 'suffixTemplate' => 'nosuffix');
foreach (array($args['occurrence_attribute_id'], isset($args['occurrence_attribute_id_2']) && $args['occurrence_attribute_id_2'] != "" ? $args['occurrence_attribute_id_2'] : $args['occurrence_attribute_id'], isset($args['occurrence_attribute_id_3']) && $args['occurrence_attribute_id_3'] != "" ? $args['occurrence_attribute_id_3'] : $args['occurrence_attribute_id'], isset($args['occurrence_attribute_id_4']) && $args['occurrence_attribute_id_4'] != "" ? $args['occurrence_attribute_id_4'] : $args['occurrence_attribute_id']) as $idx => $attr) {
unset($occ_attributes[$attr]['caption']);
$ctrl = data_entry_helper::outputAttribute($occ_attributes[$attr], $defAttrOptions);
data_entry_helper::$javascript .= "indiciaData.occurrence_attribute[" . ($idx + 1) . "] = {$attr};\n";
data_entry_helper::$javascript .= "indiciaData.occurrence_attribute_ctrl[" . ($idx + 1) . "] = jQuery('" . str_replace("\n", "", $ctrl) . "');\n";
}
$sections = data_entry_helper::get_population_data(array('table' => 'location', 'extraParams' => $auth['read'] + array('view' => 'detail', 'parent_id' => $parentLocId, 'deleted' => 'f'), 'nocache' => true));
usort($sections, "ukbms_stis_sectionSort");
$location = data_entry_helper::get_population_data(array('table' => 'location', 'extraParams' => $auth['read'] + array('view' => 'detail', 'id' => $parentLocId)));
$r = "<h2>" . $location[0]['name'] . " on " . $date . "</h2><div id=\"tabs\">\n";
$tabs = array('#grid1' => t($args['species_tab_1']));
// tab 1 is required.
if (isset($args['second_taxon_list_id']) && $args['second_taxon_list_id'] != '') {
$tabs['#grid2'] = t(isset($args['species_tab_2']) && $args['species_tab_2'] != '' ? $args['species_tab_2'] : 'Species Tab 2');
}
if (isset($args['third_taxon_list_id']) && $args['third_taxon_list_id'] != '') {
$tabs['#grid3'] = t(isset($args['species_tab_3']) && $args['species_tab_3'] != '' ? $args['species_tab_3'] : 'Species Tab 3');
}
if (isset($args['fourth_taxon_list_id']) && $args['fourth_taxon_list_id'] != '') {
$tabs['#grid4'] = t(isset($args['species_tab_4']) && $args['species_tab_4'] != '' ? $args['species_tab_4'] : 'Species Tab 4');
}
if (isset($args['map_taxon_list_id']) && $args['map_taxon_list_id'] != '') {
$tabs['#gridmap'] = t(isset($args['species_map_tab']) && $args['species_map_tab'] != '' ? $args['species_map_tab'] : 'Map Based Tab');
}
$tabs['#notes'] = lang::get('Notes');
$r .= data_entry_helper::tab_header(array('tabs' => $tabs));
data_entry_helper::enable_tabs(array('divId' => 'tabs', 'style' => 'Tabs'));
$commonSelected = isset($args['start_with_common_species']) && $args['start_with_common_species'] ? 'selected="selected"' : '';
// will assume that first table is based on abundance count, so do totals
$r .= '<div id="grid1">' . '<label for="listSelect">' . lang::get('Use species list') . ' :</label><select id="listSelect"><option value="full">' . lang::get('All species') . '</option><option value="common"' . $commonSelected . '>' . lang::get('Common species') . '</option><option value="here">' . lang::get('Species known at this site') . '</option><option value="mine">' . lang::get('Species I have recorded') . '</option><option value="filled">' . lang::get('Species with data') . '</option></select>' . '<span id="listSelectMsg"></span>';
$r .= '<table id="transect-input1" class="ui-widget species-grid"><thead class="table-header">';
$r .= '<tr><th class="ui-widget-header">' . lang::get('Sections') . '</th>';
foreach ($sections as $idx => $section) {
$r .= '<th class="ui-widget-header col-' . ($idx + 1) . '">' . $section['code'] . '</th>';
}
$r .= '<th class="ui-widget-header">' . lang::get('Total') . '</th>';
$r .= '</tr></thead>';
$r .= '<tbody class="ui-widget-content">';
// output rows at the top for any transect section level sample attributes
$rowClass = '';
foreach ($attributes as $attr) {
$r .= '<tr ' . $rowClass . ' id="smp-' . $attr['attributeId'] . '"><td>' . $attr['caption'] . '</td>';
$rowClass = $rowClass == '' ? 'class="alt-row"' : '';
unset($attr['caption']);
foreach ($sections as $idx => $section) {
// output a cell with the attribute - tag it with a class & id to make it easy to find from JS.
$attrOpts = array('class' => 'smp-input smpAttr-' . $section['code'], 'id' => $attr['fieldname'] . ':' . $section['code'], 'extraParams' => $auth['read']);
// if there is an existing value, set it and also ensure the attribute name reflects the attribute value id.
if (isset($subSamplesByCode[$section['code']])) {
// but have to take into account possibility that this field has been blanked out, so deleting the attribute.
if (isset($subSamplesByCode[$section['code']]['attr_id_sample_' . $attr['attributeId']]) && $subSamplesByCode[$section['code']]['attr_id_sample_' . $attr['attributeId']] != '') {
$attrOpts['fieldname'] = $attr['fieldname'] . ':' . $subSamplesByCode[$section['code']]['attr_id_sample_' . $attr['attributeId']];
$attr['default'] = $subSamplesByCode[$section['code']]['attr_sample_' . $attr['attributeId']];
} else {
$attr['default'] = isset($_POST[$attr['fieldname']]) ? $_POST[$attr['fieldname']] : '';
}
} else {
$attr['default'] = isset($_POST[$attr['fieldname']]) ? $_POST[$attr['fieldname']] : '';
}
示例15: get_form
/**
* Return the generated form output.
* @return Form HTML.
*/
public static function get_form($args)
{
global $user;
$logged_in = $user->uid > 0;
// 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'];
// enable image viewing with FancyBox - only required if the file box is enabled
//data_entry_helper::$javascript .= "jQuery(\"a.fancybox\").fancybox();\n";
$r = "\n<form method=\"post\" id=\"entry_form\">\n";
if (isset($_GET['taxa_taxon_list_id']) || isset($_GET['taxon_external_key'])) {
if (isset($_GET['taxa_taxon_list_id'])) {
$filter = array('id' => $_GET['taxa_taxon_list_id']);
} else {
$filter = array('external_key' => $_GET['taxon_external_key']);
}
$species = data_entry_helper::get_population_data(array('table' => 'taxa_taxon_list', 'extraParams' => $readAuth + $filter + array('taxon_list_id' => $args['list_id'], 'view' => 'detail', 'preferred' => 't')));
// we need only one result, but there could be more than one picture, therefore multiple rows
$uniqueMeaning = false;
if (count($species) == 1) {
$uniqueMeaning = $species[0]['taxon_meaning_id'];
}
if (count($species) > 1) {
$uniqueMeaning = $species[0]['taxon_meaning_id'];
foreach ($species as $item) {
if ($item['taxon_meaning_id'] != $uniqueMeaning) {
$uniqueMeaning = false;
}
}
}
if ($uniqueMeaning) {
// now we have the meaning_id, we need to fetch the actual species in the chosen common name
$speciesCommon = data_entry_helper::get_population_data(array('table' => 'taxa_taxon_list', 'extraParams' => $readAuth + array('taxon_meaning_id' => $uniqueMeaning, 'language_iso' => iform_lang_iso_639_2($user->lang), 'view' => 'detail')));
$r .= '<div class="ui-widget ui-widget-content ui-corner-all page-notice ui-helper-clearfix">';
$nameString = ($species[0]['language_iso'] == 'lat' ? '<em>' : '') . $species[0]['taxon'] . ($species[0]['language_iso'] == 'lat' ? '</em>' : '');
if (count($speciesCommon) >= 1) {
// use a common name if we have one
$nameString = $speciesCommon[0]['taxon'] . ' (' . $nameString . ')';
}
if (!empty($species[0]['description_in_list'])) {
$r .= '<div class="page-notice">' . lang::get('you are recording a', $nameString) . '</div>';
}
$taxa_taxon_list_id = $species[0]['id'];
$images_path = data_entry_helper::$base_url . (isset(data_entry_helper::$indicia_upload_path) ? data_entry_helper::$indicia_upload_path : 'upload/');
foreach ($species as $item) {
if (!empty($item['image_path'])) {
$r .= '<a class="fancybox left" href="' . $images_path . $item['image_path'] . '" style="margin: 0 1em 1em;">';
$r .= '<img width="100" src="' . $images_path . 'thumb-' . $item['image_path'] . '" />';
$r .= '</a>';
}
}
if (!empty($species[0]['description_in_list'])) {
$r .= '<p>' . $species[0]['description_in_list'] . "</p>";
} else {
$r .= '<p>' . lang::get('you are recording a', $nameString) . '</p>';
}
$r .= "</div>\n";
} else {
$r .= "<p>The species not be identified uniquely from the URL parameters.</p>\n";
}
}
// request automatic JS validation
data_entry_helper::enable_validation('entry_form');
$r .= "<div id=\"controls\">\n";
if ($args['interface'] != 'one_page') {
$r .= "<ul>\n";
if (!$logged_in) {
$r .= ' <li><a href="#about_you"><span>' . lang::get('about you') . "</span></a></li>\n";
}
if (!isset($taxa_taxon_list_id)) {
$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";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('about you tab instructions') . "</p>";
$r .= data_entry_helper::text_input(array('label' => lang::get('first name'), 'fieldname' => 'smpAttr:' . $args['first_name_attr_id'], 'class' => 'control-width-4'));
$r .= data_entry_helper::text_input(array('label' => lang::get('surname'), 'fieldname' => 'smpAttr:' . $args['surname_attr_id'], 'class' => 'control-width-4'));
$r .= data_entry_helper::text_input(array('label' => lang::get('email'), 'fieldname' => 'smpAttr:' . $args['email_attr_id'], 'class' => 'control-width-4'));
$r .= data_entry_helper::text_input(array('label' => lang::get('phone number'), 'fieldname' => 'smpAttr:' . $args['phone_attr_id'], 'class' => 'control-width-4'));
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'first'));
}
$r .= "</fieldset>\n";
}
// the species tab is ommitted if the page is called with a taxon in the querystring parameters
if (isset($taxa_taxon_list_id)) {
$r .= "<input type=\"hidden\" name=\"occurrence:taxa_taxon_list_id\" value=\"{$taxa_taxon_list_id}\"/>\n";
} else {
$r .= "<fieldset id=\"species\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('species tab instructions') . "</p>";
$extraParams = $readAuth + array('taxon_list_id' => $args['list_id']);
//.........这里部分代码省略.........