本文整理汇总了PHP中data_entry_helper::check_errors方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::check_errors方法的具体用法?PHP data_entry_helper::check_errors怎么用?PHP data_entry_helper::check_errors使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::check_errors方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: tab_your_square
protected static function tab_your_square($args, $auth, $attrs)
{
$r = '<fieldset class="ui-corner-all" >';
$r .= '<legend>Place on map</legend>';
$r .= '<div class="two columns"><div class="column">';
$r .= data_entry_helper::georeference_lookup(array('label' => 'Enter the nearest place name', 'labelClass' => 'control-width-5', 'helpText' => 'Enter the name of a nearby town or village then click Search to quickly find the correct region on the map. ' . 'Or if you know the grid reference, type it into the following box.'));
$r .= data_entry_helper::sref_and_system(array('label' => 'Your 1km grid reference', 'labelClass' => 'control-width-5', 'fieldname' => 'sample:entered_sref', 'systems' => array('OSGB' => 'British National Grid', 'OSIE' => 'Irish Grid'), 'class' => 'ui-state-highlight'));
$sq_error = data_entry_helper::check_errors('smpAttr:' . $args['attr_surveyed_square']);
$r .= '<fieldset class="ui-state-highlight ui-corner-all' . ($sq_error ? ' ui-state-error' : '') . '">';
$r .= "<legend>Please also select one of the 3 choices below</legend>\n";
if ($sq_error) {
$r .= "{$sq_error}<br/>\n";
}
// manual output of radio buttons since data_entry_helper::radio_group does not support splicing in the textarea.
$whichSqrAttr = $attrs['smpAttr:' . $args['attr_surveyed_square']];
$reasonAttr = $attrs['smpAttr:' . $args['attr_surveyed_other_square_reason']];
$fieldname = $whichSqrAttr['fieldname'];
$value = $whichSqrAttr['default'];
$r .= '<label class="auto">';
$r .= '<input ';
if ($value == $args['term_surveyed_given_square']) {
$r .= 'checked="checked" ';
}
$r .= 'type="radio" id="attr_surveyed_given_square" value="' . $args['term_surveyed_given_square'] . '" name="' . $whichSqrAttr['fieldname'] . '"/> ';
$r .= "I have surveyed the random square that I was given</label><br/>\n";
$r .= '<label class="auto">';
$r .= '<input ';
if ($value == $args['term_surveyed_other_square']) {
$r .= 'checked="checked" ';
}
$r .= 'type="radio" id="attr_surveyed_other_square" value="' . $args['term_surveyed_other_square'] . '" name="' . $whichSqrAttr['fieldname'] . '"/> ';
$r .= "I have not surveyed the random square because</label><br/>\n";
$r .= data_entry_helper::textarea(array('fieldname' => $reasonAttr['fieldname'], 'class' => 'indented reason', 'default' => $reasonAttr['default'], 'cols' => 50));
$r .= "\n<label class=\"auto\">";
$r .= '<input ';
if ($value == $args['term_surveyed_same_square']) {
$r .= 'checked="checked" ';
}
$r .= 'type="radio" id="attr_surveyed_same_square" value="' . $args['term_surveyed_same_square'] . '" name="' . $whichSqrAttr['fieldname'] . '"/> ';
$r .= "I have resurveyed the same square as before</label>\n";
$r .= '</fieldset>';
$r .= '</div><div class="column">';
$r .= data_entry_helper::map_panel(array('presetLayers' => array('google_hybrid'), 'readAuth' => $auth, 'class' => 'ui-widget-content', 'clickedSrefPrecisionMin' => 4, 'clickedSrefPrecisionMax' => 4, 'initial_lat' => 54, 'initial_long' => -1, 'initial_zoom' => 5, 'width' => '100%', 'tabDiv' => 'your-square'));
$r .= "</div></div></fieldset>\n";
$r .= data_entry_helper::wizard_buttons(array('divId' => 'tabs', 'page' => 'middle'));
return $r;
}
示例2: dump_one_row
private function dump_one_row($txIdx, $rowIds, $taxalist, $taxonRows, $occAttrControls, $attributes, $options)
{
global $indicia_templates;
$ttlId = $rowIds['ttlId'];
$colIdx = (int) floor($rowIdx / count($taxonRows));
// Find the taxon in our preloaded list data that we want to output for this row
$taxonIdx = 0;
while ($taxonIdx < count($taxalist) && $taxalist[$taxonIdx]['id'] != $ttlId) {
$taxonIdx += 1;
}
if ($taxonIdx >= count($taxalist)) {
return '';
}
// next taxon, as this one was not found in the list
$taxon = $taxalist[$taxonIdx];
$firstColumnTaxon = $taxon;
// map field names if using a cached lookup
if ($options['cacheLookup']) {
$firstColumnTaxon = $firstColumnTaxon + array('preferred_name' => $firstColumnTaxon['preferred_taxon'], 'common' => $firstColumnTaxon['default_common_name']);
}
$firstColumnTaxon['taxonComp'] = preg_replace('/\\s+|\\//', '-', strtolower($firstColumnTaxon['taxon']));
// Get the cell content from the taxon_label template
$firstCell = data_entry_helper::mergeParamsIntoTemplate($firstColumnTaxon, 'taxon_label');
// Now create the table cell to contain this.
$row = '';
$row .= str_replace(array('{content}', '{colspan}', '{tableId}', '{idx}'), array($firstCell, '', $options['id'], $colIdx), $indicia_templates['taxon_label_cell']);
$row .= "\n<td class=\"scPresenceCell\" headers=\"{$options['id']}-present-{$colIdx}\" style=\"display:none\">";
$fieldname = "sc:{$options['id']}-{$txIdx}:{$existing_record_id}:present";
$row .= "<input type=\"hidden\" name=\"{$fieldname}\" id=\"{$fieldname}\" value=\"{$taxon['id']}\"/>";
$row .= "</td>";
$idx = 0;
foreach ($occAttrControls as $attrId => $control) {
$existing_value = '';
$valId = false;
// no existing record, so use a default control ID which excludes the existing record ID.
$ctrlId = str_replace('-idx-', "{$options['id']}-{$txIdx}", $attributes[$attrId]['fieldname']);
$loadedCtrlFieldName = '-';
if ($existing_value === '' && array_key_exists('default', $attributes[$attrId])) {
// this case happens when reloading an existing record
$existing_value = $attributes[$attrId]['default'];
}
// inject the field name into the control HTML
$oc = str_replace('{fieldname}', $ctrlId, $control);
if ($existing_value != "") {
// For select controls, specify which option is selected from the existing value
if (substr($oc, 0, 7) == '<select') {
$oc = str_replace('value="' . $existing_value . '"', 'value="' . $existing_value . '" selected="selected"', $oc);
} else {
if (strpos($oc, 'checkbox') !== false) {
if ($existing_value == "1") {
$oc = str_replace('type="checkbox"', 'type="checkbox" checked="checked"', $oc);
}
} else {
$oc = str_replace('value=""', 'value="' . $existing_value . '"', $oc);
}
}
}
$errorField = "occAttr:{$attrId}" . ($valId ? ":{$valId}" : '');
$error = data_entry_helper::check_errors($errorField);
if ($error) {
$oc = str_replace("class='", "class='ui-state-error ", $oc);
$oc .= $error;
}
$headers = $options['id'] . "-attr{$attrId}-{$colIdx}";
$class = self::species_checklist_occ_attr_class($options, $idx, $attributes[$attrId]['untranslatedCaption']);
$class = $class . 'Cell';
$row .= str_replace(array('{label}', '{class}', '{content}', '{headers}'), array(lang::get($attributes[$attrId]['caption']), $class, $oc, $headers), $indicia_templates[$options['attrCellTemplate']]);
$idx++;
}
return $row;
}
示例3: addAttributeCols
private static function addAttributeCols($occAttrControls, $attributes, $options, $txIdx)
{
global $indicia_templates;
$idx = 0;
foreach ($occAttrControls as $attrId => $control) {
$existing_value = '';
$valId = false;
// no existing record, so use a default control ID which excludes the existing record ID.
$ctrlId = str_replace('-idx-', "{$options['id']}-{$txIdx}", $attributes[$attrId]['fieldname']);
$loadedCtrlFieldName = '-';
if ($existing_value === '' && array_key_exists('default', $attributes[$attrId])) {
// this case happens when reloading an existing record
$existing_value = $attributes[$attrId]['default'];
}
// inject the field name into the control HTML
$oc = str_replace('{fieldname}', $ctrlId, $control);
if ($existing_value != "") {
// For select controls, specify which option is selected from the existing value
if (substr($oc, 0, 7) == '<select') {
$oc = str_replace('value="' . $existing_value . '"', 'value="' . $existing_value . '" selected="selected"', $oc);
} else {
if (strpos($oc, 'checkbox') !== false) {
if ($existing_value == "1") {
$oc = str_replace('type="checkbox"', 'type="checkbox" checked="checked"', $oc);
}
} else {
$oc = str_replace('value=""', 'value="' . $existing_value . '"', $oc);
}
}
}
$errorField = "occAttr:{$attrId}" . ($valId ? ":{$valId}" : '');
$error = data_entry_helper::check_errors($errorField);
if ($error) {
$oc = str_replace("class='", "class='ui-state-error ", $oc);
$oc .= $error;
}
$headers = $options['id'] . "-attr{$attrId}-{$txIdx}";
$class = self::species_checklist_occ_attr_class($options, $idx, $attributes[$attrId]['untranslatedCaption']);
$class = $class . 'Cell';
$row .= str_replace(array('{label}', '{class}', '{content}', '{headers}'), array(lang::get($attributes[$attrId]['caption']), $class, $oc, $headers), $indicia_templates[$options['attrCellTemplate']]);
$idx++;
}
return $row;
}