本文整理汇总了PHP中CVote::GetByIDEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CVote::GetByIDEx方法的具体用法?PHP CVote::GetByIDEx怎么用?PHP CVote::GetByIDEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVote
的用法示例。
在下文中一共展示了CVote::GetByIDEx方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: GetVoteDataByID
function GetVoteDataByID($VOTE_ID, &$arChannel, &$arVote, &$arQuestions, &$arAnswers, &$arDropDown, &$arMultiSelect, &$arGroupAnswers, $arAddParams = "N")
{
$VOTE_ID = intval($VOTE_ID);
$arChannel = array();
$arVote = array();
$arQuestions = array();
$arAnswers = array();
$arDropDown = array();
$arMultiSelect = array();
$GLOBALS["VOTE_CACHE_VOTING"][$VOTE_ID] = (is_array($GLOBALS["VOTE_CACHE_VOTING"][$VOTE_ID]) ? $GLOBALS["VOTE_CACHE_VOTING"][$VOTE_ID] : array());
if (empty($GLOBALS["VOTE_CACHE_VOTING"][$VOTE_ID]))
{
$db_res = CVote::GetByIDEx($VOTE_ID);
if (!($db_res && $arVote = $db_res->GetNext()))
{
return false;
}
foreach ($arVote as $key => $res)
{
if (strpos($key, "CHANNEL_") === 0)
{
$arChannel[substr($key, 8)] = $res;
}
elseif (strpos($key, "~CHANNEL_") === 0)
{
$arChannel["~".substr($key, 9)] = $res;
}
}
$by = "s_c_sort"; $order = "asc";
$db_res = CVoteQuestion::GetList($VOTE_ID, $by, $order, array("ACTIVE" => "Y"), $is_filtered);
while ($res = $db_res->GetNext())
{
$arQuestions[$res["ID"]] = $res + array("ANSWERS" => array());
}
if (!empty($arQuestions))
{
$db_res = CVoteAnswer::GetListEx(
array("C_SORT" => "ASC"),
array("VOTE_ID" => $VOTE_ID, "ACTIVE" => "Y", "@QUESTION_ID" => array_keys($arQuestions)));
while ($res = $db_res->GetNext())
{
$arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ID"]] = $res;
$arAnswers[$res["QUESTION_ID"]][] = $res;
switch ($res["FIELD_TYPE"]) // dropdown and multiselect and text inputs
{
case 2:
$arDropDown[$res["QUESTION_ID"]] = (is_array($arDropDown[$res["QUESTION_ID"]]) ? $arDropDown[$res["QUESTION_ID"]] :
array("reference" => array(), "reference_id" => array(), "~reference" => array()));
$arDropDown[$res["QUESTION_ID"]]["reference"][] = $res["MESSAGE"];
$arDropDown[$res["QUESTION_ID"]]["~reference"][] = $res["~MESSAGE"];
$arDropDown[$res["QUESTION_ID"]]["reference_id"][] = $res["ID"];
break;
case 3:
$arMultiSelect[$res["QUESTION_ID"]] = (is_array($arMultiSelect[$res["QUESTION_ID"]]) ? $arMultiSelect[$res["QUESTION_ID"]] :
array("reference" => array(), "reference_id" => array(), "~reference" => array()));
$arMultiSelect[$res["QUESTION_ID"]]["reference"][] = $res["MESSAGE"];
$arMultiSelect[$res["QUESTION_ID"]]["~reference"][] = $res["~MESSAGE"];
$arMultiSelect[$res["QUESTION_ID"]]["reference_id"][] = $res["ID"];
break;
}
}
$event_id = intval($arAddParams["bRestoreVotedData"] == "Y" && !!$_SESSION["VOTE"]["VOTES"][$VOTE_ID] ?
$_SESSION["VOTE"]["VOTES"][$VOTE_ID] : 0);
$db_res = CVoteEvent::GetUserAnswerStat($VOTE_ID,
array("bGetMemoStat" => "N", "bGetEventResults" => $event_id));
if ($db_res && ($res = $db_res->Fetch()))
{
do
{
if (isset($arQuestions[$res["QUESTION_ID"]]) && is_array($arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]]) && is_array($res))
{
$arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]] += $res;
if ($event_id > 0 && !empty($res["RESTORED_ANSWER_ID"]))
{
switch ($arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]]["FIELD_TYPE"]):
case 0: // radio
case 2: // dropdown list
$fieldName = ($arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]]["FIELD_TYPE"] == 0 ?
"vote_radio_" : "vote_dropdown_").$res["QUESTION_ID"];
$_REQUEST[$fieldName] = $res["RESTORED_ANSWER_ID"];
break;
case 1: // checkbox
case 3: // multiselect list
$fieldName = ($arQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ANSWER_ID"]]["FIELD_TYPE"] == 1 ?
"vote_checkbox_" : "vote_multiselect_").$res["QUESTION_ID"];
$_REQUEST[$fieldName] = (is_array($_REQUEST[$fieldName]) ? $_REQUEST[$fieldName] : array());
$_REQUEST[$fieldName][] = $res["ANSWER_ID"];
break;
case 4: // field
case 5: // text
// do not restored
break;
endswitch;
}
}
//.........这里部分代码省略.........
示例2: GetAdminListViewHTML
function GetAdminListViewHTML($arUserField, $arHtmlControl)
{
$return = ' ';
$return_url = $GLOBALS["APPLICATION"]->GetCurPageParam("", array("admin_history", "mode", "table_id"));
if ($arHtmlControl["VALUE"] > 0) {
$db_res = CVote::GetByIDEx($arHtmlControl["VALUE"]);
if ($db_res && ($arVote = $db_res->GetNext())) {
if ($arVote["LAMP"] == "yellow") {
$arVote["LAMP"] = $arVote["ID"] == CVote::GetActiveVoteId($arVote["CHANNEL_ID"]) ? "green" : "red";
}
$return = "<div class=\"lamp-red\" title=\"" . ($arVote["ACTIVE"] != 'Y' ? GetMessage("VOTE_NOT_ACTIVE") : GetMessage("VOTE_ACTIVE_RED_LAMP")) . "\" style=\"display:inline-block;\"></div>";
if ($arVote["LAMP"] == "green") {
$return = "<div class=\"lamp-green\" title=\"" . GetMessage("VOTE_LAMP_ACTIVE") . "\" style=\"display:inline-block;\"></div>";
}
$return .= " [<a href='vote_edit.php?lang=" . LANGUAGE_ID . "&ID=" . $arVote["ID"] . "&return_url=" . urlencode($return_url) . "' title='" . GetMessage("VOTE_EDIT_TITLE") . "'>" . $arVote["ID"] . "</a>] ";
$return .= $arVote["TITLE"] . (!empty($arVote["DESCRIPTION"]) ? " <i>(" . $arVote["DESCRIPTION"] . ")</i>" : "");
if ($arVote["COUNTER"] > 0) {
$return .= GetMessage("VOTE_VOTES") . " <a href=\"vote_user_votes.php?lang=" . LANGUAGE_ID . "&find_vote_id=" . $arVote["ID"] . "&find_valid=Y&set_filter=Y\">" . $arVote["COUNTER"] . "</a>";
}
}
}
return $return;
}
示例3: intval
if ($arParams["CACHE_TYPE"] == "Y" || $arParams["CACHE_TYPE"] == "A" && COption::GetOptionString("main", "component_cache_on", "Y") == "Y") {
$arParams["CACHE_TIME"] = intval($arParams["CACHE_TIME"]);
} else {
$arParams["CACHE_TIME"] = 0;
}
/********************************************************************
/Input params
********************************************************************/
$obCache = new CPHPCache();
$cache_path = str_replace(array(":", "//"), "/", "/" . SITE_ID . "/" . $componentName . "/" . $arParams["CHANNEL_SID"] . "/");
$cache_id = "vote_current_" . serialize($arParams) . (($tzOffset = CTimeZone::GetOffset()) != 0 ? "_" . $tzOffset : "");
if (!$obCache->InitCache($arParams["CACHE_TIME"], $cache_id, $cache_path)) {
$arVote = array();
$db_res = false;
if (!!$arParams["VOTE_ID"]) {
$db_res = CVote::GetByIDEx($arParams["VOTE_ID"]);
} else {
$obChannel = CVoteChannel::GetList($by, $order, array("SID" => $arParams["CHANNEL_SID"], "SID_EXACT_MATCH" => "Y", "SITE" => SITE_ID, "ACTIVE" => "Y", "HIDDEN" => "N"), $is_filtered);
if ($obChannel && ($arChannel = $obChannel->Fetch())) {
$db_res = CVote::GetList($by, $order, array("CHANNEL_ID" => $arChannel["ID"], "LAMP" => "green"), $is_filtered);
}
}
$arVote = $db_res ? $db_res->Fetch() : array();
if (empty($arVote) || $arVote["CHANNEL_ACTIVE"] != "Y" || $arVote["ACTIVE"] != "Y") {
return false;
}
$arResult = array("VOTE" => $arVote, "VOTE_ID" => $arVote["ID"], "VOTE_RESULT_TEMPLATE" => $APPLICATION->GetCurPageParam("", array("VOTE_SUCCESSFULL", "VOTE_ID", "view_form")), "ADDITIONAL_CACHE_ID" => "current_vote");
$obCache->StartDataCache();
CVoteCacheManager::SetTag($cache_path, array("C" => $arVote["CHANNEL_ID"], "V" => $arVote["ID"]));
$obCache->EndDataCache(array("arResult" => $arResult));
} else {