18 require_once SQ_INCLUDE_PATH.
'/asset_edit/asset_edit_fns.inc';
43 $this->static_screens = Array(
46 'force_unlock' => TRUE,
47 'lock_type' =>
'none',
49 'dependants' => Array(
50 'name' =>
'Dependants',
51 'force_unlock' => TRUE,
52 'lock_type' =>
'none',
72 if ($asset->_suffix ==
'0') {
73 $ipb_bridge =& $GLOBALS[
'SQ_SYSTEM']->am->getAsset($asset->_ipbid,
'ipb_bridge');
74 $ipb =& $ipb_bridge->getIpbConn();
75 $list_of_polls = $ipb->getListOfPolls();
77 if (empty($list_of_polls)) {
78 $o->openField(translate(
'list_of_polls'));
79 echo translate(
'no_poll_in_forum');
82 $o->openSection(translate(
'summary'));
83 $o->openField(translate(
'num_of_polls'));
84 echo count($list_of_polls);
87 $o->openField(translate(
'list_of_polls'));
88 $ipb =& $ipb_bridge->getIpbConn();
90 <table
class=
"sq-backend-table">
92 <th style=
"width: 45%"><?php echo translate(
'question'); ?></th>
93 <th style=
"width: 50%"><?php echo translate(
'asset'); ?></th>
94 <th style=
"width: 15%"><?php echo translate(
'state'); ?></th>
97 foreach ($list_of_polls as $poll) {
98 $data = $ipb->getTopicInfo($ipb_bridge->id.
':'.
't_'.$poll[
'tid']);
101 <td style=
"font-weight: bold;"><?php echo $poll[
'poll_question']; ?></td>
102 <td><?php echo get_asset_tag_line($asset->_ipbid.
':'.
'o_'.$poll[
'pid']); ?></td>
103 <td><?php echo $data[
'poll_state']; ?></td>
114 $o->openSection(
'Details');
115 $poll_question = $asset->attr(
'poll_question');
116 $start_date = date(
'g:i:s D j M Y', $asset->attr(
'start_date'));
118 $started_by = get_asset_tag_line($asset->_ipbid.
':'.
'u_'.$asset->attr(
'starter_id'));
119 $forum_tag_line = get_asset_tag_line($asset->_ipbid.
':'.
'f_'.$asset->attr(
'forum_id'));
120 $total_votes = $asset->attr(
'votes');
122 translate(
'poll_question') => $poll_question,
123 translate(
'start_date') => $start_date,
124 translate(
'started_by') => $started_by,
125 translate(
'forum') => $forum_tag_line,
126 translate(
'total_votes') => $total_votes,
128 foreach ($fields as $key => $value) {
134 $o->openField(
'Results');
135 $poll_data = @unserialize(stripslashes($asset->attr(
'choices')));
136 if ($poll_data === FALSE) {
137 echo
'<b>'.translate(
'poll_result_error').
'</b>';
139 $total_votes = $asset->attr(
'votes');
141 <table
class=
"sq-backend-table">
143 <th style=
"width: 40%"><?php echo translate(
'option'); ?></th>
144 <th style=
"width: 30%"><?php echo translate(
'votes'); ?></th>
145 <th style=
"width: 30%"><?php echo translate(
'percentage'); ?></th>
148 foreach ($poll_data as $data) {
151 <td><?php echo $data[1]; ?></td>
152 <td><?php echo $data[2]; ?></td>
153 <td><?php echo ($data[2]==0) ? 0 : ($data[2]/$total_votes) * 100; ?> %</td>