本文整理汇总了PHP中CForumNew::getByIDEx方法的典型用法代码示例。如果您正苦于以下问题:PHP CForumNew::getByIDEx方法的具体用法?PHP CForumNew::getByIDEx怎么用?PHP CForumNew::getByIDEx使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForumNew
的用法示例。
在下文中一共展示了CForumNew::getByIDEx方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setForum
protected function setForum($id)
{
if (!$this->checkForumId($id)) {
throw new ArgumentTypeException(Loc::getMessage("FORUM_CM_FORUM_IS_WRONG"), self::ERROR_PARAMS_FORUM_ID);
}
$this->forum = \CForumNew::getByIDEx($id, SITE_ID);
if (!$this->forum) {
throw new ArgumentException(Loc::getMessage("FORUM_CM_FORUM_IS_LOST"), self::ERROR_PARAMS_FORUM_ID);
}
return $this;
}
示例2: getDataToCheck
private static function getDataToCheck($messageId)
{
$return = false;
if ($messageId > 0 && Loader::includeModule("forum")) {
if (!array_key_exists($messageId, self::$messages)) {
$cacheTtl = 2592000;
$cacheId = 'forum_message_' . $messageId;
$cachePath = \CComponentEngine::makeComponentPath("forum.topic.read");
$cache = new \CPHPCache();
$messages = $topics = array();
if ($cache->initCache($cacheTtl, $cacheId, $cachePath)) {
list($messages, $topics) = $cache->getVars();
} else {
$dbRes = \CForumMessage::getListEx(array("ID" => "ASC"), array("TOPIC" => "Y", "TOPIC_MESSAGE_ID" => $messageId, ">=ID" => $messageId), false, 10);
while ($res = $dbRes->fetch()) {
$messages["M" . $res["ID"]] = array_intersect_key($res, array("ID" => "", "TOPIC_ID" => "", "FORUM_ID" => "", "USER_ID" => "", "NEW_TOPIC" => "", "PARAM1" => "", "PARAM2" => ""));
if (!array_key_exists("T" . $res["TOPIC_ID"], $topics)) {
$topics["T" . $res["TOPIC_ID"]] = array("TITLE" => $res["TITLE"], "USER_ID" => $res["USER_START_ID"], "XML_ID" => $res["TOPIC_XML_ID"], "SOCNET_GROUP_ID" => $res["TOPIC_SOCNET_GROUP_ID"], "OWNER_ID" => $res["TOPIC_OWNER_ID"]);
}
}
if (!empty($messages)) {
$cache->startDataCache();
$res = reset($topics);
/** @noinspection PhpDynamicAsStaticMethodCallInspection */
\CForumCacheManager::setTag($cachePath, "forum_topic_" . $res['ID']);
$cache->endDataCache(array($messages, $topics));
}
}
self::$messages += $messages;
self::$topics += $topics;
}
if (array_key_exists("M" . $messageId, self::$messages)) {
$return = array(self::$messages["M" . $messageId], self::$topics["T" . self::$messages["M" . $messageId]["TOPIC_ID"]], \CForumNew::getByIDEx(self::$messages["M" . $messageId]["FORUM_ID"], SITE_ID));
}
}
return $return;
}