forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
calendar MDL-19793 Upgrade deprecated calls and added set_url calls
- Loading branch information
samhemelryk
committed
Sep 29, 2009
1 parent
d530c8d
commit 93c91ee
Showing
7 changed files
with
863 additions
and
761 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,50 @@ | ||
<?php // $Id$ | ||
<?php | ||
|
||
///////////////////////////////////////////////////////////////////////////// | ||
// // | ||
// NOTICE OF COPYRIGHT // | ||
// // | ||
// Moodle - Calendar extension // | ||
// // | ||
// Copyright (C) 2003-2004 Greek School Network www.sch.gr // | ||
// // | ||
// Designed by: // | ||
// Avgoustos Tsinakos ([email protected]) // | ||
// Jon Papaioannou ([email protected]) // | ||
// // | ||
// Programming and development: // | ||
// Jon Papaioannou ([email protected]) // | ||
// // | ||
// For bugs, suggestions, etc contact: // | ||
// Jon Papaioannou ([email protected]) // | ||
// // | ||
// The current module was developed at the University of Macedonia // | ||
// (www.uom.gr) under the funding of the Greek School Network (www.sch.gr) // | ||
// The aim of this project is to provide additional and improved // | ||
// functionality to the Asynchronous Distance Education service that the // | ||
// Greek School Network deploys. // | ||
// // | ||
// This program is free software; you can redistribute it and/or modify // | ||
// it under the terms of the GNU General Public License as published by // | ||
// the Free Software Foundation; either version 2 of the License, or // | ||
// (at your option) any later version. // | ||
// // | ||
// This program is distributed in the hope that it will be useful, // | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of // | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // | ||
// GNU General Public License for more details: // | ||
// // | ||
// http://www.gnu.org/copyleft/gpl.html // | ||
// // | ||
///////////////////////////////////////////////////////////////////////////// | ||
|
||
/** | ||
* This file is part of the User section Moodle | ||
* | ||
* @copyright 2003-2004 Jon Papaioannou ([email protected]) | ||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v2 or later | ||
* @package calendar | ||
*/ | ||
|
||
require_once('../config.php'); | ||
require_once($CFG->dirroot.'/course/lib.php'); | ||
|
@@ -15,6 +61,24 @@ | |
$course = NULL; | ||
} | ||
|
||
$url = new moodle_url($CFG->wwwroot.'/calendar/export.php'); | ||
if ($action !== '') { | ||
$url->param('action', $action); | ||
} | ||
if ($cal_d !== 0) { | ||
$url->param('cal_d', $cal_d); | ||
} | ||
if ($cal_m !== 0) { | ||
$url->param('cal_m', $cal_m); | ||
} | ||
if ($cal_y !== 0) { | ||
$url->param('cal_y', $cal_y); | ||
} | ||
if ($course !== 0) { | ||
$url->param('course', $course); | ||
} | ||
$PAGE->set_url($url); | ||
|
||
require_login(); | ||
|
||
if (empty($CFG->enablecalendarexport)) { | ||
|
@@ -43,14 +107,16 @@ | |
} | ||
$time = make_timestamp($yr, $mon, $day); | ||
|
||
if (empty($USER->id) or isguest()) { | ||
$isguest = has_capability('moodle/legacy:guest', get_context_instance(CONTEXT_SYSTEM), 0, false); | ||
|
||
if (empty($USER->id) or $isguest) { | ||
$defaultcourses = calendar_get_default_courses(); | ||
calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses); | ||
} else { | ||
calendar_set_filters($courses, $groups, $users); | ||
} | ||
|
||
if (empty($USER->id) or isguest()) { | ||
if (empty($USER->id) or $isguest) { | ||
$defaultcourses = calendar_get_default_courses(); | ||
calendar_set_filters($courses, $groups, $users, $defaultcourses, $defaultcourses); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
<?php // %Id% | ||
<?php | ||
|
||
require('../config.php'); | ||
|
||
redirect($CFG->wwwroot.'/calendar/view.php'); | ||
|
||
?> | ||
require('../config.php'); | ||
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/calendar/view.php')); | ||
redirect($CFG->wwwroot.'/calendar/view.php'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,88 @@ | ||
<?PHP // $Id$ | ||
// preferences.php - user prefs for calendar | ||
<?php | ||
|
||
require_once('../config.php'); | ||
require_once($CFG->dirroot.'/calendar/lib.php'); | ||
// preferences.php - user prefs for calendar | ||
|
||
if (isset($SESSION->cal_course_referer)) { | ||
if (! $course = $DB->get_record('course', array('id'=>$SESSION->cal_course_referer))) { | ||
$course = get_site(); | ||
} | ||
} | ||
require_once('../config.php'); | ||
require_once($CFG->dirroot.'/calendar/lib.php'); | ||
|
||
if ($course->id != SITEID) { | ||
require_login($course->id); | ||
if (isset($SESSION->cal_course_referer)) { | ||
if (! $course = $DB->get_record('course', array('id'=>$SESSION->cal_course_referer))) { | ||
$course = get_site(); | ||
} | ||
// Initialize the session variables | ||
calendar_session_vars(); | ||
} | ||
|
||
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/calendar/preferences.php')); | ||
|
||
if ($course->id != SITEID) { | ||
require_login($course->id); | ||
} | ||
// Initialize the session variables | ||
calendar_session_vars(); | ||
|
||
/// If data submitted, then process and store. | ||
|
||
if ($form = data_submitted()) { | ||
foreach ($form as $preference => $value) { | ||
switch ($preference) { | ||
case 'timeformat': | ||
if ($value != CALENDAR_TF_12 and $value != CALENDAR_TF_24) { | ||
$value = ''; | ||
} | ||
set_user_preference('calendar_timeformat', $value); | ||
break; | ||
case 'startwday': | ||
$value = intval($value); | ||
if ($value < 0 or $value > 6) { | ||
$value = abs($value % 7); | ||
} | ||
set_user_preference('calendar_startwday', $value); | ||
break; | ||
case 'maxevents': | ||
if (intval($value) >= 1) { | ||
set_user_preference('calendar_maxevents', $value); | ||
} | ||
break; | ||
case 'lookahead': | ||
if (intval($value) >= 1) { | ||
set_user_preference('calendar_lookahead', $value); | ||
} | ||
break; | ||
case 'persistflt': | ||
set_user_preference('calendar_persistflt', intval($value)); | ||
break; | ||
} | ||
if ($form = data_submitted()) { | ||
foreach ($form as $preference => $value) { | ||
switch ($preference) { | ||
case 'timeformat': | ||
if ($value != CALENDAR_TF_12 and $value != CALENDAR_TF_24) { | ||
$value = ''; | ||
} | ||
set_user_preference('calendar_timeformat', $value); | ||
break; | ||
case 'startwday': | ||
$value = intval($value); | ||
if ($value < 0 or $value > 6) { | ||
$value = abs($value % 7); | ||
} | ||
set_user_preference('calendar_startwday', $value); | ||
break; | ||
case 'maxevents': | ||
if (intval($value) >= 1) { | ||
set_user_preference('calendar_maxevents', $value); | ||
} | ||
break; | ||
case 'lookahead': | ||
if (intval($value) >= 1) { | ||
set_user_preference('calendar_lookahead', $value); | ||
} | ||
break; | ||
case 'persistflt': | ||
set_user_preference('calendar_persistflt', intval($value)); | ||
break; | ||
} | ||
redirect('view.php?course='.$course->id, get_string('changessaved'), 1); | ||
exit; | ||
} | ||
redirect('view.php?course='.$course->id, get_string('changessaved'), 1); | ||
exit; | ||
} | ||
|
||
$site = get_site(); | ||
|
||
$strcalendar = get_string('calendar', 'calendar'); | ||
$strpreferences = get_string('preferences', 'calendar'); | ||
$site = get_site(); | ||
|
||
if ($course->id != SITEID) { | ||
$PAGE->navbar-add($course->shortname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id))); | ||
} | ||
$PAGE->navbar->add($strpreferences, new moodle_url($CFG->wwwroot.'/calendar/view.php')); | ||
$strcalendar = get_string('calendar', 'calendar'); | ||
$strpreferences = get_string('preferences', 'calendar'); | ||
|
||
$PAGE->set_title("$site->shortname: $strcalendar: $strpreferences"); | ||
$PAGE->set_heading($strcalendar); | ||
$PAGE->set_headingmenu(user_login_string($site)); | ||
if ($course->id != SITEID) { | ||
$PAGE->navbar-add($course->shortname, new moodle_url($CFG->wwwroot.'/course/view.php', array('id'=>$course->id))); | ||
} | ||
$PAGE->navbar->add($strpreferences, new moodle_url($CFG->wwwroot.'/calendar/view.php')); | ||
|
||
echo $OUTPUT->header(); | ||
$PAGE->set_title("$site->shortname: $strcalendar: $strpreferences"); | ||
$PAGE->set_heading($strcalendar); | ||
$PAGE->set_headingmenu(user_login_string($site)); | ||
|
||
echo $OUTPUT->heading($strpreferences); | ||
echo $OUTPUT->header(); | ||
|
||
echo $OUTPUT->box_start('generalbox boxaligncenter'); | ||
echo $OUTPUT->heading($strpreferences); | ||
|
||
$prefs->timeformat = get_user_preferences('calendar_timeformat', ''); | ||
$prefs->startwday = get_user_preferences('calendar_startwday', CALENDAR_STARTING_WEEKDAY); | ||
$prefs->maxevents = get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS); | ||
$prefs->lookahead = get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS); | ||
$prefs->persistflt = get_user_preferences('calendar_persistflt', 0); | ||
echo $OUTPUT->box_start('generalbox boxaligncenter'); | ||
|
||
include('./preferences.html'); | ||
echo $OUTPUT->box_end(); | ||
$prefs->timeformat = get_user_preferences('calendar_timeformat', ''); | ||
$prefs->startwday = get_user_preferences('calendar_startwday', CALENDAR_STARTING_WEEKDAY); | ||
$prefs->maxevents = get_user_preferences('calendar_maxevents', CALENDAR_UPCOMING_MAXEVENTS); | ||
$prefs->lookahead = get_user_preferences('calendar_lookahead', CALENDAR_UPCOMING_DAYS); | ||
$prefs->persistflt = get_user_preferences('calendar_persistflt', 0); | ||
|
||
echo $OUTPUT->footer(); | ||
include('./preferences.html'); | ||
echo $OUTPUT->box_end(); | ||
|
||
?> | ||
echo $OUTPUT->footer(); |
Oops, something went wrong.