Tripal Plant PopGen Submit
status_bar.inc File Reference

Go to the source code of this file.

Functions

 tpps_status_bar (array &$form, array $form_state)
 

Detailed Description

Defines function to display the TPPS Status Bar.

Definition in file status_bar.inc.

Function Documentation

◆ tpps_status_bar()

tpps_status_bar ( array &  $form,
array  $form_state 
)

Adds the TPPS Status Bar to the top of the form.

The status bar allows users to see where they are in the TPPS Submission form steps.

Parameters
array$formThe form being populated.
array$form_stateThe state of the form being populated.

string $base_url The base URL of the site.

Definition at line 22 of file status_bar.inc.

22  {
23 
24  global $base_url;
25 
26  $form['#prefix'] = '<style>
27  .tgdr_form_status div {
28  display: inline-block;
29  padding: 3px;
30  margin-right: 10px;
31  }
32  .tgdr_form_status div img {
33  vertical-align: middle;
34  margin-bottom: 4px;
35  margin-right: 2px;
36  }
37 
38  .tgdr_form_status {
39  padding: 5px;
40  background-color: #ffffff;
41  border: 1px solid #cccccc;
42  border-radius: 4px;
43  margin-bottom: 10px;
44  }
45 
46  .btn-primary[name=op]{
47  margin: 10px 10px 10px 0px;
48  }
49 
50  a.fieldset-title {
51  display: contents;
52  }
53  </style>';
54  $form['#prefix'] .= '<div class="tgdr_form_status">';
55 
56  /**** Page 1 ****/
57  if (isset($form_state['saved_values'][TPPS_PAGE_1]) and $form_state['stage'] != TPPS_PAGE_1) {
58  $image_fname = 'message-16-ok.png';
59  }
60  else {
61  $image_fname = 'message-16-warning.png';
62  }
63  $form['#prefix'] .= "<div><img src='$base_url/misc/$image_fname'> Author and Species Information</div>";
64 
65  /**** Page 2 ****/
66  if ($form_state['stage'] != TPPS_PAGE_2 and !isset($form_state['saved_values'][TPPS_PAGE_2]['#cleared'])) {
67  $image_fname = 'message-16-error.png';
68  }
69  elseif ($form_state['stage'] != TPPS_PAGE_2 and $form_state['saved_values'][TPPS_PAGE_2]['#cleared'] == TRUE) {
70  $image_fname = 'message-16-ok.png';
71  }
72  else {
73  $image_fname = 'message-16-warning.png';
74  }
75  $form['#prefix'] .= "<div><img src='$base_url/misc/$image_fname'> Experimental Conditions</div>";
76 
77  /**** Page 3 ****/
78  if ($form_state['stage'] != TPPS_PAGE_3 and !isset($form_state['saved_values'][TPPS_PAGE_3]['#cleared'])) {
79  $image_fname = 'message-16-error.png';
80  }
81  elseif ($form_state['stage'] != TPPS_PAGE_3 and $form_state['saved_values'][TPPS_PAGE_3]['#cleared'] == TRUE) {
82  $image_fname = 'message-16-ok.png';
83  }
84  else {
85  $image_fname = 'message-16-warning.png';
86  }
87  $form['#prefix'] .= "<div><img src='$base_url/misc/$image_fname'> Plant Accession</div>";
88 
89  /**** Page 4 ****/
90  if ($form_state['stage'] != TPPS_PAGE_4 and !isset($form_state['saved_values'][TPPS_PAGE_4]['#cleared'])) {
91  $image_fname = 'message-16-error.png';
92  }
93  elseif ($form_state['stage'] != TPPS_PAGE_4 and $form_state['saved_values'][TPPS_PAGE_4]['#cleared'] == TRUE) {
94  $image_fname = 'message-16-ok.png';
95  }
96  else {
97  $image_fname = 'message-16-warning.png';
98  }
99  $form['#prefix'] .= "<div><img src='$base_url/misc/$image_fname'> Submit Data</div>";
100 
101  $form['#prefix'] .= '</div>';
102 }
const TPPS_PAGE_1
Definition: tpps.module:12
const TPPS_PAGE_4
Definition: tpps.module:15
const TPPS_PAGE_3
Definition: tpps.module:14
const TPPS_PAGE_2
Definition: tpps.module:13