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


PHP data_entry_helper::file_box方法代码示例

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


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

示例1: get_media_tab

 /**
  * Return the generated output for the media grid tab.
  * @param array $args List of parameter values passed through to the form depending on how the form has been configured.
  *                    This array always contains a value for language.
  * @param integer $nid The Drupal node object's ID.
  * @param object $auth The full read-write authorisation.
  * @return HTML.
  */
 private static function get_media_tab($args, $nid, $auth)
 {
     global $user;
     data_entry_helper::add_resource('fancybox');
     data_entry_helper::add_resource('plupload');
     data_entry_helper::add_resource('jquery_ui');
     $limit1 = $args['sample_attribute_id_1_limit'];
     $limit2 = $args['sample_attribute_id_2_limit'];
     if (!isset($args['sample_attribute_id_2']) || $args['sample_attribute_id_2'] == "") {
         $limit2 = 1;
         $caption2 = "";
     } else {
         $caption2 = $attributesIdx[$args['sample_attribute_id_2']]['caption'];
     }
     $attributesIdx = data_entry_helper::getAttributes(array('valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => 'smpAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id'], 'sample_method_id' => $args['quadrat_level_sample_method_id'], 'multiValue' => false));
     $scd = isset($args['site_caption_differentiator']) && $args['site_caption_differentiator'] != "" ? explode(',', $args['site_caption_differentiator']) : array('1');
     $qcd = isset($args['quadrat_caption_differentiator']) && $args['quadrat_caption_differentiator'] != "" ? explode(',', $args['quadrat_caption_differentiator']) : array('1');
     $bumpf = isset($args['media_tab_bumpf']) && $args['media_tab_bumpf'] != "" ? $args['media_tab_bumpf'] : lang::get('Please use the caption field to indicate whether the image is of a particular ' . (count($qcd) > 1 ? 'aspect of a ' : '') . $attributesIdx[$args['sample_attribute_id_1']]['caption'] . ', or the shore/site.') . ' ' . lang::get('When you start typing you should see a set of appropriate options from which you can choose: this will guide you to enter the correct value and format. Alternative just pressing the down arrow key should give the full list.');
     //    'description'=>'Format is <x>:<n>=<txt>:<n>=<txt>[,<x>:<n>=<txt>:<n>=<txt>] where <x> is the attribute id, <n> is the attribute value, and <txt> is the replacement value to be used in the template.',
     $mappings = isset($args['quadrat_caption_attribute_mapping']) ? explode(',', $args['quadrat_caption_attribute_mapping']) : array();
     $mappingsList = array();
     foreach ($mappings as $mapping) {
         $parts = explode(':', $mapping);
         $map = array();
         for ($i = 1; $i < count($parts); $i++) {
             // skip first
             $map[] = explode('=', $parts[$i]);
         }
         $mappingsList['attr' . $parts[0]] = $map;
     }
     data_entry_helper::$javascript .= "indiciaData.limit1={$limit1};\r\nindiciaData.site_caption_template='" . (isset($args['site_caption_template']) ? $args['site_caption_template'] : 'Site') . "';\r\nindiciaData.site_caption_differentiator=" . json_encode($scd) . ";\r\nindiciaData.limit2={$limit2};\r\nindiciaData.quadrat_caption_template='" . str_replace(array('{caption1}', '{caption2}'), array($attributesIdx[$args['sample_attribute_id_1']]['caption'], $caption2), isset($args['quadrat_caption_template']) ? $args['quadrat_caption_template'] : '{caption1} {N1}') . "';\r\nindiciaData.quadrat_caption_differentiator=" . json_encode($qcd) . ";\r\nindiciaData.quadrat_caption_attribute_mapping=" . json_encode($mappingsList) . ";\r\n";
     $r = '<div id="media">' . '<p class="ui-state-highlight page-notice ui-corner-all">' . $bumpf . '<span style="display:none;">' . 'MEM:' . ini_get('memory_limit') . ' FILE:' . ini_get('upload_max_filesize') . ' POST:' . ini_get('post_max_size') . '</span>' . '<br/>' . lang::get('The maximum number of files you can upload is ') . (count($scd) + count($qcd) * $limit1 * $limit2) . '. The maximum filesize you can upload is 4M - the images will be resized to a maximum of 1500 pixels high or wide, to ensure this is the case.' . '.<p>' . data_entry_helper::file_box(array('table' => 'sample_medium', 'caption' => lang::get('Photos'), 'codeGenerated' => 'all', 'maxFileCount' => count($scd) + count($qcd) * $limit1 * $limit2, 'file_box_uploaded_extra_fieldsTemplate' => '<input type="hidden" name="{idField}" id="{idField}" value="{idValue}" />' . '<input type="hidden" name="{pathField}" id="{pathField}" value="{pathValue}" />' . '<input type="hidden" name="{typeField}" id="{typeField}" value="{typeValue}" />' . '<input type="hidden" name="{typeNameField}" id="{typeNameField}" value="{typeNameValue}" />' . '<input type="hidden" name="{deletedField}" id="{deletedField}" value="{deletedValue}" class="deleted-value" />' . '<input type="hidden" id="{isNewField}" value="{isNewValue}" />' . '<label for="{captionField}">Caption:</label><br/><input type="text" list="captions" maxlength="100" style="width: {imagewidth}px" name="{captionField}" id="{captionField}" value="{captionValue}"/>', 'resizeWidth' => '1500', 'resizeHeight' => '1500')) . (self::$readOnly ? '' : '<br/><input type="submit" value="' . lang::get('Save') . '" title="' . lang::get('Saves any data entered across all the tabs.') . '" />') . '<datalist id="captions"></datalist>' . '</div>';
     $typeTermData = data_entry_helper::get_population_data(array('table' => 'termlists_term', 'extraParams' => $auth['read'] + array('view' => 'cache', 'termlist_title' => 'Media types', 'columns' => 'id,term')));
     $typeTermIdLookup = array();
     foreach ($typeTermData as $record) {
         $typeTermIdLookup[$record['term']] = $record['id'];
     }
     data_entry_helper::$javascript .= "indiciaData.mediaTypeTermIdLookup=" . json_encode($typeTermIdLookup) . ";\n";
     return $r;
 }
开发者ID:Indicia-Team,项目名称:CoCoast,代码行数:48,代码来源:cocoast_transect_quadrat_input_sample.php

示例2: get_sample_form

 public static function get_sample_form($args, $node, $response)
 {
     global $user;
     if (!module_exists('iform_ajaxproxy')) {
         return 'This form must be used in Drupal with the Indicia AJAX Proxy module enabled.';
     }
     iform_load_helpers(array('map_helper'));
     $auth = data_entry_helper::get_read_write_auth($args['website_id'], $args['password']);
     $sampleId = isset($_GET['sample_id']) ? $_GET['sample_id'] : null;
     $locationId = null;
     if ($sampleId) {
         data_entry_helper::load_existing_record($auth['read'], 'sample', $sampleId, 'detail', false, true);
         $locationId = data_entry_helper::$entity_to_load['sample:location_id'];
     } else {
         // location ID also might be in the $_POST data after a validation save of a new record
         if (isset($_POST['sample:location_id'])) {
             $locationId = $_POST['sample:location_id'];
         }
     }
     $url = explode('?', $args['my_obs_page'], 2);
     $params = NULL;
     $fragment = NULL;
     // fragment is always at the end.
     if (count($url) > 1) {
         $params = explode('#', $url[1], 2);
         if (count($params) > 1) {
             $fragment = $params[1];
         }
         $params = $params[0];
     } else {
         $url = explode('#', $url[0], 2);
         if (count($url) > 1) {
             $fragment = $url[1];
         }
     }
     $args['my_obs_page'] = url($url[0], array('query' => $params, 'fragment' => $fragment, 'absolute' => TRUE));
     $r = '<form method="post" id="sample">';
     $r .= $auth['write'];
     $r .= '<input type="hidden" name="page" value="mainSample"/>';
     $r .= '<input type="hidden" name="website_id" value="' . $args['website_id'] . '"/>';
     if (isset(data_entry_helper::$entity_to_load['sample:id'])) {
         $r .= '<input type="hidden" name="sample:id" value="' . data_entry_helper::$entity_to_load['sample:id'] . '"/>';
     }
     $r .= '<input type="hidden" name="sample:survey_id" value="' . $args['survey_id'] . '"/>';
     $r .= '<div id="cols" class="ui-helper-clearfix"><div class="left" style="width: ' . (98 - (isset($args['percent_width']) ? $args['percent_width'] : 50)) . '%">';
     // Output only the locations for this website and location type.
     $availableSites = data_entry_helper::get_population_data(array('report' => 'library/locations/locations_list', 'extraParams' => $auth['read'] + array('website_id' => $args['website_id'], 'location_type_id' => $args['locationType'], 'locattrs' => 'CMS User ID', 'attr_location_cms_user_id' => $user->uid), 'nocache' => true));
     // convert the report data to an array for the lookup, plus one to pass to the JS so it can keep the map updated
     $sitesLookup = array();
     $sitesIds = array();
     $sitesJs = array();
     foreach ($availableSites as $site) {
         $sitesLookup[$site['location_id']] = $site['name'];
         $sitesIds[] = $site['location_id'];
     }
     $sites = data_entry_helper::get_population_data(array('table' => 'location', 'extraParams' => $auth['read'] + array('website_id' => $args['website_id'], 'id' => $sitesIds, 'view' => 'detail')));
     foreach ($sites as $site) {
         $sitesJs[$site['id']] = $site;
     }
     data_entry_helper::$javascript .= "indiciaData.sites = " . json_encode($sitesJs) . ";\n";
     if ($locationId) {
         $r .= '<input type="hidden" name="sample:location_id" id="sample_location_id" value="' . $locationId . '"/>';
         // for reload of existing, don't let the user switch the square as that could mess everything up.
         $r .= '<label>' . lang::get('1km square') . ':</label><span>' . $sitesJs[$locationId]['name'] . '</span><br/>' . lang::get('<p class="ui-state-highlight page-notice ui-corner-all">Please use the map to select a more precise location for your timed observation.</p>');
     } else {
         $options = array('label' => lang::get('Select 1km square'), 'validation' => array('required'), 'blankText' => lang::get('Please select'), 'lookupValues' => $sitesLookup, 'id' => "sample_location_id");
         // if ($locationId) $options['default'] = $locationId;
         $r .= data_entry_helper::location_select($options) . lang::get('<p class="ui-state-highlight page-notice ui-corner-all">After selecting the 1km square, use the map to select a more precise location for your timed observation.</p>');
     }
     // [spatial reference]
     $systems = array();
     foreach (explode(',', str_replace(' ', '', $args['spatial_systems'])) as $system) {
         $systems[$system] = lang::get("sref:{$system}");
     }
     $r .= data_entry_helper::sref_and_system(array('label' => lang::get('Grid Ref'), 'systems' => $systems));
     $r .= data_entry_helper::file_box(array('table' => 'sample_image', 'readAuth' => $auth['read'], 'caption' => lang::get('Upload photo(s) of timed search area')));
     $sampleMethods = helper_base::get_termlist_terms($auth, 'indicia:sample_methods', array('Field Observation'));
     $attributes = data_entry_helper::getAttributes(array('id' => $sampleId, 'valuetable' => 'sample_attribute_value', 'attrtable' => 'sample_attribute', 'key' => 'sample_id', 'fieldprefix' => 'smpAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id'], 'sample_method_id' => $sampleMethods[0]['id']));
     $r .= get_user_profile_hidden_inputs($attributes, $args, '', $auth['read']);
     if (isset($_GET['date'])) {
         $r .= '<input type="hidden" name="sample:date" value="' . $_GET['date'] . '"/>';
         $r .= '<label>' . lang::get('Date') . ':</label> <span class="value-label">' . $_GET['date'] . '</span><br/>';
     } else {
         if (isset(data_entry_helper::$entity_to_load['sample:date']) && preg_match('/^(\\d{4})/', data_entry_helper::$entity_to_load['sample:date'])) {
             // Date has 4 digit year first (ISO style) - convert date to expected output format
             // @todo The date format should be a global configurable option. It should also be applied to reloading of custom date attributes.
             $d = new DateTime(data_entry_helper::$entity_to_load['sample:date']);
             data_entry_helper::$entity_to_load['sample:date'] = $d->format('d/m/Y');
         }
         $r .= data_entry_helper::date_picker(array('label' => lang::get('Date'), 'fieldname' => 'sample:date'));
     }
     // are there any option overrides for the custom attributes?
     if (isset($args['custom_attribute_options']) && $args['custom_attribute_options']) {
         $blockOptions = get_attr_options_array_with_user_data($args['custom_attribute_options']);
     } else {
         $blockOptions = array();
     }
     $r .= get_attribute_html($attributes, $args, array('extraParams' => $auth['read']), null, $blockOptions);
     $r .= '<input type="hidden" name="sample:sample_method_id" value="' . $sampleMethods[0]['id'] . '" />';
     $r .= '<input type="submit" value="' . lang::get('Next') . '" />';
//.........这里部分代码省略.........
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:101,代码来源:ukbms_timed_observations.php

示例3: get_control_speciesattributes

 /**
  * Get the block of custom attributes at the species (occurrence) level
  */
 private static function get_control_speciesattributes($auth, $args, $tabalias, $options)
 {
     if (!self::getGridMode($args)) {
         // Add any dynamically generated controls
         $attrArgs = array('valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => 'occAttr', 'extraParams' => $auth['read'], 'survey_id' => $args['survey_id']);
         if (count(self::$occurrenceIds) == 1) {
             // if we have a single occurrence Id to load, use it to get attribute values
             $attrArgs['id'] = self::$occurrenceIds[0];
         }
         $attributes = data_entry_helper::getAttributes($attrArgs);
         $defAttrOptions = array('extraParams' => $auth['read']);
         $r = self::get_attribute_html($attributes, $args, $defAttrOptions);
         if ($args['occurrence_comment']) {
             $r .= data_entry_helper::textarea(array('fieldname' => 'occurrence:comment', 'label' => lang::get('Record Comment')));
         }
         if ($args['occurrence_images']) {
             $opt = array('table' => 'occurrence_image', 'label' => lang::get('Upload your photos'));
         }
         if ($args['interface'] !== 'one_page') {
             $opts['tabDiv'] = $tabalias;
         }
         $r .= data_entry_helper::file_box($opts);
         return $r;
     } else {
         // in grid mode the attributes are embedded in the grid.
         return '';
     }
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:31,代码来源:mnhnl_dynamic_1.php

示例4: occurrence_photo_input

 /**
  * Provides a control for inputting photos against the record, when in single record mode.
  *
  * @param array $readAuth Read authorisation tokens
  * @param array $options Options array for the control.
  * @param string $tabAlias ID of the tab's div if this is being loaded onto a div.
  */
 protected static function occurrence_photo_input($readAuth, $options, $tabAlias, $args)
 {
     $opts = array('table' => 'occurrence_image', 'readAuth' => $readAuth, 'label' => lang::get('Upload your photos'), 'caption' => lang::get('Photos'), 'resizeWidth' => 1600, 'resizeHeight' => 1600, 'readAuth' => $readAuth);
     if ($args['interface'] !== 'one_page') {
         $opts['tabDiv'] = $tabAlias;
     }
     foreach ($options as $key => $value) {
         // skip attribute specific options as they break the JavaScript.
         if (strpos($key, ':') === false) {
             $opts[$key] = $value;
         }
     }
     return data_entry_helper::file_box($opts);
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:21,代码来源:dynamic_sample_occurrence.php

示例5: get_control_speciesidentifier


//.........这里部分代码省略.........
     $r .= self::get_control_identifier($auth, $args, $tabalias, $options);
     if (!empty($args['enscribed_colour_ring_regex'])) {
         unset($options['seq_format_class']);
     }
     // setup and call function for metal ring
     $options['identifierName'] = '';
     $options['identifierTypeId'] = '';
     foreach ($options['identifierTypes'] as $identifier_type) {
         if ($identifier_type['id'] == $args['metal_ring_type']) {
             $options['identifierName'] = $identifier_type['term'];
             $options['identifierTypeId'] = $identifier_type['id'];
             break;
         }
     }
     $options['attrList'] = array(array('attrType' => 'idn', 'typeId' => $options['positionId'], 'lockable' => true, 'hidden' => false), array('attrType' => 'idn', 'typeId' => $options['sequenceId'], 'lockable' => false, 'hidden' => false), array('attrType' => 'iso', 'typeId' => $options['conditionsId'], 'lockable' => false, 'hidden' => false));
     $options['fieldprefix'] = 'idn:' . $taxIdx . ':metal:';
     $options['classprefix'] = 'idn-metal-';
     $options['seq_maxlength'] = !empty($args['metal_ring_max_length']) ? $args['metal_ring_max_length'] : '';
     $options['seq_maxlength'] = !empty($args['metal_ring_max_length']) ? $args['metal_ring_max_length'] : '';
     if (!empty($args['metal_ring_regex'])) {
         $options['seq_format_class'] = 'metalRingFormat';
     }
     $r .= self::get_control_identifier($auth, $args, $tabalias, $options);
     if (!empty($args['metal_ring_regex'])) {
         unset($options['seq_format_class']);
     }
     unset($options['seq_maxlength']);
     $r .= '</div>';
     // end of identifier accordion
     // other devices (trackers etc.)
     if ($options['attachmentId'] > 0 && !empty($args['other_devices']) && count($args['other_devices']) > 0) {
         // reset prefix
         $options['fieldprefix'] = 'idn:' . $taxIdx . ':';
         // filter the devices available
         $query = array('in' => array('id', $args['other_devices']));
         $filter = array('query' => json_encode($query), 'orderby' => 'sort_order');
         $extraParams = array_merge($filter, $auth['read']);
         $fieldname = $options['fieldprefix'] . 'sjoAttr:' . $options['attachmentId'];
         $default = array();
         // if this attribute exists on DB, we need to write a hidden with id appended to fieldname and set defaults for checkboxes
         if (is_array(data_entry_helper::$entity_to_load)) {
             $stored_keys = preg_grep('/^' . $fieldname . ':[0-9]+$/', array_keys(data_entry_helper::$entity_to_load));
             foreach ($stored_keys as $stored_key) {
                 $r .= '<input type="hidden" name="' . $stored_key . '" value="" />';
                 $default[] = array('fieldname' => $stored_key, 'default' => data_entry_helper::$entity_to_load[$stored_key]);
                 unset(data_entry_helper::$entity_to_load[$stored_key]);
             }
         }
         $r .= data_entry_helper::checkbox_group(array_merge(array('label' => lang::get('What other devices did you see on the bird'), 'fieldname' => $fieldname, 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'default' => $default, 'extraParams' => $extraParams), $options));
     }
     // subject_observation comment
     if ($args['observation_comment']) {
         $r .= self::get_control_observationcomment($auth, $args, $tabalias, $options);
     }
     $r .= '</fieldset>';
     // output identifier visualisations
     $r .= '<div id="idn:' . $taxIdx . ':neck-collar:colourbox" class="neck-collar-indentifier-colourbox ui-corner-all">&nbsp;</div>';
     $r .= '<div id="idn:' . $taxIdx . ':colour-left:colourbox" class="colour-left-indentifier-colourbox ui-corner-all">&nbsp;</div>';
     $r .= '<div id="idn:' . $taxIdx . ':colour-right:colourbox" class="colour-right-indentifier-colourbox ui-corner-all">&nbsp;</div>';
     $r .= '</div>';
     // close clearfix div
     // occurrence images
     $opts = array('table' => 'idn:' . $taxIdx . ':' . 'occurrence_image', 'label' => lang::get('Upload your photos'));
     if ($args['interface'] !== 'one_page') {
         $opts['tabDiv'] = $tabalias;
     }
     $opts['resizeWidth'] = isset($options['resizeWidth']) ? $options['resizeWidth'] : 1600;
     $opts['resizeHeight'] = isset($options['resizeHeight']) ? $options['resizeHeight'] : 1600;
     $opts['caption'] = lang::get('Photos');
     $opts['readAuth'] = $auth['read'];
     $opts['imageWidth'] = '168';
     // $opts['id'] = 'idn:0';
     if ($options['inNewIndividual']) {
         $opts['codeGenerated'] = 'php';
     }
     $r .= data_entry_helper::file_box($opts);
     // remove bird button - don't show if bird is being edited or only bird on the form
     $r .= '<input type="button" id="idn:0:remove-individual" class="idn-remove-individual" value="' . lang::get('Remove This Bird') . '" />';
     $r .= '</div>';
     // recursive call to get a template for the 'individual panel' markup for a new observation so we can add another bird
     if (!$options['inNewIndividual']) {
         $r .= '</div>';
         $temp = data_entry_helper::$entity_to_load;
         data_entry_helper::$entity_to_load = null;
         $options['inNewIndividual'] = true;
         $options['lockable'] = $options['identifiers_lockable'];
         $new_individual = self::get_control_speciesidentifier($auth, $args, $tabalias, $options);
         unset($options['lockable']);
         $opts['codeGenerated'] = 'js';
         $photoJavascript = data_entry_helper::file_box($opts);
         data_entry_helper::$entity_to_load = $temp;
         unset($options['inNewIndividual']);
         data_entry_helper::$javascript .= "window.indicia.wwt.newIndividual = '" . str_replace(array('\'', "\n"), array('\\\'', ' '), $new_individual) . "';\n";
         // save the javascript needed for an additional colour-marked individual
         // process it to sanitise the string and remove comments (works now but not 100% reliable)
         data_entry_helper::$javascript .= "window.indicia.wwt.newJavascript = '" . str_replace(array('\'', "\n"), array('\\\'', ' '), str_replace('\\', '\\\\', preg_replace('#^\\s*//.+$#m', '', $photoJavascript))) . str_replace(array('\'', "\n", "\r"), array('\\\'', ' ', ' '), str_replace('\\', '\\\\', preg_replace('#^\\s*//.+$#m', '', $autoJavascript))) . "';\n";
         $r .= '<input type="button" id="idn:add-another" class="ui-state-default ui-corner-all" ' . 'value="' . lang::get('Add Another Bird at the Same Date and Location') . '" /><br />';
     }
     return $r;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:101,代码来源:wwt_colour_marked_report.php

示例6: species_checklist


//.........这里部分代码省略.........
     self::$js_read_tokens = $options['readAuth'];
     self::$javascript .= "indiciaData['rowInclusionCheck-" . $options['id'] . "'] = '" . $options['rowInclusionCheck'] . "';\n";
     self::$javascript .= "indiciaData['copyDataFromPreviousRow-" . $options['id'] . "'] = '" . $options['copyDataFromPreviousRow'] . "';\n";
     self::$javascript .= "indiciaData['includeSpeciesGridLinkPage-" . $options['id'] . "'] = '" . $options['includeSpeciesGridLinkPage'] . "';\n";
     self::$javascript .= "indiciaData.speciesGridPageLinkUrl = '" . $options['speciesGridPageLinkUrl'] . "';\n";
     self::$javascript .= "indiciaData.speciesGridPageLinkParameter = '" . $options['speciesGridPageLinkParameter'] . "';\n";
     self::$javascript .= "indiciaData.speciesGridPageLinkTooltip = '" . $options['speciesGridPageLinkTooltip'] . "';\n";
     self::$javascript .= "indiciaData['editTaxaNames-" . $options['id'] . "'] = '" . $options['editTaxaNames'] . "';\n";
     self::$javascript .= "indiciaData['subSpeciesColumn-" . $options['id'] . "'] = '" . $options['subSpeciesColumn'] . "';\n";
     self::$javascript .= "indiciaData['subSamplePerRow-" . $options['id'] . "'] = " . ($options['subSamplePerRow'] ? 'true' : 'false') . ";\n";
     if ($options['copyDataFromPreviousRow']) {
         self::$javascript .= "indiciaData['previousRowColumnsToInclude-" . $options['id'] . "'] = '" . $options['previousRowColumnsToInclude'] . "';\n";
         self::$javascript .= "indiciaData.langAddAnother='" . lang::get('Add another') . "';\n";
     }
     if (count($options['mediaTypes'])) {
         self::add_resource('plupload');
         // store some globals that we need later when creating uploaders
         $relpath = self::getRootFolder() . self::client_helper_path();
         $interim_image_folder = isset(parent::$interim_image_folder) ? parent::$interim_image_folder : 'upload/';
         self::$javascript .= "indiciaData.uploadSettings = {\n";
         self::$javascript .= "  uploadScript: '" . $relpath . "upload.php',\n";
         self::$javascript .= "  destinationFolder: '" . $relpath . $interim_image_folder . "',\n";
         self::$javascript .= "  jsPath: '" . self::$js_path . "'";
         if (isset($options['resizeWidth'])) {
             self::$javascript .= ",\n  resizeWidth: " . $options['resizeWidth'];
         }
         if (isset($options['resizeHeight'])) {
             self::$javascript .= ",\n  resizeHeight: " . $options['resizeHeight'];
         }
         if (isset($options['resizeQuality'])) {
             self::$javascript .= ",\n  resizeQuality: " . $options['resizeQuality'];
         }
         self::$javascript .= "\n}\n";
         if ($indicia_templates['file_box'] != '') {
             self::$javascript .= "file_boxTemplate = '" . str_replace('"', '\\"', $indicia_templates['file_box']) . "';\n";
         }
         if ($indicia_templates['file_box_initial_file_info'] != '') {
             self::$javascript .= "file_box_initial_file_infoTemplate = '" . str_replace('"', '\\"', $indicia_templates['file_box_initial_file_info']) . "';\n";
         }
         if ($indicia_templates['file_box_uploaded_image'] != '') {
             self::$javascript .= "file_box_uploaded_imageTemplate = '" . str_replace('"', '\\"', $indicia_templates['file_box_uploaded_image']) . "';\n";
         }
     }
     $occAttrControls = array();
     $occAttrs = array();
     $occAttrControlsExisting = array();
     $taxonRows = array();
     $subSampleRows = array();
     // Load any existing sample's occurrence data into $entity_to_load
     if (isset(self::$entity_to_load['sample:id']) && $options['useLoadedExistingRecords'] === false) {
         self::preload_species_checklist_occurrences(self::$entity_to_load['sample:id'], $options['readAuth'], $options['mediaTypes'], $options['reloadExtraParams'], $subSampleRows, $options['speciesControlToUseSubSamples'], isset($options['subSampleSampleMethodID']) ? $options['subSampleSampleMethodID'] : '');
     }
     // load the full list of species for the grid, including the main checklist plus any additional species in the reloaded occurrences.
     $taxalist = self::get_species_checklist_taxa_list($options, $taxonRows);
     // If we managed to read the species list data we can proceed
     if (!array_key_exists('error', $taxalist)) {
         $attrOptions = array('id' => null, 'valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => "sc:-idx-::occAttr", 'extraParams' => $options['readAuth'], 'survey_id' => array_key_exists('survey_id', $options) ? $options['survey_id'] : null);
         if (!empty($options['attributeIds'])) {
             // make sure we load the grid ID attribute
             if (!empty($options['gridIdAttributeId']) && !in_array($options['gridIdAttributeId'], $options['attributeIds'])) {
                 $options['attributeIds'][] = $options['gridIdAttributeId'];
             }
             $attrOptions['extraParams'] += array('query' => json_encode(array('in' => array('id' => $options['attributeIds']))));
         }
         $attributes = self::getAttributes($attrOptions);
         // Merge in the attribute options passed into the control which can override the warehouse config
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:67,代码来源:data_entry_helper.php

示例7: get_control_locationphoto

 /**
  * Get the location photo control
  */
 protected static function get_control_locationphoto($auth, $args, $tabalias, $options)
 {
     return data_entry_helper::file_box(array_merge(array('table' => 'location_medium', 'readAuth' => $auth['read'], 'caption' => lang::get('File upload'), 'readAuth' => $auth['read']), $options));
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:7,代码来源:dynamic_location.php

示例8: get_form


//.........这里部分代码省略.........
         $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'), 'listId' => $args['species_list_id'], 'columns' => 1, '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");
     } else {          
       jQuery("#place_wrapper").removeClass("hidden");
       jQuery(".shore_mode").addClass("hidden");
       jQuery(".boat_mode").removeClass("hidden");
     }
   }
 );' . "\n";
     // Force existing setting of the radio buttons to reload when showign page after validation failure
     data_entry_helper::$onload_javascript .= '
 jQuery("input[name=smpAttr\\\\:' . $args['platform_attr_id'] . ']:checked").trigger("click");
 ';
     $r .= '</div></div>';
     if ($args['interface'] == 'wizard') {
         $r .= data_entry_helper::wizard_buttons(array('divId' => 'controls'));
     }
     $r .= '</fieldset>';
     // --Other information tab--
     $r .= "<fieldset id=\"other\">\n";
     // Get authorisation tokens to update and read from the Warehouse.
     $r .= data_entry_helper::get_auth($args['website_id'], $args['password']);
     $r .= "<input type=\"hidden\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
     $r .= "<input type=\"hidden\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />\n";
     $r .= "<input type=\"hidden\" name=\"occurrence:record_status\" value=\"C\" />\n";
     if ($args['interface'] == 'one_page') {
         $r .= '<legend>' . lang::get('other information') . '</legend>';
     }
     $r .= data_entry_helper::date_picker(array('label' => lang::get('Sighting Date'), 'fieldname' => 'sample:date'));
     $indicia_templates['timeFormat'] = '<label>hh:mm</label><br/>';
     $r .= data_entry_helper::text_input(array('label' => lang::get('Sighting Time'), 'fieldname' => 'smpAttr:' . $args['sample_time_attr_id'], 'class' => 'control-width-1', 'suffixTemplate' => 'timeFormat'));
     $r .= data_entry_helper::textarea(array('label' => lang::get('Any other information'), 'fieldname' => 'sample:comment', 'class' => 'control-width-6', 'helpText' => lang::get('Instructions for any other info')));
     $r .= data_entry_helper::file_box(array('caption' => 'Upload your photos', 'resizeWidth' => 1024, 'resizeHeight' => 768, 'table' => 'occurrence_image', 'tabDiv' => 'other'));
     $r .= '<div class="footer">' . data_entry_helper::checkbox(array('label' => lang::get('happy for contact'), 'labelClass' => 'auto', 'fieldname' => 'smpAttr:' . $args['contact_attr_id'])) . '</div>';
     if ($args['interface'] == 'wizard') {
         $r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'last'));
     } else {
         $r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"Save\" />\n";
     }
     $r .= "</fieldset></div>";
     $r .= "</form>";
     $r .= data_entry_helper::loading_block_end();
     return $r;
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:101,代码来源:ad_hoc_cetaceans.php

示例9: species_checklist


//.........这里部分代码省略.........
             // Get the cell content from the taxon_label template
             $firstCell = self::mergeParamsIntoTemplate($taxon, 'taxon_label');
             // If the taxon label template is PHP, evaluate it.
             if ($options['PHPtaxonLabel']) {
                 $firstCell = eval($firstCell);
             }
             // Now create the table cell to contain this.
             $colspan = isset($options['lookupListId']) ? ' colspan="2"' : '';
             $row = str_replace('{content}', $firstCell, str_replace('{colspan}', $colspan, $indicia_templates['taxon_label_cell']));
             $existing_record_id = false;
             $search = preg_grep("/^sc:{$id}:[0-9]*:present\$/", array_keys(self::$entity_to_load));
             if (count($search) === 1) {
                 // we have to implode the search result as the key can be not zero, then strip out the stuff other than the occurrence Id.
                 $existing_record_id = str_replace(array("sc:{$id}:", ":present"), '', implode('', $search));
             }
             if ($options['checkboxCol'] == 'true') {
                 if (self::$entity_to_load != null && array_key_exists("sc:{$id}:{$existing_record_id}:present", self::$entity_to_load)) {
                     $checked = ' checked="checked"';
                 } else {
                     $checked = '';
                 }
                 $row .= "\n<td class=\"scPresenceCell\"><input type=\"checkbox\" name=\"sc:{$id}:{$existing_record_id}:present\" {$checked} /></td>";
             }
             foreach ($occAttrControls as $attrId => $control) {
                 if ($existing_record_id) {
                     $search = preg_grep("/^sc:{$id}:{$existing_record_id}:occAttr:{$attrId}" . '[:[0-9]*]?$/', array_keys(self::$entity_to_load));
                     $ctrlId = count($search) === 1 ? implode('', $search) : $attributes[$attrId]['fieldname'];
                 } else {
                     $ctrlId = str_replace('{ttlId}', $id, $attributes[$attrId]['fieldname']);
                 }
                 if (isset(self::$entity_to_load[$ctrlId])) {
                     $existing_value = self::$entity_to_load[$ctrlId];
                 } elseif (array_key_exists('default', $attributes[$attrId])) {
                     // this case happens when reloading an existing record
                     $existing_value = $attributes[$attrId]['default'];
                 } else {
                     $existing_value = '';
                 }
                 // inject the field name into the control HTML
                 $oc = str_replace('{fieldname}', $ctrlId, $control);
                 if (!empty($existing_value)) {
                     // For select controls, specify which option is selected from the existing value
                     if (substr($oc, 0, 7) == '<select') {
                         $oc = str_replace('value="' . $existing_value . '"', 'value="' . $existing_value . '" selected="selected"', $oc);
                     } else {
                         $oc = str_replace('value=""', 'value="' . $existing_value . '"', $oc);
                     }
                     $error = self::check_errors("occAttr:{$attrId}");
                     if ($error) {
                         $oc = str_replace("class='", "class='ui-state-error ", $oc);
                         $oc .= $error;
                     }
                 }
                 $row .= str_replace(array('{label}', '{content}'), array(lang::get($attributesForThisRow[$attrId]['caption']), $oc), $indicia_templates[$options['attrCellTemplate']]);
             }
             if ($options['occurrenceComment']) {
                 $row .= "\n<td class=\"ui-widget-content\"><input class=\"control-width-4\" type=\"text\" name=\"sc:{$id}:{$existing_record_id}:occurrence:comment\" " . "value=\"" . self::$entity_to_load["sc:{$id}:{$existing_record_id}:occurrence:comment"] . "\" /></td>";
             }
             if ($options['occurrenceImages']) {
                 $existingImages = preg_grep("/^sc:{$id}:{$existing_record_id}:occurrence_image:id:[0-9]*\$/", array_keys(self::$entity_to_load));
                 if (count($existingImages) === 0) {
                     $row .= "\n<td class=\"ui-widget-content\"><a href=\"\" class=\"add-image-link\" id=\"add-images:{$id}:{$existing_record_id}\">" . lang::get('add images') . '</a></td>';
                 } else {
                     $row .= "\n<td class=\"ui-widget-content\"><a href=\"\" class=\"hide-image-link\" id=\"hide-images:{$id}:{$existing_record_id}\">" . lang::get('hide images') . '</a></td>';
                 }
             }
             // Are we in the first column? Note this is disabled if using occurrenceImages as it adds extra rows and messes things up.
             if ($options['occurrenceImages'] || $rowIdx < count($taxalist) / $options['columns']) {
                 $rows[$rowIdx] = $row;
             } else {
                 $rows[$rowIdx % ceil(count($taxalist) / $options['columns'])] .= $row;
             }
             $rowIdx++;
             if ($options['occurrenceImages']) {
                 // If there are existing images for this row, display the image control
                 if (count($existingImages) > 0) {
                     $totalCols = ($options['lookupListId'] ? 2 : 1) + ($options['checkboxCol'] ? 1 : 0) + ($options['occurrenceImages'] ? 1 : 0) + count($occAttrControls);
                     $rows[$rowIdx] = '<td colspan="' . $totalCols . '">' . data_entry_helper::file_box(array('table' => "sc:{$id}:{$existing_record_id}:occurrence_image", 'label' => lang::get('Upload your photos'), 'maxFileCount' => 3)) . '</td>';
                     $rowIdx++;
                 }
             }
         }
         $grid .= "<tbody>\n<tr>" . implode("</tr>\n<tr>", $rows) . "</tr>\n";
         $grid .= '</tbody></table>';
         // If the lookupListId parameter is specified then the user is able to add extra rows to the grid,
         // selecting the species from this list. Add the required controls for this.
         if (isset($options['lookupListId'])) {
             // Javascript to add further rows to the grid
             self::add_resource('addrowtogrid');
             self::$javascript .= "addRowToGrid('" . parent::$base_url . "index.php/services/data" . "', '" . $options['id'] . "', '" . $options['lookupListId'] . "', {'auth_token' : '" . $options['readAuth']['auth_token'] . "', 'nonce' : '" . $options['readAuth']['nonce'] . "'}," . "'" . $indicia_templates['taxon_label'] . "');\r\n";
         }
         if ($options['checkboxCol'] == 'true') {
             // need to tag if checkboxes active so can delete entry if needed
             $grid .= "<input type='hidden' id='control:checkbox' name='control:checkbox' value='YES'/>";
         }
         return $grid;
     } else {
         return $taxalist['error'];
     }
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:101,代码来源:data_entry_helper.php

示例10: get_species_checklist_empty_row_with_image

 private static function get_species_checklist_empty_row_with_image($options, $occAttrControls, $attributes, $rowIdx, $mediaId)
 {
     $rowClass = 'scOccImageRow';
     $rowId = $options['id'] . '-scOccImageRow-' . $mediaId;
     $r = '<table><tbody><tr class="' . $rowClass . '" id="' . $rowId . '">';
     $r .= self::get_species_checklist_empty_row($options, $occAttrControls, $attributes);
     if ($options['mediaTypes']) {
         $totalCols = ($options['lookupListId'] ? 2 : 1) + 1 + (count($options['mediaTypes']) ? 1 : 0) + count($occAttrControls);
         $gridId = $options['id'];
         $r .= '<td colspan="' . $totalCols . '">' . data_entry_helper::file_box(array('table' => "sc:{$gridId}-{$rowIdx}:{$mediaId}:sample_medium", 'loadExistingRecordKey' => "sc:{$gridId}:{$rowIdx}:{$mediaId}:sample_medium", 'mediaTypes' => $options['mediaTypes'], 'readAuth' => $options['readAuth'])) . '</td>';
     }
     $r .= "</tr></tbody></table>\n";
     return $r;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:14,代码来源:dynamic_progressive_seasearch_survey.php

示例11: get_form


//.........这里部分代码省略.........
         }
         $r .= "</fieldset>\n";
     }
     // the species tab is ommitted if the page is called with a taxon in the querystring parameters
     if (isset($taxa_taxon_list_id)) {
         $r .= "<input type=\"hidden\" name=\"occurrence:taxa_taxon_list_id\" value=\"{$taxa_taxon_list_id}\"/>\n";
     } else {
         $r .= "<fieldset id=\"species\">\n";
         $r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('species tab instructions') . "</p>";
         $extraParams = $readAuth + array('taxon_list_id' => $args['list_id']);
         if ($args['preferred']) {
             $extraParams += array('preferred' => 't');
         }
         if ($args['restrict_species_to_users_lang']) {
             $extraParams += array('language_iso' => iform_lang_iso_639_2($user->lang));
         }
         $species_list_args = array('label' => lang::get('occurrence:taxa_taxon_list_id'), 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'columns' => 2, 'view' => 'detail', 'parentField' => 'parent_id', 'extraParams' => $extraParams);
         if ($args['species_ctrl'] == 'tree_browser') {
             // change the node template to include images
             global $indicia_templates;
             $indicia_templates['tree_browser_node'] = '<div>' . '<img src="' . data_entry_helper::$base_url . '/upload/thumb-{image_path}" alt="Image of {caption}" width="80" /></div>' . '<span>{caption}</span>';
         }
         // Dynamically generate the species selection control required.
         $r .= call_user_func(array('data_entry_helper', $args['species_ctrl']), $species_list_args);
         if ($args['interface'] == 'wizard') {
             $r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $user->id == 0 ? 'first' : 'middle'));
         }
         $r .= "</fieldset>\n";
     }
     $r .= "<fieldset id=\"place\">\n";
     // Output all our hidden data here, because this tab is always present
     $r .= $auth['write'];
     if ($logged_in) {
         // If logged in, output some hidden data about the user
         $r .= iform_user_get_hidden_inputs($args);
     }
     // if the species being recorded is a fixed species defined in the URL, then output a hidden
     if (isset($taxa_taxon_list_id)) {
         $r .= "<input type=\"hidden\" name=\"occurrence:taxa_taxon_list_id'\" value=\"" . $taxa_taxon_list_id . "\" />\n";
     }
     $r .= "<input type=\"hidden\" name=\"website_id\" value=\"" . $args['website_id'] . "\" />\n";
     $r .= "<input type=\"hidden\" name=\"survey_id\" value=\"" . $args['survey_id'] . "\" />\n";
     $r .= "<input type=\"hidden\" name=\"record_status\" value=\"" . $args['record_status'] . "\" />\n";
     $r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('place tab instructions') . "</p>";
     // Build the array of spatial reference systems into a format Indicia can use.
     $systems = array();
     $list = explode(',', str_replace(' ', '', $args['spatial_systems']));
     foreach ($list as $system) {
         $systems[$system] = lang::get($system);
     }
     $r .= data_entry_helper::georeference_lookup(iform_map_get_georef_options($args, $auth['read']));
     $r .= data_entry_helper::sref_and_system(array('label' => lang::get('sample:entered_sref'), 'systems' => $systems));
     // retrieve options for the IndiciaMapPanel, and optionally options for OpenLayers.
     $options = iform_map_get_map_options($args, $readAuth);
     $options['tabDiv'] = 'place';
     $olOptions = iform_map_get_ol_options($args);
     $options['scroll_wheel_zoom'] = false;
     $r .= data_entry_helper::map_panel($options, $olOptions);
     if ($args['interface'] == 'wizard') {
         $r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => $user->id == 0 && isset($taxa_taxon_list_id) ? 'first' : 'middle'));
     }
     $r .= "</fieldset>\n";
     $r .= "<fieldset id=\"other\">\n";
     $r .= '<p class="page-notice ui-state-highlight ui-corner-all">' . lang::get('other tab instructions') . "</p>";
     $r .= data_entry_helper::date_picker(array('label' => lang::get('Date'), 'fieldname' => 'sample:date'));
     $r .= data_entry_helper::file_box(array('caption' => 'Upload your photos', 'readAuth' => $readAuth, 'resizeWidth' => 1024, 'resizeHeight' => 768, 'table' => 'occurrence_image', 'tabDiv' => 'other', 'runtimes' => array('html5', 'html4')));
     // Dynamically create a control for the abundance, unless overridden for this species
     if (isset($species) && count($species) > 0 && trim($args['abundance_overrides']) !== '') {
         $overrides = explode("\n", $args['abundance_overrides']);
         foreach ($overrides as $override) {
             $tokens = explode(':', $override);
             if ($tokens[0] == $species[0]['taxon']) {
                 // remove the default abundance attribute behaviour
                 $args['abundance_attr_id'] = '';
                 if (trim($tokens[1]) !== '') {
                     $attrIds = explode(',', $tokens[1]);
                     $attributes = data_entry_helper::getAttributes(array('id' => null, 'valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => "occAttr", 'extraParams' => $readAuth + array('query' => urlencode(json_encode(array('in' => array('id', $attrIds))))), 'survey_id' => $args['survey_id']));
                     foreach ($attributes as $attribute) {
                         $r .= data_entry_helper::outputAttribute($attribute, array('language' => iform_lang_iso_639_2($user->lang), 'booleanCtrl' => 'checkbox'));
                     }
                 }
             }
         }
     }
     if (!empty($args['abundance_attr_id'])) {
         $abundance_args = array('label' => lang::get('abundance'), 'fieldname' => 'occAttr:' . $args['abundance_attr_id'], 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'extraParams' => $readAuth + array('termlist_id' => $args['abundance_termlist_id']), 'size' => 6, 'sep' => '<br/>');
         $r .= call_user_func(array('data_entry_helper', $args['abundance_ctrl']), $abundance_args);
     }
     $r .= data_entry_helper::textarea(array('label' => lang::get('sample:comment'), 'fieldname' => 'sample:comment', 'class' => 'wide'));
     $r .= '<div class="footer">' . data_entry_helper::checkbox(array('label' => lang::get('happy for contact'), 'labelClass' => 'auto', 'fieldname' => 'smpAttr:' . $args['contact_attr_id'])) . '</div>';
     if ($args['interface'] == 'wizard') {
         $r .= data_entry_helper::wizard_buttons(array('divId' => 'controls', 'page' => 'last'));
     } else {
         $r .= "<input type=\"submit\" class=\"ui-state-default ui-corner-all\" value=\"Save\" />\n";
     }
     $r .= "</fieldset>\n";
     $r .= "</div>\n";
     $r .= "</form>";
     return $r;
 }
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:101,代码来源:mnhnl_citizen_science_1.php

示例12: get_control_habitatblocks

 protected static function get_control_habitatblocks($auth, $args, $tabAlias, $options)
 {
     $habitatName = self::$habitatAttrsByCaption['habitat name'];
     $biotopeCode = self::$habitatAttrsByCaption['biotope code'];
     $seabedType = self::$habitatAttrsByCaption['seabed type'];
     $seabedTypeOther = self::$habitatAttrsByCaption['other seabed type'];
     $communities = self::$habitatAttrsByCaption['communities'];
     $animalTurf = self::$habitatAttrsByCaption['animal turf'];
     $animalBed = self::$habitatAttrsByCaption['animal bed'];
     $sedimentTypes = self::$habitatAttrsByCaption['sediment types'];
     // build a template for the data entry controls for each habitat
     $template = '<legend title="' . lang::get('Each habitat is numbered. Make sure the description and quantitative data is ' . 'entered in the correct columns and that you number your sketch or plan in the same way. Each written description ' . 'should tally with the information entered on the columns and diagrams on the next page.') . '">Habitat habitatIdx</legend>';
     $template .= data_entry_helper::text_input(array('fieldname' => "smpAttr:{$habitatName['attributeId']}::habitatIdx", 'label' => lang::get('Habitat name'), 'class' => "control-width-4 habitat-name"));
     $template .= data_entry_helper::textarea(array('fieldname' => 'sample:comment:habitatIdx', 'label' => lang::get('DESCRIPTION (physical + community'), 'tooltip' => lang::get('This should be a brief \\\'sketch in words\\\' to describe the main characteristics ' . 'of each habitat and the dominant plant or animal communities. An example would be: "Gently shelving ' . 'seabed consisting of large boulders up to 1m x 1m with patches of coarse sand collecting between them. Kelp ' . 'forest on boulders with pink encrusting algae and red seaweeds beneath".')));
     if (user_access('biotope codes')) {
         $template .= data_entry_helper::text_input(array('fieldname' => "smpAttr:{$biotopeCode['attributeId']}::habitatIdx", 'label' => lang::get('Biotope code')));
     }
     $template .= data_entry_helper::checkbox_group(array('fieldname' => "smpAttr:{$seabedType['attributeId']}::habitatIdx", 'label' => lang::get('Seabed type'), 'table' => 'termlists_term', 'valueField' => 'id', 'captionField' => 'term', 'extraParams' => $auth['read'] + array('termlist_id' => $seabedType['termlist_id'], 'view' => 'cache'), 'afterControl' => data_entry_helper::text_input(array('label' => lang::get('other'), 'labelClass' => 'auto', 'fieldname' => "smpAttr:{$seabedTypeOther['attributeId']}::habitatIdx")), 'labelClass' => 'auto', 'tooltip' => lang::get('Each habitat should only contain a limited number of physical types. Rock and boulders or ' . 'cobble and pebbles are fine but avoid identifying habitats containing very different physical characteristics, ' . 'for instance rock and sand or wreckage and mud.')));
     $template .= data_entry_helper::checkbox_group(array('fieldname' => "smpAttr:{$communities['attributeId']}::habitatIdx", 'label' => lang::get('Communities'), 'table' => 'termlists_term', 'valueField' => 'id', 'captionField' => 'term', 'extraParams' => $auth['read'] + array('label' => lang::get('other'), 'termlist_id' => $communities['termlist_id'], 'view' => 'cache', 'orderby' => 'sort_order'), 'labelClass' => 'auto', 'tooltip' => lang::get('Each habitat described should rarely have more than one dominant community. For instance ' . 'if the main cover is kelp forest with pink encrusting algae and anemones on the rocks beneath only tick the ' . 'kelp forest box because this dominates.')));
     $template .= '<div style="display: inline-block;">';
     $template .= data_entry_helper::text_input(array('label' => lang::get('animal turf'), 'fieldname' => "smpAttr:{$animalTurf['attributeId']}::habitatIdx", 'labelClass' => 'auto', 'tooltip' => lang::get('Write the main component in the box. This may, for example, be hydroids, jewel anemones or ' . 'bryozoans but will not be mobile animals.')));
     $template .= '</div>&nbsp; <div style="display: inline-block;">';
     $template .= data_entry_helper::text_input(array('label' => lang::get('animal bed'), 'fieldname' => "smpAttr:{$animalBed['attributeId']}::habitatIdx", 'labelClass' => 'auto', 'tooltip' => lang::get('Animal beds are where large numbers of a particular animal changes the composition of the ' . 'seabed. Examples are the brittlestar beds, mussel beds and gravel sea cucumber beds.')));
     $template .= '</div>';
     $template .= data_entry_helper::checkbox_group(array('fieldname' => "smpAttr:{$sedimentTypes['attributeId']}::habitatIdx", 'table' => 'termlists_term', 'valueField' => 'id', 'captionField' => 'term', 'extraParams' => $auth['read'] + array('label' => lang::get('other'), 'termlist_id' => $sedimentTypes['termlist_id'], 'view' => 'cache')));
     $template .= data_entry_helper::file_box(array('table' => 'sample_mediumhabitatIdx', 'caption' => lang::get('Habitat photos'), 'codeGenerated' => 'php'));
     // create the control output
     // add the template, wrapped in a hidden div. JS will be used to clone it as many times as is required.
     $r = "<div style=\"display: none;\"><fieldset id=\"habitat-block-template\">\n{$template}\n</fieldset></div>\n";
     $r .= '<input type="hidden" id="habitat-count" name="habitat-count" />';
     $r .= "<div id=\"habitat-blocks\"></div>\n";
     return $r;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:33,代码来源:seasearch_survey.php

示例13: array

<form method="post" enctype="multipart/form-data">
<?php 
// Get authorisation tokens to update and read from the Warehouse.
$auth = data_entry_helper::get_read_write_auth($config['website_id'], $config['password']);
echo $auth['write'];
$readAuth = $auth['read'];
?>
<input type='hidden' id='website_id' name='website_id' value='<?php 
echo $config['website_id'];
?>
' />
<input type='hidden' id='record_status' name='record_status' value='C' />
<?php 
echo data_entry_helper::autocomplete(array('label' => 'Species', 'fieldname' => 'occurrence:taxa_taxon_list_id', 'table' => 'taxa_taxon_list', 'captionField' => 'taxon', 'valueField' => 'id', 'extraParams' => $readAuth + array('taxon_list_id' => $config['species_checklist_taxon_list'])));
echo data_entry_helper::date_picker(array('label' => 'Date', 'fieldname' => 'sample:date'));
echo data_entry_helper::file_box(array('caption' => 'Upload your photos', 'resizeWidth' => 1024, 'resizeHeight' => 768, 'table' => 'occurrence_image', 'runtimes' => array('html4')));
echo data_entry_helper::sref_and_system(array('label' => 'Grid ref'));
echo data_entry_helper::select(array('label' => 'Survey', 'fieldname' => 'sample:survey_id', 'table' => 'survey', 'captionField' => 'title', 'valueField' => 'id', 'extraParams' => $readAuth));
echo data_entry_helper::textarea(array('label' => 'Comment', 'fieldname' => 'sample:comment', 'class' => 'wide'));
?>

<input type="submit" class="ui-state-default ui-corner-all" value="Save" />
</form>
<?php 
echo data_entry_helper::loading_block_end();
echo data_entry_helper::dump_remaining_errors();
echo data_entry_helper::dump_javascript();
?>
</div>
</body>
</html>
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:31,代码来源:file_upload.php

示例14: get_site_trees_tab


//.........这里部分代码省略.........
     $r .= '<input type="hidden" id="sample:location_name" value="" name="sample:location_name">';
     $r .= '<input type="hidden" name="occurrence:id" value="" id="occurrence:id" />';
     $r .= '<input type="hidden" name="occurrence:record_status" value="C" id="occurrence:record_status" />';
     $extraParams = $auth['read'];
     $extraParams['taxon_list_id'] = $args['taxon_list_id'];
     $options = array('speciesNameFilterMode' => $args['speciesNameFilterMode']);
     $ctrl = $args['species_ctrl'];
     $species_ctrl_opts = array_merge(array('fieldname' => 'occurrence:taxa_taxon_list_id', 'label' => lang::get('Tree Species'), 'columns' => 1, 'parentField' => 'parent_id', 'blankText' => lang::get('Please select'), 'cacheLookup' => false), $options);
     if (isset($species_ctrl_opts['extraParams'])) {
         $species_ctrl_opts['extraParams'] = array_merge($extraParams, $species_ctrl_opts['extraParams']);
     } else {
         $species_ctrl_opts['extraParams'] = $extraParams;
     }
     if (!empty($args['taxon_filter'])) {
         $species_ctrl_opts['taxonFilterField'] = $args['taxon_filter_field'];
         // applies to autocompletes
         $species_ctrl_opts['taxonFilter'] = helper_base::explode_lines($args['taxon_filter']);
         // applies to autocompletes
     }
     // obtain table to query and hence fields to use
     $db = data_entry_helper::get_species_lookup_db_definition(false);
     // get local vars for the array
     extract($db);
     if ($ctrl !== 'species_autocomplete') {
         // The species autocomplete has built in support for the species name filter.
         // For other controls we need to apply the species name filter to the params used for population
         if (!empty($species_ctrl_opts['taxonFilter']) || $options['speciesNameFilterMode']) {
             $species_ctrl_opts['extraParams'] = array_merge($species_ctrl_opts['extraParams'], data_entry_helper::get_species_names_filter($species_ctrl_opts));
         }
         // for controls which don't know how to do the lookup, we need to tell them
         $species_ctrl_opts = array_merge(array('table' => $tblTaxon, 'captionField' => $colTaxon, 'valueField' => $colId), $species_ctrl_opts);
     }
     // if using something other than an autocomplete, then set the caption template to include the appropriate names. Autocompletes
     // use a JS function instead.
     if ($ctrl !== 'autocomplete' && isset($args['species_include_both_names']) && $args['species_include_both_names']) {
         if ($args['speciesNameFilterMode'] === 'all') {
             $indicia_templates['species_caption'] = "{{$colTaxon}}";
         } elseif ($args['speciesNameFilterMode'] === 'language') {
             $indicia_templates['species_caption'] = "{{$colTaxon}} - {{$colPreferred}}";
         } else {
             $indicia_templates['species_caption'] = "{{$colTaxon}} - {{$colCommon}}";
         }
         $species_ctrl_opts['captionTemplate'] = 'species_caption';
     }
     if ($ctrl == 'tree_browser') {
         // change the node template to include images
         $indicia_templates['tree_browser_node'] = '<div>' . '<img src="' . data_entry_helper::$base_url . '/upload/thumb-{image_path}" alt="Image of {caption}" width="80" /></div>' . '<span>{caption}</span>';
     }
     // Dynamically generate the species selection control required.
     $r .= call_user_func(array('data_entry_helper', $ctrl), $species_ctrl_opts);
     $ctrlOptions = array('extraParams' => $auth['read']);
     $attrSpecificOptions = array();
     $options = helper_base::explode_lines_key_value_pairs($args['attrOptions']);
     self::parseForAttrSpecificOptions($options, $ctrlOptions, $attrSpecificOptions);
     $r .= get_attribute_html($settings['tree_attributes'], $args, $ctrlOptions, '', $attrSpecificOptions);
     $r .= '</fieldset>';
     $r .= "</div>" . '<div class="right" style="width: ' . (isset($args['percent_width']) ? $args['percent_width'] : 50) . '%">';
     $olOptions = iform_map_get_ol_options($args);
     $options = iform_map_get_map_options($args, $auth['read']);
     $options['divId'] = 'trees-map';
     $options['toolbarDiv'] = 'top';
     $options['tabDiv'] = 'site-trees';
     $options['gridRefHint'] = true;
     $options['latLongFormat'] = 'DMS';
     // TODO drive from args or user.
     if (array_key_exists('standard_controls_trees', $args) && $args['standard_controls_trees']) {
         $standard_controls_trees = str_replace("\r\n", "\n", $args['standard_controls_trees']);
         $options['standardControls'] = explode("\n", $standard_controls_trees);
         // If drawing controls are enabled, then allow polygon recording.
         if (in_array('drawPolygon', $options['standardControls']) || in_array('drawLine', $options['standardControls'])) {
             $options['allowPolygonRecording'] = true;
         }
     }
     // also let the user click on a feature to select it. The highlighter just makes it easier to select one.
     // these controls are not present in read-only mode: all you can do is look at the map.
     $options['switchOffSrefRetrigger'] = true;
     $options['clickForSpatialRef'] = true;
     // override the opacity so the parent square does not appear filled in.
     $options['fillOpacity'] = 0;
     // override the map height and buffer size, which are specific to this map.
     $options['height'] = $args['tree_map_height'];
     $options['maxZoomBuffer'] = $args['tree_map_buffer'];
     $options['srefId'] = 'imp-sref-tree';
     $options['geomId'] = 'imp-geom-tree';
     $options['srefSystemId'] = 'imp-sref-system-tree';
     $help = '<p>' . lang::get('Add your trees using the appropriate tools in the top right of the map') . ':</p>' . '<ol><li>' . lang::get('Navigation Tool.') . '</li>' . '<li>' . lang::get('Query Tool. This tool allows you to click on a tree on the map to view its tree details.') . '</li>' . '<li>' . lang::get('Location Tool. This tool allows you to select the approximate location of a new tree on your site map. You can also reposition existing trees by first clicking on the tree and then clicking on its new location on the map.') . '</li></ol>';
     $r .= '<div class="ui-state-highlight page-notice ui-corner-all">' . $help . '</div>';
     $r .= map_helper::map_panel($options, $olOptions);
     $r .= data_entry_helper::file_box(array('table' => 'location_medium', 'readAuth' => $auth['read'], 'caption' => lang::get('Photos of Tree'), 'readAuth' => $auth['read']));
     $r .= "</div>";
     // right
     $r .= '<div class="follow_on_block" style="clear:both;">';
     $r .= get_attribute_html($settings['tree_attributes'], $args, $ctrlOptions, 'Lower Block', $attrSpecificOptions);
     data_entry_helper::$javascript .= "\n\$('#fieldset-optional-external-sc').prepend(\"" . lang::get('If you choose to record this tree for one of the citizen science projects below, please submit the tree ID used for that scheme.') . "\");\n";
     $r .= data_entry_helper::textarea(array('id' => 'location-comment', 'fieldname' => 'location:comment', 'label' => lang::get("Additional information"), 'labelClass' => 'autowidth')) . "<br />";
     $r .= '<input type="submit" value="' . lang::get('Save') . '" class="form-button right" id="submit-tree" />';
     $r .= '</div></form></div>';
     data_entry_helper::$onload_javascript .= "\$('#current-tree').change(selectTree);\n";
     return $r;
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:101,代码来源:tree_locations.php

示例15: species_checklist


//.........这里部分代码省略.........
  * taxon's label. Otherwise the template should be plain HTML. Defaults to false.
  * </ul>
  */
 public static function species_checklist()
 {
     global $indicia_templates;
     $options = self::check_arguments(func_get_args(), array('listId', 'occAttrs', 'readAuth', 'extraParams', 'lookupListId'));
     $options = self::get_species_checklist_options($options);
     if ($options['columns'] > 1 && $options['occurrenceImages']) {
         throw new Exception('The species_checklist control does not support having more than one occurrence per row (columns option > 0) ' . 'at the same time has having the occurrenceImages option enabled.');
     }
     self::add_resource('json');
     self::add_resource('autocomplete');
     if ($options['occurrenceImages']) {
         self::add_resource('plupload');
         // store some globals that we need later when creating uploaders
         $relpath = self::getRootFolder() . self::relative_client_helper_path();
         $interim_image_folder = isset(parent::$interim_image_folder) ? parent::$interim_image_folder : 'upload/';
         self::$javascript .= "uploadSettings = {\n";
         self::$javascript .= "  uploadScript: '" . $relpath . "upload.php',\n";
         self::$javascript .= "  destinationFolder: '" . $relpath . $interim_image_folder . "',\n";
         self::$javascript .= "  swfAndXapFolder: '" . $relpath . "plupload/',\n";
         self::$javascript .= "  jsPath: '" . self::$js_path . "'";
         if (isset($options['resizeWidth'])) {
             self::$javascript .= ",\n  resizeWidth: " . $options['resizeWidth'];
         }
         if (isset($options['resizeHeight'])) {
             self::$javascript .= ",\n  resizeHeight: " . $options['resizeHeight'];
         }
         if (isset($options['resizeQuality'])) {
             self::$javascript .= ",\n  resizeQuality: " . $options['resizeQuality'];
         }
         self::$javascript .= "\n}\n";
         if ($indicia_templates['file_box'] != '') {
             self::$javascript .= "file_boxTemplate = '" . str_replace('"', '\\"', $indicia_templates['file_box']) . "';\n";
         }
         if ($indicia_templates['file_box_initial_file_info'] != '') {
             self::$javascript .= "file_box_initial_file_infoTemplate = '" . str_replace('"', '\\"', $indicia_templates['file_box_initial_file_info']) . "';\n";
         }
         if ($indicia_templates['file_box_uploaded_image'] != '') {
             self::$javascript .= "file_box_uploaded_imageTemplate = '" . str_replace('"', '\\"', $indicia_templates['file_box_uploaded_image']) . "';\n";
         }
     }
     $occAttrControls = array();
     $occAttrs = array();
     $taxaThatExist = array();
     // Load any existing sample's occurrence data into $entity_to_load
     if (isset(self::$entity_to_load['sample:id'])) {
         self::preload_species_checklist_occurrences(self::$entity_to_load['sample:id'], $options['readAuth'], $options['occurrenceImages']);
     }
     // load the full list of species for the grid, including the main checklist plus any additional species in the reloaded occurrences.
     $taxalist = self::get_species_checklist_taxa_list($options, $taxaThatExist);
     // If we managed to read the species list data we can proceed
     if (!array_key_exists('error', $taxalist)) {
         $attributes = self::getAttributes(array('id' => null, 'valuetable' => 'occurrence_attribute_value', 'attrtable' => 'occurrence_attribute', 'key' => 'occurrence_id', 'fieldprefix' => "sc:-ttlId-::occAttr", 'extraParams' => $options['readAuth'], 'survey_id' => array_key_exists('survey_id', $options) ? $options['survey_id'] : null));
         // Get the attribute and control information required to build the custom occurrence attribute columns
         self::species_checklist_prepare_attributes($options, $attributes, $occAttrControls, $occAttrs);
         $grid = "\n";
         if (isset($options['lookupListId'])) {
             $grid .= self::get_species_checklist_clonable_row($options, $occAttrControls, $attributes);
         }
         $grid .= '<table class="ui-widget ui-widget-content species-grid ' . $options['class'] . '" id="' . $options['id'] . '">';
         $grid .= self::get_species_checklist_header($options, $occAttrs);
         $rows = array();
         $rowIdx = 0;
         foreach ($taxalist as $taxon) {
开发者ID:BirenRathod,项目名称:drupal-6,代码行数:67,代码来源:data_entry_helper.php


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