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


PHP ActivityModel::GetWhere方法代码示例

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


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

示例1: InformNotifications

 /**
  * Grabs all new notifications and adds them to the sender's inform queue.
  *
  * This method gets called by dashboard's hooks file to display new
  * notifications on every pageload. 
  *
  * @since 2.0.18
  * @access public
  *
  * @param Gdn_Controller $Sender The object calling this method.
  */
 public static function InformNotifications($Sender)
 {
     $Session = Gdn::Session();
     if (!$Session->IsValid()) {
         return;
     }
     $ActivityModel = new ActivityModel();
     // Get five pending notifications.
     $Where = array('NotifyUserID' => Gdn::Session()->UserID, 'Notified' => ActivityModel::SENT_PENDING);
     // If we're in the middle of a visit only get very recent notifications.
     $Where['DateUpdated >'] = Gdn_Format::ToDateTime(strtotime('-5 minutes'));
     $Activities = $ActivityModel->GetWhere($Where, 0, 5)->ResultArray();
     $ActivityIDs = ConsolidateArrayValuesByKey($Activities, 'ActivityID');
     $ActivityModel->SetNotified($ActivityIDs);
     foreach ($Activities as $Activity) {
         if ($Activity['Photo']) {
             $UserPhoto = Anchor(Img($Activity['Photo'], array('class' => 'ProfilePhotoMedium')), $Activity['Url'], 'Icon');
         } else {
             $UserPhoto = '';
         }
         $Excerpt = Gdn_Format::Display($Activity['Story']);
         $ActivityClass = ' Activity-' . $Activity['ActivityType'];
         $Sender->InformMessage($UserPhoto . Wrap($Activity['Headline'], 'div', array('class' => 'Title')) . Wrap($Excerpt, 'div', array('class' => 'Excerpt')), 'Dismissable AutoDismiss' . $ActivityClass . ($UserPhoto == '' ? '' : ' HasIcon'));
     }
 }
开发者ID:elpum,项目名称:TgaForumBundle,代码行数:36,代码来源:class.notificationscontroller.php

示例2: GetData

 public function GetData($Limit = FALSE)
 {
     if (!$Limit) {
         $Limit = $this->Limit;
     }
     $ActivityModel = new ActivityModel();
     $Data = $ActivityModel->GetWhere(array('NotifyUserID' => ActivityModel::NOTIFY_PUBLIC), 0, $Limit);
     $this->ActivityData = $Data;
 }
开发者ID:edward-tsai,项目名称:vanilla4china,代码行数:9,代码来源:class.recentactivitymodule.php

示例3: Index

 /**
  * Default activity stream.
  * 
  * @since 2.0.0
  * @access public
  * @todo Validate comment length rather than truncating.
  * 
  * @param int $Offset Number of activity items to skip.
  */
 public function Index($Filter = FALSE, $Page = FALSE)
 {
     switch (strtolower($Filter)) {
         case 'mods':
             $this->Title(T('Recent Moderator Activity'));
             $this->Permission('Garden.Moderation.Manage');
             $NotifyUserID = ActivityModel::NOTIFY_MODS;
             break;
         case 'admins':
             $this->Title(T('Recent Admin Activity'));
             $this->Permission('Garden.Settings.Manage');
             $NotifyUserID = ActivityModel::NOTIFY_ADMINS;
             break;
         default:
             $Filter = 'public';
             $this->Title(T('Recent Activity'));
             $this->Permission('Garden.Activity.View');
             $NotifyUserID = ActivityModel::NOTIFY_PUBLIC;
             break;
     }
     // Which page to load
     list($Offset, $Limit) = OffsetLimit($Page, 30);
     $Offset = is_numeric($Offset) ? $Offset : 0;
     if ($Offset < 0) {
         $Offset = 0;
     }
     // Page meta.
     $this->AddJsFile('activity.js');
     if ($this->Head) {
         $this->Head->AddRss(Url('/activity/feed.rss', TRUE), $this->Head->Title());
     }
     // Comment submission
     $Session = Gdn::Session();
     $Comment = $this->Form->GetFormValue('Comment');
     $Activities = $this->ActivityModel->GetWhere(array('NotifyUserID' => $NotifyUserID), $Offset, $Limit)->ResultArray();
     $this->ActivityModel->JoinComments($Activities);
     $this->SetData('Filter', strtolower($Filter));
     $this->SetData('Activities', $Activities);
     $this->AddModule('ActivityFilterModule');
     $this->View = 'all';
     $this->Render();
 }
开发者ID:3marproof,项目名称:vanilla,代码行数:51,代码来源:class.activitycontroller.php


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