Example #1
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     parent::__construct($config);
     foreach (array('enabled' => true, 'levels' => 3, 'limit' => 0, 'offset' => 0, 'sort' => 'path_sort_ordering') as $key => $val) {
         $this->_request->{$key} = $val;
     }
     //Set model recurse
     //if(KRequest::method() == 'GET') KRequest::set('get.recurse', true);
     //Set other model states
     //KRequest::set('get.enabled', true);
     $this->registerCallback(array('before.read', 'before.browse'), array($this, 'setOrdering'));
     if ($this->isDispatched()) {
         $this->registerCallback('after.read', array($this, 'setCanonical'));
     }
     $cache = JPATH_ROOT . '/cache/com_' . $this->getIdentifier()->package . '/maintenance.txt';
     if (!JFile::exists($cache)) {
         if (KFactory::get('admin::com.ninjaboard.controller.maintenance')->topics() && KFactory::get('admin::com.ninjaboard.controller.maintenance')->forums()) {
             JFile::write($cache, date('r'));
         }
     }
     $user = KFactory::get('lib.joomla.user');
     // User specific maintenance
     if (!$user->guest) {
         $cache = JPATH_ROOT . '/cache/com_' . $this->getIdentifier()->package . '/maintenance.' . $user->id . '.txt';
         if (!JFile::exists($cache)) {
             if (KFactory::get('admin::com.ninjaboard.controller.maintenance')->logtopicreads()) {
                 JFile::write($cache, date('r'));
             }
         }
     }
 }
Example #2
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options.
  */
 public function __construct(KConfig $config)
 {
     //To prevent these states to be set while browsing after a delete/unwatch
     $config->append(array('request' => array('sort' => 'created_on', 'direction' => 'desc')));
     $config->persistent = false;
     parent::__construct($config);
     $this->registerCallback('before.add', array($this, 'setUser'));
     $this->registerCallback('before.edit', array($this, 'setUser'));
     $this->registerCallback('before.delete', array($this, 'beforeDelete'));
     //Set default redirect
     $this->_redirect = KRequest::referrer();
 }
Example #3
0
 /**
  * Constructor
  *
  * @param 	object 	An optional KConfig object with configuration options
  */
 public function __construct(KConfig $config)
 {
     KRequest::set('get.format', 'file');
     parent::__construct($config);
 }
Example #4
0
 /**
  * Apply action, workaround for redirects
  */
 protected function _actionApply($context)
 {
     $result = parent::_actionApply($context);
     $row = parent::_actionRead($context);
     $this->_redirect = 'index.php?option=com_ninjaboard&view=person&id=' . $row->id . '&layout=default';
     return $result;
 }
Example #5
0
 protected function _actionSave(KCommandContext $context)
 {
     $result = parent::_actionSave($context);
     $row = $this->getModel()->getItem();
     if ($row->id) {
         $this->setRedirect('index.php?option=com_ninjaboard&view=topic&id=' . $row->id);
     }
     return $result;
 }
Example #6
0
 protected function _actionCancel(KCommandContext $context)
 {
     $post = $this->getModel()->getItem();
     $isset = array('post' => $post->id, 'topic' => isset($this->_request->topic) && $this->_request->topic, 'forum' => isset($this->_request->forum) && $this->_request->forum);
     if ($isset['post']) {
         $append = $this->_redirect_hash ? '#p' . $post->id : '';
         $this->_redirect = 'index.php?option=com_ninjaboard&view=topic&id=' . $post->ninjaboard_topic_id . '&post=' . $post->id . $append;
     } elseif ($isset['topic']) {
         $this->_redirect = 'index.php?option=com_ninjaboard&view=topic&id=' . $this->_request->topic;
     } elseif ($isset['forum']) {
         $this->_redirect = 'index.php?option=com_ninjaboard&view=forum&id=' . $this->_request->forum;
     } else {
         parent::_actionCancel($context);
     }
     return $post;
 }
Example #7
0
 protected function _actionSave(KCommandContext $context)
 {
     $result = parent::_actionSave($context);
     $this->_redirect = 'index.php?option=com_ninjaboard&view=messages';
     return $result;
 }