/** * Sets up initial variable values * @param string $userid id of the calendar user * @param int MyCalendarType type for this calendar * @param int $actualDate todays date */ function ResCalendar($userid = null, $type = null, $actualDate = null, $machid = null, $scheduleid = null) { $this->machid = $machid; $this->scheduleid = $scheduleid; $this->db = new ResCalendarDB(); parent::MyCalendar($userid, $type, $actualDate, false); $this->resources = $this->db->get_resources(); // Used to provide a pull down to change resources $this->schedules = $this->db->get_schedules(); // Used in resource pull down and to determine start/end/interval times if ($this->machid == null && $this->scheduleid == null) { $this->scheduleid = $this->resources[0]['scheduleid']; } $this->isresource = $this->scheduleid == null; if ($this->isresource && $this->machid == null) { $this->machid = $this->resources[0]['machid']; // If we dont have a machid from the querystring, take the first one in the list $this->scheduleid = $this->resources[0]['scheduleid']; } else { if (!$this->isresource && $this->scheduleid == null) { $this->scheduleid = $this->schedules[0]['scheduleid']; } else { if ($this->isresource && $this->machid != null) { // Set the scheduleid for this machid for ($i = 0; $i < count($this->resources); $i++) { if ($this->resources[$i]['machid'] == $this->machid) { $this->scheduleid = $this->resources[$i]['scheduleid']; $this->name = $this->resources[$i]['name']; break; } } } else { if (!$this->isresource && $this->scheduleid != null) { for ($i = 0; $i < count($this->schedules); $i++) { if ($this->schedules[$i]['scheduleid'] == $this->scheduleid) { $this->name = $this->schedules[$i]['scheduletitle']; break; } } } } } } if ($this->type != MYCALENDARTYPE_MONTH) { // Set the schedule properties (only needed for the day/week views for ($i = 0; $i < count($this->schedules); $i++) { if ($this->schedules[$i]['scheduleid'] == $this->scheduleid) { $this->starttime = $this->schedules[$i]['daystart']; $this->endtime = $this->schedules[$i]['dayend']; $this->timespan = $this->schedules[$i]['timespan']; break; } } } $this->load_reservations(); }
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(); }
} } js_include('js/calendar.js'); pageheader_mini($lang_calendar_php['title'], true); $today = getdate(); if ($superCage->get->testInt('month')) { $month = $superCage->get->getInt('month'); } else { $month = $today['mon']; } if ($superCage->get->testInt('year')) { $year = $superCage->get->getInt('year'); } else { $year = $today['year']; } $cal = new MyCalendar(); $cal->setMonthNames($lang_month); $cal->setDayNames($lang_day_of_week); $cal->setStartDay(1); echo $cal->getMonthView($month, $year, false); pagefooter_mini(); ///////////////////////////////////////////////////////////////////////////////////////// // PHP Calendar Class Version 1.4 (5th March 2001) // // Copyright David Wilkinson 2000 - 2001. All Rights reserved. // // This software may be used, modified and distributed freely // providing this copyright notice remains intact at the head // of the file. // // This software is freeware. The author accepts no liability for
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(); } }
$page->add_head_css(".PHP_calendarToday {font-size: 12px;background-color: #fffa00;}"); $page->add_head_css(".PHP_calendar {font-size: 12px;color: #3363b7;}"); $page->add_head_css(".PHP_calendarlink {color: #3363b7;text-decoration:none;}"); $page->add_head_css(".PHP_calendarHeaderWeekdays {font-size: 12px;color: #3363b7;font-weight:bold;}"); $page->add_head_css(".PHP_calendarTodayEvent {font-size: 12px;background-color: #fffa00;font-weight:bold;}"); $page->add_head_css(".PHP_calendarEvent {font-size: 12px;color: #3363b7;font-weight:bold;}"); // build the calendar class MyCalendar extends Calendar { function GetLink($date) { return "http://www.mik3.com/?date={$date}"; } function DayIsEvent($day) { // you could query a database here, instead we only return the 15 every month as a day that should be marked different $date = getdate($day); if ($date['mday'] == 15) { return true; } return false; } } if ($_REQUEST['year'] == false) { $page->add(new MyCalendar(150, mktime(), array("es", "es_ES")), html_br(2), html_a("calendartest.php?year=true", "Year view")); } else { $thing = new MyCalendar("160", mktime(), array("es", "es_ES")); $thing->ShowYear(True); $page->add($thing, html_br(2), html_a("calendartest.php", "Month view")); } print $page->render();
if (!Auth::is_logged_in()) { Auth::print_login_msg(); } $t = new Template(translate('My Calendar')); // Print HTML headers $t->printHTMLHeader(); // Print welcome box $t->printWelcome(); // Begin main table $t->startMain(); $t->startNavLinkTable(); $t->showNavLinksTable(Auth::isAdmin()); $t->endNavLinkTable(); $t->splitTable(); $type = isset($_GET['view']) ? $_GET['view'] : MYCALENDARTYPE_DAY; $calendar = new MyCalendar(Auth::getCurrentID(), $type, get_calendar_actual_date()); $calendar->print_calendar(); // End main table $t->endMain(); $timer->stop(); $timer->print_comment(); // Print HTML footer $t->printHTMLFooter(); /** * Sets the 'actualDate' field of the MyCalendar object * @param none * @return datestamp of the viewed date */ function get_calendar_actual_date() { if (isset($_GET['date'])) {
function b_weblog_calendar_show($options) { global $xoopsDB, $xoopsUser; global $xoopsConfig, $xoopsTpl; $mydirname = $options[0]; include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/include/PEAR/Date/Calc.php'; $currentuid = is_object($xoopsUser) ? $xoopsUser->getVar('uid', 'E') : 0; if (is_object($xoopsUser)) { $useroffset = $xoopsUser->timezone() - $xoopsConfig['server_TZ']; } else { $useroffset = $xoopsConfig['default_TZ'] - $xoopsConfig['server_TZ']; } // set when month $date = isset($_GET['date']) && strlen(intval($_GET['date'])) >= 6 ? intval($_GET['date']) : ''; if ($date > 0) { $month = substr($date, 0, 6); } else { $month = date('Ym', time() + $useroffset * 3600); } // get next/previous month and year $this_year = substr(strval($month), 0, 4); $this_month = substr(strval($month), 4, 6); $month_next = Date_Calc::beginOfNextMonth('1', $this_month, $this_year, $format = '%Y%m'); $month_prev = Date_Calc::beginOfPrevMonth('1', $this_month, $this_year, $format = '%Y%m'); $year_next = strval($this_year + 1) . $this_month; $year_prev = strval($this_year - 1) . $this_month; if (file_exists(XOOPS_ROOT_PATH . '/language/' . $xoopsConfig["language"] . '/calendar.php')) { require_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig["language"] . '/calendar.php'; } else { require_once XOOPS_ROOT_PATH . '/language/english/calendar.php'; } $month_arr = array(1 => _CAL_JANUARY, 2 => _CAL_FEBRUARY, 3 => _CAL_MARCH, 4 => _CAL_APRIL, 5 => _CAL_MAY, 6 => _CAL_JUNE, 7 => _CAL_JULY, 8 => _CAL_AUGUST, 9 => _CAL_SEPTEMBER, 10 => _CAL_OCTOBER, 11 => _CAL_NOVEMBER, 12 => _CAL_DECEMBER); $week_arr = array(_MB_WEBLOG_LANG_SUNDAY, _MB_WEBLOG_LANG_MONDAY, _MB_WEBLOG_LANG_TUESDAY, _MB_WEBLOG_LANG_WEDNESDAY, _MB_WEBLOG_LANG_THURSDAY, _MB_WEBLOG_LANG_FRIDAY, _MB_WEBLOG_LANG_SATURDAY); // get one month calendar array include_once XOOPS_ROOT_PATH . '/modules/' . $mydirname . '/class/class.calendar.php'; $mycalendar = new MyCalendar($month); $calendar = $mycalendar->dispCalendar(); $calendar['lang_monthPrev'] = _MB_WEBLOG_LANG_PREVMONTH; $calendar['lang_monthNext'] = _MB_WEBLOG_LANG_NEXTMONTH; $calendar['lang_yearPrev'] = _MB_WEBLOG_LANG_PREVYEAR; $calendar['lang_yearNext'] = _MB_WEBLOG_LANG_NEXTYEAR; $calendar['lang_month'] = $month_arr[intval($calendar['month'])]; $calendar['lang_ShowPrevMonth'] = _MB_WEBLOG_LANG_PREVMONTH_TITLE; $calendar['lang_ShowNextMonth'] = _MB_WEBLOG_LANG_NEXTMONTH_TITLE; $calendar['lang_ShowPrevYear'] = _MB_WEBLOG_LANG_PREVYEAR_TITLE; $calendar['lang_ShowNextYear'] = _MB_WEBLOG_LANG_NEXTYEAR_TITLE; $calendar['lang_ShowThisMonth'] = _MB_WEBLOG_LANG_THIS_MONTH_TITLE; $calendar['dayofweek'] = $week_arr; // override $calendar['monthThis'] = $this_year . $this_month; $calendar['monthPrev'] = $month_prev; $calendar['monthNext'] = $month_next; $calendar['yearPrev'] = $year_prev; $calendar['yearNext'] = $year_next; // add xoops_block_header for css file $xoops_block_header = $xoopsTpl->get_template_vars('xoops_block_header'); $xoops_block_header .= '<link rel="stylesheet" type="text/css" media="screen" href="' . XOOPS_URL . '/modules/' . $mydirname . '/weblog_block.css" />'; $xoopsTpl->assign('xoops_block_header', $xoops_block_header); if (!empty($_SERVER['QUERY_STRING'])) { if (ereg("^calMonth=[0-9]{10}\$", $_SERVER['QUERY_STRING'])) { $query_string = "?"; } else { $query_string = "?" . preg_replace("/(.*)\\&calMonth=[0-9]{10}\$/", "\$1", $_SERVER['QUERY_STRING']) . "&"; } } else { $query_string = "?"; } $calendar['action_url'] = $_SERVER['PHP_SELF'] . $query_string; // set the month $yearmonth = date('Ym', $calendar['monthThis']); $calendar['yearmonth'] = $yearmonth; // get entries of the month $sql = "select FROM_UNIXTIME(created+" . $useroffset * 3600 . ", '%d') as day, blog_id from " . $xoopsDB->prefix($mydirname); $sql .= " where (FROM_UNIXTIME(created+" . $useroffset * 3600 . ", '%Y%m') = " . $month . ") "; $sql .= " AND (private='N' or (private='Y' and user_id={$currentuid}))"; $sql .= " group by day "; $sql .= " order by day ASC"; //echo $sql ; $lines = $xoopsDB->query($sql); $entries = array(); if ($lines) { while (list($day, $blog_id) = $xoopsDB->fetchRow($lines)) { // $entries[$blog_id] = intval($day); $entries[intval($day)] = $this_year . $this_month . $day; } } else { return $block['calendar'] = $calendar; } $days = array_keys($entries); // make array of day // $counts = array_count_values($days); // make day=>count array // $entries = array_flip($entries); // make day=>blog_id array // week number of 1st day of this month $firstcol = date("w", mktime(0, 0, 0, $this_month, 1, $this_year)); // insert entry count corresponding to the day foreach ($entries as $day => $yyyymmdd) { $row = ceil(($day + $firstcol) / 7) - 1; $col = date("w", mktime(0, 0, 0, $this_month, $day, $this_year)); $calendar['details'][$row][$col] = $yyyymmdd; } // optional variables in case you replace prev and next month to the months posted any entries // prev month to show /* $sql = "select FROM_UNIXTIME(created, '%Y%m') as prevmonth from ".$xoopsDB->prefix($mydirname); $sql .= " where (private='N' or (private='Y' and user_id=$currentuid))"; $sql .= " and FROM_UNIXTIME(created, '%Y%m') < $yearmonth"; $sql .= " group by prevmonth"; $sql .= " order by prevmonth DESC"; $sql .= " limit 0, 1"; $result = $xoopsDB->query($sql); if($result) { list($calendar['prevMonthPosted']) = $xoopsDB->fetchRow($result); } else { $calendar['prevMonthPosted'] = ""; }*/ // next month to show /* if( $yearmonth < date( 'Ym', time() ) ) { $sql = "select FROM_UNIXTIME(created, '%Y%m') as nextmonth from ".$xoopsDB->prefix($mydirname); $sql .= " where (private='N' or (private='Y' and user_id=$currentuid))"; $sql .= " and FROM_UNIXTIME(created, '%Y%m') > $yearmonth"; $sql .= " group by nextmonth"; $sql .= " order by nextmonth ASC"; $sql .= " limit 0, 1"; $result = $xoopsDB->query($sql); if($result) { list($calendar['nextMonthPosted']) = $xoopsDB->fetchRow($result); } else { $calendar['nextMonthPosted'] = ""; } } else { $calendar['nextMonthPosted'] = ""; }*/ $calendar['moduledir'] = $mydirname; $calendar['calblockcss'] = 'db:' . $mydirname . '_calblock.css.html'; $calendar['user_id'] = isset($_GET['user_id']) ? intval($_GET['user_id']) : 0; $block['calendar'] = $calendar; return $block; }
<tr><td height="3" ></td></tr> <tr><td height="1" class="dotline"></td></tr> <tr><td height="3" ></td></tr> <?php } //จบการแสดงข่าวสาร ?> </table> <br><br> <img src="images/menu/textmenu_calendar.gif" border="0"><br><br> <?php // If no month/year set, use current month/year $d = getdate(time()); $month = isset($_GET['month']) ? intval($_GET['month']) : $d['mon']; $year = isset($_GET['year']) ? intval($_GET['year']) : $d['year']; $cal = new MyCalendar(); echo $cal->getMonthView($month, $year); ?> <div align=right><a href="?name=calendar">>> รายการกิจกรรมทั้งหมด</a> </div> <!-- End Left --> </td> <td width="10" valign="top"><img src="images/fader.gif"></td> <td width="460" valign="top" style="vertical-align: top;"> <img src="images/topfader.gif"><br> <img src="images/menu/textmenu_welcome.gif" border="0"> <table width=100% cellspacing="5"> <tr> <td> <?php $contents = file_get_contents('editortalk/editortalk.html'); echo stripslashes($contents);
<TD width="710" vAlign=top><IMG src="images/topfader.gif" border=0><BR> <!-- Admin --> <IMG SRC="images/menu/textmenu_admin.gif" BORDER="0"><BR> <TABLE width="700" align=center cellSpacing=0 cellPadding=0 border=0> <TR> <TD height="1" class="dotline"></TD> </TR> <TR> <TD> <BR><B><IMG SRC="images/icon/plus.gif" BORDER="0" ALIGN="absmiddle"> <A HREF="?name=admin&file=main">หน้าหลักผู้ดูแลระบบ</A> <IMG SRC="images/icon/arrow_wap.gif" BORDER="0" ALIGN="absmiddle"> ปฏิทินกิจกรรม <IMG SRC="images/icon/calendar.gif" BORDER="0" ALIGN="absmiddle"> <A HREF="popup.php?name=admin&file=addevent" onclick="return hs.htmlExpand(this, { contentId: 'highslide-html', objectType: 'iframe', objectWidth: 700, objectHeight: 500} )" class="highslide">เพิ่มรายการใหม่ </A></B> <BR><BR> <CENTER> <?php if (!isset($_GET['year'])) { $_GET['year'] = date("Y"); } $cal = new MyCalendar(); echo $cal->getYearView($_GET['year']); ?> </CENTER> <BR><BR> </TD> </TR> </TABLE> <BR><BR> <!-- Admin --> </TD> </TR> </TBODY> </TABLE>
<style type="text/css"> <!-- .calendar { width:220; background-color: #FFFFFF; } --> </style> <TABLE cellSpacing=0 cellPadding=0 width=720 border=0> <TBODY> <TR> <TD width="10" vAlign=top><IMG src="images/fader.gif" border=0></TD> <TD width="710" vAlign=top><IMG src="images/topfader.gif" border=0><BR> <!-- News --> <IMG SRC="images/menu/textmenu_calendar.gif" BORDER="0"><BR><BR> <CENTER> <?php $year = input_get('year', date("Y")); $cal = new MyCalendar(); echo $cal->getYearView($year); ?> </CENTER> <BR><BR> <!-- End News --> </TD> </TR> </TBODY> </TABLE>
} if ($month == 1 && $day == 10) { return "Yom Kippur"; } if ($month == 3 && $day == 25) { return "Chanukkah"; } if ($month == 8 && $day == 15) { return "Passover"; } // call the base class for USA holidays return parent::isHoliday($date); } } // class MyCalendar extends PDF_USA_Calendar // MyCalendar shows how to customize your calendar with Easter, some select Jewish holidays and a birthday // Supports any size paper FPDF does $pdf = new MyCalendar("L", "Letter"); // you can set margins and line width here. PDF_USA_Calendar uses the current settings. $pdf->SetMargins(7, 7); $pdf->SetAutoPageBreak(false, 0); // set fill color for non-weekend holidays $greyValue = 190; $pdf->SetFillColor($greyValue, $greyValue, $greyValue); // print the calendar for a whole year $year = gmdate("Y"); for ($month = 1; $month <= 12; ++$month) { $date = $pdf->MDYtoJD($month, 1, $year); $pdf->printMonth($date); } $pdf->Output();
<?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>
<BR> <?php $month = isset($_GET['month']); $year = isset($_GET['year']); if ($month == '') { $mon = date('m'); } else { $mon = $months; } if ($year == '') { $yea = date('Y'); } else { $yea = $years; } $cal = new MyCalendar(); echo $cal->getmonthView($mon, $yea); ?> </CENTER> <BR> </TD> </TR> <?php $db->connectdb(DB_NAME, DB_USERNAME, DB_PASSWORD); $dateday = date('Y-m-d'); $mn = date('m') + 1; $daten = date('Y-' . $mn . '-d'); $mt = date('m'); $my = date('Y'); $dd = date('d');