/** * Add unobtrusive javascript support for a calendar control. * * @return void * @since 11.1 */ public static function calendar() { static $loaded = false; // Only load once if ($loaded) { return; } $document = JFactory::getDocument(); $tag = JFactory::getLanguage()->getTag(); //Add uncompressed versions when debug is enabled $uncompressed = JFactory::getConfig()->get('debug') ? '-uncompressed' : ''; JHtml::_('stylesheet', 'system/calendar-jos.css', array(' title' => JText::_('JLIB_HTML_BEHAVIOR_GREEN'), ' media' => 'all'), true); JHtml::_('script', $tag . '/calendar' . $uncompressed . '.js', false, true); JHtml::_('script', $tag . '/calendar-setup' . $uncompressed . '.js', false, true); $translation = JHtmlBehavior::_calendartranslation(); if ($translation) { $document->addScriptDeclaration($translation); } $loaded = true; }
public static function calendar() { $document =& JFactory::getDocument(); JHtml::stylesheet('calendar-jos.css', 'media/system/css/', array(' title' => JText::_('green'), ' media' => 'all')); JHtml::script('calendar.js', 'media/system/js/'); JHtml::script('calendar-setup.js', 'media/system/js/'); $translation = JHtmlBehavior::_calendartranslation(); if ($translation) { $document->addScriptDeclaration($translation); } }
/** * Add unobtrusive javascript support for a calendar control. * * @return void * * @since 11.1 */ public static function calendar() { // Only load once if (isset(self::$loaded[__METHOD__])) { return; } $document = JFactory::getDocument(); $tag = JFactory::getLanguage()->getTag(); JHtml::_('stylesheet', 'system/calendar-jos.css', array(' title' => JText::_('JLIB_HTML_BEHAVIOR_GREEN'), ' media' => 'all'), true); JHtml::_('script', $tag . '/calendar.js', false, true); JHtml::_('script', $tag . '/calendar-setup.js', false, true); $translation = JHtmlBehavior::_calendartranslation(); if ($translation) { $document->addScriptDeclaration($translation); } self::$loaded[__METHOD__] = true; }
/** * Add unobtrusive javascript support for a calendar control. * * @return void * * @since 11.1 */ public static function calendar() { // Only load once if (isset(self::$loaded[__METHOD__])) { return; } JHtml::_('stylesheet', 'system/calendar-jos.css', array(' title' => FText::_('JLIB_HTML_BEHAVIOR_GREEN'), ' media' => 'all'), true); $translation = JHtmlBehavior::_calendartranslation(); $document = JFactory::getDocument(); $tag = JFactory::getLanguage()->getTag(); $app = JFactory::getApplication(); $option = $app->input->get('option'); // Bah - not sure why we were trying to load the calendar via requirejs $isFabrik = $option == 'com_fabrik' || !is_null($app->input->get('fabrik_sticky_filters')); $isFabrik = false; if ($app->isAdmin() || !$isFabrik) { $tag = JFactory::getLanguage()->getTag(); JHtml::_('script', $tag . '/calendar.js', false, true); JHtml::_('script', $tag . '/calendar-setup.js', false, true); if ($translation) { $document->addScriptDeclaration($translation); } } else { $f = array(); $f[] = JHtml::_('script', $tag . '/calendar.js', false, true, true); $f[] = JHtml::_('script', $tag . '/calendar-setup.js', false, true, true); if ($translation) { // In any event its not right as the 2 scrips would need to be loaded one after the other $translation = "requirejs(" . json_encode($f) . ", function () { {$translation} });\n"; $document->addScriptDeclaration($translation); } } self::$loaded[__METHOD__] = true; }