while ($res = $db_res->Fetch()) { $data = array("ID" => $res["ID"]); if (array_key_exists("PERSONAL_PHOTO", $res)) { $arFileTmp = CFile::ResizeImageGet($res["PERSONAL_PHOTO"], array("width" => 21, "height" => 21), BX_RESIZE_IMAGE_EXACT, false); $data["PHOTO"] = CFile::ShowImage($arFileTmp["src"], 21, 21, "border=0"); } $data["FULL_NAME"] = CUser::FormatName($_REQUEST["NAME_TEMPLATE"], $res); $data["URL"] = CUtil::JSEscape(CComponentEngine::MakePathFromTemplate($_REQUEST["URL_TEMPLATE"], array("UID" => $res["ID"], "user_id" => $res["ID"], "USER_ID" => $res["ID"]))); $arUsers[$res["ID"]] = $data; } $arVoteList["items"] = array(); foreach ($_REQUEST["ID"] as $id) { $arVoteList["items"][] = $arUsers[$id]; } if ($arParams["CACHE_TIME"] > 0) { $cache->StartDataCache($arParams["CACHE_TIME"], $cache_id, $cache_path); if (!!$arEventsInfo) { $db_res = CVoteQuestion::GetByID($arEventsInfo["QUESTION_ID"]); if ($db_res && ($res = $db_res->Fetch())) { CVoteCacheManager::SetTag($cache_path, "V", $res["VOTE_ID"]); } } $cache->EndDataCache($arVoteList); } } } } $APPLICATION->RestartBuffer(); Header('Content-Type: application/x-javascript; charset=' . LANG_CHARSET); echo CUtil::PhpToJsObject($arVoteList); die;
public static function Copy($ID, $newVoteID) { $ID = intVal($ID); if ($ID <= 0) { return false; } $newVoteID = intVal($newVoteID); if ($newVoteID <= 0) { return false; } $res = CVoteQuestion::GetByID($ID); if (!($arQuestion = $res->Fetch())) { return false; } $arQuestion['VOTE_ID'] = $newVoteID; unset($arQuestion['ID']); $newQuestionID = CVoteQuestion::Add($arQuestion); if ($newQuestionID === false) { return false; } $state = true; $rAnswers = CVoteAnswer::GetList($ID); while ($arAnswer = $rAnswers->Fetch()) { $arAnswer['QUESTION_ID'] = $newQuestionID; unset($arAnswer['ID']); $state = $state && CVoteAnswer::Add($arAnswer) !== false; } if (!$state) { return $state; } CVoteQuestion::Reset($newQuestionID); return $newQuestionID; }
function Copy($ID, $newVoteID) { $err_mess = CAllVoteQuestion::err_mess() . "<br>Function: Copy<br>Line: "; $ID = intVal($ID); if ($ID <= 0) { return false; } $newVoteID = intVal($newVoteID); if ($newVoteID <= 0) { return false; } $res = CVoteQuestion::GetByID($ID); if (!($arQuestion = $res->Fetch())) { return false; } $arQuestion['VOTE_ID'] = $newVoteID; unset($arQuestion['ID']); $newQuestionID = CVoteQuestion::Add($arQuestion); if ($newQuestionID === false) { return false; } $state = true; $rAnswers = CVoteAnswer::GetList($ID); while ($arAnswer = $rAnswers->GetNext()) { $arAnswer['QUESTION_ID'] = $newQuestionID; unset($arAnswer['ID']); unset($arAnswer['~ID']); $state = $state && CVoteAnswer::Add($arAnswer) !== false; } if (!$state) { return $state; } CVoteQuestion::Reset($newQuestionID); return $newQuestionID; }
function OnAfterVoteQuestionUpdate($ID, $arFields) { if (array_key_exists("VOTE_ID", $arFields)) { self::ClearTag("V", $arFields["VOTE_ID"]); } else { $db_res = CVoteQuestion::GetByID($ID); if ($db_res && ($res = $db_res->Fetch())) { self::ClearTag("V", $res["VOTE_ID"]); } } self::ClearTag("Q", $ID); }
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/vote/include.php"; ClearVars(); IncludeModuleLangFile(__FILE__); $err_mess = "File: " . __FILE__ . "<br>Line: "; define("HELP_FILE", "vote_list.php"); $old_module_version = CVote::IsOldVersion(); $aTabs = array(array("DIV" => "edit2", "TAB" => GetMessage("VOTE_QUESTION"), "ICON" => "vote_question_edit", "TITLE" => GetMessage("VOTE_QUESTION_TEXT")), array("DIV" => "edit3", "TAB" => GetMessage("VOTE_ANSWERS"), "ICON" => "vote_question_edit", "TITLE" => GetMessage("VOTE_ANSWER_LIST"))); $tabControl = new CAdminTabControl("tabControl", $aTabs); $message = null; $arSort = array(0); $ID = intval($ID); $arQuestion = array(); $arAnswers = array(); $arAnswersFields = array(); if ($ID > 0) { $db_res = CVoteQuestion::GetByID($ID); if (!($db_res && ($arQuestion = $db_res->Fetch()))) { $ID = 0; } else { $ii = 1; $VOTE_ID = intVal($arQuestion["VOTE_ID"]); $db_res = CVoteAnswer::GetList($ID); if ($db_res && ($res = $db_res->Fetch())) { do { $arAnswers[$ii] = $res; $ii++; } while ($res = $db_res->Fetch()); } } } if ($ID <= 0) {