本文整理汇总了PHP中data_entry_helper::dump_remaining_errors方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::dump_remaining_errors方法的具体用法?PHP data_entry_helper::dump_remaining_errors怎么用?PHP data_entry_helper::dump_remaining_errors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::dump_remaining_errors方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_form
//.........这里部分代码省略.........
$arr = explode("\r\n", $args['structure']);
if (!in_array('[record status]', $arr)) {
$value = isset($args['defaults']['occurrence:record_status']) ? $args['defaults']['occurrence:record_status'] : 'C';
$hiddens .= "<input type=\"hidden\" id=\"occurrence:record_status\" name=\"occurrence:record_status\" value=\"{$value}\" />\n";
}
// request automatic JS validation
if (!isset($args['clientSideValidation']) || $args['clientSideValidation']) {
data_entry_helper::enable_validation('entry_form');
}
// If logged in, output some hidden data about the user
foreach ($attributes as &$attribute) {
if (strcasecmp($attribute['caption'], 'cms user id') == 0) {
if ($logged_in) {
$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) {
if ($args['emailShow'] != true) {
// email attribute is not displayed
$attribute['value'] = $user->mail;
$attribute['handled'] = true;
} else {
$attribute['default'] = $user->mail;
}
}
} elseif ((strcasecmp($attribute['caption'], 'first name') == 0 || strcasecmp($attribute['caption'], 'last name') == 0 || strcasecmp($attribute['caption'], 'surname') == 0) && $logged_in) {
if ($args['nameShow'] != true) {
// name attributes are not displayed
$attribute['handled'] = true;
}
}
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";
// Build a list of the tabs that actually have content
$tabHtml = self::get_tab_html($tabs, $auth, $args, $attributes, $hiddens);
// 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']['#' . $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;
foreach ($tabHtml 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";
// For wizard include the tab title as a header.
if ($args['interface'] == 'wizard') {
$r .= '<h1>' . $headerOptions['tabs']['#' . $tabalias] . '</h1>';
}
$r .= $tabContent;
// 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
// @todo Why is this not in the data entry helper, and is it really needed?
if (self::$want_location_layer) {
data_entry_helper::$onload_javascript .= "\n \nlocationChange = function(obj){\n locationLayer.destroyFeatures();\n if(obj.value != ''){\n jQuery.getJSON(\"" . $svcUrl . "\" + \"/data/location/\"+obj.value +\n \"?mode=json&view=detail&auth_token=" . $auth['read']['auth_token'] . "&nonce=" . $auth['read']["nonce"] . "\" +\n \"&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";
}
$r .= self::link_species_popups($args);
return $r;
}
示例2: get_form
//.........这里部分代码省略.........
$r .= "<div id=\"controls\">\n";
if ($args['interface'] != 'one_page') {
$r .= "<ul>\n";
if (!$logged_in) {
$r .= ' <li><a href="#about_you"><span>' . lang::get('LANG_About_You_Tab') . "</span></a></li>\n";
}
$r .= ' <li><a href="#species"><span>' . lang::get('LANG_Species_Tab') . "</span></a></li>\n";
$r .= ' <li><a href="#place"><span>' . lang::get('LANG_Place_Tab') . "</span></a></li>\n";
$r .= ' <li><a href="#other"><span>' . lang::get('LANG_Other_Information_Tab') . "</span></a></li>\n";
$r .= "</ul>\n";
data_entry_helper::enable_tabs(array('divId' => 'controls', 'style' => $args['interface']));
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
if (!$logged_in) {
$r .= "<div id=\"about_you\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_About_You_Tab_Instructions') . "</p>";
$defAttrOptions['class'] = 'control-width-4';
$r .= data_entry_helper::outputAttribute($attributes[$args['first_name_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['surname_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['email_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['phone_attr_id']], $defAttrOptions);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'first'));
}
unset($defAttrOptions['class']);
$r .= "</div>\n";
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////
global $indicia_templates;
$indicia_templates['taxon_label'] = '<div class="biota"><span class="nobreak sci binomial"><em>{taxon}</em></span> {authority}</div>';
$r .= "<div id=\"species\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_Species_Tab_Instructions') . "</p>";
$extraParams = $readAuth + array('taxon_list_id' => $args['list_id']);
$species_list_args = array('label' => lang::get('occurrence:taxa_taxon_list_id'), 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 1, 'view' => 'detail', 'parentField' => 'parent_id', 'occAttrs' => explode(',', $args['checklist_attributes']), 'extraParams' => $extraParams, 'survey_id' => $args['survey_id']);
$r .= data_entry_helper::species_checklist($species_list_args);
$r .= "<label for=\"sample:comment\">" . lang::get('LANG_Sample_Comment_Label') . "</label><input type=\"text\" id=\"sample:comment\" name=\"sample:comment\" value=\"" . data_entry_helper::$entity_to_load['sample:comment'] . "\" />\n";
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $user->id == 0 ? 'first' : 'middle'));
}
$r .= "</div>\n";
////////////////////////////////////////////////////////////////////////////////////////////////////////////
$r .= "<div id=\"place\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_Place_Tab_Instructions') . "</p>";
// Build the array of spatial reference systems into a format Indicia can use.
$systems = array();
$list = explode(',', str_replace(' ', '', $args['spatial_systems']));
foreach ($list as $system) {
$systems[$system] = lang::get($system);
}
$r .= data_entry_helper::sref_and_system(array('label' => lang::get('LANG_SRef_Label'), 'systems' => $systems));
$location_list_args = array('label' => lang::get('LANG_Location_Label'), 'view' => 'detail', 'extraParams' => array_merge(array('view' => 'detail', 'orderby' => 'name'), $extraParams));
$r .= call_user_func(array('data_entry_helper', $args['location_ctrl']), $location_list_args);
$r .= data_entry_helper::georeference_lookup(array('label' => lang::get('LANG_Georef_Label'), 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language']));
$options = iform_map_get_map_options($args, $readAuth);
$options['layers'][] = 'locationLayer';
$olOptions = iform_map_get_ol_options($args);
$r .= data_entry_helper::map_panel($options, $olOptions);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls'));
}
$r .= "</div>\n";
////////////////////////////////////////////////////////////////////////////////////////////////////////////
$r .= "<div id=\"other\">\n";
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('LANG_Other_Information_Tab_Instructions') . "</p>";
$r .= data_entry_helper::date_picker(array('label' => lang::get('LANG_Date'), 'fieldname' => 'sample:date'));
$r .= data_entry_helper::outputAttribute($attributes[$args['biotope_attr_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['voucher_attr_id']], $defAttrOptions);
$values = array('I', 'C');
// not initially doing V=Verified
$r .= '<label for="occurrence:record_status">' . lang::get('LANG_Record_Status_Label') . '</label><select id="occurrence:record_status" name="occurrence:record_status">';
foreach ($values as $value) {
$r .= '<option value="' . $value . '"';
if (isset(data_entry_helper::$entity_to_load['occurrence:record_status'])) {
if (data_entry_helper::$entity_to_load['occurrence:record_status'] == $value) {
$r .= ' selected="selected"';
}
}
$r .= '>' . lang::get('LANG_Record_Status_' . $value) . '</option>';
}
$r .= '</select>';
// TODO image upload - not sure how to do this as images are attached to occurrences, and occurrences
// are embedded in the species list.
// $r .= "<label for='occurrence:image'>".lang::get('LANG_Image_Label')."</label>\n".
// data_entry_helper::image_upload('occurrence:image');
$r .= '<br/><br/>';
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'last'));
} else {
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save') . "\" />\n";
}
$r .= "</div>\n";
$r .= "</div>\n";
if (!empty(data_entry_helper::$validation_errors)) {
$r .= data_entry_helper::dump_remaining_errors();
}
$r .= "</form>";
// may need to keep following code for location change functionality
data_entry_helper::$onload_javascript .= "\n \nlocationChange = function(obj){\n\tlocationLayer.destroyFeatures();\n\tif(obj.value != ''){\n\t\tjQuery.getJSON(\"" . $svcUrl . "\" + \"/data/location/\"+obj.value +\n\t\t\t\"?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"] . "\" +\n\t\t\t\"&callback=?\", function(data) {\n if (data.length>0) {\n \tvar parser = new OpenLayers.Format.WKT();\n \tfor (var i=0;i<data.length;i++)\n\t\t\t\t{\n\t \t\t\tif(data[i].centroid_geom){\n\t\t\t\t\t\tfeature = parser.read(data[i].centroid_geom);\n\t\t\t\t\t\tcentre = feature.geometry.getCentroid();\n\t\t\t\t\t\tcentrefeature = new OpenLayers.Feature.Vector(centre, {}, {label: data[i].name});\n\t\t\t\t\t\tlocationLayer.addFeatures([feature, centrefeature]); \n\t\t\t\t\t}\n\t\t\t\t\tif(data[i].boundary_geom){\n\t\t\t\t\t\tfeature = parser.read(data[i].boundary_geom);\n\t\t\t\t\t\tfeature.style = {strokeColor: \"Blue\",\n \t \tstrokeWidth: 2,\n \t\t\t\t\t\t\tlabel: (data[i].centroid_geom ? \"\" : data[i].name)};\n\t\t\t\t\t\tlocationLayer.addFeatures([feature]);\n \t\t\t\t\t}\n \t\t\t\tlocationLayer.map.zoomToExtent(locationLayer.getDataExtent());\n \t\t\t\t}\n\t\t\t}\n\t\t});\n }\n};\njQuery('#imp-location').unbind('change');\njQuery('#imp-location').change(function(){\n\tlocationChange(this);\n});\n// upload location & sref initial values into map.\njQuery('#imp-location').change();\njQuery('#imp-sref').change();\n\n";
return $r;
}
示例3: get_form
//.........这里部分代码省略.........
$r .= '<p>Submission was:<br /><pre>' . print_r(self::$submission, true) . '</pre></p>';
$r .= '<input type="button" value="Hide debug info" onclick="$(\'#debug-info-div\').slideToggle();" />';
$r .= '</div>';
}
// reset button
$r .= '<input type="button" class="ui-state-default ui-corner-all" value="' . lang::get('Abandon Form and Reload') . '" ' . 'onclick="window.location.href=\'' . url('node/' . $node->nid, array('query' => 'newSample')) . '\'">';
// clear all padlocks button
$r .= ' <input type="button" class="ui-state-default ui-corner-all" value="' . lang::get('Clear All Padlocks') . '" ' . 'onclick="if (indicia && indicia.locks) indicia.locks.unlockRegion(\'body\');">';
// Get authorisation tokens to update the Warehouse, plus any other hidden data.
$hiddens = $auth['write'] . "<input type=\"hidden\" id=\"read_auth_token\" name=\"read_auth_token\" value=\"" . $auth['read']['auth_token'] . "\" />\n" . "<input type=\"hidden\" id=\"read_nonce\" name=\"read_nonce\" value=\"" . $auth['read']['nonce'] . "\" />\n" . "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n" . "<input type=\"hidden\" id=\"survey_id\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />\n";
if (!empty($args['sample_method_id'])) {
$hiddens .= '<input type="hidden" name="sample:sample_method_id" value="' . $args['sample_method_id'] . '"/>';
}
if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
$hiddens .= "<input type=\"hidden\" id=\"sample:id\" name=\"sample:id\" value=\"" . data_entry_helper::$entity_to_load['sample:id'] . "\" />\n";
}
// request automatic JS validation
if (!isset($args['clientSideValidation']) || $args['clientSideValidation']) {
data_entry_helper::enable_validation('entry_form');
// override the default invalidHandler to activate the first accordion panels which has an error
global $indicia_templates;
$indicia_templates['invalid_handler_javascript'] = "function(form, validator) {\n var tabselected=false;\n var accordion\$=jQuery('.ui-accordion');\n jQuery.each(validator.errorMap, function(ctrlId, error) {\n // select the tab containing the first error control\n var ctrl = jQuery('[name=' + ctrlId.replace(/:/g, '\\\\:').replace(/\\[/g, '\\\\[').replace(/]/g, '\\\\]') + ']');\n if (!tabselected && typeof(tabs)!=='undefined') {\n tabs.tabs('select',ctrl.filter('input,select').parents('.ui-tabs-panel')[0].id);\n tabselected = true;\n }\n ctrl.parents('fieldset').removeClass('collapsed');\n ctrl.parents('.fieldset-wrapper').show();\n // for each accordion, activate the first panel which has an error\n ctrl.parents('.ui-accordion-content').each(function (n) {\n var acc\$ = \$(this).closest('.ui-accordion');\n var accId = acc\$[0].id.replace(/:/g, '\\\\:').replace(/\\[/g, '\\\\[').replace(/]/g, '\\\\]');\n if (accordion\$.is('#'+accId)) {\n var header\$ = \$(this).prev('h3');\n var accHeaderId = header\$.attr('id').replace(/:/g, '\\\\:').replace(/\\[/g, '\\\\[').replace(/]/g, '\\\\]');\n acc\$.accordion('activate', '#'+accHeaderId);\n accordion\$ = accordion\$.not('#'+accId);\n }\n });\n });\n }";
// By default, validate doesn't validate any ':hidden' fields,
// but we need to validate hidden with display: none; fields in accordions
data_entry_helper::$javascript .= "jQuery.validator.setDefaults({ \n ignore: \"input[type='hidden']\"\n });\n";
}
if (method_exists(get_called_class(), 'getHeaderHTML')) {
$r .= call_user_func(array(get_called_class(), 'getHeaderHTML'), true, $args);
}
if ($mode == MODE_EXISTING && ($loadedSampleId || $loadedSubjectObservationId)) {
$existing = true;
} else {
$existing = false;
}
$hiddens .= get_user_profile_hidden_inputs($attributes, $args, $existing, $auth['read']);
$customAttributeTabs = get_attribute_tabs($attributes);
// remove added comment controls unless editing an existing sample
if ($mode !== MODE_EXISTING || helper_base::$form_mode === 'ERRORS') {
$controls = helper_base::explode_lines($args['structure']);
$new_controls = array();
foreach ($controls as $control) {
if ($control !== '[show added sample comments]' && $control !== '[add sample comment]') {
$new_controls[] = $control;
}
}
$args['structure'] = implode("\r\n", $new_controls);
}
$tabs = self::get_all_tabs($args['structure'], $customAttributeTabs);
$r .= "<div id=\"controls\">\n";
// Build a list of the tabs that actually have content
$tabHtml = self::get_tab_html($tabs, $auth, $args, $attributes, $hiddens);
// 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']['#' . $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;
foreach ($tabHtml 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";
// For wizard include the tab title as a header.
if ($args['interface'] == 'wizard') {
$r .= '<h1>' . $headerOptions['tabs']['#' . $tabalias] . '</h1>';
}
$r .= $tabContent;
// 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')));
} elseif ($pageIdx == count($tabHtml) - 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\" id=\"save-button\" 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\" id=\"save-button\" value=\"" . lang::get('LANG_Save') . "\" />\n";
}
if (!empty(data_entry_helper::$validation_errors)) {
$r .= data_entry_helper::dump_remaining_errors();
}
$r .= "</form>";
if (method_exists(get_called_class(), 'getTrailerHTML')) {
$r .= call_user_func(array(get_called_class(), 'getTrailerHTML'), true, $args);
}
return $r;
}
示例4: get_form
//.........这里部分代码省略.........
// If logged in, output some hidden data about the user
if (isset($args['copyFromProfile']) && $args['copyFromProfile'] == true) {
self::profile_load_all_profile($user);
}
foreach ($attributes as &$attribute) {
$attrPropName = 'profile_' . strtolower(str_replace(' ', '_', $attribute['caption']));
if (isset($args['copyFromProfile']) && $args['copyFromProfile'] == true && isset($user->{$attrPropName})) {
if ($args['nameShow'] == true) {
$attribute['default'] = $user->{$attrPropName};
} else {
// profile attributes are not displayed as the user is logged in
$attribute['handled'] = true;
$attribute['value'] = $user->{$attrPropName};
}
} elseif (strcasecmp($attribute['caption'], 'cms user id') == 0) {
if ($logged_in) {
$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) {
if ($args['emailShow'] != true) {
// email attribute is not displayed
$attribute['value'] = $user->mail;
$attribute['handled'] = true;
} else {
$attribute['default'] = $user->mail;
}
}
} elseif ((strcasecmp($attribute['caption'], 'first name') == 0 || strcasecmp($attribute['caption'], 'last name') == 0 || strcasecmp($attribute['caption'], 'surname') == 0) && $logged_in) {
if ($args['nameShow'] != true) {
// name attributes are not displayed because we have the users login
$attribute['handled'] = true;
}
}
// If we have a value for one of the user login attributes then we need to output this value. BUT, for existing data
// we must not overwrite the user who created the record.
if (isset($attribute['value']) && $mode != MODE_EXISTING) {
$hiddens .= '<input type="hidden" name="' . $attribute['fieldname'] . '" value="' . $attribute['value'] . '" />' . "\n";
}
}
$customAttributeTabs = get_attribute_tabs($attributes);
$tabs = self::get_all_tabs($args['structure'], $customAttributeTabs);
$r .= "<div id=\"controls\">\n";
// Build a list of the tabs that actually have content
$tabHtml = self::get_tab_html($tabs, $auth, $args, $attributes, $hiddens);
// 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']['#' . $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;
foreach ($tabHtml 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";
// For wizard include the tab title as a header.
if ($args['interface'] == 'wizard') {
$r .= '<h1>' . $headerOptions['tabs']['#' . $tabalias] . '</h1>';
}
$r .= $tabContent;
// 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')));
} elseif ($pageIdx == count($tabHtml) - 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\" id=\"save-button\" 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\" id=\"save-button\" value=\"" . lang::get('LANG_Save') . "\" />\n";
}
if (!empty(data_entry_helper::$validation_errors)) {
$r .= data_entry_helper::dump_remaining_errors();
}
$r .= "</form>";
$r .= self::link_species_popups($args);
return $r;
}
示例5: 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;
}
示例6: getFooter
/**
* Overridable function to retrieve the HTML to appear below the dynamically constructed form,
* which by default is the closure of the HTML form for data submission
* @param type $args
*/
protected static function getFooter($args)
{
$r = '';
// add a single submit button outside the tabs if they want a button visible all the time
if ($args['interface'] == 'tabs' && $args['save_button_below_all_pages'] && method_exists(self::$called_class, 'getSubmitButtons')) {
$r .= call_user_func(array(self::$called_class, 'getSubmitButtons'), $args);
}
if (!empty(data_entry_helper::$validation_errors)) {
$r .= data_entry_helper::dump_remaining_errors();
}
$r .= "</form>";
return $r;
}
示例7: renderFooter
/**
* Overridable function to retrieve the HTML to appear below the dynamically
* constructed form, which by default is the closure of the HTML form for data
* submission
* @param string $args
* @return string
*/
protected static function renderFooter($args)
{
$r = '';
if (!empty(data_entry_helper::$validation_errors)) {
$r .= data_entry_helper::dump_remaining_errors();
}
return $r;
}
示例8: get_form
//.........这里部分代码省略.........
}
$languageFilteredAttrOptions = $defAttrOptions + array('language' => iform_lang_iso_639_2($args['language']));
$r .= data_entry_helper::outputAttribute($attributes[$args['sample_walk_direction_id']], $languageFilteredAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['sample_reliability_id']], $languageFilteredAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['sample_visit_number_id']], array_merge($languageFilteredAttrOptions, array('default' => 1, 'noBlankText' => true)));
if ($readOnly) {
$r .= data_entry_helper::text_input(array_merge($defAttrOptions, array('label' => lang::get('LANG_Date'), 'fieldname' => 'sample:date', 'disabled' => $disabledText)));
} else {
$r .= data_entry_helper::date_picker(array('label' => lang::get('LANG_Date'), 'fieldname' => 'sample:date', 'class' => 'vague-date-picker', 'suffixTemplate' => 'requiredsuffix'));
}
$r .= data_entry_helper::outputAttribute($attributes[$args['sample_wind_id']], $languageFilteredAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['sample_precipitation_id']], $languageFilteredAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['sample_temperature_id']], array_merge($defAttrOptions, array('suffixTemplate' => 'nosuffix')));
$r .= " degC<span class=\"deh-required\">*</span><br />";
$r .= data_entry_helper::outputAttribute($attributes[$args['sample_cloud_id']], $defAttrOptions);
$r .= data_entry_helper::outputAttribute($attributes[$args['sample_start_time_id']], array_merge($defAttrOptions, array('suffixTemplate' => 'nosuffix')));
$r .= " hh:mm<span class=\"deh-required\">*</span><br />";
$r .= data_entry_helper::outputAttribute($attributes[$args['sample_end_time_id']], array_merge($defAttrOptions, array('suffixTemplate' => 'nosuffix')));
$r .= " hh:mm<span class=\"deh-required\">*</span><br />";
unset($defAttrOptions['suffixTemplate']);
unset($defAttrOptions['validation']);
if (user_access($adminPerm)) {
// users with admin permissions can override the closing of the
// sample by unchecking the checkbox.
// Because this is attached to the sample, we have to include the sample required fields in the
// the post. This means they can't be disabled, so we enable all fields in this case.
// Normal users can only set this to closed, and they do this using a button/hidden field.
$r .= data_entry_helper::outputAttribute($attributes[$args['sample_closure_id']], $defAttrOptions);
} else {
// hidden closed
$r .= "<input type=\"hidden\" id=\"" . $closedFieldName . "\" name=\"" . $closedFieldName . "\" value=\"" . $closedFieldValue . "\" />\n";
}
if (!empty(data_entry_helper::$validation_errors)) {
$r .= data_entry_helper::dump_remaining_errors();
}
$escaped_id = str_replace(':', '\\\\:', $closedFieldName);
if (!$readOnly) {
$r .= "<input type=button id=\"close1\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save_Survey_Details') . "\";\n onclick=\"var result = \$('#SurveyForm input').valid();\n var result2 = \$('#SurveyForm select').valid();\n if (!result || !result2) {\n return;\n }\n jQuery('#SurveyForm').submit();\">\n";
if (!user_access($adminPerm) && $mode != 1) {
$r .= "<input type=button id=\"close2\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save_Survey_And_Close') . "\"\n onclick=\"if(confirm('" . lang::get('LANG_Close_Survey_Confirm') . "')){\n var result = \$('#SurveyForm input').valid();\n var result2 = \$('#SurveyForm select').valid();\n if (!result || !result2) {\n return;\n }\n jQuery('#" . $escaped_id . "').val('1');\n jQuery('#SurveyForm').submit();\n };\">\n";
}
}
$r .= "</form>";
$r .= "</div>\n";
// Set up Occurrence List tab: don't include when creating a new sample as it will have no occurrences
// Grid populated at a later point
$r .= "<div id=\"occurrenceList\" class=\"mnhnl-btw-datapanel\">\n";
if ($mode != 1) {
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');
$r .= '<div id="occ_grid"></div>';
$r .= "<form method=\"post\" action=\"" . data_entry_helper::$base_url . "/index.php/services/report/requestReport?report=mnhnl_btw_occurrences_report.xml&reportSource=local&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth['nonce'] . "&mode=csv\">";
$r .= "<input type=\"hidden\" id=\"params\" name=\"params\" value='{\"survey_id\":" . $args['survey_id'] . ", \"sample_id\":" . data_entry_helper::$entity_to_load['sample:id'] . "}' />";
$r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Download_Occurrences') . "\">";
$r .= "</FORM>";
} else {
$r .= '<p>' . lang::get('LANG_Page_Not_Available') . '</p>';
}
$r .= '</div>';
// Set up Occurrence tab: don't allow entry of a new occurrence until after top level sample is saved.
$r .= "<div id=\"occurrence\" class=\"mnhnl-btw-datapanel\">\n";
if ($mode != 1 && ($mode != 2 && $mode != 4 || $readOnly == false)) {
data_entry_helper::$entity_to_load = $childSample;
data_entry_helper::$validation_errors = $childErrors;
$attributes = data_entry_helper::getAttributes(array('id' => data_entry_helper::$entity_to_load['occurrence:id'], 'valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => 'occAttr', 'extraParams' => $readAuth));
if ($occReadOnly) {
示例9: array
<?php
// Get authorisation tokens to update and read from the Warehouse.
$auth = data_entry_helper::get_read_write_auth($config['website_id'], $config['password']);
echo $auth['write'];
$readAuth = $auth['read'];
?>
<input type='hidden' id='website_id' name='website_id' value='<?php
echo $config['website_id'];
?>
' />
<input type='hidden' id='record_status' name='record_status' value='C' />
<?php
echo data_entry_helper::autocomplete(array('label' => 'Species', 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'extraParams' => $readAuth + array('taxon_list_id' => $config['species_checklist_taxon_list'])));
echo data_entry_helper::date_picker(array('label' => 'Date', 'fieldname' => 'sample:date'));
echo data_entry_helper::file_box(array('caption' => 'Upload your photos', 'resizeWidth' => 1024, 'resizeHeight' => 768, 'table' => 'occurrence_image', 'runtimes' => array('html4')));
echo data_entry_helper::sref_and_system(array('label' => 'Grid ref'));
echo data_entry_helper::select(array('label' => 'Survey', 'fieldname' => 'sample:survey_id', 'table' => 'survey', 'captionField' => 'title', 'valueField' => 'id', 'extraParams' => $readAuth));
echo data_entry_helper::textarea(array('label' => 'Comment', 'fieldname' => 'sample:comment', 'class' => 'wide'));
?>
<input type="submit" class="ui-state-default ui-corner-all" value="Save" />
</form>
<?php
echo data_entry_helper::loading_block_end();
echo data_entry_helper::dump_remaining_errors();
echo data_entry_helper::dump_javascript();
?>
</div>
</body>
</html>
示例10: get_form_sampleoccurrence
protected static function get_form_sampleoccurrence($args, $node)
{
// attributes must be fetched after the entity to load is filled in - this is because the id gets filled in then!
$cancelUrl = self::$currentUrl;
$cancelUrl .= strpos($cancelUrl, '?') === false ? '?' : '&';
$cancelUrl .= "supersample_id=" . data_entry_helper::$entity_to_load['sample:parent_id'];
$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' => self::$auth['read'], 'survey_id' => $args['survey_id']));
if (self::$mode == MODE_EXISTING_OCCURRENCE && self::$gridmode == false && isset(data_entry_helper::$entity_to_load['sample:id'])) {
$cloneEntity = data_entry_helper::$entity_to_load;
$occList = data_entry_helper::preload_species_checklist_occurrences(data_entry_helper::$entity_to_load['sample:id'], self::$auth['read'], $args['occurrence_images']);
foreach ($occList as $id => $taxon) {
self::$occurrenceIds[] = $id;
}
if (count(self::$occurrenceIds) > 1) {
self::$gridmode = true;
data_entry_helper::$entity_to_load = $cloneEntity;
}
}
// Make sure the form action points back to this page
$r = "<form method=\"post\" id=\"entry_form\" action=\"" . self::$currentUrl . "\">\n";
// Get authorisation tokens to update the Warehouse, plus any other hidden data.
$hiddens = self::$auth['write'] . "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n" . "<input type=\"hidden\" id=\"survey_id\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />\n" . "<input type=\"hidden\" id=\"parent_id\" name=\"sample:parent_id\" value=\"" . data_entry_helper::$entity_to_load['sample:parent_id'] . "\" />\n" . "<input type=\"hidden\" id=\"date\" name=\"sample:date\" value=\"" . data_entry_helper::$entity_to_load['sample:date'] . "\" />\n";
if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
$hiddens .= "<input type=\"hidden\" id=\"sample:id\" name=\"sample:id\" value=\"" . data_entry_helper::$entity_to_load['sample:id'] . "\" />\n";
}
// Check if Record Status is included as a control. If not, then add it as a hidden.
$arr = explode("\r\n", $args['structure']);
if (!in_array('[record status]', $arr)) {
$value = isset($args['defaults']['occurrence:record_status']) ? $args['defaults']['occurrence:record_status'] : 'C';
$hiddens .= "<input type=\"hidden\" id=\"occurrence:record_status\" name=\"occurrence:record_status\" value=\"{$value}\" />\n";
}
// request automatic JS validation
if (!isset($args['clientSideValidation']) || $args['clientSideValidation']) {
data_entry_helper::enable_validation('entry_form');
}
self::set_attribute_default_block($attributes);
$tabs = self::get_all_tabs($args['occurrence_structure'], array());
$r .= "<div id=\"controls\">\n";
// Build a list of the tabs that actually have content
$tabHtml = self::get_tab_html($tabs, self::$auth, $args, $attributes, $hiddens);
// Output the dynamic tab headers
$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']['#' . $alias] = $tabtitle;
}
if ($args['interface'] != 'one_page') {
$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;
foreach ($tabHtml 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";
// For wizard include the tab title as a header.
if ($args['interface'] != 'tabs') {
$r .= '<h1>' . $headerOptions['tabs']['#' . $tabalias] . '</h1>';
}
$r .= $tabContent;
// Add any buttons required at the bottom of the tab
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('classRedisplay' => 'ui-widget-content ui-state-default ui-corner-all indicia-button tab-submit-redisplay', 'captionSaveRedisplay' => 'save and redisplay', '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";
$r .= "<input type=\"submit\" name=\"navigate:newoccurrence\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save_and_New') . "\" />\n";
$r .= "<input type=\"button\" class=\"ui-state-default ui-corner-all\"value=\"" . lang::get('LANG_Cancel') . "\" onclick=\"window.location.href='" . $cancelUrl . "'\" >\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";
$r .= "<input type=\"submit\" name=\"navigate:newoccurrence\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Save_and_New') . "\" />\n";
$r .= "<input type=\"button\" class=\"ui-state-default ui-corner-all\" value=\"" . lang::get('LANG_Cancel') . "\" onclick=\"window.location.href='" . $cancelUrl . "'\" >\n";
}
if (!empty(data_entry_helper::$validation_errors)) {
$r .= data_entry_helper::dump_remaining_errors();
}
$r .= "</form>";
$url = self::$svcUrl . "/data/sample/" . data_entry_helper::$entity_to_load['sample:parent_id'];
$url .= "?mode=json&view=detail&auth_token=" . self::$auth['read']['auth_token'] . "&nonce=" . self::$auth['read']['nonce'];
$session = curl_init($url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$entity = json_decode(curl_exec($session), true);
if (isset($entity['error'])) {
throw new Exception($entity['error']);
}
data_entry_helper::$javascript .= "\n// Create a vector layer to display the supersample location\n// the default edit layer is used for the subsamples\nSSStyleMap = new OpenLayers.StyleMap({\n \"default\": new OpenLayers.Style({\n fillColor: \"Green\",\n strokeColor: \"Black\",\n fillOpacity: 0.2,\n strokeWidth: 1\n })\n });\nSSLayer = new OpenLayers.Layer.Vector(\"" . lang::get("LANG_Supersample_Layer") . "\",\n {styleMap: SSStyleMap});\nSSparser = new OpenLayers.Format.WKT();\nSSfeature = SSparser.read('" . $entity[0]['wkt'] . "');\nSSLayer.addFeatures([SSfeature]);\n";
// The map can get initialised an awful lot later (eg when the tab it is on is displayed).
// It is therefore virtually impossible to zoom to this supersample in as the code is not templated
return $r;
//.........这里部分代码省略.........