本文整理汇总了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'));
}
}
示例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;
}
示例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();
}