roomids; $rooms = $this->rooms; $rooms_busy = $this->rooms_busy; $months = $this->months; $fromts = $this->fromts; $tots = $this->tots; $vbo_app = VikBooking::getVboApplication(); $vbo_app->loadSelect2(); $vbo_app->loadDatePicker(); $vbo_app->prepareJavaScriptCurrency(); JHtml::fetch('script', VBO_ADMIN_URI . 'resources/js_upload/jquery.stickytableheaders.min.js'); $nowdf = VikBooking::getDateFormat(true); 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(true); $juidf = $nowdf == "%d/%m/%Y" ? 'dd/mm/yy' : ($nowdf == "%m/%d/%Y" ? 'mm/dd/yy' : 'yy/mm/dd'); $month = VikRequest::getInt('month', 0, 'request'); $printtableaux = VikRequest::getInt('printtableaux', 0, 'request'); $colortags = VikBooking::loadBookingsColorTags(); $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'), ); $long_months_labels = $months_labels; foreach ($months_labels as $i => $v) { $months_labels[$i] = function_exists('mb_substr') ? mb_substr($v, 0, 3, 'UTF-8') : substr($v, 0, 3); } ?>
renderElementsDropDown([ 'id' => 'roomsel', 'elements' => 'listings', 'placeholder' => JText::translate('VBO_LISTINGS'), 'allow_clear' => 1, 'attributes' => [ 'name' => 'roomids[]', 'multiple' => 'multiple', ], 'load_categories' => 1, 'selected_values' => (array) JFactory::getApplication()->input->get('roomids', [], 'array'), ]); ?>
 
 
'tableaux', ]; // render the permissions layout echo JLayoutHelper::render('operators.permissions', $layout_data); // count the cells per month $thead_info = array(); $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]++; // push information for the table head array_push($thead_info, array( 'mon' => $long_months_labels[($nowinfo['mon'] - 1)], 'mday' => $nowinfo['mday'], 'wday' => $days_labels[$nowinfo['wday']], 'year' => $nowinfo['year'], 'ts' => $nowinfo[0], )); // next loop $nowinfo = getdate(mktime(0, 0, 0, $nowinfo['mon'], ($nowinfo['mday'] + 1), $nowinfo['year'])); } // today $todaydt = date('Y-m-d'); ?>
$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]); } } // extra class for single-unit rooms $room_extra_class = $rdata['units'] == 1 ? 'vbo-tableaux-booking-singleunit ' : ''; ?> 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); // } // ?>
 
  0 ? ' width="100' : ''; ?> data-ymd="" data-readymd="">
= $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 (J) - 1.3.5 (WP) */ 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++; ?>
 
pbmode == 'tags' && !isset($colortags_map[$rbook['idorder']])) { $colortags_map[$rbook['idorder']] = VikBooking::applyBookingColorTag($rbook); } if (!in_array($rbook['idorder'], $prevbuffer)) { // first time we print the details for this booking - compose the content of the element $cellcont = ''; // customer details if (!empty($rbook['first_name']) || !empty($rbook['last_name'])) { /** * Check if we need to display a profile picture or a channel logo. * * @since 1.16.0 (J) - 1.6.0 (WP) */ $booking_avatar_src = null; $booking_avatar_alt = null; if (!empty($rbook['pic'])) { // customer profile picture $booking_avatar_src = strpos($rbook['pic'], 'http') === 0 ? $rbook['pic'] : VBO_SITE_URI . 'resources/uploads/' . $rbook['pic']; $booking_avatar_alt = basename($booking_avatar_src); } elseif (!empty($rbook['channel'])) { // channel logo $logo_helper = VikBooking::getVcmChannelsLogo($rbook['channel'], $get_istance = true); if ($logo_helper !== false) { $booking_avatar_src = $logo_helper->getSmallLogoURL(); $booking_avatar_alt = $logo_helper->provenience; } } if (!empty($booking_avatar_src)) { // make sure the alt attribute is not too long in case of broken images $booking_avatar_alt = !empty($booking_avatar_alt) && strlen($booking_avatar_alt) > 15 ? '...' . substr($booking_avatar_alt, -12) : $booking_avatar_alt; // append booking avatar image $cellcont .= ''; } // customer record $cellcont .= '' . $rbook['first_name'] . ' ' . $rbook['last_name'] . ''; } 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'] . ''; } } // distinctive features if (!empty($rbook['indexes']) && isset($rooms_features_map[$rid])) { $bookindexes = explode(';', $rbook['indexes']); $roomindexes = explode(';', $rbook['roomids']); 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']]++; } // seek for the index occurrence of this room in the list of rooms booked $count_pos = -1; $room_pos = null; foreach ($roomindexes as $rk => $rv) { if ((int)$rv == (int)$rid) { $count_pos++; if ($count_pos == $rooms_features_bookings[$rid.'_'.$rbook['idorder']]) { $room_pos = $rk; break; } } } $nowfeatindex = isset($bookindexes[$room_pos]) ? $room_pos : null; if (!is_null($room_pos) && isset($bookindexes[$nowfeatindex]) && isset($rooms_features_map[$rid][$bookindexes[$nowfeatindex]])) { // get this room feature $cellcont .= '' . $rooms_features_map[$rid][$bookindexes[$nowfeatindex]] . ' '; } } // add invoice/receipt number if available (taken from booking color tag) if (isset($colortags_map[$rbook['idorder']]) && count($colortags_map[$rbook['idorder']])) { if (isset($colortags_map[$rbook['idorder']]['invoice_number'])) { // invoice number $invstyle = isset($colortags_map[$rbook['idorder']]['fontcolor']) ? ' style="color: '.$colortags_map[$rbook['idorder']]['fontcolor'].';"' : ''; $cellcont .= ' '.$colortags_map[$rbook['idorder']]['invoice_number'].''; } elseif (isset($colortags_map[$rbook['idorder']]['receipt_number'])) { // receipt number $cellcont .= ' '; } } } // color tag styles $cont_styles = array(); $span_styles = array(); if (isset($colortags_map[$rbook['idorder']]) && count($colortags_map[$rbook['idorder']])) { $cont_styles[] = 'background-color: '.$colortags_map[$rbook['idorder']]['color'].';'; if (isset($colortags_map[$rbook['idorder']]['fontcolor'])) { $cont_styles[] = 'color: '.$colortags_map[$rbook['idorder']]['fontcolor'].';'; $span_styles[] = 'color: '.$colortags_map[$rbook['idorder']]['fontcolor'].';'; } } // try to guess if this will be the last element of the day (single-unit rooms, check-out day with wider space because of no check-ins on the same day) $last_checkout_class = ''; if ($rdata['units'] == 1 && strpos($contclass, 'checkout') !== false && !isset($room_bookings[($k + 1)])) { $last_checkout_class = 'vbo-tableaux-booking-checkout-last '; } ?>
data-bid=""> >