$smarty->assign('msg', tra("Permission denied you cannot view this page"));
    $smarty->display("error.tpl");
    die;
}
if (!isset($_REQUEST["maxRecords"])) {
    $_REQUEST["maxRecords"] = 30;
    $smarty->assign('maxRecords', $_REQUEST['maxRecords']);
} elseif ($_REQUEST["maxRecords"] == '') {
    $_REQUEST["maxRecords"] = -1;
    $smarty->assign('maxRecords', '');
}
if (!isset($_REQUEST['find'])) {
    $_REQUEST['find'] = '';
}
$smarty->assign_by_ref('find', $_REQUEST['find']);
$polls = $polllib->list_active_polls(0, $_REQUEST["maxRecords"], "votes_desc", $_REQUEST['find']);
$pollIds = array();
if (isset($_REQUEST["pollId"])) {
    $pollIds[] = $_REQUEST["pollId"];
} else {
    foreach ($polls["data"] as $pId) {
        $pollIds[] = $pId["pollId"];
    }
}
$poll_info_arr = array();
foreach ($pollIds as $pK => $pId) {
    // iterate each poll
    $poll_info = $polllib->get_poll($pId);
    $poll_info_arr[$pK] = $poll_info;
    $options = $polllib->list_poll_options($pId);
    $temp_max = count($options);
Пример #2
0
include_once 'lib/polls/polllib.php';
if (!isset($polllib)) {
    $polllib = new PollLib($dbTiki);
}
if ($feature_polls != 'y') {
    $smarty->assign('msg', tra("This feature is disabled") . ": feature_polls");
    $smarty->display("error.tpl");
    die;
}
if (!isset($_REQUEST["pollId"])) {
    $smarty->assign('msg', tra("No poll indicated"));
    $smarty->display("error.tpl");
    die;
}
$poll_info = $polllib->get_poll($_REQUEST["pollId"]);
$polls = $polllib->list_active_polls(0, -1, 'publishDate_desc', '');
$options = $polllib->list_poll_options($_REQUEST["pollId"]);
$temp_max = count($options);
for ($i = 0; $i < $temp_max; $i++) {
    if ($poll_info["votes"] == 0) {
        $percent = 0;
    } else {
        $percent = number_format($options[$i]["votes"] * 100 / $poll_info["votes"], 2);
        $options[$i]["percent"] = $percent;
    }
    $width = $percent * 200 / 100;
    $options[$i]["width"] = $percent;
}
// Poll comments
if ($feature_poll_comments == 'y') {
    $comments_per_page = $poll_comments_per_page;
$smarty->assign('groups', $allgroups);

if (!isset($_REQUEST['offset'])) {
	$offset = 0;
} else {
	$offset = $_REQUEST['offset'];
}
$maximum = 0;
$maxRecords = $prefs['maxRecords'];

$galleries = $tikilib->list_galleries($offset, $maxRecords, 'lastModif_desc', $user, '');
$smarty->assign('galleries', $galleries['data']);
$maximum = max($maximum, $galleries['cant']);

$polls = $polllib->list_active_polls($offset, $maxRecords, 'publishDate_desc', '');
$smarty->assign('polls', $polls['data']);
$maximum = max($maximum, $polls['cant']);

$contents = $dcslib->list_content($offset, $maxRecords, 'contentId_desc', '');
$smarty->assign('contents', $contents['data']);
$maximum = max($maximum, $contents['cant']);

$rsss = $rsslib->list_rss_modules($offset, $maxRecords, 'name_desc', '');
$smarty->assign('rsss', $rsss['data']);
$maximum = max($maximum, $rsss['cant']);

$menus = $menulib->list_menus($offset, $maxRecords, 'menuId_desc', '');
$smarty->assign('menus', $menus['data']);
$maximum = max($maximum, $menus['cant']);