当前位置: 首页>>代码示例>>PHP>>正文


PHP data_entry_helper::select方法代码示例

本文整理汇总了PHP中data_entry_helper::select方法的典型用法代码示例。如果您正苦于以下问题:PHP data_entry_helper::select方法的具体用法?PHP data_entry_helper::select怎么用?PHP data_entry_helper::select使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在data_entry_helper的用法示例。


在下文中一共展示了data_entry_helper::select方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_control_sensitivity

 /**
  * Override the sensitivity control to create a simple select with default value 
  * set by user profile.
  */
 protected static function get_control_sensitivity($auth, $args, $tabAlias, $options)
 {
     // Obtain the default value for the user.
     global $user;
     $user = user_load($user->uid);
     $field_values = field_get_items('user', $user, 'field_icpveg_permission');
     $default_value = $field_values[0]['value'];
     if ($default_value == 0) {
         // Where Drupal stores 0, we want the Warehouse field to be NULL to indicate
         // no blurring of detail.
         $default_value = '';
     }
     return data_entry_helper::select(array_merge(array('fieldname' => 'occurrence:sensitivity_precision', 'label' => lang::get('ICPVeg Sensitivity'), 'lookupValues' => array('50000' => lang::get('ICPVeg Sensitivity 50km')), 'blankText' => lang::get('ICPVeg Sensitivity blankText'), 'default' => $default_value), $options));
 }
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:18,代码来源:icpveg_mobile.php

示例2: get_form

 /**
  * Return the generated form output.
  * @return Form HTML.
  */
 public static function get_form($args)
 {
     data_entry_helper::enable_tabs(array('divId' => 'controls'));
     $r = "<form method=\"post\">\n";
     // Get authorisation tokens to update and read from the Warehouse.
     $r .= data_entry_helper::get_auth($args['website_id'], $args['password']);
     $readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
     $r .= "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
     $r .= "<input type=\"hidden\" id=\"record_status\" name=\"record_status\" value=\"C\" />\n";
     $r .= "<div id=\"controls\">\n";
     // Create a list which jQuery can parse to create the tabs.
     $r .= "<ul>\r\n      <li><a href=\"#recorder\"><span>Recorder</span></a></li>\r\n      <li><a href=\"#site\"><span>Site</span></a></li>\r\n      <li><a href=\"#species_tab_1\"><span>" . $args['tab_title_1'] . "</span></a></li>\n";
     if ($args['list_id_2']) {
         $r .= "<li><a href=\"#species_tab_2\"><span>" . $args['tab_title_2'] . "</span></a></li>\n";
     }
     if ($args['list_id_3']) {
         $r .= "<li><a href=\"#species_tab_3\"><span>" . $args['tab_title_3'] . "</span></a></li>\n";
     }
     if ($args['list_id_4']) {
         $r .= "<li><a href=\"#species_tab_4\"><span>" . $args['tab_title_4'] . "</span></a></li>\n";
     }
     $r .= "</ul>\n";
     $r .= "<div id=\"recorder\">\n";
     $r .= data_entry_helper::select(array('label' => 'Title', 'fieldname' => 'smpAttr:5', 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'extraParams' => $readAuth + array('termlist_external_key' => 'indicia:titles')));
     $r .= data_entry_helper::text_input(array('label' => 'First name', 'fieldname' => 'smpAttr:6'));
     $r .= data_entry_helper::text_input(array('label' => 'Last name', 'fieldname' => 'smpAttr:7'));
     $r .= data_entry_helper::text_input(array('label' => 'Email', 'fieldname' => 'smpAttr:8'));
     // Postcode before address since entering the postcode auto-populates part of the address.
     $r .= data_entry_helper::postcode_textbox(array('label' => 'Postcode', 'fieldname' => 'smpAttr:10', 'linkedAddressBoxId' => 'address', 'hiddenFields' => false));
     $r .= data_entry_helper::textarea(array('label' => 'Address', 'fieldname' => 'smpAttr:9', 'id' => 'address'));
     $r .= "</div>\n";
     $r .= "<div id=\"site\">\n";
     $r .= data_entry_helper::map();
     $r .= data_entry_helper::date_picker(array('label' => 'Date', 'fieldname' => 'sample:date'));
     $r .= "</div>\n";
     $r .= "<div id=\"species_tab_1\">\n";
     $species_list_args = array('label' => 'Species', 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'extraParams' => $readAuth + array('taxon_list_id' => $args['list_id_1']));
     $r .= data_entry_helper::species_checklist($species_list_args);
     $r .= "</div>\n";
     $r .= "</div>\n";
     $r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"Save\" />\n";
     $r .= "</form>";
     return $r;
 }
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:48,代码来源:site_survey_recording_form.php

示例3: get_form

 /**
  * Return the generated form output.
  * @return Form HTML.
  */
 public static function get_form($args)
 {
     $r = "<form method=\"post\">\n";
     // Get authorisation tokens to update and read from the Warehouse.
     $r .= data_entry_helper::get_auth($args['website_id'], $args['password']);
     $readAuth = data_entry_helper::get_read_auth($args['website_id'], $args['password']);
     $r .= "<input type=\"hidden\" id=\"website_id\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
     $r .= "<input type=\"hidden\" id=\"record_status\" name=\"record_status\" value=\"C\" />\n";
     $r .= "<div id=\"controls\">\n";
     if ($args['tabs']) {
         $r .= "<ul>\n        <li><a href=\"#species\"><span>Species</span></a></li>\n        <li><a href=\"#place\"><span>Place</span></a></li>\n        <li><a href=\"#other\"><span>Other Information</span></a></li>\n      </ul>\n";
         data_entry_helper::enable_tabs(array('divId' => 'controls'));
     }
     $r .= "<div id=\"species\">\n";
     $extraParams = $readAuth + array('taxon_list_id' => $args['list_id']);
     if ($args['preferred']) {
         $extraParams += array('preferred' => 't');
     }
     $species_list_args = array('label' => 'Species', 'itemTemplate' => 'select_species', 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'extraParams' => $extraParams);
     // Dynamically generate the species selection control required.
     $r .= call_user_func(array('data_entry_helper', $args['species_ctrl']), $species_list_args);
     $r .= "</div>\n";
     $r .= "<div id=\"place\">\n";
     // for this form, use bing and no geoplanet lookup, since then it requires no API keys so is a good
     // quick demo of how things work.
     $mapOptions = array('presetLayers' => array('bing_aerial'), 'locate' => false);
     if ($args['tabs']) {
         $mapOptions['tabDiv'] = 'place';
     }
     $r .= data_entry_helper::map($mapOptions);
     $r .= "</div>\n";
     $r .= "<div id=\"other\">\n";
     $r .= data_entry_helper::date_picker(array('label' => 'Date', 'fieldname' => 'sample:date'));
     $r .= data_entry_helper::select(array('label' => 'Survey', 'fieldname' => 'sample:survey_id', 'table' => 'survey', 'captionField' => 'title', 'valueField' => 'id', 'extraParams' => $readAuth));
     $r .= data_entry_helper::textarea(array('label' => 'Comment', 'fieldname' => 'sample:comment', 'class' => 'wide'));
     $r .= "</div>\n";
     $r .= "</div>\n";
     $r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"Save\" />\n";
     $r .= "</form>";
     return $r;
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:45,代码来源:basic_1.php

示例4: my_sites_form

 public static function my_sites_form($auth, $args, $tabalias, $options, $path)
 {
     if (!function_exists('iform_ajaxproxy_url')) {
         return 'An AJAX Proxy module must be enabled for the My Sites Form to work.';
     }
     $r = "<fieldset><legend>" . lang::get('Find additional sites to store in your sites list') . "</legend>";
     if (empty($options['locationTypes']) || !preg_match('/^([0-9]+,( )?)*[0-9]+$/', $options['locationTypes'])) {
         return 'The My sites form is not correctly configured. Please provide the location types to allow search by.';
     }
     $locationTypes = explode(',', str_replace(' ', '', $options['locationTypes']));
     if (empty($options['locationTypeResults']) || !preg_match('/^([0-9]+,( )?)*[0-9]+$/', $options['locationTypeResults'])) {
         return 'The My sites form is not correctly configured. Please provide the location types to allow results to be returned for.';
     }
     if (empty($options['mySitesPsnAttrId']) || !preg_match('/^[0-9]+$/', $options['mySitesPsnAttrId'])) {
         return 'The My sites form is not correctly configured. Please provide the person attribute ID used to store My Sites.';
     }
     $localityOpts = array('fieldname' => 'locality_id', 'id' => 'locality_id', 'extraParams' => $auth['read'] + array('orderby' => 'name'), 'blankText' => '<' . lang::get('all') . '>');
     if (count($locationTypes) > 1) {
         $r .= '<label>' . lang::get('Select site by type then locality:') . '</label> ';
         $r .= data_entry_helper::select(array('fieldname' => 'location_type_id', 'table' => 'termlists_term', 'valueField' => 'id', 'captionField' => 'term', 'extraParams' => $auth['read'] + array('orderby' => 'term', 'query' => urlencode(json_encode(array('in' => array('id', $locationTypes))))), 'blankText' => '<' . lang::get('please select') . '>'));
         // link the locality select to the location type select
         $localityOpts = array_merge(array('parentControlId' => 'location_type_id', 'parentControlLabel' => lang::get('Site type to search'), 'filterField' => 'location_type_id', 'filterIncludesNulls' => false, 'emptyFilterIsUnfiltered' => true), $localityOpts);
     } else {
         $r .= '<label>' . lang::get('Select site by locality') . '</label> ';
         // no need for a locality select, so just filter to the location type
         $localityOpts['extraParams']['location_type_id'] = $locationTypes[0];
         $localityOpts['default'] = hostsite_get_user_field('location');
     }
     $r .= data_entry_helper::location_select($localityOpts);
     $r .= data_entry_helper::location_select(array('id' => 'location-select', 'report' => 'library/locations/locations_for_my_sites', 'table' => '', 'valueField' => 'location_id', 'captionField' => 'q', 'extraParams' => $auth['read'] + array('location_type_ids' => $options['locationTypeResults'], 'locattrs' => '', 'user_id' => hostsite_get_user_field('indicia_user_id'), 'person_site_attr_id' => $options['mySitesPsnAttrId'], 'hide_existing' => 1), 'parentControlId' => 'locality_id', 'parentControlLabel' => lang::get('Locality to search'), 'filterField' => 'parent_id', 'filterIncludesNulls' => false, 'blankText' => '<' . lang::get('please select') . '>'));
     $r .= '<button id="add-site-button" type="button">' . lang::get('Add to My Sites') . '</button><br/>';
     $r .= data_entry_helper::location_autocomplete(array('id' => 'location-search', 'label' => lang::get('<strong>Or</strong> search for a site'), 'report' => 'library/locations/locations_for_my_sites', 'table' => '', 'valueField' => 'location_id', 'captionField' => 'q', 'extraParams' => $auth['read'] + array('location_type_ids' => $options['locationTypeResults'], 'locattrs' => '', 'user_id' => hostsite_get_user_field('indicia_user_id'), 'person_site_attr_id' => $options['mySitesPsnAttrId'], 'hide_existing' => 1, 'parent_id' => '')));
     $r .= '<button id="add-searched-site-button" type="button">' . lang::get('Add to My Sites') . '</button><br/>';
     $postUrl = iform_ajaxproxy_url(null, 'person_attribute_value');
     data_entry_helper::$javascript .= "\r\n      function addSite(locationId) {\r\n        if (!isNaN(locationId) && locationId!=='') {\r\n          \$.post('{$postUrl}', \r\n            {\"website_id\":" . $args['website_id'] . ",\"person_attribute_id\":" . $options['mySitesPsnAttrId'] . ",\"user_id\":" . hostsite_get_user_field('indicia_user_id') . ",\"int_value\":locationId} ,\r\n            function (data) {\r\n              if (typeof data.error === 'undefined') {\r\n                indiciaData.reports.dynamic.grid_report_grid_0.reload(true);\r\n              } else {\r\n                alert(data.error);\r\n              }\r\n            },\r\n            'json'\r\n          );\r\n        }\r\n      }\r\n      \$('#add-site-button').click(function() {\r\n        addSite(\$('#location-select').val());\r\n        if (!isNaN(\$('#location-select').val())) {\r\n          \$('#location-select option:selected').remove();\r\n        }\r\n      });\r\n      \$('#add-searched-site-button').click(function() {addSite(\$('#location-search').val());});\r\n      \$('#location-select, #location-search, #locality_id').change(function() {\r\n        if (typeof indiciaData.mapdiv!=='undefined') {\r\n          indiciaData.mapdiv.locationSelectedInInput(indiciaData.mapdiv, this.value);\r\n        }\r\n      });\r\n      \r\n      linked_site_delete = function(pav_id) {\r\n        var userId=" . hostsite_get_user_field('indicia_user_id') . ";\r\n        \$.post('{$postUrl}', \r\n          {\"website_id\":" . $args['website_id'] . ",\"id\":pav_id, \"deleted\":\"t\"},\r\n          function (data) {\r\n            if (typeof data.error === 'undefined') {\r\n              indiciaData.reports.dynamic.grid_report_grid_0.reload(true);\r\n            } else {\r\n              alert(data.error);\r\n            }\r\n          },\r\n          'json'\r\n        );\r\n      }\r\n    ";
     $r .= '</fieldset>';
     return $r;
 }
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:38,代码来源:my_sites.php

示例5: get_site_tab

 private static function get_site_tab($auth, $args, $settings)
 {
     $r = '<div id="site-details" class="ui-helper-clearfix">';
     $r .= '<form method="post" id="input-form">';
     $r .= $auth['write'];
     $r .= '<div id="cols" class="ui-helper-clearfix"><div class="left" style="width: 54%">';
     $r .= '<fieldset><legend>' . lang::get('Site Details') . '</legend>';
     $r .= "<input type=\"hidden\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
     $typeTerms = array();
     if (!empty($args['main_type_term_1'])) {
         $typeTerms[] = $args['main_type_term_1'];
     }
     if (!empty($args['main_type_term_2'])) {
         $typeTerms[] = $args['main_type_term_2'];
     }
     if (!empty($args['main_type_term_3'])) {
         $typeTerms[] = $args['main_type_term_3'];
     }
     $typeTermIDs = helper_base::get_termlist_terms($auth, 'indicia:location_types', $typeTerms);
     $lookUpValues = array('' => '<' . lang::get('please select') . '>');
     foreach ($typeTermIDs as $termDetails) {
         $lookUpValues[$termDetails['id']] = $termDetails['term'];
     }
     // if location is predefined, can not change unless a 'managerPermission'
     $canEditType = !$settings['locationId'] || isset($args['managerPermission']) && $args['managerPermission'] != '' && function_exists('user_access') && user_access($args['managerPermission']);
     if ($canEditType) {
         $r .= data_entry_helper::select(array('label' => lang::get('Site Type'), 'id' => 'location_type_id', 'fieldname' => 'location:location_type_id', 'lookupValues' => $lookUpValues));
         data_entry_helper::$javascript .= "\$('#location_type_id').change(function(){\r\n  switch(\$(this).val()){\n";
         for ($i = 1; $i < 4; $i++) {
             if (!empty($args['main_type_term_' . $i])) {
                 $type = helper_base::get_termlist_terms($auth, 'indicia:location_types', array($args['main_type_term_' . $i]));
                 data_entry_helper::$javascript .= "    case \"" . $type[0]['id'] . "\":\n";
                 if (!isset($args['can_change_section_number_' . $i]) || !$args['can_change_section_number_' . $i]) {
                     if ($settings['locationId']) {
                         // not saved yet, so no sections yet created, hence no need to worry about existing value. make number attribute readonly. set value. min value will be 1.
                         data_entry_helper::$javascript .= "      var minValue = \$('[name=" . str_replace(':', '\\\\:', $settings['numSectionsAttr']) . "]').attr('min');\r\n      if(minValue > " . $args['section_number_' . $i] . ") { // existing value is greater than one we want to set\r\n        alert('You are reducing the number of sections below that already existing. Please use the Remove Section button on the Your Route tab to reduce the number of sections to " . $args['section_number_' . $i] . " before changing the Site type');\r\n        return false;\r\n      }\r\n      \$('[name=" . str_replace(':', '\\\\:', $settings['numSectionsAttr']) . "]').val(" . $args['section_number_' . $i] . ").attr('readonly','readonly').css('color','graytext');\n";
                     } else {
                         // not saved yet, so no sections yet created, hence no need to worry about existing value. make number attribute readonly. set value. min value will be 1.
                         data_entry_helper::$javascript .= "      \$('[name=" . str_replace(':', '\\\\:', $settings['numSectionsAttr']) . "]').val(" . $args['section_number_' . $i] . ").attr('readonly','readonly').css('color','graytext');\n";
                     }
                 } else {
                     // user modifiable number of sections. value of attribute is left alone: don't have to worry att his point whether existing data.
                     data_entry_helper::$javascript .= "      \$('[name=" . str_replace(':', '\\\\:', $settings['numSectionsAttr']) . "]').removeAttr('readonly').css('color','');\n";
                 }
                 data_entry_helper::$javascript .= "      break;\n";
             }
         }
         data_entry_helper::$javascript .= "    default: break;\r\n  };\r\n  return true;\r\n});\n";
     }
     if ($settings['locationId']) {
         $r .= '<input type="hidden" name="location:id" id="location:id" value="' . $settings['locationId'] . "\" />\n";
     }
     $r .= data_entry_helper::text_input(array('fieldname' => 'location:name', 'label' => lang::get('Site Name'), 'class' => 'control-width-4 required', 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '));
     if (!$settings['canEditBody']) {
         $r .= '<p>' . lang::get('This site cannot be edited because there are walks recorded on it. Please contact the site administrator if you think there are details which need changing.') . '</p>';
     } else {
         if (count($settings['walks']) > 0) {
             // can edit it
             $r .= '<p>' . lang::get('This site has walks recorded on it. Please do not change the site details without considering the impact on the existing data.') . '</p>';
         }
     }
     $list = explode(',', str_replace(' ', '', $args['spatial_systems']));
     foreach ($list as $system) {
         $systems[$system] = lang::get($system);
     }
     if (isset(data_entry_helper::$entity_to_load['location:centroid_sref_system']) && in_array(data_entry_helper::$entity_to_load['location:centroid_sref_system'], array('osgb', 'osie'))) {
         data_entry_helper::$entity_to_load['location:centroid_sref_system'] = strtoupper(data_entry_helper::$entity_to_load['location:centroid_sref_system']);
     }
     $r .= data_entry_helper::sref_and_system(array('fieldname' => 'location:centroid_sref', 'geomFieldname' => 'location:centroid_geom', 'label' => 'Grid Ref.', 'systems' => $systems, 'class' => 'required', 'helpText' => lang::get('Click on the map to set the central grid reference.'), 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '));
     if ($settings['locationId'] && data_entry_helper::$entity_to_load['location:code'] != '' && data_entry_helper::$entity_to_load['location:code'] != null) {
         $r .= data_entry_helper::text_input(array('fieldname' => 'location:code', 'label' => lang::get('Site Code'), 'class' => 'control-width-4', 'disabled' => ' readonly="readonly" '));
     } else {
         $r .= "<p>" . lang::get('The Site Code will be allocated by the Administrator.') . "</p>";
     }
     // setup the map options
     $options = iform_map_get_map_options($args, $auth['read']);
     // find the form blocks that need to go below the map.
     $bottom = '';
     $bottomBlocks = explode("\n", isset($args['bottom_blocks']) ? $args['bottom_blocks'] : '');
     foreach ($bottomBlocks as $block) {
         $bottom .= get_attribute_html($settings['attributes'], $args, array('extraParams' => $auth['read'], 'disabled' => $settings['canEditBody'] ? '' : ' disabled="disabled" '), $block);
     }
     // other blocks to go at the top, next to the map
     if (isset($args['site_help']) && $args['site_help'] != '') {
         $r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . t($args['site_help']) . '</p>';
     }
     $r .= get_attribute_html($settings['attributes'], $args, array('extraParams' => $auth['read']));
     $r .= '</fieldset>';
     $r .= "</div>";
     // left
     $r .= '<div class="right" style="width: 44%">';
     if (!$settings['locationId']) {
         $help = t('Use the search box to find a nearby town or village, then drag the map to pan and click on the map to set the centre grid reference of the transect. ' . 'Alternatively if you know the grid reference you can enter it in the Grid Ref box on the left.');
         $r .= '<p class="ui-state-highlight page-notice ui-corner-all">' . $help . '</p>';
         $r .= data_entry_helper::georeference_lookup(array('label' => lang::get('Search for place'), 'driver' => $args['georefDriver'], 'georefPreferredArea' => $args['georefPreferredArea'], 'georefCountry' => $args['georefCountry'], 'georefLang' => $args['language'], 'readAuth' => $auth['read']));
     }
     if (isset($args['maxPrecision']) && $args['maxPrecision'] != '') {
         $options['clickedSrefPrecisionMax'] = $args['maxPrecision'];
     }
     if (isset($args['minPrecision']) && $args['minPrecision'] != '') {
//.........这里部分代码省略.........
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:101,代码来源:ukbms_sectioned_transects_edit_transect.php

示例6: get_form


//.........这里部分代码省略.........
		<div id="name-filter-header" class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
	  		<div id="fold-name-button" class="ui-state-default ui-corner-all fold-button fold-button-folded">&nbsp;</div>
	  		<div id="reset-name-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
	  		<div id="general-filter-title">
		  		<span>' . lang::get('LANG_Name_Filter_Title') . '</span>
      		</div>
		</div>
	    <div id="name-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-all">
	        ' . data_entry_helper::text_input(array('label' => lang::get('LANG_Name'), 'fieldname' => 'username', 'suffixTemplate' => 'nosuffix')) . '
  		</div>
		<div id="date-filter-header" class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
	  		<div id="fold-date-button" class="ui-state-default ui-corner-all fold-button fold-button-folded">&nbsp;</div>
	  		<div id="reset-date-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
	  		<div id="general-filter-title">
		  		<span>' . lang::get('LANG_Date_Filter_Title') . '</span>
      		</div>
		</div>
	    <div id="date-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-all">
        	<label for="start_date" >' . lang::get('LANG_Created_Between') . ':</label>
  			<input type="text" size="10" id="start_date" name="start_date" value="' . lang::get('click here') . '" />
  			<input type="hidden" id="real_start_date" name="real_start_date" />
  			<label for="end_date" >' . lang::get('LANG_And') . ':</label>
  			<input type="text" size="10" id="end_date" name="end_date" value="' . lang::get('click here') . '" />
  			<input type="hidden" id="real_end_date" name="real_end_date" />
  		</div>
  		<div id="flower-filter-header" class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
	  		<div id="fold-flower-button" class="ui-state-default ui-corner-all fold-button fold-button-folded">&nbsp;</div>
	  		<div id="reset-flower-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
	  		<div id="flower-filter-title">
		  		<span>' . lang::get('LANG_Flower_Filter_Title') . '</span>
      		</div>
		</div>
		<div id="flower-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-all">
		  ' . data_entry_helper::select($flower_ctrl_args) . '
 		  <input type="text" name="flower:taxon_extra_info" class="taxon-info" value="' . lang::get('LANG_More_Precise') . '"
	 		onclick="if(this.value==\'' . lang::get('LANG_More_Precise') . '\'){this.value=\'\'; this.style.color=\'#000\'}"  
            onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_More_Precise') . '\'; this.style.color=\'#555\'}" />
		  ' . str_replace("\n", "", data_entry_helper::outputAttribute($occurrence_attributes[$args['flower_type_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($location_attributes[$args['habitat_attr_id']], $defAttrOptions)) . '
    	</div>
		<div id="insect-filter-header" class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
	  		<div id="fold-insect-button" class="ui-state-default ui-corner-all fold-button fold-button-folded">&nbsp;</div>
			<div id="reset-insect-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
	  		<div id="insect-filter-title">
		  		<span>' . lang::get('LANG_Insect_Filter_Title') . '</span>
      		</div>
		</div>
		<div id="insect-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-all">
		  ' . data_entry_helper::select($insect_ctrl_args) . '
 		  <input type="text" name="insect:taxon_extra_info" class="taxon-info" value="' . lang::get('LANG_More_Precise') . '"
	 		onclick="if(this.value==\'' . lang::get('LANG_More_Precise') . '\'){this.value=\'\'; this.style.color=\'#000\'}"  
            onblur="if(this.value==\'\'){this.value=\'' . lang::get('LANG_More_Precise') . '\'; this.style.color=\'#555\'}" />
		</div>
		<div id="conditions-filter-header" class="ui-accordion-header ui-helper-reset ui-state-default ui-corner-all">
	  		<div id="fold-conditions-button" class="ui-state-default ui-corner-all fold-button fold-button-folded">&nbsp;</div>
			<div id="reset-conditions-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
	  		<div id="conditions-filter-title">
		  		<span>' . lang::get('LANG_Conditions_Filter_Title') . '</span>
      		</div>
		</div>
		<div id="conditions-filter-body" class="ui-accordion-content ui-helper-reset ui-widget-content ui-corner-all">
    	  ' . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['sky_state_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['temperature_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['wind_attr_id']], $defAttrOptions)) . str_replace("\n", "", data_entry_helper::outputAttribute($sample_attributes[$args['shade_attr_id']], $defAttrOptions)) . '
		</div>
		<div id="location-filter-header" class="ui-accordion-header ui-helper-reset ui-state-active ui-corner-all">
	  		<div id="fold-location-button" class="ui-state-default ui-corner-all fold-button">&nbsp;</div>
			<div id="reset-location-button" class="ui-state-default ui-corner-all reset-button">' . lang::get('LANG_Reset_Filter') . '</div>
			<div id="location-filter-title">
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:67,代码来源:pollenator_gallery.php

示例7: prebuilt_form_picker

 /**
  * Outputs a pair of linked selects, for picking a prebuilt form from the library. The first select is for picking a form 
  * category and the second select is populated by AJAX for picking the actual form.
  * @param array $options Options array with the following possibilities:<ul>
  * <li><b>form</b><br/>
  * Optional. The name of the form to select as a default value.</li>
  * <li><b>includeOutputDiv</b><br/>
  * Set to true to generate a div after the controls which will receive the form parameter
  * controls when a form is selected.</li>
  * <li><b>needWebsiteInputs</b><br/>
  * Defaults to false. In this state, the website ID and password controls are not displayed
  * when both the values are already specified, though hidden inputs are put into the form.
  * When set to true, the website ID and password input controls are always included in the form output.
  * </li>
  * </ul>
  */
 public static function prebuilt_form_picker($options)
 {
     require_once 'data_entry_helper.php';
     form_helper::add_resource('jquery_ui');
     $path = dirname($_SERVER['SCRIPT_FILENAME']) . '/' . self::relative_client_helper_path();
     $r = '';
     if (!($dir = opendir($path . 'prebuilt_forms/'))) {
         throw new Exception('Cannot open path to prebuilt form library.');
     }
     while (false !== ($file = readdir($dir))) {
         $parts = explode('.', $file);
         if ($file != "." && $file != ".." && strtolower($parts[count($parts) - 1]) == 'php') {
             require_once $path . 'prebuilt_forms/' . $file;
             $file_tokens = explode('.', $file);
             ob_start();
             if (is_callable(array('iform_' . $file_tokens[0], 'get_' . $file_tokens[0] . '_definition'))) {
                 $definition = call_user_func(array('iform_' . $file_tokens[0], 'get_' . $file_tokens[0] . '_definition'));
                 $definition['title'] = lang::get($definition['title']);
                 $forms[$definition['category']][$file_tokens[0]] = $definition;
                 if (isset($options['form']) && $file_tokens[0] == $options['form']) {
                     $defaultCategory = $definition['category'];
                 }
             } elseif (is_callable(array('iform_' . $file_tokens[0], 'get_title'))) {
                 $title = call_user_func(array('iform_' . $file_tokens[0], 'get_title'));
                 $forms['Miscellaneous'][$file_tokens[0]] = array('title' => $title);
                 if (isset($options['form']) && $file_tokens[0] == $options['form']) {
                     $defaultCategory = 'Miscellaneous';
                 }
             }
             ob_end_clean();
         }
     }
     if (isset($defaultCategory)) {
         $availableForms = array();
         foreach ($forms[$defaultCategory] as $form => $def) {
             $availableForms[$form] = $def['title'];
         }
     } else {
         $defaultCategory = '';
         $availableForms = array('' => '&lt;Please select a category first&gt;');
     }
     closedir($dir);
     // makes an assoc array from the categories.
     $categories = array_merge(array('' => '&lt;Please select&gt;'), array_combine(array_keys($forms), array_keys($forms)));
     // translate categories
     foreach ($categories as $key => &$value) {
         $value = lang::get($value);
     }
     asort($categories);
     if (isset($options['needWebsiteInputs']) && !$options['needWebsiteInputs'] && !empty($options['website_id']) && !empty($options['password'])) {
         $r .= '<input type="hidden" id="website_id" name="website_id" value="' . $options['website_id'] . '">';
         $r .= '<input type="hidden" id="password" name="password" value="' . $options['password'] . '">';
     } else {
         $r .= data_entry_helper::text_input(array('label' => lang::get('Website ID'), 'fieldname' => 'website_id', 'helpText' => lang::get('Enter the ID of the website record on the Warehouse you are using.'), 'default' => isset($options['website_id']) ? $options['website_id'] : ''));
         $r .= data_entry_helper::text_input(array('label' => lang::get('Password'), 'fieldname' => 'password', 'helpText' => lang::get('Enter the password for the website record on the Warehouse you are using.'), 'default' => isset($options['password']) ? $options['password'] : ''));
     }
     $r .= data_entry_helper::select(array('id' => 'form-category-picker', 'label' => lang::get('Select Form Category'), 'helpText' => lang::get('Select the form category pick a form from.'), 'lookupValues' => $categories, 'default' => $defaultCategory));
     $r .= data_entry_helper::select(array('id' => 'form-picker', 'fieldname' => 'iform', 'label' => lang::get('Select Form'), 'helpText' => lang::get('Select the Indicia form you want to use.'), 'lookupValues' => $availableForms, 'default' => isset($options['form']) ? $options['form'] : ''));
     // div for the form instructions
     $details = '';
     if (isset($options['form'])) {
         if (isset($forms[$defaultCategory][$options['form']]['description'])) {
             $details .= '<p>' . $forms[$defaultCategory][$options['form']]['description'] . '</p>';
         }
         if (isset($forms[$defaultCategory][$options['form']]['helpLink'])) {
             $details .= '<p><a href="' . $forms[$defaultCategory][$options['form']]['helpLink'] . '">Find out more...</a></p>';
         }
         if ($details !== '') {
             $details = "<div class=\"ui-state-highlight ui-corner-all page-notice\">{$details}</div>";
         }
     }
     $r .= "<div id=\"form-def\">{$details}</div>\n";
     $r .= '<input type="button" value="' . lang::get('Load Settings Form') . '" id="load-params" disabled="disabled" />';
     if (isset($options['includeOutputDivs']) && $options['includeOutputDivs']) {
         $r .= '<div id="form-params"></div>';
     }
     self::add_form_picker_js($forms);
     return $r;
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:95,代码来源:form_helper.php

示例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 $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;
 }
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:77,代码来源:easy_download_2.php

示例9: get_form

 /**
  * Return the generated form output.
  * @param array $args List of parameter values passed through to the form depending on how the form has been configured.
  * This array always contains a value for language.
  * @param object $node The Drupal node object.
  * @param array $response When this form is reloading after saving a submission, contains the response from the service call.
  * Note this does not apply when redirecting (in this case the details of the saved object are in the $_GET data).
  * @return Form HTML.
  * @todo: Implement this method 
  */
 public static function get_form($args, $node, $response = null)
 {
     if (empty($_GET['group_id'])) {
         return 'This page needs a group_id URL parameter.';
     }
     require_once 'includes/map.php';
     require_once 'includes/groups.php';
     global $indicia_templates;
     iform_load_helpers(array('report_helper', 'map_helper'));
     $conn = iform_get_connection_details($node);
     $readAuth = report_helper::get_read_auth($conn['website_id'], $conn['password']);
     report_helper::$javascript .= "indiciaData.website_id={$conn['website_id']};\n";
     report_helper::$javascript .= "indiciaData.nodeId={$node->nid};\n";
     group_authorise_form($args, $readAuth);
     $group = data_entry_helper::get_population_data(array('table' => 'group', 'extraParams' => $readAuth + array('id' => $_GET['group_id'], 'view' => 'detail')));
     $group = $group[0];
     hostsite_set_page_title("{$group['title']}: {$node->title}");
     $actions = array();
     if (!empty($args['edit_location_path'])) {
         $actions[] = array('caption' => 'edit', 'url' => '{rootFolder}' . $args['edit_location_path'], 'urlParams' => array('group_id' => $_GET['group_id'], 'location_id' => '{location_id}'));
     }
     $actions[] = array('caption' => 'remove', 'javascript' => "remove_location_from_group({groups_location_id});");
     $leftcol = report_helper::report_grid(array('readAuth' => $readAuth, 'dataSource' => 'library/locations/locations_for_groups', 'sendOutputToMap' => true, 'extraParams' => array('group_id' => $_GET['group_id']), 'rowId' => 'location_id', 'columns' => array(array('display' => 'Actions', 'actions' => $actions, 'caption' => 'edit', 'url' => '{rootFolder}'))));
     $leftcol .= '<fieldset><legend>' . lang::Get('Add sites to the group') . '</legend>';
     $leftcol .= '<p>' . lang::get('LANG_Add_Sites_Instruct') . '</p>';
     if (!empty($args['edit_location_path'])) {
         $leftcol .= lang::get('Either') . ' <a class="button" href="' . hostsite_get_url($args['edit_location_path'], array('group_id' => $_GET['group_id'])) . '">' . lang::get('enter details of a new site') . '</a><br/>';
     }
     $leftcol .= data_entry_helper::select(array('label' => lang::get('Or, add an existing site'), 'fieldname' => 'add_existing_location_id', 'report' => 'library/locations/locations_available_for_group', 'caching' => false, 'blankText' => lang::get('<please select>'), 'valueField' => 'location_id', 'captionField' => 'name', 'extraParams' => $readAuth + array('group_id' => $_GET['group_id'], 'user_id' => hostsite_get_user_field('indicia_user_id', 0)), 'afterControl' => '<button id="add-existing">Add</button>'));
     $leftcol .= '</fieldset>';
     // @todo Link existing My Site to group. Need a new report to list sites I created, with sites already in the group
     // removed. Show in a drop down with an add button. Adding must create the groups_locations record, plus refresh
     // the grid and refresh the drop down.
     // @todo set destination after saving added site
     $map = map_helper::map_panel(iform_map_get_map_options($args, $readAuth), iform_map_get_ol_options($args));
     $r = str_replace(array('{col-1}', '{col-2}'), array($leftcol, $map), $indicia_templates['two-col-50']);
     data_entry_helper::$javascript .= "indiciaData.group_id={$_GET['group_id']};\n";
     return $r;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:49,代码来源:group_locations.php

示例10: link_to_group_fields

 /**
  * If there are any recording groups, then add controls to the config to allow the forms to be linked to the recording group
  * functionality.
  */
 private static function link_to_group_fields($readAuth, $options)
 {
     $r = '';
     if (function_exists('db_query')) {
         $qry = db_query("SELECT count(*) as count FROM {iform} WHERE iform='group_edit'");
         if (function_exists('db_fetch_object')) {
             $row = db_fetch_object($qry);
         } else {
             $row = $qry->fetchObject();
         }
         if ($row->count > 0) {
             $r .= data_entry_helper::checkbox(array('label' => lang::get('Allow this form to be used by recording groups'), 'fieldname' => 'available_for_groups', 'helpText' => lang::get('Tick this box if the form is suitable for use by recording groups for their own record collection or reporting.'), 'default' => isset($options['available_for_groups']) ? $options['available_for_groups'] : false));
             $r .= data_entry_helper::select(array('label' => lang::get('Restrict to a recording group'), 'fieldname' => 'limit_to_group_id', 'helpText' => lang::get('If this form is being built for the private use of 1 recording group, then choose that group here. ' . 'This does not affect visibility of the actual records input using the form. Only applies if the above checkbox is ticked.'), 'blankText' => '<' . lang::get('Unrestricted') . '>', 'table' => 'group', 'valueField' => 'id', 'captionField' => 'title', 'extraParams' => $readAuth, 'default' => isset($options['limit_to_group_id']) ? $options['limit_to_group_id'] : false));
         }
     }
     return $r;
 }
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:21,代码来源:form_helper.php

示例11: get_control_locationtype

 protected static function get_control_locationtype($auth, $args, $tabalias, $options)
 {
     // To limit the terms listed add a terms option to the Form Structure as a JSON array.
     // The terms must exist in the termlist that has external key indidia:location_types
     // e.g.
     // [location type]
     // @terms=["City","Town","Village"]
     // get the list of terms
     $filter = null;
     if (array_key_exists('terms', $options)) {
         $filter = $options['terms'];
     }
     $terms = helper_base::get_termlist_terms($auth, 'indicia:location_types', $filter);
     if (count($terms) == 1) {
         //only one location type so output as hidden control
         return '<input type="hidden" id="location:location_type_id" name="location:location_type_id" value="' . $terms[0]['id'] . '" />' . PHP_EOL;
     } elseif (count($terms) > 1) {
         // convert the $terms to an array of id => term
         $lookup = array();
         foreach ($terms as $term) {
             $lookup[$term['id']] = $term['term'];
         }
         return data_entry_helper::select(array_merge(array('label' => lang::get('LANG_Location_Type'), 'fieldname' => 'location:location_type_id', 'lookupValues' => $lookup, 'blankText' => lang::get('LANG_Blank_Text')), $options));
     }
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:25,代码来源:dynamic_location.php

示例12: location_control

 private static function location_control($args, $readAuth, $node, &$options)
 {
     // note that when in user specific mode it returns the list currently assigned to the user: it does not give
     // locations which the user previously recorded data against, but is no longer allocated to.
     global $user;
     $ctrl = '';
     $siteUrlParams = self::get_site_url_params();
     // loctools is not appropriate here as it is based on a node, for which this is a very simple one, invoking other nodes for the sample creation
     if (!isset($args['includeLocationFilter']) || !$args['includeLocationFilter']) {
         return '';
     }
     // this is user specific: when no user selection control, or all users selected then default to all locations
     // this means it does not get a list of all locations if no user is selected: to be added later?
     $options['location_id'] = $siteUrlParams[self::$locationKey]['value'];
     $options['extraParams']['location_id'] = $siteUrlParams[self::$locationKey]['value'];
     $options['extraParams']['location_list'] = '';
     // Set up common data.
     $locationListArgs = array('extraParams' => array_merge(array('website_id' => $args['website_id'], 'location_type_id' => '', 'sensattr' => '', 'exclude_sensitive' => 0), $readAuth), 'readAuth' => $readAuth, 'caching' => true, 'dataSource' => 'library/locations/locations_list_exclude_sensitive');
     $allowSensitive = empty($args['sensitivityLocAttrId']) || function_exists('user_access') && !empty($args['sensitivityAccessPermission']) && user_access($args['sensitivityAccessPermission']);
     if (!empty($args['sensitivityLocAttrId'])) {
         $locationListArgs['extraParams']['locattrs'] = $args['sensitivityLocAttrId'];
     }
     $attrArgs = array('valuetable' => 'location_attribute_value', 'attrtable' => 'location_attribute', 'key' => 'location_id', 'fieldprefix' => 'locAttr', 'extraParams' => $readAuth, 'survey_id' => self::$siteUrlParams[self::$SurveyKey]);
     if (isset($args['locationTypesFilter']) && $args['locationTypesFilter'] != "") {
         $types = explode(',', $args['locationTypesFilter']);
         $types1 = array();
         $types2 = array();
         foreach ($types as $type) {
             $parts = explode(':', $type);
             $types1[] = $parts[0];
             $types2[] = $parts;
         }
         $terms = self::get_sorted_termlist_terms(array('read' => $readAuth), 'indicia:location_types', $types1);
         $attrArgs['location_type_id'] = $siteUrlParams[self::$locationTypeKey]['value'];
         $locationListArgs['extraParams']['location_type_id'] = $siteUrlParams[self::$locationTypeKey]['value'];
         if (count($types) > 1) {
             $lookUpValues = array();
             foreach ($terms as $termDetails) {
                 $lookUpValues[$termDetails['id']] = $termDetails['term'];
             }
             // if location is predefined, can not change unless a 'manager_permission'
             $ctrlid = 'calendar-location-type-' . $node->nid;
             $ctrl .= data_entry_helper::select(array('label' => lang::get('Site Type'), 'id' => $ctrlid, 'fieldname' => 'location_type_id', 'lookupValues' => $lookUpValues, 'default' => $siteUrlParams[self::$locationTypeKey]['value'])) . '</th><th>';
             self::set_up_control_change($ctrlid, self::$locationTypeKey, array());
             $options['downloadFilePrefix'] .= preg_replace('/[^A-Za-z0-9]/i', '', $lookUpValues[$siteUrlParams[self::$locationTypeKey]['value']]) . '_';
         }
     }
     $locationAttributes = data_entry_helper::getAttributes($attrArgs, false);
     $locationList = array();
     // If we are looking a user, then we display all that users sites. If I am that user, or if I am a person with sensitive access, then I can see all the sites, even sensitive.
     if (isset($args['includeUserFilter']) && $args['includeUserFilter'] && isset($args['userSpecificLocationLookUp']) && $args['userSpecificLocationLookUp'] && isset($options['user_id']) && $options['user_id'] != "" && $siteUrlParams[self::$userKey]['value'] != "branch") {
         if (!$allowSensitive && $options['user_id'] != $user->uid) {
             // ensure can see sensitive sites for my sites only, unless manager who can see all
             $locationListArgs['extraParams']['sensattr'] = $args['sensitivityLocAttrId'];
             $locationListArgs['extraParams']['exclude_sensitive'] = 1;
         }
         $cmsAttr = extract_cms_user_attr($locationAttributes, false);
         if (!$cmsAttr) {
             return lang::get('Location control: CMS User ID Attribute missing from locations.');
         }
         $attrListArgs = array('extraParams' => array_merge(array('view' => 'list', 'website_id' => $args['website_id'], 'location_attribute_id' => $cmsAttr['attributeId'], 'raw_value' => $options['user_id']), $readAuth), 'table' => 'location_attribute_value');
         $description = "All " . ($user->uid == $options['user_id'] ? 'my' : 'user') . " sites";
         $attrList = data_entry_helper::get_population_data($attrListArgs);
         if (isset($attrList['error'])) {
             return $attrList['error'];
         }
         if (count($attrList) === 0) {
             $options['downloadFilePrefix'] .= 'NS_';
             return $ctrl . lang::get('[No sites allocated.]');
         }
         $locationIDList = array();
         foreach ($attrList as $attr) {
             $locationIDList[] = $attr['location_id'];
         }
         $locationListArgs['extraParams']['idlist'] = implode(',', $locationIDList);
         $locationList = report_helper::get_report_data($locationListArgs);
         if (isset($locationList['error'])) {
             return $locationList['error'];
         }
     } else {
         // If we are looking at a branch, we can see all the sites allocated to me even sensitive.
         if (isset($args['includeUserFilter']) && $args['includeUserFilter'] && isset($args['userSpecificLocationLookUp']) && $args['userSpecificLocationLookUp'] && $siteUrlParams[self::$userKey]['value'] == "branch") {
             $description = "All branch sites";
             if (count(self::$branchLocationList) === 0) {
                 $options['downloadFilePrefix'] .= 'NS_';
                 return $ctrl . lang::get('[No branch sites allocated.]');
             }
             $locationListArgs['extraParams']['idlist'] = implode(',', self::$branchLocationList);
             $locationList = report_helper::get_report_data($locationListArgs);
             if (isset($locationList['error'])) {
                 return $locationList['error'];
             }
             $options['extraParams']['location_list'] = implode(',', self::$branchLocationList);
             $options['branch_location_list'] = self::$branchLocationList;
         } else {
             // If we are looking at all sites, we can see all non sensitive sites, plus sensitive sites if they are allocated to me as a site or as a branch, or if I have access to sensitive.
             $description = "All sites";
             $locationListArgs['extraParams']['idlist'] = '';
             // get my sites, including sensitive sites.
             $cmsAttr = extract_cms_user_attr($locationAttributes, false);
//.........这里部分代码省略.........
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:101,代码来源:report_calendar_summary_2.php

示例13: sensitivity_input

 /**
  * Helper function to output a set of controls for handling the sensitivity of a record. Includes
  * a checkbox plus a control for setting the amount to blur the record by for public viewing.
  * The output of this control can be configured using the following templates: 
  * <ul>
  * <li><b>hidden_text</b></br>
  * HTML template used to generate the hidden input element.
  * </li>
  * </ul>
  *
  * @param array $options Options array with the following possibilities:<ul>
  * <li><b>fieldname</b><br/>
  * Required. The name of the database field this control is bound to. Defaults to occurrence:sensitivity_precision.</li>
  * <li><b>defaultBlur</b><br/>
  * Optional. The initial value to blur a record by when assigning sensitivity. Defaults to 10000.</li>
  * <li><b>additionalControls</b><br/>
  * Optional. Any additional controls to include in the div which is disabled when a record is not sensitive. An example use of this
  * might be a Reason for sensitivity custom attribute. Provide the controls as an HTML string.</li>
  * </ul>
  *
  * @return string HTML to insert into the page for the hidden text control.
  */
 public static function sensitivity_input($options)
 {
     $options = array_merge(array('fieldname' => 'occurrence:sensitivity_precision', 'defaultBlur' => 10000, 'additionalControls' => ''), $options);
     $r = '<fieldset><legend>' . lang::get('Sensitivity') . '</legend>';
     $r .= data_entry_helper::checkbox(array('id' => 'sensitive-checkbox', 'fieldname' => 'sensitive', 'label' => lang::get('Is the record sensitive?')));
     // Put a hidden input out, so that when the select control is disabled we get an empty value posted to clear the sensitivity
     $r .= '<input type="hidden" name="' . $options['fieldname'] . '">';
     $r .= '<div id="sensitivity-controls">';
     $r .= data_entry_helper::select(array('fieldname' => $options['fieldname'], 'id' => 'sensitive-blur', 'label' => lang::get('Blur record to'), 'lookupValues' => array('100' => lang::get('Blur to 100m'), '1000' => lang::get('Blur to 1km'), '2000' => lang::get('Blur to 2km'), '10000' => lang::get('Blur to 10km'), '100000' => lang::get('Blur to 100km')), 'blankText' => 'none', 'helpText' => 'This is the precision that the record will be shown at for public viewing'));
     // output any extra controls which should get disabled when the record is not sensitive.
     $r .= $options['additionalControls'];
     $r .= '</div></fieldset>';
     self::$javascript .= "\nvar doSensitivityChange = function(evt) {\n  if (\$('#sensitive-checkbox').attr('checked')) {\n    \$('#sensitivity-controls input, #sensitivity-controls select').removeAttr('disabled');\n  } else {\n    \$('#sensitivity-controls input, #sensitivity-controls select').attr('disabled', true);\n  }\n  \$('#sensitivity-controls').css('opacity', \$('#sensitive-checkbox').attr('checked') ? 1 : .5);\n  if (\$('#sensitive-checkbox').attr('checked')=== true && typeof evt!=='undefined' && \$('#sensitive-blur').val()==='') {\n    // set a default\n    \$('#sensitive-blur').val('" . $options['defaultBlur'] . "');\n  } \n  else if (typeof evt!=='undefined') {\n    \$('#sensitive-blur').val('');\n  }\n};\n\$('#sensitive-checkbox').change(doSensitivityChange);\n\$('#sensitive-checkbox').attr('checked', \$('#sensitive-blur').val()==='' ? false : true);\ndoSensitivityChange();\n\$('#sensitive-blur').change(function() {\n  if (\$('#sensitive-blur').val()==='') {\n    \$('#sensitive-checkbox').attr('checked', false);\n    doSensitivityChange();\n  }\n});\n\n";
     return $r;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:37,代码来源:data_entry_helper.php

示例14: 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 post records for the {1}', self::$groupType) . '</legend>';
         $r .= '<p>' . lang::get('LANG_Record_Inclusion_Instruct_1', self::$groupType, lang::get("group's")) . ' ';
         if ($args['include_sensitivity_controls']) {
             $r .= lang::get('LANG_Record_Inclusion_Instruct_Sensitive') . ' ';
         }
         $r .= lang::get('LANG_Record_Inclusion_Instruct_1', self::$groupType, ucfirst(self::$groupType)) . '</p>';
         $r .= data_entry_helper::select(array('fieldname' => 'group:implicit_record_inclusion', 'label' => lang::get('Records are included in the {1} if', self::$groupType), 'lookupValues' => array('t' => lang::get('they match the filter defined above'), 'f' => lang::get('they were recorded on a group data entry form'))));
         $r . ' </fieldset>';
     }
     return $r;
 }
开发者ID:joewoodhouse,项目名称:client_helpers,代码行数:23,代码来源:group_edit.php

示例15: species_checklist_prepare_attributes

 /**
  * Internal function to prepare the list of occurrence attribute columns for a species_checklist control.
  */
 private static function species_checklist_prepare_attributes($options, $attributes, &$occAttrControls, &$occAttrs)
 {
     $idx = 0;
     if (array_key_exists('occAttrs', $options)) {
         $attrs = $options['occAttrs'];
     } else {
         // There is no specified list of occurrence attributes, so use all available for the survey
         $attrs = array_keys($attributes);
     }
     foreach ($attrs as $occAttrId) {
         // test that this occurrence attribute is linked to the survey
         if (!isset($attributes[$occAttrId])) {
             throw new Exception('The occurrence attributes requested for the grid are not linked with the survey.');
         }
         $attrDef = $attributes[$occAttrId];
         $occAttrs[$occAttrId] = $attrDef['caption'];
         // Get the control class if available. If the class array is too short, the last entry gets reused for all remaining.
         $class = array_key_exists('occAttrClasses', $options) && $idx < count($options['occAttrClasses']) ? $options['occAttrClasses'][$idx] : strtolower(str_replace(' ', '_', $attrDef['caption']));
         // provide a default class based on the control caption
         // Build the correct control
         switch ($attrDef['data_type']) {
             case 'L':
                 $tlId = $attrDef['termlist_id'];
                 $occAttrControls[$occAttrId] = data_entry_helper::select(array('fieldname' => '{fieldname}', 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'extraParams' => $options['readAuth'] + array('termlist_id' => $tlId), 'class' => $class, 'blankText' => ''));
                 break;
             case 'D':
             case 'V':
                 // Date-picker control
                 $occAttrControls[$occAttrId] = '<input type="text" class="date $class" ' . 'id="{fieldname}" name="{fieldname}" ' . "value=\"" . lang::get('click here') . "\"/>";
                 break;
             default:
                 $occAttrControls[$occAttrId] = "<input type=\"text\" id=\"{fieldname}\" name=\"{fieldname}\" class=\"{$class}\" value=\"\" />";
                 break;
         }
         $idx++;
     }
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:40,代码来源:data_entry_helper.php


注:本文中的data_entry_helper::select方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。