Fixed missing display of event url;

Fixed XHTML validation error in calendar; 
Added portal block;
This commit is contained in:
Marc Alexander
2010-10-19 12:56:23 +00:00
parent 1ea2f6f3e5
commit 6b49958396
8 changed files with 1084 additions and 4 deletions

View File

@@ -151,7 +151,7 @@
<td style="text-align: center;">{events.EVENT_TITLE}</td> <td style="text-align: center;">{events.EVENT_TITLE}</td>
<td style="text-align: center;">{events.EVENT_DESC}</td> <td style="text-align: center;">{events.EVENT_DESC}</td>
<td style="text-align: center;"><!-- IF events.EVENT_END -->{L_EVENT_START}:&nbsp;{events.EVENT_START}&nbsp;&#124;&nbsp;{L_EVENT_END}:&nbsp;{events.EVENT_END}<!-- ELSE -->{L_EVENT_TIME}:&nbsp;{events.EVENT_START}<!-- IF events.EVENT_ALL_DAY -->&nbsp;&#124;&nbsp;{L_EVENT_ALL_DAY}<!-- ENDIF --><!-- ENDIF --></td> <td style="text-align: center;"><!-- IF events.EVENT_END -->{L_EVENT_START}:&nbsp;{events.EVENT_START}&nbsp;&#124;&nbsp;{L_EVENT_END}:&nbsp;{events.EVENT_END}<!-- ELSE -->{L_EVENT_TIME}:&nbsp;{events.EVENT_START}<!-- IF events.EVENT_ALL_DAY -->&nbsp;&#124;&nbsp;{L_EVENT_ALL_DAY}<!-- ENDIF --><!-- ENDIF --></td>
<td style="text-align: center;">{events.LINK_URL}</td> <td style="text-align: center;">{events.EVENT_URL}</td>
<td style="text-align: center;"> <td style="text-align: center;">
<a href="{events.U_EDIT}">{ICON_EDIT}</a> <a href="{events.U_DELETE}">{ICON_DELETE}</a> <a href="{events.U_EDIT}">{ICON_EDIT}</a> <a href="{events.U_DELETE}">{ICON_DELETE}</a>
</td> </td>

View File

@@ -0,0 +1,56 @@
<?php
/**
* @package Portal - Poll
* @version $Id$
* @copyright (c) 2009, 2010 Board3 Portal Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
/**
* DO NOT CHANGE
*/
if (!defined('IN_PHPBB'))
{
exit;
}
if (empty($lang) || !is_array($lang))
{
$lang = array();
}
// DEVELOPERS PLEASE NOTE
//
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
//
// Placeholders can now contain order information, e.g. instead of
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
// translators to re-order the output of data while ensuring it remains correct
//
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
// equally where a string contains only two placeholders which are used to wrap text
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
$lang = array_merge($lang, array(
'PORTAL_POLL' => 'Poll',
'LATEST_POLLS' => 'Latest Polls',
'NO_OPTIONS' => 'This poll has no available options.',
'NO_POLL' => 'No polls available',
'RETURN_PORTAL' => '%sReturn to the portal%s',
// ACP
'ACP_PORTAL_POLLS_SETTINGS' => 'Poll settings',
'ACP_PORTAL_POLLS_SETTINGS_EXP' => 'This is where you customize the poll block.',
'PORTAL_POLL_TOPIC' => 'Display poll blocks',
'PORTAL_POLL_TOPIC_EXP' => 'Display this block on the portal.',
'PORTAL_POLL_TOPIC_ID' => 'Poll forum(s)',
'PORTAL_POLL_TOPIC_ID_EXP' => 'The forum(s) from which the polls should be displayed. If "Exclude forums" is set to "Yes", select the forums you want to exclude.<br />If "Exclude forums" is set to "No" select the forums you want to see.<br />Select/Deselect multiple forums by holding <samp>CTRL</samp> and clicking.',
'PORTAL_POLL_EXCLUDE_ID' => 'Exclude Forums',
'PORTAL_POLL_EXCLUDE_ID_EXP' => 'Select "Yes" if you want to exlude the selected forums from the polls block, and "No" if you only want to see the polls from the selected forums in the polls block.',
'PORTAL_POLL_LIMIT' => 'Poll display limit',
'PORTAL_POLL_LIMIT_EXP' => 'The number of polls you would like to display on the portal page.',
'PORTAL_POLL_ALLOW_VOTE' => 'Allow voting',
'PORTAL_POLL_ALLOW_VOTE_EXP' => 'Allow users with the required permissions to vote from the portal page.',
'PORTAL_POLL_HIDE' => 'Hide expired polls?',
));
?>

View File

@@ -184,7 +184,7 @@ class portal_calendar_module
if(($cur_event['start_time'] <= $today_timestamp && $cur_event['end_time'] <= $cur_event['start_time']) || ($cur_event['start_time'] <= $today_timestamp && $cur_event['end_time'] >= $today_timestamp)) if(($cur_event['start_time'] <= $today_timestamp && $cur_event['end_time'] <= $cur_event['start_time']) || ($cur_event['start_time'] <= $today_timestamp && $cur_event['end_time'] >= $today_timestamp))
{ {
$template->assign_block_vars('cur_events', array( $template->assign_block_vars('cur_events', array(
'EVENT_URL' => (isset($cur_event['url']) && $cur_event['url'] != '') ? $this->validate_url($cur_event['url']) : '', 'EVENT_URL' => (isset($cur_event['url']) && $cur_event['url'] != '') ? $this->validate_url(str_replace('&', '&amp;', $cur_event['url'])) : '',
'EVENT_TITLE' => $cur_event['title'], 'EVENT_TITLE' => $cur_event['title'],
'START_TIME' => $user->format_date($cur_event['start_time'], 'j. M Y, H:i'), 'START_TIME' => $user->format_date($cur_event['start_time'], 'j. M Y, H:i'),
'END_TIME' => $user->format_date($cur_event['end_time'], 'j. M Y, H:i'), 'END_TIME' => $user->format_date($cur_event['end_time'], 'j. M Y, H:i'),
@@ -195,7 +195,7 @@ class portal_calendar_module
else else
{ {
$template->assign_block_vars('upcoming_events', array( $template->assign_block_vars('upcoming_events', array(
'EVENT_URL' => (isset($cur_event['url']) && $cur_event['url'] != '') ? $this->validate_url($cur_event['url']) : '', 'EVENT_URL' => (isset($cur_event['url']) && $cur_event['url'] != '') ? $this->validate_url(str_replace('&', '&amp;', $cur_event['url'])) : '',
'EVENT_TITLE' => $cur_event['title'], 'EVENT_TITLE' => $cur_event['title'],
'CUR_EVENT' => ($cur_event['start_time'] <= $today_timestamp && $cur_event['end_time'] >= $today_timestamp) ? true : false, 'CUR_EVENT' => ($cur_event['start_time'] <= $today_timestamp && $cur_event['end_time'] >= $today_timestamp) ? true : false,
'START_TIME' => $user->format_date($cur_event['start_time'], 'j. M Y, H:i'), 'START_TIME' => $user->format_date($cur_event['start_time'], 'j. M Y, H:i'),
@@ -500,6 +500,7 @@ class portal_calendar_module
'EVENT_URL' => ($action != 'add') ? str_replace('&', '&amp;', $events[$i]['url']) : '', 'EVENT_URL' => ($action != 'add') ? str_replace('&', '&amp;', $events[$i]['url']) : '',
'EVENT_START' => ($action != 'add') ? $user->format_date($events[$i]['start_time'], 'j. M Y, H:i') : '', 'EVENT_START' => ($action != 'add') ? $user->format_date($events[$i]['start_time'], 'j. M Y, H:i') : '',
'EVENT_END' => ($action != 'add' && ($events[$i]['start_time'] - $events[$i]['end_time']) != 1) ? $user->format_date($events[$i]['end_time'], 'j. M Y, H:i') : '', 'EVENT_END' => ($action != 'add' && ($events[$i]['start_time'] - $events[$i]['end_time']) != 1) ? $user->format_date($events[$i]['end_time'], 'j. M Y, H:i') : '',
'EVENT_URL' => ($action != 'add' && isset($events[$i]['url']) && !empty($events[$i]['url'])) ? $events[$i]['url'] : '',
'U_EDIT' => $u_action . '&amp;action=edit&amp;id=' . $i, 'U_EDIT' => $u_action . '&amp;action=edit&amp;id=' . $i,
'U_DELETE' => $u_action . '&amp;action=delete&amp;id=' . $i, 'U_DELETE' => $u_action . '&amp;action=delete&amp;id=' . $i,
'EVENT_ALL_DAY' => ($events[$i]['end_time'] - $events[$i]['start_time']) ? true : false, 'EVENT_ALL_DAY' => ($events[$i]['end_time'] - $events[$i]['start_time']) ? true : false,

View File

@@ -0,0 +1,892 @@
<?php
/**
* @package Portal - Poll
* @version $Id$
* @copyright (c) 2009, 2010 Board3 Portal Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
/**
* @ignore
*/
if (!defined('IN_PHPBB'))
{
exit;
}
/**
* @package Poll
*/
class portal_poll_module
{
/**
* Allowed columns: Just sum up your options (Exp: left + right = 10)
* top 1
* left 2
* center 4
* right 8
* bottom 16
*/
var $columns = 31;
/**
* Default modulename
*/
var $name = 'PORTAL_POLL';
/**
* Default module-image:
* file must be in "{T_THEME_PATH}/images/portal/"
*/
var $image_src = 'portal_poll.png';
/**
* module-language file
* file must be in "language/{$user->lang}/mods/portal/"
*/
var $language = 'portal_poll_module';
/**
* custom acp template
* file must be in "adm/style/portal/"
*/
var $custom_acp_tpl = '';
function get_template_center($module_id)
{
global $config, $template, $db, $user, $auth, $phpbb_root_path, $phpEx;
$user->add_lang('viewtopic');
$view = request_var('view', '');
$update = request_var('update', false);
$poll_view = request_var('polls', '');
$poll_view_ar = (strpos($poll_view, ',') !== FALSE) ? explode(',', $poll_view) : (($poll_view != '') ? array($poll_view) : array());
if ($update && $config['board3_poll_allow_vote_' . $module_id])
{
$up_topic_id = request_var('t', 0);
$up_forum_id = request_var('f', 0);
$voted_id = request_var('vote_id', array('' => 0));
$cur_voted_id = array();
if ($user->data['is_registered'])
{
$sql = 'SELECT poll_option_id
FROM ' . POLL_VOTES_TABLE . '
WHERE topic_id = ' . $up_topic_id . '
AND vote_user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$cur_voted_id[] = $row['poll_option_id'];
}
$db->sql_freeresult($result);
}
else
{
// Cookie based guest tracking ... I don't like this but hum ho
// it's oft requested. This relies on "nice" users who don't feel
// the need to delete cookies to mess with results.
if (isset($_COOKIE[$config['cookie_name'] . '_poll_' . $up_topic_id]))
{
$cur_voted_id = explode(',', request_var($config['cookie_name'] . '_poll_' . $up_topic_id, 0, false, true));
$cur_voted_id = array_map('intval', $cur_voted_id);
}
}
$sql = 'SELECT t.poll_length, t.poll_start, t.poll_vote_change, t.topic_status, f.forum_status, t.poll_max_options
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
WHERE t.forum_id = f.forum_id AND t.topic_id = " . (int) $up_topic_id . " AND t.forum_id = " . (int) $up_forum_id;
$result = $db->sql_query_limit($sql, 1);
$topic_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$s_can_up_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $up_forum_id)) ||
($auth->acl_get('f_votechg', $up_forum_id) && $topic_data['poll_vote_change'])) &&
(($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) &&
$topic_data['topic_status'] != ITEM_LOCKED &&
$topic_data['forum_status'] != ITEM_LOCKED) ? true : false;
if($s_can_up_vote)
{
if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id))
{
$redirect_url = append_sid("{$phpbb_root_path}portal.$phpEx");
meta_refresh(5, $redirect_url);
if (!sizeof($voted_id))
{
$message = 'NO_VOTE_OPTION';
}
else if (sizeof($voted_id) > $topic_data['poll_max_options'])
{
$message = 'TOO_MANY_VOTE_OPTIONS';
}
else
{
$message = 'VOTE_CONVERTED';
}
$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_PORTAL'], '<a href="' . $redirect_url . '">', '</a>');
trigger_error($message);
}
foreach ($voted_id as $option)
{
if (in_array($option, $cur_voted_id))
{
continue;
}
$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . '
SET poll_option_total = poll_option_total + 1
WHERE poll_option_id = ' . (int) $option . '
AND topic_id = ' . (int) $up_topic_id;
$db->sql_query($sql);
if ($user->data['is_registered'])
{
$sql_ary = array(
'topic_id' => (int) $up_topic_id,
'poll_option_id' => (int) $option,
'vote_user_id' => (int) $user->data['user_id'],
'vote_user_ip' => (string) $user->ip,
);
$sql = 'INSERT INTO ' . POLL_VOTES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
}
}
foreach ($cur_voted_id as $option)
{
if (!in_array($option, $voted_id))
{
$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . '
SET poll_option_total = poll_option_total - 1
WHERE poll_option_id = ' . (int) $option . '
AND topic_id = ' . (int) $up_topic_id;
$db->sql_query($sql);
if ($user->data['is_registered'])
{
$sql = 'DELETE FROM ' . POLL_VOTES_TABLE . '
WHERE topic_id = ' . (int) $up_topic_id . '
AND poll_option_id = ' . (int) $option . '
AND vote_user_id = ' . (int) $user->data['user_id'];
$db->sql_query($sql);
}
}
}
if ($user->data['user_id'] == ANONYMOUS && !$user->data['is_bot'])
{
$user->set_cookie('poll_' . $up_topic_id, implode(',', $voted_id), time() + 31536000);
}
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET poll_last_vote = ' . time() . "
WHERE topic_id = $up_topic_id";
//, topic_last_post_time = ' . time() . " -- for bumping topics with new votes, ignore for now
$db->sql_query($sql);
$redirect_url = append_sid("{$phpbb_root_path}portal.$phpEx");
meta_refresh(5, $redirect_url);
trigger_error($user->lang['VOTE_SUBMITTED'] . '<br /><br />' . sprintf($user->lang['RETURN_PORTAL'], '<a href="' . $redirect_url . '">', '</a>'));
}
}
$where = '';
$poll_forums = false;
// Get readable forums
$forum_list = array();
$forum_list = array_unique(array_keys($auth->acl_getf('f_read', true)));
if($config['board3_poll_topic_id_' . $module_id] !== '')
{
$poll_forums_config = explode(',' ,$config['board3_poll_topic_id_' . $module_id]);
if($config['board3_poll_exclude_id_' . $module_id])
{
$forum_list = array_unique(array_diff($forum_list, $poll_forums_config));
}
else
{
$forum_list = array_unique(array_intersect($poll_forums_config, $forum_list));
}
}
$where = '';
if(sizeof($forum_list))
{
$poll_forums = true;
$where = 'AND ' . $db->sql_in_set('t.forum_id', $forum_list);
}
if ($config['board3_poll_hide_' . $module_id])
{
$portal_poll_hide = "AND (t.poll_start + t.poll_length > ". time() ." OR t.poll_length = 0)";
}
else
{
$portal_poll_hide = '';
}
if ($poll_forums === true)
{
$sql = 'SELECT t.poll_title, t.poll_start, t.topic_id, t.topic_first_post_id, t.forum_id, t.poll_length, t.poll_vote_change, t.poll_max_options, t.topic_status, f.forum_status, p.bbcode_bitfield, p.bbcode_uid
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
WHERE t.forum_id = f.forum_id AND t.topic_approved = 1 AND t.poll_start > 0
{$where}
AND t.topic_moved_id = 0
AND p.post_id = t.topic_first_post_id
{$portal_poll_hide}
ORDER BY t.poll_start DESC";
$limit = (isset($config['board3_poll_limit_' . $module_id])) ? $config['board3_poll_limit_' . $module_id] : 3;
$result = $db->sql_query_limit($sql, $limit);
$has_poll = false;
if ($result)
{
while($data = $db->sql_fetchrow($result))
{
$has_poll = true;
$poll_has_options = false;
$topic_id = (int) $data['topic_id'];
$forum_id = (int) $data['forum_id'];
$cur_voted_id = array();
if($config['board3_poll_allow_vote_' . $module_id])
{
if ($user->data['is_registered'])
{
$vote_sql = 'SELECT poll_option_id
FROM ' . POLL_VOTES_TABLE . '
WHERE topic_id = ' . $topic_id . '
AND vote_user_id = ' . $user->data['user_id'];
$vote_result = $db->sql_query($vote_sql);
while ($row = $db->sql_fetchrow($vote_result))
{
$cur_voted_id[] = $row['poll_option_id'];
}
$db->sql_freeresult($vote_result);
}
else
{
// Cookie based guest tracking ... I don't like this but hum ho
// it's oft requested. This relies on "nice" users who don't feel
// the need to delete cookies to mess with results.
if (isset($_COOKIE[$config['cookie_name'] . '_poll_' . $topic_id]))
{
$cur_voted_id = explode(',', request_var($config['cookie_name'] . '_poll_' . $topic_id, 0, false, true));
$cur_voted_id = array_map('intval', $cur_voted_id);
}
}
$s_can_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $forum_id)) ||
($auth->acl_get('f_votechg', $forum_id) && $data['poll_vote_change'])) &&
(($data['poll_length'] != 0 && $data['poll_start'] + $data['poll_length'] > time()) || $data['poll_length'] == 0) &&
$data['topic_status'] != ITEM_LOCKED &&
$data['forum_status'] != ITEM_LOCKED) ? true : false;
}
else
{
$s_can_vote = false;
}
$s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || ($view == 'viewpoll' && in_array($topic_id, $poll_view_ar))) ? true : false;
$poll_sql = 'SELECT po.poll_option_id, po.poll_option_text, po.poll_option_total
FROM ' . POLL_OPTIONS_TABLE . " po
WHERE po.topic_id = {$topic_id}
ORDER BY po.poll_option_id";
$poll_result = $db->sql_query($poll_sql);
$poll_total_votes = 0;
$poll_data = array();
if ($poll_result)
{
while($polls_data = $db->sql_fetchrow($poll_result))
{
$poll_has_options = true;
$poll_data[] = $polls_data;
$poll_total_votes += $polls_data['poll_option_total'];
}
}
$db->sql_freeresult($poll_result);
$make_poll_view = array();
if(in_array($topic_id, $poll_view_ar) === FALSE)
{
$make_poll_view[] = $topic_id;
$make_poll_view = array_merge($poll_view_ar, $make_poll_view);
}
$poll_view_str = urlencode(implode(',', $make_poll_view));
$portalpoll_url= append_sid("{$phpbb_root_path}portal.$phpEx", "polls=$poll_view_str");
$portalvote_url= append_sid("{$phpbb_root_path}portal.$phpEx", "f=$forum_id&amp;t=$topic_id");
$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id");
$poll_end = $data['poll_length'] + $data['poll_start'];
// Parse BBCode title
if ($data['bbcode_bitfield'])
{
$poll_bbcode = new bbcode();
}
else
{
$poll_bbcode = false;
}
$data['poll_title'] = censor_text($data['poll_title']);
if ($poll_bbcode !== false)
{
$poll_bbcode->bbcode_second_pass($data['poll_title'], $data['bbcode_uid'], $data['bbcode_bitfield']);
}
$data['poll_title'] = bbcode_nl2br($data['poll_title']);
$data['poll_title'] = smiley_text($data['poll_title']);
unset($poll_bbcode);
$template->assign_block_vars('poll', array(
'S_POLL_HAS_OPTIONS' => $poll_has_options,
'POLL_QUESTION' => $data['poll_title'],
'U_POLL_TOPIC' => append_sid($phpbb_root_path . 'viewtopic.' . $phpEx . '?t=' . $topic_id . '&amp;f=' . $forum_id),
'POLL_LENGTH' => $data['poll_length'],
'TOPIC_ID' => $topic_id,
'TOTAL_VOTES' => $poll_total_votes,
'L_MAX_VOTES' => ($data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $data['poll_max_options']),
'L_POLL_LENGTH' => ($data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '',
'S_CAN_VOTE' => $s_can_vote,
'S_DISPLAY_RESULTS' => $s_display_results,
'S_IS_MULTI_CHOICE' => ($data['poll_max_options'] > 1) ? true : false,
'S_POLL_ACTION' => $portalvote_url,
'U_VIEW_RESULTS' => $portalpoll_url . '&amp;view=viewpoll#viewpoll',
'U_VIEW_TOPIC' => $viewtopic_url,
));
foreach($poll_data as $pd)
{
$option_pct = ($poll_total_votes > 0) ? $pd['poll_option_total'] / $poll_total_votes : 0;
$option_pct_txt = sprintf("%.1d%%", round($option_pct * 100));
// Parse BBCode option text
if ($data['bbcode_bitfield'])
{
$poll_bbcode = new bbcode();
}
else
{
$poll_bbcode = false;
}
$pd['poll_option_text'] = censor_text($pd['poll_option_text']);
if ($poll_bbcode !== false)
{
$poll_bbcode->bbcode_second_pass($pd['poll_option_text'], $data['bbcode_uid'], $data['bbcode_bitfield']);
}
$pd['poll_option_text'] = bbcode_nl2br($pd['poll_option_text']);
$pd['poll_option_text'] = smiley_text($pd['poll_option_text']);
unset($poll_bbcode);
$template->assign_block_vars('poll.poll_option', array(
'POLL_OPTION_ID' => $pd['poll_option_id'],
'POLL_OPTION_CAPTION' => $pd['poll_option_text'],
'POLL_OPTION_RESULT' => $pd['poll_option_total'],
'POLL_OPTION_PERCENT' => $option_pct_txt,
'POLL_OPTION_PCT' => round($option_pct * 100),
'POLL_OPTION_IMG' => $user->img('poll_center', $option_pct_txt, round($option_pct * 250)),
'POLL_OPTION_VOTED' => (in_array($pd['poll_option_id'], $cur_voted_id)) ? true : false
));
}
}
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'S_DISPLAY_POLL' => true,
'S_HAS_POLL' => $has_poll,
'POLL_LEFT_CAP_IMG' => $user->img('poll_left'),
'POLL_RIGHT_CAP_IMG' => $user->img('poll_right'),
));
}
return 'poll_center.html';
}
function get_template_side($module_id)
{
global $config, $template, $db, $user, $auth, $phpbb_root_path, $phpEx;
$user->add_lang('viewtopic');
$view = request_var('view', '');
$update = request_var('update', false);
$poll_view = request_var('polls', '');
$poll_view_ar = (strpos($poll_view, ',') !== FALSE) ? explode(',', $poll_view) : (($poll_view != '') ? array($poll_view) : array());
if ($update && $config['board3_poll_allow_vote_' . $module_id])
{
$up_topic_id = request_var('t', 0);
$up_forum_id = request_var('f', 0);
$voted_id = request_var('vote_id', array('' => 0));
$cur_voted_id = array();
if ($user->data['is_registered'])
{
$sql = 'SELECT poll_option_id
FROM ' . POLL_VOTES_TABLE . '
WHERE topic_id = ' . $up_topic_id . '
AND vote_user_id = ' . $user->data['user_id'];
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$cur_voted_id[] = $row['poll_option_id'];
}
$db->sql_freeresult($result);
}
else
{
// Cookie based guest tracking ... I don't like this but hum ho
// it's oft requested. This relies on "nice" users who don't feel
// the need to delete cookies to mess with results.
if (isset($_COOKIE[$config['cookie_name'] . '_poll_' . $up_topic_id]))
{
$cur_voted_id = explode(',', request_var($config['cookie_name'] . '_poll_' . $up_topic_id, 0, false, true));
$cur_voted_id = array_map('intval', $cur_voted_id);
}
}
$sql = 'SELECT t.poll_length, t.poll_start, t.poll_vote_change, t.topic_status, f.forum_status, t.poll_max_options
FROM ' . TOPICS_TABLE . ' t, ' . FORUMS_TABLE . " f
WHERE t.forum_id = f.forum_id AND t.topic_id = " . (int) $up_topic_id . " AND t.forum_id = " . (int) $up_forum_id;
$result = $db->sql_query_limit($sql, 1);
$topic_data = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$s_can_up_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $up_forum_id)) ||
($auth->acl_get('f_votechg', $up_forum_id) && $topic_data['poll_vote_change'])) &&
(($topic_data['poll_length'] != 0 && $topic_data['poll_start'] + $topic_data['poll_length'] > time()) || $topic_data['poll_length'] == 0) &&
$topic_data['topic_status'] != ITEM_LOCKED &&
$topic_data['forum_status'] != ITEM_LOCKED) ? true : false;
if($s_can_up_vote)
{
if (!sizeof($voted_id) || sizeof($voted_id) > $topic_data['poll_max_options'] || in_array(VOTE_CONVERTED, $cur_voted_id))
{
$redirect_url = append_sid("{$phpbb_root_path}portal.$phpEx");
meta_refresh(5, $redirect_url);
if (!sizeof($voted_id))
{
$message = 'NO_VOTE_OPTION';
}
else if (sizeof($voted_id) > $topic_data['poll_max_options'])
{
$message = 'TOO_MANY_VOTE_OPTIONS';
}
else
{
$message = 'VOTE_CONVERTED';
}
$message = $user->lang[$message] . '<br /><br />' . sprintf($user->lang['RETURN_PORTAL'], '<a href="' . $redirect_url . '">', '</a>');
trigger_error($message);
}
foreach ($voted_id as $option)
{
if (in_array($option, $cur_voted_id))
{
continue;
}
$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . '
SET poll_option_total = poll_option_total + 1
WHERE poll_option_id = ' . (int) $option . '
AND topic_id = ' . (int) $up_topic_id;
$db->sql_query($sql);
if ($user->data['is_registered'])
{
$sql_ary = array(
'topic_id' => (int) $up_topic_id,
'poll_option_id' => (int) $option,
'vote_user_id' => (int) $user->data['user_id'],
'vote_user_ip' => (string) $user->ip,
);
$sql = 'INSERT INTO ' . POLL_VOTES_TABLE . ' ' . $db->sql_build_array('INSERT', $sql_ary);
$db->sql_query($sql);
}
}
foreach ($cur_voted_id as $option)
{
if (!in_array($option, $voted_id))
{
$sql = 'UPDATE ' . POLL_OPTIONS_TABLE . '
SET poll_option_total = poll_option_total - 1
WHERE poll_option_id = ' . (int) $option . '
AND topic_id = ' . (int) $up_topic_id;
$db->sql_query($sql);
if ($user->data['is_registered'])
{
$sql = 'DELETE FROM ' . POLL_VOTES_TABLE . '
WHERE topic_id = ' . (int) $up_topic_id . '
AND poll_option_id = ' . (int) $option . '
AND vote_user_id = ' . (int) $user->data['user_id'];
$db->sql_query($sql);
}
}
}
if ($user->data['user_id'] == ANONYMOUS && !$user->data['is_bot'])
{
$user->set_cookie('poll_' . $up_topic_id, implode(',', $voted_id), time() + 31536000);
}
$sql = 'UPDATE ' . TOPICS_TABLE . '
SET poll_last_vote = ' . time() . "
WHERE topic_id = $up_topic_id";
//, topic_last_post_time = ' . time() . " -- for bumping topics with new votes, ignore for now
$db->sql_query($sql);
$redirect_url = append_sid("{$phpbb_root_path}portal.$phpEx");
meta_refresh(5, $redirect_url);
trigger_error($user->lang['VOTE_SUBMITTED'] . '<br /><br />' . sprintf($user->lang['RETURN_PORTAL'], '<a href="' . $redirect_url . '">', '</a>'));
}
}
$where = '';
$poll_forums = false;
// Get readable forums
$forum_list = array();
$forum_list = array_unique(array_keys($auth->acl_getf('f_read', true)));
if($config['board3_poll_topic_id_' . $module_id] !== '')
{
$poll_forums_config = explode(',' ,$config['board3_poll_topic_id_' . $module_id]);
if($config['board3_poll_exclude_id_' . $module_id])
{
$forum_list = array_unique(array_diff($forum_list, $poll_forums_config));
}
else
{
$forum_list = array_unique(array_intersect($poll_forums_config, $forum_list));
}
}
$where = '';
if(sizeof($forum_list))
{
$poll_forums = true;
$where = 'AND ' . $db->sql_in_set('t.forum_id', $forum_list);
}
if ($config['board3_poll_hide_' . $module_id])
{
$portal_poll_hide = "AND (t.poll_start + t.poll_length > ". time() ." OR t.poll_length = 0)";
}
else
{
$portal_poll_hide = '';
}
if ($poll_forums === true)
{
$sql = 'SELECT t.poll_title, t.poll_start, t.topic_id, t.topic_first_post_id, t.forum_id, t.poll_length, t.poll_vote_change, t.poll_max_options, t.topic_status, f.forum_status, p.bbcode_bitfield, p.bbcode_uid
FROM ' . TOPICS_TABLE . ' t, ' . POSTS_TABLE . ' p, ' . FORUMS_TABLE . " f
WHERE t.forum_id = f.forum_id AND t.topic_approved = 1 AND t.poll_start > 0
{$where}
AND t.topic_moved_id = 0
AND p.post_id = t.topic_first_post_id
{$portal_poll_hide}
ORDER BY t.poll_start DESC";
$limit = (isset($config['board3_poll_limit_' . $module_id])) ? $config['board3_poll_limit_' . $module_id] : 3;
$result = $db->sql_query_limit($sql, $limit);
$has_poll = false;
if ($result)
{
while($data = $db->sql_fetchrow($result))
{
$has_poll = true;
$poll_has_options = false;
$topic_id = (int) $data['topic_id'];
$forum_id = (int) $data['forum_id'];
$cur_voted_id = array();
if($config['board3_poll_allow_vote_' . $module_id])
{
if ($user->data['is_registered'])
{
$vote_sql = 'SELECT poll_option_id
FROM ' . POLL_VOTES_TABLE . '
WHERE topic_id = ' . $topic_id . '
AND vote_user_id = ' . $user->data['user_id'];
$vote_result = $db->sql_query($vote_sql);
while ($row = $db->sql_fetchrow($vote_result))
{
$cur_voted_id[] = $row['poll_option_id'];
}
$db->sql_freeresult($vote_result);
}
else
{
// Cookie based guest tracking ... I don't like this but hum ho
// it's oft requested. This relies on "nice" users who don't feel
// the need to delete cookies to mess with results.
if (isset($_COOKIE[$config['cookie_name'] . '_poll_' . $topic_id]))
{
$cur_voted_id = explode(',', request_var($config['cookie_name'] . '_poll_' . $topic_id, 0, false, true));
$cur_voted_id = array_map('intval', $cur_voted_id);
}
}
$s_can_vote = (((!sizeof($cur_voted_id) && $auth->acl_get('f_vote', $forum_id)) ||
($auth->acl_get('f_votechg', $forum_id) && $data['poll_vote_change'])) &&
(($data['poll_length'] != 0 && $data['poll_start'] + $data['poll_length'] > time()) || $data['poll_length'] == 0) &&
$data['topic_status'] != ITEM_LOCKED &&
$data['forum_status'] != ITEM_LOCKED) ? true : false;
}
else
{
$s_can_vote = false;
}
$s_display_results = (!$s_can_vote || ($s_can_vote && sizeof($cur_voted_id)) || ($view == 'viewpoll' && in_array($topic_id, $poll_view_ar))) ? true : false;
$poll_sql = 'SELECT po.poll_option_id, po.poll_option_text, po.poll_option_total
FROM ' . POLL_OPTIONS_TABLE . " po
WHERE po.topic_id = {$topic_id}
ORDER BY po.poll_option_id";
$poll_result = $db->sql_query($poll_sql);
$poll_total_votes = 0;
$poll_data = array();
if ($poll_result)
{
while($polls_data = $db->sql_fetchrow($poll_result))
{
$poll_has_options = true;
$poll_data[] = $polls_data;
$poll_total_votes += $polls_data['poll_option_total'];
}
}
$db->sql_freeresult($poll_result);
$make_poll_view = array();
if(in_array($topic_id, $poll_view_ar) === FALSE)
{
$make_poll_view[] = $topic_id;
$make_poll_view = array_merge($poll_view_ar, $make_poll_view);
}
$poll_view_str = urlencode(implode(',', $make_poll_view));
$portalpoll_url= append_sid("{$phpbb_root_path}portal.$phpEx", "polls=$poll_view_str");
$portalvote_url= append_sid("{$phpbb_root_path}portal.$phpEx", "f=$forum_id&amp;t=$topic_id");
$viewtopic_url = append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&amp;t=$topic_id");
$poll_end = $data['poll_length'] + $data['poll_start'];
// Parse BBCode title
if ($data['bbcode_bitfield'])
{
$poll_bbcode = new bbcode();
}
else
{
$poll_bbcode = false;
}
$data['poll_title'] = censor_text($data['poll_title']);
if ($poll_bbcode !== false)
{
$poll_bbcode->bbcode_second_pass($data['poll_title'], $data['bbcode_uid'], $data['bbcode_bitfield']);
}
$data['poll_title'] = bbcode_nl2br($data['poll_title']);
$data['poll_title'] = smiley_text($data['poll_title']);
unset($poll_bbcode);
$template->assign_block_vars('poll_side', array(
'S_POLL_HAS_OPTIONS' => $poll_has_options,
'POLL_QUESTION' => $data['poll_title'],
'U_POLL_TOPIC' => append_sid($phpbb_root_path . 'viewtopic.' . $phpEx . '?t=' . $topic_id . '&amp;f=' . $forum_id),
'POLL_LENGTH' => $data['poll_length'],
'TOPIC_ID' => $topic_id,
'TOTAL_VOTES' => $poll_total_votes,
'L_MAX_VOTES' => ($data['poll_max_options'] == 1) ? $user->lang['MAX_OPTION_SELECT'] : sprintf($user->lang['MAX_OPTIONS_SELECT'], $data['poll_max_options']),
'L_POLL_LENGTH' => ($data['poll_length']) ? sprintf($user->lang[($poll_end > time()) ? 'POLL_RUN_TILL' : 'POLL_ENDED_AT'], $user->format_date($poll_end)) : '',
'S_CAN_VOTE' => $s_can_vote,
'S_DISPLAY_RESULTS' => $s_display_results,
'S_IS_MULTI_CHOICE' => ($data['poll_max_options'] > 1) ? true : false,
'S_POLL_ACTION' => $portalvote_url,
'U_VIEW_RESULTS' => $portalpoll_url . '&amp;view=viewpoll#viewpoll',
'U_VIEW_TOPIC' => $viewtopic_url,
));
foreach($poll_data as $pd)
{
$option_pct = ($poll_total_votes > 0) ? $pd['poll_option_total'] / $poll_total_votes : 0;
$option_pct_txt = sprintf("%.1d%%", round($option_pct * 100));
// Parse BBCode option text
if ($data['bbcode_bitfield'])
{
$poll_bbcode = new bbcode();
}
else
{
$poll_bbcode = false;
}
$pd['poll_option_text'] = censor_text($pd['poll_option_text']);
if ($poll_bbcode !== false)
{
$poll_bbcode->bbcode_second_pass($pd['poll_option_text'], $data['bbcode_uid'], $data['bbcode_bitfield']);
}
$pd['poll_option_text'] = bbcode_nl2br($pd['poll_option_text']);
$pd['poll_option_text'] = smiley_text($pd['poll_option_text']);
unset($poll_bbcode);
$template->assign_block_vars('poll_side.poll_option', array(
'POLL_OPTION_ID' => $pd['poll_option_id'],
'POLL_OPTION_CAPTION' => $pd['poll_option_text'],
'POLL_OPTION_RESULT' => $pd['poll_option_total'],
'POLL_OPTION_PERCENT' => $option_pct_txt,
'POLL_OPTION_PCT' => round($option_pct * 100),
'POLL_OPTION_IMG' => $user->img('poll_center', $option_pct_txt, round($option_pct * 250)),
'POLL_OPTION_VOTED' => (in_array($pd['poll_option_id'], $cur_voted_id)) ? true : false
));
}
}
}
$db->sql_freeresult($result);
$template->assign_vars(array(
'S_DISPLAY_POLL' => true,
'S_HAS_POLL' => $has_poll,
'POLL_LEFT_CAP_IMG' => $user->img('poll_left'),
'POLL_RIGHT_CAP_IMG' => $user->img('poll_right'),
));
}
return 'poll_side.html';
}
function get_template_acp($module_id)
{
return array(
'title' => 'ACP_PORTAL_POLLS_SETTINGS',
'vars' => array(
'legend1' => 'ACP_PORTAL_POLLS_SETTINGS',
'board3_poll_topic_id_' . $module_id => array('lang' => 'PORTAL_POLL_TOPIC_ID' , 'validate' => 'string', 'type' => 'custom', 'explain' => true, 'method' => 'select_forums'),
'board3_poll_exclude_id_' . $module_id => array('lang' => 'PORTAL_POLL_EXCLUDE_ID' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_poll_limit_' . $module_id => array('lang' => 'PORTAL_POLL_LIMIT' , 'validate' => 'int', 'type' => 'text:3:3', 'explain' => true),
'board3_poll_allow_vote_' . $module_id => array('lang' => 'PORTAL_POLL_ALLOW_VOTE' , 'validate' => 'ibool', 'type' => 'radio:yes_no', 'explain' => true),
'board3_poll_hide_' . $module_id => array('lang' => 'PORTAL_POLL_HIDE' , 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
)
);
}
/**
* API functions
*/
function install($module_id)
{
set_config('board3_poll_allow_vote_' . $module_id, 1);
set_config('board3_poll_topic_id_' . $module_id, '');
set_config('board3_poll_exclude_id_' . $module_id, 0);
set_config('board3_poll_hide_' . $module_id, 0);
set_config('board3_poll_limit_' . $module_id, 3);
return true;
}
function uninstall($module_id)
{
global $db;
$del_config = array(
'board3_poll_allow_vote_' . $module_id,
'board3_poll_topic_id_' . $module_id,
'board3_poll_exclude_id_' . $module_id,
'board3_poll_hide_' . $module_id,
'board3_poll_limit_' . $module_id,
);
$sql = 'DELETE FROM ' . CONFIG_TABLE . '
WHERE ' . $db->sql_in_set('config_name', $del_config);
return $db->sql_query($sql);
}
// Create forum select box
function select_forums($value, $key, $module_id)
{
global $user, $config;
$forum_list = make_forum_select(false, false, true, true, true, false, true);
$selected = array();
if(isset($config[$key]) && strlen($config[$key]) > 0)
{
$selected = explode(',', $config[$key]);
}
// Build forum options
$s_forum_options = '<select id="' . $key . '" name="' . $key . '[]" multiple="multiple">';
foreach ($forum_list as $f_id => $f_row)
{
$s_forum_options .= '<option value="' . $f_id . '"' . ((in_array($f_id, $selected)) ? ' selected="selected"' : '') . (($f_row['disabled']) ? ' disabled="disabled" class="disabled-option"' : '') . '>' . $f_row['padding'] . $f_row['forum_name'] . '</option>';
}
$s_forum_options .= '</select>';
return $s_forum_options;
}
// Store selected forums
function store_selected_forums($key, $module_id)
{
global $db, $cache;
// Get selected forums
$values = request_var($key, array(0 => ''));
$news = implode(',', $values);
set_config($key, $news);
}
}
?>

View File

@@ -1,5 +1,5 @@
<!--version $Id$ //--> <!--version $Id$ //-->
{$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{T_THEME_PATH}/images/portal/portal_menu.png" width="16" height="16" alt="" />&nbsp;<!-- ENDIF -->{L_M_MENU}{$LR_BLOCK_H_R} {$LR_BLOCK_H_L}<!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="16" height="16" alt="" />&nbsp;<!-- ENDIF -->{L_M_MENU}{$LR_BLOCK_H_R}
<div class="portal-navigation"> <div class="portal-navigation">
<!-- BEGIN portalmenu --> <!-- BEGIN portalmenu -->
<div class="menutitle">{portalmenu.CAT_TITLE}</div> <div class="menutitle">{portalmenu.CAT_TITLE}</div>

View File

@@ -0,0 +1,66 @@
<!--version $Id$ //-->
<a name="viewpoll"></a>
{$C_BLOCK_H_L}<dt>{L_PORTAL_POLL}</dt>{$C_BLOCK_H_R}
<!-- IF S_HAS_POLL -->
<div class="panel bg1" style="margin-bottom: 0px">
<div class="inner">
<!-- BEGIN poll -->
<!-- IF poll.S_CAN_VOTE --><form method="post" action="{poll.S_POLL_ACTION}"><!-- ENDIF -->
<div class="content">
<h2>{poll.POLL_QUESTION}</h2>
<p class="author">{poll.L_POLL_LENGTH}<!-- IF poll.S_CAN_VOTE and poll.L_POLL_LENGTH --><br /><!-- ENDIF --><!-- IF poll.S_CAN_VOTE -->{poll.L_MAX_VOTES}<!-- ENDIF --></p>
<fieldset class="polls">
<!-- IF poll.S_POLL_HAS_OPTIONS -->
<!-- BEGIN poll_option -->
<dl class="<!-- IF poll.poll_option.POLL_OPTION_VOTED -->voted<!-- ENDIF -->"<!-- IF poll.poll_option.POLL_OPTION_VOTED --> title="{L_POLL_VOTED_OPTION}"<!-- ENDIF -->>
<dt><!-- IF poll.S_CAN_VOTE --><label for="poll_{poll.TOPIC_ID}_vote_{poll.poll_option.POLL_OPTION_ID}">{poll.poll_option.POLL_OPTION_CAPTION}</label><!-- ELSE -->{poll.poll_option.POLL_OPTION_CAPTION}<!-- ENDIF --></dt>
<!-- IF poll.S_CAN_VOTE --><dd style="width: auto;"><!-- IF poll.S_IS_MULTI_CHOICE --><input type="checkbox" name="vote_id[]" id="poll_{poll.TOPIC_ID}_vote_{poll.poll_option.POLL_OPTION_ID}" value="{poll.poll_option.POLL_OPTION_ID}"<!-- IF poll.poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> /><!-- ELSE --><input type="radio" name="vote_id[]" id="poll_{poll.TOPIC_ID}_vote_{poll.poll_option.POLL_OPTION_ID}" value="{poll.poll_option.POLL_OPTION_ID}"<!-- IF poll.poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> /><!-- ENDIF --></dd><!-- ENDIF -->
<!-- IF poll.S_DISPLAY_RESULTS --><dd class="resultbar"><div class="<!-- IF poll.poll_option.POLL_OPTION_PCT < 20 -->pollbar1<!-- ELSEIF poll.poll_option.POLL_OPTION_PCT < 40 -->pollbar2<!-- ELSEIF poll.poll_option.POLL_OPTION_PCT < 60 -->pollbar3<!-- ELSEIF poll.poll_option.POLL_OPTION_PCT < 80 -->pollbar4<!-- ELSE -->pollbar5<!-- ENDIF -->" style="width:{poll.poll_option.POLL_OPTION_PERCENT};">{poll.poll_option.POLL_OPTION_RESULT}</div></dd>
<dd><!-- IF poll.poll_option.POLL_OPTION_RESULT == 0 -->{L_NO_VOTES}<!-- ELSE -->{poll.poll_option.POLL_OPTION_PERCENT}<!-- ENDIF --></dd><!-- ENDIF -->
</dl>
<!-- END poll_option -->
<!-- ELSE -->
{L_NO_OPTIONS}
<!-- ENDIF -->
<!-- IF poll.S_DISPLAY_RESULTS -->
<dl>
<dt>&nbsp;</dt>
<dd class="resultbar"><p style="font-size:1.0em;">{L_TOTAL_VOTES} : {poll.TOTAL_VOTES}</p></dd>
</dl>
<!-- ENDIF -->
<!-- IF poll.S_CAN_VOTE -->
<dl style="border-top: none;">
<dt>&nbsp;</dt>
<dd class="resultbar"><input type="submit" name="update" value="{L_SUBMIT_VOTE}" class="button1" /></dd>
</dl>
<!-- ENDIF -->
<!-- IF not poll.S_DISPLAY_RESULTS -->
<dl style="border-top: none;">
<dt>&nbsp;</dt>
<dd class="resultbar"><p style="font-size:1.0em;"><a href="{poll.U_VIEW_RESULTS}">{L_VIEW_RESULTS}</a></p></dd>
</dl>
<!-- ENDIF -->
<dl style="border-top: none;">
<dt>&nbsp;</dt>
<dd class="resultbar"><p style="font-size:1.0em;"><a href="{poll.U_VIEW_TOPIC}">{L_VIEW_TOPIC}</a></p></dd>
</dl>
</fieldset>
</div>
<!-- IF poll.S_CAN_VOTE -->{poll.S_HIDDEN_FIELDS}<!-- ENDIF -->
<!-- IF poll.S_CAN_VOTE --></form><!-- ENDIF -->
<!-- END poll -->
</div>
</div>
<!-- ELSE -->
<div class="panel bg1" style="margin-bottom: 0px">
<div class="inner"><span class="portal-corners-top-inner"></span>
<span style="text-align: center;"><strong>{L_NO_POLL}</strong></span>
<span class="portal-corners-bottom-inner"></span></div>
</div>
<!-- ENDIF -->
{$C_BLOCK_F_L}{$C_BLOCK_F_R}

View File

@@ -0,0 +1,65 @@
<!--version $Id$ //-->
<a name="viewpoll"></a>
{$LR_BLOCK_H_L}<img src="{$IMAGE_SRC}" width="16" height="16" alt="" />&nbsp;{L_PORTAL_POLL}{$LR_BLOCK_H_R}
<!-- IF S_HAS_POLL -->
<div class="inner">
<!-- BEGIN poll_side -->
<!-- IF poll_side.S_CAN_VOTE --><form method="post" action="{poll_side.S_POLL_ACTION}"><!-- ENDIF -->
<div class="content">
<h2>{poll_side.POLL_QUESTION}</h2>
<p class="author">{poll_side.L_POLL_LENGTH}<!-- IF poll_side.S_CAN_VOTE and poll_side.L_POLL_LENGTH --><br /><!-- ENDIF --><!-- IF poll_side.S_CAN_VOTE -->{poll_side.L_MAX_VOTES}<!-- ENDIF --></p>
<fieldset class="polls">
<!-- IF poll_side.S_POLL_HAS_OPTIONS -->
<!-- BEGIN poll_option -->
<dl class="<!-- IF poll_side.poll_option.POLL_OPTION_VOTED -->voted<!-- ENDIF -->"<!-- IF poll_side.poll_option.POLL_OPTION_VOTED --> title="{L_POLL_VOTED_OPTION}"<!-- ENDIF -->>
<dt><!-- IF poll_side.S_CAN_VOTE --><label for="poll_{poll_side.TOPIC_ID}_vote_{poll_side.poll_option.POLL_OPTION_ID}">{poll_side.poll_option.POLL_OPTION_CAPTION}</label><!-- ELSE -->{poll_side.poll_option.POLL_OPTION_CAPTION}<!-- ENDIF --></dt>
<!-- IF poll_side.S_CAN_VOTE --><dd style="width: auto;"><!-- IF poll_side.S_IS_MULTI_CHOICE --><input type="checkbox" name="vote_id[]" id="poll_{poll_side.TOPIC_ID}_vote_{poll_side.poll_option.POLL_OPTION_ID}" value="{poll_side.poll_option.POLL_OPTION_ID}"<!-- IF poll_side.poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> /><!-- ELSE --><input type="radio" name="vote_id[]" id="poll_{poll_side.TOPIC_ID}_vote_{poll_side.poll_option.POLL_OPTION_ID}" value="{poll_side.poll_option.POLL_OPTION_ID}"<!-- IF poll_side.poll_option.POLL_OPTION_VOTED --> checked="checked"<!-- ENDIF --> /><!-- ENDIF --></dd><!-- ENDIF -->
<!-- IF poll_side.S_DISPLAY_RESULTS --><dd class="resultbar"><div class="<!-- IF poll_side.poll_option.POLL_OPTION_PCT < 20 -->pollbar1<!-- ELSEIF poll_side.poll_option.POLL_OPTION_PCT < 40 -->pollbar2<!-- ELSEIF poll_side.poll_option.POLL_OPTION_PCT < 60 -->pollbar3<!-- ELSEIF poll_side.poll_option.POLL_OPTION_PCT < 80 -->pollbar4<!-- ELSE -->pollbar5<!-- ENDIF -->" style="width:{poll_side.poll_option.POLL_OPTION_PERCENT};">{poll_side.poll_option.POLL_OPTION_RESULT}</div></dd>
<dd><!-- IF poll_side.poll_option.POLL_OPTION_RESULT == 0 -->{L_NO_VOTES}<!-- ELSE -->{poll_side.poll_option.POLL_OPTION_PERCENT}<!-- ENDIF --></dd><!-- ENDIF -->
</dl>
<!-- END poll_option -->
<!-- ELSE -->
{L_NO_OPTIONS}
<!-- ENDIF -->
<!-- IF poll_side.S_DISPLAY_RESULTS -->
<dl>
<dt>&nbsp;</dt>
<dd class="resultbar"><p style="font-size:1.0em;">{L_TOTAL_VOTES} : {poll_side.TOTAL_VOTES}</p></dd>
</dl>
<!-- ENDIF -->
<!-- IF poll_side.S_CAN_VOTE -->
<dl style="border-top: none;">
<dt>&nbsp;</dt>
<dd class="resultbar"><input type="submit" name="update" value="{L_SUBMIT_VOTE}" class="button1" /></dd>
</dl>
<!-- ENDIF -->
<!-- IF not poll_side.S_DISPLAY_RESULTS -->
<dl style="border-top: none;">
<dt>&nbsp;</dt>
<dd class="resultbar"><p style="font-size:1.0em;"><a href="{poll_side.U_VIEW_RESULTS}">{L_VIEW_RESULTS}</a></p></dd>
</dl>
<!-- ENDIF -->
<dl style="border-top: none;">
<dt>&nbsp;</dt>
<dd class="resultbar"><p style="font-size:1.0em;"><a href="{poll_side.U_VIEW_TOPIC}">{L_VIEW_TOPIC}</a></p></dd>
</dl>
</fieldset>
</div>
<!-- IF poll_side.S_CAN_VOTE -->{poll_side.S_HIDDEN_FIELDS}<!-- ENDIF -->
<!-- IF poll_side.S_CAN_VOTE --></form><!-- ENDIF -->
<!-- END poll -->
</div>
<!-- ELSE -->
<div class="panel bg1" style="margin-bottom: 0px">
<div class="inner"><span class="portal-corners-top-inner"></span>
<span style="text-align: center;"><strong>{L_NO_POLL}</strong></span>
<span class="portal-corners-bottom-inner"></span></div>
</div>
<!-- ENDIF -->
{$LR_BLOCK_F_L}{$LR_BLOCK_F_R}

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB