本文整理匯總了PHP中data_entry_helper::dump_errors方法的典型用法代碼示例。如果您正苦於以下問題:PHP data_entry_helper::dump_errors方法的具體用法?PHP data_entry_helper::dump_errors怎麽用?PHP data_entry_helper::dump_errors使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::dump_errors方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: 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)
{
if (isset($response['error'])) {
data_entry_helper::dump_errors($response);
}
if (isset($_REQUEST['page']) && $_REQUEST['page'] == 'grid' && !isset(data_entry_helper::$validation_errors)) {
// we have just saved the sample page, so move on to the occurrences list
return self::get_occurrences_form($args, $node, $response);
} else {
return self::get_sample_form($args, $node, $response);
}
}
示例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 $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)
{
if (isset($response['error'])) {
data_entry_helper::dump_errors($response);
}
if (isset($_REQUEST['page']) && ($_REQUEST['page'] === 'site' && !isset(data_entry_helper::$validation_errors) || $_REQUEST['page'] === 'occurrences' && isset(data_entry_helper::$validation_errors))) {
// or we have just saved the occurrences page with errors, so redisplay the occurrences list
return self::get_occurrences_form($args, $node, $response);
} else {
return self::get_sample_form($args, $node, $response);
}
}
示例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 integer $nid The Drupal node object's ID.
* @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, $nid, $response = null)
{
global $user;
// if (!function_exists('module_exists') || !module_exists('iform_ajaxproxy'))
// return 'This form must be used in Drupal with the Indicia AJAX Proxy module enabled.';
if (!function_exists('module_exists') || !module_exists('easy_login')) {
return 'FATAL INTERNAL CONFIGURATION ERROR: This form must be used in Drupal with the Easy Login module enabled.';
}
if (!function_exists('module_exists') || !module_exists('species_packages')) {
return 'FATAL INTERNAL CONFIGURATION ERROR: This form must be used in Drupal with the custom species_packages module enabled.';
}
// assuming easy login
$userId = hostsite_get_user_field('indicia_user_id');
if (empty($userId)) {
return '<p>FATAL ERROR: Could not identify user.</p>';
}
// something is wrong
$r = isset($response['error']) ? data_entry_helper::dump_errors($response) : '';
iform_load_helpers(array('map_helper', 'report_helper'));
$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
self::$sampleId = null;
self::$occurrenceId = false;
if (isset(data_entry_helper::$entity_to_load['sample:id']) && data_entry_helper::$entity_to_load['sample:id'] != "") {
// have just posted a (failed) edit to an existing parent sample.
self::$sampleId = data_entry_helper::$entity_to_load['sample:id'];
} else {
if (isset(data_entry_helper::$entity_to_load['sample:survey_id']) && data_entry_helper::$entity_to_load['sample:survey_id'] != "") {
// have just posted a (failed) edit to a new parent sample.
self::$sampleId = null;
} else {
if (isset($response['outer_id'])) {
// have just successfully posted either a new parent sample, or an update to an existing one.
self::$sampleId = $response['outer_id'];
data_entry_helper::load_existing_record($auth['read'], 'sample', self::$sampleId, 'detail', false, true);
if (!isset($_POST['force_page_reload'])) {
return self::get_success_page($args, $auth, $response['outer_id']);
}
drupal_set_message(lang::get('The Transect you have just saved specified the Species Package to be used. The Transect has been reloaded below, and the Species tab now contains the Species Grid for the Species Package, which will allow you to enter the species data.'));
} else {
if (isset($_GET['sample_id']) && intval($_GET['sample_id']) == $_GET['sample_id']) {
self::$sampleId = $_GET['sample_id'];
data_entry_helper::load_existing_record($auth['read'], 'sample', self::$sampleId, 'detail', false, true);
} else {
self::$sampleId = null;
}
}
}
}
if (isset($_GET['occurrence_id']) && intval($_GET['occurrence_id']) == $_GET['occurrence_id']) {
self::$occurrenceId = $_GET['occurrence_id'];
if (self::$sampleId == null) {
// fill in the sample_id from the occurrence if don't already have it
$occurrence = data_entry_helper::get_population_data(array('table' => 'occurrence', 'extraParams' => $auth['read'] + array('view' => 'detail', 'id' => self::$occurrenceId)));
// this throws an error exception if any error.
// this gives
if (count($occurrence) == 1) {
$subsample = data_entry_helper::get_population_data(array('table' => 'sample', 'extraParams' => $auth['read'] + array('view' => 'detail', 'id' => $occurrence[0]['sample_id'])));
if (count($subsample) == 1) {
self::$sampleId = $subsample[0]['parent_id'];
data_entry_helper::load_existing_record($auth['read'], 'sample', self::$sampleId, 'detail', false, true);
}
}
}
}
if (isset(data_entry_helper::$entity_to_load['sample:survey_id']) && data_entry_helper::$entity_to_load['sample:survey_id'] != $args['survey_id']) {
drupal_set_message(t('The data entry form you have selected to use is configured for a particular survey:') . ' ID ' . $args['survey_id'] . ' ' . t('The sample you have chosen to view is not assigned to this survey.'), 'error');
drupal_goto('<front>');
}
if (isset(data_entry_helper::$entity_to_load['sample:parent_id']) && data_entry_helper::$entity_to_load['sample:parent_id'] != '' && data_entry_helper::$entity_to_load['sample:parent_id'] !== null) {
drupal_set_message(t('An attempt has been made to access a non top level sample.'));
drupal_goto('<front>');
}
$survey = data_entry_helper::get_population_data(array('table' => 'survey', 'extraParams' => $auth['read'] + array('view' => 'detail', 'id' => $args['survey_id'], 'website_id' => $args['website_id'])));
if (count($survey) != 1) {
return "FATAL INTERNAL CONFIGURATION ERROR: Supplied form survey_id value (" . $args['survey_id'] . ") is not valid survey for this website (" . $args['website_id'] . ").<br/>";
}
$surveyTitle = $survey[0]['title'];
if (self::$sampleId == null) {
$packages = species_packages_get_packages($user->uid, $args['survey_id']);
if ($packages === false || is_array($packages) && count($packages) == 0) {
drupal_set_message(t('You have not yet selected a species package that is compatible with survey') . ' : "' . $surveyTitle . '"', 'error');
drupal_set_message(str_replace('#link#', '<a href="' . url('user/' . $user->uid . '/edit') . '">' . t('this link') . '</a>', t('You can set the species package on your user account page, which can be accessed using #link#. If you have already selected a species package, and wish to add another or wish to change your selection, please contact your Hub Manager.')));
drupal_goto('<front>');
}
self::$readOnly = false;
} else {
self::$readOnly = !isset($response['error']) && data_entry_helper::$entity_to_load['sample:created_by_id'] != hostsite_get_user_field('indicia_user_id') && (empty($args['edit_permission']) || !hostsite_user_has_permission($args['edit_permission']));
}
if (self::$readOnly) {
drupal_set_message(t('In order to save changes to existing records, you must either be the creator of the entry, or have been given the appropriate permission.'));
}
//.........這裏部分代碼省略.........
示例4: array
$occurrences = data_entry_helper::wrap_species_checklist($data);
// Add the occurrences in as submodels
$sampleMod['subModels'] = $occurrences;
// and link in the attributes of the sample
$sampleMod['metaFields']['smpAttributes']['value'] = $smpAttrs;
// Wrap submission and submit
$submission = array('submission' => array('entries' => array(array('model' => $sampleMod))));
$response = data_entry_helper::forward_post_to('save', $submission);
if (array_key_exists('success', $response)) {
// on success, redirect to the thank you page
header('Location:success.php');
die;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<title>Saving data</title>
<link rel="stylesheet" href="advanced.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../media/css/default_site.css" type="text/css" media="screen">
</head>
<body>
<div id="wrap">
<!-- We shouldn't get this far as a success causes redirection -->
<h1>An error occurred</h1>
<?php
echo data_entry_helper::dump_errors($response, false);
?>
</div>
</body>
</html>
示例5:
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/gpl.html.
*
* @package Core
* @subpackage Views
* @author Indicia Team
* @license http://www.gnu.org/licenses/gpl.html GPL
* @link http://code.google.com/p/indicia/
*/
$id = html::initial_value($values, 'location_medium:id');
require_once DOCROOT . 'client_helpers/data_entry_helper.php';
require_once DOCROOT . 'client_helpers/form_helper.php';
if (isset($_POST)) {
data_entry_helper::dump_errors(array('errors' => $this->model->getAllErrors()));
}
?>
<p>This page allows you to specify the details of an location media file.</p>
<form class="cmxform" action="<?php
echo url::site() . 'location_medium/save';
?>
" method="post"
enctype="multipart/form-data" id="location-medium-edit">
<?php
echo $metadata;
?>
<fieldset>
<?php
echo data_entry_helper::hidden_text(array('fieldname' => 'location_medium:id', 'default' => $id));
echo data_entry_helper::hidden_text(array('fieldname' => 'location_medium:location_id', 'default' => html::initial_value($values, 'location_medium:location_id')));
示例6: get_form
/**
* Return the Indicia form code.
* Expects there to be a sample attribute with caption 'Email' containing the email
* address.
* @param array $args Input parameters.
* @param array $node Drupal node object
* @param array $response Response from Indicia services after posting a verification.
* @return HTML string
*/
public static function get_form($args, $node, $response)
{
global $user, $indicia_templates;
// put each param control in a div, which makes it easier to layout with CSS
$indicia_templates['prefix'] = '<div id="container-{fieldname}" class="param-container">';
$indicia_templates['suffix'] = '</div>';
$indicia_user_id = self::get_indicia_user_id($args);
$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
$r = '';
if ($_POST) {
// dump out any errors that occurred on verification
if (data_entry_helper::$validation_errors) {
$r .= '<div class="page-notice ui-state-highlight ui-corner-all"><p>' . implode('</p></p>', array_values(data_entry_helper::$validation_errors)) . '</p></div>';
} else {
if (isset($_POST['email']) && !isset($response['error'])) {
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: ' . $user->mail . PHP_EOL . "\r\n";
$headers .= 'Return-Path: ' . $user->mail . "\r\n";
if (isset($_POST['photoHTML'])) {
$emailBody = str_replace('[photo]', '<br/>' . $_POST['photoHTML'], $_POST['email_content']);
} else {
$emailBody = $_POST['email_content'];
}
$emailBody = str_replace("\n", "<br/>", $emailBody);
// Send email. Depends upon settings in php.ini being correct
$success = mail($_POST['email_to'], $_POST['email_subject'], wordwrap($emailBody, 70), $headers);
if ($success) {
$r .= '<div class="page-notice ui-state-highlight ui-corner-all"><p>An email was sent to ' . $_POST['email_to'] . '.</p></div>';
} else {
$r .= '<div class="page-notice ui-widget-content ui-corner-all ui-state-highlight left">The webserver is not correctly configured to send emails. Please send the following email manually: <br/>' . '<div id="manual-email"><span>To:</span><div>' . $_POST['email_to'] . '</div>' . '<span>Subject:</span><div>' . $_POST['email_subject'] . '</div>' . '<span>Content:</span><div>' . $emailBody . '</div>' . '</div></div><div style="clear: both">';
}
} else {
if (isset($_POST['occurrence:record_status']) && isset($response['success']) && $args['emails_enabled']) {
$r .= self::get_notification_email_form($args, $response, $auth);
}
}
}
if (isset($_POST['action']) && $_POST['action'] == 'send_to_verifier' && $args['log_send_to_verifier']) {
$comment = str_replace(array('%email%', '%date%', '%user%'), array($_POST['email_to'], date('jS F Y'), $user->name), $args['log_send_to_verifier_comment']);
} elseif (isset($_POST['action']) && ($_POST['action'] = 'general_comment')) {
$comment = $_POST['comment'];
}
// If there is a comment to save, add it to the occurrence comments
if (isset($comment)) {
// get our own write tokens for this submission, as the main ones are used in the JavaScript form.
$loggingAuth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
$sub = data_entry_helper::wrap(array('comment' => $comment, 'occurrence_id' => $_POST['occurrence:id'], 'created_by_id' => $indicia_user_id), 'occurrence_comment');
$logResponse = data_entry_helper::forward_post_to('occurrence_comment', $sub, $loggingAuth['write_tokens']);
if (!array_key_exists('success', $logResponse)) {
$r .= data_entry_helper::dump_errors($response, false);
}
}
}
//extract fixed parameters for report grid.
$params = explode(",", $args['fixed_params']);
foreach ($params as $param) {
$keyvals = explode("=", $param);
$key = trim($keyvals[0]);
$val = trim($keyvals[1]);
$extraParams[$key] = $val;
}
// plus defaults which are not fixed
$params = explode("\n", $args['param_defaults']);
foreach ($params as $param) {
$keyvals = explode("=", $param);
$key = trim($keyvals[0]);
$val = trim($keyvals[1]);
$paramDefaults[$key] = $val;
}
$actions = array();
if ($args['send_for_verification']) {
// store authorisation details as a global in js, since some of the JavaScript needs to be able to access Indicia data
data_entry_helper::$javascript .= 'auth=' . json_encode($auth) . ';';
$actions[] = array('caption' => str_replace(' ', ' ', lang::get('Send to verifier')), 'class' => 'send_for_verification_btn', 'javascript' => 'indicia_send_to_verifier(\'{taxon}\', {occurrence_id}, ' . $user->uid . ', ' . $args['website_id'] . '); return false;');
$r .= self::get_send_for_verification_form();
}
$actions[] = array('caption' => str_replace(' ', ' ', lang::get('Verify')), 'javascript' => 'indicia_verify(\'{taxon}\', {occurrence_id}, true, ' . $user->uid . '); return false;');
$actions[] = array('caption' => str_replace(' ', ' ', lang::get('Reject')), 'javascript' => 'indicia_verify(\'{taxon}\', {occurrence_id}, false, ' . $user->uid . '); return false;');
$actions[] = array('caption' => str_replace(' ', ' ', lang::get('Comments')), 'javascript' => 'indicia_comments(\'{taxon}\', {occurrence_id}, ' . $user->uid . ', \'' . $auth['read']['nonce'] . '\', \'' . $auth['read']['auth_token'] . '\'); return false;');
if (isset($args['path_to_record_details_page']) && $args['path_to_record_details_page']) {
$actions[] = array('caption' => str_replace(' ', ' ', lang::get('View details')), 'url' => '{rootFolder}' . $args['path_to_record_details_page'], 'urlParams' => array('occurrence_id' => '{occurrence_id}'));
}
// default columns behaviour is to just include anything returned by the report plus add an actions column
$columns = array(array('display' => 'Actions', 'actions' => $actions));
// this can be overridden
if (isset($args['columns_config']) && !empty($args['columns_config'])) {
$columns = array_merge(json_decode($args['columns_config'], true), $columns);
}
$r .= data_entry_helper::report_grid(array('id' => 'verification-grid', 'dataSource' => $args['report_name'], 'mode' => 'report', 'readAuth' => $auth['read'], 'columns' => $columns, 'rowId' => 'occurrence_id', 'itemsPerPage' => 10, 'autoParamsForm' => $args['auto_params_form'], 'extraParams' => $extraParams, 'paramDefaults' => $paramDefaults));
//.........這裏部分代碼省略.........