function display() { require_once JPATH_COMPONENT . '/helpers/rokcandyhelper.php'; // Load the submenu. RokCandyHelper::addSubmenu(JRequest::getCmd('view', 'macros')); switch ($this->getTask()) { case 'add': JRequest::setVar('hidemainmenu', 1); JRequest::setVar('layout', 'form'); JRequest::setVar('view', 'candymacro'); JRequest::setVar('edit', false); // Checkout the RokCandy Macro $model = $this->getModel('candymacro'); $model->checkout(); break; case 'edit': JRequest::setVar('hidemainmenu', 1); JRequest::setVar('layout', 'form'); JRequest::setVar('view', 'candymacro'); JRequest::setVar('edit', true); // Checkout the RokCandy Macro $model = $this->getModel('candymacro'); $model->checkout(); break; case 'list': JRequest::setVar('layout', 'list'); JRequest::setVar('view', 'rokcandy'); } parent::display(); }
public function display($cachable = false, $urlparams = false) { require_once JPATH_COMPONENT . '/helpers/rokcandy.php'; $jinput = JFactory::getApplication()->input; // Load the submenu. RokCandyHelper::addSubmenu($jinput->get('view', 'candymacros')); $view = $jinput->get('view', 'candymacros'); $layout = $jinput->get('layout', 'default'); $id = $jinput->get('id', '', 'int'); // Check for edit form. if ($view == 'candymacro' && $layout == 'edit' && !$this->checkEditId('com_rokcandy.edit.candymacro', $id)) { // Somehow the person just went to the form - we don't allow that. $this->setError(JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); $this->setMessage($this->getError(), 'error'); $this->setRedirect(JRoute::_('index.php?option=com_rokcandy&view=candymacros', false)); return false; } parent::display(); return $this; }