MDL-43127 tool_uploadcourse: Add support for more enrolment methods

This commit is contained in:
Frederic Massart
2014-11-25 11:01:22 +08:00
parent 06378d1069
commit acd52a33ec
7 changed files with 233 additions and 18 deletions
+14 -4
View File
@@ -136,7 +136,8 @@ class tool_uploadcourse_tracker {
* Output one more line.
*
* @param int $line line number.
* @param bool $outcome success or not?
* @param int $outcome 0 for failure, 1 for success, 2 for success with errors. Use 2 when
* most of the process succeeded but there might have been outstanding errors.
* @param array $status array of statuses.
* @param array $data extra data to display.
* @return void
@@ -148,9 +149,16 @@ class tool_uploadcourse_tracker {
}
if ($this->outputmode == self::OUTPUT_PLAIN) {
if ($outcome == 1) {
$ok = 'OK';
} else if (!$outcome) {
$ok = 'NOK'; // Not OK.
} else {
$ok = 'EOK'; // Errors, but OK.
}
$message = array(
$line,
$outcome ? 'OK' : 'NOK',
$ok,
isset($data['id']) ? $data['id'] : '',
isset($data['shortname']) ? $data['shortname'] : '',
isset($data['fullname']) ? $data['fullname'] : '',
@@ -168,10 +176,12 @@ class tool_uploadcourse_tracker {
if (is_array($status)) {
$status = implode(html_writer::empty_tag('br'), $status);
}
if ($outcome) {
if ($outcome == 1) {
$outcome = $OUTPUT->pix_icon('i/valid', '');
} else {
} else if (!$outcome) {
$outcome = $OUTPUT->pix_icon('i/invalid', '');
} else {
$outcome = $OUTPUT->pix_icon('i/caution', '');
}
echo html_writer::start_tag('tr', array('class' => 'r' . $this->rownb % 2));
echo html_writer::tag('td', $line, array('class' => 'c' . $ci++));