当前位置: 首页>>代码示例>>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 = array_column($Activities, 'ActivityID');
     $ActivityModel->setNotified($ActivityIDs);
     $Sender->EventArguments['Activities'] =& $Activities;
     $Sender->fireEvent('InformNotifications');
     foreach ($Activities as $Activity) {
         if ($Activity['Photo']) {
             $UserPhoto = anchor(img($Activity['Photo'], array('class' => 'ProfilePhotoMedium')), $Activity['Url'], 'Icon');
         } else {
             $UserPhoto = '';
         }
         $Excerpt = Gdn_Format::plainText($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:austins,项目名称:vanilla,代码行数:38,代码来源: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), '', '', $Limit, 0);
     $this->ActivityData = $Data;
 }
开发者ID:R-J,项目名称:vanilla,代码行数:9,代码来源:class.recentactivitymodule.php

示例3: index

 /**
  * Default activity stream.
  *
  * @since 2.0.0
  * @access public
  *
  * @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;
         case '':
         case 'feed':
             // rss feed
             $Filter = 'public';
             $this->title(t('Recent Activity'));
             $this->permission('Garden.Activity.View');
             $NotifyUserID = ActivityModel::NOTIFY_PUBLIC;
             break;
         default:
             throw notFoundException();
     }
     // Which page to load
     list($Offset, $Limit) = offsetLimit($Page, c('Garden.Activities.PerPage', 30));
     $Offset = is_numeric($Offset) ? $Offset : 0;
     if ($Offset < 0) {
         $Offset = 0;
     }
     // Page meta.
     $this->addJsFile('activity.js');
     $this->addJsFile('spoilers.js');
     $this->addCssFile('spoilers.css');
     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), '', '', $Limit, $Offset)->resultArray();
     $this->ActivityModel->joinComments($Activities);
     $this->setData('Filter', strtolower($Filter));
     $this->setData('Activities', $Activities);
     $this->addModule('ActivityFilterModule');
     $this->View = 'all';
     $this->render();
 }
开发者ID:R-J,项目名称:vanilla,代码行数:56,代码来源:class.activitycontroller.php


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