本文整理汇总了PHP中ActivityModel::GetComment方法的典型用法代码示例。如果您正苦于以下问题:PHP ActivityModel::GetComment方法的具体用法?PHP ActivityModel::GetComment怎么用?PHP ActivityModel::GetComment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ActivityModel
的用法示例。
在下文中一共展示了ActivityModel::GetComment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Comment
/**
* Comment on an activity item.
*
* @since 2.0.0
* @access public
*/
public function Comment()
{
$this->Permission('Garden.Profiles.Edit');
$Session = Gdn::Session();
$this->Form->SetModel($this->ActivityModel);
$NewActivityID = 0;
// Form submitted
if ($this->Form->IsPostBack()) {
$Body = $this->Form->GetValue('Body', '');
$ActivityID = $this->Form->GetValue('ActivityID', '');
if (is_numeric($ActivityID) && $ActivityID > 0) {
$ActivityComment = array('ActivityID' => $ActivityID, 'Body' => $Body, 'Format' => 'Text');
$ID = $this->ActivityModel->Comment($ActivityComment);
if ($ID == SPAM || $ID == UNAPPROVED) {
$this->StatusMessage = T('ActivityCommentRequiresApproval', 'Your comment will appear after it is approved.');
$this->Render('Blank', 'Utility');
return;
}
$this->Form->SetValidationResults($this->ActivityModel->ValidationResults());
if ($this->Form->ErrorCount() > 0) {
throw new Exception($this->ActivityModel->Validation->ResultsText());
$this->ErrorMessage($this->Form->Errors());
}
}
}
// Redirect back to the sending location if this isn't an ajax request
if ($this->_DeliveryType === DELIVERY_TYPE_ALL) {
$Target = $this->Form->GetValue('Return');
if (!$Target) {
$Target = '/activity';
}
Redirect($Target);
} else {
// Load the newly added comment.
$this->SetData('Comment', $this->ActivityModel->GetComment($ID));
// Set it in the appropriate view.
$this->View = 'comment';
}
// And render
$this->Render();
}