mirror of
https://github.com/moodle/moodle.git
synced 2025-03-19 15:10:05 +01:00
community block MDL-24826 'Save a link to this course' redirect to the original course
This commit is contained in:
parent
c6619b6c1e
commit
9e32912bca
@ -77,8 +77,11 @@ if ($add != -1 and $confirm and confirm_sesskey()) {
|
||||
$course->url = optional_param('courseurl', '', PARAM_URL);
|
||||
$course->imageurl = optional_param('courseimageurl', '', PARAM_URL);
|
||||
$communitymanager->block_community_add_course($course, $USER->id);
|
||||
$notificationmessage = $OUTPUT->notification(get_string('addedtoblock', 'community_hub'),
|
||||
'notifysuccess');
|
||||
echo $OUTPUT->header();
|
||||
echo $renderer->save_link_success(
|
||||
new moodle_url('/course/view.php', array('id' => $courseid)));
|
||||
echo $OUTPUT->footer();
|
||||
die();
|
||||
}
|
||||
|
||||
/// Delete temp file when cancel restore
|
||||
@ -204,9 +207,6 @@ if (optional_param('executesearch', 0, PARAM_INTEGER) and confirm_sesskey()) {
|
||||
// OUTPUT
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(get_string('searchcommunitycourse', 'block_community'), 3, 'main');
|
||||
if (!empty($notificationmessage)) {
|
||||
echo $notificationmessage;
|
||||
}
|
||||
$hubselectorform->display();
|
||||
if (!empty($errormessage)) {
|
||||
echo $errormessage;
|
||||
|
@ -26,7 +26,7 @@
|
||||
|
||||
$string['activities'] = 'Activities';
|
||||
$string['add'] = 'Add';
|
||||
$string['addedtoblock'] = 'A link to this course has been added in your community block';
|
||||
$string['addedtoblock'] = 'A link to this course has been added in your community finder block';
|
||||
$string['addtocommunityblock'] = 'Save a link to this course';
|
||||
$string['addcommunitycourse'] = 'Add community course';
|
||||
$string['additionalcoursedesc'] = '{$a->lang} Creator: {$a->creatorname} - Publisher: {$a->publishername} - Subject: {$a->subject}
|
||||
|
@ -60,6 +60,21 @@ class block_community_renderer extends plugin_renderer_base {
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display add community course success message and a button to be redirected to te referer page
|
||||
* @param moodle_url $url the page to be redirected to
|
||||
* @return string html
|
||||
*/
|
||||
public function save_link_success(moodle_url $url) {
|
||||
$html = $this->output->notification(get_string('addedtoblock', 'block_community'),
|
||||
'notifysuccess');
|
||||
$continuebutton = new single_button($url,
|
||||
get_string('continue', 'block_community'));
|
||||
$html .= html_writer::tag('div', $this->output->render($continuebutton),
|
||||
array('class' => 'continuebutton'));
|
||||
return $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* The 'Next'/'more course result' link for a courses search
|
||||
* @param array $data - the form parameter to execute the search on more result
|
||||
|
Loading…
x
Reference in New Issue
Block a user