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


PHP ActivityModel::joinUsers方法代码示例

本文整理汇总了PHP中ActivityModel::joinUsers方法的典型用法代码示例。如果您正苦于以下问题:PHP ActivityModel::joinUsers方法的具体用法?PHP ActivityModel::joinUsers怎么用?PHP ActivityModel::joinUsers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ActivityModel的用法示例。


在下文中一共展示了ActivityModel::joinUsers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: post

 /**
  *
  * 
  * @param bool $Notify
  * @param bool $UserID
  */
 public function post($Notify = false, $UserID = false)
 {
     if (is_numeric($Notify)) {
         $UserID = $Notify;
         $Notify = false;
     }
     if (!$UserID) {
         $UserID = Gdn::session()->UserID;
     }
     switch ($Notify) {
         case 'mods':
             $this->permission('Garden.Moderation.Manage');
             $NotifyUserID = ActivityModel::NOTIFY_MODS;
             break;
         case 'admins':
             $this->permission('Garden.Settings.Manage');
             $NotifyUserID = ActivityModel::NOTIFY_ADMINS;
             break;
         default:
             $this->permission('Garden.Profiles.Edit');
             $NotifyUserID = ActivityModel::NOTIFY_PUBLIC;
             break;
     }
     $Activities = array();
     if ($this->Form->authenticatedPostBack()) {
         $Data = $this->Form->formValues();
         $Data = $this->ActivityModel->filterForm($Data);
         if (!isset($Data['Format']) || strcasecmp($Data['Format'], 'Raw') == 0) {
             $Data['Format'] = c('Garden.InputFormatter');
         }
         if ($UserID != Gdn::session()->UserID) {
             // This is a wall post.
             $Activity = array('ActivityType' => 'WallPost', 'ActivityUserID' => $UserID, 'RegardingUserID' => Gdn::session()->UserID, 'HeadlineFormat' => t('HeadlineFormat.WallPost', '{RegardingUserID,you} → {ActivityUserID,you}'), 'Story' => $Data['Comment'], 'Format' => $Data['Format'], 'Data' => array('Bump' => true));
         } else {
             // This is a status update.
             $Activity = array('ActivityType' => 'Status', 'HeadlineFormat' => t('HeadlineFormat.Status', '{ActivityUserID,user}'), 'Story' => $Data['Comment'], 'Format' => $Data['Format'], 'NotifyUserID' => $NotifyUserID, 'Data' => array('Bump' => true));
             $this->setJson('StatusMessage', Gdn_Format::plainText($Activity['Story'], $Activity['Format']));
         }
         $Activity = $this->ActivityModel->save($Activity, false, array('CheckSpam' => true));
         if ($Activity == SPAM || $Activity == UNAPPROVED) {
             $this->StatusMessage = t('ActivityRequiresApproval', 'Your post will appear after it is approved.');
             $this->render('Blank', 'Utility');
             return;
         }
         if ($Activity) {
             if ($UserID == Gdn::session()->UserID && $NotifyUserID == ActivityModel::NOTIFY_PUBLIC) {
                 Gdn::userModel()->setField(Gdn::session()->UserID, 'About', Gdn_Format::plainText($Activity['Story'], $Activity['Format']));
             }
             $Activities = array($Activity);
             ActivityModel::joinUsers($Activities);
             $this->ActivityModel->calculateData($Activities);
         } else {
             $this->Form->setValidationResults($this->ActivityModel->validationResults());
             $this->StatusMessage = $this->ActivityModel->Validation->resultsText();
             //            $this->render('Blank', 'Utility');
         }
     }
     if ($this->deliveryType() == DELIVERY_TYPE_ALL) {
         $Target = $this->Request->get('Target', '/activity');
         if (isSafeUrl($Target)) {
             redirect($Target);
         } else {
             redirect(url('/activity'));
         }
     }
     $this->setData('Activities', $Activities);
     $this->render('Activities');
 }
开发者ID:sitexa,项目名称:vanilla,代码行数:74,代码来源:class.activitycontroller.php


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