addToolBar(); $cid = VikRequest::getVar('cid', array(0)); if (!empty($cid[0])) { $id = $cid[0]; } $row = array(); $dbo = JFactory::getDBO(); if (!empty($cid[0])) { $q = "SELECT * FROM `#__vikbooking_categories` WHERE `id`=".(int)$id.";"; $dbo->setQuery($q); $dbo->execute(); if ($dbo->getNumRows() != 1) { VikError::raiseWarning('', 'Not found.'); $mainframe = JFactory::getApplication(); $mainframe->redirect("index.php?option=com_vikbooking&task=categories"); exit; } $row = $dbo->loadAssoc(); } $this->row = $row; // Display the template parent::display($tpl); } /** * Sets the toolbar */ protected function addToolBar() { $cid = VikRequest::getVar('cid', array(0)); if (!empty($cid[0])) { //edit JToolBarHelper::title(JText::translate('VBMAINCATTITLEEDIT'), 'vikbooking'); if (JFactory::getUser()->authorise('core.edit', 'com_vikbooking')) { JToolBarHelper::save( 'updatecat', JText::translate('VBSAVE')); JToolBarHelper::spacer(); } JToolBarHelper::cancel( 'cancelcat', JText::translate('VBANNULLA')); JToolBarHelper::spacer(); } else { //new JToolBarHelper::title(JText::translate('VBMAINCATTITLENEW'), 'vikbooking'); if (JFactory::getUser()->authorise('core.create', 'com_vikbooking')) { JToolBarHelper::save( 'createcat', JText::translate('VBSAVE')); JToolBarHelper::spacer(); } JToolBarHelper::cancel( 'cancelcat', JText::translate('VBANNULLA')); JToolBarHelper::spacer(); } } }