summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2005-08-18 19:05:05 +0000
committerMax Kremmel <xing@synapse.plus.com>2005-08-18 19:05:05 +0000
commitb4ed9bcda68a80bee15f366cb5a8a85033b8c784 (patch)
tree8da9131360bf10ee92c746b7fa740e23d31ece9c
parentc0dc92218773219fa3eb6b805ece4106e81d0902 (diff)
downloadcalendar-b4ed9bcda68a80bee15f366cb5a8a85033b8c784.tar.gz
calendar-b4ed9bcda68a80bee15f366cb5a8a85033b8c784.tar.bz2
calendar-b4ed9bcda68a80bee15f366cb5a8a85033b8c784.zip
extensive calendar work
-rw-r--r--Calendar.php509
-rw-r--r--CalendarLib.php57
-rw-r--r--admin/admin_calendar_inc.php37
-rw-r--r--admin/schema_inc.php12
-rw-r--r--index.php177
-rw-r--r--modules/mod_calendar.tpl138
-rw-r--r--templates/admin_calendar.tpl20
-rw-r--r--templates/calendar.tpl48
-rw-r--r--templates/calendar_box.tpl9
-rw-r--r--templates/menu_calendar.tpl4
-rw-r--r--templates/menu_calendar_admin.tpl5
11 files changed, 162 insertions, 854 deletions
diff --git a/Calendar.php b/Calendar.php
index 86ba5e3..0fcca7f 100644
--- a/Calendar.php
+++ b/Calendar.php
@@ -1,486 +1,87 @@
<?php
/**
- * @version $Header: /cvsroot/bitweaver/_bit_calendar/Calendar.php,v 1.2 2005/08/01 21:08:12 lsces Exp $
+ * @version $Header: /cvsroot/bitweaver/_bit_calendar/Calendar.php,v 1.3 2005/08/18 19:05:03 squareing Exp $
* @package calendar
*/
-// class_calendar.php EXTENDS: None Abstract: No.
-//
-// The calendar class provides basic functions to build calendars,
-// like validating dates, getting day of week etc...
-//
-// Constructor:
-//
-// new calendar('lan') : Language for the calendar valid options: (ar,br,en)
-// Tiki: doesn't use the language translation, the translation is done at the calling level
-//
-// Methods:
-//
-// validDate($day,$month,$year) : Returns true if date is valid.
-// validTime($hour,$minute,$second) : Returns true if time is valid.
-// isLeap($year) : true/false
-// nameOfMonth($monthnum,[$lan]) : Name of the month, language is optional.
-// daysInMonth($monthnum,$year) : Number of days in month for the given year.
-// dayOfWeek($day,$month,$year) : Day of week in 1-7 format.
-// dayOfWeekStr($day,$month,$year,[$lan]) : String representing of day of week, language optional.
-// getDisplayMatrix($day,$month,$year) : Builds a 425 (7x6) matrix where
-// representing the calendar, the actual day appears as +NN
-// buildMonthBox($name,$m) : Builds an HTML select box for months,the second argument indicates selected month
-// buildYearBox($name,$ny) : Builds a select box for years
-// buildDayOfWeekBox($name,$mul=false,$d=1): Builds a select box for days of the week, multiple selection may be allowed
-// buildDayBox($name,$d,$m,$y) : Bulds a select box for days
-// buildHourBox($name,$h) : Builds a select box for hours
-// buildMinBox($name,$h) : Builds a select box for minutes
-// buildIntBox($name,$min,$max,$inter,$def=0) : Generic Select box indicating minimum, maximum, interval and default values
-// buildIntBoxMul($name,$min,$max,$inter,$def=0,$cu=0) : Idem but allowing multiple selections
/**
* @package calendar
* @subpackage Calendar
*/
-class Calendar {
- var $lan;
+class Calendar extends LibertyContent {
- function Calendar($lan = 'ar') {
- $this->lan = $lan;
+ function Calendar() {
+ LibertyContent::LibertyContent();
}
- function validDate($d, $m, $y) {
- return checkdate($m, $d, $y);
- }
-
- function buildYearBox($name, $ny) {
- print ("<select name=\"$name\">");
-
- print ("<option value=\"$ny\">$ny</option>");
+ /**
+ * This method generates a calendar entry record which is displayed as a fly over pop-up.
+ * The Liberty items to be displayed are defined in the $bitObjects array
+ * At present no filtering is provided on $user_id
+ * It a full array of items between $tstart and $tstop
+ **/
+ function getList( $pListHash ) {
+ $ret = array();
+ include_once( LIBERTY_PKG_PATH.'LibertyContent.php' );
+ $content = new LibertyContent();
+ $content->prepGetList( $pListHash );
+ $res = $content->getContentList( $pListHash );
- for ($i = 0; $i < 10; $i++) {
- $y = $ny + $i;
-
- print ("<option value=\"$y\">$y</option>");
+ foreach( $res['data'] as $item ) {
+ $dstart = mktime( 0, 0, 0, date( "m", $item['last_modified'] ), date( "d", $item['last_modified'] ), date( "Y", $item['last_modified'] ) );
+ $ret[$dstart][] = $item;
}
- print ("</select>");
- }
+/* this version of getList doens't use liberty
- function buildMonthBox($name, $m) {
- print ("<select name=\"$name\">");
+ global $gLibertySystem, $gBitUser;
+ $ret = array();
- for ($i = 0; $i < 12; $i++) {
- $z = $i + 1;
+ if( !empty( $pListHash['bitObjects'] ) ) {
+ $order = '';
+ $bindVals[] = $pListHash['start'];
+ $bindVals[] = $pListHash['stop'];
- if ($z < 10) {
- $zst = '0' . $z;
- } else {
- $zst = $z;
+ $where = "WHERE ( `last_modified`>? AND `last_modified`<? )";
+ $where .= " AND ";
+ $and = '';
+ foreach( $pListHash['bitObjects'] as $bit ) {
+ $and .= ( empty( $and ) ? " " : " OR " )."tc.`content_type_guid`=?";
+ $bindVals[] = $bit;
}
+ $where .= " ( $and ) ";
- $name = $this->nameOfMonth($z);
-
- if ($z == $m) {
- print ("<option value=\"$zst\" selected>$name</option>");
- } else {
- print ("<option value=\"$zst\">$name</option>");
+ if( !empty( $pListHash['user_id'] ) ) {
+ $where .= " AND tc.`user_id`=?";
+ $bindVals[] = $pListHash['user_id'];
}
- }
- print ("</select>");
- }
-
- function buildDayOfWeekBox($name, $mul = false, $d = 1) {
- if ($mul) {
- $st = 'multiple size="1"';
- } else {
- $st = '';
- }
-
- print ("<select name=\"$name\" $st>");
-
- for ($i = 0; $i < 7; $i++) {
- $z = $i + 1;
-
- $dia = $this->dayOfWeekStrFromNo($z);
-
- if ($z == $d) {
- print ("<option value=\"$z\" selected>$dia</option>");
+ if( !empty( $pListHash['sort_mode'] ) ) {
+ $order .= " ORDER BY ".$this->mDb->convert_sortmode( $pListHash['sort_mode'] )." ";
} else {
- print ("<option value=\"$z\">$dia</option>");
+ $order .= " ORDER BY tc.`last_modified` ASC";
}
- }
- print ("</select>");
- }
+ $query = "SELECT tc.*,
+ uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,
+ uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name
+ FROM `".BIT_DB_PREFIX."tiki_content` tc
+ LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON ( uue.`user_id` = tc.`modifier_user_id` )
+ LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON ( uuc.`user_id` = tc.`user_id` )
+ $where $order";
+ $result = $this->mDb->query( $query, $bindVals );
- function buildDayBox($name, $d, $m, $y) {
- $cuantos = $this->daysInMonth($m, $y);
+ while( $res = $result->fetchRow() ) {
+ $aux = $res;
+ $aux['url'] = BIT_ROOT_URL.$gLibertySystem->mContentTypes[$bit]['handler_package']."/index.php?content_id=" . $res["content_id"];
+ $aux['name'] = $res["title"];
- print ("<select name=\"$name\">");
-
- for ($i = 0; $i < $cuantos; $i++) {
- $z = $i + 1;
-
- if ($z < 10) {
- $zst = '0' . $z;
- } else {
- $zst = $z;
- }
-
- if ($z == $d) {
- print ("<option value=\"$zst\" selected>$zst</option>");
- } else {
- print ("<option value=\"$zst\">$zst</option>");
+ $dstart = mktime( 0, 0, 0, date( "m", $res['last_modified'] ), date( "d", $res['last_modified'] ), date( "Y", $res['last_modified'] ) );
+ $ret[$dstart][] = $aux;
}
}
-
- print ("</select>");
- }
-
- function buildHourBox($name, $h) {
- print ("<select name=\"$name\">");
-
- for ($i = 0; $i < 24; $i++) {
- if ($i < 10) {
- $zst = '0' . $i;
- } else {
- $zst = $i;
- }
-
- if ($i == $h) {
- print ("<option value=\"$zst\" selected>$zst</option>");
- } else {
- print ("<option value=\"$zst\">$zst</option>");
- }
- }
-
- print ("</select>");
- }
-
- function buildMinBox($name, $m) {
- print ("<select name=\"$name\">");
-
- for ($i = 0; $i < 60; $i++) {
- if ($i < 10) {
- $zst = '0' . $i;
- } else {
- $zst = $i;
- }
-
- if ($i == $m) {
- print ("<option value=\"$zst\" selected>$zst</option>");
- } else {
- print ("<option value=\"$zst\">$zst</option>");
- }
- }
-
- print ("</select>");
- }
-
- function buildMinBoxI($name, $m = 60) {
- print ("<select name=\"$name\">");
-
- for ($i = 5; $i < 66; $i += 5) {
- if ($i < 10) {
- $zst = '0' . $i;
- } else {
- $zst = $i;
- }
-
- if ($i == $m) {
- print ("<option value=\"$zst\" selected>$zst</option>");
- } else {
- print ("<option value=\"$zst\">$zst</option>");
- }
- }
-
- print ("</select>");
- }
-
- function buildIntBox($name, $min, $max, $inter, $def = 0) {
- print ("<select name=\"$name\">");
-
- for ($i = $min; $i <= $max; $i += $inter) {
- if ($i < 10) {
- $zst = '0' . $i;
- } else {
- $zst = $i;
- }
-
- if ($i == $def) {
- print ("<option value=\"$zst\" selected>$zst</option>");
- } else {
- print ("<option value=\"$zst\">$zst</option>");
- }
- }
-
- print ("</select>");
- }
-
- function buildIntBoxMul($name, $min, $max, $inter, $def = 0, $cu = 0) {
- print ("<select name=\"$name\" multiple size=\"$cu\">");
-
- for ($i = $min; $i <= $max; $i += $inter) {
- if ($i < 10) {
- $zst = '0' . $i;
- } else {
- $zst = $i;
- }
-
- if ($i == $def) {
- print ("<option value=\"$zst\" selected>$zst</option>");
- } else {
- print ("<option value=\"$zst\">$zst</option>");
- }
- }
-
- print ("</select>");
- }
-
- function getDisplayMatrix($d, $m, $y) {
- $dw = $this->dayOfWeek(1, $m, $y);
-
- $cu = $this->daysInMonth($m, $y);
- $hd = date('d');
- $hm = date('m');
- $hy = date('Y');
-
- //Inicializo la matriz horrible...
- for ($i = 0; $i < 42; $i++) {
- $mat[$i] = ' ';
- }
-
- for ($j = 0; $j < $cu; $j++) {
- $v = $j + 1;
-
- $mat[$j + ($dw - 1)] = "$v";
-
- if ($hm == $m && $hy == $y && $hd == $v) {
- $mat[$j + ($dw - 1)] = '+' . $mat[$j + ($dw - 1)] . '';
- }
- }
-
- return $mat;
- }
-
- function getPureMatrix($d, $m, $y) {
- $dw = $this->dayOfWeek(1, $m, $y);
-
- $cu = $this->daysInMonth($m, $y);
-
- //Inicializo la matriz horrible...
- for ($i = 0; $i < 42; $i++) {
- $mat[$i] = ' ';
- }
-
- for ($j = 0; $j < $cu; $j++) {
- $v = $j + 1;
-
- $mat[$j + ($dw - 1)] = "$v";
- }
-
- return $mat;
- }
-
- function validTime($h, $m, $s) {
- return (($h <= 24) && ($h >= 0) && ($m <= 60) && ($m >= 0) && ($s >= 0) && ($s <= 60));
- }
-
- // Returns true if the given year is 'leap' false if not. Year MUST use 4 digits!
- function isLeap($year) {
- if (($year % 4 == 0) && (($year % 100 <> 0) || ($year % 400 == 0))) {
- return true;
- } else {
- return false;
- }
- }
-
- // Returns the name of month in the given language.
- function nameOfMonth($month, $lan = false) {
- $month = ceil($month);
-
- if (!$lan) {
- $lan = $this->lan;
- }
-
- $ar = array(
- '',
- 'Enero',
- 'Febrero',
- 'Marzo',
- 'Abril',
- 'Mayo',
- 'Junio',
- 'Julio',
- 'Agosto',
- 'Setiembre',
- 'Octubre',
- 'Noviembre',
- 'Diciembre'
- );
-
- $br = array(
- '',
- 'Janeiro',
- 'Fevereiro',
- 'Maro',
- 'Abril',
- 'Junho',
- 'Julho',
- 'Agosto',
- 'Stembro',
- 'Outubro',
- 'Novembro',
- 'Dezembro'
- );
-
- $en = array(
- '',
- 'January',
- 'February',
- 'March',
- 'April',
- 'May',
- 'June',
- 'July',
- 'August',
- 'September',
- 'October',
- 'November',
- 'December'
- );
-
- $coso = ${$lan}[$month];
- return ${$lan}[$month];
- }
-
- // Returns the number of days in the given month for a give 4 DIGITS year.
- function daysInMonth($month, $year) {
- if (substr($month, 0, 1) == '0') {
- $month = substr($month, 1, 1);
- }
-
- $vec = array(
- 0,
- 31,
- 28,
- 31,
- 30,
- 31,
- 30,
- 31,
- 31,
- 30,
- 31,
- 30,
- 31
- );
-
- if ($this->isLeap($year)) {
- $vec[2] += 1;
- }
-
- return $vec[$month];
- }
-
- // Returns the day of week for the passed date. 1=Sun,2=Mon,...,7=Sat
- function dayOfWeek($dia, $mes, $anio) {
- $u = mktime(10, 1, 1, $mes, $dia, $anio);
-
- $w = date('w', $u);
- return $w + 1;
- }
-
- function dayOfWeekStrFromNo($x, $lan = false) {
- if (!$lan) {
- $lan = $this->lan;
- }
-
- $ar = array(
- '',
- 'Domingo',
- 'Lunes',
- 'Martes',
- 'Miercoles',
- 'Jueves',
- 'Viernes',
- 'Sabado'
- );
-
- $en = array(
- '',
- 'Sunday',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday'
- );
-
- $br = array(
- '',
- 'Domingo',
- 'Segunda-feira',
- 'Tera-feira',
- 'Quarta-feira',
- 'Quinta-feira',
- 'Sexta-feira',
- 'Sbado'
- );
-
- return ${$lan}[$x];
- }
-
- // Returns the day_of_week in the language choosen.
- function dayOfWeekStr($dia, $mes, $anio, $lan = false) {
- if (!$lan) {
- $lan = $this->lan;
- }
-
- $ar = array(
- '',
- 'Domingo',
- 'Lunes',
- 'Martes',
- 'Miercoles',
- 'Jueves',
- 'Viernes',
- 'Sabado'
- );
-
- $en = array(
- '',
- 'Sunday',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday'
- );
-
- $br = array(
- '',
- 'Domingo',
- 'Segunda-feira',
- 'Tera-feira',
- 'Quarta-feira',
- 'Quinta-feira',
- 'Sexta-feira',
- 'Sbado'
- );
-
- $w = $this->dayOfWeek($dia, $mes, $anio);
- return ${$lan}[$w];
+*/
+ return $ret;
}
}
-
?>
-
-<?php
-
-// example
-//$c=new calendar('en');
-//$x=$c->day_of_week_str(2,3,2000,'po');
-//print("$x\n");
-//''
-
-?> \ No newline at end of file
diff --git a/CalendarLib.php b/CalendarLib.php
deleted file mode 100644
index ff68b9a..0000000
--- a/CalendarLib.php
+++ /dev/null
@@ -1,57 +0,0 @@
-<?php
-/**
- * @version $Header: /cvsroot/bitweaver/_bit_calendar/Attic/CalendarLib.php,v 1.6 2005/08/18 11:37:11 squareing Exp $
- * @package calendar
- */
-
-/**
- * @package calendar
- * @subpackage CalendarLib
- */
-class CalendarLib extends LibertyContent {
-
- function CalendarLib() {
- LibertyContent::LibertyContent();
- }
-
- /**
- * This method generates a calendar entry record which is displayed as a fly over pop-up.
- * The Liberty items to be displayed are defined in the $bitobj array
- * At present no filtering is provided on $user_id
- * It a full array of items between $tstart and $tstop
- **/
- function getList($bitobj, $user_id, $tstart, $tstop, $offset, $maxRecords, $sort_mode, $find) {
- global $gLibertySystem, $gBitUser;
- $ret = array();
-
- $res = $dstart = '';
-
- foreach( $bitobj as $bit ) {
- $query = "SELECT tc.*,
- uue.`login` AS modifier_user, uue.`real_name` AS modifier_real_name,
- uuc.`login` AS creator_user, uuc.`real_name` AS creator_real_name
- FROM `".BIT_DB_PREFIX."tiki_content` tc
- LEFT JOIN `".BIT_DB_PREFIX."users_users` uue ON ( uue.`user_id` = tc.`modifier_user_id` )
- LEFT JOIN `".BIT_DB_PREFIX."users_users` uuc ON ( uuc.`user_id` = tc.`user_id` )
- WHERE (`last_modified`>? AND `last_modified`<?) AND `content_type_guid` = ?
- ORDER BY tc.`last_modified`";
- $result = $this->mDb->query( $query, array( $tstart, $tstop, $bit ) );
-
- while( $res = $result->fetchRow() ) {
- $dstart = mktime(0, 0, 0, date("m", $res['last_modified']), date("d", $res['last_modified']), date("Y", $res['last_modified']));
- $tstart = date("Hi", $res["last_modified"]);
-
- $aux = $res;
- $aux['calname'] = "";
- $aux['prio'] = "";
- $aux['time'] = $tstart;
- $aux['type'] = $bit;
- $aux['url'] = BIT_ROOT_URL.$gLibertySystem->mContentTypes[$bit]['handler_package']."/index.php?content_id=" . $res["content_id"];
- $aux['name'] = $res["title"];
- $ret[$dstart][] = $aux;
- }
- }
- return $ret;
- }
-}
-?>
diff --git a/admin/admin_calendar_inc.php b/admin/admin_calendar_inc.php
deleted file mode 100644
index d229bd4..0000000
--- a/admin/admin_calendar_inc.php
+++ /dev/null
@@ -1,37 +0,0 @@
-<?php
-
-// $Header: /cvsroot/bitweaver/_bit_calendar/admin/admin_calendar_inc.php,v 1.4 2005/07/30 12:00:32 lsces Exp $
-
-// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
-// All Rights Reserved. See copyright.txt for details and a complete list of authors.
-// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
-
-include_once( CALENDAR_PKG_PATH.'CalendarLib.php' );
-
-$formCalendarFeatures = array(
- "calendar_blogs" => array(
- 'label' => 'Display blog updates',
- ),
- "calendar_users" => array(
- 'label' => 'Display user personal page updates',
- ),
- "calendar_wiki" => array(
- 'label' => 'Display wiki page updates',
- ),
- "calendar_contact" => array(
- 'label' => 'Display contact record updates',
- ),
- "feature_jscalendar" => array(
- 'label' => 'Enable jscalendar popup',
- ),
-);
-$gBitSmarty->assign( 'formCalendarFeatures',$formCalendarFeatures );
-
-if (isset($_REQUEST["calendarfeatures"])) {
-
- foreach( $formCalendarFeatures as $item => $data ) {
- simple_set_toggle( $item );
- }
-}
-
-?>
diff --git a/admin/schema_inc.php b/admin/schema_inc.php
index f1acc9e..e099326 100644
--- a/admin/schema_inc.php
+++ b/admin/schema_inc.php
@@ -1,25 +1,15 @@
<?php
global $gBitInstaller;
-$gBitInstaller->makePackageHomeable('calendar');
+$gBitInstaller->makePackageHomeable( 'calendar' );
$gBitInstaller->registerPackageInfo( CALENDAR_PKG_NAME, array(
'description' => "Calendar package to display bitweaver entries by date, and set events",
'license' => '<a href="http://www.gnu.org/licenses/licenses.html#LGPL">LGPL</a>',
) );
-// ### Defaults
-
// ### Default User Permissions
$gBitInstaller->registerUserPermissions( CALENDAR_PKG_NAME, array(
array('bit_p_view_calendar', 'Can browse the calendar', 'basic', CALENDAR_PKG_NAME),
) );
-
-// ### Default Preferences
-$gBitInstaller->registerPreferences( CALENDAR_PKG_NAME, array(
- array (CALENDAR_PKG_NAME, 'calendar_blogs', 'y'),
- array (CALENDAR_PKG_NAME, 'calendar_users', 'y'),
- array (CALENDAR_PKG_NAME, 'calendar_wiki', 'y')
-) );
-
?>
diff --git a/index.php b/index.php
index 8cc6b30..46f3855 100644
--- a/index.php
+++ b/index.php
@@ -1,56 +1,46 @@
<?php
-// $Header: /cvsroot/bitweaver/_bit_calendar/index.php,v 1.9 2005/08/18 11:37:11 squareing Exp $
+// $Header: /cvsroot/bitweaver/_bit_calendar/index.php,v 1.10 2005/08/18 19:05:03 squareing Exp $
// Copyright (c) 2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
require_once( '../bit_setup_inc.php' );
-include_once( CALENDAR_PKG_PATH.'CalendarLib.php' );
+include_once( CALENDAR_PKG_PATH.'Calendar.php' );
-# perms are
-# $bit_p_view_calendar
-# $bit_p_admin_calendar
-# $bit_p_change_events
-# $bit_p_add_events
-$gBitSystem->isPackageActive('calendar', TRUE);
+$gBitSystem->isPackageActive( 'calendar', TRUE );
-$bufid = array();
-$bufdata = array();
-$modifiable = array();
+$gBitSystem->verifyPermission( 'bit_p_view_calendar' );
-$calendarlib = new CalendarLib();
+$Calendar = new Calendar();
// setup list of bit items displayed
if (isset($_REQUEST["bitcals"])and is_array($_REQUEST["bitcals"])and count($_REQUEST["bitcals"])) {
- $_SESSION['CalendarViewBitCals'] = $_REQUEST["bitcals"];
-} elseif (!isset($_SESSION['CalendarViewBitCals'])) {
- $_SESSION['CalendarViewBitCals'] = array();
+ $_SESSION['calendarContentGuids'] = $_REQUEST["bitcals"];
+} elseif (!isset($_SESSION['calendarContentGuids'])) {
+ $_SESSION['calendarContentGuids'] = array();
} elseif (isset($_REQUEST["refresh"])and !isset($_REQUEST["bitcals"])) {
- $_SESSION['CalendarViewBitCals'] = array();
+ $_SESSION['calendarContentGuids'] = array();
}
// this should be a global array generated by the some object in the kernel
-$bitItems = $gLibertySystem->mContentTypes;
-$gBitSmarty->assign('bitItems', $bitItems);
+$gBitSmarty->assign( 'bitItems', $bitItems = $gLibertySystem->mContentTypes );
$bitcal = array();
-foreach ($_SESSION['CalendarViewBitCals'] as $calt) {
- $bitcal["$calt"] = 1;
+foreach ($_SESSION['calendarContentGuids'] as $calt) {
+ $bitcal[$calt] = 1;
}
-
-$trunc = "12"; // put in a pref, number of chars displayed in cal cells
$gBitSmarty->assign('bitcal', $bitcal);
if (isset($_REQUEST["todate"]) && $_REQUEST['todate']) {
- $_SESSION['CalendarFocusDate'] = $_REQUEST['todate'];
-} elseif (isset($_SESSION['CalendarFocusDate']) && $_SESSION['CalendarFocusDate']) {
- $_REQUEST["todate"] = $_SESSION['CalendarFocusDate'];
+ $_SESSION['calendar_focus_date'] = $_REQUEST['todate'];
+} elseif (isset($_SESSION['calendar_focus_date']) && $_SESSION['calendar_focus_date']) {
+ $_REQUEST["todate"] = $_SESSION['calendar_focus_date'];
} else {
- $_SESSION['CalendarFocusDate'] = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
- $_REQUEST["todate"] = $_SESSION['CalendarFocusDate'];
+ $_SESSION['calendar_focus_date'] = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
+ $_REQUEST["todate"] = $_SESSION['calendar_focus_date'];
}
$focusdate = $_REQUEST['todate'];
@@ -62,52 +52,41 @@ list($focus_day, $focus_month, $focus_year) = array(
$focusdate = mktime(0,0,0,$focus_month,$focus_day,$focus_year);
if (isset($_REQUEST["viewmode"]) and $_REQUEST["viewmode"]) {
- $_SESSION['CalendarViewMode'] = $_REQUEST["viewmode"];
+ $_SESSION['calendar_view_mode'] = $_REQUEST["viewmode"];
}
-if (!isset($_SESSION['CalendarViewMode']) or !$_SESSION['CalendarViewMode']) {
- $_SESSION['CalendarViewMode'] = 'month';
+if (!isset($_SESSION['calendar_view_mode']) or !$_SESSION['calendar_view_mode']) {
+ $_SESSION['calendar_view_mode'] = 'month';
}
-$gBitSmarty->assign('viewmode', $_SESSION['CalendarViewMode']);
+$gBitSmarty->assign('viewmode', $_SESSION['calendar_view_mode']);
if (isset($_REQUEST["find"])) {
$find = $_REQUEST["find"];
} else {
$find = '';
}
-
$gBitSmarty->assign('find', $find);
$z = date("z");
-$focus_prevday = mktime(0, 0, 0, $focus_month, $focus_day - 1, $focus_year);
-$focus_nextday = mktime(0, 0, 0, $focus_month, $focus_day + 1, $focus_year);
-$focus_prevweek = mktime(0, 0, 0, $focus_month, $focus_day - 7, $focus_year);
-$focus_nextweek = mktime(0, 0, 0, $focus_month, $focus_day + 7, $focus_year);
-$focus_prevmonth = mktime(0, 0, 0, $focus_month - 1, $focus_day, $focus_year);
-$focus_nextmonth = mktime(0, 0, 0, $focus_month + 1, $focus_day, $focus_year);
+$gBitSmarty->assign('daybefore', mktime( 0, 0, 0, $focus_month, $focus_day - 1, $focus_year ) );
+$gBitSmarty->assign('weekbefore', mktime( 0, 0, 0, $focus_month, $focus_day - 7, $focus_year ) );
+$gBitSmarty->assign('monthbefore', mktime( 0, 0, 0, $focus_month - 1, $focus_day, $focus_year ) );
+$gBitSmarty->assign('dayafter', mktime( 0, 0, 0, $focus_month, $focus_day + 1, $focus_year ) );
+$gBitSmarty->assign('weekafter', mktime( 0, 0, 0, $focus_month, $focus_day + 7, $focus_year ) );
+$gBitSmarty->assign('monthafter', mktime( 0, 0, 0, $focus_month + 1, $focus_day, $focus_year ) );
+$gBitSmarty->assign('focusmonth', $focus_month );
+$gBitSmarty->assign('focusdate', $focusdate );
+$gBitSmarty->assign('now', mktime( 0, 0, 0, date('m'), date('d'), date('Y') ) );
-$gBitSmarty->assign('daybefore', $focus_prevday);
-$gBitSmarty->assign('weekbefore', $focus_prevweek);
-$gBitSmarty->assign('monthbefore', $focus_prevmonth);
-$gBitSmarty->assign('dayafter', $focus_nextday);
-$gBitSmarty->assign('weekafter', $focus_nextweek);
-$gBitSmarty->assign('monthafter', $focus_nextmonth);
-$gBitSmarty->assign('focusmonth', $focus_month);
-$gBitSmarty->assign('focusdate', $focusdate);
-$gBitSmarty->assign('now', mktime(0, 0, 0, date('m'), date('d'), date('Y')));
-
-$weekdays = range(0, 6);
+$weekdays = range( 0, 6 );
$d = 60 * 60 * 24;
$currentweek = date("W", $focusdate);
$wd = date('w', $focusdate);
-#if ($wd == 0) $w = 7;
-#$wd--;
-
// calculate timespan for sql query
-if ($_SESSION['CalendarViewMode'] == 'month') {
+if ($_SESSION['calendar_view_mode'] == 'month') {
$viewstart = mktime(0,0,0,$focus_month, 1, $focus_year);
$TmpWeekday = date("w",$viewstart);
// move viewstart back to Sunday....
@@ -128,7 +107,7 @@ if ($_SESSION['CalendarViewMode'] == 'month') {
}
}
$numberofweeks = $lastweek - $firstweek;
-} elseif ($_SESSION['CalendarViewMode'] == 'week') {
+} elseif ($_SESSION['calendar_view_mode'] == 'week') {
$firstweek = $currentweek;
$lastweek = $currentweek;
// start by putting $viewstart at midnight starting focusdate
@@ -151,11 +130,10 @@ if ($_SESSION['CalendarViewMode'] == 'month') {
// [2004/01/05:rpg]
function m_weeks($y, $m){
// monthday array
- $monthdays = array(1=>31, 3=>31, 4=>30, 5=>31, 6=>30,7=>31,
- 8=>31, 9=>30, 10=>31, 11=>30, 12=>31);
+ $monthdays = array( 1=>31, 3=>31, 4=>30, 5=>31, 6=>30, 7=>31, 8=>31, 9=>30, 10=>31, 11=>30, 12=>31 );
// weekdays remaining in a week starting on 7 - Sunday...(could be changed)
- $weekdays = array(7=>7, 1=>6, 2=>5, 3=>4, 4=>3, 5=>2, 6=>1);
- $date = mktime( 0, 0, 0, $m, 1, $y);
+ $weekdays = array( 7=>7, 1=>6, 2=>5, 3=>4, 4=>3, 5=>2, 6=>1 );
+ $date = mktime( 0, 0, 0, $m, 1, $y );
$leap = date("L", $date);
// if it is a leap year set February to 29 days, otherwise 28
$monthdays[2] = ($leap ? 29 : 28);
@@ -165,43 +143,48 @@ function m_weeks($y, $m){
return (ceil($days/7)+1);
}
-
-$gBitSmarty->assign('viewstart', $viewstart);
-$gBitSmarty->assign('viewend', $viewend);
-$gBitSmarty->assign('numberofweeks', $numberofweeks);
+$gBitSmarty->assign( 'viewstart', $viewstart );
+$gBitSmarty->assign( 'viewend', $viewend );
+$gBitSmarty->assign( 'numberofweeks', $numberofweeks );
$daysnames = array(
- tra("Sunday"),
- tra("Monday"),
- tra("Tuesday"),
- tra("Wednesday"),
- tra("Thursday"),
- tra("Friday"),
- tra("Saturday")
+ tra( "Sunday" ),
+ tra( "Monday" ),
+ tra( "Tuesday" ),
+ tra( "Wednesday" ),
+ tra( "Thursday" ),
+ tra( "Friday" ),
+ tra( "Saturday" )
);
$weeks = array();
$cell = array();
-if ($_SESSION['CalendarViewBitCals']) {
- $listbitevents = $calendarlib->getList($_SESSION['CalendarViewBitCals'], $gBitUser->mUserId, $viewstart, $viewend, 0, 50, 'name_desc', '');
+if ($_SESSION['calendarContentGuids']) {
+ $listHash = array(
+ 'content_type_guid' => $_SESSION['calendarContentGuids'],
+ 'user_id' => !empty( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : NULL,
+ 'start' => $viewstart,
+ 'stop' => $viewend,
+ 'sort_mode' => !empty( $_REQUEST['sort_mode'] ) ? $_REQUEST['sort_mode'] : 'last_modified_asc',
+ 'offset' => 0,
+ 'max_records' => 500,
+ );
+ $listbitevents = $Calendar->getList( $listHash );
} else {
$listbitevents = array();
}
-define("weekInSeconds", 604800);
// note that number of weeks starts at ZERO (i.e., zero = 1 week to display).
-for ($i = 0; $i <= $numberofweeks; $i++) {
- $wee = $firstweek + $i;
-
- $weeks[] = $wee;
+for( $i = 0; $i <= $numberofweeks; $i++ ) {
+ $weeks[] = $firstweek + $i;
// $startOfWeek is a unix timestamp
- $startOfWeek = $viewstart + $i * weekInSeconds;
+ $startOfWeek = $viewstart + $i * 604800; // one week
- foreach ($weekdays as $w) {
+ foreach( $weekdays as $w ) {
$leday = array();
- if ($_SESSION['CalendarViewMode'] == 'day') {
+ if( $_SESSION['calendar_view_mode'] == 'day' ) {
$dday = $startOfWeek;
} else {
$dday = $startOfWeek + $d * $w;
@@ -209,25 +192,13 @@ for ($i = 0; $i <= $numberofweeks; $i++) {
$cell[$i][$w]['day'] = $dday;
- if (isset($listevents["$dday"])) {
- $e = 0;
-
- foreach ($listevents["$dday"] as $le) {
- $leday["{$le['time']}$e"] = $le;
- $leday["{$le['time']}$e"]["over"] = $gBitSmarty->fetch("bitpackage:calendar/calendar_box.tpl");
- $gBitSmarty->assign( 'cellHash', $le );
- $e++;
- }
- }
-
- if (isset($listbitevents["$dday"])) {
- $e = 0;
-
- foreach ($listbitevents["$dday"] as $lte) {
- $leday["{$lte['time']}$e"] = $lte;
- $leday["{$lte['time']}$e"]["over"] = $gBitSmarty->fetch("bitpackage:calendar/calendar_box.tpl");
- $gBitSmarty->assign( 'cellHash', $lte );
- $e++;
+ if( isset( $listbitevents[$dday] ) ) {
+ $event = 0;
+ foreach ($listbitevents["$dday"] as $bitevent) {
+ $leday["{$bitevent['last_modified']}$event"] = $bitevent;
+ $gBitSmarty->assign( 'cellHash', $bitevent );
+ $leday["{$bitevent['last_modified']}$event"]["over"] = $gBitSmarty->fetch("bitpackage:calendar/calendar_box.tpl");
+ $event++;
}
}
@@ -239,7 +210,7 @@ for ($i = 0; $i <= $numberofweeks; $i++) {
}
$hrows = array();
-if ($_SESSION['CalendarViewMode'] == 'day') {
+if ($_SESSION['calendar_view_mode'] == 'day') {
foreach ($cell[0]["{$weekdays[0]}"]['items'] as $dayitems) {
$rawhour = substr($dayitems['time'],0,2);
$dayitems['mins'] = substr($dayitems['time'],2);
@@ -252,8 +223,7 @@ $hours = array( '0:00', '1:00', '2:00', '3:00', '4:00', '5:00', '6:00', '7:00',
$gBitSmarty->assign('hrows', $hrows);
$gBitSmarty->assign('hours', $hours);
-
-$gBitSmarty->assign('trunc', $trunc);
+$gBitSmarty->assign('trunc', 12); // put in a pref, number of chars displayed in cal cells
$gBitSmarty->assign('daformat', $gBitSystem->get_long_date_format()." ".tra("at")." %H:%M");
$gBitSmarty->assign('daformat2', $gBitSystem->get_long_date_format());
$gBitSmarty->assign('currentweek', $currentweek);
@@ -265,10 +235,5 @@ $gBitSmarty->assign('daysnames', $daysnames);
$gBitSmarty->assign('cell', $cell);
$gBitSmarty->assign('var', '');
-$section = 'calendar';
-
-
$gBitSystem->display( 'bitpackage:calendar/calendar.tpl');
-
-//echo "<pre>";print_r($cell);echo "</pre>";
?>
diff --git a/modules/mod_calendar.tpl b/modules/mod_calendar.tpl
deleted file mode 100644
index ef2f952..0000000
--- a/modules/mod_calendar.tpl
+++ /dev/null
@@ -1,138 +0,0 @@
-{* $Header: /cvsroot/bitweaver/_bit_calendar/modules/mod_calendar.tpl,v 1.3 2005/07/21 12:01:57 lsces Exp $ *}
-
-{php}
-include_once( CALENDAR_PKG_PATH."Calendar.php");
-global $gBitSystem;
-if(isset($_SESSION["thedate"])) {
- $day=date("d",$_SESSION["thedate"]);
- $mon=date("m",$_SESSION["thedate"]);
- $year=date("Y",$_SESSION["thedate"]);
-} else {
- $day=date( "d", $gBitSystem->server_time_to_site_time( time() ) );
- $mon=date( "m", $gBitSystem->server_time_to_site_time( time() ) );
- $year=date( "Y", $gBitSystem->server_time_to_site_time( time() ) );
-}
-if(isset($_REQUEST["day"])) {
- $day = $_REQUEST["day"];
-}
-
-if(isset($_REQUEST["mon"])) {
- $mon = $_REQUEST["mon"];
-}
-
-if(isset($_REQUEST["year"])) {
- $year = $_REQUEST["year"];
-}
-
-$thedate = mktime(23,59,59,$mon,$day,$year);
-$_SESSION["thedate"] = $thedate;
-
-// Calculate number of days in month
-// The format is S M T W T F S
-$c = new Calendar("en");
-$v = mb_substr(tra($c->nameOfMonth($mon)),0,3);
-$dayofweek = tra($c->dayOfWeekStr($day,$mon,$year));
-if (false) { // to have the months collected by get_strings.php
- tra("January"); tra("February"); tra("March"); tra("April"); tra("May");tra("June"); tra("July"); tra("August"); tra("September"); tra("October"); tra("November"); tra("December" );
-}
-
-$parsed = parse_url($_SERVER["REQUEST_URI"]);
-if (!isset($parsed["query"])) {
- $parsed["query"]='';
-}
-parse_str($parsed["query"],$query);
-unset($query["day"]);
-unset($query["mon"]);
-unset($query["year"]);
-$father = CALENDAR_PKG_URL.'index.php';
-{* $parsed["path"]; *}
-if (count($query)>0) {
- $first=1;
- foreach ($query as $name => $val) {
- if ($first) {
- $first=false;
- $father.='?'.$name.'='.$val;
- } else {
- $father.='&amp;'.$name.'='.$val;
- }
- }
- $father.='&amp;';
-} else {
- $father.='?';
-}
-
-if (!strstr($father,"?")) {
- $todaylink=$father."day=".date("d")."&amp;mon=".date("m")."&amp;year=".date("Y");
-} else {
- $todaylink=$father."day=".date("d")."&amp;mon=".date("m")."&amp;year=".date("Y");
-}
-{/php}
-
-{bitmodule title="$moduleTitle" name="calendar"}
- <!-- THIS ROW DISPLAYS THE YEAR AND MONTH -->
- <div class="navigation">
-{php}
- $mong=$mon-1;
- $url="$father"."day=$day&amp;mon=$mong&amp;year=$year";
- print( "<a href=\"".$url."\"> &laquo; </a>" );
- print( $v );
- $mong=$mon+1;
- $url="$father"."day=$day&amp;mon=$mong&amp;year=$year";
- print( "<a href=\"".$url."\"> &raquo; </a>" );
- print( "&nbsp;" );
- $mong=$year-1;
- $url="$father"."day=$day&amp;mon=$mon&amp;year=$mong";
- print( "<a href=\"".$url."\"> &laquo; </a>" );
- print( $year );
- $mong=$year+1;
- $url="$father"."day=$day&amp;mon=$mon&amp;year=$mong";
- print( "<a href=\"".$url."\"> &raquo; </a>" );
-{/php}
- </div>
-{php}
- $mat = $c->getDisplayMatrix($day,$mon,$year);
- $pmat = $c->getPureMatrix($day,$mon,$year);
-{/php}
- <table class="mother">
- <!-- DAYS OF THE WEEK -->
- <tr>
-{php}
- for ($i=0;$i<7;$i++) {
- $dayW = tra($c->dayOfWeekStrFromNo($i+1));
- $dayp = mb_substr($dayW,0,1);
- print("<th>$dayp</th>");
- }
-{/php}
- </tr>
- <!-- TRs WITH DAYS -->
-{php}
- for ($i=0;$i<6;$i++) {
- print("<tr>");
- for ($j=0;$j<7;$j++) {
- $in = $i*7+$j;
- $pval = $pmat[$in];
- $val = $mat[$in];
- if (substr($val,0,1)=='+') {
- $val = substr($val,1,strlen($val)-1);
- $classval = "class=\"highlight\"";
- } else {
- $classval = "";
- }
- if ($val != " ") {
- print( "<td>" );
- $url = $father."day=$pval&amp;mon=$mon&amp;year=$year";
- print( "<a $classval href=\"$url\">$val</a></td>");
- } else {
- print( "<td>&nbsp;</td>" );
- }
- }
- print("</tr>");
- }
-{/php}
- </table>
- <div class="navigation">
-{php}
- print( "<a href=\"".$todaylink."\">".tra("Today")."</a>" );
-{/php}
- </div>
-{/bitmodule}
diff --git a/templates/admin_calendar.tpl b/templates/admin_calendar.tpl
deleted file mode 100644
index 85db676..0000000
--- a/templates/admin_calendar.tpl
+++ /dev/null
@@ -1,20 +0,0 @@
-{strip}
-{form legend="Calendar Features"}
- <input type="hidden" name="page" value="{$page}" />
-
- {foreach from=$formCalendarFeatures key=item item=output}
- <div class="row">
- {formlabel label=`$output.label` for=$item}
- {forminput}
- {html_checkboxes name="$item" values="y" checked=`$gBitSystemPrefs.$item` labels=false id=$item}
- {/forminput}
- {formhelp note=`$output.help` page=`$output.page`}
- </div>
- {/foreach}
-
- <div class="row submit">
- <input type="submit" name="calendarfeatures" value="{tr}Change preferences{/tr}" />
- </div>
-{/form}
-
-{/strip} \ No newline at end of file
diff --git a/templates/calendar.tpl b/templates/calendar.tpl
index a22e317..0570a3f 100644
--- a/templates/calendar.tpl
+++ b/templates/calendar.tpl
@@ -1,4 +1,4 @@
-{* $Header: /cvsroot/bitweaver/_bit_calendar/templates/calendar.tpl,v 1.7 2005/08/18 11:37:11 squareing Exp $ *}
+{* $Header: /cvsroot/bitweaver/_bit_calendar/templates/calendar.tpl,v 1.8 2005/08/18 19:05:05 squareing Exp $ *}
{strip}
{if !$gBitSystem->isFeatureActive( 'feature_helppopup' )}
@@ -13,10 +13,24 @@
<div class="body">
{/strip}
- <script type="text/javascript">//<![CDATA[
- document.write("<a href=\"javascript:toggle('tabcal');\">{tr}Display Options{/tr}</a>");
- document.write("<div id=\"tabcal\" style=\"display:{if $smarty.cookies.tabcal eq 'o'}block{else}none{/if};\">");
- //]]></script>
+ <div class="navbar">
+ <ul>
+ <script type="text/javascript">//<![CDATA[
+ document.write("<li><a href=\"javascript:toggle('tabcal');\">{tr}Show / Hide Options{/tr}</a></li>");
+ //]]></script>
+ {if $smarty.request.user_id}
+ <li>{smartlink ititle="Show all"}</li>
+ {else}
+ <li>{smartlink ititle="Show only my items" user_id=$gBitUser->mUserId}</li>
+ {/if}
+ </ul>
+ </div>
+
+ <div class="clear"></div>
+
+ <script type="text/javascript">//<![CDATA[
+ document.write("<div id=\"tabcal\" style=\"display:{if $smarty.cookies.tabcal eq 'o'}block{else}none{/if};\">");
+ //]]></script>
{form legend="Display Options" id="display_options"}
<div class="row">
@@ -37,9 +51,9 @@
</div>
{/form}
- <script type="text/javascript">//<![CDATA[
- document.write("</div>");
- //]]></script>
+ <script type="text/javascript">//<![CDATA[
+ document.write("</div>");
+ //]]></script>
{strip}
{if $gBitSystemPrefs.feature_jscalendar eq 'y'}
@@ -86,7 +100,7 @@
</td>
<td style="text-align:center;">
- <a href="{$gBitLoc.CALENDAR_PKG_URL}index.php?todate={$now}" title="{$now|bit_short_date}">{tr}View Today{/tr}: <strong>{$now|bit_short_date}</strong></a>
+ <a href="{$gBitLoc.CALENDAR_PKG_URL}index.php?todate={$now}" title="{$now|bit_short_date}">{tr}Today{/tr}: <strong>{$now|bit_short_date}</strong></a>
</td>
<td rowspan="2" style="text-align:right;">
@@ -120,14 +134,12 @@
<td>
{section name=hr loop=$hrows[h]}
{assign var=over value=$hrows[h][hr].over}
- <div class="cal{$hrows[h][hr].type}">
+ <div class="cal{$hrows[h][hr].content_type_guid}">
{$hours[h]}:{$hrows[h][hr].mins} :
- <span class="prio{$hrows[h][hr].prio}">
- <a href="{$hrows[h][hr].url}" {popup fullhtml="1" text=$over|escape:"javascript"|escape:"html"}>
- {$hrows[h][hr].name|default:"..."}
- </a>
- </span>
+ <a href="{$smarty.const.BIT_ROOT_URL}index.php?content_id={$cell[w][d].items[items].content_id}" {popup fullhtml="1" text=$over|escape:"javascript"|escape:"html"}>
+ {$hrows[h][hr].title|default:"..."}
+ </a>
{if $hrows[h][hr].web}
<a href="{$hrows[h][hr].web}" title="{$hrows[h][hr].web}">w</a>
@@ -171,10 +183,10 @@
{* - Calendar Content - *}
{section name=items loop=$cell[w][d].items}
{assign var=over value=$cell[w][d].items[items].over}
- <div class="cal{$cell[w][d].items[items].type} prio{$cell[w][d].items[items].prio}">
+ <div class="cal{$cell[w][d].items[items].content_type_guid}">
- <a href="{$cell[w][d].items[items].url}" {popup fullhtml="1" text=$over|escape:"javascript"|escape:"html"}>
- {$cell[w][d].items[items].name|truncate:$trunc:".."|default:"..."}
+ <a href="{$smarty.const.BIT_ROOT_URL}index.php?content_id={$cell[w][d].items[items].content_id}" {popup fullhtml="1" text=$over|escape:"javascript"|escape:"html"}>
+ {$cell[w][d].items[items].title|truncate:$trunc:"..."|default:"?"}
</a>
{if $cell[w][d].items[items].web}
diff --git a/templates/calendar_box.tpl b/templates/calendar_box.tpl
index 62966c8..2e76b4d 100644
--- a/templates/calendar_box.tpl
+++ b/templates/calendar_box.tpl
@@ -1,11 +1,8 @@
<div class="calendar popup box">
- <h3 class="{if $cellprio}calprio{$cellprio}{/if}">{$cellHash.last_modified|bit_short_time} in {$cellHash.type}</h3>
+ <h3>{$cellHash.title}</h3>
<div class="boxcontent">
- <strong>{$cellHash.name}</strong>
- {if $cellcalname}
- {tr}in {$cellcalname}{/tr}
- {/if}
+ {tr}Content Type{/tr}: {$cellHash.content_description}
<br />
- {tr}Last modified by {displayname login=$cellHash.modifier_user real_name=$cellHash.modifier_real_name}{/tr}
+ {tr}Last modified by {displayname login=$cellHash.modifier_user real_name=$cellHash.modifier_real_name} at {$cellHash.last_modified|bit_short_time}{/tr}
</div>
</div>
diff --git a/templates/menu_calendar.tpl b/templates/menu_calendar.tpl
index 11d6e1b..0386782 100644
--- a/templates/menu_calendar.tpl
+++ b/templates/menu_calendar.tpl
@@ -1,5 +1,5 @@
{strip}
<ul>
- <li><a class="item" href="{$gBitLoc.CALENDAR_PKG_URL}index.php">{tr}Display Calendar{/tr}</a></li>
+ <li><a class="item" href="{$smarty.const.CALENDAR_PKG_URL}index.php">{tr}Display Calendar{/tr}</a></li>
</ul>
-{/strip} \ No newline at end of file
+{/strip}
diff --git a/templates/menu_calendar_admin.tpl b/templates/menu_calendar_admin.tpl
deleted file mode 100644
index ec43b02..0000000
--- a/templates/menu_calendar_admin.tpl
+++ /dev/null
@@ -1,5 +0,0 @@
-{strip}
-<ul>
- <li><a class="item" href="{$gBitLoc.KERNEL_PKG_URL}admin/index.php?page=calendar">{tr}Calendar settings{/tr}</a></li>
-</ul>
-{/strip} \ No newline at end of file