| 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 |
jimport('joomla.application.component.view'); |
| 14 |
|
| 15 |
class VikbookingViewLoginregister extends JViewVikBooking { |
| 16 |
function display($tpl = null) { |
| 17 |
$dbo = JFactory::getDBO(); |
| 18 |
$proomid = VikRequest::getVar('roomid', array()); |
| 19 |
$pdays = VikRequest::getInt('days', '', 'request'); |
| 20 |
$pcheckin = VikRequest::getInt('checkin', '', 'request'); |
| 21 |
$pcheckout = VikRequest::getInt('checkout', '', 'request'); |
| 22 |
$proomsnum = VikRequest::getInt('roomsnum', '', 'request'); |
| 23 |
$padults = VikRequest::getVar('adults', array()); |
| 24 |
$pchildren = VikRequest::getVar('children', array()); |
| 25 |
$rooms = array(); |
| 26 |
$arrpeople = array(); |
| 27 |
for($ir = 1; $ir <= $proomsnum; $ir++) { |
| 28 |
$ind = $ir - 1; |
| 29 |
if (!empty($proomid[$ind])) { |
| 30 |
$q = "SELECT * FROM `#__vikbooking_rooms` WHERE `id`='".intval($proomid[$ind])."' AND `avail`='1';"; |
| 31 |
$dbo->setQuery($q); |
| 32 |
$dbo->execute(); |
| 33 |
if ($dbo->getNumRows() > 0) { |
| 34 |
$takeroom = $dbo->loadAssocList(); |
| 35 |
$rooms[$ir] = $takeroom[0]; |
| 36 |
} |
| 37 |
} |
| 38 |
if (!empty($padults[$ind])) { |
| 39 |
$arrpeople[$ir]['adults'] = intval($padults[$ind]); |
| 40 |
}else { |
| 41 |
$arrpeople[$ir]['adults'] = 0; |
| 42 |
} |
| 43 |
if (!empty($pchildren[$ind])) { |
| 44 |
$arrpeople[$ir]['children'] = intval($pchildren[$ind]); |
| 45 |
}else { |
| 46 |
$arrpeople[$ir]['children'] = 0; |
| 47 |
} |
| 48 |
} |
| 49 |
$prices = array(); |
| 50 |
foreach($rooms as $num => $r) { |
| 51 |
$ppriceid = VikRequest::getString('priceid'.$num, '', 'request'); |
| 52 |
if (!empty($ppriceid)) { |
| 53 |
$prices[$num] = intval($ppriceid); |
| 54 |
} |
| 55 |
} |
| 56 |
$selopt = array(); |
| 57 |
$q = "SELECT * FROM `#__vikbooking_optionals`;"; |
| 58 |
$dbo->setQuery($q); |
| 59 |
$dbo->execute(); |
| 60 |
if ($dbo->getNumRows() > 0) { |
| 61 |
$optionals = $dbo->loadAssocList(); |
| 62 |
foreach($rooms as $num => $r) { |
| 63 |
foreach ($optionals as $opt) { |
| 64 |
$tmpvar = VikRequest::getString('optid'.$num.$opt['id'], '', 'request'); |
| 65 |
if (!empty ($tmpvar)) { |
| 66 |
$opt['quan'] = $tmpvar; |
| 67 |
$selopt[$num][] = $opt; |
| 68 |
} |
| 69 |
} |
| 70 |
} |
| 71 |
} |
| 72 |
$this->prices = $prices; |
| 73 |
$this->rooms = $rooms; |
| 74 |
$this->days = $pdays; |
| 75 |
$this->checkin = $pcheckin; |
| 76 |
$this->checkout = $pcheckout; |
| 77 |
$this->selopt = $selopt; |
| 78 |
$this->roomsnum = $proomsnum; |
| 79 |
$this->adults = $padults; |
| 80 |
$this->children = $pchildren; |
| 81 |
$this->arrpeople = $arrpeople; |
| 82 |
//theme |
| 83 |
$theme = VikBooking::getTheme(); |
| 84 |
if($theme != 'default') { |
| 85 |
$thdir = VBO_SITE_PATH.DS.'themes'.DS.$theme.DS.'loginregister'; |
| 86 |
if(is_dir($thdir)) { |
| 87 |
$this->_setPath('template', $thdir.DS); |
| 88 |
} |
| 89 |
} |
| 90 |
// |
| 91 |
parent::display($tpl); |
| 92 |
} |
| 93 |
} |
| 94 |
|