MDL-19773 - Cannot have code like $SESSION->feedback = new object(); in mod/feedback/lib.php

This commit is contained in:
agrabs 2009-09-16 12:21:47 +00:00
parent 3a5c7d825c
commit f1b9e2df43
5 changed files with 20 additions and 8 deletions

View File

@ -12,6 +12,8 @@
require_once("lib.php");
require_once($CFG->libdir . '/completionlib.php');
feedback_init_feedback_session();
$id = required_param('id', PARAM_INT);
$completedid = optional_param('completedid', false, PARAM_INT);
$preservevalues = optional_param('preservevalues', 0, PARAM_INT);

View File

@ -11,6 +11,8 @@
require_once("../../config.php");
require_once("lib.php");
feedback_init_feedback_session();
$id = required_param('id', PARAM_INT);
$completedid = optional_param('completedid', false, PARAM_INT);
$preservevalues = optional_param('preservevalues', 0, PARAM_INT);

View File

@ -12,6 +12,8 @@
require_once("lib.php");
require_once('edit_form.php');
feedback_init_feedback_session();
$id = required_param('id', PARAM_INT);
if(($formdata = data_submitted()) AND !confirm_sesskey()) {

View File

@ -11,6 +11,8 @@
require_once("../../config.php");
require_once("lib.php");
feedback_init_feedback_session();
$id = optional_param('id', NULL, PARAM_INT);
$typ = optional_param('typ', false, PARAM_ALPHA);
$itemid = optional_param('itemid', false, PARAM_INT);

View File

@ -38,14 +38,6 @@ define('FEEDBACK_RESETFORM_RESET', 'feedback_reset_data_');
define('FEEDBACK_RESETFORM_DROP', 'feedback_drop_feedback_');
define('FEEDBACK_MAX_PIX_LENGTH', '400'); //max. Breite des grafischen Balkens in der Auswertung
//initialize the feedback-Session - not nice at all!!
global $SESSION;
if (!empty($SESSION)) {
if (!isset($SESSION->feedback) OR !is_object($SESSION->feedback)) {
$SESSION->feedback = new object();
}
}
/**
* @uses FEATURE_GROUPS
* @uses FEATURE_GROUPINGS
@ -2299,6 +2291,8 @@ function feedback_print_errors() {
global $SESSION, $OUTPUT;
feedback_init_feedback_session();
if(empty($SESSION->feedback->errors)) {
return;
}
@ -2361,4 +2355,14 @@ function feedback_extend_settings_navigation($settings, $module) {
if (has_capability('moodle/course:manageactivities', $PAGE->cm->context)) {
$feedbacknav->add(get_string('updatethis', '', get_string('modulename', 'feedback')), new moodle_url($CFG->wwwroot.'/course/mod.php', array('update' => $PAGE->cm->id, 'return' => true, 'sesskey' => sesskey())));
}
}
function feedback_init_feedback_session() {
//initialize the feedback-Session - not nice at all!!
global $SESSION;
if (!empty($SESSION)) {
if (!isset($SESSION->feedback) OR !is_object($SESSION->feedback)) {
$SESSION->feedback = new object();
}
}
}