当前位置: 首页>>代码示例>>PHP>>正文


PHP CVote::IsOldVersion方法代码示例

本文整理汇总了PHP中CVote::IsOldVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP CVote::IsOldVersion方法的具体用法?PHP CVote::IsOldVersion怎么用?PHP CVote::IsOldVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CVote的用法示例。


在下文中一共展示了CVote::IsOldVersion方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: CheckFields

 function CheckFields($ACTION, &$arFields, $ID = 0)
 {
     $aMsg = array();
     $ID = intVal($ID);
     $ACTION = $ACTION == "UPDATE" ? "UPDATE" : "ADD";
     $arQuestion = array();
     if ($ID > 0 && $ACTION == "UPDATE") {
         $db_res = CVoteQuestion::GetByID($ID);
         if (!($db_res && ($arQuestion = $db_res->Fetch()))) {
             $aMsg[] = array("id" => "ID", "text" => GetMessage("VOTE_QUESTION_NOT_FOUND"));
         }
     }
     unset($arFields["ID"]);
     if (is_set($arFields, "VOTE_ID") || $ACTION == "ADD") {
         $arFields["VOTE_ID"] = intVal($arFields["VOTE_ID"]);
         if ($arFields["VOTE_ID"] <= 0) {
             $aMsg[] = array("id" => "VOTE_ID", "text" => GetMessage("VOTE_FORGOT_VOTE_ID"));
         }
     }
     if (is_set($arFields, "QUESTION") || $ACTION == "ADD") {
         $arFields["QUESTION"] = trim($arFields["QUESTION"]);
         if (empty($arFields["QUESTION"])) {
             $aMsg[] = array("id" => "QUESTION", "text" => GetMessage("VOTE_FORGOT_QUESTION"));
         }
     }
     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($arQuestion)) {
                 $arFields["IMAGE_ID"]["old_file"] = $arQuestion["IMAGE_ID"];
             }
         }
     }
     if (is_set($arFields, "ACTIVE") || $ACTION == "ADD") {
         $arFields["ACTIVE"] = $arFields["ACTIVE"] == "N" ? "N" : "Y";
     }
     unset($arFields["TIMESTAMP_X"]);
     if (is_set($arFields, "C_SORT") || $ACTION == "ADD") {
         $arFields["C_SORT"] = intVal($arFields["C_SORT"]) > 0 ? intVal($arFields["C_SORT"]) : 100;
     }
     if (is_set($arFields, "COUNTER") || $ACTION == "ADD") {
         $arFields["COUNTER"] = intVal($arFields["COUNTER"]);
     }
     if (is_set($arFields, "QUESTION_TYPE") || $ACTION == "ADD") {
         $arFields["QUESTION_TYPE"] = $arFields["QUESTION_TYPE"] == "html" ? "html" : "text";
     }
     if (is_set($arFields, "DIAGRAM") || $ACTION == "ADD") {
         $arFields["DIAGRAM"] = $arFields["DIAGRAM"] == "N" ? "N" : "Y";
     }
     if (is_set($arFields, "DIAGRAM_TYPE") && (empty($arFields["DIAGRAM_TYPE"]) || in_array($arFields["DIAGRAM_TYPE"], GetVoteDiagramArray()))) {
         $arFields["DIAGRAM_TYPE"] = VOTE_DEFAULT_DIAGRAM_TYPE;
     }
     if (is_set($arFields, "TEMPLATE")) {
         $arFields["TEMPLATE"] = substr(trim($arFields["TEMPLATE"]), 0, 255);
     }
     if (is_set($arFields, "TEMPLATE_NEW")) {
         $arFields["TEMPLATE_NEW"] = substr(trim($arFields["TEMPLATE_NEW"]), 0, 255);
     }
     if ((is_set($arFields, "TEMPLATE") || is_set($arFields, "TEMPLATE_NEW")) && COption::GetOptionString("vote", "VOTE_COMPATIBLE_OLD_TEMPLATE", "Y") == "Y") {
         $old_module_version = CVote::IsOldVersion();
         if ($old_module_version != "Y") {
             unset($arFields["TEMPLATE"]);
         } else {
             unset($arFields["TEMPLATE_NEW"]);
         }
     }
     if (!empty($aMsg)) {
         global $APPLICATION;
         $e = new CAdminException(array_reverse($aMsg));
         $APPLICATION->ThrowException($e);
         return false;
     }
     return true;
 }
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:78,代码来源:question.php

示例2: CheckFields


//.........这里部分代码省略.........
             $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"]);
     }
     if (is_set($arFields, "EVENT3")) {
         $arFields["EVENT3"] = trim($arFields["EVENT3"]);
     }
     if (is_set($arFields, "UNIQUE_TYPE")) {
         $arFields["UNIQUE_TYPE"] = intVal($arFields["UNIQUE_TYPE"]);
     }
     if (is_set($arFields, "DELAY_TYPE") || $ACTION == "ADD") {
         $arFields["DELAY_TYPE"] = trim($arFields["DELAY_TYPE"]);
         $arFields["DELAY_TYPE"] = in_array($arFields["DELAY_TYPE"], array("S", "M", "H", "D")) ? $arFields["DELAY_TYPE"] : "D";
     }
     if (is_set($arFields, "DELAY") || $ACTION == "ADD") {
         $arFields["DELAY"] = intVal($arFields["DELAY"]);
     }
     unset($arFields["KEEP_IP_SEC"]);
     $sec = 1;
     switch ($arFields["DELAY_TYPE"]) {
         case "S":
             $sec = 1;
             break;
         case "M":
             $sec = 60;
             break;
         case "H":
             $sec = 3600;
             break;
         case "D":
             $sec = 86400;
             break;
     }
     $arFields["KEEP_IP_SEC"] = intval($arFields["DELAY"]) * $sec;
     if (is_set($arFields, "UNIQUE_TYPE") && $arFields['UNIQUE_TYPE'] < 5) {
         switch ($arFields['UNIQUE_TYPE']) {
             case 0:
                 $arFields['UNIQUE_TYPE'] = 5;
                 break;
             case 1:
                 $arFields['UNIQUE_TYPE'] = 6;
                 break;
             case 2:
                 $arFields['UNIQUE_TYPE'] = 8;
                 break;
             case 3:
                 $arFields['UNIQUE_TYPE'] = 12;
                 break;
             case 4:
                 $arFields['UNIQUE_TYPE'] = 20;
                 break;
         }
     }
     if (CVote::IsOldVersion() != "Y") {
         unset($arFields["TEMPLATE"]);
         unset($arFields["RESULT_TEMPLATE"]);
     }
     if (is_set($arFields, "TEMPLATE")) {
         $arFields["TEMPLATE"] = trim($arFields["TEMPLATE"]);
     }
     if (is_set($arFields, "RESULT_TEMPLATE")) {
         $arFields["RESULT_TEMPLATE"] = trim($arFields["RESULT_TEMPLATE"]);
     }
     if (is_set($arFields, "NOTIFY")) {
         $arFields["NOTIFY"] = in_array($arFields["NOTIFY"], array("Y", "N", "I")) ? $arFields["NOTIFY"] : "N";
     }
     if (is_set($arFields, "REQUIRED")) {
         $arFields["REQUIRED"] = $arFields["REQUIRED"] == "Y" ? "Y" : "N";
     }
     if (is_set($arFields, "AUTHOR_ID")) {
         $arFields["AUTHOR_ID"] = intval($arFields["AUTHOR_ID"]);
     }
     if (!empty($aMsg)) {
         global $APPLICATION;
         $e = new CAdminException(array_reverse($aMsg));
         $APPLICATION->ThrowException($e);
         return false;
     }
     return true;
 }
开发者ID:andy-profi,项目名称:bxApiDocs,代码行数:101,代码来源:vote.php

示例3: ClearVars

# http://www.bitrix.ru						 #
# mailto:admin@bitrix.ru					 #
##############################################
*/
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_before.php";
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/vote/prolog.php";
$VOTE_RIGHT = $APPLICATION->GetGroupRight("vote");
if ($VOTE_RIGHT == "D") {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/vote/include.php";
ClearVars();
IncludeModuleLangFile(__FILE__);
CModule::IncludeModule("vote");
$err_mess = "File: " . __FILE__ . "<br>Line: ";
$old_module_version = CVote::IsOldVersion();
$aTabs = array(array("DIV" => "edit1", "TAB" => GetMessage("VOTE_PROP"), "ICON" => "main_vote_edit", "TITLE" => GetMessage("VOTE_PARAMS")), array("DIV" => "edit2", "TAB" => GetMessage("VOTE_DESCR"), "ICON" => "main_vote_edit", "TITLE" => GetMessage("VOTE_DESCRIPTION")), array("DIV" => "edit3", "TAB" => GetMessage("VOTE_HOSTS"), "ICON" => "main_vote_edit", "TITLE" => GetMessage("VOTE_UNIQUE_PARAMS")));
$tabControl = new CAdminTabControl("tabControl", $aTabs);
$arChannels = array();
$is_filtered = false;
$bVarsFromForm = false;
$db_res = CVoteChannel::GetList($by = "s_c_sort", $order = "asc", array(), $is_filtered);
if ($db_res && ($res = $db_res->GetNext())) {
    do {
        $arChannels[$res["ID"]] = $res;
    } while ($res = $db_res->GetNext());
}
if (empty($arChannels)) {
    $APPLICATION->SetTitle(GetMessage("VOTE_NEW_RECORD"));
    require_once $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_admin_after.php";
    echo "<a href='vote_list.php?lang=" . LANGUAGE_ID . "' class='navchain'>" . GetMessage("VOTE_VOTE_LIST") . "</a>";
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:vote_edit.php


注:本文中的CVote::IsOldVersion方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。