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


PHP CVote::Update方法代码示例

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


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

示例1: isset

 $uniqSession = isset($_REQUEST['UNIQUE_TYPE_SESSION']) ? intval($_REQUEST['UNIQUE_TYPE_SESSION']) : 0;
 $uniqCookie = isset($_REQUEST['UNIQUE_TYPE_COOKIE']) ? intval($_REQUEST['UNIQUE_TYPE_COOKIE']) : 0;
 $uniqIP = isset($_REQUEST['UNIQUE_TYPE_IP']) ? intval($_REQUEST['UNIQUE_TYPE_IP']) : 0;
 $uniqID = isset($_REQUEST['UNIQUE_TYPE_USER_ID']) ? intval($_REQUEST['UNIQUE_TYPE_USER_ID']) : 0;
 $uniqIDNew = isset($_REQUEST['UNIQUE_TYPE_USER_ID_NEW']) ? intval($_REQUEST['UNIQUE_TYPE_USER_ID_NEW']) : 0;
 $uniqType = $uniqSession | $uniqCookie | $uniqIP | $uniqID | $uniqIDNew;
 $uniqType += 5;
 $arFields = array("CHANNEL_ID" => $_REQUEST["CHANNEL_ID"], "C_SORT" => intVal($_REQUEST["C_SORT"]), "ACTIVE" => $_REQUEST["ACTIVE"] == "Y" ? "Y" : "N", "DATE_START" => $_REQUEST["DATE_START"], "DATE_END" => $_REQUEST["DATE_END"], "TITLE" => $_REQUEST["TITLE"], "DESCRIPTION" => $_REQUEST["DESCRIPTION"], "DESCRIPTION_TYPE" => $_REQUEST["DESCRIPTION_TYPE"], "IMAGE_ID" => $arIMAGE_ID, "EVENT1" => $_REQUEST["EVENT1"], "EVENT2" => $_REQUEST["EVENT2"], "EVENT3" => $_REQUEST["EVENT3"], "UNIQUE_TYPE" => $uniqType, "DELAY" => $_REQUEST["DELAY"], "DELAY_TYPE" => $_REQUEST["DELAY_TYPE"], "TEMPLATE" => $_REQUEST["TEMPLATE"], "RESULT_TEMPLATE" => $_REQUEST["RESULT_TEMPLATE"], "NOTIFY" => $_REQUEST["NOTIFY"], "URL" => $_REQUEST["URL"]);
 $result = false;
 $arFields["IMAGE_ID"]["del"] = $_POST["IMAGE_ID_del"];
 if (!CVote::CheckFields($ID > 0 ? "UPDATE" : "ADD", $arFields, $ID, array("CHECK_INTERSECTION" => "Y"))) {
 } elseif ($ID <= 0) {
     $arFields["AUTHOR_ID"] = $GLOBALS["USER"]->GetId();
     $result = $ID = CVote::Add($arFields);
 } else {
     $result = CVote::Update($ID, $arFields);
 }
 if (!$result) {
     $e = $APPLICATION->GetException();
     $message = new CAdminMessage(GetMessage("VOTE_GOT_ERROR"), $e);
     $bVarsFromForm = true;
 } else {
     if (isset($_REQUEST['COPYID']) && ($oldID = intval($_REQUEST['COPYID'])) > 0 && ($rCurrentVote = CVote::GetByID($oldID)) && ($arCurrentVote = $rCurrentVote->Fetch())) {
         global $DB;
         $newImageId = false;
         if (intval($arCurrentVote['IMAGE_ID']) > 0 && empty($arIMAGE_ID['name']) && $arIMAGE_ID['del'] != 'Y') {
             $imageId = $arCurrentVote['IMAGE_ID'];
             $newImageId = CFile::CopyFile($imageId);
             $arCurrentVote["IMAGE_ID"] = NULL;
         }
         $newID = $ID;
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:vote_edit.php

示例2: VoteVoteEditFromArray


//.........这里部分代码省略.........
        $arFieldsQuestions[$key] = $arQuestion;
    }
    foreach ($arQuestions as $arQuestion) {
        $arFieldsQuestions[] = $arQuestion + array("DEL" => "Y");
    }
    if (!empty($aMsg)) {
        $e = new CAdminException(array_reverse($aMsg));
        $GLOBALS["APPLICATION"]->ThrowException($e);
        return false;
    } elseif (empty($arFieldsQuestions) && $VOTE_ID <= 0) {
        return true;
    } elseif ($params["bOnlyCheck"] == "Y") {
        return true;
    }
    /************** Check Data/*****************************************/
    /************** Main actions with return ***************************/
    if (empty($arFieldsVote["TITLE"])) {
        $q = reset($arFieldsQuestions);
        $arFieldsVote["TITLE"] = null;
        do {
            if ($q["DEL"] != "Y") {
                $arFieldsVote["TITLE"] = $q["QUESTION"];
                break;
            }
        } while ($q = next($arFieldsQuestions));
        reset($arFieldsQuestions);
    }
    if (empty($arVote)) {
        $arFieldsVote["UNIQUE_TYPE"] = $params["UNIQUE_TYPE"];
        $arFieldsVote["DELAY"] = $params["DELAY"];
        $arFieldsVote["DELAY_TYPE"] = $params["DELAY_TYPE"];
        $arVote["ID"] = intval(CVote::Add($arFieldsVote));
    } else {
        CVote::Update($VOTE_ID, $arFieldsVote);
    }
    if ($iQuestions > 0 && $arVote["ID"] > 0) {
        $iQuestions = 0;
        foreach ($arFieldsQuestions as $arQuestion) {
            if ($arQuestion["DEL"] == "Y") {
                CVoteQuestion::Delete($arQuestion["ID"]);
                continue;
            } elseif ($arQuestion["ID"] > 0) {
                $arQuestion["C_SORT"] = ($iQuestions + 1) * 10;
                CVoteQuestion::Update($arQuestion["ID"], $arQuestion);
            } else {
                $arQuestion["C_SORT"] = ($iQuestions + 1) * 10;
                $arQuestion["VOTE_ID"] = $arVote["ID"];
                $arQuestion["ID"] = intVal(CVoteQuestion::Add($arQuestion));
                if ($arQuestion["ID"] <= 0) {
                    continue;
                }
            }
            $iQuestions++;
            $iAnswers = 0;
            foreach ($arQuestion["ANSWERS"] as $arAnswer) {
                if ($arAnswer["DEL"] == "Y") {
                    CVoteAnswer::Delete($arAnswer["ID"]);
                    continue;
                }
                if ($arAnswer["ID"] > 0) {
                    $arAnswer["C_SORT"] = $iAnswers * 10;
                    CVoteAnswer::Update($arAnswer["ID"], $arAnswer);
                } else {
                    $arAnswer["QUESTION_ID"] = $arQuestion["ID"];
                    $arAnswer["C_SORT"] = ($iAnswers + 1) * 10;
                    $arAnswer["ID"] = intVal(CVoteAnswer::Add($arAnswer));
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:67,代码来源:include.php

示例3: is_array

            $arID[] = $arRes['ID'];
        }
    }
    $arID = is_array($arID) ? $arID : array($arID);
    foreach ($arID as $ID) {
        $ID = intVal($ID);
        if ($ID <= 0) {
            continue;
        }
        switch ($_REQUEST['action']) {
            case "delete":
                CVote::Delete($ID);
                break;
            case "activate":
            case "deactivate":
                if (!CVote::Update($ID, array("ACTIVE" => $_REQUEST['action'] == "activate" ? "Y" : "N"))) {
                    if ($ex = $GLOBALS['APPLICATION']->GetException()) {
                        $lAdmin->AddGroupError($ex->GetString(), $ID);
                    } else {
                        $lAdmin->AddGroupError(GetMessage("VOTE_SAVE_ERROR"), $ID);
                    }
                }
                break;
        }
    }
}
/********************************************************************
				/ACTIONS
********************************************************************/
/********************************************************************
				Data
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:31,代码来源:vote_list.php


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