Пример #1
0
if ( $xforumtopic->getVar('topic_haspoll') 
	&& $topic_handler->getPermission($viewtopic_forum, $xforumtopic->getVar('topic_status'), "vote")
){

	$xoopsTpl->assign('topic_poll', 1);
	$poll = new XoopsPoll($xforumtopic->getVar('poll_id'));
	$renderer = new XoopsPollRenderer($poll);
	$uid = is_object($xoopsUser)?$xoopsUser->getVar("uid"):0;
	if ( XoopsPollLog::hasVoted($xforumtopic->getVar('poll_id'), $_SERVER['REMOTE_ADDR'], $uid) ) {
		$renderer->assignResults($xoopsTpl);
		//pollresults($xforumtopic->getVar('poll_id'));
		$xoopsTpl->assign('topic_pollresult', 1);
		setcookie("xf_polls[".$xforumtopic->getVar("poll_id")."]", 1);
	} else {
	    $renderer->assignForm($xoopsTpl);
	    $xoopsTpl->assign('lang_vote' , _PL_VOTE);
	    $xoopsTpl->assign('lang_results' , _PL_RESULTS);
		//pollview($xforumtopic->getVar('poll_id'));
		setcookie("xf_polls[".$xforumtopic->getVar("poll_id")."]", 1);
	}
}
if ($topic_handler->getPermission($viewtopic_forum, $xforumtopic->getVar('topic_status'), "addpoll")
){
	if(!$xforumtopic->getVar('topic_haspoll')){	
		if( is_object($xoopsUser) && $xoopsUser->getVar("uid")==$xforumtopic->getVar("topic_poster") ){
			$t_poll = forum_displayImage($xforumImage['t_poll'],_MD_ADDPOLL);
			$xoopsTpl->assign('forum_addpoll', "<a href=\"polls.php?op=add&amp;forum=".$forum_id."&amp;topic_id=".$topic_id."\">".$t_poll."</a>&nbsp;");
		}
	}elseif($isadmin
		|| (is_object($poll) && is_object($xoopsUser) && $xoopsUser->getVar("uid")==$poll->getVar("user_id") )
Пример #2
0
function pollview($poll_id)
{
    global $xoopsTpl;
    $poll = new XoopsPoll($poll_id);
    $renderer = new XoopsPollRenderer($poll);
    $renderer->assignForm($xoopsTpl);
    $xoopsTpl->assign('lang_vote', _PL_VOTE);
    $xoopsTpl->assign('lang_results', _PL_RESULTS);
}