0 ? "`id` IN (".implode(',', $room_ids).") AND " : "")."`avail`='1' ORDER BY ".$oclause.";"; $dbo->setQuery($q); $dbo->execute(); if (!$dbo->getNumRows()) { $app = JFactory::getApplication(); $app->redirect("index.php"); $app->close(); } $rooms=$dbo->loadAssocList(); $vbo_tn->translateContents($rooms, '#__vikbooking_rooms'); $pmonth = VikRequest::getInt('month', '', 'request'); if (!empty($pmonth)) { $tsstart=$pmonth; } else { $oggid = getdate(); $tsstart = mktime(0, 0, 0, $oggid['mon'], 1, $oggid['year']); } $oggid = getdate($tsstart); if ($oggid['mon'] == 12) { $nextmon = 1; $year = $oggid['year'] + 1; } else { $nextmon = $oggid['mon'] + 1; $year = $oggid['year']; } $tsend = mktime(0, 0, 0, $nextmon, 1, $year); $today = getdate(); $firstmonth = mktime(0, 0, 0, $today['mon'], 1, $today['year']); $wmonthsel = "\n"; $busy = array(); $q = "SELECT * FROM `#__vikbooking_busy` WHERE ".(count($room_ids) > 0 ? "`idroom` IN (".implode(',', $room_ids).") AND " : "")."(`checkin`>=".$tsstart." OR `checkout`>=".$tsstart.");"; $dbo->setQuery($q); $dbo->execute(); if ($dbo->getNumRows()) { $all_busy = $dbo->loadAssocList(); foreach ($all_busy as $brecord) { $busy[$brecord['idroom']][] = $brecord; } } $this->rooms = $rooms; $this->tsstart = $tsstart; $this->wmonthsel = $wmonthsel; $this->busy = $busy; $this->vbo_tn = $vbo_tn; //theme $theme = VikBooking::getTheme(); if ($theme != 'default') { $thdir = VBO_SITE_PATH . DIRECTORY_SEPARATOR . 'themes' . DIRECTORY_SEPARATOR . $theme . DIRECTORY_SEPARATOR . 'availability'; if (is_dir($thdir)) { $this->_setPath('template', $thdir . DIRECTORY_SEPARATOR); } } // parent::display($tpl); } }