diff --git a/backup/cc/cc2moodle.php b/backup/cc/cc2moodle.php index 0728daca872..3b323ad58d0 100644 --- a/backup/cc/cc2moodle.php +++ b/backup/cc/cc2moodle.php @@ -144,7 +144,7 @@ class cc2moodle { public function generate_moodle_xml () { - global $CFG; + global $CFG, $OUTPUT; $cdir = static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'course_files'; @@ -213,7 +213,7 @@ class cc2moodle { } else { $status = false; - notify('The course is empty'); + echo $OUTPUT->notification('The course is empty'); static::log_action('The course is empty', false); } diff --git a/backup/cc/entities.class.php b/backup/cc/entities.class.php index dfff6b2a1b9..4a8ef064e9f 100644 --- a/backup/cc/entities.class.php +++ b/backup/cc/entities.class.php @@ -198,7 +198,7 @@ class entities { } public function move_files($files, $destination_folder) { - global $CFG; + global $CFG, $OUTPUT; if (!empty($files)) { @@ -220,7 +220,7 @@ class entities { } if (!$copy_success) { - notify('WARNING: Cannot copy the file ' . $source . ' to ' . $destination); + echo $OUTPUT->notification('WARNING: Cannot copy the file ' . $source . ' to ' . $destination); cc2moodle::log_action('Cannot copy the file ' . $source . ' to ' . $destination, false); } } diff --git a/backup/cc/restore_cc.php b/backup/cc/restore_cc.php index 17d91705519..94625fb4ee0 100644 --- a/backup/cc/restore_cc.php +++ b/backup/cc/restore_cc.php @@ -25,6 +25,7 @@ require_once($CFG->dirroot . '/backup/cc/includes/constants.php'); require_once($CFG->dirroot . '/backup/cc/cc2moodle.php'); function cc_convert ($dir) { + global $OUTPUT; $manifest_file = $dir . DIRECTORY_SEPARATOR . 'imsmanifest.xml'; $moodle_file = $dir . DIRECTORY_SEPARATOR . 'moodle.xml'; @@ -39,26 +40,26 @@ function cc_convert ($dir) { $detected_requirements = detect_requirements(); if (!$detected_requirements["php5"]) { - notify(get_string('cc_import_req_php5', 'imscc')); + echo $OUTPUT->notification(get_string('cc_import_req_php5', 'imscc')); return false; } if (!$detected_requirements["dom"]) { - notify(get_string('cc_import_req_dom', 'imscc')); + echo $OUTPUT->notification(get_string('cc_import_req_dom', 'imscc')); return false; } if (!$detected_requirements["libxml"]) { - notify(get_string('cc_import_req_libxml', 'imscc')); + echo $OUTPUT->notification(get_string('cc_import_req_libxml', 'imscc')); return false; } if (!$detected_requirements["libxmlminversion"]) { - notify(get_string('cc_import_req_libxmlminversion', 'imscc')); + echo $OUTPUT->notification(get_string('cc_import_req_libxmlminversion', 'imscc')); return false; } if (!$detected_requirements["xsl"]) { - notify(get_string('cc_import_req_xsl', 'imscc')); + echo $OUTPUT->notification(get_string('cc_import_req_xsl', 'imscc')); return false; } @@ -76,17 +77,17 @@ function cc_convert ($dir) { if (!$cc2moodle->is_auth()) { return $cc2moodle->generate_moodle_xml(); } else { - notify(get_string('cc2moodle_req_auth', 'imscc')); + echo $OUTPUT->notification(get_string('cc2moodle_req_auth', 'imscc')); return false; } } else { - notify(get_string('cc2moodle_invalid_schema', 'imscc')); + echo $OUTPUT->notification(get_string('cc2moodle_invalid_schema', 'imscc')); return false; } } else { - notify(get_string('cc2moodle_manifest_dont_load', 'imscc')); + echo $OUTPUT->notification(get_string('cc2moodle_manifest_dont_load', 'imscc')); return false; } } diff --git a/lib/deprecatedlib.php b/lib/deprecatedlib.php index d09fcc0a520..e2a26d6fe0d 100644 --- a/lib/deprecatedlib.php +++ b/lib/deprecatedlib.php @@ -901,9 +901,10 @@ function print_container_end($return=false) { /** * Print a bold message in an optional color. * - * @deprecated use $OUTPUT->notification instead. + * @deprecated since Moodle 2.0 MDL-12345 - use $OUTPUT->notification instead. + * @todo MDL-50469 This will be deleted in Moodle 3.3. * @param string $message The message to print out - * @param string $style Optional style to display message text in + * @param string $classes Optional style to display message text in * @param string $align Alignment option * @param bool $return whether to return an output string or echo now * @return string|bool Depending on $result @@ -911,6 +912,8 @@ function print_container_end($return=false) { function notify($message, $classes = 'notifyproblem', $align = 'center', $return = false) { global $OUTPUT; + debugging('notify() is deprecated, please use $OUTPUT->notification() instead', DEBUG_DEVELOPER); + if ($classes == 'green') { debugging('Use of deprecated class name "green" in notify. Please change to "notifysuccess".', DEBUG_DEVELOPER); $classes = 'notifysuccess'; // Backward compatible with old color system diff --git a/lib/upgrade.txt b/lib/upgrade.txt index 5a732f1a59a..bc76325580d 100644 --- a/lib/upgrade.txt +++ b/lib/upgrade.txt @@ -7,6 +7,7 @@ information provided here is intended especially for developers. _extend_navigation_user(navigation_node $parentnode, stdClass $user, context_user $context, stdClass $course, context_course $coursecontext) +* The function notify() now throws a debugging message - see MDL-50269. === 3.0 === diff --git a/question/engine/upgrade/upgradelib.php b/question/engine/upgrade/upgradelib.php index d60fa17ab11..82eb82e03c3 100644 --- a/question/engine/upgrade/upgradelib.php +++ b/question/engine/upgrade/upgradelib.php @@ -47,6 +47,8 @@ class question_engine_attempt_upgrader { protected $logger; public function save_usage($preferredbehaviour, $attempt, $qas, $quizlayout) { + global $OUTPUT; + $missing = array(); $layout = explode(',', $attempt->layout); @@ -95,9 +97,10 @@ class question_engine_attempt_upgrader { $this->set_quiz_attempt_layout($attempt->uniqueid, implode(',', $layout)); if ($missing) { - notify("Question sessions for questions " . + $message = "Question sessions for questions " . implode(', ', $missing) . - " were missing when upgrading question usage {$attempt->uniqueid}."); + " were missing when upgrading question usage {$attempt->uniqueid}."; + echo $OUTPUT->notification($message); } }