input->cookie; // load context menu assets $vbo_app->loadContextMenuAssets(); // preload chat assets VBOFactory::getChatMediator()->useAssets(); // gather permissions $vbo_auth_pricing = JFactory::getUser()->authorise('core.vbo.pricing', 'com_vikbooking'); $vbo_auth_pms = JFactory::getUser()->authorise('core.vbo.pms', 'com_vikbooking'); // load all the existing task manager areas/projects $taskAreas = VBOTaskModelArea::getInstance()->getItems(); // load all room rate plans to detect derived rate plans $allRatePlans = VikBooking::getAvailabilityInstance(true)->loadRatePlans(true); $hasDerivedRates = (bool) array_filter($allRatePlans, function($rp) { return !empty($rp['derived_id']) && !empty($rp['parent_rate_id']); }); // currency symbol and formatting options $currencysymb = VikBooking::getCurrencySymb(); list($currency_digits, $currency_decimals, $currency_thousands) = explode(':', VikBooking::getNumberFormatData()); // check whether VCM is available $vcm_enabled = VikBooking::vcmAutoUpdate(); // build room-ota relations for pricing alterations, if any $room_ota_relations = []; foreach (array_column(($rooms ?? []), 'id') as $rid) { // always get a new instance of the VikChannelManagerLogos class $vcm_logos = VikBooking::getVcmChannelsLogo('', true); // load channels (firsr) and accounts (after) for this listing $room_ota_channels = is_object($vcm_logos) && method_exists($vcm_logos, 'getVboRoomLogosMapped') ? $vcm_logos->getVboRoomLogosMapped($rid) : []; $room_ota_accounts = is_object($vcm_logos) && method_exists($vcm_logos, 'getRoomOtaAccounts') ? $vcm_logos->getRoomOtaAccounts() : []; // filter channels not available as accounts (i.e. iCal) if (count($room_ota_channels) != count(($room_ota_accounts[$rid] ?? []))) { $ota_account_names = array_map('strtolower', array_column(($room_ota_accounts[$rid] ?? []), 'channel')); $room_ota_channels = array_filter($room_ota_channels, function($chid) use ($ota_account_names) { return in_array(strtolower($chid), $ota_account_names); }, ARRAY_FILTER_USE_KEY); } if ($room_ota_channels && ($room_ota_accounts[$rid] ?? [])) { $room_ota_relations[$rid] = [ 'channels' => $room_ota_channels, 'accounts' => $room_ota_accounts[$rid], ]; } } // build room names map $room_names_map = array_combine(array_column(($rooms ?? []), 'id'), array_column(($rooms ?? []), 'name')); // access the current task manager filters $tmfilters = (array) (($tmfilters ?? []) ?: $app->input->get('tmfilters', [], 'array')); // check if the tasks should be automatically loaded for certain area/project IDs $activeAreas = array_values(array_filter(array_map('intval', $tmfilters['area_ids'] ?? []))); ?>