本文整理汇总了PHP中data_entry_helper::radio_group方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::radio_group方法的具体用法?PHP data_entry_helper::radio_group怎么用?PHP data_entry_helper::radio_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类data_entry_helper
的用法示例。
在下文中一共展示了data_entry_helper::radio_group方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.
*/
public static function get_form($args, $node, $response = null)
{
$conn = iform_get_connection_details($node);
data_entry_helper::$js_read_tokens = data_entry_helper::get_read_auth($conn['website_id'], $conn['password']);
if (!empty($_POST) && !empty($_POST['format'])) {
self::do_data_services_download($args, $node);
}
$conn = iform_get_connection_details($node);
data_entry_helper::$js_read_tokens = data_entry_helper::get_read_auth($conn['website_id'], $conn['password']);
$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>';
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']) || user_access($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 {
// only allowed 1 format, so no need for a selection control
$keys = array_keys($formats);
$r .= '<input type="hidden" name="format" value="' . array_pop($keys) . '"/>';
}
$r .= '<input type="submit" value="' . lang::get('Download') . '"/></form>';
data_entry_helper::$javascript .= 'indiciaData.ajaxUrl="' . url('iform/ajax/easy_download_2') . "\";\n";
data_entry_helper::$javascript .= 'indiciaData.nid = "' . $node->nid . "\";\n";
data_entry_helper::$javascript .= "setAvailableDownloadFilters();\n";
return $r;
}
示例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)
{
// 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') . '"/>';
//.........这里部分代码省略.........
示例3: getFirstTabAdditionalContent
protected static function getFirstTabAdditionalContent($args, $auth, &$attributes)
{
// Get authorisation tokens to update the Warehouse, plus any other hidden data.
$r = $auth['write'] . "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n" . "<input type=\"hidden\" id=\"survey_id\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />\n";
if (!empty($args['sample_method_id'])) {
$r .= '<input type="hidden" name="sample:sample_method_id" value="' . $args['sample_method_id'] . '"/>' . PHP_EOL;
}
if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
$r .= '<input type="hidden" id="sample:id" name="sample:id" value="' . data_entry_helper::$entity_to_load['sample:id'] . '" />' . PHP_EOL;
}
if (isset(data_entry_helper::$entity_to_load['occurrence:id'])) {
$r .= '<input type="hidden" id="occurrence:id" name="occurrence:id" value="' . data_entry_helper::$entity_to_load['occurrence:id'] . '" />' . PHP_EOL;
}
if (!empty(data_entry_helper::$entity_to_load['sample:group_id'])) {
$r .= "<input type=\"hidden\" id=\"group_id\" name=\"sample:group_id\" value=\"" . data_entry_helper::$entity_to_load['sample:group_id'] . "\" />\n";
// If the group does not release it's records, set the release_status flag
if (self::$group['private_records'] === 't') {
$r .= "<input type=\"hidden\" id=\"occurrence:release_status\" name=\"occurrence:release_status\" value=\"U\" />\n";
}
if (empty(data_entry_helper::$entity_to_load['sample:group_title'])) {
data_entry_helper::$entity_to_load['sample:group_title'] = self::$group['title'];
}
$msg = empty(self::$loadedSampleId) ? 'This form will be posted to the <strong>{1}</strong> group.' : 'This form was posted to the <strong>{1}</strong> group.';
$r .= '<p>' . lang::get($msg, data_entry_helper::$entity_to_load['sample:group_title']) . '</p>';
} elseif (self::$availableForGroups && !isset(data_entry_helper::$entity_to_load['sample:id'])) {
// Group enabled form being used to add new records, but no group specified in URL path, so give
// the user a chance to pick from their list of possible groups for this form.
// Get the list of possible groups they might be posting into using this form. To do this we need the page
// path without the initial leading /.
$reload = data_entry_helper::get_reload_link_parts();
// Slightly messy path handling. Ideally we'd call the same code as group_edit::get_path but we don't know the nid.
$reload['path'] = preg_replace('/^\\//', '', $reload['path']);
$dirname = preg_replace('/^\\//', '', dirname($_SERVER['SCRIPT_NAME'])) . '/';
$reload['path'] = str_replace($dirname, '', $reload['path']);
$possibleGroups = data_entry_helper::get_report_data(array('dataSource' => 'library/groups/groups_for_page', 'readAuth' => $auth['read'], 'extraParams' => array('currentUser' => hostsite_get_user_field('indicia_user_id'), 'path' => $reload['path'])));
// Output a drop down so they can select the appropriate group.
if (count($possibleGroups) > 1) {
$options = array('' => lang::get('Ad-hoc non-group records'));
foreach ($possibleGroups as $group) {
$options[$group['id']] = "{$group['group_type']}: {$group['title']}";
}
$r .= data_entry_helper::select(array('label' => lang::get('Record destination'), 'helpText' => lang::get('Choose whether to post your records into a group that you belong to.'), 'fieldname' => 'sample:group_id', 'lookupValues' => $options));
} elseif (count($possibleGroups) === 1) {
$r .= data_entry_helper::radio_group(array('label' => lang::get('Post to {1}', $possibleGroups[0]['title']), 'labelClass' => 'auto', 'helpText' => lang::get('Choose whether to post your records into {1}.', $possibleGroups[0]['title']), 'fieldname' => 'sample:group_id', 'lookupValues' => array('' => lang::get('No'), $possibleGroups[0]['id'] => lang::get('Yes'))));
}
}
// Check if Record Status is included as a control. If not, then add it as a hidden.
$arr = helper_base::explode_lines($args['structure']);
if (!in_array('[record status]', $arr)) {
$value = isset($args['defaults']['occurrence:record_status']) ? $args['defaults']['occurrence:record_status'] : 'C';
$r .= '<input type="hidden" id="occurrence:record_status" name="occurrence:record_status" value="' . $value . '" />' . PHP_EOL;
}
if (!empty($args['defaults']['occurrence:release_status'])) {
$r .= '<input type="hidden" id="occurrence:release_status" name="occurrence:release_status" value="' . $args['defaults']['occurrence:release_status'] . '" />' . PHP_EOL;
}
$r .= get_user_profile_hidden_inputs($attributes, $args, isset(data_entry_helper::$entity_to_load['sample:id']), $auth['read']);
if ($args['multiple_occurrence_mode'] === 'multi') {
$r .= '<input type="hidden" value="true" name="gridmode" />';
}
return $r;
}
示例4: joinMethodsControl
/**
* Returns a control for picking one of the allowed joining methods. If there is only one,
* then this is output as a single hidden input.
* @param array $args Form configuration arguments
* @return string HTML to output
*/
private static function joinMethodsControl($args)
{
$r = '';
$joinMethods = data_entry_helper::explode_lines_key_value_pairs($args['join_methods']);
if (count($joinMethods) === 1) {
$methods = array_keys($joinMethods);
$r .= '<input type="hidden" name="group:joining_method" value="' . $methods[0] . '"/>';
} else {
$r .= data_entry_helper::radio_group(array('label' => ucfirst(lang::get('How users join this {1}', self::$groupType)), 'fieldname' => 'group:joining_method', 'lookupValues' => $joinMethods, 'sep' => '<br/>', 'validation' => array('required')));
}
return $r;
}
示例5: array
" />
<input type="hidden" name="trigger_action:trigger_id" value="<?php
echo html::initial_value($values, 'trigger_action:trigger_id');
?>
" />
<input type="hidden" name="trigger_action:type" value="E" />
<input type="hidden" name="trigger_action:param1" value="<?php
echo html::initial_value($values, 'trigger_action:param1');
?>
" />
<input type="hidden" name="return_url" value="<?php
echo url::site();
?>
trigger" />
<?php
echo data_entry_helper::radio_group(array('fieldname' => 'trigger_action:param2', 'label' => 'Notification frequency', 'labelClass' => 'align-top', 'class' => 'check-or-radio-box', 'default' => html::initial_value($values, 'trigger_action:param2'), 'helpText' => 'Please specify how frequently you would like to receive email notifications for this trigger?', 'lookupValues' => array('N' => 'No emails', 'I' => 'Immediate', 'D' => 'Daily', 'W' => 'Weekly'), 'sep' => '<br/>'));
echo data_entry_helper::textarea(array('label' => 'Copy email to', 'helpText' => 'Provide a comma separated list of email addresses to copy this notification to.', 'labelClass' => 'align-top', 'fieldname' => 'trigger_action:param3', 'default' => html::initial_value($values, 'trigger_action:param3')));
?>
</fieldset>
<input type="submit" name="submit" value="<?php
echo kohana::lang('misc.save');
?>
" class="ui-corner-all ui-state-default button ui-priority-primary" />
<input type="submit" name="submit" value="<?php
echo kohana::lang('misc.cancel');
?>
" class="ui-corner-all ui-state-default button" />
<input type="submit" name="submit" value="<?php
echo kohana::lang('misc.unsubscribe');
?>
" onclick="if (!confirm('<?php
示例6: 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)
{
global $indicia_templates, $user;
data_entry_helper::enable_validation('entry_form');
$url = !empty($_SERVER['HTTPS']) ? "https://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'] : "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
$r = data_entry_helper::loading_block_start();
$r .= "<form method=\"post\" id=\"entry_form\" action=\"{$url}\">\n";
$readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
$r .= "<div id=\"controls\">\n";
if ($args['interface'] != 'one_page') {
$r .= "<ul>\n";
if ($user->uid == 0) {
$r .= ' <li><a href="#about_you"><span>' . lang::get('about you') . "</span></a></li>\n";
}
$r .= ' <li><a href="#species"><span>' . lang::get('what did you see') . "</span></a></li>\n";
$r .= ' <li><a href="#place"><span>' . lang::get('where was it') . "</span></a></li>\n";
$r .= ' <li><a href="#other"><span>' . lang::get('other information') . "</span></a></li>\n";
$r .= "</ul>\n";
data_entry_helper::enable_tabs(array('divId' => 'controls', 'style' => $args['interface']));
}
if ($user->uid == 0) {
$r .= "<fieldset id=\"about_you\">\n";
if ($args['interface'] == 'one_page') {
$r .= '<legend>' . lang::get('about you') . '</legend>';
}
$r .= data_entry_helper::text_input(array('label' => lang::get('first name'), 'fieldname' => 'smpAttr:' . $args['first_name_attr_id'], 'class' => 'control-width-4', 'validation' => array('required')));
$r .= data_entry_helper::text_input(array('label' => lang::get('surname'), 'fieldname' => 'smpAttr:' . $args['surname_attr_id'], 'class' => 'control-width-4', 'validation' => array('required')));
$r .= data_entry_helper::text_input(array('label' => lang::get('phone number'), 'fieldname' => 'smpAttr:' . $args['phone_attr_id'], 'class' => 'control-width-4'));
$r .= data_entry_helper::text_input(array('label' => lang::get('email'), 'fieldname' => 'smpAttr:' . $args['email_attr_id'], 'class' => 'control-width-4 optional', 'validation' => array('email')));
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'first'));
}
$r .= "</fieldset>\n";
}
// Species tab
$r .= "<fieldset id=\"species\">\n";
if ($args['interface'] == 'one_page') {
$r .= '<legend>' . lang::get('what did you see') . '</legend>';
}
$species_list_args = array('label' => lang::get('Species'), 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'listId' => $args['species_list_id'], 'columns' => 1, 'parentField' => 'parent_id', 'checkboxCol' => false, 'occAttrs' => array($args['abundance_attr_id']), 'extraParams' => $readAuth + array('view' => 'detail', 'orderby' => 'taxonomic_sort_order'), 'survey_id' => $args['survey_id'], 'header' => false, 'view' => 'detail', 'PHPtaxonLabel' => true);
// Build a nice template to show a picture of each species, with fancybox.
data_entry_helper::add_resource('fancybox');
data_entry_helper::$javascript .= "jQuery('a.fancybox').fancybox();\n";
$indicia_templates['taxon_label'] = 'return \'<div class="taxon-cell">' . '<a href="' . data_entry_helper::$base_url . 'upload/{image_path}" class="fancybox" >' . '<img alt="{taxon}" src="' . data_entry_helper::$base_url . 'upload/med-{image_path}" width="250"/></a>' . '<div>{taxon}</div></div>' . '<div class="taxon-desc"><ul><li>\'.str_replace("\\n", "</li><li>","{description_in_list}").\'</li></ul>' . '<a href="http://www.marine-life.org.uk/northeastcetaceans/?q=\'.
strtolower(str_replace(array(" ", "\\\'"), array("-", ""), "{taxon}")).
\'" target="_blank" class="ui-state-default ui-corner-all indicia-button">' . lang::get('More Info') . '...</a></div>\';';
// Template the taxon label cell
$indicia_templates['taxon_label_cell'] = "\n<td class='scTaxonCell'>{content}</td>";
// Also template the attribute controls to show the label in place.
$indicia_templates['attribute_cell'] = "\n<td class='scOccAttrCell'><label>{label}:</label><br/>{content}</td>";
$r .= data_entry_helper::species_checklist($species_list_args);
if ($args['interface'] == 'wizard') {
$r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $user->uid == 0 ? 'middle' : 'first'));
}
$r .= "</fieldset>";
// --Place tab--
$r .= "<fieldset id=\"place\">\n";
if ($args['interface'] == 'one_page') {
$r .= '<legend>' . lang::get('where was it') . '</legend>';
}
$r .= data_entry_helper::radio_group(array('label' => 'Where were you when you made the sighting?', 'fieldname' => 'smpAttr:' . $args['platform_attr_id'], 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'extraParams' => $readAuth + array('termlist_id' => $args['platform_termlist_id']), 'sep' => '<br />', 'labelClass' => 'auto', 'class' => 'inline sighting-platform', 'validation' => array('required')));
$r .= '<div id="place_wrapper" class="hidden">';
// Some instructions only visible when entering data from a boat
$r .= '<p class="boat_mode page-notice ui-state-highlight ui-corner-all">' . lang::get('Instructions for when on boat') . '</p>';
// Some instructions only visible when entering data from the shore
$r .= '<p class="shore_mode page-notice ui-state-highlight ui-corner-all">' . lang::get('Instructions for clicking on map') . '</p>';
$r .= '<div class="boat_mode">';
// Add help examples to the lat and long boxes
$indicia_templates['sref_textbox_latlong'] = '<label for="{idLat}">{labelLat}:</label>' . '<input type="text" id="{idLat}" name="{fieldnameLat}" {class} {disabled} value="{default}" /> <p class="helpText">e.g. 55:12.345N</p>' . '<label for="{idLong}">{labelLong}:</label>' . '<input type="text" id="{idLong}" name="{fieldnameLong}" {class} {disabled} value="{default}" /> <p class="helpText">e.g. 0:45.678W</p>' . '<input type="hidden" id="imp-geom" name="{table}:geom" value="{defaultGeom}" />' . '<input type="text" id="{id}" name="{fieldname}" style="display:none" value="{default}" />';
$r .= data_entry_helper::sref_and_system(array('systems' => array(4326 => lang::get('Latitude, Longitude')), 'splitLatLong' => true, 'helpText' => lang::get('Instructions for latlong')));
$r .= '</div>';
// Initially, we hide the map. Only show it when the user selects the sighting was from the shore,
// as a click on the map for boat recordings will not be accurate.
$r .= '<div class="shore_mode">';
$options = iform_map_get_map_options($args, $readAuth);
$olOptions = iform_map_get_ol_options($args);
$options['maxZoom'] = 9;
// Switch to degrees and decimal minutes for lat long.
$options['latLongFormat'] = 'DM';
$r .= data_entry_helper::map_panel($options, $olOptions);
// Now, add some JavaScript to show or hide the map. Show it for when the sighting was from the shore.
// Hide it for boat based sightings as we want a GPS coordinate in this case. The JavaScript looks for the
// checked radio button to see the value
data_entry_helper::$javascript .= 'jQuery(".sighting-platform input").click(
function() {
var platformId = jQuery("input[name=smpAttr\\\\:' . $args['platform_attr_id'] . ']:checked").val();
if (platformId == ' . $args['platform_mapped_term_id'] . ') {
jQuery("#place_wrapper").removeClass("hidden");
jQuery(".shore_mode").removeClass("hidden");
jQuery(".boat_mode").addClass("hidden");
//.........这里部分代码省略.........
示例7: array
?>
'>Abundance DAFOR:</label>
<?php
echo data_entry_helper::select($config['dafor'], 'termlists_term', 'term', 'id', $readAuth + array('termlist_id' => $config['dafor_termlist']));
?>
<br />
<?php
echo data_entry_helper::text_input(array('label' => 'Determination Date', 'fieldname' => $config['det_date']));
?>
</fieldset>
<fieldset>
<legend>Sample attributes</legend>
<?php
echo data_entry_helper::text_input(array('label' => 'Weather', 'fieldname' => $config['weather'], 'class' => 'control-width-6'));
echo data_entry_helper::text_input(array('label' => 'Temperature (Celcius)', 'fieldname' => $config['temperature']));
echo data_entry_helper::radio_group(array('label' => 'Surroundings', 'fieldname' => $config['surroundings'], 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'extraParams' => $readAuth + array('termlist_id' => $config['surroundings_termlist']), 'sep' => '<br />'));
?>
<br/>
<label for='<?php
echo $config['site_usage'];
?>
[]'>Site Usage:</label>
<?php
echo data_entry_helper::listbox($config['site_usage'] . '[]', 'termlists_term', 'term', 4, true, 'id', $readAuth + array('termlist_id' => $config['site_usage_termlist']));
?>
</fieldset>
<input type="submit" value="Save" />
</form>
</div>
</body>
示例8: 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 {
//.........这里部分代码省略.........
示例9: inclusionMethodControl
/**
* Returns a control for picking one of the allowed record inclusion methods methods. If there is only one allowed,
* then this is output as a single hidden input.
* @param array $args Form configuration arguments
* @return string HTML to output
*/
private static function inclusionMethodControl($args)
{
if ($args['data_inclusion_mode'] !== 'choose') {
$implicit = $args['data_inclusion_mode'] === 'implicit' ? 't' : 'f';
$r = data_entry_helper::hidden_text(array('fieldname' => 'group:implicit_record_inclusion', 'default' => $implicit));
} else {
$r = '<fieldset><legend>' . lang::get('How to decide which records to include in the {1} reports', self::$groupType) . '</legend>';
$r .= '<p>' . lang::get('LANG_Record_Inclusion_Instruct_1', self::$groupType, lang::get(self::$groupType . "'s")) . ' ';
if ($args['include_sensitivity_controls']) {
$r .= lang::get('LANG_Record_Inclusion_Instruct_Sensitive', self::$groupType) . ' ';
}
$r .= lang::get('LANG_Record_Inclusion_Instruct_2', self::$groupType, ucfirst(self::$groupType)) . '</p>';
$r .= data_entry_helper::radio_group(array('fieldname' => 'group:implicit_record_inclusion', 'label' => lang::get('Include records on reports if'), 'lookupValues' => array('f' => lang::get('they were posted by a group member and match the filter defined above ' . 'and they were submitted via a {1} data entry form', self::$groupType), 't' => lang::get('they were posted by a group member and match the filter defined above, ' . 'but it doesn\'t matter which recording form was used', self::$groupType), '' => lang::get('they match the filter defined above but it doesn\'t matter who ' . 'posted the record or via which form', self::$groupType)), 'default' => 'f'));
$r .= ' </fieldset>';
}
return $r;
}
示例10: array
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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 Survey cleanup
* @subpackage Views
* @author Indicia Team
* @license http://www.gnu.org/licenses/gpl.html GPL
* @link http://code.google.com/p/indicia/
*/
require_once DOCROOT . 'client_helpers/data_entry_helper.php';
if (!($this->auth->logged_in('CoreAdmin') || $this->auth->has_website_access('admin', $survey->website_id))) {
echo '<p class="page-notice ui-state-highlight ui-corner-all">You must be an admin of the website that this survey belongs to in order to use the Survey Cleanup tool</p>';
} else {
echo data_entry_helper::radio_group(array('label' => 'Type of data to cleanup', 'fieldname' => 'mode', 'id' => 'mode', 'lookupValues' => array('deleted' => 'Mark deleted records', 'test' => 'Test records', 'all' => 'All records'), 'sep' => '<br/>', 'default' => 'deleted'));
echo data_entry_helper::hidden_text(array('fieldname' => 'survey_id', 'default' => $survey->id));
echo data_entry_helper::apply_template('submitButton', array('id' => 'cleanup-button', 'class' => 'indicia-button', 'caption' => 'Cleanup Records'));
data_entry_helper::link_default_stylesheet();
data_entry_helper::$dumped_resources[] = 'jquery';
data_entry_helper::$dumped_resources[] = 'jquery_ui';
data_entry_helper::$dumped_resources[] = 'fancybox';
data_entry_helper::$javascript .= "\$('#cleanup-button').click(function() {\n if (!confirm('Are you certain you want to cleanup these records?')) {\n return false;\n } else {\n \$.post(\"" . url::site('survey_cleanup/cleanup') . "\", \n { mode: \$('input:radio[name=mode]:checked').val(), survey_id: \$('#survey_id').val() }, \n function(data, textStatus) {\n alert(data);\n }\n );\n }\n });\n";
echo data_entry_helper::dump_javascript();
}
示例11: survey_points_report_params
/**
*
*/
public static function survey_points_report_params($auth, $args, $tabalias, $options, $path)
{
if (!function_exists('iform_ajaxproxy_url')) {
return 'An AJAX Proxy module must be enabled for the survey_points_report_params control to work.';
}
if (!($userId = hostsite_get_user_field('indicia_user_id'))) {
return 'The user account must be connected via Easy Login for the survey_points_report_params control to work';
}
// map the ID parameter provided after saving a crossing sample to the report input parameter to filter the list
if (!empty($_GET['id']) && empty($_GET['dynamic-parent_sample_id'])) {
$_GET['dynamic-parent_sample_id'] = $_GET['id'];
}
if (empty($_GET['dynamic-parent_sample_id'])) {
return 'Survey identifier not provided - cannot load the survey';
}
$requiredOptions = array('transectIdAttrId', 'sampleTypeAttrId', 'sampleTypeTermlistId', 'transectSampleMethodId');
foreach ($requiredOptions as $option) {
if (empty($options[$option])) {
return "Please provide a value for the @{$option} option.";
}
}
$surveySampleId = $_GET['dynamic-parent_sample_id'];
$samples = data_entry_helper::get_population_data(array('table' => 'sample', 'extraParams' => $auth['read'] + array('id' => $surveySampleId)));
if (count($samples) !== 1) {
return 'No unique survey found for the provided ID';
}
$sample = $samples[0];
$sampleMethods = data_entry_helper::get_population_data(array('table' => 'termlists_term', 'extraParams' => $auth['read'] + array('term' => 'Transect', 'termlist_title' => 'Sample methods', 'view' => 'cache')));
if (count($sampleMethods) !== 1) {
return 'No sample method term found for Transect';
}
$transectMethodId = $sampleMethods[0]['id'];
$date = strtotime($sample['date_start']);
hostsite_set_page_title(lang::get('Effort and sightings points for {1} on {2}', $sample['location'], date('d/m/Y', $date)));
$r = '<div id="points-params">';
$r .= data_entry_helper::radio_group(array('fieldname' => 'point-type-param', 'lookupValues' => array('E' => lang::get('Effort only'), 'S' => lang::get('Sightings only'), 'ES' => lang::get('Both effort and sightings')), 'default' => 'ES'));
$r .= '<fieldset>';
$r .= data_entry_helper::select(array('fieldname' => 'transect-param', 'label' => lang::get('Transect'), 'report' => 'reports_for_prebuilt_forms/marinelife/transects_list', 'valueField' => 'id', 'captionField' => 'caption', 'extraParams' => $auth['read'] + array('parent_sample_id' => $surveySampleId, 'sample_type_attr_id' => $options['sampleTypeAttrId'], 'transect_id_attr_id' => $options['transectIdAttrId']), 'caching' => false));
$r .= '<a href="#" id="new-transect" class="indicia-button">New transect</a>';
$r .= '<a href="' . hostsite_get_url('survey/points/edit-effort', array('transect_sample_id' => 0, 'parent_sample_id' => $surveySampleId)) . '" id="edit-effort" class="indicia-button edit-point">Add effort waypoint(s)</a>';
$r .= '<a href="' . hostsite_get_url('survey/points/edit-sighting', array('transect_sample_id' => 0, 'parent_sample_id' => $surveySampleId)) . '" id="edit-sighting" class="indicia-button edit-point">Add sighting(s)</a>';
$r .= '</fieldset>';
$r .= '<a href="casual/edit">Add casual sighting(s)</a>';
$r .= "</div>\n";
// popup template for adding a transect
$r .= '<div style="display: none">';
$r .= '<div id="add-transect-popup">';
$r .= '<h3>' . lang::get('New transect') . '</h3>';
$r .= data_entry_helper::text_input(array('fieldname' => 'popup-transect-id', 'label' => lang::get('Transect ID')));
$r .= data_entry_helper::select(array('fieldname' => 'popup-sample-type', 'label' => lang::get('Sample type'), 'table' => 'termlists_term', 'valueField' => 'id', 'captionField' => 'term', 'blankText' => lang::get('<Please select>'), 'extraParams' => $auth['read'] + array('view' => 'cache', 'termlist_id' => $options['sampleTypeTermlistId'], 'orderby' => 'sort_order'), 'validation' => array('required')));
$r .= data_entry_helper::date_picker(array('fieldname' => 'popup-transect-date', 'label' => lang::get('Date'), 'helpText' => lang::get('Please alter the date if the survey spans several days'), 'default' => $sample['date_start']));
$r .= '<button id="transect-popup-save">Save</button> ';
$r .= '<button id="transect-popup-cancel">Cancel</button>';
$r .= '</div>';
$r .= '</div>';
$url = iform_ajaxproxy_url(null, 'sample');
data_entry_helper::$javascript .= "indiciaData.surveySampleId={$surveySampleId};\n";
data_entry_helper::$javascript .= "indiciaData.websiteId={$args['website_id']};\n";
data_entry_helper::$javascript .= "indiciaData.userId='{$userId}';\n";
data_entry_helper::$javascript .= "indiciaData.surveyId='{$sample['survey_id']}';\n";
!!(data_entry_helper::$javascript .= "indiciaData.sampleDate='{$sample['date_start']}';\n");
data_entry_helper::$javascript .= "indiciaData.sampleSref='{$sample['entered_sref']}';\n";
data_entry_helper::$javascript .= "indiciaData.transectMethodId={$transectMethodId};\n";
data_entry_helper::$javascript .= "indiciaData.saveSampleUrl='{$url}';\n";
data_entry_helper::$javascript .= "indiciaData.transectIdAttrId={$options['transectIdAttrId']};\n";
data_entry_helper::$javascript .= "indiciaData.sampleTypeAttrId={$options['sampleTypeAttrId']};\n";
data_entry_helper::$javascript .= "indiciaData.transectSampleMethodId={$options['transectSampleMethodId']};\n";
data_entry_helper::$javascript .= "indiciaData.langRequireTransectID='" . lang::get('Please supply the Transect ID.') . "';\n";
data_entry_helper::$javascript .= "indiciaData.langRequireSampleType='" . lang::get('Please supply the Sample Type.') . "';\n";
return $r;
}