Exemplo n.º 1
0
foreach ($URL_NAME_DEFAULT as $URL => $URL_VALUE) {
    if (strLen(trim($arParams[strToUpper($URL) . "_TEMPLATE"])) <= 0) {
        $arParams[strToUpper($URL) . "_TEMPLATE"] = $APPLICATION->GetCurPage() . "?" . $URL_VALUE;
    }
    $arParams["~" . strToUpper($URL) . "_TEMPLATE"] = $arParams[strToUpper($URL) . "_TEMPLATE"];
    $arParams[strToUpper($URL) . "_TEMPLATE"] = htmlspecialcharsbx($arParams["~" . strToUpper($URL) . "_TEMPLATE"]);
}
/********************************************************************
				/Input params
********************************************************************/
/********************************************************************
				Data
********************************************************************/
$arResult["VOTES"] = array();
$arResult["NAV_STRING"] = "";
$db_res = GetVoteList($arParams["CHANNEL_SID"], array("bDescPageNumbering" => false, "nPageSize" => 10, "bShowAll" => false));
if ($db_res) {
    $arResult["NAV_STRING"] = $db_res->GetPageNavString(GetMessage("VOTE_PAGES"));
    while ($res = $db_res->Fetch()) {
        $res["USER_ALREADY_VOTE"] = CVote::UserAlreadyVote($res["ID"], $_SESSION["VOTE_USER_ID"], $res["UNIQUE_TYPE"], $res["KEEP_IP_SEC"], $GLOBALS["USER"]->GetID()) ? "Y" : "N";
        $res["URL"] = array("~VOTE_RESULT" => CComponentEngine::MakePathFromTemplate($arParams["~VOTE_RESULT_TEMPLATE"], array("VOTE_ID" => $res["ID"])), "~VOTE_FORM" => CComponentEngine::MakePathFromTemplate($arParams["~VOTE_FORM_TEMPLATE"], array("VOTE_ID" => $res["ID"])), "VOTE_RESULT" => CComponentEngine::MakePathFromTemplate($arParams["VOTE_RESULT_TEMPLATE"], array("VOTE_ID" => $res["ID"])), "VOTE_FORM" => CComponentEngine::MakePathFromTemplate($arParams["VOTE_FORM_TEMPLATE"], array("VOTE_ID" => $res["ID"])));
        $res["IMAGE"] = CFile::GetFileArray($res["IMAGE_ID"]);
        // For custom
        foreach ($res["URL"] as $key => $val) {
            $res[$key . "_URL"] = $val;
        }
        $res["TITLE"] = htmlspecialcharsEx($res["TITLE"]);
        if ($res['DESCRIPTION_TYPE'] == 'text') {
            $res['DESCRIPTION'] = htmlspecialcharsbx($res['DESCRIPTION']);
        }
        $arResult["VOTES"][$res["ID"]] = $res;
Exemplo n.º 2
0
$CHANNEL_SID - mnemonic code of the polls group (polls from all groups binded to the current site will be displayed if no value set)
$VOTE_URL - Page URL for displaying the Poll form (for participating in poll)
$RESULTS_URL - Page URL for displaying the poll result diagrams

********************************************************************/
global $USER, $APPLICATION;
$APPLICATION->SetTemplateCSS("vote/vote.css");
if (CModule::IncludeModule("vote")) {
    IncludeTemplateLangFile(__FILE__);
    if (is_array($_REQUEST)) {
        extract($_REQUEST, EXTR_SKIP);
    }
    ?>
<p><?php 
    $rsVotes = GetVoteList($arParams["CHANNEL_SID"]);
    $rsVotes->NavStart(10);
    echo $rsVotes->NavPrint(GetMessage("VOTE_PAGES"));
    ?>
</p>
	<?php 
    while ($arVote = $rsVotes->GetNext(true, false)) {
        ?>
	<table border="0" cellspacing="0" cellpadding="7" width="100%">
		<tr>
			<td>
				<table border="0" cellspacing="0" cellpadding="0" width="100%"  class="tableborder">
					<tr>
						<td>
							<table border="0" cellspacing="1" cellpadding="4" width="100%">
								<tr>