本文整理汇总了PHP中data_entry_helper::check_default_value方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::check_default_value方法的具体用法?PHP data_entry_helper::check_default_value怎么用?PHP data_entry_helper::check_default_value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::check_default_value方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_control_speciesmap
/**
* Get the control for map based species input, assumed to be multiple entry: ie a grid. Can be single species though.
* Uses the normal species grid, so all options that apply to that, apply to this.
* An option called sampleMethodId can be used to specify the sample method used for subsamples, and therefore the
* controls to show for subsamples.
*/
protected static function get_control_speciesmap($auth, $args, $tabAlias, $options)
{
// The ID must be done here so it can be accessed by both the species grid and the buttons.
$code = rand(0, 1000);
$defaults = array('id' => 'species-grid-' . $code, 'buttonsId' => 'species-grid-buttons-' . $code);
$options = array_merge($defaults, $options);
$gridmode = call_user_func(array(self::$called_class, 'getGridMode'), $args);
if (!$gridmode) {
return "<b>The SpeciesMap control must be used in gridmode.</b><br/>";
}
// Force a new option
$options['speciesControlToUseSubSamples'] = true;
$options['base_url'] = data_entry_helper::$base_url;
if (!isset($args['cache_lookup']) || $args['species_ctrl'] !== 'autocomplete') {
$args['cache_lookup'] = false;
}
// default for old form configurations or when not using an autocomplete
//The filter can be a URL or on the edit tab, so do the processing to work out the filter to use
$filterLines = self::get_species_filter($args);
// store in the argument so that it can be used elsewhere
$args['taxon_filter'] = implode("\n", $filterLines);
//Single species mode only ever applies if we have supplied only one filter species and we aren't in taxon group mode
if ($args['taxon_filter_field'] !== 'taxon_group' && count($filterLines) === 1 && $args['multiple_occurrence_mode'] !== 'multi') {
$response = self::get_single_species_data($auth, $args, $filterLines);
//Optional message to display the single species on the page
if ($args['single_species_message']) {
self::$singleSpeciesName = $response[0]['taxon'];
}
if (count($response) == 0) {
//if the response is empty there is no matching taxon, so clear the filter as we can try and display the checklist with all data
$args['taxon_filter'] = '';
} elseif (count($response) == 1) {
//Keep the id of the single species in a hidden field for processing if in single species mode
// TBD
return '<input type="hidden" name="occurrence:taxa_taxon_list_id" value="' . $response[0]['id'] . "\"/>\n";
}
}
$extraParams = $auth['read'];
// the imp-sref & imp-geom are within the dialog so it is updated.
$speciesCtrl = self::get_control_species_checklist($auth, $args, $extraParams, $options);
// this preloads the subsample data.
$systems = explode(',', str_replace(' ', '', $args['spatial_systems']));
// note that this control only uses the first spatial reference system in the list.
$system = '<input type="hidden" id="imp-sref-system" name="sample:entered_sref_system" value="' . $systems[0] . '" />';
// since we handle the system ourself, we need to include the system handled js files.
data_entry_helper::include_sref_handler_js(array($systems[0] => ''));
$r = '';
if (isset($options['sampleMethodId'])) {
$args['sample_method_id'] = $options['sampleMethodId'];
$sampleAttrs = self::getAttributes($args, $auth);
foreach ($sampleAttrs as &$attr) {
$attr['fieldname'] = 'sc:n::' . $attr['fieldname'];
$attr['id'] = 'sc:n::' . $attr['id'];
}
$attrOptions = self::get_attr_specific_options($options);
$sampleCtrls = get_attribute_html($sampleAttrs, $args, array('extraParams' => $auth['read']), null, $attrOptions);
$r .= '<div id="' . $options['id'] . '-subsample-ctrls" style="display: none">' . $sampleCtrls . '</div>';
}
$r .= '<div id="' . $options['id'] . '-container" style="display: none">' . '<input type="hidden" id="imp-sref" />' . '<input type="hidden" id="imp-geom" />' . '<input type="hidden" name="sample:entered_sref" value="' . data_entry_helper::check_default_value('sample:entered_sref', '') . '">' . '<input type="hidden" name="sample:geom" value="' . data_entry_helper::check_default_value('sample:geom', '') . '" >' . $system . '<div id="' . $options['id'] . '-blocks">' . self::get_control_speciesmap_controls($auth, $args, $options) . '</div>' . '<input type="hidden" value="true" name="speciesgridmapmode" />' . $speciesCtrl . '</div>';
return $r;
}
示例2: get_form
//.........这里部分代码省略.........
// value received from db is not WKT, which is assumed by all the code.
$childSample['taxon'] = $childSample['occurrence:taxon'];
$parentLoadID = $childSample['sample:parent_id'];
}
$parentSample = array();
if ($parentLoadID) {
// load the container master sample
$url = $svcUrl . '/data/sample/' . $parentLoadID;
$url .= "?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"];
$session = curl_init($url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$entity = json_decode(curl_exec($session), true);
if (count($entity) == 0) {
return '<p>' . lang::get('LANG_No_Access_To_Sample') . '</p>';
}
foreach ($entity[0] as $key => $value) {
$parentSample['sample:' . $key] = $value;
}
if (is_array($locations) && !in_array($entity[0]["location_id"], $locations)) {
return '<p>' . lang::get('LANG_No_Access_To_Location') . '</p>';
}
if ($entity[0]["parent_id"]) {
return '<p>' . lang::get('LANG_No_Access_To_Sample') . '</p>';
}
$parentSample['sample:date'] = $parentSample['sample:date_start'];
// bit of a bodge
$childSample['sample:date'] = $parentSample['sample:date'];
// enforce a match between child and parent sample dates
// default values for attributes from DB are picked up automatically.
}
data_entry_helper::$entity_to_load = $parentSample;
$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));
$closedFieldName = $attributes[$sample_closure_id]['fieldname'];
$closedFieldValue = data_entry_helper::check_default_value($closedFieldName, array_key_exists('default', $attributes[$sample_closure_id]) ? $attributes[$sample_closure_id]['default'] : '0');
// default is not closed
if ($closedFieldValue == '') {
$closedFieldValue = '0';
}
if ($closedFieldValue == '1' && !user_access($args['edit_permission'])) {
// sample has been closed, no admin perms. Everything now set to read only.
$surveyReadOnly = true;
$disabledText = "disabled=\"disabled\"";
$defAttrOptions = array('extraParams' => $readAuth, 'disabled' => $disabledText);
} else {
// sample editable. Admin users can modify closed samples.
$disabledText = "";
$defAttrOptions = array('extraParams' => $readAuth);
}
// with the AJAX code, we deal with the validation semi manually: Form name is meant be invalid as we only want code included.
data_entry_helper::enable_validation(null);
$r .= "<div id=\"controls\">\n";
$activeTab = 'survey';
// mode 1 = new Sample, display sample.
if ($mode == 2) {
// have specified a sample ID
if ($args["on_edit_survey_nav"] == "survey") {
$activeTab = 'survey';
} else {
if ($surveyReadOnly || $args["on_edit_survey_nav"] == "list") {
$activeTab = 'occurrenceList';
} else {
$activeTab = 'occurrence';
}
}
if ($surveyReadOnly) {
data_entry_helper::$javascript .= "jQuery('#occ-form').hide();";
示例3: get_form
//.........这里部分代码省略.........
$childSample['sample:geom'] = '';
// value received from db is not WKT, which is assumed by all the code.
$thisOccID = $childLoadID;
// this will be used to load the occurrence into the editlayer.
$childSample['taxon'] = $childSample['occurrence:taxon'];
$parentLoadID = $childSample['sample:parent_id'];
}
if ($parentLoadID) {
$url = $svcUrl . '/data/sample/' . $parentLoadID;
$url .= "?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"];
$session = curl_init($url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$entity = json_decode(curl_exec($session), true);
$parentSample = array();
foreach ($entity[0] as $key => $value) {
$parentSample['sample:' . $key] = $value;
}
if (is_array($locations) && !in_array($entity[0]["location_id"], $locations)) {
return '<p>' . lang::get('LANG_No_Access_To_Location') . '</p>';
}
if ($entity[0]["parent_id"]) {
return '<p>' . lang::get('LANG_No_Access_To_Sample') . '</p>';
}
$parentSample['sample:date'] = $parentSample['sample:date_start'];
// bit of a bodge
// default values for attributes from DB are picked up automatically.
}
$childSample['sample:date'] = $parentSample['sample:date'];
// enforce a match between child and parent sample dates
data_entry_helper::$entity_to_load = $parentSample;
data_entry_helper::$validation_errors = $parentErrors;
$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));
$closedFieldName = $attributes[$args['sample_closure_id']]['fieldname'];
$closedFieldValue = data_entry_helper::check_default_value($closedFieldName, array_key_exists('default', $attributes[$args['sample_closure_id']]) ? $attributes[$args['sample_closure_id']]['default'] : '0');
// default is not closed
$adminPerm = 'IForm node ' . $node->nid . ' admin';
if ($closedFieldValue == '1' && !user_access($adminPerm)) {
// sample has been closed, no admin perms. Everything now set to read only.
$readOnly = true;
$disabledText = "disabled=\"disabled\"";
$defAttrOptions = array('extraParams' => $readAuth, 'disabled' => $disabledText);
} else {
// sample open.
$disabledText = "";
$defAttrOptions = array('extraParams' => $readAuth);
}
data_entry_helper::enable_validation('SurveyForm');
$r .= "<div id=\"controls\">\n";
$activeTab = 'survey';
if ($mode == 3 || $mode == 2) {
$activeTab = 'occurrence';
}
// Set Up form tabs.
if ($mode == 4) {
$activeTab = 'occurrenceList';
}
$r .= data_entry_helper::enable_tabs(array('divId' => 'controls', 'active' => $activeTab));
$r .= "<div id=\"temp\"></div>";
$r .= data_entry_helper::tab_header(array('tabs' => array('#survey' => lang::get('LANG_Survey'), '#occurrence' => lang::get($readOnly || $occReadOnly ? 'LANG_Show_Occurrence' : (isset($childSample['sample:id']) ? 'LANG_Edit_Occurrence' : 'LANG_Add_Occurrence')), '#occurrenceList' => lang::get('LANG_Occurrence_List'))));
// Set up main Survey Form.
$r .= "<div id=\"survey\" class=\"mnhnl-btw-datapanel\">\n";
if ($readOnly) {
$r .= "<strong>" . lang::get('LANG_Read_Only_Survey') . "</strong>";
}
$r .= "<form id=\"SurveyForm\" method=\"post\">\n";
$r .= $writeAuth;
示例4:
}
}
}
global $reload_post_data;
$reload_post_data = true;
?>
<form method="post" enctype="multipart/form-data" >
<?php
// Get authentication information
echo data_entry_helper::get_auth($config['website_id'], $config['password']);
?>
<input type='hidden' id='website_id' name='website_id' value='1' />
<input type='hidden' id='record_status' name='record_status' value='C' />
<input type='hidden' id='id' name='id' value='<?php
echo data_entry_helper::check_default_value('id');
?>
' />
<?php
echo data_entry_helper::autocomplete(array('label' => 'Taxon', 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'extraParams' => $readAuth));
echo data_entry_helper::date_picker(array('label' => 'Date', 'fieldname' => 'sample:date'));
echo data_entry_helper::map();
echo data_entry_helper::text_input(array('label' => 'Locality Description', 'fieldname' => 'sample:location_name', 'class' => 'wide'));
echo data_entry_helper::select(array('label' => 'Survey', 'fieldname' => 'sample:survey_id', 'table' => 'survey', 'captionField' => 'title', 'valueField' => 'id', 'extraParams' => $readAuth));
?>
<br />
<label for='occurrence:determiner_id:caption'>Determiner:</label>
<?php
echo data_entry_helper::autocomplete('occurrence:determiner_id', 'person', 'caption', 'id', $readAuth);
?>
<br />
示例5: get_form
//.........这里部分代码省略.........
$childSample['sample:geom'] = '';
// value received from db is not WKT, which is assumed by all the code.
$thisOccID = $childLoadID;
// this will be used to load the occurrence into the editlayer.
$childSample['taxon'] = $childSample['occurrence:taxon'];
$parentLoadID = $childSample['sample:parent_id'];
}
if ($parentLoadID) {
// load the container master sample
$url = $svcUrl . '/data/sample/' . $parentLoadID;
$url .= "?mode=json&view=detail&auth_token=" . $readAuth['auth_token'] . "&nonce=" . $readAuth["nonce"];
$session = curl_init($url);
curl_setopt($session, CURLOPT_RETURNTRANSFER, true);
$entity = json_decode(curl_exec($session), true);
$parentSample = array();
foreach ($entity[0] as $key => $value) {
$parentSample['sample:' . $key] = $value;
}
if (is_array($locations) && !in_array($entity[0]["location_id"], $locations)) {
return '<p>' . lang::get('LANG_No_Access_To_Location') . '</p>';
}
if ($entity[0]["parent_id"]) {
return '<p>' . lang::get('LANG_No_Access_To_Sample') . '</p>';
}
$parentSample['sample:date'] = $parentSample['sample:date_start'];
// bit of a bodge
// default values for attributes from DB are picked up automatically.
}
$childSample['sample:date'] = $parentSample['sample:date'];
// enforce a match between child and parent sample dates
data_entry_helper::$entity_to_load = $parentSample;
$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));
$closedFieldName = $attributes[$args['sample_closure_id']]['fieldname'];
$closedFieldValue = data_entry_helper::check_default_value($closedFieldName, array_key_exists('default', $attributes[$args['sample_closure_id']]) ? $attributes[$args['sample_closure_id']]['default'] : '0');
// default is not closed
$adminPerm = 'IForm node ' . $node->nid . ' admin';
if ($closedFieldValue == '1' && !user_access($adminPerm)) {
// sample has been closed, no admin perms. Everything now set to read only.
$surveyReadOnly = true;
$disabledText = "disabled=\"disabled\"";
$defAttrOptions = array('extraParams' => $readAuth, 'disabled' => $disabledText);
} else {
// sample open.
$disabledText = "";
$defAttrOptions = array('extraParams' => $readAuth);
}
// with the AJAX code, we deal with the validation semi manually: Form name is meant be invalid as we only want code included.
data_entry_helper::enable_validation('DummyForm');
$r .= "<div id=\"controls\">\n";
$activeTab = 'survey';
// mode 1 = new Sample, display sample.
if ($mode == 2) {
// have specified a sample ID
if ($args["on_edit_survey_nav"] == "survey") {
$activeTab = 'survey';
} else {
if ($surveyReadOnly || $args["on_edit_survey_nav"] == "list") {
$activeTab = 'occurrenceList';
} else {
$activeTab = 'occurrence';
}
}
if ($surveyReadOnly) {
data_entry_helper::$javascript .= "jQuery('#occ-form').hide();";
}
} else {