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 () {
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);
}

View File

@ -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);
}
}

View File

@ -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;
}
}

View File

@ -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

View File

@ -7,6 +7,7 @@ information provided here is intended especially for developers.
<frankenstyle>_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 ===

View File

@ -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);
}
}