Skip to content
Snippets Groups Projects
Unverified Commit 0de7e0ff authored by Tobias Reischmann's avatar Tobias Reischmann
Browse files

Added a placeholder for link and link-html in email templates

parent de6456f1
No related branches found
No related tags found
No related merge requests found
......@@ -107,7 +107,7 @@ class email extends libbase {
array('instanceid' => $step->id,
'touser' => $user->id));
$parsedsettings = $this->replace_placeholders($settings, $user);
$parsedsettings = $this->replace_placeholders($settings, $user, $step->id);
$subject = $parsedsettings['subject'];
$content = $parsedsettings['content'];
......@@ -129,7 +129,8 @@ class email extends libbase {
* @param mixed $user user object
* @return string[] array of mail text.
*/
private function replace_placeholders($strings, $user) {
private function replace_placeholders($strings, $user, $stepid) {
global $CFG;
$patterns = array();
$replacements = array();
......@@ -140,6 +141,14 @@ class email extends libbase {
$patterns [] = '##lastname##';
$replacements [] = $user->lastname;
$url = $CFG->wwwroot . '/' . $this->get_interaction_link($stepid)->out();
$patterns [] = '##link##';
$replacements [] = $url;
$patterns [] = '##link-html##';
$replacements [] = \html_writer::link($url, $url);
return str_ireplace($patterns, $replacements, $strings);
}
......
......@@ -72,4 +72,5 @@ abstract class interactionlibbase {
* @param string $action action string
*/
public abstract function handle_interaction($process, $step, $action);
}
\ No newline at end of file
......@@ -105,6 +105,16 @@ abstract class libbase {
public function extend_add_instance_form_definition_after_data($mform, $settings) {
}
/**
* Generates the link to the interaction table of the respective step
* @param int $stepid id of the step
* @return \moodle_url
*/
public function get_interaction_link($stepid) {
return new \moodle_url('admin/tool/cleanupcourses/view.php', array('stepid' => $stepid));
}
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment