当前位置: 首页>>代码示例>>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->authenticatedPostBack()) {
         $Body = $this->Form->getValue('Body', '');
         $ActivityID = $this->Form->getValue('ActivityID', '');
         if (is_numeric($ActivityID) && $ActivityID > 0) {
             $activity = $this->ActivityModel->getID($ActivityID);
             if ($activity) {
                 if ($activity['NotifyUserID'] == ActivityModel::NOTIFY_ADMINS) {
                     $this->permission('Garden.Settings.Manage');
                 } elseif ($activity['NotifyUserID'] == ActivityModel::NOTIFY_MODS) {
                     $this->permission('Garden.Moderation.Manage');
                 }
             } else {
                 throw new Exception(t('Invalid activity'));
             }
             $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:sitexa,项目名称:vanilla,代码行数:57,代码来源:class.activitycontroller.php


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