本文整理汇总了PHP中CVote::GetNowTime方法的典型用法代码示例。如果您正苦于以下问题:PHP CVote::GetNowTime方法的具体用法?PHP CVote::GetNowTime怎么用?PHP CVote::GetNowTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVote
的用法示例。
在下文中一共展示了CVote::GetNowTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFields
function CheckFields($arUserField, $value)
{
if (!($arUserField && is_array($arUserField["USER_TYPE"]) &&
$arUserField["USER_TYPE"]["CLASS_NAME"] == __CLASS__))
return true;
$arData = (isset($GLOBALS[$arUserField["FIELD_NAME"]."_DATA"]) ? $GLOBALS[$arUserField["FIELD_NAME"]."_DATA"] : false);
$aMsg = array();
if (!empty($arData) && CModule::IncludeModule("vote"))
{
$arVote = array(
"ID" => $value,
"CHANNEL_ID" => $arUserField["SETTINGS"]["CHANNEL_ID"],
"TITLE" => $arData["TITLE"],
"URL" => $arData["URL"],
"NOTIFY" => $arUserField["SETTINGS"]["NOTIFY"],
"DATE_END" => GetTime((isset($arData["DATE_END"]) ? MakeTimeStamp($arData["DATE_END"]) : 1924984799), "FULL"),
"QUESTIONS" => array());
$arVoteQuestions = array();
$arQuestions = is_array($arData["QUESTIONS"]) ? $arData["QUESTIONS"] : array();
if (!$arVote["ID"]) {
$arVote["DATE_START"] = GetTime(CVote::GetNowTime(), "FULL");
} else {
$db_res = CVoteQuestion::GetListEx(array("ID" => "ASC"),
array("CHANNEL_ID" => $arVote["CHANNEL_ID"], "VOTE_ID" => $arVote["ID"]));
if ($db_res && $res = $db_res->Fetch()) {
do {
$arVoteQuestions[$res["ID"]] = $res + array("ANSWERS" => array());
} while ($res = $db_res->Fetch());
}
if (!empty($arVoteQuestions)) {
$db_res = CVoteAnswer::GetListEx(array("ID" => "ASC"),
array("CHANNEL_ID" => $arVote["CHANNEL_ID"], "VOTE_ID" => $arVote["ID"]));
if ($db_res && $res = $db_res->Fetch()) {
do {
if (is_set($arVoteQuestions, $res["QUESTION_ID"]))
$arVoteQuestions[$res["QUESTION_ID"]]["ANSWERS"][$res["ID"]] = $res;
} while ($res = $db_res->Fetch());
}
}
}
foreach ($arQuestions as $key => $arQuestion)
{
$res = array(
"ID" => (array_key_exists($arQuestion["ID"], $arVoteQuestions) ? $arQuestion["ID"] : false),
"QUESTION" => trim($arQuestion["QUESTION"]),
"MULTI" => ($arQuestion["MULTI"] == "Y" ? "Y" : "N"),
"ANSWERS" => array());
$arQuestion["ANSWERS"] = (is_array($arQuestion["ANSWERS"]) ?
$arQuestion["ANSWERS"] : array());
$arVoteAnswers = ($res["ID"] > 0 ? $arVoteQuestions[$res["ID"]]["ANSWERS"] : array());
foreach ($arQuestion["ANSWERS"] as $arAnswer)
{
$resa = array(
"ID" => (array_key_exists($arAnswer["ID"], $arVoteAnswers) ? $arAnswer["ID"] : false),
"MESSAGE" => trim($arAnswer["MESSAGE"]),
"FIELD_TYPE" => ($res["MULTI"] == "Y" ? 1 : 0));
if (empty($resa["MESSAGE"])){ continue; }
if (!!$resa["ID"]) { unset($arVoteAnswers[$resa["ID"]]); }
$res["ANSWERS"][] = $resa;
}
foreach ($arVoteAnswers as $arAnswer) {
$res["ANSWERS"][] = array_merge($arAnswer, array("DEL" => "Y")); }
if (empty($res["ANSWERS"]) && empty($res["QUESTION"]) && !$res["ID"]) { continue; }
if (!!$res["ID"]) { unset($arVoteQuestions[$res["ID"]]); }
$arVote["QUESTIONS"][] = $res;
}
$arVoteParams = array();
if (!empty($arVote["QUESTIONS"]))
{
$arVoteParams = array(
"UNIQUE_TYPE" => $arUserField["SETTINGS"]['UNIQUE'],
"DELAY" => intval($arUserField["SETTINGS"]['UNIQUE_IP_DELAY']["DELAY"]),
"DELAY_TYPE" => $arUserField["SETTINGS"]['UNIQUE_IP_DELAY']["DELAY_TYPE"]);
}
if (!VoteVoteEditFromArray($arUserField["SETTINGS"]["CHANNEL_ID"], $arVote["ID"],
$arVote, ($res = ($arVoteParams + array("bOnlyCheck" => "Y")))))
{
$aMsg[] = array(
"id" => $arUserField["FIELD_NAME"],
"text" => (($e = $GLOBALS['APPLICATION']->GetException()) && $e ? preg_replace("/\<br(.*?)\>/", " ", $e->GetString()) : GetMessage("VT_UNKNOWN_ERROR_ADD_VOTE"))
);
}
else
{
$GLOBALS[__CLASS__.$arUserField["ENTITY_VALUE_ID"]] = array("VOTE" => $arVote, "PARAMS" => $arVoteParams);
}
}
//.........这里部分代码省略.........