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


PHP CForumTopic::Update方法代码示例

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


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

示例1: unset

 }
 if (is_set($arFields, "FORUM_ID")) {
     if ($res["FORUM_ID"] != $arFields["FORUM_ID"]) {
         $result = CForumTopic::MoveTopic2Forum(array($res["ID"]), $arFields["FORUM_ID"], "N");
     }
     unset($arFields["FORUM_ID"]);
 }
 foreach ($arFields as $key => $val) {
     if ($val == $res[$key]) {
         unset($arFields[$key]);
     }
 }
 if (empty($arFields)) {
     continue;
 }
 if (!CForumTopic::Update($ID, $arFields)) {
     if ($ex = $APPLICATION->GetException()) {
         $lAdmin->AddUpdateError($ex->GetString(), $ID);
     } else {
         $lAdmin->AddUpdateError(GetMessage("FM_WRONG_UPDATE"), $ID);
     }
 } else {
     if (is_set($arFields, "STATE") && $arFields["STATE"] != $res["STATE"]) {
         $res = serialize($res);
         if ($arFields["STATE"] == "Y") {
             CForumEventLog::Log("topic", "open", $ID, $res);
         } else {
             CForumEventLog::Log("topic", "close", $ID, $res);
         }
         unset($arFields["STATE"]);
     }
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:forum_topics.php

示例2: ForumTopOrdinaryTopic

function ForumTopOrdinaryTopic($topic, $TYPE, &$strErrorMessage, &$strOKMessage, $arAddParams = array())
{
    global $USER;
    $arError = array();
    $arOk = array();
    $arFields = array("SORT" => $TYPE == "TOP" ? 100 : 150);
    $arAddParams = !is_array($arAddParams) ? array($arAddParams) : $arAddParams;
    $arAddParams["PERMISSION"] = !empty($arAddParams["PERMISSION"]) ? $arAddParams["PERMISSION"] : false;
    $topic = ForumDataToArray($topic);
    $forumID = 0;
    if (empty($topic)) {
        $arError[] = GetMessage("TOTOP_NO_TOPIC");
    } else {
        if (!CForumUser::IsAdmin() && !$arAddParams["PERMISSION"]) {
            $db_res = CForumTopic::GetListEx(array(), array("@ID" => implode(",", $topic), "PERMISSION_STRONG" => true));
        } else {
            $db_res = CForumTopic::GetListEx(array(), array("@ID" => implode(",", $topic)));
        }
        if ($db_res && ($res = $db_res->Fetch())) {
            do {
                if ($arAddParams["PERMISSION"] && !CForumTopic::CanUserUpdateTopic($res["ID"], $USER->GetUserGroupArray(), $USER->GetID(), $arAddParams["PERMISSION"])) {
                    $arError[] = GetMessage("FMT_NO_PERMS_MODERATE") . " (TID=" . intVal($res["ID"]) . ")";
                    continue;
                }
                $ID = CForumTopic::Update($res["ID"], $arFields, True);
                if (IntVal($ID) <= 0) {
                    if ($TYPE == "TOP") {
                        $arError[] = GetMessage("TOTOP_ERROR_TOP") . " (TID=" . intVal($res["ID"]) . ")";
                    } else {
                        $arError[] = GetMessage("TOTOP_ERROR_TOP1") . " (TID=" . intVal($res["ID"]) . ")";
                    }
                } else {
                    $forumID = $res['FORUM_ID'];
                    $arTopic["SORT"] = $arFields["SORT"];
                    $res = serialize($res);
                    if ($TYPE == "TOP") {
                        $arOk[] = GetMessage("TOTOP_SUCCESS_TOP") . " (TID=" . intVal($res["ID"]) . ")";
                        CForumEventLog::Log("topic", "stick", $ID, $res);
                    } else {
                        $arOk[] = GetMessage("TOTOP_SUCCESS_TOP1") . " (TID=" . intVal($res["ID"]) . ")";
                        CForumEventLog::Log("topic", "unstick", $ID, $res);
                    }
                }
            } while ($res = $db_res->Fetch());
            if (intval($forumID) > 0) {
                CForumCacheManager::ClearTag("F", $forumID);
            }
        } else {
            $arError[] = GetMessage("FMT_NO_PERMS_EDIT");
        }
    }
    if (count($arError) > 0) {
        $strErrorMessage .= implode(".\n", $arError) . ".\n";
    }
    if (count($arOk) > 0) {
        $strOKMessage .= implode(".\n", $arOk) . ".\n";
    }
    if (empty($arError)) {
        return true;
    } else {
        return false;
    }
}
开发者ID:DarneoStudio,项目名称:bitrix,代码行数:63,代码来源:include.php

示例3: SetStat

 function SetStat($ID = 0, $arParams = array())
 {
     global $DB;
     $ID = intVal($ID);
     if ($ID <= 0) {
         return false;
     }
     $arParams = is_array($arParams) ? $arParams : array();
     $arMessage = is_array($arParams["MESSAGE"]) ? $arParams["MESSAGE"] : array();
     if ($arMessage["TOPIC_ID"] != $ID) {
         $arMessage = array();
     }
     $arFields = array();
     if (!empty($arMessage)) {
         $arFields = array("ABS_LAST_POSTER_ID" => intVal($arMessage["AUTHOR_ID"]) > 0 ? $arMessage["AUTHOR_ID"] : false, "ABS_LAST_POSTER_NAME" => $arMessage["AUTHOR_NAME"], "ABS_LAST_POST_DATE" => $arMessage["POST_DATE"], "ABS_LAST_MESSAGE_ID" => $arMessage["ID"]);
         if ($arMessage["APPROVED"] == "Y") {
             $arFields["APPROVED"] = "Y";
             $arFields["LAST_POSTER_ID"] = $arFields["ABS_LAST_POSTER_ID"];
             $arFields["LAST_POSTER_NAME"] = $arFields["ABS_LAST_POSTER_NAME"];
             $arFields["LAST_POST_DATE"] = $arFields["ABS_LAST_POST_DATE"];
             $arFields["LAST_MESSAGE_ID"] = $arFields["ABS_LAST_MESSAGE_ID"];
             if ($arMessage["NEW_TOPIC"] != "Y") {
                 $arFields["=POSTS"] = "POSTS+1";
             }
         } else {
             $arFields["=POSTS_UNAPPROVED"] = "POSTS_UNAPPROVED+1";
         }
     } else {
         $res = CForumMessage::GetList(array(), array("TOPIC_ID" => $ID), "cnt_not_approved");
         $res["CNT"] = intVal($res["CNT"]) - intVal($res["CNT_NOT_APPROVED"]);
         $res["CNT"] = $res["CNT"] > 0 ? $res["CNT"] : 0;
         if (intval($res["ABS_FIRST_MESSAGE_ID"]) > 0 && intval($res["ABS_FIRST_MESSAGE_ID"]) != intval($res["FIRST_MESSAGE_ID"])) {
             $strSQL = "UPDATE b_forum_message SET NEW_TOPIC = (CASE WHEN ID=" . intval($res["ABS_FIRST_MESSAGE_ID"]) . " THEN 'Y' ELSE 'N' END) WHERE TOPIC_ID=" . $ID;
             $GLOBALS["DB"]->Query($strSQL, false, "File: " . __FILE__ . "<br>Line: " . __LINE__);
         }
         $arFields = array("APPROVED" => $res["CNT"] > 0 ? "Y" : "N", "POSTS" => $res["CNT"] > 0 ? $res["CNT"] - 1 : 0, "LAST_POSTER_ID" => false, "LAST_POSTER_NAME" => false, "LAST_POST_DATE" => false, "LAST_MESSAGE_ID" => intVal($res["LAST_MESSAGE_ID"]), "POSTS_UNAPPROVED" => intVal($res["CNT_NOT_APPROVED"]), "ABS_LAST_POSTER_ID" => false, "ABS_LAST_POSTER_NAME" => false, "ABS_LAST_POST_DATE" => false, "ABS_LAST_MESSAGE_ID" => intVal($res["ABS_LAST_MESSAGE_ID"]));
         if ($arFields["ABS_LAST_MESSAGE_ID"] > 0) {
             $res = CForumMessage::GetByID($arFields["ABS_LAST_MESSAGE_ID"], array("FILTER" => "N"));
             $arFields["ABS_LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
             $arFields["ABS_LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
             $arFields["ABS_LAST_POST_DATE"] = $res["POST_DATE"];
             if (intVal($arFields["LAST_MESSAGE_ID"]) > 0) {
                 if ($arFields["LAST_MESSAGE_ID"] < $arFields["ABS_LAST_MESSAGE_ID"]) {
                     $res = CForumMessage::GetByID($arFields["LAST_MESSAGE_ID"], array("FILTER" => "N"));
                 }
                 $arFields["LAST_POSTER_ID"] = intVal($res["AUTHOR_ID"]) > 0 ? $res["AUTHOR_ID"] : false;
                 $arFields["LAST_POSTER_NAME"] = $res["AUTHOR_NAME"];
                 $arFields["LAST_POST_DATE"] = $res["POST_DATE"];
             }
         }
         foreach (array("LAST_POST_DATE" => "START_DATE", "ABS_LAST_POST_DATE" => "START_DATE", "LAST_POSTER_NAME" => "USER_START_NAME", "ABS_LAST_POSTER_NAME" => "USER_START_NAME") as $key => $val) {
             if ($arFields[$key] == false) {
                 $arFields["=" . $key] = $val;
                 unset($arFields[$key]);
             }
         }
     }
     return CForumTopic::Update($ID, $arFields);
 }
开发者ID:k-kalashnikov,项目名称:geekcon_new,代码行数:59,代码来源:topic.php

示例4: empty

         $sName = empty($sName) ? $nameProperty : $sName;
         $res = $obProperty->Add(array("IBLOCK_ID" => $PRODUCT_IBLOCK_ID, "ACTIVE" => "Y", "PROPERTY_TYPE" => "N", "MULTIPLE" => "N", "NAME" => $sName, "CODE" => $nameProperty));
         if ($res) {
             ${strToUpper($nameProperty)} = 0;
         }
     }
 }
 // 1.5 Set NULL for topic_id if it was deleted
 if ($FORUM_TOPIC_ID > 0) {
     $arTopic = CForumTopic::GetByID($FORUM_TOPIC_ID);
     if (!$arTopic || !is_array($arTopic) || count($arTopic) <= 0 || $arTopic["FORUM_ID"] != $arParams["FORUM_ID"]) {
         CIBlockElement::SetPropertyValues($arParams["ELEMENT_ID"], $PRODUCT_IBLOCK_ID, 0, "FORUM_TOPIC_ID");
         CIBlockElement::SetPropertyValues($arParams["ELEMENT_ID"], $PRODUCT_IBLOCK_ID, 0, "FORUM_MESSAGE_CNT");
         $FORUM_TOPIC_ID = 0;
     } elseif ($arTopic["XML_ID"] !== "IBLOCK_" . $arParams["ELEMENT_ID"]) {
         CForumTopic::Update($FORUM_TOPIC_ID, array("XML_ID" => "IBLOCK_" . $arParams["ELEMENT_ID"]));
     }
 } elseif (($arTopic = CForumTopic::GetList(array(), array("XML_ID" => "IBLOCK_" . $arParams["ELEMENT_ID"]))->fetch()) && $arTopic) {
     $FORUM_TOPIC_ID = intval($arTopic["ID"]);
     CIBlockElement::SetPropertyValues($arParams["ELEMENT_ID"], $PRODUCT_IBLOCK_ID, $arTopic["ID"], "FORUM_TOPIC_ID");
     CIBlockElement::SetPropertyValues($arParams["ELEMENT_ID"], $PRODUCT_IBLOCK_ID, $arTopic["POSTS"], "FORUM_MESSAGE_CNT");
 }
 // 1.6 Create New topic and add messages
 $MID = 0;
 $TID = 0;
 if ($FORUM_TOPIC_ID <= 0) {
     // 1.6.a Create New topic
     // 1.6.a.1 Get author info
     $arUserStart = array("ID" => intVal($arResult["ELEMENT"]["~CREATED_BY"]), "NAME" => $GLOBALS["FORUM_STATUS_NAME"]["guest"]);
     if ($arUserStart["ID"] > 0) {
         $res = array();
开发者ID:mrdeadmouse,项目名称:u136006,代码行数:31,代码来源:action.php


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