Source for file data.calendar.php
Documentation is available at data.calendar.php
* @subpackage plugins_data
// +----------------------------------------------------------------------+
// | Copyright (c) 2004, bitweaver.org
// +----------------------------------------------------------------------+
// | All Rights Reserved. See below for details and a complete list of authors.
// | Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
// | For comments, please use phpdocu.sourceforge.net documentation standards!!!
// | -> see http://phpdocu.sourceforge.net/
// +----------------------------------------------------------------------+
// | Author (TikiWiki): Luis Argerich <lrargerich@users.sourceforge.net>
// | Reworked for Bitweaver (& Undoubtedly Screwed-Up)
// | by: StarRider <starrrider@users.sourceforge.net>
// +----------------------------------------------------------------------+
define( 'PLUGIN_GUID_DATACALENDAR', 'datacalendar' );
'requires_pair' => FALSE,
'load_function' => 'data_calendar',
'help_page' => 'DataPluginCalendar',
'description' => tra("Displays a mini calendar that links to the calendar package."),
'syntax' => " {CALENDAR} ",
global $gBitSmarty, $gBitSystem;
if ($gBitSystem->isPackageActive('calendar')) {
$offset = $gBitSystem->get_display_offset();
$time = $bitDate->getUTCTime();
$date = $bitDate->getDate($time, true);
$month_day = $date['mday'];
$month_name = $date['month'];
// reset time so we can make today look different in template with compare
$time = $bitDate->mktime(0, 0, 0, $month, $month_day, $year);
$last_time = $bitDate->mktime(0, 0, 0, $month, 0, $year);
$next_time = $bitDate->mktime(0, 0, 0, $month + 1, 1, $year);
$last = $bitDate->getDate($last_time);
$next = $bitDate->getDate($next_time);
for ($i = 2; $i < 9; $i++ ) {
// Start from known sunday.
$timestamp = $bitDate->mktime(0, 0, 0, 1, $i, 2000);
$days[] = $bitDate->strftime('%a', $timestamp);
// Build a two-dimensional array of UNIX timestamps.
// Start with last days of previous month.
$month_begin = $bitDate->mktime(0, 0, 0, $month, 1, $year);
$month_begin_dow = strftime('%w', $month_begin);
$days_last_month = $bitDate->daysInMonth($last['month'], $last['year']);
$day = $days_last_month - $month_begin_dow + $dow;
$d['time'] = $bitDate->mktime(0, 0, 0, $month - 1, $day, $year);
$days_in_month = $bitDate->daysInMonth($month, $year);
for ($i = 1; $i <= $days_in_month; $i++ ) {
$d['time'] = $bitDate->mktime(0, 0, 0, $month, $i, $year);
for ($i = 1; $dow < 7; $i++ , $dow++ ) {
$d['time'] = $bitDate->mktime(0, 0, 0, $month + 1, $i, $year);
$gBitSmarty->assign('minical', true);
$gBitSmarty->assign('month_name', $month_name);
$gBitSmarty->assign('month', $month);
$gBitSmarty->assign('year', $year);
$gBitSmarty->assign('last_month', $last_time);
$gBitSmarty->assign('next_month', $next_time);
$gBitSmarty->assign('dow_abbrevs', $days);
$gBitSmarty->assign('calendar', $calendar);
$gBitSmarty->assign('today', $time);
if (empty($params['events'])) {
$pBaseUrl = CALENDAR_PKG_URL. 'index.php';
$pBaseUrl = EVENTS_PKG_URL. 'calendar.php';
$gBitSmarty->assign('baseCalendarUrl', $pBaseUrl);
return $gBitSmarty->fetch('bitpackage:calendar/minical.tpl');
return '<div class="error">Calendar Package Not Active</div>';
|