本文整理匯總了PHP中CForumTopic::delete方法的典型用法代碼示例。如果您正苦於以下問題:PHP CForumTopic::delete方法的具體用法?PHP CForumTopic::delete怎麽用?PHP CForumTopic::delete使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CForumTopic
的用法示例。
在下文中一共展示了CForumTopic::delete方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: createTopic
protected function createTopic()
{
$topic = array('TITLE' => $this->entity->getXmlId(), 'TAGS' => '', 'MESSAGE' => $this->entity->getXmlId(), 'AUTHOR_ID' => 0);
/** @var $request \Bitrix\Main\HttpRequest */
$request = \Bitrix\Main\Context::getCurrent()->getRequest();
$post = array_merge($request->getQueryList()->toArray(), $request->getPostList()->toArray());
$event = new Event("forum", "OnCommentTopicAdd", array($this->entity->getType(), $this->entity->getId(), $post, &$topic));
$event->send();
if (strlen($topic["AUTHOR_NAME"]) <= 0) {
$topic["AUTHOR_NAME"] = $topic["AUTHOR_ID"] <= 0 ? Loc::getMessage("FORUM_USER_SYSTEM") : self::getUserName($topic["AUTHOR_ID"]);
}
$topic = array_merge($topic, array("FORUM_ID" => $this->forum["ID"], 'TITLE' => $topic["TITLE"], 'TAGS' => $topic["TAGS"], 'MESSAGE' => $topic["MESSAGE"], "USER_START_ID" => $topic["AUTHOR_ID"], "USER_START_NAME" => $topic["AUTHOR_NAME"], "LAST_POSTER_NAME" => $topic["AUTHOR_NAME"], "XML_ID" => $this->entity->getXmlId(), "APPROVED" => "Y"));
if (($tid = \CForumTopic::add($topic)) > 0) {
if ($this->forum["ALLOW_HTML"] != "Y") {
$topic['MESSAGE'] = strip_tags($topic['MESSAGE']);
}
$fields = array("POST_MESSAGE" => $topic['MESSAGE'], "AUTHOR_ID" => $topic["AUTHOR_ID"], "AUTHOR_NAME" => $topic["AUTHOR_NAME"], "FORUM_ID" => $topic["FORUM_ID"], "TOPIC_ID" => $tid, "APPROVED" => $topic["APPROVED"], "NEW_TOPIC" => "Y", "PARAM1" => $this->entity->getType(), "PARAM2" => $this->entity->getId());
if (\CForumMessage::add($fields, false, array("SKIP_INDEXING" => "Y", "SKIP_STATISTIC" => "N")) > 0) {
$event = new Event("forum", "OnAfterCommentTopicAdd", array($this->entity->getType(), $this->entity->getId(), $tid));
$event->send();
self::$topics[$this->entity->getXmlId()] = $topic + array("ID" => $tid);
return self::$topics[$this->entity->getXmlId()];
}
\CForumTopic::delete($tid);
}
$this->errorCollection->add(array(new Error(Loc::getMessage("FORUM_CM_TOPIC_IS_NOT_CREATED"), self::ERROR_PARAMS_TOPIC_ID)));
return null;
}