예제 #1
0
파일: topic.php 프로젝트: stonyyi/anahita
 /**
  * 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;
 }
예제 #2
0
파일: page.php 프로젝트: stonyyi/anahita
 /**
  * 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);
     }
 }
예제 #3
0
파일: note.php 프로젝트: stonyyi/anahita
 /**
  * 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);
     }
 }
예제 #4
0
파일: set.php 프로젝트: stonyyi/anahita
 /**
  * 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;
 }
예제 #5
0
 /**
  * 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);
 }
예제 #6
0
 /**
  * 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;
 }
예제 #7
0
 /**
  * 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);
 }