((($tzOffset = CTimeZone::GetOffset()) <> 0) ? "_".$tzOffset : ""); $cache_path = str_replace(array(":", "//"), "/", "/".SITE_ID."/".$componentName); if ($obCache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path) && !$_SESSION["VOTE"]["VOTES"][$arParams["VOTE_ID"]]) { $arVars = $obCache->GetVars(); $arResult["VOTE"] = $arVars["arResult"]["VOTE"]; $arResult["CHANNEL"] = $arVars["arResult"]["CHANNEL"]; $arResult["QUESTIONS"] = $arVars["arResult"]["QUESTIONS"]; } elseif (CModule::IncludeModule("vote")) { $tmp = array("bGetMemoStat" => array("bGetMemoStat" => "N", "bRestoreVotedData" => "Y")); $tmp = array("bGetMemoStat" => array("bGetMemoStat" => "N", "bRestoreVotedData" => "Y")); $arParams["VOTE_ID"] = GetVoteDataByID($arParams["VOTE_ID"], $arChannel, $arVote, $arQuestions, $arAnswers, $tmp["DropDown"], $tmp["MultiSelect"], $tmp["arGroupAnswers"], $tmp["bGetMemoStat"]); $permission = ($arParams["PERMISSION"] === false ? CVoteChannel::GetGroupPermission($arChannel["ID"]) : $arParams["PERMISSION"]); if ($permission < 2) { $arError[] = array( "id" => "access denied", "text" => GetMessage("VOTE_ACCESS_DENIED")); } else { //Vote Image $arVote["IMAGE"] = CFile::GetFileArray($arVote["IMAGE_ID"]); $arResult["VOTE"] = $arVote;
public static function KeepVoting() { global $DB, $VOTING_LAMP, $USER_ALREADY_VOTE, $USER_GROUP_PERMISSION, $USER; $err_mess = CAllVote::err_mess() . "<br>Function: KeepVoting<br>Line: "; $VOTING_LAMP = "green"; $USER_ALREADY_VOTE = "N"; $PUBLIC_VOTE_ID = intval($_REQUEST["PUBLIC_VOTE_ID"]); $aMsg = array(); $VOTE_ID = 0; $arVote = array(); $arQuestions = array(); if (!(!empty($_REQUEST["vote"]) && $PUBLIC_VOTE_ID > 0 && check_bitrix_sessid())) { $aMsg[] = array("id" => "bad_params", "text" => GetMessage("VOTE_NOT_FOUND")); } elseif (($VOTE_ID = intVal(GetVoteDataByID($PUBLIC_VOTE_ID, $arChannel, $arVote, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $arGroupAnswers, "N"))) && ($VOTE_ID <= 0 || $arVote["LAMP"] != "green")) { $VOTING_LAMP = "red"; if ($VOTE_ID <= 0) { $aMsg[] = array("id" => "VOTE_ID", "text" => GetMessage("VOTE_NOT_FOUND")); } else { $aMsg[] = array("id" => "LAMP", "text" => GetMessage("VOTE_RED_LAMP")); } } elseif ($arChannel["USE_CAPTCHA"] == "Y" && !$USER->IsAuthorized()) { include_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/classes/general/captcha.php"; $cpt = new CCaptcha(); if (!empty($_REQUEST["captcha_word"])) { $captchaPass = COption::GetOptionString("main", "captcha_password", ""); if (!$cpt->CheckCodeCrypt($_REQUEST["captcha_word"], $_REQUEST["captcha_code"], $captchaPass)) { $GLOBALS["BAD_CAPTCHA"] = "Y"; $aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("VOTE_BAD_CAPTCHA")); } } else { if (!$cpt->CheckCode($_REQUEST["captcha_word"], 0)) { $GLOBALS["NO_CAPTCHA"] = "Y"; $aMsg[] = array("id" => "CAPTCHA", "text" => GetMessage("VOTE_BAD_CAPTCHA")); } } } if (empty($aMsg)) { // get user id $_SESSION["VOTE_USER_ID"] = CVote::SetVoteUserID(); $GLOBALS["VOTING_ID"] = $VOTE_ID; // check: can user vote $UNIQUE_TYPE = $arVote["UNIQUE_TYPE"]; $KEEP_IP_SEC = $arVote["KEEP_IP_SEC"]; $CHANNEL_ID = $arVote["CHANNEL_ID"]; $StatusVote = CVote::UserAlreadyVote($VOTE_ID, $_SESSION["VOTE_USER_ID"], $UNIQUE_TYPE, $KEEP_IP_SEC, $USER->GetID()); $USER_ALREADY_VOTE = $StatusVote != false ? "Y" : "N"; $USER_GROUP_PERMISSION = CVote::UserGroupPermission($CHANNEL_ID); // if user can vote that if (($USER_ALREADY_VOTE == "N" || $StatusVote == 8 && $_REQUEST["REVOTE_ID"] == $VOTE_ID) && $USER_GROUP_PERMISSION >= 2) { $arSqlAnswers = array(); // check answers foreach ($arQuestions as $qID => $arQuestion) { $arSqlAnswers[$arQuestion["ID"]] = array(); $bIndicators = array(); foreach ($arQuestion["ANSWERS"] as $arAnswer) { switch ($arAnswer["FIELD_TYPE"]) { case 0: // radio // radio case 2: // dropdown list $fieldName = ($arAnswer["FIELD_TYPE"] == 0 ? "vote_radio_" : "vote_dropdown_") . $qID; $aID = intval($GLOBALS[$fieldName]); if (!isset($bIndicators[$fieldName]) && array_key_exists($aID, $arQuestion["ANSWERS"])) { if (!empty($arAnswer['MESSAGE'])) { $arSqlAnswers[$qID][$aID] = array("ANSWER_ID" => $aID); } $bIndicators[$fieldName] = "Y"; } break; case 1: // checkbox // checkbox case 3: // multiselect list $fieldName = ($arAnswer["FIELD_TYPE"] == 1 ? "vote_checkbox_" : "vote_multiselect_") . $qID; $res = $GLOBALS[$fieldName]; if (!isset($bIndicators[$fieldName]) && is_array($res) && !empty($res)) { reset($res); foreach ($res as $aID) { if (array_key_exists($aID, $arQuestion["ANSWERS"])) { $arSqlAnswers[$qID][$aID] = array("ANSWER_ID" => $aID); } } $bIndicators[$fieldName] = "Y"; } break; case 4: // field // field case 5: // text $aID = $arAnswer["ID"]; $fieldName = ($arAnswer["FIELD_TYPE"] == 4 ? "vote_field_" : "vote_memo_") . $aID; $MESSAGE = trim($GLOBALS[$fieldName]); if ($MESSAGE != "") { $arSqlAnswers[$qID][$aID] = array("ANSWER_ID" => $aID, "MESSAGE" => "'" . $DB->ForSql(trim($MESSAGE), 2000) . "'"); } break; } } if (empty($arSqlAnswers[$qID])) { unset($arSqlAnswers[$qID]); if ($arQuestion['REQUIRED'] == 'Y') { $aMsg[] = array("id" => "QUESTION_" . $qID, "text" => GetMessage("VOTE_REQUIRED_MISSING")); $GLOBALS["VOTE_REQUIRED_MISSING"] = "Y"; break; } } } if (!empty($aMsg)) { /* do nothing; */ } elseif (!empty($arSqlAnswers)) { // vote event $arFields = array("VOTE_ID" => $VOTE_ID, "VOTE_USER_ID" => intval($_SESSION["VOTE_USER_ID"]), "DATE_VOTE" => $DB->GetNowFunction(), "STAT_SESSION_ID" => intval($_SESSION["SESS_SESSION_ID"]), "IP" => "'" . $DB->ForSql($_SERVER["REMOTE_ADDR"], 15) . "'", "VALID" => "'Y'"); /***************** Event onBeforeVoting ****************************/ foreach (GetModuleEvents("vote", "onBeforeVoting", true) as $arEvent) { if (ExecuteModuleEventEx($arEvent, array(&$arFields, &$arSqlAnswers)) === false) { return false; } } /***************** /Event ******************************************/ if ($StatusVote == 8 && $_REQUEST["REVOTE_ID"] == $VOTE_ID) { $strSql = "SELECT VE.ID, VEQ.QUESTION_ID, VEA.ANSWER_ID" . " FROM b_vote_event VE " . "\tLEFT JOIN b_vote_event_question VEQ ON (VEQ.EVENT_ID=VE.ID)" . "\tLEFT JOIN b_vote_event_answer VEA ON (VEA.EVENT_QUESTION_ID=VEQ.ID)" . "\tLEFT JOIN b_vote_user VU ON (VE.VOTE_USER_ID = VU.ID)" . " WHERE VE.VOTE_ID=" . $VOTE_ID . " AND VU.AUTH_USER_ID=" . intval($USER->GetID()) . " ORDER BY VE.ID ASC, VEQ.QUESTION_ID ASC"; $db_res = $DB->Query($strSql, false, $err_mess . __LINE__); if ($db_res && ($res = $db_res->Fetch())) { if ($USER->GetID() > 0 && CModule::IncludeModule("im")) { CIMNotify::DeleteByTag("VOTING|" . $VOTE_ID, $USER->GetID()); } $del = false; $delQ = false; do { if ($delQ !== $res["QUESTION_ID"]) { if ($del !== $res["ID"]) { CVoteEvent::Delete($res["ID"]); $del = $res["ID"]; $arVote["COUNTER"] = intval($arVote["COUNTER"]) - 1; } $delQ = $res["QUESTION_ID"]; $arQuestions[$res["QUESTION_ID"]]["COUNTER"] = intval($arQuestions[$res["QUESTION_ID"]]["COUNTER"]) - 1; } $arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]]["COUNTER"] = intval($arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]]["COUNTER"]) - 1; } while ($res = $db_res->Fetch()); } $USER_ALREADY_VOTE = "N"; } unset($GLOBALS["VOTE_CACHE_VOTING"][$VOTE_ID]); unset($GLOBALS["VOTE_CACHE"]["VOTE"][$VOTE_ID]); $EVENT_ID = intval($DB->Insert("b_vote_event", $arFields, $err_mess . __LINE__)); if ($EVENT_ID > 0) { $arSqlQuestionsID = array(); $arSqlAnswersID = array(); foreach ($arSqlAnswers as $qID => $arSqlAnswer) { $arFields = array("EVENT_ID" => $EVENT_ID, "QUESTION_ID" => $qID); $EVENT_QUESTION_ID = intval($DB->Insert("b_vote_event_question", $arFields, $err_mess . __LINE__)); if ($EVENT_QUESTION_ID > 0) { $arSqlQuestionsID[] = $qID; $arQuestions[$qID]["COUNTER"] = intval($arQuestions[$qID]["COUNTER"]) + 1; foreach ($arSqlAnswer as $aID => $res) { $res["EVENT_QUESTION_ID"] = $EVENT_QUESTION_ID; if ($DB->Insert("b_vote_event_answer", $res, $err_mess . __LINE__)) { $arSqlAnswersID[$aID] = $qID; $arQuestions[$qID]["ANSWERS"][$aID]["COUNTER"] = intval($arQuestions[$qID]["ANSWERS"][$aID]["COUNTER"]) + 1; } } } } if (empty($arSqlQuestionsID) || empty($arSqlAnswersID)) { $DB->Query("DELETE FROM b_vote_event WHERE ID=" . $EVENT_ID, $arFields, $err_mess . __LINE__); } else { $arFields = array("COUNTER" => "COUNTER+1"); $DB->Update("b_vote", $arFields, "WHERE ID='" . $VOTE_ID . "'", $err_mess . __LINE__); $arVote["COUNTER"] = intval($arVote["COUNTER"]) + 1; $DB->Update("b_vote_question", $arFields, "WHERE ID in (" . implode(", ", $arSqlQuestionsID) . ")", $err_mess . __LINE__); $DB->Update("b_vote_answer", $arFields, "WHERE ID in (" . implode(", ", array_keys($arSqlAnswersID)) . ")", $err_mess . __LINE__); // increment user counter CVote::UpdateVoteUserID($_SESSION["VOTE_USER_ID"]); $GLOBALS["VOTING_OK"] = "Y"; $_SESSION["VOTE_ARRAY"][] = $VOTE_ID; if ($UNIQUE_TYPE & 8) { $_SESSION["VOTE"]["VOTES"][$VOTE_ID] = $EVENT_ID; } // statistic module if (CModule::IncludeModule("statistic")) { $event3 = $arVote["EVENT3"]; if (!empty($event3)) { $event3 = "http://" . $_SERVER["HTTP_HOST"] . "/bitrix/admin/vote_user_results.php?EVENT_ID=" . $EVENT_ID . "&lang=" . LANGUAGE_ID; } CStatEvent::AddCurrent($arVote["EVENT1"], $arVote["EVENT2"], $event3); } // notification if (!!$arVote["AUTHOR_ID"] && $arVote["AUTHOR_ID"] != $USER->GetID()) { if (empty($arVote["TITLE"])) { $arQuestion = reset($arQuestions); $arVote["TITLE"] = $arQuestion["QUESTION"]; } if ($arVote["NOTIFY"] == "I" && CModule::IncludeModule("im")) { $arVote["TOTAL_URL"] = ""; if (!empty($arVote["URL"])) { if (defined('SITE_SERVER_NAME')) { $arVote["TOTAL_URL"] = SITE_SERVER_NAME; } $arVote["TOTAL_URL"] = !empty($arVote["TOTAL_URL"]) ? $arVote["TOTAL_URL"] : COption::GetOptionString("main", "server_name", $GLOBALS["SERVER_NAME"]); if (!empty($arVote["TOTAL_URL"])) { $arVote["TOTAL_URL"] = (CMain::IsHTTPS() ? "https" : "http") . "://" . $arVote["TOTAL_URL"] . $arVote["URL"]; } } // send notification $gender = $USER->getParam("PERSONAL_GENDER") == "F" ? "_F" : ""; $arMessageFields = array("MESSAGE_TYPE" => IM_MESSAGE_SYSTEM, "TO_USER_ID" => $arVote["AUTHOR_ID"], "FROM_USER_ID" => $USER->GetID(), "NOTIFY_TYPE" => IM_NOTIFY_FROM, "NOTIFY_MODULE" => "vote", "NOTIFY_EVENT" => "voting", "NOTIFY_TAG" => "VOTING|" . $VOTE_ID, "NOTIFY_MESSAGE" => !empty($arVote["URL"]) ? GetMessage("V_NOTIFY_MESSAGE_HREF" . $gender, array("#VOTE_TITLE#" => $arVote["TITLE"], "#VOTE_URL#" => $arVote["URL"])) : GetMessage("V_NOTIFY_MESSAGE" . $gender, array("#VOTE_TITLE#" => $arVote["TITLE"])), "NOTIFY_MESSAGE_OUT" => !empty($arVote["TOTAL_URL"]) ? GetMessage("V_NOTIFY_MESSAGE_OUT_HREF" . $gender, array("#VOTE_TITLE#" => $arVote["TITLE"], "#VOTE_URL#" => $arVote["TOTAL_URL"])) : GetMessage("V_NOTIFY_MESSAGE" . $gender, array("#VOTE_TITLE#" => $arVote["TITLE"]))); CIMNotify::Add($arMessageFields); } else { if ($arVote["NOTIFY"] == "Y") { // send e-mail $db_user = CUser::GetById($arVote["AUTHOR_ID"]); if ($db_user && ($arUser = $db_user->Fetch()) && !empty($arUser["EMAIL"])) { $arEventFields = array("EMAIL_TO" => $arUser["EMAIL"], "VOTE_STATISTIC" => "", "ID" => $EVENT_ID, "TIME" => GetTime(time(), "FULL"), "VOTE_TITLE" => $arVote["TITLE"], "VOTE_DESCRIPTION" => $arVote["DESCRIPTION"], "VOTE_ID" => $arVote["ID"], "VOTE_COUNTER" => $arVote["COUNTER"], "URL" => $arVote["URL"], "CHANNEL" => $arChannel["TITLE"], "CHANNEL_ID" => $arChannel["ID"], "VOTER_ID" => $_SESSION["VOTE_USER_ID"], "USER_NAME" => $USER->GetFullName(), "LOGIN" => $USER->GetLogin(), "USER_ID" => $USER->GetID(), "STAT_GUEST_ID" => intval($_SESSION["SESS_GUEST_ID"]), "SESSION_ID" => intval($_SESSION["SESS_SESSION_ID"]), "IP" => $_SERVER["REMOTE_ADDR"]); $arEventFields["USER_NAME"] = !!$arEventFields["USER_NAME"] ? $arEventFields["USER_NAME"] : $arEventFields["LOGIN"]; // VOTE_STATISTIC $text = array(); foreach ($arSqlAnswersID as $aID => $qID) { $text[$qID] = is_array($text[$qID]) ? $text[$qID] : array(); if ($arQuestions[$qID]["ANSWERS"][$aID]["FIELD_TYPE"] == 4 || $arQuestions[$qID]["ANSWERS"][$aID]["FIELD_TYPE"] == 5) { if (!empty($arSqlAnswers[$qID][$aID]["MESSAGE"])) { $text[$qID][] = $arSqlAnswers[$qID][$aID]["MESSAGE"]; } } else { $text[$qID][] = $arQuestions[$qID]["ANSWERS"][$aID]["MESSAGE"]; } } foreach ($text as $qID => $txt) { $text[$qID] = " - " . $arQuestions[$qID]["QUESTION"] . "\n - " . implode(", ", $text[$qID]); } $arEventFields["VOTE_STATISTIC"] = "\n" . implode("\n\n", $text); $arrSites = CVoteChannel::GetSiteArray($arChannel["ID"]); CEvent::Send("VOTE_FOR", $arrSites, $arEventFields, "N"); } } } } } /***************** Event onAfterVoting *****************************/ foreach (GetModuleEvents("vote", "onAfterVoting", true) as $arEvent) { ExecuteModuleEventEx($arEvent, array($VOTE_ID, $EVENT_ID)); } /***************** /Event ******************************************/ } } else { $GLOBALS["USER_VOTE_EMPTY"] = "Y"; $aMsg[] = array("id" => "VOTE_ID", "text" => GetMessage("USER_VOTE_EMPTY")); } } else { $aMsg[] = array("id" => "VOTE_ID", "text" => $USER_GROUP_PERMISSION >= 2 ? GetMessage("VOTE_ALREADY_VOTE") : GetMessage("VOTE_ACCESS_DENIED")); } } if (!empty($aMsg)) { $e = new CAdminException($aMsg, "CVote::KeepVoting"); $GLOBALS["APPLICATION"]->ThrowException($e); $GLOBALS["VOTING_OK"] = "N"; return false; } return true; }
$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 echo $VOTE_ID; ?>
********************************************************************/ global $USER, $APPLICATION; $APPLICATION->SetTemplateCSS("vote/vote.css"); if (CModule::IncludeModule("vote")) { IncludeTemplateLangFile(__FILE__); if (is_array($_REQUEST)) { extract($_REQUEST, EXTR_SKIP); } if ($VOTING_OK == "Y" || $VOTE_SUCCESSFULL == "Y") { $strNote .= GetMessage("VOTE_OK") . "<br>"; } if ($USER_ALREADY_VOTE == "Y") { $strError .= GetMessage("VOTE_ALREADY_VOTE") . "<br>"; } $VOTE_ID = GetVoteDataByID($arParams["VOTE_ID"], $arChannel, $arVote, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $arGroupAnswers, "Y"); if (intval($VOTE_ID) > 0) { $VOTE_PERMISSION = CVoteChannel::GetGroupPermission($arChannel["ID"]); if (intval($VOTE_PERMISSION) >= 1) { ?> <p><?php echo ShowError($strError); echo ShowNote($strNote); ?> </p> <table border="0" cellspacing="0" cellpadding="0" width="100%"> <tr> <td width="100%"> <table border="0" cellspacing="0" cellpadding="1" width="100%" class="tablehead"> <tr> <td width="100%">
$arResult["CURRENT_PAGE"] = htmlspecialcharsbx($arResult["~CURRENT_PAGE"]); /******************************************************************** /Default values ********************************************************************/ /******************************************************************** Data ********************************************************************/ $obCache = new CPHPCache(); $cache_id = "vote_result_" . serialize(array($arParams["VOTE_ID"], $arParams["ADDITIONAL_CACHE_ID"], $arParams["VOTE_ALL_RESULTS"], isset($arParams["PERMISSION"]) ? $arParams["PERMISSION"] : array())) . (($tzOffset = CTimeZone::GetOffset()) != 0 ? "_" . $tzOffset : ""); $cache_path = str_replace(array(":", "//"), "/", "/" . SITE_ID . "/" . $componentName . "/" . $arParams["VOTE_ID"]); if ($obCache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) { $arVars = $obCache->GetVars(); $arResult = $arVars["arResult"]; } elseif (CModule::IncludeModule("vote")) { $arAnswers = $arDropDown = $arMultiSelect = array(); $arParams["VOTE_ID"] = GetVoteDataByID($arParams["VOTE_ID"], $arResult["CHANNEL"], $arResult["VOTE"], $arResult["QUESTIONS"], $arAnswers, $arDropDown, $arMultiSelect, $arResult["GROUP_ANSWERS"], array("bGetMemoStat" => $arParams["VOTE_ALL_RESULTS"])); if ($arParams["VOTE_ID"] <= 0) { ShowError(GetMessage("VOTE_NOT_FOUND")); return; } $counter = intval($arResult["VOTE"]["COUNTER"]); $counter = $counter <= 0 ? 1 : $counter; if ($arParams["VOTE_ALL_RESULTS"] == "Y" && !empty($arResult["GROUP_ANSWERS"])) { foreach ($arResult["GROUP_ANSWERS"] as $answerId => $answerOptions) { $userAnswerSum = 0; foreach ($answerOptions as $answerOption) { $userAnswerSum += $answerOption["COUNTER"]; } $ucolor = "\n"; foreach ($answerOptions as $aID => $answerOption) { $ucolor = GetNextRGB($ucolor, count($answerOptions));
echo LANGUAGE_ID; ?> &VOTE_ID=<?php echo $VOTE_ID; ?> " class="navchain"><?php echo GetMessage("VOTE_RESULTS_LIST"); ?> </a><?php echo ShowError(GetMessage("VOTE_NOT_FOUND")); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/epilog_admin.php"; die; } $aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("VOTE_PARAMS"), "ICON" => "main_vote_edit", "TITLE" => GetMessage("VOTE_PARAMS_TITE"))); $tabControl = new CAdminTabControl("tabControl", $aTabs, true, true); GetVoteDataByID($VOTE_ID, $arChannel, $arVote, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $arGroupAnswers, "N", $template, $res_template); /******************************************************************** Form ********************************************************************/ $APPLICATION->SetTitle(str_replace("#ID#", "{$EVENT_ID}", GetMessage("VOTE_PAGE_TITLE"))); require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php"; $aMenu = array(array("TEXT" => GetMessage("VOTE_RESULTS_LIST"), "LINK" => "/bitrix/admin/vote_user_votes_table.php?lang=" . LANGUAGE_ID . "&VOTE_ID=" . $VOTE_ID)); $context = new CAdminContextMenu($aMenu); $context->Show(); echo ShowError($strError); $tabControl->Begin(); //******************** //General Tab //******************** $tabControl->BeginNextTab(); ?>
function ShowVoteResults($VOTE_ID, $template1="") { global $APPLICATION; $VOTE_ID = GetVoteDataByID($VOTE_ID, $arChannel, $arVote, $arQuestions, $arAnswers, $arDropDown, $arMultiSelect, $arGroupAnswers, "Y"); if (intval($VOTE_ID)>0) { /***** for old pre-component templates **********/ global $VOTE_PERMISSION; $VOTE_PERMISSION = CVote::UserGroupPermission($arChannel["ID"]); /***** /old *************************************/ $perm = CVoteChannel::GetGroupPermission($arChannel["ID"]); if (intval($perm)>=1) { $template = (strlen($arVote["RESULT_TEMPLATE"])<=0) ? "default.php" : $arVote["RESULT_TEMPLATE"]; require_once ($_SERVER["DOCUMENT_ROOT"]."/bitrix/modules/vote/include.php"); IncludeModuleLangFile(__FILE__); $path = COption::GetOptionString("vote", "VOTE_TEMPLATE_PATH_VOTE"); if (strlen($template1)>0) $template = $template1; if ($APPLICATION->GetShowIncludeAreas()) { $arIcons = Array(); if (CModule::IncludeModule("fileman")) { $arIcons[] = Array( "URL" => "/bitrix/admin/fileman_file_edit.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&full_src=Y&path=". urlencode($path.$template), "SRC" => "/bitrix/images/vote/panel/edit_template.gif", "ALT" => GetMessage("VOTE_PUBLIC_ICON_TEMPLATE") ); $arrUrl = parse_url($_SERVER["REQUEST_URI"]); $arIcons[] = Array( "URL" => "/bitrix/admin/fileman_file_edit.php?lang=".LANGUAGE_ID."&site=".SITE_ID."&full_src=Y&path=". urlencode($arrUrl["path"]), "SRC" => "/bitrix/images/vote/panel/edit_file.gif", "ALT" => GetMessage("VOTE_PUBLIC_ICON_HANDLER") ); } $arIcons[] = Array( "URL" => "/bitrix/admin/vote_edit.php?lang=".LANGUAGE_ID."&ID=".$VOTE_ID, "SRC" => "/bitrix/images/vote/panel/edit_vote.gif", "ALT" => GetMessage("VOTE_PUBLIC_ICON_SETTINGS") ); echo $APPLICATION->IncludeStringBefore($arIcons); } $template = Rel2Abs('/', $template); include($_SERVER["DOCUMENT_ROOT"].$path.$template); if ($APPLICATION->GetShowIncludeAreas()) { echo $APPLICATION->IncludeStringAfter(); } } } }