Skip to content

Commit

Permalink
MDL-35226 lesson: Adding $extrapagetitle to the api mod_lesson_render…
Browse files Browse the repository at this point in the history
…er::header()
  • Loading branch information
ankitagarwal committed Sep 17, 2012
1 parent c8ac480 commit 27affa2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
17 changes: 11 additions & 6 deletions mod/lesson/renderer.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -30,17 +30,22 @@ class mod_lesson_renderer extends plugin_renderer_base {
/** /**
* Returns the header for the lesson module * Returns the header for the lesson module
* *
* @param lesson $lesson * @param lesson $lesson a lesson object.
* @param string $currenttab * @param string $currenttab current tab that is shown.
* @param bool $extraeditbuttons * @param bool $extraeditbuttons if extra edit buttons should be displayed.
* @param int $lessonpageid * @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 * @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; global $CFG;


$activityname = format_string($lesson->name, true, $lesson->course); $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 // Build the buttons
$context = context_module::instance($cm->id); $context = context_module::instance($cm->id);
Expand Down
3 changes: 2 additions & 1 deletion mod/lesson/view.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -349,6 +349,7 @@
$currenttab = 'view'; $currenttab = 'view';
$extraeditbuttons = true; $extraeditbuttons = true;
$lessonpageid = $page->id; $lessonpageid = $page->id;
$extrapagetitle = $page->title;


if (($edit != -1) && $PAGE->user_allowed_editing()) { if (($edit != -1) && $PAGE->user_allowed_editing()) {
$USER->editing = $edit; $USER->editing = $edit;
Expand Down Expand Up @@ -387,7 +388,7 @@
} }


lesson_add_fake_blocks($PAGE, $cm, $lesson, $timer); 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) { if ($attemptflag) {
// We are using level 3 header because attempt heading is a sub-heading of lesson title (MDL-30911). // 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); echo $OUTPUT->heading(get_string('attempt', 'lesson', $retries), 3);
Expand Down
4 changes: 4 additions & 0 deletions mod/upgrade.txt
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ new features:


* mod/xxx/adminlib.php may now include 'plugininfo_yoursubplugintype' class definition * 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 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 === === 2.3 ===


Expand Down

0 comments on commit 27affa2

Please sign in to comment.