本文整理汇总了PHP中CVote::WrongDateInterval方法的典型用法代码示例。如果您正苦于以下问题:PHP CVote::WrongDateInterval方法的具体用法?PHP CVote::WrongDateInterval怎么用?PHP CVote::WrongDateInterval使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CVote
的用法示例。
在下文中一共展示了CVote::WrongDateInterval方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: CheckFields
public static function CheckFields($ACTION, &$arFields, $ID = 0)
{
$aMsg = array();
$ID = intVal($ID);
$arVote = array();
if ($ID > 0) {
$db_res = CVote::GetByID($ID);
if ($db_res && ($res = $db_res->Fetch())) {
$arVote = $res;
}
}
unset($arFields["ID"]);
if (is_set($arFields, "CHANNEL_ID") || $ACTION == "ADD") {
$arFields["CHANNEL_ID"] = intVal($arFields["CHANNEL_ID"]);
if ($arFields["CHANNEL_ID"] <= 0) {
$aMsg[] = array("id" => "CHANNEL_ID", "text" => GetMessage("VOTE_EMPTY_CHANNEL_ID"));
} else {
$rChannel = CVoteChannel::GetList($by, $order, array('ID' => intval($arFields['CHANNEL_ID'])), $filtered);
if (!($rChannel && ($arChannel = $rChannel->Fetch()))) {
$aMsg[] = array("id" => "CHANNEL_ID", "text" => GetMessage("VOTE_WRONG_CHANNEL_ID"));
}
}
}
if (is_set($arFields, "C_SORT")) {
$arFields["C_SORT"] = intval($arFields["C_SORT"]);
}
if (is_set($arFields, "ACTIVE") || $ACTION == "ADD") {
$arFields["ACTIVE"] = $arFields["ACTIVE"] == "N" ? "N" : "Y";
}
unset($arFields["TIMESTAMP_X"]);
$date_start = false;
if (is_set($arFields, "DATE_START") || $ACTION == "ADD") {
$arFields["DATE_START"] = trim($arFields["DATE_START"]);
$date_start = MakeTimeStamp($arFields["DATE_START"]);
if (!$date_start) {
$aMsg[] = array("id" => "DATE_START", "text" => GetMessage("VOTE_WRONG_DATE_START"));
}
}
if (is_set($arFields, "DATE_END") || $ACTION == "ADD") {
$arFields["DATE_END"] = trim($arFields["DATE_END"]);
if (strlen($arFields["DATE_END"]) <= 0) {
if ($date_start != false) {
$date_end = $date_start + 2592000;
$arFields["DATE_END"] = GetTime($date_end, "FULL");
} else {
$date_end = 1924984799;
// '31.12.2030 23:59:59'
$arFields["DATE_END"] = GetTime($date_end, "FULL");
}
} else {
$date_end = MakeTimeStamp($arFields["DATE_END"]);
}
if (!$date_end) {
$aMsg[] = array("id" => "DATE_END", "text" => GetMessage("VOTE_WRONG_DATE_END"));
} elseif ($date_start >= $date_end && !empty($arFields["DATE_START"])) {
$aMsg[] = array("id" => "DATE_END", "text" => GetMessage("VOTE_WRONG_DATE_TILL"));
}
}
if (empty($aMsg) && (is_set($arFields, "DATE_START") || is_set($arFields, "DATE_END") || is_set($arFields, "CHANNEL_ID") || is_set($arFields, "ACTIVE"))) {
$vid = 0;
if ($ACTION == "ADD" && $arFields["ACTIVE"] == "Y") {
$vid = CVote::WrongDateInterval(0, $arFields["DATE_START"], $arFields["DATE_END"], $arFields["CHANNEL_ID"]);
} elseif ($ACTION != "ADD" && !(is_set($arFields, "ACTIVE") && $arFields["ACTIVE"] != "Y")) {
$res = array("DATE_START" => is_set($arFields, "DATE_START") ? $arFields["DATE_START"] : false, "DATE_END" => is_set($arFields, "DATE_END") ? $arFields["DATE_END"] : false, "CHANNEL_ID" => is_set($arFields, "CHANNEL_ID") ? $arFields["CHANNEL_ID"] : false);
$vid = CVote::WrongDateInterval($ID, $res["DATE_START"], $res["DATE_END"], $res["CHANNEL_ID"]);
}
if (intVal($vid) > 0) {
$aMsg[] = array("id" => "DATE_START", "text" => str_replace("#ID#", $vid, GetMessage("VOTE_WRONG_INTERVAL")));
}
}
if (is_set($arFields, "IMAGE_ID") && strLen($arFields["IMAGE_ID"]["name"]) <= 0 && strLen($arFields["IMAGE_ID"]["del"]) <= 0) {
unset($arFields["IMAGE_ID"]);
} elseif (is_set($arFields, "IMAGE_ID")) {
if ($str = CFile::CheckImageFile($arFields["IMAGE_ID"])) {
$aMsg[] = array("id" => "IMAGE_ID", "text" => $str);
} else {
$arFields["IMAGE_ID"]["MODULE_ID"] = "vote";
if (!empty($arVote)) {
$arFields["IMAGE_ID"]["old_file"] = $arVote["IMAGE_ID"];
}
}
}
if (is_set($arFields, "COUNTER")) {
$arFields["COUNTER"] = intVal($arFields["COUNTER"]);
}
if (is_set($arFields, "TITLE")) {
$arFields["TITLE"] = trim($arFields["TITLE"]);
}
if (is_set($arFields, "DESCRIPTION")) {
$arFields["DESCRIPTION"] = trim($arFields["DESCRIPTION"]);
}
if (is_set($arFields, "DESCRIPTION_TYPE") || $ACTION == "ADD") {
$arFields["DESCRIPTION_TYPE"] = $arFields["DESCRIPTION_TYPE"] == "html" ? "html" : "text";
}
if (is_set($arFields, "EVENT1")) {
$arFields["EVENT1"] = trim($arFields["EVENT1"]);
}
if (is_set($arFields, "EVENT2")) {
$arFields["EVENT2"] = trim($arFields["EVENT2"]);
}
//.........这里部分代码省略.........