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


PHP ActivityModel::GetComment方法代码示例

本文整理汇总了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();
 }
开发者ID:statico,项目名称:openshift-origin-vanillaforums,代码行数:47,代码来源:class.activitycontroller.php


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