Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

MDL-35226 lesson: Adding $extrapagetitle to the api mod_lesson_render…

…er::header()
  • Loading branch information...
commit 27affa2622beae3a2e77e2d48d4cb23908618bcc 1 parent c8ac480
@ankitagarwal ankitagarwal authored
Showing with 17 additions and 7 deletions.
  1. +11 −6 mod/lesson/renderer.php
  2. +2 −1  mod/lesson/view.php
  3. +4 −0 mod/upgrade.txt
View
17 mod/lesson/renderer.php
@@ -30,17 +30,22 @@ class mod_lesson_renderer extends plugin_renderer_base {
/**
* Returns the header for the lesson module
*
- * @param lesson $lesson
- * @param string $currenttab
- * @param bool $extraeditbuttons
- * @param int $lessonpageid
+ * @param lesson $lesson a lesson object.
+ * @param string $currenttab current tab that is shown.
+ * @param bool $extraeditbuttons if extra edit buttons should be displayed.
+ * @param int $lessonpageid id of the lesson page that needs to be displayed.
+ * @param string $extrapagetitle String to appent to the page title.
* @return string
*/
- public function header($lesson, $cm, $currenttab = '', $extraeditbuttons = false, $lessonpageid = null) {
+ public function header($lesson, $cm, $currenttab = '', $extraeditbuttons = false, $lessonpageid = null, $extrapagetitle = null) {
global $CFG;
$activityname = format_string($lesson->name, true, $lesson->course);
- $title = $this->page->course->shortname.": ".$activityname;
+ if (empty($extrapagetitle)) {
+ $title = $this->page->course->shortname.": ".$activityname;
+ } else {
+ $title = $this->page->course->shortname.": ".$activityname.": ".$extrapagetitle;
+ }
// Build the buttons
$context = context_module::instance($cm->id);
View
3  mod/lesson/view.php
@@ -349,6 +349,7 @@
$currenttab = 'view';
$extraeditbuttons = true;
$lessonpageid = $page->id;
+ $extrapagetitle = $page->title;
if (($edit != -1) && $PAGE->user_allowed_editing()) {
$USER->editing = $edit;
@@ -387,7 +388,7 @@
}
lesson_add_fake_blocks($PAGE, $cm, $lesson, $timer);
- echo $lessonoutput->header($lesson, $cm, $currenttab, $extraeditbuttons, $lessonpageid);
+ echo $lessonoutput->header($lesson, $cm, $currenttab, $extraeditbuttons, $lessonpageid, $extrapagetitle);
if ($attemptflag) {
// We are using level 3 header because attempt heading is a sub-heading of lesson title (MDL-30911).
echo $OUTPUT->heading(get_string('attempt', 'lesson', $retries), 3);
View
4 mod/upgrade.txt
@@ -8,6 +8,10 @@ new features:
* mod/xxx/adminlib.php may now include 'plugininfo_yoursubplugintype' class definition
used by plugin_manager; it is recommended to store extra admin settings classes in this file
+
+optional - no changes needed:
+
+* mod_lesson_renderer::header() now accepts an additional parameter $extrapagetitle
=== 2.3 ===
Please sign in to comment.
Something went wrong with that request. Please try again.