本文整理汇总了PHP中data_entry_helper::get_reload_link_parts方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::get_reload_link_parts方法的具体用法?PHP data_entry_helper::get_reload_link_parts怎么用?PHP data_entry_helper::get_reload_link_parts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::get_reload_link_parts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_form
public static function get_form($args, $node, $response = null)
{
global $indicia_templates;
global $user;
$indicia_templates['select_item'] = '<option value="{value}" {selected} >{caption} </option>';
// we don't use the map, but a lot of the inherited code assumes the map is present.
self::$svcUrl = data_entry_helper::$base_url . '/index.php/services';
data_entry_helper::add_resource('openlayers');
$indicia_templates['label'] = '<label for="{id}"{labelClass}>{label}:</label>';
// can't have the CR on the end
$indicia_templates['zilch'] = '';
// can't have the CR on the end
self::$locations = iform_loctools_listlocations($node);
$retVal = parent::get_form($args, $node, $response);
$reload = data_entry_helper::get_reload_link_parts();
$reloadPath = $reload['path'];
if (self::$mode != 0) {
data_entry_helper::$javascript .= "\njQuery('<div class=\"ui-widget-content ui-state-default ui-corner-all indicia-button tab-cancel\"><span><a href=\"" . $reloadPath . "\">Cancel</a></span></div>').appendTo('.buttons');\n\$.validator.messages.required = \"" . lang::get('validation_required') . "\";";
if (!iform_loctools_checkaccess($node, 'superuser')) {
data_entry_helper::$javascript .= "\njQuery('[name=smpAttr\\:" . $args['observer_attr_id'] . "],[name^=smpAttr\\:" . $args['observer_attr_id'] . "\\:]').attr('readonly',true)";
if (self::$mode == 1) {
data_entry_helper::$javascript .= ".val(\"" . $user->name . "\");";
} else {
data_entry_helper::$javascript .= ";";
}
} else {
$userlist = iform_loctools_listusers($node);
data_entry_helper::$javascript .= "\nexisting = jQuery('[name=smpAttr\\:" . $args['observer_attr_id'] . "],[name^=smpAttr\\:" . $args['observer_attr_id'] . "\\:]');\nreplacement = '<select name=\"'+existing.attr('name')+'\" >";
foreach ($userlist as $uid => $a_user) {
data_entry_helper::$javascript .= "<option value=\"" . $a_user->name . "\">" . $a_user->name . " </option>";
}
data_entry_helper::$javascript .= "</select>';\njQuery(replacement).insertBefore(existing).val(existing.val());\nexisting.remove();\n";
}
data_entry_helper::$javascript .= "\n// jQuery('#sample\\\\:date').datepicker( \"option\", \"minDate\", new Date(2010, 4 - 1, 1) );\nDate.prototype.getMonthName = function() {\nvar m = ['" . lang::get('January') . "','" . lang::get('February') . "','" . lang::get('March') . "',\n'" . lang::get('April') . "','" . lang::get('May') . "','" . lang::get('June') . "',\n'" . lang::get('July') . "','" . lang::get('August') . "','" . lang::get('September') . "',\n'" . lang::get('October') . "','" . lang::get('November') . "','" . lang::get('December') . "'];\nreturn m[this.getMonth()];\n} \nvar monthAttr = jQuery('[name=smpAttr\\\\:" . $args['month_attr_id'] . "],[name^=smpAttr\\\\:" . $args['month_attr_id'] . "\\\\:]').attr('disabled', true);\nmonthAttr.before('<input type=\"hidden\" id=\"storedMonth\" name=\"'+monthAttr.attr('name')+'\">');\nupdateSampleDate = function(context, doAlert){\n jQuery('.displayDateDetails').empty().append('<span>'+jQuery('[name=sample\\:date]').val()+'</span>');\n var myDate = jQuery(context).datepicker(\"getDate\").getMonthName();\n var monthAttr = jQuery('[name=smpAttr\\\\:" . $args['month_attr_id'] . "],[name^=smpAttr\\\\:" . $args['month_attr_id'] . "\\\\:]').filter('select').val(\"\");\n monthAttr.find(\"option:contains('\"+myDate+\"')\").attr('selected',true) ; \n jQuery('#storedMonth').val(monthAttr.val()); // doing in this order converts the text to a number and stores that number in the storedMonth\n if(doAlert && monthAttr.val() == \"\")\n \talert('Given date is outside valid month range (April to September).');\n};\njQuery('#sample\\\\:date').change(function(){updateSampleDate(this, true);});\nupdateSampleDate('#sample\\\\:date', false);\njQuery('.tab-submit').unbind('click');\njQuery('.tab-submit').click(function() {\n var current=jQuery('#controls').tabs('option', 'selected');\n var tabinputs = jQuery('#entry_form div > .ui-tabs-panel:eq('+current+')').find('input,select');\n var secList = '';\n if (!tabinputs.valid()) { return; }\n var rows = jQuery('.sectionlist').find('tr');\n for(var i=1; i<= " . $args['max_number_sections'] . "; i++){\n if(jQuery('.sectionlist').find('[section='+i+']').length > 0) {\n var aucuneControl = jQuery(':checkbox[name^=\"SLA\\:'+i+'\\:\"]').filter('[name\$=\"\\:" . $args['aucune_attr_id'] . "\"]');\n var foundEntry = false;\n for(var j = 1; j < (rows.length-(numAttrs+1)); j++){\n foundEntry = foundEntry || (jQuery(rows[j]).find('td').filter(':eq('+i+')').find('[value!=\"\"]').length > 0);\n }\n if(!foundEntry && !aucuneControl.attr('checked')){\n secList = secList + (secList=='' ? '' : ', ') + i;\n }\n }\n }\n if (secList != ''){\n alert('The following sections have no species recorded against them: Section(s) '+secList+'. In these circumstances, the \"No Observation\" checkbox must be checked for the relevant section.'); \n return;\n }\n var form = jQuery(this).parents('form:first');\n form.submit();\n});\n";
} else {
$retVal .= "<div style=\"display:none\" />\n <form id=\"form-delete-survey\" action=\"" . $reloadPath . "\" method=\"POST\">" . self::$auth['write'] . "\n <input type=\"hidden\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n <input type=\"hidden\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />\n <input type=\"hidden\" name=\"sample:id\" value=\"\" />\n <input type=\"hidden\" name=\"sample:date\" value=\"2010-01-01\"/>\n <input type=\"hidden\" name=\"sample:location_id\" value=\"\" />\n <input type=\"hidden\" name=\"sample:deleted\" value=\"t\" />\n </form>\n</div>";
data_entry_helper::$javascript .= "\ndeleteSurvey = function(sampleID){\n if(confirm(\"Are you sure you wish to delete survey \"+sampleID)){\n jQuery.getJSON(\"" . self::$svcUrl . "/data/sample/\"+sampleID +\n \"?mode=json&view=detail&auth_token=" . self::$auth['read']['auth_token'] . "&nonce=" . self::$auth['read']["nonce"] . "\" +\n \"&callback=?\", function(data) {\n if (data.length>0) {\n jQuery('#form-delete-survey').find('[name=sample\\:id]').val(data[0].id);\n jQuery('#form-delete-survey').find('[name=sample\\:date]').val(data[0].date_start);\n jQuery('#form-delete-survey').find('[name=sample\\:location_id]').val(data[0].location_id);\n jQuery('#form-delete-survey').submit();\n }});\n };\n};\n";
}
return $retVal;
}
示例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 (!($user_id = hostsite_get_user_field('indicia_user_id'))) {
return self::abort('Please ensure that you\'ve filled in your surname on your user profile before leaving a group.', $args);
}
if (empty($_GET['group_id'])) {
return self::abort('This form must be called with a group_id in the URL parameters.', $args);
}
$r = '';
$auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
$group = data_entry_helper::get_population_data(array('table' => 'group', 'extraParams' => $auth['read'] + array('id' => $_GET['group_id']), 'nocache' => true));
if (count($group) !== 1) {
return self::abort('The group you\'ve requested membership of does not exist.', $args);
}
iform_load_helpers(array('submission_builder'));
$group = $group[0];
// Check for an existing group user record
$existing = data_entry_helper::get_population_data(array('table' => 'groups_user', 'extraParams' => $auth['read'] + array('group_id' => $_GET['group_id'], 'user_id' => $user_id), 'nocache' => true));
if (count($existing) !== 1) {
return self::abort('You are not a member of this group.', $args);
}
if (!empty($_POST['response']) && $_POST['response'] === lang::get('Cancel')) {
drupal_goto($args['groups_page_path']);
} elseif (!empty($_POST['response']) && $_POST['response'] === lang::get('Confirm')) {
$data = array('groups_user:id' => $existing[0]['id'], 'groups_user:group_id' => $group['id'], 'groups_user:user_id' => $user_id, 'deleted' => 't');
$wrap = submission_builder::wrap($data, 'groups_user');
$response = data_entry_helper::forward_post_to('groups_user', $wrap, $auth['write_tokens']);
if (isset($response['success'])) {
hostsite_show_message("You are no longer participating in {$group['title']}!");
drupal_goto($args['groups_page_path']);
} else {
return self::abort('An error occurred whilst trying to update your group membership.');
}
} else {
// First access of the form. Let's get confirmation
$reload = data_entry_helper::get_reload_link_parts();
$reloadpath = $reload['path'] . '?' . data_entry_helper::array_to_query_string($reload['params']);
$r = '<form action="' . $reloadpath . '" method="POST"><fieldset>';
$r .= '<legend>' . lang::get('Confirmation') . '</legend>';
$r .= '<input type="hidden" name="leave" value="1" />';
$r .= '<p>' . lang::get('Are you sure you want to stop participating in {1}?', $group['title']) . '</p>';
$r .= '<input type="submit" value="' . lang::get('Confirm') . '" name="response" />';
$r .= '<input type="submit" value="' . lang::get('Cancel') . '" name="response" />';
$r .= '</fieldset></form>';
}
return $r;
}
示例3: report_filter_panel
//.........这里部分代码省略.........
$def['taxon_group_names'][$group['id']] = $group['title'];
}
}
if ($survey_ids) {
$def['survey_list'] = implode(',', array_filter($survey_ids));
}
$contextDefs['default'] = $def;
}
}
}
if (!empty($_GET['context_id'])) {
$options['context_id'] = $_GET['context_id'];
}
if (!empty($_GET['filter_id'])) {
$options['filter_id'] = $_GET['filter_id'];
}
if (!empty($_GET['filters_user_id'])) {
$options['filters_user_id'] = $_GET['filters_user_id'];
}
foreach ($filterData as $filter) {
if ($filter['defines_permissions'] === 't') {
$selected = !empty($options['context_id']) && $options['context_id'] == $filter['id'] ? 'selected="selected" ' : '';
$contexts .= "<option value=\"{$filter['id']}\" {$selected}>{$filter['title']}</option>";
$contextDefs[$filter['id']] = json_decode($filter['definition']);
} else {
$selected = !empty($options['filter_id']) && $options['filter_id'] == $filter['id'] ? 'selected="selected" ' : '';
$existing .= "<option value=\"{$filter['id']}\" {$selected}>{$filter['title']}</option>";
}
}
$r = '<div id="standard-params" class="ui-widget">';
if ($options['allowSave'] && $options['admin']) {
if (empty($_GET['filters_user_id'])) {
// new filter to create, so sharing type can be edited
$reload = data_entry_helper::get_reload_link_parts();
$reloadPath = $reload['path'];
if (count($reload['params'])) {
$reloadPath .= '?' . data_entry_helper::array_to_query_string($reload['params']);
}
$r .= "<form action=\"{$reloadPath}\" method=\"post\" >";
$r .= data_entry_helper::select(array('label' => lang::get('Select filter type'), 'fieldname' => 'filter:sharing', 'lookupValues' => $options['adminCanSetSharingTo'], 'afterControl' => '<input type="submit" value="Go"/>', 'default' => $options['sharingCode']));
$r .= '</form>';
} else {
// existing filter to edit, type is therefore fixed. JS will fill these values in.
$r .= '<p>' . lang::get('This filter is for <span id="sharing-type-label"></span>.') . '</p>';
$r .= data_entry_helper::hidden_text(array('fieldname' => 'filter:sharing'));
}
}
if ($options['allowLoad']) {
$r .= '<div class="header ui-toolbar ui-widget-header ui-helper-clearfix"><div><span id="active-filter-label">' . lang::get('New report') . '</span></div><span class="changed" style="display:none" title="This filter has been changed">*</span>';
$r .= '<div>';
if ($contexts) {
data_entry_helper::$javascript .= "indiciaData.filterContextDefs = " . json_encode($contextDefs) . ";\n";
if (count($contextDefs) > 1) {
$r .= '<label for="context-filter">' . lang::get('Context:') . "</label><select id=\"context-filter\">{$contexts}</select>";
} else {
$keys = array_keys($contextDefs);
$r .= '<input type="hidden" id="context-filter" value="' . $keys[0] . '" />';
}
}
$r .= '<label for="select-filter">' . lang::get('Filter:') . '</label><select id="select-filter"><option value="" selected="selected">' . lang::get('Select filter') . "...</option>{$existing}</select>";
$r .= '<button type="button" id="filter-apply">' . lang::get('Apply') . '</button>';
$r .= '<button type="button" id="filter-reset" class="disabled">' . lang::get('Reset') . '</button>';
$r .= '<button type="button" id="filter-build">' . lang::get('Create a filter') . '</button></div>';
$r .= '</div>';
$r .= '<div id="filter-details" style="display: none">';
$r .= '<img src="' . data_entry_helper::$images_path . 'nuvola/close-22px.png" width="22" height="22" alt="Close filter builder" title="Close filter builder" class="button" id="filter-done"/>' . "\n";
示例4: 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)
{
// Do they have expert access?
$expert = function_exists('user_access') && user_access($args['permission']);
$conn = iform_get_connection_details($node);
$readAuth = data_entry_helper::get_read_auth($conn['website_id'], $conn['password']);
// Find out which types of filters and formats are available to the user
$filters = self::get_filters($args, $readAuth);
$formats = array();
if ($args['csv_format'] === 'yes' || $args['csv_format'] === 'expert' && $expert) {
$formats[] = 'csv';
}
if ($args['tsv_format'] === 'yes' || $args['tsv_format'] === 'expert' && $expert) {
$formats[] = 'tsv';
}
if ($args['kml_format'] === 'yes' || $args['kml_format'] === 'expert' && $expert) {
$formats[] = 'kml';
}
if ($args['gpx_format'] === 'yes' || $args['gpx_format'] === 'expert' && $expert) {
$formats[] = 'gpx';
}
if ($args['nbn_format'] === 'yes' || $args['nbn_format'] === 'expert' && $expert) {
$formats[] = 'nbn';
}
if (count($filters) === 0) {
return 'This download page is configured so that no filter options are available.';
}
if (count($formats) === 0) {
return 'This download page is configured so that no download format options are available.';
}
if (!empty($_POST)) {
self::do_download($args, $filters);
}
iform_load_helpers(array('data_entry_helper'));
$reload = data_entry_helper::get_reload_link_parts();
$reloadPath = $reload['path'];
if (count($reload['params'])) {
$reloadPath .= '?' . helper_base::array_to_query_string($reload['params']);
}
$r = '<form method="POST" action="' . $reloadPath . '">';
$r .= '<fieldset><legend>' . lang::get('Filters') . '</legend>';
if (count($filters) === 0) {
return 'This download page is configured so that no filter options are available.';
} elseif (count($filters) === 1) {
$r .= '<input type="hidden" name="user-filter" value="' . implode('', array_keys($filters)) . '"/>';
// Since there is only one option, we may as well tell the user what it is.
drupal_set_title(implode('', array_values($filters)));
if (implode('', array_keys($filters)) === 'mine') {
$r .= '<p>' . lang::get('Use this form to download your own records.') . '</p>';
}
} else {
$r .= data_entry_helper::radio_group(array('label' => lang::get('User filter'), 'fieldname' => 'user-filter', 'lookupValues' => $filters, 'default' => empty($_POST['user-filter']) ? 'mine' : $_POST['user-filter']));
}
if (empty($args['survey_id'])) {
// A survey picker when downloading my data
$r .= '<div id="survey_all">';
$r .= data_entry_helper::select(array('fieldname' => 'survey_id_all', 'label' => lang::get('Survey to include'), 'table' => 'survey', 'valueField' => 'id', 'captionField' => 'title', 'helpText' => 'Choose a survey, or <all> to not filter by survey.', 'blankText' => '<all>', 'class' => 'control-width-4', 'extraParams' => $readAuth + array('sharing' => 'data_flow', 'orderby' => 'title')));
$r .= '</div>';
// A survey picker when downloading data you are an expert for
$surveys_expertise = hostsite_get_user_field('surveys_expertise');
if ($surveys_expertise) {
$surveys_expertise = unserialize($surveys_expertise);
$surveysFilter = array('query' => json_encode(array('in' => array('id' => $surveys_expertise))));
} else {
// no filter as there are no specific surveys this user is an expert for
$surveysFilter = array();
}
$r .= '<div id="survey_expertise">';
$r .= data_entry_helper::select(array('fieldname' => 'survey_id_expert', 'label' => lang::get('Survey to include'), 'table' => 'survey', 'valueField' => 'id', 'captionField' => 'title', 'helpText' => 'Choose a survey, or <all> to not filter by survey.', 'blankText' => '<all>', 'class' => 'control-width-4', 'extraParams' => $readAuth + array('sharing' => 'verification', 'orderby' => 'title') + $surveysFilter));
$r .= '</div>';
}
// Let the user pick the date range to download.
$r .= data_entry_helper::date_picker(array('fieldname' => 'date_from', 'label' => lang::get('Start Date'), 'helpText' => 'Leave blank for no start date filter', 'class' => 'control-width-4'));
$r .= data_entry_helper::date_picker(array('fieldname' => 'date_to', 'label' => lang::get('End Date'), 'helpText' => 'Leave blank for no end date filter', 'class' => 'control-width-4'));
$r .= '</fieldset>';
$r .= '<fieldset><legend>' . lang::get('Downloads') . '</legend>';
$r .= '<label>Download options:</label>';
if (in_array('csv', $formats)) {
$r .= '<input class="inline-control" type="submit" name="format" value="' . lang::get('Spreadsheet (CSV)') . '"/>';
}
if (in_array('tsv', $formats)) {
$r .= '<input class="inline-control" type="submit" name="format" value="' . lang::get('Tab Separated File (TSV)') . '"/>';
}
if (in_array('kml', $formats)) {
$r .= '<input class="inline-control" type="submit" name="format" value="' . lang::get('Google Earth File') . '"/>';
}
if (in_array('gpx', $formats)) {
$r .= '<input class="inline-control" type="submit" name="format" value="' . lang::get('GPS Track File') . '"/>';
}
if (in_array('nbn', $formats)) {
$r .= '<input class="inline-control" type="submit" name="format" value="' . lang::get('NBN Format') . '"/>';
//.........这里部分代码省略.........
示例5: getReloadPath
/**
* Retrieve the path to the current page, so the form can submit to itself.
* @return string
*/
private static function getReloadPath()
{
$reload = data_entry_helper::get_reload_link_parts();
$reloadPath = $reload['path'];
if (count($reload['params'])) {
// decode params prior to encoding to prevent double encoding.
foreach ($reload['params'] as $key => $param) {
$reload['params'][$key] = urldecode($param);
}
$reloadPath .= '?' . http_build_query($reload['params']);
}
return $reloadPath;
}
示例6: get_occurrences_form
//.........这里部分代码省略.........
}
$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>';
}
$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>';
}
if (isset($args['taxon_list_id_3']) && $args['taxon_list_id_3'] != '') {
$r .= '<div id="grid3"><p id="grid3-loading">' . lang::get('Loading - Please Wait') . '</p><table id="observation-input3" 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>';
}
$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>';
}
if (isset($args['taxon_list_id_4']) && $args['taxon_list_id_4'] != '') {
$r .= '<div id="grid4"><p id="grid4-loading">' . lang::get('Loading - Please Wait') . '</p><table id="observation-input4" 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>';
}
$r .= '<td class="ui-state-disabled first"></td></tr></tfoot></table>';
$r .= '<label for="taxonLookupControl4" class="auto-width">' . lang::get('Add species to list') . ':</label> <input id="taxonLookupControl4" name="taxonLookupControl4" >';
$r .= '<br /><a href="' . $args['my_obs_page'] . '" class="button">' . lang::get('Finish') . '</a></div>';
}
// for the comment form, we want to ensure that if there is a timeout error that it reloads the
// data as stored in the DB.
$reload = data_entry_helper::get_reload_link_parts();
$reload['params']['sample_id'] = $parentSampleId;
unset($reload['params']['new']);
$reloadPath = $reload['path'];
if (count($reload['params'])) {
// decode params prior to encoding to prevent double encoding.
foreach ($reload['params'] as $key => $param) {
$reload['params'][$key] = urldecode($param);
}
$reloadPath .= '?' . http_build_query($reload['params']);
}
// fragment is always at the end. discard this.
$reloadPath = explode('#', $reloadPath, 2);
$reloadPath = $reloadPath[0];
$r .= "<div id=\"notes\"><form method=\"post\" id=\"notes_form\" action=\"" . $reloadPath . "#notes\">\n";
$r .= $auth['write'];
$r .= '<input type="hidden" name="sample:id" value="' . $sampleId . '" />' . '<input type="hidden" name="website_id" value="' . $args['website_id'] . '"/>' . '<input type="hidden" name="survey_id" value="' . $args['survey_id'] . '"/>' . '<input type="hidden" name="page" value="notes"/>';
$r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('When using this page, please remember that the data is not saved to the database as you go (which is the case for the previous tabs). In order to save the data entered in this page you must click on the Submit button at the bottom of the page.') . '</p>';
$r .= data_entry_helper::textarea(array('fieldname' => 'sample:comment', 'label' => lang::get('Notes'), 'helpText' => "Use this space to input comments about this week's walk."));
$r .= '<input type="submit" value="' . lang::get('Submit') . '" id="save-button"/></form>';
$r .= '<br /><a href="' . $args['my_walks_page'] . '" class="button">' . lang::get('Finish') . '</a></div></div>';
// enable validation on the comments form in order to include the simplified ajax queuing for the autocomplete.
data_entry_helper::enable_validation('notes_form');
// A stub form for AJAX posting when we need to create an occurrence
$r .= '<form style="display: none" id="occ-form" method="post" action="' . iform_ajaxproxy_url($node, 'occurrence') . '">';
$r .= '<input name="website_id" value="' . $args['website_id'] . '"/>';
$r .= '<input name="occurrence:id" id="occid" />';
$r .= '<input name="occurrence:taxa_taxon_list_id" id="ttlid" />';
$r .= '<input name="occurrence:sample_id" value="' . $sampleId . '"/>';
$r .= '<input name="occAttr:" id="occattr"/>';
$r .= '<input name="transaction_id" id="transaction_id"/>';
$r .= '<input name="user_id" value="' . hostsite_get_user_field('user_id', 1) . '"/>';
$r .= '</form>';
示例7: get_form
//.........这里部分代码省略.........
return $r;
}
// from this point on, we are MODE_EXISTING or MODE_NEW_SAMPLE
if ($mode == MODE_EXISTING && is_null(data_entry_helper::$entity_to_load)) {
// only load if not in error situation
// Displaying an existing sample. If we know the subject_observation ID, and don't know the sample ID
// then we must get the sample id from the subject_observation data.
if ($loadedSubjectObservationId && !$loadedSampleId) {
data_entry_helper::load_existing_record($auth['read'], 'subject_observation', $loadedSubjectObservationId);
$loadedSampleId = data_entry_helper::$entity_to_load['subject_observation:sample_id'];
}
data_entry_helper::$entity_to_load = self::reload_form_data($loadedSampleId, $args, $auth);
}
// get the sample attributes
$attrOpts = array('id' => data_entry_helper::$entity_to_load['sample:id'], 'valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => 'smpAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id']);
// select only the custom attributes that are for this sample method or all sample methods, if this
// form is for a specific sample method.
if (!empty($args['sample_method_id'])) {
$attrOpts['sample_method_id'] = $args['sample_method_id'];
}
$attributes = data_entry_helper::getAttributes($attrOpts, false);
// Check if Recorder details is included as a control.
// If so, remove the recorder attributes from the $attributes array so not output anywhere else.
$arr = helper_base::explode_lines($args['structure']);
if (in_array('[recorder details]', $arr)) {
$attrCount = count($attributes);
for ($i = 0; $i < $attrCount; $i++) {
if (strcasecmp($attributes[$i]['caption'], 'first name') === 0 || strcasecmp($attributes[$i]['caption'], 'last name') === 0 || strcasecmp($attributes[$i]['caption'], 'email') === 0) {
unset($attributes[$i]);
}
}
}
//// Make sure the form action points back to this page
$reload = data_entry_helper::get_reload_link_parts();
unset($reload['params']['sample_id']);
unset($reload['params']['subject_observation_id']);
unset($reload['params']['newSample']);
$reloadPath = $reload['path'];
// don't url-encode the drupal path id using dirty url
$pathParam = function_exists('variable_get') && variable_get('clean_url', 0) == '0' ? 'q' : '';
if (count($reload['params'])) {
if ($pathParam === 'q' && array_key_exists('q', $reload['params'])) {
$reloadPath .= '?q=' . $reload['params']['q'];
unset($reload['params']['q']);
if (count($reload['params'])) {
$reloadPath .= '&' . http_build_query($reload['params']);
}
} else {
$reloadPath .= '?' . http_build_query($reload['params']);
}
}
$r = "<form method=\"post\" id=\"entry_form\" action=\"{$reloadPath}\">\n";
// debug section
if (!empty($args['debug_info']) && $args['debug_info']) {
$r .= '<input type="button" value="Debug info" onclick="$(\'#debug-info-div\').slideToggle();" /><br />' . '<div id="debug-info-div" style="display: none;">';
$r .= '<p>$_GET is:<br /><pre>' . print_r($_GET, true) . '</pre></p>';
$r .= '<p>$_POST is:<br /><pre>' . print_r($_POST, true) . '</pre></p>';
$r .= '<p>Entity to load is:<br /><pre>' . print_r(data_entry_helper::$entity_to_load, true) . '</pre></p>';
$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\');">';
示例8: get_form
//.........这里部分代码省略.........
// 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));
// Put in a blank form, which lets JavaScript set the values and post the data.
$r .= '
<form id="verify" method="post" action="">
' . $auth['write'] . '
<input type="hidden" id="occurrence:id" name="occurrence:id" value="" />
<input type="hidden" id="occurrence:record_status" name="occurrence:record_status" value="" />
<input type="hidden" id="occurrence_comment:comment" name="occurrence_comment:comment" value="" />
<input type="hidden" name="occurrence_comment:created_by_id" value="' . $indicia_user_id . '" />
<input type="hidden" id="website_id" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" id="occurrence:verified_by_id" name="occurrence:verified_by_id" value="" />
</form>
';
drupal_add_js('
var indicia_user_id = ' . $indicia_user_id . ';
var url = ' . json_encode(data_entry_helper::get_reload_link_parts()) . ';
var svc = "' . data_entry_helper::$base_url . 'index.php/services/data/";
var email_subject_send_to_verifier = "' . $args['email_subject_send_to_verifier'] . '";
var email_body_send_to_verifier = "' . str_replace(array("\r", "\n"), array('', '\\n'), $args['email_body_send_to_verifier']) . '";
', 'inline');
/*.';
');*/
return $r;
}
示例9: upload_mappings_form
/**
* Outputs the form for mapping columns to the import fields.
* @param array $options Options array passed to the import control.
*/
private static function upload_mappings_form($options)
{
//The Shorewatch importer only supports 4326 as this is required for the occurrence sample grid reference
//calculations to work. This can be hardcoded.
$_POST['sample:entered_sref_system'] = 4326;
$_SESSION['importSettingsToCarryForward'] = $_POST;
if (!file_exists($_SESSION['uploaded_file'])) {
return lang::get('upload_not_available');
}
data_entry_helper::add_resource('jquery_ui');
$filename = basename($_SESSION['uploaded_file']);
// If the last step was skipped because the user did not have any settings to supply, presetSettings contains the presets.
// Otherwise we'll use the settings form content which already in $_POST so will overwrite presetSettings.
if (isset($options['presetSettings'])) {
$settings = array_merge($options['presetSettings'], $_POST);
} else {
$settings = $_POST;
}
// only want defaults that actually have a value - others can be set on a per-row basis by mapping to a column
foreach ($settings as $key => $value) {
if (empty($value)) {
unset($settings[$key]);
}
}
//The Shorewatch importer only supports 4326 as this is required for the occurrence sample grid reference
//calculations to work. This can be hardcoded.
$settings['sample:entered_sref_system'] = 4326;
// cache the mappings
$metadata = array('settings' => json_encode($settings));
$post = array_merge($options['auth']['write_tokens'], $metadata);
$request = data_entry_helper::$base_url . "index.php/services/import/cache_upload_metadata?uploaded_csv={$filename}";
$response = data_entry_helper::http_post($request, $post);
if (!isset($response['output']) || $response['output'] != 'OK') {
return "Could not upload the settings metadata. <br/>" . print_r($response, true);
}
$request = data_entry_helper::$base_url . "index.php/services/import/get_import_fields/" . $options['model'];
$request .= '?' . data_entry_helper::array_to_query_string($options['auth']['read']);
// include survey and website information in the request if available, as this limits the availability of custom attributes
if (!empty($settings['website_id'])) {
$request .= '&website_id=' . trim($settings['website_id']);
}
if (!empty($settings['survey_id'])) {
$request .= '&survey_id=' . trim($settings['survey_id']);
}
$response = data_entry_helper::http_post($request, array());
$fields = json_decode($response['output'], true);
if (!is_array($fields)) {
return "curl request to {$request} failed. Response " . print_r($response, true);
}
$request = str_replace('get_import_fields', 'get_required_fields', $request);
$response = data_entry_helper::http_post($request);
$responseIds = json_decode($response['output'], true);
if (!is_array($responseIds)) {
return "curl request to {$request} failed. Response " . print_r($response, true);
}
$model_required_fields = self::expand_ids_to_fks($responseIds);
if (!empty($settings)) {
$preset_fields = self::expand_ids_to_fks(array_keys($settings));
} else {
$preset_fields = array();
}
if (!empty($preset_fields)) {
$unlinked_fields = array_diff_key($fields, array_combine($preset_fields, $preset_fields));
} else {
$unlinked_fields = $fields;
}
// only use the required fields that are available for selection - the rest are handled somehow else
$unlinked_required_fields = array_intersect($model_required_fields, array_keys($unlinked_fields));
ini_set('auto_detect_line_endings', 1);
$handle = fopen($_SESSION['uploaded_file'], "r");
$columns = fgetcsv($handle, 1000, ",");
$reload = data_entry_helper::get_reload_link_parts();
$reloadpath = $reload['path'] . '?' . data_entry_helper::array_to_query_string($reload['params']);
self::clear_website_survey_fields($unlinked_fields, $settings);
self::clear_website_survey_fields($unlinked_required_fields, $settings);
$savedFieldMappings = array();
// Note the Shorewatch importer doesn't currently support remembered fields, so set this to false (we are reusing a lot of the import_helper code, so leave the variable in the code as it already has proven reliability).
self::$rememberingMappings = false;
// if the user checked the Remember All checkbox, save it in a variable
if (isset($savedFieldMappings['RememberAll'])) {
$checked['RememberAll'] = 'checked';
}
$r = "<form method=\"post\" id=\"entry_form\" action=\"{$reloadpath}\" class=\"iform\">\n" . '<p>' . lang::get('column_mapping_instructions') . '</p>' . '<div class="ui-helper-clearfix import-mappings-table"><table class="ui-widget ui-widget-content">' . '<thead class="ui-widget-header">' . "<tr><th>Column in CSV File</th><th>Maps to attribute</th>";
if (self::$rememberingMappings) {
$r .= "<th id='remember-all-header' name='remember-all-header'>" . lang::get('Remember choice?') . "<br/><input type='checkbox' name='RememberAll' id='RememberAll' value='1' title='Tick all boxes to remember every column mapping next time you import.' {$checked['RememberAll']} onclick='\n if (this.checked) {\n \$(\".rememberField\").attr(\"checked\",\"checked\")\n } else {\n \$(\".rememberField\").removeAttr(\"checked\")\n }'/></th>";
}
$r .= '</tr></thead><tbody>';
foreach ($columns as $column) {
$colFieldName = preg_replace('/[^A-Za-z0-9]/', '_', $column);
$r .= "<tr><td>{$column}</td><td><select name=\"{$colFieldName}\" id=\"{$colFieldName}\">";
$r .= self::get_column_options($options['model'], $unlinked_fields, $column, ' ', $savedFieldMappings);
$r .= "</select></td></tr>\n";
}
$r .= '</tbody>';
$r .= '</table>';
$r .= '<div id="required-instructions" class="import-mappings-instructions"><h2>' . lang::get('Tasks') . '</h2><span>' . lang::get('The following database attributes must be matched to a column in your import file before you can continue') . ':</span><ul></ul><br/></div>';
//.........这里部分代码省略.........
示例10: 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 $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)
{
drupal_add_js(iform_client_helpers_path() . "prebuilt_forms/js/easy_download_2.js");
drupal_add_css(iform_client_helpers_path() . "prebuilt_forms/css/easy_download_2.css");
$conn = iform_get_connection_details($nid);
$args = array_merge(array('download_administered_groups' => 'indicia data admin', 'download_group_types' => ''), $args);
$readAuth = data_entry_helper::get_read_auth($conn['website_id'], $conn['password']);
if (data_entry_helper::$js_read_tokens === null) {
data_entry_helper::$js_read_tokens = $readAuth;
}
if (!empty($_POST) && !empty($_POST['format'])) {
self::do_data_services_download($args, $nid);
}
$types = self::get_download_types($args);
$formats = self::get_download_formats($args);
if (count($types) === 0) {
return 'This download page is configured so that no download type options are available.';
}
if (count($formats) === 0) {
return 'This download page is configured so that no download format options are available.';
}
$reload = data_entry_helper::get_reload_link_parts();
$reloadPath = $reload['path'];
if (count($reload['params'])) {
$reloadPath .= '?' . helper_base::array_to_query_string($reload['params']);
}
$r = '<form method="POST" action="' . $reloadPath . '">';
$r .= '<fieldset id="download-type-fieldset"><legend>' . lang::get('Records to download') . '</legend>';
if (count($types) === 1) {
$r .= '<input type="hidden" name="download-type" id="download-type" value="' . implode('', array_keys($types)) . '"/>';
hostsite_set_page_title(lang::get('Download {1}', strtolower(implode('', $types))));
} else {
$r .= data_entry_helper::select(array('fieldname' => 'download-type', 'label' => lang::get('Download type'), 'lookupValues' => $types, 'class' => 'control-width-5', 'helpText' => 'Select the type of download you require, i.e. the purpose for the data. This defines which records are available to download.'));
}
$r .= data_entry_helper::select(array('fieldname' => 'download-subfilter', 'label' => lang::get('Filter to apply'), 'lookupValues' => array(), 'class' => 'control-width-5', 'helpText' => lang::get('Optionally select from the available filters. Filters you create on the Explore pages will be available here.')));
$r .= "</fieldset>\n";
$r .= '<fieldset><legend>' . lang::get('Limit the records') . '</legend>';
// Hub
// TODO may run into URL size limits
$vocabulary = taxonomy_vocabulary_machine_name_load('hubs');
$terms = entity_load('taxonomy_term', FALSE, array('vid' => $vocabulary->vid));
// the hub is driven by a user field, stored as tid.
$hubList = array('' => lang::get('<All>'));
foreach ($terms as $term) {
// TODO Cache
$query = new EntityFieldQuery();
$query->entityCondition('entity_type', 'user')->fieldCondition('field_preferred_training_hub', 'tid', $term->tid);
$result = $query->execute();
// This gives us the list of users which are in the hub: CMS user ID: now convert to indicia user id
$userIDList = array();
if (count($result) > 0) {
$cmsUserIDs = array_keys($result['user']);
foreach ($cmsUserIDs as $cmsUserID) {
$user_data = user_load($cmsUserID);
// TODO Making assumption about language
if (!empty($user_data->field_indicia_user_id['und'][0]['value'])) {
$userIDList[] = $user_data->field_indicia_user_id['und'][0]['value'];
}
}
if (count($userIDList) > 0) {
$hubList[implode(',', $userIDList)] = $term->tid . ' ' . $term->name;
}
}
}
$r .= data_entry_helper::select(array('fieldname' => 'user_id_list', 'label' => lang::get('Hub to include'), 'helpText' => 'Choose a Hub, or <All> to not filter by Hub. This is driven off the users currently allocated to the hub. This currently does not apply to the NBN download.', 'lookupValues' => $hubList, 'class' => 'control-width-5'));
// End Cocoast Hub
if (empty($args['survey_id'])) {
// put up an empty surveys drop down. AJAX will populate it.
$r .= data_entry_helper::select(array('fieldname' => 'survey_id', 'label' => lang::get('Survey to include'), 'helpText' => 'Choose a survey, or <All> to not filter by survey.', 'lookupValues' => array(), 'class' => 'control-width-5'));
} else {
$r .= '<input type="hidden" name="survey_id" value="' . $args['survey_id'] . '"/>';
}
// Let the user pick the date range to download.
$r .= data_entry_helper::select(array('label' => lang::get('Date field'), 'fieldname' => 'date_type', 'lookupValues' => array('recorded' => lang::get('Field record date'), 'input' => lang::get('Input date'), 'edited' => lang::get('Last changed date'), 'verified' => 'Verification status change date'), 'helpText' => 'If filtering on date, which date field would you like to filter on?'));
$r .= data_entry_helper::date_picker(array('fieldname' => 'date_from', 'label' => lang::get('Start Date'), 'helpText' => 'Leave blank for no start date filter', 'class' => 'control-width-4'));
$r .= data_entry_helper::date_picker(array('fieldname' => 'date_to', 'label' => lang::get('End Date'), 'helpText' => 'Leave blank for no end date filter', 'class' => 'control-width-4'));
$r .= '</fieldset>';
if (!empty($args['custom_formats'])) {
$customFormats = json_decode($args['custom_formats'], true);
foreach ($customFormats as $idx => $format) {
if (empty($format['permission']) || hostsite_user_has_permission($format['permission'])) {
$formats["custom-{$idx}"] = lang::get(isset($format['title']) ? $format['title'] : 'Untitled format');
}
}
}
if (count($formats) > 1) {
$r .= '<fieldset><legend>' . lang::get('Select a format to download') . '</legend>';
$keys = array_keys($formats);
$r .= data_entry_helper::radio_group(array('fieldname' => 'format', 'lookupValues' => $formats, 'default' => $keys[0]));
$r .= '</fieldset>';
} else {
//.........这里部分代码省略.........
示例11: get_control_customJS
/**
* Insert any custom JS for this form: this may be related to attributes, which are included
* as part of inherited generic code.
* Does not include any HTML.
*/
protected static function get_control_customJS($auth, $args, $tabalias, $options)
{
$reload = data_entry_helper::get_reload_link_parts();
$reloadPath = $reload['path'];
if (lang::get('validation_required') != 'validation_required') {
data_entry_helper::$late_javascript .= "\n\$.validator.messages.required = \"" . lang::get('validation_required') . "\";";
}
if (lang::get('validation_max') != 'validation_max') {
data_entry_helper::$late_javascript .= "\n\$.validator.messages.max = \$.validator.format(\"" . lang::get('validation_max') . "\");";
}
if (lang::get('validation_min') != 'validation_min') {
data_entry_helper::$late_javascript .= "\n\$.validator.messages.min = \$.validator.format(\"" . lang::get('validation_min') . "\");";
}
if (lang::get('validation_number') != 'validation_number') {
data_entry_helper::$late_javascript .= "\n\$.validator.messages.number = \$.validator.format(\"" . lang::get('validation_number') . "\");";
}
if (lang::get('validation_digits') != 'validation_digits') {
data_entry_helper::$late_javascript .= "\n\$.validator.messages.digits = \$.validator.format(\"" . lang::get('validation_digits') . "\");";
}
$numRows = 3;
$numCols = 1;
$startPos = 2;
data_entry_helper::$javascript .= "\njQuery('<div class=\"ui-widget-content ui-state-default ui-corner-all indicia-button tab-cancel\"><span><a href=\"" . $reloadPath . "\">" . lang::get('LANG_Cancel') . "</a></span></div>').appendTo('.buttons');\n\ncheckRadioStatus = function(){\n jQuery('[name^=locAttr]').filter(':radio').filter('[value=" . $args['siteTypeOtherTermID'] . "]').each(function(){\n if(this.checked)\n jQuery('[name=locAttr\\:" . $args['siteTypeOtherAttrID'] . "],[name^=locAttr\\:" . $args['siteTypeOtherAttrID'] . "\\:]').addClass('required').removeAttr('readonly');\n else\n jQuery('[name=locAttr\\:" . $args['siteTypeOtherAttrID'] . "],[name^=locAttr\\:" . $args['siteTypeOtherAttrID'] . "\\:]').removeClass('required').val('').attr('readonly',true);\n });\n};\njQuery('[name^=locAttr]').filter(':radio').change(checkRadioStatus);\ncheckRadioStatus();\n\nvar other = jQuery('[name=locAttr\\:" . $args['siteTypeOtherAttrID'] . "],[name^=locAttr\\:" . $args['siteTypeOtherAttrID'] . "\\:]');\nother.next().remove(); // remove break\nother.prev().remove(); // remove legend\nother.remove(); // remove Other field, then bolt in after the other radio button.\njQuery('[name^=locAttr]').filter(':radio').filter('[value=" . $args['siteTypeOtherTermID'] . "]').parent().append(other);\n\nvar other = jQuery('[name=smpAttr\\:" . $args['entranceDefectiveCommentAttrID'] . "],[name^=smpAttr\\:" . $args['entranceDefectiveCommentAttrID'] . "\\:]');\nother.next().remove(); // remove break\nother.prev().remove(); // remove legend\nother.remove(); // remove Other field, then bolt in after the other radio button.\njQuery('[name^=smpAttr]').filter(':checkbox').filter('[value=" . $args['entranceDefectiveTermID'] . "]').parent().append(other);\n\nvar other = jQuery('[name=smpAttr\\:" . $args['disturbanceCommentAttrID'] . "],[name^=smpAttr\\:" . $args['disturbanceCommentAttrID'] . "\\:]');\nother.next().remove(); // remove break\nother.prev().remove(); // remove legend\nother.remove(); // remove Other field, then bolt in after the other radio button.\njQuery('[name^=smpAttr]').filter(':checkbox').filter('[value=" . $args['disturbanceOtherTermID'] . "]').parent().append(other);\n\ncheckCheckStatus = function(){\n jQuery('[name^=smpAttr]').filter(':checkbox').filter('[value=" . $args['entranceDefectiveTermID'] . "]').each(function(){\n if(this.checked) // note not setting the required flag.\n jQuery('[name=smpAttr\\:" . $args['entranceDefectiveCommentAttrID'] . "],[name^=smpAttr\\:" . $args['entranceDefectiveCommentAttrID'] . "\\:]').removeAttr('readonly');\n else\n jQuery('[name=smpAttr\\:" . $args['entranceDefectiveCommentAttrID'] . "],[name^=smpAttr\\:" . $args['entranceDefectiveCommentAttrID'] . "\\:]').val('').attr('readonly',true);\n });\n jQuery('[name^=smpAttr]').filter(':checkbox').filter('[value=" . $args['disturbanceOtherTermID'] . "]').each(function(){\n if(this.checked)\n jQuery('[name=smpAttr\\:" . $args['disturbanceCommentAttrID'] . "],[name^=smpAttr\\:" . $args['disturbanceCommentAttrID'] . "\\:]').addClass('required').removeAttr('readonly');\n else\n jQuery('[name=smpAttr\\:" . $args['disturbanceCommentAttrID'] . "],[name^=smpAttr\\:" . $args['disturbanceCommentAttrID'] . "\\:]').removeClass('required').val('').attr('readonly',true);\n });\n };\njQuery('[name^=smpAttr]').filter(':checkbox').change(checkCheckStatus);\ncheckCheckStatus();\n\n// Two aspects: need to find scClonableRow, and then do existing rows in grid, and clear row being added.\nvar occAttrs = jQuery('.scClonableRow').find('.scOccAttrCell');\nvar newTable = jQuery('<table class=\"fullWidth\">');\nvar newElem = jQuery('<td class=\"noPadding\" >').append(newTable).insertBefore(occAttrs.filter(':first'));\nfor (var i=0;i<{$numRows};i++){\n\tswitch(i){";
for ($i = 0; $i < $numRows; $i++) {
data_entry_helper::$javascript .= "\n\t\tcase({$i}): jQuery(\"<tr><td class='scOccAttrCell ui-widget-content'>" . lang::get('SCLabel_Row' . ($i + 1)) . "</td></tr>\").appendTo(newTable); break;";
}
data_entry_helper::$javascript .= "\n\t}\n}\n// TBD\noccAttrs.find('input').filter(':text').addClass('digits').attr('min',1);\nfor (var i=0;i<occAttrs.length;i++){\n\tif(i%{$numRows} == 0){\n\t\tnewTable = jQuery('<table class=\"fullWidth\">');\n\t\tnewElem = jQuery('<td class=\"noPadding\">').append(newTable).insertAfter(newElem);\n\t}\n\tjQuery('<tr>').append(occAttrs[i]).appendTo(newTable);\n}\nvar CRgroup = jQuery('.scClonableRow').find('table').find('td');\n// Do main table header\noccAttrs = jQuery('.species-grid > thead').find('th');\nvar newElem = jQuery('<th>').insertBefore(occAttrs.filter(':eq({$startPos})'));\nfor (var i=0;i<{$numRows}*{$numCols};i++){\n\tjQuery(occAttrs[i+{$startPos}]).remove();\n}\nfor (var i=0;i<{$numCols};i++){\n\tswitch(i){";
for ($i = 0; $i < $numCols; $i++) {
data_entry_helper::$javascript .= "\n\t\tcase({$i}): newElem = jQuery(\"<th>" . lang::get('SCLabel_Col' . ($i + 1)) . "</th>\").insertAfter(newElem); break;";
}
data_entry_helper::$javascript .= "\n\t}\n}\n// Main table existing entries\nspeciesRows = jQuery('.species-grid > tbody').find('tr');\nfor(var j=0; j<speciesRows.length; j++){\n\toccAttrs = jQuery(speciesRows[j]).find('.scOccAttrCell');\n\tnewTable = jQuery('<table class=\"fullWidth\">');\n\tnewElem = jQuery('<td class=\"noPadding\" >').append(newTable).insertBefore(occAttrs.filter(':first'));\n\tfor (var i=0;i<{$numRows};i++){\n\t\tswitch(i){";
for ($i = 0; $i < $numRows; $i++) {
data_entry_helper::$javascript .= "\n\t\t\tcase({$i}): jQuery(\"<tr><td class='scOccAttrCell ui-widget-content'>" . lang::get('SCLabel_Row' . ($i + 1)) . "</td></tr>\").appendTo(newTable); break;";
}
data_entry_helper::$javascript .= "\n\t\t}\n\t}\n\toccAttrs.find('input').filter(':text').addClass('digits').attr('min',1);\n\tfor (var i=0;i<occAttrs.length;i++){\n\t\tif(i%{$numRows} == 0){\n\t\t\tnewTable = jQuery('<table class=\"fullWidth\">');\n\t\t\tnewElem = jQuery('<td class=\"noPadding\" >').append(newTable).insertAfter(newElem);\n\t\t}\n\t\tjQuery('<tr>').append(occAttrs[i]).appendTo(newTable);\n\t}\n\tvar group = jQuery(speciesRows[j]).find('table').find('td');\n\tvar tallest = 0;\n\tgroup.each(function(){ tallest = Math.max(\$(this).outerHeight(), tallest); });\n\tgroup.each(function(){ \n\t\t\$(this).height(tallest); });\n\tCRgroup.each(function(){ \n\t\t\$(this).height(tallest); });\n}\n";
if (isset($args['col_widths']) && $args['col_widths']) {
$colWidths = explode(',', $args['col_widths']);
for ($i = 0; $i < count($colWidths); $i++) {
data_entry_helper::$javascript .= "\njQuery('.species-grid > thead').find('th').filter(':eq(" . $i . ")').width('";
if ($colWidths[$i] == '') {
data_entry_helper::$javascript .= "auto');";
} else {
data_entry_helper::$javascript .= $colWidths[$i] . "%');";
}
}
}
// Move the Temperature and Humidity fields side by side.
$removeBreakIDs = explode(';', $args['removeBreakIDs']);
foreach ($removeBreakIDs as $removeBreakID) {
$removeBreakID = str_replace(':', '\\:', $removeBreakID);
data_entry_helper::$javascript .= "\njQuery('[name=" . $removeBreakID . "],[name^=" . $removeBreakID . "\\:]').css('margin-right', '20px').nextAll('br').eq(0).remove();";
}
if (!empty($args['attributeValidation'])) {
$rules = array();
$argRules = explode(';', $args['attributeValidation']);
foreach ($argRules as $rule) {
$rules[] = explode(',', $rule);
}
foreach ($rules as $rule) {
// But only do if a parameter given as rule:param - eg min:-40
for ($i = 1; $i < count($rule); $i++) {
if (strpos($rule[$i], ':') !== false) {
$details = explode(':', $rule[$i]);
data_entry_helper::$late_javascript .= "\njQuery('[name=" . str_replace(':', '\\:', $rule[0]) . "],[name^=" . str_replace(':', '\\:', $rule[0]) . "\\:]').attr('" . $details[0] . "'," . $details[1] . ");";
} else {
if ($rule[$i] == 'no_observation') {
data_entry_helper::$late_javascript .= "\njQuery('[name=" . str_replace(':', '\\:', $rule[0]) . "],[name^=" . str_replace(':', '\\:', $rule[0]) . "\\:]').filter(':checkbox').rules('add', {no_observation: true});\nhook_species_checklist_delete_row=function() {\n var rows=jQuery('.species-grid > tbody > tr').not(':hidden').not('.scClonableRow').length;\n if(rows==0)\n jQuery('[name=" . str_replace(':', '\\:', $rule[0]) . "],[name^=" . str_replace(':', '\\:', $rule[0]) . "\\:]').removeAttr('disabled');\n else\n jQuery('[name=" . str_replace(':', '\\:', $rule[0]) . "],[name^=" . str_replace(':', '\\:', $rule[0]) . "\\:]').attr('disabled','disabled').removeAttr('checked');\n};\nhook_species_checklist_pre_delete_row=function(e) {\n return confirm(\"" . lang::get('Are you sure you want to delete this row?') . "\");\n};\n// possible clash with link_species_popups, so latter disabled.\nhook_species_checklist_new_row=function(rowData) {\n jQuery.getJSON('" . data_entry_helper::$base_url . "/index.php/services/data/taxa_taxon_list/' + rowData.id +\n '?mode=json&view=detail&auth_token=" . $auth['read']['auth_token'] . "&nonce=" . $auth['read']["nonce"] . "&callback=?', function(mdata) {\n if(mdata instanceof Array && mdata.length>0){\n jQuery.getJSON('" . data_entry_helper::$base_url . "/index.php/services/data/taxa_taxon_list' +\n '?mode=json&view=detail&auth_token=" . $auth['read']['auth_token'] . "&nonce=" . $auth['read']["nonce"] . "&taxon_meaning_id='+mdata[0].taxon_meaning_id+'&callback=?', function(data) {\n var taxaList = '';\n var duplicate=false;\n if(data instanceof Array && data.length>0){\n for (var i=0;i<data.length;i++){\n if(data[i].id != mdata[0].id){\n if(data[i].preferred == 'f')\n taxaList += (taxaList == '' ? '' : ', ')+data[i].taxon;\n else\n taxaList = '<em>'+data[i].taxon+'</em>'+(taxaList == '' ? '' : ', '+taxaList);\n if(jQuery('[name^=sc\\:'+data[i].id+'\\:]').length > 0)\n duplicate=true;\n } else\n if(jQuery('[name^=sc\\:'+data[i].id+'\\:]').length > 8)\n duplicate=true;\n }\n if(duplicate){\n alert(\"" . lang::get('LANG_Duplicate_Taxon') . "\");\n jQuery('.extraCommonNames').filter('[tID='+mdata[0].id+']').closest('tr').remove();\n } else\n jQuery('.extraCommonNames').filter('[tID='+mdata[0].id+']').append(' - '+taxaList).removeClass('extraCommonNames');\n }\n });\n }})\n hook_species_checklist_delete_row();\n}\nhook_species_checklist_delete_row();\n\$.validator.addMethod('no_observation', function(arg1, arg2){\nvar numChecked = jQuery('[name^=sc]').not(':hidden').not('[name^=sc\\:-ttlId-]').filter(':radio').filter('[checked=true]').length;\nvar numFilledIn = jQuery('[name^=sc]').not(':hidden').not('[name^=sc\\:-ttlId-]').not(':radio').filter('[value!=]').length;\nif(jQuery('[name='+jQuery(arg2).attr('name')+']').not(':hidden').filter('[checked=true]').length>0)\n // is checked.\n return(numChecked==0&&numFilledIn==0)\nelse if(numChecked>0||numFilledIn>0)\n return true;\n// there are no rows filled in, in which case ensure no obs can be filled in.\njQuery('[name=" . str_replace(':', '\\:', $rule[0]) . "],[name^=" . str_replace(':', '\\:', $rule[0]) . "\\:]').removeAttr('disabled','disabled');\nreturn false;\n},\n \"" . lang::get('validation_no_observation') . "\");\n ";
} else {
if (substr($rule[0], 3, 4) != 'Attr') {
// have to add for non attribute case.
data_entry_helper::$late_javascript .= "\njQuery('[name=" . str_replace(':', '\\:', $rule[0]) . "],[name^=" . str_replace(':', '\\:', $rule[0]) . "\\:]').addClass('" . $rule[$i] . "');";
}
}
}
}
}
}
if (array_key_exists('sample:id', data_entry_helper::$entity_to_load)) {
data_entry_helper::$late_javascript .= "\nsetupButtons(\$('#controls'), 1);\nsetupButtons(\$('#controls'), 2);\nsetupButtons(\$('#controls'), 0);";
}
return '';
}
示例12: get_form
/**
* Return the Indicia form code
* @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)
{
$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['occurrence:record_status']) && isset($response['success']) && $args['emails_enabled']) {
// Provide a send email form to allow the user to send a verification email
if ($_POST['occurrence:record_status'] == 'V') {
$action = 'verified';
} elseif ($_POST['occurrence:record_status'] == 'R') {
$action = 'rejected';
} else {
$action = '';
}
if ($action) {
$occ = data_entry_helper::get_population_data(array('table' => 'occurrence', 'extraParams' => $auth['read'] + array('id' => $response['outer_id'], 'view' => 'detail')));
$email_attr = data_entry_helper::get_population_data(array('table' => 'sample_attribute_value', 'extraParams' => $auth['read'] + array('caption' => 'Email', 'sample_id' => $occ[0]['sample_id'])));
$subject = self::get_email_component('subject', $action, $occ[0], $args);
$body = self::get_email_component('body', $action, $occ[0], $args);
if (!empty($email_attr[0]['value'])) {
$r .= '
<form id="email-form" action="mailto:' . $email_attr[0]['value'] . '?subject=' . $subject . '&body=' . $body . '" method="post" enctype="text/plain">
<fieldset>
<legend>Send a notification email to the recorder.</legend>
<input type="submit" value="Send Email">
</fieldset>
</form>
';
} else {
$r .= '<div class="page-notice ui-state-highlight ui-corner-all">The record has been ' . $action . '. The recorder did not leave an email address so cannot be notified.</div>';
}
}
}
}
}
global $user;
$r .= data_entry_helper::report_grid(array('id' => 'verification-grid', 'dataSource' => $args['report_name'], 'mode' => 'report', 'readAuth' => $auth['read'], 'columns' => array(array('display' => 'Actions', 'actions' => array(array('caption' => 'Verify', 'javascript' => 'indicia_verify(\'{taxon}\', {occurrence_id}, true, ' . $user->uid . '); return false;'), array('caption' => 'Reject', 'javascript' => 'indicia_verify(\'{taxon}\', {occurrence_id}, false, ' . $user->uid . '); return false;')))), 'itemsPerPage' => 10, 'autoParamsForm' => $args['auto_params_form'], 'extraParams' => array()));
$r .= '
<form id="verify" method="post" action="">
' . $auth['write'] . '
<input type="hidden" id="occurrence:id" name="occurrence:id" value="" />
<input type="hidden" id="occurrence:record_status" name="occurrence:record_status" value="" />
<input type="hidden" id="website7_id" name="website_id" value="' . $args['website_id'] . '" />
<input type="hidden" id="occurrence:verified_by_id" name="occurrence:verified_by_id" value="" />
</form>
';
drupal_add_js('
var verifiers_mapping = "' . $args['verifiers_mapping'] . '";
var url = ' . json_encode(data_entry_helper::get_reload_link_parts()) . ';
function indicia_verify(taxon, id, valid, cmsUser){
var action;
if (valid) {
$("#occurrence\\\\:record_status").attr("value", "V");
action = "verify";
} else {
$("#occurrence\\\\:record_status").attr("value", "R");
action = "reject";
}
if (confirm("Are you sure you want to " + action + " this record of " + taxon + "?")) {
$("#occurrence\\\\:id").attr(\'value\', id);
if (verifiers_mapping.indexOf("=")==-1) {
verifier = verifiers_mapping;
} else {
var verifierMaps = verifiers_mapping.split(",");
var keyval, verifiersArr = new Array();
$.each(verifierMaps, function(idx, map) {
keyval = map.split("=");
if (parseInt(keyval[0].trim())==cmsUser) {
verifier = keyval[1].trim();
}
});
}
$("#occurrence\\\\:verified_by_id").attr(\'value\', verifier);
// We need to dynamically build the submitTo so we get the correct sort order
var submitTo = "";
// access globals created by the report grid to get the current state of pagination and sort as a result of AJAX calls
url.params["page-verification-grid"] = report_grid_page;
if (report_grid_orderby!="") {
url.params["orderby-verification-grid"] = report_grid_orderby;
} else {
delete url.params["orderby-verification-grid"];
}
if (report_grid_sortdir!="") {
url.params["sortdir-verification-grid"] = report_grid_sortdir;
} else {
delete url.params["sortdir-verification-grid"]
}
$.each(url.params, function(field, value) {
submitTo += (submitTo ==="" ? "?" : "&");
//.........这里部分代码省略.........
示例13: 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)
{
if (isset($_POST['enable'])) {
module_enable(array('iform_ajaxproxy'));
drupal_set_message(lang::get('The Indicia AJAX Proxy module has been enabled.', 'info'));
} elseif (!defined('IFORM_AJAXPROXY_PATH')) {
$r = '<p>' . lang::get('The Indicia AJAX Proxy module must be enabled to use this form. This lets the form save verifications to the ' . 'Indicia Warehouse without having to reload the page.') . '</p>';
$r .= '<form method="post">';
$r .= '<input type="hidden" name="enable" value="t"/>';
$r .= '<input type="submit" value="' . lang::get('Enable Indicia AJAX Proxy') . '"/>';
$r .= '</form>';
return $r;
}
if (function_exists('drupal_add_js')) {
drupal_add_js('misc/collapse.js');
}
iform_load_helpers(array('data_entry_helper', 'map_helper'));
// fancybox for popup comment forms etc
data_entry_helper::add_resource('fancybox');
data_entry_helper::add_resource('validation');
global $user, $indicia_templates;
$indicia_user_id = self::get_indicia_user_id($args);
$auth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
//extract fixed parameters for report grid.
$params = explode("\n", $args['param_presets']);
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;
}
$opts = array('id' => 'verification-grid', 'dataSource' => $args['report_name'], 'mode' => 'report', 'readAuth' => $auth, 'rowId' => 'occurrence_id', 'itemsPerPage' => 10, 'autoParamsForm' => true, 'extraParams' => $extraParams, 'paramDefaults' => $paramDefaults, 'fieldsetClass' => 'collapsible collapsed');
if (!empty($args['columns_config'])) {
$opts['columns'] = json_decode($args['columns_config'], true);
}
$grid = data_entry_helper::report_grid($opts);
$r = str_replace(array('{grid}'), array($grid), self::get_template_grid_left($args, $auth));
$link = data_entry_helper::get_reload_link_parts();
global $user;
data_entry_helper::$javascript .= 'indiciaData.username = "' . $user->name . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.rootUrl = "' . $link['path'] . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.website_id = ' . $args['website_id'] . ";\n";
data_entry_helper::$javascript .= 'indiciaData.ajaxFormPostUrl="' . iform_ajaxproxy_url($node, 'occurrence') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.ajaxUrl="' . url('iform/ajax/verification_3') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.autoDiscard = ' . $args['auto_discard_rows'] . ";\n";
// output some translations for JS to use
data_entry_helper::$javascript .= "indiciaData.popupTranslations = {};\n";
data_entry_helper::$javascript .= 'indiciaData.popupTranslations.title="' . lang::get('Add {1} comment') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.popupTranslations.save="' . lang::get('Save and {1}') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.popupTranslations.verbV="' . lang::get('verify') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.popupTranslations.verbR="' . lang::get('reject') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.popupTranslations.V="' . lang::get('Verification') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.popupTranslations.R="' . lang::get('Rejection') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.popupTranslations.emailTitle="' . lang::get('Email record details for checking') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.popupTranslations.sendEmail="' . lang::get('Send Email') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.popupTranslations.emailSent="' . lang::get('The email was sent successfully.') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.popupTranslations.requestManualEmail="' . lang::get('The webserver is not correctly configured to send emails. Please send the following email usual your email client:') . "\";\n";
data_entry_helper::$javascript .= "indiciaData.statusTranslations = {};\n";
data_entry_helper::$javascript .= 'indiciaData.statusTranslations.V = "' . lang::get('Verified') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.statusTranslations.R = "' . lang::get('Rejected') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.statusTranslations.I = "' . lang::get('In progress') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.statusTranslations.T = "' . lang::get('Test record') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.statusTranslations.S = "' . lang::get('Sent for verification') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.statusTranslations.C = "' . lang::get('Awaiting verification') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.email_subject_send_to_verifier = "' . $args['email_subject_send_to_verifier'] . "\";\n";
$body = str_replace(array("\r", "\n"), array('', '\\n'), $args['email_body_send_to_verifier']);
data_entry_helper::$javascript .= 'indiciaData.email_body_send_to_verifier = "' . $body . "\";\n";
return $r;
}
示例14: report_calendar_grid_get_reload_url
/**
* Build a url suitable for inclusion in the links for the report calendar grid column pagination
* bar. This effectively re-builds the current page's URL, but drops the query string parameters that
* indicate the year and site.
* Note there is no need to sort for the calender grid.
* @param array $pageUrlParams List pagination parameters which should be excluded.
* @return string
*/
private static function report_calendar_grid_get_reload_url($pageUrlParams)
{
// get the url parameters. Don't use $_GET, because it contains any parameters that are not in the
// URL when search friendly URLs are used (e.g. a Drupal path node/123 is mapped to index.php?q=node/123
// using Apache mod_alias but we don't want to know about that)
$reloadUrl = data_entry_helper::get_reload_link_parts();
// find the names of the params we must not include
$excludedParams = array();
foreach ($pageUrlParams as $param) {
$excludedParams[] = $param['name'];
}
foreach ($reloadUrl['params'] as $key => $value) {
if (!in_array($key, $excludedParams)) {
$reloadUrl['path'] .= (strpos($reloadUrl['path'], '?') === false ? '?' : '&') . "{$key}={$value}";
}
}
return $reloadUrl['path'];
}
示例15: iform_mnhnl_getReloadPath
function iform_mnhnl_getReloadPath($exclusions = array('sample_id', 'occurrence_id', 'new', 'page'))
{
$reload = data_entry_helper::get_reload_link_parts();
foreach ($exclusions as $exclude) {
unset($reload['params'][$exclude]);
}
$reloadPath = $reload['path'];
if (count($reload['params'])) {
$reloadPath .= '?' . http_build_query($reload['params']);
}
return $reloadPath;
}