forked from gwu-libraries/srrs-mobile
/
mycalendar.php
70 lines (54 loc) · 1.54 KB
/
mycalendar.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* All specific views of the calendar will be available from this file
* such as day/week/month view
* @author Nick Korbel <lqqkout13@users.sourceforge.net>
* @version 04-08-06
* @package phpScheduleIt
*
* Copyright (C) 2003 - 2007 phpScheduleIt
* License: GPL, see LICENSE
*/
include_once('lib/Template.class.php');
include_once('lib/MyCalendar.class.php');
$timer = new Timer();
$timer->start();
// Check that the user is logged in
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'])) {
$date_split = explode('-', $_GET['date']);
}
else {
$date_split = explode('-', date('m-d-Y', Time::getAdjustedTime(mktime(), date('H') * 60)));
}
return mktime(0,0,0, $date_split[0], $date_split[1], $date_split[2]);
}
?>