| Current Path : /home/h/e/l/helpink/www/components/com_jbusinessdirectory/helpers/ |
| Current File : /home/h/e/l/helpink/www/components/com_jbusinessdirectory/helpers/calendar.php |
<?php
/**
* @package J-BusinessDirectory
*
* @author CMSJunkie http://www.cmsjunkie.com/
* @copyright Copyright (C) 2007 - 2022 CMSJunkie. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0.en.html
*/
defined('_JEXEC') or die('Restricted access');
$document = JFactory::getDocument();
JBusinessUtil::enqueueScript('libraries/calendar/index.global.min.js');
/* $calendarSource needs to be provided when the file is included. */
// Day/Month names are now handled by FullCalendar locales/Intl API
$calendarOptions = "\tvar calendarOptions = {\n";
$calendarOptions .= "\t\teventSources: " . json_encode([$calendarSource]) . ",\n";
// Removed deprecated month/day name options
$calendarOptions .= "\t};\n";
$document->addScriptDeclaration($calendarOptions);
?>
<div id="events-calendar-container">
<div class="clear"></div>
<div id="events-calendar"></div>
</div>
<script>
<?php $languageTag = strtolower(JFactory::getLanguage()->getTag()); ?>
window.addEventListener('load', function() {
// Add options to the global calendarOptions object
// It will be used when initializing the calendar in events.js
calendarOptions['locale'] = '<?php echo $languageTag; ?>'; // Set locale from Joomla language
calendarOptions['headerToolbar'] = { // Renamed from header
left : 'prev,next today',
center : 'title',
right : 'dayGridMonth,dayGridWeek,dayGridDay' // Updated view names
};
calendarOptions['height'] = "auto";
calendarOptions['dayMaxEvents'] = true; // Renamed from eventLimit
calendarOptions['views'] = {
dayGridMonth: { // Updated view name
dayMaxEvents: 10 // Renamed from eventLimit
},
dayGridWeek: { // Updated view name
dayMaxEvents: 50 // Renamed from eventLimit
},
dayGridDay: { // Updated view name
dayMaxEvents: 50 // Renamed from eventLimit
}
};
// Translations
calendarOptions['allDayText'] = "<?php echo JText::_('LNG_ALL_DAY', true); ?>";
calendarOptions['buttonText'] = {
today : "<?php echo JText::_('LNG_TODAY', true)?>",
month : "<?php echo JText::_('LNG_MONTH', true)?>",
week : "<?php echo JText::_('LNG_WEEK', true)?>",
day : "<?php echo JText::_('LNG_DAY', true)?>",
list : "<?php echo JText::_('LNG_LIST', true)?>" // Note: 'list' view might need a separate plugin in v6
};
// Removed listTexts option
// Removed dayClick handler (should be dateClick and defined in events.js)
// Removed eventClick handler (should be defined in events.js)
});
</script>