| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package VikBooking |
| 4 |
* @subpackage com_vikbooking |
| 5 |
* @author Alessio Gaggii - e4j - Extensionsforjoomla.com |
| 6 |
* @copyright Copyright (C) 2018 e4j - Extensionsforjoomla.com. All rights reserved. |
| 7 |
* @license GNU General Public License version 2 or later; see LICENSE |
| 8 |
* @link https://vikwp.com |
| 9 |
*/ |
| 10 |
|
| 11 |
defined('ABSPATH') or die('No script kiddies please!'); |
| 12 |
|
| 13 |
// import Joomla view library |
| 14 |
jimport('joomla.application.component.view'); |
| 15 |
|
| 16 |
class VikBookingViewManageiva extends JViewVikBooking { |
| 17 |
|
| 18 |
function display($tpl = null) { |
| 19 |
// Set the toolbar |
| 20 |
$this->addToolBar(); |
| 21 |
|
| 22 |
$cid = VikRequest::getVar('cid', array(0)); |
| 23 |
if (!empty($cid[0])) { |
| 24 |
$id = $cid[0]; |
| 25 |
} |
| 26 |
|
| 27 |
$row = array(); |
| 28 |
$dbo = JFactory::getDBO(); |
| 29 |
if (!empty($cid[0])) { |
| 30 |
$q = "SELECT * FROM `#__vikbooking_iva` WHERE `id`=".(int)$id.";"; |
| 31 |
$dbo->setQuery($q); |
| 32 |
$dbo->execute(); |
| 33 |
if ($dbo->getNumRows() != 1) { |
| 34 |
VikError::raiseWarning('', 'Not found.'); |
| 35 |
$mainframe = JFactory::getApplication(); |
| 36 |
$mainframe->redirect("index.php?option=com_vikbooking&task=iva"); |
| 37 |
exit; |
| 38 |
} |
| 39 |
$row = $dbo->loadAssoc(); |
| 40 |
} |
| 41 |
|
| 42 |
$this->row = $row; |
| 43 |
|
| 44 |
// Display the template |
| 45 |
parent::display($tpl); |
| 46 |
} |
| 47 |
|
| 48 |
/** |
| 49 |
* Sets the toolbar |
| 50 |
*/ |
| 51 |
protected function addToolBar() { |
| 52 |
$cid = VikRequest::getVar('cid', array(0)); |
| 53 |
|
| 54 |
if (!empty($cid[0])) { |
| 55 |
//edit |
| 56 |
JToolBarHelper::title(JText::translate('VBMAINIVATITLEEDIT'), 'vikbooking'); |
| 57 |
if (JFactory::getUser()->authorise('core.edit', 'com_vikbooking')) { |
| 58 |
JToolBarHelper::save( 'updateiva', JText::translate('VBSAVE')); |
| 59 |
JToolBarHelper::spacer(); |
| 60 |
} |
| 61 |
JToolBarHelper::cancel( 'canceliva', JText::translate('VBANNULLA')); |
| 62 |
JToolBarHelper::spacer(); |
| 63 |
} else { |
| 64 |
//new |
| 65 |
JToolBarHelper::title(JText::translate('VBMAINIVATITLENEW'), 'vikbooking'); |
| 66 |
if (JFactory::getUser()->authorise('core.create', 'com_vikbooking')) { |
| 67 |
JToolBarHelper::save( 'createiva', JText::translate('VBSAVE')); |
| 68 |
JToolBarHelper::spacer(); |
| 69 |
} |
| 70 |
JToolBarHelper::cancel( 'canceliva', JText::translate('VBANNULLA')); |
| 71 |
JToolBarHelper::spacer(); |
| 72 |
} |
| 73 |
} |
| 74 |
|
| 75 |
} |
| 76 |
|