|
@@ -1,46 +1,5 @@
|
|
|
<?php
|
|
|
/* For licensing terms, see /license.txt */
|
|
|
-/**
|
|
|
- @author: Patrick Cool <patrick.cool@UGent.be>, Ghent University
|
|
|
- @author: Toon Van Hoecke <toon.vanhoecke@ugent.be>, Ghent University
|
|
|
- @author: Eric Remy (initial version)
|
|
|
- @version: 2.2 alpha
|
|
|
- @description: this file generates a general agenda of all items of the
|
|
|
- courses the user is registered for
|
|
|
-
|
|
|
- version info:
|
|
|
- -------------
|
|
|
- -> version 2.3 : Yannick Warnier, yannick.warnier@dokeos.com 2008
|
|
|
- Added repeated events
|
|
|
- -> version 2.2 : Patrick Cool, patrick.cool@ugent.be, november 2004
|
|
|
- Personal Agenda added. The user can add personal agenda items. The items
|
|
|
- are stored in a chamilo_user database because it is not course or platform
|
|
|
- based. A personal agenda view was also added. This lists all the personal
|
|
|
- agenda items of that user.
|
|
|
-
|
|
|
- -> version 2.1 : Patrick Cool, patrick.cool@ugent.be, , oktober 2004
|
|
|
- This is the version that works with the Group based Agenda tool.
|
|
|
-
|
|
|
- -> version 2.0 (alpha): Patrick Cool, patrick.cool@ugent.be, , oktober 2004
|
|
|
- The 2.0 version introduces besides the month view also a week- and day view.
|
|
|
- In the 2.5 (final) version it will be possible for the student to add his/her
|
|
|
- own agenda items. The platform administrator can however decide if the students
|
|
|
- are allowed to do this or not.
|
|
|
- The alpha version only contains the three views. The personal agenda feature is
|
|
|
- not yet completely finished. There are however already some parts of the code
|
|
|
- for adding a personal agenda item present.
|
|
|
- this code was not released in an official dokeos but was only used in the offical
|
|
|
- server of the Ghent University where it underwent serious testing
|
|
|
-
|
|
|
- -> version 1.5: Toon Van Hoecke, toon.vanhoecke@ugent.be, december 2003
|
|
|
-
|
|
|
- -> version 1.0: Eric Remy, eremy@rmwc.edu, 6 Oct 2003
|
|
|
- The tool was initially called master-calendar as it collects all the calendar
|
|
|
- items of all the courses one is subscribed to. It was very soon integrated in
|
|
|
- Dokeos as this was a really basic and very usefull tool.
|
|
|
-**/
|
|
|
-
|
|
|
-// HEADER
|
|
|
|
|
|
// name of the language file that needs to be included
|
|
|
$language_file = 'agenda';
|
|
@@ -76,11 +35,11 @@ Display::display_header(get_lang('MyAgenda'));
|
|
|
// SETTING SOME VARIABLES
|
|
|
|
|
|
// setting the database variables
|
|
|
-$TABLECOURS = Database :: get_main_table(TABLE_MAIN_COURSE);
|
|
|
-$TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
|
|
|
-$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA);
|
|
|
+$TABLECOURS = Database :: get_main_table(TABLE_MAIN_COURSE);
|
|
|
+$TABLECOURSUSER = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
|
|
|
+$TABLEAGENDA = Database :: get_course_table(TABLE_AGENDA);
|
|
|
$TABLE_ITEMPROPERTY = Database :: get_course_table(TABLE_ITEM_PROPERTY);
|
|
|
-$tbl_personal_agenda = Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
|
|
|
+$tbl_personal_agenda= Database :: get_user_personal_table(TABLE_PERSONAL_AGENDA);
|
|
|
|
|
|
// the variables for the days and the months
|
|
|
// Defining the shorts for the days
|
|
@@ -91,17 +50,17 @@ $DaysLong = api_get_week_days_long();
|
|
|
$MonthsLong = api_get_months_long();
|
|
|
|
|
|
/*
|
|
|
- TREATING THE URL PARAMETERS
|
|
|
- 1. The default values
|
|
|
- 2. storing it in the session
|
|
|
- 3. possible view
|
|
|
- 3.a Month view
|
|
|
- 3.b Week view
|
|
|
- 3.c day view
|
|
|
- 3.d personal view (only the personal agenda items)
|
|
|
- 4. add personal agenda
|
|
|
- 5. edit personal agenda
|
|
|
- 6. delete personal agenda
|
|
|
+ TREATING THE URL PARAMETERS
|
|
|
+ 1. The default values
|
|
|
+ 2. storing it in the session
|
|
|
+ 3. possible view
|
|
|
+ 3.a Month view
|
|
|
+ 3.b Week view
|
|
|
+ 3.c day view
|
|
|
+ 3.d personal view (only the personal agenda items)
|
|
|
+ 4. add personal agenda
|
|
|
+ 5. edit personal agenda
|
|
|
+ 6. delete personal agenda
|
|
|
*/
|
|
|
|
|
|
// 1. The default values. if there is no session yet, we have by default the month view
|
|
@@ -118,51 +77,47 @@ if ($_SESSION['view']) {
|
|
|
switch ($_SESSION['view']) {
|
|
|
// 3.a Month view
|
|
|
case "month" :
|
|
|
- $process = "month_view";
|
|
|
+ $process = 'month_view';
|
|
|
break;
|
|
|
// 3.a Week view
|
|
|
case "week" :
|
|
|
- $process = "week_view";
|
|
|
+ $process = 'week_view';
|
|
|
break;
|
|
|
// 3.a Day view
|
|
|
case "day" :
|
|
|
- $process = "day_view";
|
|
|
+ $process = 'day_view';
|
|
|
break;
|
|
|
// 3.a Personal view
|
|
|
case "personal" :
|
|
|
- $process = "personal_view";
|
|
|
+ $process = 'personal_view';
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
// 4. add personal agenda
|
|
|
-if (!empty($_GET['action']) && $_GET['action'] == "add_personal_agenda_item" and !$_POST['Submit'])
|
|
|
-{
|
|
|
+if (!empty($_GET['action']) && $_GET['action'] == 'add_personal_agenda_item' and !$_POST['Submit']) {
|
|
|
$process = "add_personal_agenda_item";
|
|
|
}
|
|
|
-if (!empty($_GET['action']) && $_GET['action'] == "add_personal_agenda_item" and $_POST['Submit'])
|
|
|
-{
|
|
|
+if (!empty($_GET['action']) && $_GET['action'] == "add_personal_agenda_item" and $_POST['Submit']) {
|
|
|
$process = "store_personal_agenda_item";
|
|
|
}
|
|
|
// 5. edit personal agenda
|
|
|
-if (!empty($_GET['action']) && $_GET['action'] == "edit_personal_agenda_item" and !$_POST['Submit'])
|
|
|
-{
|
|
|
+if (!empty($_GET['action']) && $_GET['action'] == 'edit_personal_agenda_item' and !$_POST['Submit']) {
|
|
|
$process = "edit_personal_agenda_item";
|
|
|
}
|
|
|
-if (!empty($_GET['action']) && $_GET['action'] == "edit_personal_agenda_item" and $_POST['Submit'])
|
|
|
-{
|
|
|
+if (!empty($_GET['action']) && $_GET['action'] == 'edit_personal_agenda_item' and $_POST['Submit']) {
|
|
|
$process = "store_personal_agenda_item";
|
|
|
}
|
|
|
// 6. delete personal agenda
|
|
|
-if (!empty($_GET['action']) && $_GET['action'] == "delete" AND $_GET['id'])
|
|
|
-{
|
|
|
+if (!empty($_GET['action']) && $_GET['action'] == "delete" AND $_GET['id']) {
|
|
|
$process = "delete_personal_agenda_item";
|
|
|
}
|
|
|
+
|
|
|
// OUTPUT
|
|
|
if (isset ($_user['user_id'])) {
|
|
|
// getting all the courses that this user is subscribed to
|
|
|
$courses_dbs = get_all_courses_of_user();
|
|
|
- if (!is_array($courses_dbs)) // this is for the special case if the user has no courses (otherwise you get an error)
|
|
|
- {
|
|
|
+ if (!is_array($courses_dbs)) {
|
|
|
+ // this is for the special case if the user has no courses (otherwise you get an error)
|
|
|
$courses_dbs = array ();
|
|
|
}
|
|
|
// setting and/or getting the year, month, day, week
|
|
@@ -173,13 +128,11 @@ if (isset ($_user['user_id'])) {
|
|
|
$year = $today['year'];
|
|
|
}
|
|
|
$month = (!empty($_GET['month'])? (int)$_GET['month']:NULL);
|
|
|
- if ($month == NULL)
|
|
|
- {
|
|
|
+ if ($month == NULL) {
|
|
|
$month = $today['mon'];
|
|
|
}
|
|
|
$day = (!empty($_GET['day']) ? (int)$_GET['day']:NULL);
|
|
|
- if ($day == NULL)
|
|
|
- {
|
|
|
+ if ($day == NULL) {
|
|
|
$day = $today['mday'];
|
|
|
}
|
|
|
$week = (!empty($_GET['week']) ?(int)$_GET['week']:NULL);
|
|
@@ -207,8 +160,7 @@ if (isset ($_user['user_id'])) {
|
|
|
echo "<td width=\"220\" valign=\"top\">";
|
|
|
$agendaitems = get_myagendaitems($courses_dbs, $month, $year);
|
|
|
$agendaitems = get_global_agenda_items($agendaitems, $day, $month, $year, $week, "month_view");
|
|
|
- if (api_get_setting('allow_personal_agenda') == 'true')
|
|
|
- {
|
|
|
+ if (api_get_setting('allow_personal_agenda') == 'true') {
|
|
|
$agendaitems = get_personal_agenda_items($agendaitems, $day, $month, $year, $week, "month_view");
|
|
|
}
|
|
|
display_myminimonthcalendar($agendaitems, $month, $year, $monthName);
|
|
@@ -224,6 +176,7 @@ if (isset ($_user['user_id'])) {
|
|
|
case 'month_view' :
|
|
|
$agendaitems = get_myagendaitems($courses_dbs, $month, $year);
|
|
|
$agendaitems = get_global_agenda_items($agendaitems, $day, $month, $year, $week, "month_view");
|
|
|
+
|
|
|
if (api_get_setting("allow_personal_agenda") == "true")
|
|
|
{
|
|
|
$agendaitems = get_personal_agenda_items($agendaitems, $day, $month, $year, $week, "month_view");
|