Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lang commit for #109 #110

Merged
merged 1 commit into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
review commit 1
Syxton committed Jan 16, 2024
commit 23ba7159b008491e9521157cf2a2dc916ee40ac2
2 changes: 1 addition & 1 deletion classes/actions.php
Original file line number Diff line number Diff line change
@@ -508,7 +508,7 @@ public static function show_description(array $modules, bool $showdescription):
\course_modinfo::purge_course_module_cache($cm->course, $cm->id);
}
} else {
throw new moodle_exception('Could not find course module with id ' . $cm->id);
throw new moodle_exception('invalidmoduleid', 'block_massaction', $cm->id);
}
}
}
23 changes: 18 additions & 5 deletions classes/event/course_modules_duplicated.php
Original file line number Diff line number Diff line change
@@ -55,15 +55,28 @@ public function get_description(): string {
$cms = [];
$failed = [];
foreach ($this->other['cms'] as $srccm => $dstcm) {
$cms[] = 'cmid from \'' . $srccm . '\' to \'' . $dstcm . '\'';
$cms[] = get_string('event:duplicated_description',
'block_massaction',
['src' => $srccm,
'dst' => $dstcm,
]);
}

foreach ($this->other['failed'] as $cmid) {
$failed[] = 'cmid \'' . $cmid . '\'';
}
return 'Course modules duplicate has been completed. '
. 'Summary: ' . count($cms) . ' Completed, ' . count($failed) . ' Failed.'
. ($cms ? ' Completed ' . implode(", ", $cms) . '.' : '')
. ($failed ? ' Failed ' . implode(", ", $failed) . '.' : '');

return get_string('event:duplicated_summary',
'block_massaction',
['countcomplete' => count($cms),
'countfailed' => count($failed),
]) .
($cms ? get_string('event:duplicated_completed_list',
'block_massaction',
['list' => implode(', ', $cms)]) : '') .
($failed ? get_string('event:duplicated_failed_list',
'block_massaction',
['list' => implode(', ', $failed)]) : '');
}

/**
8 changes: 5 additions & 3 deletions classes/event/course_modules_duplicated_failed.php
Original file line number Diff line number Diff line change
@@ -52,9 +52,11 @@ public static function get_name(): string {
* @return string
*/
public function get_description(): string {
return 'Course modules duplicate failed. '
. 'cmid: ' . $this->other['cmid']
. 'error:' . $this->other['error'];
return get_string('event:duplicated_failed_description',
'block_massaction',
['cmid' => $this->other['cmid'],
'error' => $this->other['error'],
]);
}

/**
2 changes: 1 addition & 1 deletion classes/massactionutils.php
Original file line number Diff line number Diff line change
@@ -160,7 +160,7 @@ public static function duplicate_cm_to_course(object $course, object $cm): int {
}
}
if (empty($newcmid)) {
throw new \moodle_exception('Could not duplicate course module from id ' . $cm->id);
throw new \moodle_exception('duplicatefailed', 'block_massaction', $cm->id);
}
return $newcmid;
}
6 changes: 6 additions & 0 deletions lang/en/block_massaction.php
Original file line number Diff line number Diff line change
@@ -73,11 +73,17 @@
$string['confirmsectionselect'] = 'Choose section';
$string['deletecheck'] = 'Confirm mass deletion';
$string['deletecheckconfirm'] = 'Are you sure you want to delete the following module(s)?';
$string['duplicatefailed'] = 'Could not duplicate course module from id {$a}';
$string['duplicatemaxactivities'] = 'Maximum amount of course modules to duplicate';
$string['duplicatemaxactivities_description'] = 'Maximum amount of course modules which can be duplicated at the same time without running the process as background task. If set to "0" all duplication operations will be run as background task.';
$string['enablebulkediting'] = 'Enable bulk editing';
$string['event:course_modules_duplicated'] = 'Course modules duplicated';
$string['event:course_modules_duplicated_failed'] = 'Course modules failed to duplicate';
$string['event:duplicated_description'] = 'cmid from \'{$a->src}\' to \'{$a->dst}\'';
$string['event:duplicated_summary'] = 'Course module duplication has been completed. Summary: {$a->countcomplete} Completed, {$a->countfailed} Failed.';
$string['event:duplicated_completed_list'] = 'Completed {$a->list}.';
$string['event:duplicated_failed_list'] = 'Failed {$a->list}.';
$string['event:duplicated_failed_description'] = 'Course module duplication failed. cmid: {$a->cmid} error: {$a->error}';
$string['invalidaction'] = 'Unknown action: {$a}';
$string['invalidmoduleid'] = 'Invalid module ID: {$a}';
$string['invalidcoursemodule'] = 'Invalid course module';