| 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 VikBookingViewCustomf extends JViewVikBooking |
| 17 |
{ |
| 18 |
function display($tpl = null) |
| 19 |
{ |
| 20 |
// Set the toolbar |
| 21 |
$this->addToolBar(); |
| 22 |
|
| 23 |
$rows = ""; |
| 24 |
$navbut = ""; |
| 25 |
|
| 26 |
$dbo = JFactory::getDbo(); |
| 27 |
$mainframe = JFactory::getApplication(); |
| 28 |
$lim = $mainframe->getUserStateFromRequest("com_vikbooking.limit", 'limit', $mainframe->get('list_limit'), 'int'); |
| 29 |
$lim0 = VikRequest::getVar('limitstart', 0, '', 'int'); |
| 30 |
$q = "SELECT SQL_CALC_FOUND_ROWS * FROM `#__vikbooking_custfields` ORDER BY `#__vikbooking_custfields`.`ordering` ASC"; |
| 31 |
$dbo->setQuery($q, $lim0, $lim); |
| 32 |
$dbo->execute(); |
| 33 |
if ($dbo->getNumRows() > 0) { |
| 34 |
$rows = $dbo->loadAssocList(); |
| 35 |
$dbo->setQuery('SELECT FOUND_ROWS();'); |
| 36 |
jimport('joomla.html.pagination'); |
| 37 |
$pageNav = new JPagination( $dbo->loadResult(), $lim0, $lim ); |
| 38 |
$navbut = "<table align=\"center\"><tr><td>".$pageNav->getListFooter()."</td></tr></table>"; |
| 39 |
} |
| 40 |
|
| 41 |
$this->rows = $rows; |
| 42 |
$this->lim0 = $lim0; |
| 43 |
$this->navbut = $navbut; |
| 44 |
|
| 45 |
// Display the template |
| 46 |
parent::display($tpl); |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Sets the toolbar |
| 51 |
*/ |
| 52 |
protected function addToolBar() { |
| 53 |
JToolBarHelper::title(JText::translate('VBMAINCUSTOMFTITLE'), 'vikbooking'); |
| 54 |
if (JFactory::getUser()->authorise('core.create', 'com_vikbooking')) { |
| 55 |
JToolBarHelper::addNew('newcustomf', JText::translate('VBMAINCUSTOMFNEW')); |
| 56 |
JToolBarHelper::spacer(); |
| 57 |
} |
| 58 |
if (JFactory::getUser()->authorise('core.edit', 'com_vikbooking')) { |
| 59 |
JToolBarHelper::editList('editcustomf', JText::translate('VBMAINCUSTOMFEDIT')); |
| 60 |
JToolBarHelper::spacer(); |
| 61 |
} |
| 62 |
if (JFactory::getUser()->authorise('core.delete', 'com_vikbooking')) { |
| 63 |
JToolBarHelper::deleteList(JText::translate('VBDELCONFIRM'), 'removecustomf', JText::translate('VBMAINCUSTOMFDEL')); |
| 64 |
JToolBarHelper::spacer(); |
| 65 |
} |
| 66 |
} |
| 67 |
} |
| 68 |
|