Go to the source code of this file.
Creates the Submission Summary form page.
Definition in file summary.php.
◆ tpps_summary_create_form()
tpps_summary_create_form |
( |
array & |
$form, |
|
|
array |
$form_state |
|
) |
| |
Creates the Submission Summary form page.
This function displays the data that the user has already submitted, and also allows fields to add additional files to the submission and provide optional comments.
- Parameters
-
array | $form | The form to be populated. |
array | $form_state | The state of the form to be populated. |
- Returns
- array The populated form.
Definition at line 23 of file summary.php.
25 $supplemental_upload_location =
'public://' . variable_get(
'tpps_supplemental_files_dir',
'tpps_supplemental');
27 $form[
'comments'] = array(
28 '#type' =>
'textarea',
29 '#title' =>
'If you have any additional comments about this submission you would like to include, please write them here:',
33 $form[
'files'] = array(
34 '#type' =>
'fieldset',
36 '#title' => t(
'<div class="fieldset-title">Additional Files</div>'),
37 '#description' => t(
'If there are any additional files you would like to include with your submission, please upload up to 10 files here.'),
38 '#collapsible' => TRUE,
41 $form[
'files'][
'add'] = array(
43 '#title' => t(
'Add File'),
44 '#button_type' =>
'button',
45 '#value' => t(
'Add File'),
48 $form[
'files'][
'remove'] = array(
50 '#title' => t(
'Remove File'),
51 '#button_type' =>
'button',
52 '#value' => t(
'Remove File'),
55 $form[
'files'][
'number'] = array(
57 '#default_value' => isset($form_state[
'saved_values'][
'summarypage'][
'files'][
'number']) ? $form_state[
'saved_values'][
'summarypage'][
'files'][
'number'] :
'0',
60 for ($i = 1; $i <= 10; $i++) {
62 $form[
'files'][
"$i"] = array(
63 '#type' =>
'managed_file',
64 '#title' => t(
"Supplemental File @i", array(
'@i' => $i)),
65 '#upload_validators' => array(
67 'file_validate_extensions' => array(
'csv tsv xlsx txt pdf vcf doc docx xls ppt pptx fa fasta img png jpeg jpg zip gz fsa_nt html flat fsa ai '),
69 '#upload_location' =>
"$supplemental_upload_location",
73 $form[
'release'] = array(
74 '#type' =>
'checkbox',
75 '#title' => t(
'Release this data through the database immediately.'),
76 '#default_value' => isset($form_state[
'saved_values'][
'summarypage'][
'release']) ? $form_state[
'saved_values'][
'summarypage'][
'release'] : TRUE,
79 $form[
'release-date'] = array(
81 '#title' => t(
'Please select the release date for the dataset.'),
82 '#default_value' => isset($form_state[
'saved_values'][
'summarypage'][
'release-date']) ? $form_state[
'saved_values'][
'summarypage'][
'release-date'] : NULL,
85 ':input[name="release"]' => array(
'checked' => FALSE),
90 $analysis_options = array(
91 'diversity' =>
'Diversity',
92 'population_structure' =>
'Population Structure',
93 'association_genetics' =>
'Association Genetics',
94 'landscape_genomics' =>
'Landscape Genomics',
95 'phenotype_environment' =>
'Phenotype-Environment',
98 $form[
'analysis'] = array(
99 '#type' =>
'fieldset',
100 '#title' => t(
'Analysis'),
104 foreach ($analysis_options as $option => $label) {
105 $form[
'analysis'][
"{$option}_check"] = array(
106 '#type' =>
'checkbox',
110 $form[
'analysis'][
"{$option}_file"] = array(
111 '#type' =>
'managed_file',
112 '#title' => $label .
" file:",
113 '#description' => t(
'Please upload the file associated with this analysis type'),
114 '#upload_location' =>
'public://' . variable_get(
'tpps_analysis_dir',
'tpps_analysis'),
115 '#upload_validators' => array(
116 'file_validate_extensions' => array(),
120 ":input[name=\"analysis[{$option}_check]\"]" => array(
'checked' => TRUE),
125 $form[
'analysis'][
"{$option}_file_description"] = array(
126 '#type' =>
'textfield',
127 '#title' => $label .
" file description:",
130 ":input[name=\"analysis[{$option}_check]\"]" => array(
'checked' => TRUE),
136 $org_number = $form_state[
'saved_values'][
TPPS_PAGE_1][
'organism'][
'number'];
137 $new_species = array();
138 for ($i = 1; $i <= $org_number; $i++) {
139 $org = $form_state[
'saved_values'][
TPPS_PAGE_1][
'organism'][$i][
'name'];
140 $parts = explode(
" ", $org);
142 $org_record = chado_select_record(
'organism', array(
'organism_id'), array(
143 'genus' => $parts[0],
144 'species' => implode(
" ", array_slice($parts, 1)),
146 if (empty($org_record)) {
147 $new_species[] = $org;
151 if (!empty($new_species) and !empty(variable_get(
'tpps_tree_pics_files_dir', NULL))) {
152 $form[
'tree_pictures'] = array(
153 '#type' =>
'fieldset',
154 '#title' => t(
'The following plants are new in the database and will need pictures:'),
158 foreach ($new_species as $org) {
159 $form[
'tree_pictures'][$org] = array(
160 '#type' =>
'managed_file',
161 '#title' => t(
'Picture for @org: (optional)', array(
'@org' => $org)),
162 '#upload_location' =>
'public://' . variable_get(
'tpps_tree_pics_files_dir'),
163 '#upload_validators' => array(
164 'file_validate_extensions' => array(
'jpeg jpg'),
166 '#description' => t(
'Please upload a photo of the species in either .jpeg or .jpg format'),
169 if (db_table_exists(
'treepictures_metadata')) {
170 $form[
'tree_pictures'][
"{$org}_url"] = array(
171 '#type' =>
'textfield',
172 '#title' => t(
'@org Picture source URL:', array(
'@org' => $org)),
174 'invisible' => array(
175 ":input[name=\"tree_pictures[{$org}][fid]\"]" => array(
'value' => 0),
180 $form[
'tree_pictures'][
"{$org}_attribution"] = array(
181 '#type' =>
'textfield',
182 '#title' => t(
'@org Picture Attribution:', array(
'@org' => $org)),
184 'invisible' => array(
185 ":input[name=\"tree_pictures[{$org}][fid]\"]" => array(
'value' => 0),
190 $form[
'tree_pictures'][
"{$org}_license"] = array(
191 '#type' =>
'textfield',
192 '#title' => t(
'@org Picture License:', array(
'@org' => $org)),
194 'invisible' => array(
195 ":input[name=\"tree_pictures[{$org}][fid]\"]" => array(
'value' => 0),
203 $form[
'Back'] = array(
205 '#value' => t(
'Back'),
208 $form[
'Next'] = array(
210 '#value' => t(
'Submit'),
tpps_table_display(array &$state, array $options=array())