Example #1
0
 public function _actionRead($context)
 {
     $toolbar = $this->getToolbar('category');
     $toolbar->addToolbarCommands();
     $this->getView()->set('toolbar', $toolbar);
     parent::_actionRead($context);
 }
Example #2
0
 public function _actionAdd($context)
 {
     $context->data->access = $context->data->parent->access;
     $context->data->author = get_viewer();
     $this->parent->resetRead();
     $post = parent::_actionAdd($context);
 }
Example #3
0
 /**
  * Constructor.
  *
  * @param   object  An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     $this->registerCallback(array('before.edit', 'after.add'), array($this, 'setMeta'));
     $this->registerCallback(array('before.editsubscription', 'before.addsubscriber', 'before.deletesubscriber'), array($this, 'fetchSubscriber'));
     $this->registerCallback(array('before.editsubscription', 'before.addsubscriber'), array($this, 'setEndDate'));
 }
Example #4
0
 /**
  * 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;
 }
Example #5
0
 protected function _actionPost(KCommandContext $context)
 {
     $data = $context->data;
     $date = new KDate();
     $date->day((int) $data->expiresOnDay);
     $date->month((int) $data->expiresOnMonth);
     $date->year((int) $data->expiresOnYear);
     $data->expiresOn = $date;
     return parent::_actionPost($context);
 }
Example #6
0
 /**
  * Sets the default view to the comment views.
  *
  * @param stirng $view
  *
  * @return ComBaseControllerComment
  */
 public function setView($view)
 {
     parent::setView($view);
     if (!$this->_view instanceof LibBaseViewAbstract) {
         $view = KInflector::isPlural($view) ? 'comments' : 'comment';
         $defaults[] = 'ComBaseView' . ucfirst($view) . ucfirst($this->_view->name);
         register_default(array('identifier' => $this->_view, 'default' => $defaults));
     }
     return $this;
 }
Example #7
0
 /**
  * Read Service
  * 
  * @param KCommandContext $context
  */
 protected function _actionRead(KCommandContext $context)
 {
     $entity = parent::_actionRead($context);
     if ($this->scope) {
         $entity->tagables->scope($this->scope);
     }
     if ($this->sort == 'top') {
         $entity->tagables->sortTop();
     } else {
         $entity->tagables->sortRecent();
     }
     $entity->tagables->limit($this->limit, $this->start);
     //print str_replace('#_', 'jos', $entity->tagables->getQuery());
     return $entity;
 }
Example #8
0
 public function _actionRead($context)
 {
     $repos = $this->getService('repos://site/forums.thread');
     if ($thread = $this->getItem()) {
         $limit = $this->getRequest()->get('limit');
         $start = $this->getRequest()->get('start');
         $thread->posts->getQuery()->order('created_on')->limit($limit, $start);
         $thread->hit();
         $this->registerCallback('after.get', array($thread, 'markRead'));
         $this->registerCallback('after.get', array($thread->posts, 'markRead'));
     }
     $toolbar = $this->getToolbar('thread');
     $toolbar->addToolbarCommands();
     $this->getView()->set('toolbar', $toolbar);
     parent::_actionRead($context);
 }
Example #9
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.
  */
 protected function _initialize(KConfig $config)
 {
     $config->append(array('behaviors' => array('serviceable' => array('except' => array('edit')), 'ownable' => array('default' => get_viewer()))));
     parent::_initialize($config);
 }
Example #10
0
 /**
  * Read a package
  * 
  * @param KCommandContext $context
  * @return void
  */
 protected function _actionRead(KCommandContext $context)
 {
     $this->plugins = JPluginHelper::getPlugin('subscriptions');
     return parent::_actionRead($context);
 }
Example #11
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.
  */
 protected function _initialize(KConfig $config)
 {
     $config->append(array('toolbars' => null));
     parent::_initialize($config);
 }
Example #12
0
 /**
  * Only bring assignable components
  * 
  * (non-PHPdoc)
  * @see ComBaseControllerService::_actionBrowse()
  */
 protected function _actionBrowse($context)
 {
     $components = parent::_actionBrowse($context);
     $components->assignable(true);
     return $components;
 }
Example #13
0
 /**
  * Constructor.
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     $this->registerCallback(array('after.edit', 'after.add'), array($this, 'setTaxInfo'));
 }
Example #14
0
 /**
  * Checks if this controller can be executed by the viewer
  * 
  * @param string $action The action being executed
  * 
  * @return boolean
  */
 public function canExecute($action)
 {
     if (!$this->actor) {
         return false;
     }
     if (!$this->actor->isNotifiable()) {
         return false;
     }
     if ($this->actor->authorize('access') === false) {
         return false;
     }
     if ($this->actor->authorize('administration') === false) {
         return false;
     }
     return parent::canExecute($action);
 }
Example #15
0
 /**
  * Get a toolbar by identifier.
  *
  * @return KControllerToolbarAbstract
  */
 public function getToolbar($toolbar, $config = array())
 {
     if (is_string($toolbar)) {
         //if actorbar or menu alawys default to the base
         if (in_array($toolbar, array('actorbar'))) {
             $identifier = clone $this->getIdentifier();
             $identifier->path = array('controller', 'toolbar');
             $identifier->name = $toolbar;
             register_default(array('identifier' => $identifier, 'default' => 'ComActorsControllerToolbar' . ucfirst($toolbar)));
             $toolbar = $identifier;
         }
     }
     return parent::getToolbar($toolbar, $config);
 }
Example #16
0
 public function _actionEdit($context)
 {
     parent::_actionEdit($context);
 }
Example #17
0
 /**
  * Initializes the default configuration for the object
  *
  * Called from {@link __construct()} as a first step of object instantiation.
  *
  * @param KConfig $config An optional KConfig object with configuration options.
  *
  * @return void
  */
 protected function _initialize(KConfig $config)
 {
     $config->append(array('serviceable' => array('except' => array('browse', 'read', 'edit')), 'behaviors' => array('com://site/mailer.controller.behavior.mailer'), 'gateway' => 'com://site/subscriptions.domain.payment.gateway.paypal'));
     parent::_initialize($config);
 }