/** * 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')); } } } }
/** * 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(); }
/** * Constructor * * @param object An optional KConfig object with configuration options */ public function __construct(KConfig $config) { KRequest::set('get.format', 'file'); parent::__construct($config); }
/** * 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; }
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; }
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; }
protected function _actionSave(KCommandContext $context) { $result = parent::_actionSave($context); $this->_redirect = 'index.php?option=com_ninjaboard&view=messages'; return $result; }