Go to the source code of this file.
Define the helper functions for the Study Design page.
Definition in file page_2_helper.php.
◆ tpps_common_garden()
tpps_common_garden |
( |
array & |
$form | ) |
|
This function creates fields for the common garden study type.
- Parameters
-
array | $form | The form to be populated. |
Definition at line 234 of file page_2_helper.php.
236 $form[
'#title'] = t(
'<div class="fieldset-title">Common Garden Information:</div>');
238 $form[
'irrigation'] = array(
239 '#type' =>
'fieldset',
243 $form[
'irrigation'][
'option'] = array(
245 '#title' => t(
'Irrigation Type: *'),
247 0 => t(
'- Select -'),
248 'Irrigation from top' => t(
'Irrigation from top'),
249 'Irrigation from bottom' => t(
'Irrigation from bottom'),
250 'Drip Irrigation' => t(
'Drip Irrigation'),
251 'Other' => t(
'Other'),
252 'No Irrigation' => t(
'No Irrigation'),
256 $form[
'irrigation'][
'other'] = array(
257 '#type' =>
'textfield',
260 ':input[name="study_info[irrigation][option]"]' => array(
'value' =>
'Other'),
267 $form[
'biotic_env'] = array(
268 '#type' =>
'fieldset',
272 $form[
'biotic_env'][
'option'] = array(
273 '#type' =>
'checkboxes',
274 '#title' => t(
'Biotic Environment: *'),
275 '#options' => drupal_map_assoc(array(
285 $form[
'biotic_env'][
'other'] = array(
286 '#type' =>
'textfield',
287 '#title' => t(
'Please specify Biotic Environment Type: *'),
290 ':input[name="study_info[biotic_env][option][Other]"]' => array(
'checked' => TRUE),
295 $form[
'season'] = array(
296 '#type' =>
'checkboxes',
297 '#title' => t(
'Seasons: *'),
298 '#options' => drupal_map_assoc(array(
304 '#description' => t(
'If you do not know which season your samples were collected, please select all.'),
307 $treatment_options = drupal_map_assoc(array(
308 t(
'Seasonal environment'),
309 t(
'Antibiotic regime'),
310 t(
'Chemical administration'),
312 t(
'Fertilizer regime'),
313 t(
'Fungicide regime'),
315 t(
'Gravity Growth hormone regime'),
316 t(
'Herbicide regime'),
317 t(
'Mechanical treatment'),
318 t(
'Mineral nutrient regime'),
319 t(
'Non-mineral nutrient regime'),
321 t(
'Watering regime'),
322 t(
'Pesticide regime'),
324 t(
'Other perturbation'),
327 $form[
'treatment'] = array(
328 '#type' =>
'fieldset',
329 '#title' => t(
'<div class="fieldset-title">Treatments:</div>'),
332 $form[
'treatment'][
'check'] = array(
333 '#type' =>
'checkbox',
334 '#title' => t(
'My Common Garden experiment used treatments/regimes/perturbations.'),
337 foreach ($treatment_options as $option) {
338 $form[
'treatment'][
"$option"] = array(
339 '#type' =>
'checkbox',
340 '#title' => t(
"@opt", array(
'@opt' => $option)),
343 ':input[name="study_info[treatment][check]"]' => array(
'checked' => TRUE),
347 $form[
'treatment'][
"$option-description"] = array(
348 '#type' =>
'textfield',
349 '#description' => t(
"@opt Description *", array(
'@opt' => $option)),
352 ':input[name="study_info[treatment][' . $option .
']"]' => array(
'checked' => TRUE),
353 ':input[name="study_info[treatment][check]"]' => array(
'checked' => TRUE),
tpps_control(array &$form, $type, $label)
◆ tpps_control()
tpps_control |
( |
array & |
$form, |
|
|
|
$type, |
|
|
|
$label |
|
) |
| |
This function creates fields for the items that have control options.
This includes co2, humidity, light intensity, salinity, and pH.
- Parameters
-
array | $form | The form to be updated. |
string | $type | The machine-readable type of control options. |
string | $label | The human-readable label for the control options. |
Definition at line 569 of file page_2_helper.php.
570 $form[$type] = array(
571 '#type' =>
'fieldset',
575 $form[$type][
'option'] = array(
577 '#title' => t(
'@label controlled or uncontrolled: *', array(
'@label' => $label)),
579 0 => t(
'- Select -'),
580 1 => t(
'Controlled'),
581 2 => t(
'Uncontrolled'),
585 $form[$type][
'controlled'] = array(
586 '#type' =>
'textfield',
587 '#title' => t(
'Controlled @label Value: *', array(
'@label' => $label)),
590 ":input[name=\"study_info[$type][option]\"]" => array(
'value' =>
'1'),
595 $form[$type][
'uncontrolled'] = array(
596 '#type' =>
'textfield',
597 '#title' => t(
'Average @label Value: *', array(
'@label' => $label)),
600 ":input[name=\"study_info[$type][option]\"]" => array(
'value' =>
'2'),
606 $form[$type][
'controlled'][
'#states'][
'visible'] = array(
607 ':input[name="study_info[rooting][ph][option]"]' => array(
'value' =>
'1'),
609 $form[$type][
'uncontrolled'][
'#states'][
'visible'] = array(
610 ':input[name="study_info[rooting][ph][option]"]' => array(
'value' =>
'2'),
◆ tpps_greenhouse()
tpps_greenhouse |
( |
array & |
$form | ) |
|
This function creates fields for the greenhouse study type.
- Parameters
-
array | $form | The form to be populated. |
Definition at line 201 of file page_2_helper.php.
203 $form[
'#title'] = t(
'<div class="fieldset-title">Greenhouse Information:</div>');
208 $form[
'temp'] = array(
209 '#type' =>
'fieldset',
210 '#title' => t(
'<div class="fieldset-title">Temperature Information:</div>'),
211 '#description' => t(
'Please provide temperatures in Degrees Celsius'),
215 $form[
'temp'][
'high'] = array(
216 '#type' =>
'textfield',
217 '#title' => t(
'Average High Temperature: *'),
220 $form[
'temp'][
'low'] = array(
221 '#type' =>
'textfield',
222 '#title' => t(
'Average Low Temperature: *'),
tpps_rooting(array &$form)
tpps_control(array &$form, $type, $label)
◆ tpps_growth_chamber()
tpps_growth_chamber |
( |
array & |
$form | ) |
|
This function creates fields for the growth chamber study type.
- Parameters
-
array | $form | The form to be populated. |
Definition at line 167 of file page_2_helper.php.
169 $form[
'#title'] = t(
'<div class="fieldset-title">Growth Chamber Information:</div>');
175 $form[
'temp'] = array(
176 '#type' =>
'fieldset',
177 '#title' => t(
'<div class="fieldset-title">Temperature Information:</div>'),
178 '#description' => t(
'Please provide temperatures in Degrees Celsius'),
182 $form[
'temp'][
'high'] = array(
183 '#type' =>
'textfield',
184 '#title' => t(
'Average High Temperature: *'),
187 $form[
'temp'][
'low'] = array(
188 '#type' =>
'textfield',
189 '#title' => t(
'Average Low Temperature: *'),
tpps_rooting(array &$form)
tpps_control(array &$form, $type, $label)
◆ tpps_natural_population()
tpps_natural_population |
( |
array & |
$form | ) |
|
This function creates fields for the natural population study type.
- Parameters
-
array | $form | The form to be populated. |
Definition at line 132 of file page_2_helper.php.
134 $form[
'#title'] = t(
'<div class="fieldset-title">Natural Population/Landscape Information:</div>');
136 $form[
'season'] = array(
137 '#type' =>
'checkboxes',
138 '#title' => t(
'Seasons (select all that apply): *'),
139 '#options' => drupal_map_assoc(array(
145 '#description' => t(
'If you do not know which season your samples were collected, please select all.'),
149 $num_arr[0] =
'- Select -';
150 for ($i = 1; $i <= 30; $i++) {
154 $form[
'assessions'] = array(
156 '#title' => t(
'Number of times the populations were assessed (on average): *'),
157 '#options' => $num_arr,
◆ tpps_plantation()
tpps_plantation |
( |
array & |
$form | ) |
|
This function creates fields for the plantation study type.
- Parameters
-
array | $form | The form to be populated. |
Definition at line 366 of file page_2_helper.php.
368 $form[
'#title'] = t(
'<div class="fieldset-title">Plantation Information:</div>');
370 $form[
'season'] = array(
371 '#type' =>
'checkboxes',
372 '#title' => t(
'Seasons (select all that apply): *'),
373 '#options' => drupal_map_assoc(array(
379 '#description' => t(
'If you do not know which season your samples were collected, please select all.'),
383 $num_arr[0] =
'- Select -';
384 for ($i = 1; $i <= 30; $i++) {
388 $form[
'assessions'] = array(
390 '#title' => t(
'Number of times the populations were assessed (on average): *'),
391 '#options' => $num_arr,
394 $treatment_options = drupal_map_assoc(array(
395 t(
'Seasonal environment'),
396 t(
'Antibiotic regime'),
397 t(
'Chemical administration'),
399 t(
'Fertilizer regime'),
400 t(
'Fungicide regime'),
402 t(
'Gravity Growth hormone regime'),
403 t(
'Herbicide regime'),
404 t(
'Mechanical treatment'),
405 t(
'Mineral nutrient regime'),
406 t(
'Non-mineral nutrient regime'),
408 t(
'Watering regime'),
409 t(
'Pesticide regime'),
411 t(
'Other perturbation'),
414 $form[
'treatment'] = array(
415 '#type' =>
'fieldset',
416 '#title' => t(
'<div class="fieldset-title">Treatments:</div>'),
419 $form[
'treatment'][
'check'] = array(
420 '#type' =>
'checkbox',
421 '#title' => t(
'My Plantation experiment used treatments/regimes/perturbations.'),
424 foreach ($treatment_options as $option) {
425 $form[
'treatment'][
"$option"] = array(
426 '#type' =>
'checkbox',
427 '#title' => t(
"@opt", array(
'@opt' => $option)),
430 ':input[name="study_info[treatment][check]"]' => array(
'checked' => TRUE),
434 $form[
'treatment'][
"$option-description"] = array(
435 '#type' =>
'textfield',
436 '#description' => t(
"@opt Description *", array(
'@opt' => $option)),
439 ':input[name="study_info[treatment][' . $option .
']"]' => array(
'checked' => TRUE),
440 ':input[name="study_info[treatment][check]"]' => array(
'checked' => TRUE),
◆ tpps_rooting()
tpps_rooting |
( |
array & |
$form | ) |
|
This function creates fields for rooting information.
- Parameters
-
array | $form | The form to be populated. |
Definition at line 453 of file page_2_helper.php.
455 $form[
'rooting'] = array(
456 '#type' =>
'fieldset',
457 '#title' => t(
'<div class="fieldset-title">Rooting Information:</div>'),
461 $form[
'rooting'][
'option'] = array(
463 '#title' => t(
'Rooting Type: *'),
465 0 => t(
'- Select -'),
466 'Aeroponics' => t(
'Aeroponics'),
467 'Hydroponics' => t(
'Hydroponics'),
472 $form[
'rooting'][
'soil'] = array(
473 '#type' =>
'fieldset',
476 ':input[name="study_info[rooting][option]"]' => array(
'value' =>
'Soil'),
481 $form[
'rooting'][
'soil'][
'type'] = array(
483 '#title' => t(
'Soil Type: *'),
485 0 => t(
'- Select -'),
489 'Mixed' => t(
'Mixed'),
490 'Other' => t(
'Other'),
494 $form[
'rooting'][
'soil'][
'other'] = array(
495 '#type' =>
'textfield',
498 ':input[name="study_info[rooting][soil][type]"]' => array(
'value' =>
'Other'),
503 $form[
'rooting'][
'soil'][
'container'] = array(
504 '#type' =>
'textfield',
505 '#title' => t(
'Soil Container Type: *'),
510 $treatment_options = drupal_map_assoc(array(
511 t(
'Seasonal Environment'),
512 t(
'Air temperature regime'),
513 t(
'Soil Temperature regime'),
514 t(
'Antibiotic regime'),
515 t(
'Chemical administration'),
517 t(
'Fertilizer regime'),
518 t(
'Fungicide regime'),
520 t(
'Gravity Growth hormone regime'),
521 t(
'Mechanical treatment'),
522 t(
'Mineral nutrient regime'),
523 t(
'Humidity regime'),
524 t(
'Non-mineral nutrient regime'),
525 t(
'Radiation (light, UV-B, X-ray) regime'),
526 t(
'Rainfall regime'),
528 t(
'Watering regime'),
529 t(
'Water temperature regime'),
530 t(
'Pesticide regime'),
532 t(
'other perturbation'),
535 $form[
'rooting'][
'treatment'] = array(
536 '#type' =>
'fieldset',
537 '#title' => t(
'<div class="fieldset-title">Treatments: *</div>'),
540 foreach ($treatment_options as $option) {
541 $form[
'rooting'][
'treatment'][
"$option"] = array(
542 '#type' =>
'checkbox',
543 '#title' => t(
"@opt", array(
'@opt' => $option)),
545 $form[
'rooting'][
'treatment'][
"$option-description"] = array(
546 '#type' =>
'textfield',
547 '#description' => t(
"@opt Description *", array(
'@opt' => $option)),
550 ':input[name="study_info[rooting][treatment][' . $option .
']"]' => array(
'checked' => TRUE),
tpps_control(array &$form, $type, $label)
◆ tpps_study_date()
tpps_study_date |
( |
|
$type, |
|
|
array & |
$form, |
|
|
array & |
$form_state |
|
) |
| |
This function creates fields describing the study dates.
- Parameters
-
string | $type | The type of date, 'Starting' or 'Ending'. |
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 21 of file page_2_helper.php.
23 $form[$type .
'Date'] = array(
24 '#type' =>
'fieldset',
28 if ($type ==
"Ending") {
29 $form[
'EndingDate'][
'#states'] = array(
32 array(
':input[name="StartingDate[month]"]' => array(
'value' =>
'0')),
34 array(
':input[name="StartingDate[year]"]' => array(
'value' =>
'0')),
40 $form[$type .
'Date'][
'#title'] = t(
'<div class="fieldset-title">Experiment/Analysis Dates</div>');
44 $yearArr[0] =
'- Select -';
45 for ($i = 1970; $i <= 2018; $i++) {
51 'January' =>
'January',
52 'February' =>
'February',
59 'September' =>
'September',
60 'October' =>
'October',
61 'November' =>
'November',
62 'December' =>
'December',
65 $form[$type .
'Date'][
'year'] = array(
67 '#title' => t(
"@type Year: *", array(
'@type' => $type)),
68 '#options' => $yearArr,
71 $form[$type .
'Date'][
'month'] = array(
73 '#title' => t(
"@type Month: *", array(
'@type' => $type)),
74 '#options' => $monthArr,
77 ':input[name="' . $type .
'Date[year]"]' => array(
'value' =>
'0'),
82 if ($type ==
"Starting") {
83 $form[
'StartingDate'][
'year'][
'#ajax'] = array(
84 'callback' =>
'tpps_date_year_callback',
85 'wrapper' =>
'Endingyear',
87 $form[
'StartingDate'][
'month'][
'#ajax'] = array(
88 'callback' =>
'tpps_date_month_callback',
89 'wrapper' =>
'Endingmonth',
93 $form[
'EndingDate'][
'year'][
'#ajax'] = array(
94 'callback' =>
'tpps_date_month_callback',
95 'wrapper' =>
'Endingmonth',
97 $form[
'EndingDate'][
'year'][
'#prefix'] =
'<div id="Endingyear">';
98 $form[
'EndingDate'][
'year'][
'#suffix'] =
'</div>';
99 $form[
'EndingDate'][
'month'][
'#prefix'] =
'<div id="Endingmonth">';
100 $form[
'EndingDate'][
'month'][
'#suffix'] =
'</div>';
102 if (isset($form_state[
'values'][
'StartingDate'][
'year']) and $form_state[
'values'][
'StartingDate'][
'year'] !=
'0') {
104 $yearArr[0] =
'- Select -';
105 for ($i = $form_state[
'values'][
'StartingDate'][
'year']; $i <= 2018; $i++) {
108 $form[
'EndingDate'][
'year'][
'#options'] = $yearArr;
110 if (isset($form_state[
'values'][
'EndingDate'][
'year']) and $form_state[
'values'][
'EndingDate'][
'year'] == $form_state[
'values'][
'StartingDate'][
'year'] and isset($form_state[
'values'][
'StartingDate'][
'month']) and $form_state[
'values'][
'StartingDate'][
'month'] !=
'0') {
111 foreach ($monthArr as $key) {
112 if ($key !=
'0' and $key != $form_state[
'values'][
'StartingDate'][
'month']) {
113 unset($monthArr[$key]);
115 elseif ($key == $form_state[
'values'][
'StartingDate'][
'month']) {
119 $form[
'EndingDate'][
'month'][
'#options'] = $monthArr;