rooms;
$rooms_busy = $this->rooms_busy;
$fromts = $this->fromts;
$tots = $this->tots;
$operator_perms = !empty($this->operator['perms']) && is_array($this->operator['perms']) ? $this->operator['perms'] : [];
$pitemid = VikRequest::getInt('Itemid', 0, 'request');
// JS lang vars
JText::script('VBFORMADULTS');
JText::script('VBFORMCHILDREN');
JText::script('ORDER_SPREQUESTS');
JText::script('VBOCUSTOMERNOMINATIVE');
JText::script('VBPICKUP');
JText::script('VBRETURN');
JText::script('VBSEARCHRESROOM');
JText::script('VBOEXTRASERVICES');
JText::script('VBO_PETS');
JText::script('ORDER_PHONE');
$nowdf = VikBooking::getDateFormat();
if ($nowdf == "%d/%m/%Y") {
$df = 'd/m/Y';
} elseif ($nowdf == "%m/%d/%Y") {
$df = 'm/d/Y';
} else {
$df = 'Y/m/d';
}
$datesep = VikBooking::getDateSeparator();
//load jQuery
if (VikBooking::loadJquery()) {
JHtml::fetch('jquery.framework', true, true);
}
$days_labels = array(
JText::translate('VBSUN'),
JText::translate('VBMON'),
JText::translate('VBTUE'),
JText::translate('VBWED'),
JText::translate('VBTHU'),
JText::translate('VBFRI'),
JText::translate('VBSAT')
);
$months_labels = array(
JText::translate('VBMONTHONE'),
JText::translate('VBMONTHTWO'),
JText::translate('VBMONTHTHREE'),
JText::translate('VBMONTHFOUR'),
JText::translate('VBMONTHFIVE'),
JText::translate('VBMONTHSIX'),
JText::translate('VBMONTHSEVEN'),
JText::translate('VBMONTHEIGHT'),
JText::translate('VBMONTHNINE'),
JText::translate('VBMONTHTEN'),
JText::translate('VBMONTHELEVEN'),
JText::translate('VBMONTHTWELVE')
);
// count the cells per month
$months_days = array();
$nowinfo = getdate($fromts);
while ($nowinfo[0] <= $tots) {
$mkey = $nowinfo['mon'] . '_' . $nowinfo['year'];
if (!isset($months_days[$mkey])) {
$months_days[$mkey] = 0;
}
$months_days[$mkey]++;
// next loop
$nowinfo = getdate(mktime(0, 0, 0, $nowinfo['mon'], ($nowinfo['mday'] + 1), $nowinfo['year']));
}
// today
$todaydt = date('Y-m-d');
$todayts = strtotime($todaydt);
// tomorrow
$tomorrowts = strtotime("+1 day", $todayts);
// count today and tomorrow bookings
$tod_arrive = 0;
$tom_arrive = 0;
$tod_depart = 0;
$tom_depart = 0;
$tod_stays = 0;
$tom_stays = 0;
foreach ($rooms_busy as $rid => $busy) {
foreach ($busy as $b) {
$tmpone = getdate($b['checkin']);
$ritts = mktime(0, 0, 0, $tmpone['mon'], $tmpone['mday'], $tmpone['year']);
$tmptwo = getdate($b['checkout']);
$conts = mktime(0, 0, 0, $tmptwo['mon'], $tmptwo['mday'], $tmptwo['year']);
if ($todayts == $ritts) {
$tod_arrive++;
}
if ($tomorrowts == $ritts) {
$tom_arrive++;
}
if ($todayts == $conts) {
$tod_depart++;
}
if ($tomorrowts == $conts) {
$tom_depart++;
}
if ($todayts > $ritts && $todayts < $conts) {
$tod_stays++;
}
if ($tomorrowts > $ritts && $tomorrowts < $conts) {
$tom_stays++;
}
}
}
?>
|
|
$totdays) {
$mkeyparts = explode('_', $mkey);
?>
|
| |
festivities[$nowinfo_ymd]) ? ' vbo-tableaux-festcell' : '';
?>
|
$rdata) {
// distinctive features
$room_params = !empty($rdata['params']) ? json_decode($rdata['params'], true) : array();
if (is_array($room_params) && array_key_exists('features', $room_params) && count($room_params['features']) > 0) {
$rooms_features_map[$rid] = array();
foreach ($room_params['features'] as $rind => $rfeatures) {
foreach ($rfeatures as $fname => $fval) {
if (strlen($fval)) {
$rooms_features_map[$rid][$rind] = '#'.$fval;
break;
}
}
}
if (!(count($rooms_features_map[$rid]) > 0)) {
unset($rooms_features_map[$rid]);
}
}
//
?>
|
rdaynotes[$rdaynote_keyid])) {
// push associative index with notes
$rdaynote_keyids[$lookup_index] = $rdaynote_keyid;
}
}
if (count($rdaynote_keyids)) {
// some notes exist for this combination of date, room ID and subunit
$rdaynote_class = ' vbo-roomdaynote-full';
$rdaynote_icn = 'sticky-note';
/**
* Try to populate the notes for this room-day cell
* only if the previous day does not have the same note.
* Just the first readable room-day cell should have notes.
*/
$notes_titles = array();
$yesterday_ts = mktime(0, 0, 0, $nowinfo['mon'], ($nowinfo['mday'] - 1), $nowinfo['year']);
$yesterday_ymd = date('Y-m-d', $yesterday_ts);
// loop through all the keys with notes
foreach ($rdaynote_keyids as $lookup_index => $rdaynote_keyid) {
$yesterday_keyid = $yesterday_ymd . '_' . $rdata['id'] . '_' . $lookup_index;
foreach ($this->rdaynotes[$rdaynote_keyid]['info'] as $today_note) {
// only manual (custom) room-day notes will be displayed
$display_note = ($today_note->type == 'custom');
if (isset($this->rdaynotes[$yesterday_keyid])) {
// make sure the same note is not present for yesterday
foreach ($this->rdaynotes[$yesterday_keyid]['info'] as $yesterday_note) {
if ($today_note->type == $yesterday_note->type && $today_note->name == $yesterday_note->name) {
// same note available also for yesterday
$display_note = false;
break;
}
}
}
if ($display_note) {
// push just the name of the note
array_push($notes_titles, $today_note->name);
}
}
}
// separate all notes (if any) with comma
$cell_rdnotes = implode(', ', $notes_titles);
//
}
//
?>
= $ritts && $nowinfo[0] <= $conts) {
array_push($room_bookings, $b);
}
}
/**
* By default, we attempt to sort the bookings for this day by room index.
*
* @since 1.13.5
*/
if (count($room_bookings)) {
$rindexes_map = array();
foreach ($room_bookings as $rbk => $rbval) {
$rindexes_map[$rbk] = isset($rbval['indexes']) ? $rbval['indexes'] : '';
}
asort($rindexes_map);
$room_bookings_copy = array();
foreach ($rindexes_map as $rbk => $rbval) {
array_push($room_bookings_copy, $room_bookings[$rbk]);
}
$room_bookings = $room_bookings_copy;
}
//
}
if (count($room_bookings) && count($bookbuffer)) {
// sort bookings according to the previous map
$newbookings = array();
foreach ($bookbuffer as $oid) {
foreach ($room_bookings as $kb => $rbook) {
if ($oid == $rbook['idorder']) {
// get this key first
$newbookings[$kb] = $rbook;
// do not break the loop as there could be multiple idorder, just continue
continue;
}
}
}
if (count($newbookings)) {
// merge array by keys by unsetting double keys from second array
$room_bookings = $newbookings + $room_bookings;
}
// copy buffer before reset to see whether this is the first cell displayed for the booking
$prevbuffer = $bookbuffer;
// reset buffer to fill the current day bookings
$bookbuffer = array();
}
$indexpos = 0;
foreach ($room_bookings as $k => $rbook) {
$contclass = 'stay';
if ($rbook['basefrom'] == $nowinfo[0]) {
$contclass = 'checkin';
} elseif ($rbook['baseto'] == $nowinfo[0]) {
$contclass = 'checkout';
}
$shortstaycls = '';
if (ceil(($rbook['baseto'] - $rbook['basefrom']) / 86400) < 2) {
$shortstaycls = ' vbo-tableaux-booking-short';
}
//check position
$pos = $indexpos;
if (isset($positions[$rbook['idorder']]) && $indexpos < $positions[$rbook['idorder']]) {
// print empty blocks to give the right position to this booking
$pos = $indexpos.'-'.$positions[$rbook['idorder']];
$looplim = ($positions[$rbook['idorder']] - $indexpos);
for ($i = 0; $i < $looplim; $i++) {
$indexpos++;
?>
getRatePlanFromTariff(($room_rplans[$nowdataindex]));
if ($rplan_name) {
$room_extra_infos[] = $rplan_name;
}
} elseif (!empty($room_ota_rplans[$nowdataindex])) {
$room_extra_infos[] = $room_ota_rplans[$nowdataindex];
}
// parse options
$room_options = explode('__', (string) $rbook['roptions']);
if (!empty($room_options[$nowdataindex])) {
$room_options_list = [];
$all_room_options = explode(';', $room_options[$nowdataindex]);
foreach ($all_room_options as $room_opt) {
$room_opt_parts = explode(':', $room_opt);
if (count($room_opt_parts) < 2 || empty($room_opt_parts[0]) || !isset($this->all_options[$room_opt_parts[0]])) {
continue;
}
$room_options_list[] = $this->all_options[$room_opt_parts[0]]['name'];
}
if (count($room_options_list)) {
$room_extra_infos[] = JText::translate('VBACCOPZ') . ': ' . implode(', ', $room_options_list);
}
}
// parse extra services
$room_extras = explode('__', (string) $rbook['rextras']);
if (!empty($room_extras[$nowdataindex])) {
$room_extras_list = [];
$decoded_room_extras = json_decode($room_extras[$nowdataindex]);
if (is_array($decoded_room_extras)) {
foreach ($decoded_room_extras as $dre) {
if (!empty($dre->name)) {
$room_extras_list[] = $dre->name;
}
}
}
if (count($room_extras_list)) {
$room_extra_infos[] = JText::translate('VBOEXTRASERVICES') . ': ' . implode(', ', $room_extras_list);
}
}
// set the whole room extra infos string
$cont_attrs['rextrainfos'] = implode(' - ', $room_extra_infos);
}
// check for special requests
if (preg_match("/special requests: (.*?)(?=[a-z0-9\-_ ]+:|$)/is", $rbook['custdata'], $matches)) {
$cont_attrs['sprequest'] = htmlspecialchars($matches[1]);
}
// distinctive features
if (!empty($rbook['indexes']) && isset($rooms_features_map[$rid])) {
$bookindexes = explode(';', $rbook['indexes']);
if (!isset($rooms_features_bookings[$rid.'_'.$rbook['idorder']])) {
// the index to read of the feature depending on how many times this booking was printed (in case of multiple same rooms in one booking)
$rooms_features_bookings[$rid.'_'.$rbook['idorder']] = 0;
} else {
// increment index for this room booking
$rooms_features_bookings[$rid.'_'.$rbook['idorder']]++;
}
$nowfeatindex = $rooms_features_bookings[$rid.'_'.$rbook['idorder']];
if (isset($bookindexes[$nowfeatindex]) && isset($rooms_features_map[$rid][$bookindexes[$nowfeatindex]])) {
// get this room feature
$cellcont .= ''.$rooms_features_map[$rid][$bookindexes[$nowfeatindex]] . ' ';
}
}
// customer details
if (!empty($rbook['first_name']) || !empty($rbook['last_name'])) {
// customer record
if (!empty($operator_perms['guestname'])) {
$cellcont .= $rbook['first_name'].' '.$rbook['last_name'];
} else {
$cellcont .= '#' . $rbook['idorder'];
}
} else {
// parse the customer data string
$custdata_parts = explode("\n", $rbook['custdata']);
$enoughinfo = false;
if (count($custdata_parts) > 2 && strpos($custdata_parts[0], ':') !== false && strpos($custdata_parts[1], ':') !== false) {
// get the first two fields
$custvalues = array();
foreach ($custdata_parts as $custdet) {
if (strlen($custdet) < 1) {
continue;
}
$custdet_parts = explode(':', $custdet);
if (count($custdet_parts) >= 2) {
unset($custdet_parts[0]);
array_push($custvalues, trim(implode(':', $custdet_parts)));
}
if (count($custvalues) > 1) {
break;
}
}
if (count($custvalues) > 1) {
$enoughinfo = true;
$cellcont .= implode(' ', $custvalues);
}
}
if (!$enoughinfo) {
$cellcont .= $rbook['idorder'];
}
}
}
$data_attrs = array();
foreach ($cont_attrs as $datak => $datav) {
array_push($data_attrs, "data-{$datak}=\"{$datav}\"");
}
?>
>
|