Merge branch 'MDL-50269_master' of git://github.com/markn86/moodle

Conflicts:
	lib/upgrade.txt
This commit is contained in:
David Monllao 2015-12-02 15:54:25 +08:00 committed by Eloy Lafuente (stronk7)
commit 200ab5266a
6 changed files with 24 additions and 16 deletions

View file

@ -144,7 +144,7 @@ class cc2moodle {
public function generate_moodle_xml () { public function generate_moodle_xml () {
global $CFG; global $CFG, $OUTPUT;
$cdir = static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'course_files'; $cdir = static::$path_to_manifest_folder . DIRECTORY_SEPARATOR . 'course_files';
@ -213,7 +213,7 @@ class cc2moodle {
} else { } else {
$status = false; $status = false;
notify('The course is empty'); echo $OUTPUT->notification('The course is empty');
static::log_action('The course is empty', false); static::log_action('The course is empty', false);
} }

View file

@ -198,7 +198,7 @@ class entities {
} }
public function move_files($files, $destination_folder) { public function move_files($files, $destination_folder) {
global $CFG; global $CFG, $OUTPUT;
if (!empty($files)) { if (!empty($files)) {
@ -220,7 +220,7 @@ class entities {
} }
if (!$copy_success) { 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); cc2moodle::log_action('Cannot copy the file ' . $source . ' to ' . $destination, false);
} }
} }

View file

@ -25,6 +25,7 @@ require_once($CFG->dirroot . '/backup/cc/includes/constants.php');
require_once($CFG->dirroot . '/backup/cc/cc2moodle.php'); require_once($CFG->dirroot . '/backup/cc/cc2moodle.php');
function cc_convert ($dir) { function cc_convert ($dir) {
global $OUTPUT;
$manifest_file = $dir . DIRECTORY_SEPARATOR . 'imsmanifest.xml'; $manifest_file = $dir . DIRECTORY_SEPARATOR . 'imsmanifest.xml';
$moodle_file = $dir . DIRECTORY_SEPARATOR . 'moodle.xml'; $moodle_file = $dir . DIRECTORY_SEPARATOR . 'moodle.xml';
@ -39,26 +40,26 @@ function cc_convert ($dir) {
$detected_requirements = detect_requirements(); $detected_requirements = detect_requirements();
if (!$detected_requirements["php5"]) { if (!$detected_requirements["php5"]) {
notify(get_string('cc_import_req_php5', 'imscc')); echo $OUTPUT->notification(get_string('cc_import_req_php5', 'imscc'));
return false; return false;
} }
if (!$detected_requirements["dom"]) { if (!$detected_requirements["dom"]) {
notify(get_string('cc_import_req_dom', 'imscc')); echo $OUTPUT->notification(get_string('cc_import_req_dom', 'imscc'));
return false; return false;
} }
if (!$detected_requirements["libxml"]) { if (!$detected_requirements["libxml"]) {
notify(get_string('cc_import_req_libxml', 'imscc')); echo $OUTPUT->notification(get_string('cc_import_req_libxml', 'imscc'));
return false; return false;
} }
if (!$detected_requirements["libxmlminversion"]) { if (!$detected_requirements["libxmlminversion"]) {
notify(get_string('cc_import_req_libxmlminversion', 'imscc')); echo $OUTPUT->notification(get_string('cc_import_req_libxmlminversion', 'imscc'));
return false; return false;
} }
if (!$detected_requirements["xsl"]) { if (!$detected_requirements["xsl"]) {
notify(get_string('cc_import_req_xsl', 'imscc')); echo $OUTPUT->notification(get_string('cc_import_req_xsl', 'imscc'));
return false; return false;
} }
@ -76,17 +77,17 @@ function cc_convert ($dir) {
if (!$cc2moodle->is_auth()) { if (!$cc2moodle->is_auth()) {
return $cc2moodle->generate_moodle_xml(); return $cc2moodle->generate_moodle_xml();
} else { } else {
notify(get_string('cc2moodle_req_auth', 'imscc')); echo $OUTPUT->notification(get_string('cc2moodle_req_auth', 'imscc'));
return false; return false;
} }
} else { } else {
notify(get_string('cc2moodle_invalid_schema', 'imscc')); echo $OUTPUT->notification(get_string('cc2moodle_invalid_schema', 'imscc'));
return false; return false;
} }
} else { } else {
notify(get_string('cc2moodle_manifest_dont_load', 'imscc')); echo $OUTPUT->notification(get_string('cc2moodle_manifest_dont_load', 'imscc'));
return false; return false;
} }
} }

View file

@ -901,9 +901,10 @@ function print_container_end($return=false) {
/** /**
* Print a bold message in an optional color. * 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 $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 string $align Alignment option
* @param bool $return whether to return an output string or echo now * @param bool $return whether to return an output string or echo now
* @return string|bool Depending on $result * @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) { function notify($message, $classes = 'notifyproblem', $align = 'center', $return = false) {
global $OUTPUT; global $OUTPUT;
debugging('notify() is deprecated, please use $OUTPUT->notification() instead', DEBUG_DEVELOPER);
if ($classes == 'green') { if ($classes == 'green') {
debugging('Use of deprecated class name "green" in notify. Please change to "notifysuccess".', DEBUG_DEVELOPER); debugging('Use of deprecated class name "green" in notify. Please change to "notifysuccess".', DEBUG_DEVELOPER);
$classes = 'notifysuccess'; // Backward compatible with old color system $classes = 'notifysuccess'; // Backward compatible with old color system

View file

@ -7,6 +7,7 @@ information provided here is intended especially for developers.
<frankenstyle>_extend_navigation_user(navigation_node $parentnode, stdClass $user, <frankenstyle>_extend_navigation_user(navigation_node $parentnode, stdClass $user,
context_user $context, stdClass $course, context_user $context, stdClass $course,
context_course $coursecontext) context_course $coursecontext)
* The function notify() now throws a debugging message - see MDL-50269.
=== 3.0 === === 3.0 ===

View file

@ -47,6 +47,8 @@ class question_engine_attempt_upgrader {
protected $logger; protected $logger;
public function save_usage($preferredbehaviour, $attempt, $qas, $quizlayout) { public function save_usage($preferredbehaviour, $attempt, $qas, $quizlayout) {
global $OUTPUT;
$missing = array(); $missing = array();
$layout = explode(',', $attempt->layout); $layout = explode(',', $attempt->layout);
@ -95,9 +97,10 @@ class question_engine_attempt_upgrader {
$this->set_quiz_attempt_layout($attempt->uniqueid, implode(',', $layout)); $this->set_quiz_attempt_layout($attempt->uniqueid, implode(',', $layout));
if ($missing) { if ($missing) {
notify("Question sessions for questions " . $message = "Question sessions for questions " .
implode(', ', $missing) . implode(', ', $missing) .
" were missing when upgrading question usage {$attempt->uniqueid}."); " were missing when upgrading question usage {$attempt->uniqueid}.";
echo $OUTPUT->notification($message);
} }
} }