本文整理匯總了PHP中DiscussionModel::FetchPageInfo方法的典型用法代碼示例。如果您正苦於以下問題:PHP DiscussionModel::FetchPageInfo方法的具體用法?PHP DiscussionModel::FetchPageInfo怎麽用?PHP DiscussionModel::FetchPageInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DiscussionModel
的用法示例。
在下文中一共展示了DiscussionModel::FetchPageInfo方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: RefetchPageInfo
/**
* Re-fetch a discussion's content based on its foreign url.
* @param type $DiscussionID
*/
public function RefetchPageInfo($DiscussionID)
{
// Make sure we are posting back.
if (!$this->Request->IsPostBack()) {
throw PermissionException('Javascript');
}
// Grab the discussion.
$Discussion = $this->DiscussionModel->GetID($DiscussionID);
if (!$Discussion) {
throw NotFoundException('Discussion');
}
// Make sure the user has permission to edit this discussion.
$this->Permission('Vanilla.Discussions.Edit', TRUE, 'Category', $Discussion->PermissionCategoryID);
$ForeignUrl = GetValueR('Attributes.ForeignUrl', $Discussion);
if (!$ForeignUrl) {
throw new Gdn_UserException(T("This discussion isn't associated with a url."));
}
$Stub = $this->DiscussionModel->FetchPageInfo($ForeignUrl, TRUE);
// Save the stub.
$this->DiscussionModel->SetField($DiscussionID, (array) $Stub);
// Send some of the stuff back.
if (isset($Stub['Name'])) {
$this->JsonTarget('.PageTitle h1', Gdn_Format::Text($Stub['Name']));
}
if (isset($Stub['Body'])) {
$this->JsonTarget("#Discussion_{$DiscussionID} .Message", Gdn_Format::To($Stub['Body'], $Stub['Format']));
}
$this->InformMessage('The page was successfully fetched.');
$this->Render('Blank', 'Utility', 'Dashboard');
}