extract($_REQUEST, EXTR_SKIP); } $VOTE_ID = GetCurrentVote($arParams["CHANNEL_SID"]); //2 if ($VOTING_OK == "Y") { $strNote .= GetMessage("VOTE_OK") . "<br>"; } if ($USER_ALREADY_VOTE == "Y") { $strError .= GetMessage("VOTE_ALREADY_VOTE") . "<br>"; } if ($VOTING_LAMP == "red") { $strError .= GetMessage("VOTE_RED_LAMP") . "<br>"; } $IsUserVoted = "N"; if ($VOTING_OK != "Y" && $USER_ALREADY_VOTE != "Y") { $IsUserVoted = IsUserVoted($VOTE_ID) ? "Y" : "N"; } $VOTE_ID = GetVoteDataByID($VOTE_ID, $arChannel, $arVote, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $arGroupAnswers, "N"); if (intval($VOTE_ID) > 0) { echo ShowError($strError); echo ShowNote($strNote); $VOTE_PERMISSION = CVoteChannel::GetGroupPermission($arChannel["ID"]); if ($IsUserVoted != "Y" && $VOTING_OK != "Y" && $USER_ALREADY_VOTE != "Y") { if (intval($VOTE_PERMISSION) >= 2) { ?> <table cellspacing="0" cellpadding="5" width="100%"> <form name="vote_form" action="<?php echo $APPLICATION->GetCurPageParam("", array("VOTE_ID", "VOTING_OK")); ?> " method="POST"> <input type="hidden" name="PUBLIC_VOTE_ID" value="<?php
function GetAnyAccessibleVote($site_id=SITE_ID, $channel_id=null) { $arParams = array("ACTIVE"=>"Y","SITE"=>$site_id); if ($channel_id !== null) { $arParams['SID'] = $channel_id; $arParams['SID_EXACT_MATCH'] = 'Y'; } $z = CVoteChannel::GetList($by="s_c_sort", $order="asc", $arParams, $is_filtered); $arResult = array(); while ($zr = $z->Fetch()) { $perm = CVoteChannel::GetGroupPermission($zr["ID"]); if (intval($perm)>=2) { $v = CVote::GetList($by, $order, array("CHANNEL_ID"=>$zr["ID"], "LAMP"=>"green"), $is_filtered); while ($vr = $v->Fetch()) { if (!(IsUserVoted($vr['ID']))) $arResult[] = $vr['ID']; } } } if (sizeof($arResult) > 0) return array_rand(array_flip($arResult)); return false; }