Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ipb_forum.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset.inc';
19 
31 class Ipb_Forum extends Asset
32 {
33 
39  var $_ipbid = 0;
40 
46  var $_prefix = '';
47 
53  var $_suffix = '';
54 
55 
62  function Ipb_Forum($ipbid=0, $data=Array())
63  {
64  $this->_ser_attrs = TRUE;
65  $this->_loadVars();
66 
67  if (!$ipbid || empty($data)) {
68  return;
69  }
70 
71  $ipb_bridge =& $GLOBALS['SQ_SYSTEM']->am->getAsset($ipbid, 'ipb_bridge');
72  if (is_null($ipb_bridge)) return;
73 
74  $this->_ipbid = $ipbid;
75 
76  // set general object properties
77  $tmp = explode('_', $data['id']);
78  $this->_prefix = $tmp[0];
79  $this->_suffix = $tmp[1];
80  $this->id = $ipb_bridge->id.':'.$data['id'];
81  $this->name = $data['name'];
82  $this->name = $data['name'];
83 
84  $this->short_name = $this->name;
85  $this->status = $ipb_bridge->status;
86  $this->version = '0.1';
87  if (!empty($ipb_bridge->created)) {
88  $this->created = date('Y-m-d H:m:i', $ipb_bridge->created);
89  }
90  if (!empty($ipb_bridge->updated)) {
91  $this->updated = date('Y-m-d H:m:i', $ipb_bridge->updated);
92  }
93  if (!empty($ipb_bridge->published)) {
94  $this->published = date('Y-m-d H:m:i', $ipb_bridge->published);
95  }
96  if (!empty($ipb_bridge->status_changed)) {
97  $this->status_changed = date('Y-m-d H:m:i', $ipb_bridge->status_changed);
98  }
99 
100  // set the data paths
101  $this->_loadDataPaths();
102 
103  // Ipb_Post doesn't have 'name' and 'description'
104  if ($this->_prefix != 'p') {
105  $this->vars['name']['type'] = 'text';
106  $this->vars['name']['value'] = $data['name'];
107 
108  $this->vars['description']['type'] = 'text';
109  if (!empty($data['description'])) {
110  $this->vars['description']['value'] = $data['description'];
111  }
112  }
113 
114  // category
115  if ($this->_prefix == 'f' && $this->_suffix == '0') {
116  // number of root forums
117  $ipb_bridge =& $GLOBALS['SQ_SYSTEM']->am->getAsset($ipbid);
118  $ipb =& $ipb_bridge->getIpbConn();
119  $root_forums = $ipb->getListOfRootForums();
120 
121  $this->vars['root_forums']['type'] = 'int';
122  $this->vars['root_forums']['value'] = count($root_forums);
123  }
124 
125  // nomal forum
126  if ($this->_prefix == 'f' && $this->_suffix != '0') {
127  $this->vars['topics']['type'] = 'int';
128  $this->vars['topics']['value'] = $data['topics'];
129  }
130 
131  }//end constructor
132 
133 
141  function _getAllowedLinks()
142  {
143  return Array();
144 
145  }//end _getAllowedLinks()
146 
147 
157  function _getName($short_name=FALSE)
158  {
159  return 'IPB All Forums';
160 
161  }//end _getName()
162 
163 
164 }//end class
165 
166 ?>