Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ipb_user.inc
1 <?php
18 require_once SQ_CORE_PACKAGE_PATH.'/users/backend_user/backend_user.inc';
19 
31 class Ipb_User extends Backend_User
32 {
33 
39  var $_ipbid = 0;
40 
41 
49  function Ipb_User($ipbid=0, $data=Array())
50  {
51  $this->_ser_attrs = TRUE;
52  $this->_loadVars();
53 
54  if (!$ipbid || empty($data)) {
55  return;
56  }
57 
58  $ipb_bridge =& $GLOBALS['SQ_SYSTEM']->am->getAsset($ipbid, 'ipb_bridge');
59  if (is_null($ipb_bridge)) return;
60 
61  $this->_ipbid = $ipbid;
62 
63  // set general object properties
64  $this->id = $ipb_bridge->id.':'.$data['id'];
65  if (!isset($data['name'])) {
66  $this->name = translate('ipb_unknown_user');
67  } else {
68  $this->name = $data['name'];
69  }
70 
71  $this->short_name = $this->name;
72  $this->status = $ipb_bridge->status;
73  $this->version = '0.1';
74  if (!empty($ipb_bridge->created)) {
75  $this->created = date('Y-m-d H:m:i', $ipb_bridge->created);
76  }
77  if (!empty($ipb_bridge->updated)) {
78  $this->updated = date('Y-m-d H:m:i', $ipb_bridge->updated);
79  }
80  if (!empty($ipb_bridge->published)) {
81  $this->published = date('Y-m-d H:m:i', $ipb_bridge->published);
82  }
83  if (!empty($ipb_bridge->status_changed)) {
84  $this->status_changed = date('Y-m-d H:m:i', $ipb_bridge->status_changed);
85  }
86 
87  // set the data paths
88  $this->_loadDataPaths();
89 
90  // set variable values
91  $this->vars['mgroup']['type'] = 'text';
92  $this->vars['mgroup']['value'] = (empty($data['mgroup'])) ? 'none' : $data['mgroup'];
93 
94  $this->vars['name']['type'] = 'text';
95  $this->vars['name']['value'] = (empty($data['name'])) ? 'none' : $data['name'];
96 
97  $this->vars['email']['type'] = 'email';
98  $this->vars['email']['value'] = (empty($data['email'])) ? 'none' : $data['email'];
99 
100  $this->vars['title']['type'] = 'text';
101  $this->vars['title']['value'] = (empty($data['title'])) ? 'none' : $data['title'];
102 
103  $this->vars['member_login_key']['type'] = 'text';
104  $this->vars['member_login_key']['value'] = (empty($data['member_login_key'])) ? 'none' : $data['member_login_key'];
105 
106  $day_empty = empty($data['bday_day']);
107  $month_empty = empty($data['bday_month']);
108  $year_empty = empty($data['bday_year']);
109  $this->vars['date_of_birth']['type'] = 'text';
110  if ($day_empty || $month_empty || $year_empty) {
111  $this->vars['date_of_birth']['value'] = 'none';
112  } else {
113  $this->vars['date_of_birth']['value'] = $data['bday_day'].' / '.$data['bday_month'].' / '.$data['bday_year'];
114  }
115 
116  if (isset($data['photo_type'])) {
117  $this->vars['photo_type']['value'] = $data['photo_type'];
118  } else {
119  $this->vars['photo_type']['value'] = '';
120  }
121  $this->vars['photo_type']['type'] = 'text';
122 
123  if (isset($data['photo_location'])) {
124  $this->vars['photo_location']['value'] = $data['photo_location'];
125  } else {
126  $this->vars['photo_location']['value'] = '';
127  }
128  $this->vars['photo_location']['type'] = 'text';
129 
130  $this->vars['aim_name']['type'] = 'text';
131  $this->vars['aim_name']['value'] = (empty($data['aim_name'])) ? 'none' : $data['aim_name'];
132 
133  $this->vars['icq_number']['type'] = 'text';
134  $this->vars['icq_number']['value'] = (empty($data['icq_number'])) ? 'none' : $data['icq_number'];
135 
136  $this->vars['website']['type'] = 'text';
137  $this->vars['website']['value'] = (empty($data['website'])) ? 'none' : $data['website'];
138 
139  $this->vars['yahoo']['type'] = 'text';
140  $this->vars['yahoo']['value'] = (empty($data['yahoo'])) ? 'none' : $data['yahoo'];
141 
142  $this->vars['interests']['type'] = 'text';
143  $this->vars['interests']['value'] = (empty($data['interests'])) ? 'none' : html_entity_decode($data['interests']);
144 
145  $this->vars['msnname']['type'] = 'text';
146  $this->vars['msnname']['value'] = (empty($data['msnname'])) ? 'none' : $data['msnname'];
147 
148  $this->vars['vdirs']['type'] = 'text';
149  $this->vars['vdirs']['value'] = (empty($data['vdirs'])) ? 'none' : $data['vdirs'];
150 
151  $this->vars['location']['type'] = 'text';
152  $this->vars['location']['value'] = (empty($data['location'])) ? 'none' : $data['location'];
153 
154  $this->vars['signature']['type'] = 'text';
155  $this->vars['signature']['value'] = (empty($data['signature'])) ? 'none' : $data['signature'];
156 
157  $this->vars['avatar_location']['type'] = 'text';
158  $this->vars['avatar_location']['value'] = (empty($data['avatar_location'])) ? 'none' : $data['avatar_location'];
159 
160  $this->vars['avatar_size']['type'] = 'text';
161  $this->vars['avatar_size']['value'] = (empty($data['avatar_size'])) ? 'none' : $data['avatar_size'];
162 
163  $this->vars['avatar_type']['type'] = 'text';
164  $this->vars['avatar_type']['value'] = (empty($data['avatar_type'])) ? 'none' : $data['avatar_type'];
165 
166  // custom fields
167  $ipb =& $ipb_bridge->getIpbConn();
168  $custom_fields = $ipb->getCustomFields();
169  $user_custom_data = $ipb->getMemberCustomFieldData($this->id);
170  foreach ($custom_fields as $field) {
171  $field_name = strtolower($field['pf_title']);
172  $field_name = str_replace(' ', '_', $field_name);
173  $field_value = (isset($user_custom_data[0]['field_'.$field['pf_id']]) ? $user_custom_data[0]['field_'.$field['pf_id']] : '');
174  $this->vars[$field_name]['value'] = $field_value;
175  $this->vars[$field_name]['type'] = 'text';
176  }
177 
178  }//end constructor
179 
180 
188  function _getAllowedLinks()
189  {
190  return Array();
191 
192  }//end _getAllowedLinks()
193 
194 
204  function _getName($short_name=FALSE)
205  {
206  return 'IPB User';
207 
208  }//end _getName()
209 
210 
219  function canLogin()
220  {
221  return TRUE;
222 
223  }//end canLogin()
224 
225 
232  function &getWorkspace()
233  {
234  $null = NULL;
235  return $null;
236 
237  }//end getWorkspace()
238 
239 
240 }//end class
241 
242 ?>