Squiz Matrix  4.12.2
 All Data Structures Namespaces Functions Variables Pages
ipb_poll.inc
1 <?php
18 require_once SQ_INCLUDE_PATH.'/asset.inc';
19 
31 class Ipb_Poll extends Asset
32 {
33 
39  var $_ipbid = 0;
40 
46  var $_prefix = '';
47 
53  var $_suffix = '';
54 
55 
62  function Ipb_Poll($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  if ($this->_suffix != '0') {
82  $this->name = '('.$data['poll_state'].') '.$data['poll_question'];
83  } else {
84  $this->name = $data['poll_question'];
85  }
86 
87  $this->short_name = $this->name;
88  $this->status = $ipb_bridge->status;
89  $this->version = '0.1';
90  if (!empty($ipb_bridge->created)) {
91  $this->created = date('Y-m-d H:m:i', $ipb_bridge->created);
92  }
93  if (!empty($ipb_bridge->updated)) {
94  $this->updated = date('Y-m-d H:m:i', $ipb_bridge->updated);
95  }
96  if (!empty($ipb_bridge->published)) {
97  $this->published = date('Y-m-d H:m:i', $ipb_bridge->published);
98  }
99  if (!empty($ipb_bridge->status_changed)) {
100  $this->status_changed = date('Y-m-d H:m:i', $ipb_bridge->status_changed);
101  }
102 
103  // set the data paths
104  $this->_loadDataPaths();
105 
106  if ($this->_suffix != '0') {
107  $this->vars['pid']['type'] = 'int';
108  $this->vars['pid']['value'] = $data['pid'];
109 
110  $this->vars['tid']['type'] = 'int';
111  $this->vars['tid']['value'] = $data['tid'];
112 
113  $this->vars['start_date']['type'] = 'int';
114  $this->vars['start_date']['value'] = $data['start_date'];
115 
116  $this->vars['choices']['type'] = 'text';
117  $this->vars['choices']['value'] = $data['choices'];
118 
119  $this->vars['starter_id']['type'] = 'int';
120  $this->vars['starter_id']['value'] = $data['starter_id'];
121 
122  $this->vars['votes']['type'] = 'int';
123  $this->vars['votes']['value'] = $data['votes'];
124 
125  $this->vars['forum_id']['type'] = 'int';
126  $this->vars['forum_id']['value'] = $data['forum_id'];
127 
128  $this->vars['poll_question']['type'] = 'text';
129  $this->vars['poll_question']['value'] = $data['poll_question'];
130 
131  $this->vars['poll_state']['type'] = 'text';
132  $this->vars['poll_state']['value'] = $data['poll_state'];
133  }
134 
135  }//end constructor
136 
137 
145  function _getAllowedLinks()
146  {
147  return Array();
148 
149  }//end _getAllowedLinks()
150 
151 
161  function _getName($short_name=FALSE)
162  {
163  return 'IPB Polls';
164 
165  }//end _getName()
166 
167 
168 }//end class
169 
170 ?>