Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ipb_user_group.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/users/user_group/user_group.inc';
19 
32 {
33 
39  var $_ipbid = 0;
40 
47  var $_prefix = '';
48 
55  var $_suffix = '';
56 
57 
65  function Ipb_User_Group($ipbid=0, $data=Array())
66  {
67  $this->_ser_attrs = TRUE;
68  $this->_loadVars();
69 
70  if (!$ipbid || empty($data)) {
71  return;
72  }
73  $ipb_bridge =& $GLOBALS['SQ_SYSTEM']->am->getAsset($ipbid, 'ipb_bridge');
74  if (is_null($ipb_bridge)) return;
75  $this->_ipbid = $ipbid;
76 
77  // set general object properties
78  $tmp = explode('_', $data['id']);
79  $this->_prefix = $tmp[0];
80  $this->_suffix = $tmp[1];
81  $this->id = $ipb_bridge->id.':'.$data['id'];
82  if ($this->_suffix != '0') {
83  $this->name = $data['g_title'];
84  } else {
85  $this->name = $data['name'];
86  }
87  if (empty($this->name)) {
88  $this->name = translate('ipb_unknown_user');
89  }
90 
91  $this->short_name = $this->name;
92  $this->status = $ipb_bridge->status;
93  $this->version = '0.1';
94 
95  // set the data paths
96  $this->_loadDataPaths();
97 
98  $this->vars['name']['type'] = 'text';
99  $this->vars['name']['value'] = (empty($data['name'])) ? 'none' : $data['name'];
100 
101  if ($this->_suffix != '0') {
102 
103  foreach (array_keys($data) as $key) {
104  $this->vars[$key]['type'] = 'text';
105 
106  // We have to prettify some settings
107  switch ($key) {
108 
109  case 'g_photo_max_vars':
110  if (!empty($data[$key])) {
111  $tmp = explode(':', $data[$key]);
112  $value = $tmp[0].' KB';
113  if (!empty($tmp[1])) {
114  $value .= ', Max Width (px): '.$tmp[1];
115  }//end if
116  if (!empty($tmp[2])) {
117  $value .= ', Max Height (px): '.$tmp[2];
118  }//end if
119  $this->vars[$key]['value'] = $value;
120  } else {
121  $this->vars[$key]['value'] = '0';
122  }//end if
123  break;
124 
125  case 'g_email_friend' :
126  if ($data[$key]) {
127  $value = 'Yes';
128  $tmp = explode(':', $data['g_email_limit']);
129  if ($tmp[0] != '0') {
130  $value .= '. Only allow '.$tmp[1].' emails in a 24hr period';
131  }
132  if ($tmp[1] != '0') {
133  $value .= ' and only allow 1 email every '.$tmp[1].' minutes';
134  }
135  $this->vars[$key]['value'] = $value;
136  } else {
137  $this->vars[$key]['value'] = 'No';
138  }
139 
140  break;
141 
142  case 'g_promotion' :
143  $tmp = explode('&', $data[$key]);
144  $value = 'none';
145  if ($tmp[0] != '-1') {
146  $g_id = $tmp[0];
147  $ipb =& $ipb_bridge->getIpbConn();
148  $list_of_groups = $ipb->getMemberGroupInfo('groups');
149  $value = 'Promote members of this group to : '.$list_of_groups['g_'.$g_id]['g_title'];
150  }
151  if ($tmp[1] != '-1') {
152  $value .= ' when they reach '.$tmp[1].' posts';
153  }
154  $this->vars['g_promotion']['value'] = $value;
155 
156  break;
157 
158  default:
159  $this->vars[$key]['value'] = $data[$key];
160  break;
161 
162  }//end switch
163 
164  }//end foreach
165 
166  }//end if
167 
168  }//end constructor
169 
170 
177  function _getAllowedLinks()
178  {
179  return Array();
180 
181  }//end _getAllowedLinks()
182 
183 
184 }//end class
185 
186 ?>