public function _actionBrowse($context) { $owner = $context->data->owner; $threads = parent::_actionBrowse($context); $threads->where('created_by', '=', $owner->id); return $threads; }
public function _actionBrowse($context) { // $session = Kservice::get('com://site/people.controller.session'); // $viewer = get_viewer(); // $session = JFactory::getSession(); $this->categories = KService::get('repos://site/forums.category')->getQuery()->order('ordering')->fetchSet(); parent::_actionBrowse($context); }
/** * Service Browse. * * @param KCommandContext $context */ protected function _actionBrowse($context) { $entities = parent::_actionBrowse($context); if (isset($this->actor->id)) { $entities->actorId($this->actor->id); } return $entities; }
/** * Browse Action. * * @param KCommandContext $context Context Parameter * * @return AnDomainQuery */ protected function _actionBrowse($context) { $entities = parent::_actionBrowse($context); if ($this->getRepository()->hasBehavior('ownable') && $this->filter == 'leaders') { $leaderIds = array($this->viewer->id); $leaderIds = array_merge($leaderIds, $this->viewer->getLeaderIds()->toArray()); $entities->where('owner.id', 'IN', $leaderIds); } elseif ($this->getRepository()->hasBehavior('ownable') && $this->actor && $this->actor->id > 0) { $entities->where('owner', '=', $this->actor); } return $entities; }
/** * Browse Service. * * @param KCommandContext $context */ protected function _actionBrowse(KCommandContext $context) { $entities = parent::_actionBrowse($context); if (in_array($this->sort, array('top', 'trending')) && $this->q == '') { $package = $this->getIdentifier()->package; $name = $this->getIdentifier()->name; $entities->select('COUNT(*) AS count')->join('RIGHT', 'edges AS edge', $name . '.id = edge.node_a_id')->where('edge.type', 'LIKE', '%com:' . $package . '.domain.entity.tag')->group($name . '.id')->order('count', 'DESC'); if ($this->sort == 'trending') { $now = new KDate(); $entities->where('edge.created_on', '>', $now->addDays(-(int) $this->days)->getDate()); } } return $entities; }
/** * Return a set of notification objects * * @param KCommandContext $context Context parameter * * @return AnDomainEntitysetDefault */ protected function _actionBrowse($context) { $this->actor->resetNotifications(); if ($this->actor->eql(get_viewer())) { $title = JText::_('COM-NOTIFICATIONS-ACTORBAR-YOUR-NOTIFICATIONS'); } else { $title = sprintf(JText::_('COM-NOTIFICATIONS-ACTORBAR-ACTOR-NOTIFICATIONS'), $this->actor->name); } $this->getToolbar('actorbar')->setTitle($title); $context->query = $this->actor->getNotifications()->getQuery(); $set = parent::_actionBrowse($context)->order('creationTime', 'DESC'); if ($this->new) { $set->id($this->actor->newNotificationIds->toArray()); } //only zero the notifications if the viewer is the same as the //actor. prevents from admin zeroing others notifications if ($set->count() > 0 && get_viewer()->eql($this->actor)) { //set the number of notification, since it's going to be //reset by the time it gets to the mod_viewer KService::setConfig('com://site/viewer.html', array('data' => array('num_notifications' => $this->actor->numOfNewNotifications()))); $this->registerCallback('after.get', array($this->actor, 'viewedNotifications'), $set->toArray()); } return $set; }
/** * Only bring assignable components * * (non-PHPdoc) * @see ComBaseControllerService::_actionBrowse() */ protected function _actionBrowse($context) { $components = parent::_actionBrowse($context); $components->assignable(true); return $components; }