protected function _actionGet(KCommandContext $context) { $view = $this->getView(); $package = KInflector::pluralize($this->_identifier->name); if($view instanceof KViewTemplate) { //Set the layout identifier $layout = clone $view->getIdentifier(); $layout->package = $package; $layout->name = $view->getLayout(); $layout->filepath = ''; $view->setLayout($layout); //Set the template identifier $template = $view->getTemplate()->getIdentifier(); $template->package = $package; } //Set the toolbar if($this->isCommandable()) { $this->setToolbar('com://admin/'.$package.'.controller.toolbar.'.$view->getName()); } return parent::_actionGet($context); }
/** * Overridden method to be able to use it with both resource and service controllers */ protected function _actionGet(KCommandContext $context) { if ($this->getIdentifier()->name == 'image' || $this->getIdentifier()->name == 'file' && $this->getRequest()->format == 'html') { $this->getService('translator')->getTranslator($this->getIdentifier())->loadLanguageFiles(); $result = $this->getView()->display(); return $result; } return parent::_actionGet($context); }
/** * _actionGet here we will check if the we access a singular or a plural, * when plural the action will return true if singular we will check if the requested tile exists. * * @param KCommandContext $context * @return bool|KDatabaseRow */ protected function _actionGet(KCommandContext $context) { if (KInflector::isSingular($this->_request->view) && !$this->_request->type) { if (!file_exists(JPATH_FILES . '/' . $this->_request->path) || is_dir(JPATH_FILES . '/' . $this->_request->path)) { return false; } } return parent::_actionGet($context); }
public function _actionGet(KCommandContext $context) { $user = JFactory::getUser(); if ($this->_request->layout == 'register' && !$user->guest) { $url = 'index.php?Itemid=' . JSite::getMenu()->getDefault()->id; $msg = JText::_('You are already registered.'); $this->setRedirect($url, $msg); return false; } return parent::_actionGet($context); }
protected function _actionGet(KCommandContext $context) { $view = $this->getView(); //Set the layout if ($view instanceof KViewTemplate) { $layout = clone $view->getIdentifier(); $layout->package = 'categories'; $layout->name = $view->getLayout(); //Force re-creation of the filepath to load the category templates $layout->filepath = ''; $view->setLayout($layout); } //Set the toolbar if ($this->isCommandable()) { $this->setToolbar('com://admin/' . $this->getIdentifier()->package . '.controller.toolbar.' . $view->getName()); } return parent::_actionGet($context); }
protected function _actionGet(KCommandContext $context) { $view = $this->getView(); //Set the layout if ($view instanceof KViewTemplate) { if (KInflector::isPlural($view->getName())) { $view->getIdentifier()->path[1] = 'taxonomies'; } else { $view->getIdentifier()->path[1] = 'taxonomy'; } $layout = clone $view->getIdentifier(); $layout->package = 'taxonomy'; $layout->name = $view->getLayout(); //Force re-creation of the filepath to load the category templates $layout->filepath = ''; $view->setLayout($layout); } return parent::_actionGet($context); }
/** * Overridden method to be able to use it with both resource and service controllers */ protected function _actionGet(KCommandContext $context) { if ($this->getIdentifier()->name == 'image' || $this->getIdentifier()->name == 'file' && $this->getRequest()->format == 'html') { //Load the language file for HMVC requests who are not routed through the dispatcher if (!$this->isDispatched()) { JFactory::getLanguage()->load('com_' . $this->getIdentifier()->package); } $result = $this->getView()->display(); return $result; } return parent::_actionGet($context); }