/** * When a topic is added, then create a notification. * * @param KCommandContext $context Context parameter */ protected function _actionAdd($context) { $entity = parent::_actionAdd($context); if ($entity->owner->isSubscribable()) { $notification = $this->createNotification(array('name' => 'topic_add', 'object' => $entity, 'subscribers' => $entity->owner->subscriberIds->toArray()))->setType('post', array('new_post' => true)); } return $entity; }
/** * Page post action. * * @param KCommandContext $context Context parameter */ public function redirect(KCommandContext $context) { if ($context->action == 'edit' || $context->action == 'add') { $context->response->setRedirect(JRoute::_($this->getItem()->getURL() . '&layout=edit')); } else { return parent::redirect($context); } }
/** * Page post action. * * @param KCommandContext $context Context parameter */ public function redirect(KCommandContext $context) { if ($context->action == 'delete') { $context->response->setRedirect(JRoute::_($this->getItem()->owner->getURL())); } else { return parent::redirect($context); } }
/** * Browse Albums. */ protected function _actionBrowse($context) { $sets = parent::_actionBrowse($context); $sets->order('updateTime', 'DESC'); if ($this->photo_id && $this->getRequest()->get('layout') != 'selector') { $sets->where('photos.id', '=', $this->photo_id); } return $sets; }
/** * Browse Todos * * @param KCommandContext $context * @return void */ protected function _actionBrowse($context) { if (!$context->query) { $context->query = $this->getRepository()->getQuery(); } $query = $context->query; $query->order('open', 'DESC'); if ($this->sort == 'priority') { $query->order('priority', 'DESC'); } return parent::_actionBrowse($context); }
/** * Browse Photos * * @param KCommandContext $context * @return void */ protected function _actionBrowse($context) { $this->getService('repos://site/photos.set'); $photos = parent::_actionBrowse($context); $photos->order('creationTime', 'DESC'); if ($this->exclude_set != '') { $set = $this->actor->sets->fetch(array('id' => $this->exclude_set)); if (!empty($set)) { $photo_ids = array(); foreach ($set->photos as $photo) { $photo_ids[] = $photo->id; } if (count($photo_ids)) { $photos->where('photo.id', '<>', $photo_ids); } } } return $photos; }
/** * Initializes the options for the object * * Called from {@link __construct()} as a first step of object instantiation. * * @param object An optional KConfig object with configuration options. * @return void */ protected function _initialize(KConfig $config) { $config->append(array('behaviors' => array('parentable'))); parent::_initialize($config); }