function calendar() { require_once (JPATH_SITE.DS.'modules'.DS.'mod_k2_tools'.DS.'includes'.DS.'calendarClass.php'); require_once (JPATH_SITE.DS.'modules'.DS.'mod_k2_tools'.DS.'helper.php'); $mainframe = JFactory::getApplication(); $month = JRequest::getInt('month'); $year = JRequest::getInt('year'); $months = array( JText::_('K2_JANUARY'), JText::_('K2_FEBRUARY'), JText::_('K2_MARCH'), JText::_('K2_APRIL'), JText::_('K2_MAY'), JText::_('K2_JUNE'), JText::_('K2_JULY'), JText::_('K2_AUGUST'), JText::_('K2_SEPTEMBER'), JText::_('K2_OCTOBER'), JText::_('K2_NOVEMBER'), JText::_('K2_DECEMBER'), ); $days = array( JText::_('K2_SUN'), JText::_('K2_MON'), JText::_('K2_TUE'), JText::_('K2_WED'), JText::_('K2_THU'), JText::_('K2_FRI'), JText::_('K2_SAT'), ); $cal = new MyCalendar; $cal->setMonthNames($months); $cal->setDayNames($days); $cal->category = JRequest::getInt('catid'); $cal->setStartDay(1); if (($month) && ($year)) { echo $cal->getMonthView($month, $year); } else { echo $cal->getCurrentMonthView(); } $mainframe->close(); }
function calendar() { require_once JPATH_SITE . DS . 'modules' . DS . 'mod_k2_tools' . DS . 'includes' . DS . 'calendarClass.php'; require_once JPATH_SITE . DS . 'modules' . DS . 'mod_k2_tools' . DS . 'helper.php'; $mainframe =& JFactory::getApplication(); $month = JRequest::getInt('month'); $year = JRequest::getInt('year'); $months = array(JText::_('JANUARY'), JText::_('FEBRUARY'), JText::_('MARCH'), JText::_('APRIL'), JText::_('MAY'), JText::_('JUNE'), JText::_('JULY'), JText::_('AUGUST'), JText::_('SEPTEMBER'), JText::_('OCTOBER'), JText::_('NOVEMBER'), JText::_('DECEMBER')); $days = array(JText::_('SUN'), JText::_('MON'), JText::_('TUE'), JText::_('WED'), JText::_('THU'), JText::_('FRI'), JText::_('SAT')); $cal = new MyCalendar(); $cal->setMonthNames($months); $cal->setDayNames($days); $cal->category = JRequest::getInt('catid'); $cal->setStartDay(1); if ($month && $year) { echo $cal->getMonthView($month, $year); } else { echo $cal->getCurrentMonthView(); } $mainframe->close(); }
public static function calendar($params) { $month = JRequest::getInt('month'); $year = JRequest::getInt('year'); $months = array(JText::_('K2_JANUARY'), JText::_('K2_FEBRUARY'), JText::_('K2_MARCH'), JText::_('K2_APRIL'), JText::_('K2_MAY'), JText::_('K2_JUNE'), JText::_('K2_JULY'), JText::_('K2_AUGUST'), JText::_('K2_SEPTEMBER'), JText::_('K2_OCTOBER'), JText::_('K2_NOVEMBER'), JText::_('K2_DECEMBER')); $days = array(JText::_('K2_SUN'), JText::_('K2_MON'), JText::_('K2_TUE'), JText::_('K2_WED'), JText::_('K2_THU'), JText::_('K2_FRI'), JText::_('K2_SAT')); $cal = new MyCalendar(); $cal->category = $params->get('calendarCategory', 0); $cal->setStartDay(1); $cal->setMonthNames($months); $cal->setDayNames($days); if ($month && $year) { return $cal->getMonthView($month, $year); } else { return $cal->getCurrentMonthView(); } }
<?php // customize the date link; class MyCalendar extends Calendar { function getDateLink($day, $month, $year) { global $today; global $this_month; global $this_year; $link = ""; //make link since 2005/05/03 to yesterday if (mktime(0, 0, 0, $month, $day, $year) < time() - 86400 && mktime(0, 0, 0, $month, $day, $year) > mktime(0, 0, 0, 5, 2, 2005)) { $link = "/digest/" . date("Ymd", mktime(0, 0, 0, $month, $day, $year)) . ".html"; } return $link; } } $cal = new MyCalendar(); // First, create an array of month names, January through December $chinese_months = array("一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"); // Then an array of day names, starting with Sunday $chinese_days = array("日", "一", "二", "三", "四", "五", "六"); $cal->setMonthNames($chinese_months); $cal->setDayNames($chinese_days); $cal->setStartDay(1); echo "<div class=\"item\">"; echo $cal->getCurrentMonthView(); echo "</div>"; ?> </body>