function iform_mnhnl_recordernamesControl($node, $auth, $args, $tabalias, $options) { $values = array(); $userlist = array(); $results = db_query('SELECT uid, name FROM {users}'); while ($result = db_fetch_object($results)) { $account = user_load($result->uid); if ($account->uid != 1 && user_access($args['permission_name'], $account)) { $userlist[$result->name] = $result->name; } } if (isset(data_entry_helper::$entity_to_load['sample:recorder_names'])) { if (!is_array(data_entry_helper::$entity_to_load['sample:recorder_names'])) { $values = explode("\r\n", data_entry_helper::$entity_to_load['sample:recorder_names']); } else { $values = data_entry_helper::$entity_to_load['sample:recorder_names']; } } foreach ($values as $value) { // ensure all existing entries are in list. $userlist[$value] = $value; } if (isset($options['disabled']) && $options['disabled']) { return data_entry_helper::text_input(array_merge(array('id' => 'sample:recorder_names', 'fieldname' => 'sample:recorder_names[]', 'label' => lang::get('Recorder names'), 'default' => implode(', ', $values)), $options)); } $r = data_entry_helper::listbox(array_merge(array('id' => 'sample:recorder_names', 'fieldname' => 'sample:recorder_names[]', 'label' => lang::get('Recorder names'), 'size' => 6, 'multiselect' => true, 'default' => $values, 'lookupValues' => $userlist, 'validation' => array('required')), $options)); return $r . "<span id='RecorderInstructions'>" . lang::get('LANG_RecorderInstructions') . "</span><br />"; }
/** * Get the recorder names control */ protected static function get_control_recordernames($auth, $args, $tabalias, $options) { $values = array(); $userlist = array(); $results = db_query('SELECT uid, name FROM {users}'); while ($result = db_fetch_object($results)) { $account = user_load($result->uid); if ($account->uid != 1 && user_access('IForm n' . self::$node->nid . ' user', $account)) { $userlist[$result->name] = $result->name; } } if (isset(data_entry_helper::$entity_to_load['sample:recorder_names'])) { if (!is_array(data_entry_helper::$entity_to_load['sample:recorder_names'])) { $values = explode("\r\n", data_entry_helper::$entity_to_load['sample:recorder_names']); } else { $values[] = data_entry_helper::$entity_to_load['sample:recorder_names']; } } foreach ($values as $value) { $userlist[$value] = $value; } $r = data_entry_helper::listbox(array_merge(array('id' => 'sample:recorder_names', 'fieldname' => 'sample:recorder_names[]', 'label' => lang::get('Recorder names'), 'size' => 6, 'multiselect' => true, 'default' => $values, 'lookupValues' => $userlist, 'validation' => array('required')), $options)); return $r; }
<br /> <?php echo data_entry_helper::text_input(array('label' => 'Determination Date', 'fieldname' => $config['det_date'])); ?> </fieldset> <fieldset> <legend>Sample attributes</legend> <?php echo data_entry_helper::text_input(array('label' => 'Weather', 'fieldname' => $config['weather'], 'class' => 'control-width-6')); echo data_entry_helper::text_input(array('label' => 'Temperature (Celcius)', 'fieldname' => $config['temperature'])); echo data_entry_helper::radio_group(array('label' => 'Surroundings', 'fieldname' => $config['surroundings'], 'table' => 'termlists_term', 'captionField' => 'term', 'valueField' => 'id', 'extraParams' => $readAuth + array('termlist_id' => $config['surroundings_termlist']), 'sep' => '<br />')); ?> <br/> <label for='<?php echo $config['site_usage']; ?> []'>Site Usage:</label> <?php echo data_entry_helper::listbox($config['site_usage'] . '[]', 'termlists_term', 'term', 4, true, 'id', $readAuth + array('termlist_id' => $config['site_usage_termlist'])); ?> </fieldset> <input type="submit" value="Save" /> </form> </div> </body> <?php echo data_entry_helper::dump_javascript(); ?> </html>
" /> <input type="hidden" name="subject_observation:website_id" value="<?php echo html::initial_value($values, 'subject_observation:website_id'); ?> " /> <?php echo data_entry_helper::text_input(array('label' => 'Survey', 'fieldname' => 'survey:title', 'default' => html::initial_value($values, 'survey:title'), 'class' => 'readonly control-width-4')); echo data_entry_helper::text_input(array('label' => 'Date', 'fieldname' => 'sample:date_start', 'default' => html::initial_value($values, 'sample:date_start'), 'class' => 'readonly')); echo data_entry_helper::text_input(array('label' => 'Spatial reference', 'fieldname' => 'sample:entered_sref:no_validate', 'default' => html::initial_value($values, 'sample:entered_sref:no_validate'), 'class' => 'readonly')); ?> </fieldset> <fieldset> <legend>Subject observation details</legend> <?php $readAuth = data_entry_helper::get_read_auth(0 - $_SESSION['auth_user']->id, kohana::config('indicia.private_key')); echo data_entry_helper::listbox(array('label' => 'Occurrences', 'fieldname' => 'joinsTo:occurrence:id[]', 'table' => 'occurrence', 'captionField' => 'taxon', 'valueField' => 'id', 'class' => 'control-width-3', 'multiselect' => true, 'default' => array_key_exists('joinsTo:occurrence:id', $values) ? $values['joinsTo:occurrence:id'] : '', 'extraParams' => $readAuth + array('view' => 'gv', 'sample_id' => html::initial_value($values, 'sample:id')))); echo data_entry_helper::select(array('label' => 'Subject Type', 'fieldname' => 'subject_observation:subject_type_id', 'default' => html::initial_value($values, 'subject_observation:subject_type_id'), 'lookupValues' => $other_data['subject_type_terms'], 'blankText' => '<Please select>', 'extraParams' => $readAuth)); echo data_entry_helper::text_input(array('label' => 'Count', 'fieldname' => 'subject_observation:count', 'class' => 'control-width-1', 'default' => html::initial_value($values, 'subject_observation:count'), 'suffixTemplate' => 'nosuffix')); echo data_entry_helper::select(array('label' => null, 'fieldname' => 'subject_observation:count_qualifier_id', 'default' => html::initial_value($values, 'subject_observation:count_qualifier_id'), 'lookupValues' => $other_data['count_qualifier_terms'], 'blankText' => '<Please select>', 'extraParams' => $readAuth)); echo data_entry_helper::textarea(array('label' => 'Comment', 'fieldname' => 'subject_observation:comment', 'class' => 'control-width-6', 'default' => html::initial_value($values, 'subject_observation:comment'))); ?> </fieldset> <?php if (array_key_exists('attributes', $values) && count($values['attributes']) > 0) { ?> <fieldset> <legend>Custom Attributes</legend> <ol> <?php foreach ($values['attributes'] as $attr) { $name = 'sjoAttr:' . $attr['subject_observation_attribute_id'];