Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
condition_user_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  $user_types = array_get_index($condition_data, 'user_types', '');
61 
62  $type_list = Array();
63  if (!empty($user_types)) {
64  $user_types = str_replace(' ', '', $user_types);
65  $type_list = explode(',', $user_types);
66  }
67 
68  if ($write_access) {
69  ?><table style="width: auto" border="0" class="no-borders">
70  <tr>
71  <td><?php
72  asset_type_chooser($prefix.'[type_list]', TRUE, $type_list, NULL, FALSE, FALSE, Array('user'));
73  ?></td>
74  </tr>
75  </table><?php
76  } elseif (!empty($type_list)) {
77  $type_names = $GLOBALS['SQ_SYSTEM']->am->getTypeInfo($type_list, 'name');
78  ?><table class="sq-backend-table">
79  <tr>
80  <th><?php echo translate('type') ?></th>
81  </tr><?php
82  $inherit_image_path = sq_web_path('lib').'/web/images/';
83  foreach ($type_list as $type) {
84  ?><tr>
85  <td><?php
86  echo get_asset_type_icon($type);
87  echo $type_names[$type];
88  ?></td>
89  </tr><?php
90  }
91  ?></table><?php
92  }
93 
94  }//end paintEditInterface()
95 
96 
106  public static function processEditInterface(Backend_Outputter $o, $prefix)
107  {
108  if (!isset($_POST[$prefix]['type_list']) || empty($_POST[$prefix]['type_list'])) {
109  return Array();
110  }
111 
112  // construct and return data required by this condition
113  // as found in the post data, array required consists of
114  // 'match' and 'condition_data'
115  $results = Array(
116  'user_types' => trim(implode(', ', $_POST[$prefix]['type_list']),', '),
117  );
118 
119  return $results;
120 
121  }//end processEditInterface()
122 
123 
124 }//end class
125 
126 ?>