Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
condition_asset_type_edit_fns.inc
1 <?php
17 require_once SQ_CORE_PACKAGE_PATH.'/system/conditions/condition/condition_edit_fns.inc';
18 
32 {
33 
34 
40  function __construct()
41  {
42  parent::__construct();
43 
44  }//end constructor
45 
46 
58  public static function paintEditInterface(Array $condition_data, Backend_Outputter $o, $prefix, $write_access)
59  {
60  $asset_types = array_get_index($condition_data, 'types', '');
61 
62  $type_list = Array();
63  if (!empty($asset_types)) {
64  $type_list = explode(',', $asset_types);
65  }
66 
67  if ($write_access) {
68  ?><table style="width: auto" border="0" class="no-borders">
69  <tr>
70  <td><?php
71  asset_type_chooser($prefix.'[type_list]', TRUE, $type_list, NULL, FALSE, FALSE, Array('asset'));
72  ?></td>
73  </tr>
74  </table><?php
75  } elseif (!empty($type_list)) {
76  $type_names = $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($type_list, 'name');
77  ?><table class="sq-backend-table">
78  <tr>
79  <th><?php echo translate('type') ?></th>
80  </tr><?php
81  foreach ($type_list as $type) {
82  ?><tr>
83  <td><?php
84  echo get_asset_type_icon($type);
85  echo $type_names[$type];
86  ?></td>
87  </tr><?php
88  }
89  ?></table><?php
90  }
91 
92  }//end paintEditInterface()
93 
94 
104  public static function processEditInterface(Backend_Outputter $o, $prefix)
105  {
106  if (!isset($_POST[$prefix]['type_list']) || empty($_POST[$prefix]['type_list'])) {
107  return Array();
108  }
109 
110  // construct and return data required by this condition
111  // as found in the post data, array required consists of
112  // 'match' and 'condition_data'
113  $results = Array(
114  'types' => trim(implode(',', $_POST[$prefix]['type_list']),','),
115  );
116 
117  return $results;
118 
119  }//end processEditInterface()
120 
121 
122 }//end class
123 
124 ?>