| @@ -12,14 +12,19 @@ | ||
| 12 | 12 | |
| 13 | 13 | // import Joomla view library |
| 14 | 14 | jimport('joomla.application.component.view'); |
| 15 | 15 | |
| 16 | -class VikBookingViewRooms extends JViewVikBooking { | |
| 17 | - | |
| 18 | - function display($tpl = null) { | |
| 16 | +class VikBookingViewRooms extends JViewVikBooking | |
| 17 | +{ | |
| 18 | + public function display($tpl = null) | |
| 19 | + { | |
| 19 | 20 | // Set the toolbar |
| 20 | 21 | $this->addToolBar(); |
| 21 | 22 | |
| 23 | + if (!JFactory::getUser()->authorise('core.vbo.rooms', 'com_vikbooking')) { | |
| 24 | + VBOHttpDocument::getInstance()->close(403, JText::translate('JERROR_ALERTNOAUTHOR')); | |
| 25 | + } | |
| 26 | + | |
| 22 | 27 | $rows = ""; |
| 23 | 28 | $navbut = ""; |
| 24 | 29 | $mainframe = JFactory::getApplication(); |
| 25 | 30 | $pmodtar = VikRequest::getString('modtar', '', 'request'); |
| @@ -52,9 +57,9 @@ | ||
| 52 | 57 | $lim0 = VikRequest::getVar('limitstart', 0, '', 'int'); |
| 53 | 58 | $session = JFactory::getSession(); |
| 54 | 59 | $pvborderby = VikRequest::getString('vborderby', '', 'request'); |
| 55 | 60 | $pvbordersort = VikRequest::getString('vbordersort', '', 'request'); |
| 56 | - $validorderby = array('name', 'toadult', 'tochild', 'totpeople', 'units'); | |
| 61 | + $validorderby = array('name', 'toadult', 'tochild', 'totpeople', 'units', 'avail'); | |
| 57 | 62 | $orderby = $session->get('vbViewRoomsOrderby', 'name'); |
| 58 | 63 | $ordersort = $session->get('vbViewRoomsOrdersort', 'ASC'); |
| 59 | 64 | if (!empty($pvborderby) && in_array($pvborderby, $validorderby)) { |
| 60 | 65 | $orderby = $pvborderby; |
| @@ -88,9 +93,9 @@ | ||
| 88 | 93 | /** |
| 89 | 94 | * Call assertListQuery() from the View class to make sure the filters set |
| 90 | 95 | * do not produce an empty result. This would reset the page in this case. |
| 91 | 96 | * |
| 92 | - * @since 1.3.0 | |
| 97 | + * @since 1.13.0 (J) - 1.3.0 (WP) | |
| 93 | 98 | */ |
| 94 | 99 | $this->assertListQuery($lim0, $lim); |
| 95 | 100 | // |
| 96 | 101 | |
| @@ -115,9 +120,10 @@ | ||
| 115 | 120 | |
| 116 | 121 | /** |
| 117 | 122 | * Sets the toolbar |
| 118 | 123 | */ |
| 119 | - protected function addToolBar() { | |
| 124 | + protected function addToolBar() | |
| 125 | + { | |
| 120 | 126 | JToolBarHelper::title(JText::translate('VBMAINDEAFULTTITLE'), 'vikbooking'); |
| 121 | 127 | if (JFactory::getUser()->authorise('core.create', 'com_vikbooking')) { |
| 122 | 128 | JToolBarHelper::addNew('newroom', JText::translate('VBMAINDEFAULTNEW')); |
| 123 | 129 | JToolBarHelper::spacer(); |
| @@ -134,6 +140,5 @@ | ||
| 134 | 140 | JToolBarHelper::deleteList(JText::translate('VBDELCONFIRM'), 'removeroom', JText::translate('VBMAINDEFAULTDEL')); |
| 135 | 141 | JToolBarHelper::spacer(); |
| 136 | 142 | } |
| 137 | 143 | } |
| 138 | - | |
| 139 | 144 | } |