/** * 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(); }