Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
condition_asset_status_edit_fns.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/system/conditions/condition/condition_edit_fns.inc';
18 require_once SQ_LIB_PATH.'/html_form/html_form.inc';
19 
33 {
34 
35 
41  function __construct()
42  {
43  parent::__construct();
44 
45  }//end constructor
46 
47 
59  public static function paintEditInterface(Array $condition_data, Backend_Outputter $o, $prefix, $write_access)
60  {
61 
62  foreach (get_constant_values('SQ_STATUS_') as $status_value) {
63  $statii[$status_value] = get_status_description($status_value);
64  }//end foreach
65 
66  if (!isset($condition_data['status'])) {
67  $selected_statii = Array();
68  } else {
69 
70  if (!is_array($condition_data['status'])) {
71  $selected_statii = explode(',', $condition_data['status']);
72 
73  foreach ($selected_statii as $key => $status) {
74  if (!is_numeric($status)) {
75  $selected_statii[$key] = get_status_value(trim($status));
76  }//end if
77 
78  }//end foreach
79 
80  } else {
81  $selected_statii = $condition_data['status'];
82  }//end if
83 
84  }
85 
86 
87 
88  ?>
89  <table style="width: auto" class="no-borders">
90  <tr>
91  <td>
92  <?php
93  if ($write_access) {
94  combo_box($prefix.'[status]', $statii, TRUE, $selected_statii);
95  } else {
96  foreach ($selected_statii as $status) {
97  echo get_status_description($status).'<br />';
98  }//end foreach
99  }
100  ?>
101  </td>
102  </tr>
103 
104  </table>
105  <?php
106 
107  }//end paintEditInterface()
108 
109 
119  public static function processEditInterface(Backend_Outputter $o, $prefix)
120  {
121  if (!isset($_POST[$prefix])) return Array();
122 
123  $results = Array(
124  'status' => implode(',', $_POST[$prefix]['status']),
125  );
126  return $results;
127 
128  }//end processEditInterface()
129 
130 
131 }//end class
132 
133 ?>