diff --git a/blocks/community/communitycourse.php b/blocks/community/communitycourse.php index 0835faa9f94..aa38aa23e92 100644 --- a/blocks/community/communitycourse.php +++ b/blocks/community/communitycourse.php @@ -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; diff --git a/blocks/community/lang/en/block_community.php b/blocks/community/lang/en/block_community.php index bca97362c58..0505aeb8e5d 100644 --- a/blocks/community/lang/en/block_community.php +++ b/blocks/community/lang/en/block_community.php @@ -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} diff --git a/blocks/community/renderer.php b/blocks/community/renderer.php index a9b51bcf86f..5eb9d85f851 100644 --- a/blocks/community/renderer.php +++ b/blocks/community/renderer.php @@ -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