function printToolBar() { global $Itemid; $year = (int) $this->year; $month = (int) $this->month; $day = (int) $this->day; $view = $this->view; $document =& JFactory::getDocument(); $document->setTitle('GCalendar: ' . $this->getViewTitle($year, $month, $day, $this->getWeekStart(), $view)); $mainFilename = "index.php?option=com_gcalendar&view=gcalendar&Itemid=" . $Itemid; switch ($view) { case "month": $nextMonth = $month == 12 ? 1 : $month + 1; $prevMonth = $month == 1 ? 12 : $month - 1; $nextYear = $month == 12 ? $year + 1 : $year; $prevYear = $month == 1 ? $year - 1 : $year; $prevURL = $mainFilename . "&gcalendarview=month&year=" . $prevYear . "&month=" . $prevMonth; $nextURL = $mainFilename . "&gcalendarview=month&year=" . $nextYear . "&month=" . $nextMonth; break; case "week": list($nextYear, $nextMonth, $nextDay) = explode(",", date("Y,n,j", strtotime("+7 days", strtotime("" . $year . "-" . $month . "-" . $day)))); list($prevYear, $prevMonth, $prevDay) = explode(",", date("Y,n,j", strtotime("-7 days", strtotime("" . $year . "-" . $month . "-" . $day)))); $prevURL = $mainFilename . "&gcalendarview=week&year=" . $prevYear . "&month=" . $prevMonth . "&day=" . $prevDay; $nextURL = $mainFilename . "&gcalendarview=week&year=" . $nextYear . "&month=" . $nextMonth . "&day=" . $nextDay; break; case "day": list($nextYear, $nextMonth, $nextDay) = explode(",", date("Y,n,j", strtotime("+1 day", strtotime("" . $year . "-" . $month . "-" . $day)))); list($prevYear, $prevMonth, $prevDay) = explode(",", date("Y,n,j", strtotime("-1 day", strtotime("" . $year . "-" . $month . "-" . $day)))); $prevURL = $mainFilename . "&gcalendarview=day&year=" . $prevYear . "&month=" . $prevMonth . "&day=" . $prevDay; $nextURL = $mainFilename . "&gcalendarview=day&year=" . $nextYear . "&month=" . $nextMonth . "&day=" . $nextDay; break; } $calCode = "function jumpToDate(d){\n"; $calCode .= "if(d == null) d = new Date();\n"; $calCode .= "window.location = '" . html_entity_decode(JRoute::_($mainFilename . "&gcalendarview=" . $view)) . "&day='+d.getDate()+'&month='+(d.getMonth()+1)+'&year='+d.getFullYear();\n"; $calCode .= "};\n"; $document->addScriptDeclaration($calCode); GCalendarUtil::loadJQuery(); $document->addScript('administrator/components/com_gcalendar/libraries/jquery/ui/ui.core.js'); $document->addScript('administrator/components/com_gcalendar/libraries/jquery/ui/ui.datepicker.js'); $document->addStyleSheet('administrator/components/com_gcalendar/libraries/jquery/themes/redmond/ui.all.css'); $daysLong = "["; $daysShort = "["; $daysMin = "["; $monthsLong = "["; $monthsShort = "["; $dateObject = JFactory::getDate(); for ($i = 0; $i < 7; $i++) { $daysLong .= "'" . $dateObject->_dayToString($i, false) . "'"; $daysShort .= "'" . $dateObject->_dayToString($i, true) . "'"; $daysMin .= "'" . substr($dateObject->_dayToString($i, true), 0, 2) . "'"; if ($i < 6) { $daysLong .= ","; $daysShort .= ","; $daysMin .= ","; } } for ($i = 1; $i <= 12; $i++) { $monthsLong .= "'" . $dateObject->_monthToString($i, false) . "'"; $monthsShort .= "'" . $dateObject->_monthToString($i, true) . "'"; if ($i < 12) { $monthsLong .= ","; $monthsShort .= ","; } } $daysLong .= "]"; $daysShort .= "]"; $daysMin .= "]"; $monthsLong .= "]"; $monthsShort .= "]"; $calCode .= "jQuery(document).ready(function(){\n"; $calCode .= "document.getElementById('gcdate').value = jQuery.datepicker.formatDate('" . $this->dateFormat . "', new Date(" . $year . ", " . $month . " - 1, " . $day . "));\n"; // $calCode .= "jQuery(\"#gcdate\").datepicker({changeYear: true});\n"; $calCode .= "jQuery(\"#gcdate\").datepicker({dateFormat: '" . $this->dateFormat . "'});\n"; $calCode .= "jQuery(\"#gcdate\").datepicker('option', 'dayNames', " . $daysLong . ");\n"; $calCode .= "jQuery(\"#gcdate\").datepicker('option', 'dayNamesShort', " . $daysShort . ");\n"; $calCode .= "jQuery(\"#gcdate\").datepicker('option', 'dayNamesMin', " . $daysMin . ");\n"; $calCode .= "jQuery(\"#gcdate\").datepicker('option', 'monthNames', " . $monthsLong . ");\n"; $calCode .= "jQuery(\"#gcdate\").datepicker('option', 'monthNamesShort', " . $monthsShort . ");\n"; $calCode .= "});\n"; $document->addScriptDeclaration($calCode); echo "<div id=\"calToolbar\">\n"; echo "<table style=\"margin: 0pt auto;\"><tr>\n"; echo " <td valign=\"middle\"><a class=\"Item\" href=\"" . JRoute::_($prevURL) . "\" title=\"" . JText::_('TOOLBAR_PREVIOUS') . $this->getTranslatedViewName() . "\">\n"; $this->image("btn-prev.gif", JText::_('TOOLBAR_PREVIOUS') . $this->getTranslatedViewName(), "prevBtn_img"); echo "</a></td>\n"; echo " <td valign=\"middle\"><span class=\"ViewTitle\">\n"; echo $this->getViewTitle($year, $month, $day, $this->getWeekStart(), $view); echo "</span></td>\n"; echo " <td valign=\"middle\"><a class=\"Item\" href=\"" . JRoute::_($nextURL) . "\" title=\"" . JText::_('TOOLBAR_NEXT') . $this->getTranslatedViewName() . "\">\n"; $this->image("btn-next.gif", JText::_('TOOLBAR_NEXT') . $this->getTranslatedViewName(), "nextBtn_img"); echo "</a></td>\n"; echo "<td width=\"20px\"/>\n"; $today = getdate(); echo " <td valign=\"middle\">\n"; echo "<button onClick=\"jumpToDate(null)\" title=\"" . JText::_('TOOLBAR_JUMP') . JText::_('TOOLBAR_TODAY') . "\">" . JText::_('TOOLBAR_TODAY') . "</button>\n"; echo "</td>\n"; echo " <td valign=\"middle\"><input class=\"Item\"\ttype=\"text\" name=\"gcdate\" id=\"gcdate\" \n"; echo "size=\"10\" maxlength=\"10\" title=\"" . JText::_('TOOLBAR_SELECT_DATE') . "\" /></td>"; echo " <td valign=\"middle\">\n"; echo "<button onClick=\"jumpToDate(jQuery.datepicker.parseDate('" . $this->dateFormat . "', document.getElementById('gcdate').value))\" title=\"" . JText::_('TOOLBAR_JUMP') . "\">" . JText::_('TOOLBAR_GO') . "</button>\n"; echo "</td>\n"; echo "<td width=\"20px\"/>\n"; echo " <td valign=\"middle\"><a href=\"" . JRoute::_($mainFilename . "&gcalendarview=day&year=" . $year . "&month=" . $month . "&day=" . $day) . "\">\n"; $this->image("cal-day.gif", JText::_('TOOLBAR_JUMP') . $this->getTranslatedViewName('day'), "calday_img"); echo "</a></td>\n"; echo " <td valign=\"middle\"><a href=\"" . JRoute::_($mainFilename . "&gcalendarview=week&year=" . $year . "&month=" . $month . "&day=" . $day) . "\">\n"; $this->image("cal-week.gif", JText::_('TOOLBAR_JUMP') . $this->getTranslatedViewName('week'), "calweek_img"); echo "</a></td>\n"; echo " <td valign=\"middle\"><a href=\"" . JRoute::_($mainFilename . "&gcalendarview=month&year=" . $year . "&month=" . $month . "&day=" . $day) . "\">\n"; $this->image("cal-month.gif", JText::_('TOOLBAR_JUMP') . $this->getTranslatedViewName('month'), "calmonth_img"); echo "</a></td></tr></table></div>\n"; }
foreach ($this->calendars as $calendar) { $itemID = GCalendarUtil::getItemId($calendar->id); } if (!empty($itemID)) { $component =& JComponentHelper::getComponent('com_gcalendar'); $menu =& JSite::getMenu(); $params = $menu->getParams($itemID); echo "<table><tr><td valign=\"middle\">\n"; echo '<a href="' . JRoute::_('index.php?option=com_gcalendar&Itemid=' . $itemID) . "\">\n"; echo "<img id=\"prevBtn_img\" height=\"16\" border=\"0\" width=\"16\" alt=\"backlink\" src=\"components/com_gcalendar/images/back.png\"/>\n"; echo "</a></td><td valign=\"middle\">\n"; echo '<a href="' . JRoute::_('index.php?option=com_gcalendar&Itemid=' . $itemID) . '">' . JText::_('CALENDAR_BACK_LINK') . "</a>\n"; echo "</td></tr></table>\n"; } JHTML::_('behavior.mootools'); GCalendarUtil::loadJQuery(); $document =& JFactory::getDocument(); $document->addScript(JURI::base() . 'components/com_gcalendar/libraries/fullcalendar/fullcalendar.min.js'); $document->addStyleSheet(JURI::base() . 'components/com_gcalendar/libraries/fullcalendar/fullcalendar.css'); $document->addScript(JURI::base() . 'components/com_gcalendar/libraries/jquery/ui/jquery-ui-1.7.3.custom.min.js'); $document->addScript(JURI::base() . 'components/com_gcalendar/libraries/jquery/ext/jquery.ba-hashchange.min.js'); $document->addScript(JURI::base() . 'components/com_gcalendar/libraries/jquery/ext/jquery.qtip-1.0.0.min.js'); $document->addStyleDeclaration("#ui-datepicker-div { z-index: 15; }"); $theme = $params->get('theme', ''); if (JRequest::getVar('theme', null) != null) { $theme = JRequest::getVar('theme', null); } if (!empty($theme)) { $document->addStyleSheet(JURI::base() . 'components/com_gcalendar/libraries/jquery/themes/' . $theme . '/jquery-ui-1.7.3.custom.css'); } else { $document->addStyleSheet(JURI::base() . 'components/com_gcalendar/libraries/jquery/themes/ui-lightness/jquery-ui-1.7.3.custom.css');