Skip to content

Commit

Permalink
Activity email placeholders improved.
Browse files Browse the repository at this point in the history
- PLS-738
  • Loading branch information
raja-lmsace committed Apr 20, 2024
1 parent e45d28a commit 0c94b08
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions classes/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,25 @@ public static function update_emailvars($templatetext, $subject, $course, $user,
$course->category = is_number($course->category)
? core_course_category::get($course->category)->get_formatted_name() : $course->category;

$mod = clone $mod;
if (!empty($mod->id)) {
if ($DB->record_exists('course_modules', ['id' => $mod->id])) {
$module = $DB->get_record('course_modules', ['id' => $mod->id]);
$name = $DB->get_field('modules', 'name', ['id' => $module->module]);
$mod->url = new moodle_url("/mod/$name/view.php", ['id' => $mod->id]);

if (\mod_pulse\automation\helper::create()->timemanagement_installed()) {
$userenrolments = ltool_timemanagement_get_course_user_enrollment($course->id, $user->id);
$record = $DB->get_record('ltool_timemanagement_modules', ['cmid' => $mod->id ?? 0]);
if ($record) {
$dates = ltool_timemanagement_cal_coursemodule_managedates($record, $userenrolments[0]['timestart']);
$duedate = isset($dates['duedate']) ? userdate($dates['duedate']) : '';
}
}
$mod->duedate = $duedate ?? '';
}
}

$vars = new pulse_email_vars($user, $course, $sender, $mod, $conditionvars);

foreach ($amethods as $varscat => $placeholders) {
Expand Down

0 comments on commit 0c94b08

Please sign in to comment.