Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-26105 Block settings should contains less options, and be more us…

…er friendly

AMOS BEGIN
    MOV [page-blog-index, pagetype], [page-blog-index, blog]
    MOV [page-blog-x, pagetype], [page-blog-x, blog]
    MOV [page-tag-x, pagetype], [page-tag-x, tag]
    MOV [page-course-view-weeks, pagetype], [page-course-view-weeks, format_weeks]
    MOV [page-course-view-weeks-x, pagetype], [page-course-view-weeks-x, format_weeks]
    MOV [page-course-view-topics, pagetype], [page-course-view-topics, format_topics]
    MOV [page-course-view-topics-x, pagetype], [page-course-view-topics-x, format_topics]
AMOS END
  • Loading branch information...
commit b1627a92e52a7dbd67cc64383def143010f509a7 1 parent a56c68e
@dcai dcai authored andyjdavis committed
Showing with 570 additions and 38 deletions.
  1. +59 −23 blocks/edit_form.php
  2. +15 −0 blog/lib.php
  3. +3 −1 course/format/topics/lang/en/format_topics.php
  4. +2 −0  course/format/weeks/lang/en/format_weeks.php
  5. +20 −0 course/lib.php
  6. +8 −3 lang/en/block.php
  7. +3 −0  lang/en/blog.php
  8. +2 −0  lang/en/notes.php
  9. +2 −6 lang/en/pagetype.php
  10. +5 −0 lang/en/question.php
  11. +5 −0 lang/en/tag.php
  12. +140 −3 lib/blocklib.php
  13. +23 −0 lib/questionlib.php
  14. +3 −0  mod/assignment/lang/en/assignment.php
  15. +14 −0 mod/assignment/lib.php
  16. +1 −0  mod/chat/lang/en/chat.php
  17. +11 −0 mod/chat/lib.php
  18. +1 −0  mod/choice/lang/en/choice.php
  19. +11 −0 mod/choice/lib.php
  20. +1 −0  mod/data/lang/en/data.php
  21. +11 −0 mod/data/lib.php
  22. +1 −0  mod/feedback/lang/en/feedback.php
  23. +11 −0 mod/feedback/lib.php
  24. +2 −0  mod/folder/lang/en/folder.php
  25. +11 −0 mod/folder/lib.php
  26. +3 −0  mod/forum/lang/en/forum.php
  27. +15 −0 mod/forum/lib.php
  28. +3 −0  mod/forum/view.php
  29. +1 −0  mod/glossary/lang/en/glossary.php
  30. +11 −0 mod/glossary/lib.php
  31. +1 −0  mod/imscp/lang/en/imscp.php
  32. +11 −0 mod/imscp/lib.php
  33. +1 −0  mod/lesson/lang/en/lesson.php
  34. +12 −0 mod/lesson/lib.php
  35. +1 −0  mod/page/lang/en/page.php
  36. +11 −0 mod/page/lib.php
  37. +1 −0  mod/quiz/lang/en/quiz.php
  38. +11 −0 mod/quiz/lib.php
  39. +1 −0  mod/resource/lang/en/resource.php
  40. +11 −0 mod/resource/lib.php
  41. +1 −0  mod/scorm/lang/en/scorm.php
  42. +11 −0 mod/scorm/lib.php
  43. +1 −0  mod/survey/lang/en/survey.php
  44. +11 −0 mod/survey/lib.php
  45. +1 −0  mod/url/lang/en/url.php
  46. +12 −1 mod/url/lib.php
  47. +5 −0 mod/wiki/lang/en/wiki.php
  48. +17 −0 mod/wiki/lib.php
  49. +1 −0  mod/workshop/lang/en/workshop.php
  50. +11 −0 mod/workshop/lib.php
  51. +10 −0 notes/lib.php
  52. +16 −0 tag/lib.php
  53. +1 −1  user/index.php
  54. +13 −0 user/lib.php
View
82 blocks/edit_form.php
@@ -32,6 +32,7 @@
}
require_once($CFG->libdir . '/formslib.php');
+require_once($CFG->libdir . '/blocklib.php');
/**
* The base class form used by blocks/edit.php to edit block instance configuration.
@@ -89,40 +90,73 @@ function definition() {
$parentcontext = get_context_instance_by_id($this->block->instance->parentcontextid);
$mform->addElement('hidden', 'bui_parentcontextid', $parentcontext->id);
+ $mform->addElement('static', 'bui_homecontext', get_string('createdat', 'block'), print_context_name($parentcontext));
+ $mform->addHelpButton('bui_homecontext', 'createdat', 'block');
+
+ // parse pagetype patterns
+ $bits = explode('-', $this->page->pagetype);
+
$contextoptions = array();
if ( ($parentcontext->contextlevel == CONTEXT_COURSE && $parentcontext->instanceid == SITEID) ||
- ($parentcontext->contextlevel == CONTEXT_SYSTEM)) { // Home page
- $contextoptions[0] = get_string('showonfrontpageonly', 'block');
- $contextoptions[1] = get_string('showonfrontpageandsubs', 'block');
- $contextoptions[2] = get_string('showonentiresite', 'block');
+ ($parentcontext->contextlevel == CONTEXT_SYSTEM)) { // Home page
+ if ($bits[0] == 'tag') {
+ // tag always use system context, the contexts options don't make differences, so we use
+ // page type patterns only
+ $mform->addElement('hidden', 'bui_contexts', BUI_CONTEXTS_ENTIRE_SITE);
+ } else {
+ $contextoptions[BUI_CONTEXTS_FRONTPAGE_ONLY] = get_string('showonfrontpageonly', 'block');
+ $contextoptions[BUI_CONTEXTS_FRONTPAGE_SUBS] = get_string('showonfrontpageandsubs', 'block');
+ $contextoptions[BUI_CONTEXTS_ENTIRE_SITE] = get_string('showonentiresite', 'block');
+ $mform->addElement('select', 'bui_contexts', get_string('contexts', 'block'), $contextoptions);
+ $mform->addHelpButton('bui_contexts', 'contexts', 'block');
+ }
+ } else if ($parentcontext->contextlevel == CONTEXT_COURSE) {
+ // 0 means display on current context only, not child contexts
+ // but if course managers select mod-* as pagetype patterns, block system will overwrite this option
+ // to 1 (display on current context and child contexts)
+ $mform->addElement('hidden', 'bui_contexts', BUI_CONTEXTS_CURRENT);
+ } else if ($parentcontext->contextlevel == CONTEXT_MODULE or $parentcontext->contextlevel == CONTEXT_USER) {
+ // module context doesn't have child contexts, so display in current context only
+ $mform->addElement('hidden', 'bui_contexts', BUI_CONTEXTS_CURRENT);
} else {
$parentcontextname = print_context_name($parentcontext);
- $contextoptions[0] = get_string('showoncontextonly', 'block', $parentcontextname);
- $contextoptions[1] = get_string('showoncontextandsubs', 'block', $parentcontextname);
+ $contextoptions[BUI_CONTEXTS_CURRENT] = get_string('showoncontextonly', 'block', $parentcontextname);
+ $contextoptions[BUI_CONTEXTS_CURRENT_SUBS] = get_string('showoncontextandsubs', 'block', $parentcontextname);
+ $mform->addElement('select', 'bui_contexts', get_string('contexts', 'block'), $contextoptions);
}
- $mform->addElement('select', 'bui_contexts', get_string('contexts', 'block'), $contextoptions);
if ($this->page->pagetype == 'site-index') { // No need for pagetype list on home page
- $pagetypelist = array('*');
+ $pagetypelist = array('*'=>get_string('page-x', 'pagetype'));
} else {
- $pagetypelist = matching_page_type_patterns($this->page->pagetype);
- }
- $pagetypeoptions = array();
- foreach ($pagetypelist as $pagetype) { // Find human-readable names for the pagetypes
- $pagetypeoptions[$pagetype] = $pagetype;
- $pagetypestringname = 'page-'.str_replace('*', 'x',$pagetype); // Better names MDL-21375
- if (get_string_manager()->string_exists($pagetypestringname, 'pagetype')) {
- $pagetypeoptions[$pagetype] .= ' (' . get_string($pagetypestringname, 'pagetype') . ')';
+ // Generate pagetype patterns by callbacks
+ $pagetypelist = generate_page_type_patterns($this->page->pagetype, $parentcontext, $this->page->context);
+ if (!array_key_exists($this->block->instance->pagetypepattern, $pagetypelist)) {
+ // Pushing block's existing page type pattern
+ $pagetypestringname = 'page-'.str_replace('*', 'x', $this->block->instance->pagetypepattern);
+ if (get_string_manager()->string_exists($pagetypestringname, 'pagetype')) {
+ $pagetyelist[$this->block->instance->pagetypepattern] = get_string($pagetypestringname, 'pagetype');
+ }
}
}
- $mform->addElement('select', 'bui_pagetypepattern', get_string('restrictpagetypes', 'block'), $pagetypeoptions);
+
+ // hide page type pattern select box if there is only one choice
+ if (count($pagetypelist) > 1) {
+ $mform->addElement('select', 'bui_pagetypepattern', get_string('restrictpagetypes', 'block'), $pagetypelist);
+ } else {
+ $value = array_pop(array_keys($pagetypelist));
+ $mform->addElement('hidden', 'bui_pagetypepattern', $value);
+ }
if ($this->page->subpage) {
- $subpageoptions = array(
- '%@NULL@%' => get_string('anypagematchingtheabove', 'block'),
- $this->page->subpage => get_string('thisspecificpage', 'block', $this->page->subpage),
- );
- $mform->addElement('select', 'bui_subpagepattern', get_string('subpages', 'block'), $subpageoptions);
+ if ($parentcontext->contextlevel == CONTEXT_USER) {
+ $mform->addElement('hidden', 'bui_subpagepattern', '%@NULL@%');
+ } else {
+ $subpageoptions = array(
+ '%@NULL@%' => get_string('anypagematchingtheabove', 'block'),
+ $this->page->subpage => get_string('thisspecificpage', 'block', $this->page->subpage),
+ );
+ $mform->addElement('select', 'bui_subpagepattern', get_string('subpages', 'block'), $subpageoptions);
+ }
}
$defaultregionoptions = $regionoptions;
@@ -131,8 +165,10 @@ function definition() {
$defaultregionoptions[$defaultregion] = $defaultregion;
}
$mform->addElement('select', 'bui_defaultregion', get_string('defaultregion', 'block'), $defaultregionoptions);
+ $mform->addHelpButton('bui_defaultregion', 'defaultregion', 'block');
$mform->addElement('select', 'bui_defaultweight', get_string('defaultweight', 'block'), $weightoptions);
+ $mform->addHelpButton('bui_defaultweight', 'defaultweight', 'block');
// Where this block is positioned on this page.
$mform->addElement('header', 'whereheader', get_string('onthispage', 'block'));
@@ -182,7 +218,7 @@ function set_data($defaults) {
$systemcontext = get_context_instance(CONTEXT_SYSTEM);
if ($defaults->parentcontextid == $systemcontext->id) {
- $defaults->bui_contexts = 2; // System-wide and sticky
+ $defaults->bui_contexts = BUI_CONTEXTS_ENTIRE_SITE; // System-wide and sticky
} else {
$defaults->bui_contexts = $defaults->bui_showinsubcontexts;
}
View
15 blog/lib.php
@@ -1028,3 +1028,18 @@ function blog_comment_validate($comment_param) {
}
return true;
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function blog_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ return array(
+ '*'=>get_string('page-x', 'pagetype'),
+ 'blog-*'=>get_string('page-blog-x', 'blog'),
+ 'blog-index'=>get_string('page-blog-index', 'blog'),
+ 'blog-edit'=>get_string('page-blog-edit', 'blog')
+ );
+}
View
4 course/format/topics/lang/en/format_topics.php
@@ -25,4 +25,6 @@
$string['sectionname'] = 'Topic';
$string['pluginname'] = 'Topics format';
-$string['section0name'] = 'General';
+$string['section0name'] = 'General';
+$string['page-course-view-topics'] = 'Any course main page in topics format';
+$string['page-course-view-topics-x'] = 'Any course page in topics format';
View
2  course/format/weeks/lang/en/format_weeks.php
@@ -26,3 +26,5 @@
$string['sectionname'] = 'Week';
$string['pluginname'] = 'Weekly format';
$string['section0name'] = 'General';
+$string['page-course-view-weeks'] = 'Any course main page in weeks format';
+$string['page-course-view-weeks-x'] = 'Any course page in weeks format';
View
20 course/lib.php
@@ -4211,3 +4211,23 @@ protected function notify($touser, $fromuser, $name='courserequested', $subject,
message_send($eventdata);
}
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function course_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ // if above course context ,display all course fomats
+ list($currentcontext, $course, $cm) = get_context_info_array($currentcontext->id);
+ if ($course->id == SITEID) {
+ return array('*'=>get_string('page-x', 'pagetype'));
+ } else {
+ return array('*'=>get_string('page-x', 'pagetype'),
+ 'course-*'=>get_string('page-course-x', 'pagetype'),
+ 'course-view-*'=>get_string('page-course-view-x', 'pagetype'),
+ 'mod-*'=>get_string('page-mod-x', 'pagetype')
+ );
+ }
+}
View
11 lang/en/block.php
@@ -30,8 +30,13 @@
$string['bracketfirst'] = '{$a} (first)';
$string['bracketlast'] = '{$a} (last)';
$string['contexts'] = 'Page contexts';
+$string['contexts_help'] = 'Contexts are more specific types of pages where this block can be displayed within the original block location. You will have different options here depending on the original block location and your current location. For example, you can restrict a block to only appearing on forum pages in a course by adding the block to the course (making it appear on all sub-pages), then going into a forum and editing the block settings again to restrict display to just forum pages.';
+$string['createdat'] = 'Original block location';
+$string['createdat_help'] = 'This is the original location where the block was created, even though other block settings may cause it to appear in other locations (contexts) within this original location. For example, a block created in a course could be displayed on one or more pages within that course only. A block created on the front page, however, could be displayed throughout the site.';
$string['defaultregion'] = 'Default region';
+$string['defaultregion_help'] = 'Themes may define one or more named block regions where blocks are displayed. This setting defines which of these you want this block to appear in by default. The region may be overridden on specific pages if required.';
$string['defaultweight'] = 'Default weight';
+$string['defaultweight_help'] = 'The default weight allows you to choose roughly where you want the block to appear in the chosen region, either at the top or the bottom. The final location is calculated from all the blocks in that region (for example, only one block can actually be at the top). This value can be overridden on specific pages if required.';
$string['moveblockhere'] = 'Move block here';
$string['movingthisblockcancel'] = 'Moving this block ({$a})';
$string['onthispage'] = 'On this page';
@@ -43,9 +48,9 @@
$string['showonfrontpageandsubs'] = 'Display on the front page and any pages added to the front page';
$string['showonfrontpageonly'] = 'Display on the front page only';
$string['site-*'] = 'Any top-level site page';
-$string['subpages'] = 'Specific sub-page';
-$string['restrictpagetypes'] = 'Restrict to these page types';
-$string['thisspecificpage'] = 'This specific page (page {$a})';
+$string['subpages'] = 'Select pages';
+$string['restrictpagetypes'] = 'Display on page types';
+$string['thisspecificpage'] = 'This specific page';
$string['undockall'] = 'Undock all';
$string['undockitem'] = 'Undock this item';
$string['visible'] = 'Visible';
View
3  lang/en/blog.php
@@ -176,3 +176,6 @@
$string['viewuserentries'] = 'View all entries by {$a}';
$string['worldblogs'] = 'The world can read entries set to be world-accessible';
$string['wrongpostid'] = 'Wrong blog post id';
+$string['page-blog-edit'] = 'Blog editing pages';
+$string['page-blog-index'] = 'Blog listing pages';
+$string['page-blog-x'] = 'All blog pages';
View
2  lang/en/notes.php
@@ -46,6 +46,8 @@
$string['notesdisabled'] = 'Notes are disabled, sorry.';
$string['notesnotvisible'] = 'You are not allowed to view the notes.';
$string['nouser'] = 'You must select a user';
+$string['page-notes-x'] = 'Any note pages';
+$string['page-notes-index'] = 'Notes main page';
$string['personal'] = 'personal';
$string['personalnotes'] = 'Personal notes';
$string['publishstate'] = 'Context';
View
8 lang/en/pagetype.php
@@ -23,18 +23,14 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
-$string['page-blog-index'] = 'Blog listing pages';
-$string['page-blog-x'] = 'All blog pages';
-$string['page-course-view-topics'] = 'Any course main page in topics format';
-$string['page-course-view-weeks'] = 'Any course main page in weeks format';
$string['page-course-view-x'] = 'Any type of course main page';
$string['page-course-x'] = 'Any course page';
$string['page-mod-x'] = 'Any activity module page';
$string['page-mod-x-view'] = 'Any main activity module page';
-$string['page-my-index'] = 'Users\' My home page';
+$string['page-my-index'] = 'My home page';
$string['page-site-index'] = 'The front page only';
$string['page-site-x'] = 'Any top-level site page';
-$string['page-tag-x'] = 'All tag pages';
$string['page-user-view'] = 'Only user profile pages';
+$string['page-user-profile'] = 'Only user profile pages';
$string['page-user-x'] = 'All user pages';
$string['page-x'] = 'Any page';
View
5 lang/en/question.php
@@ -186,6 +186,11 @@
$string['notenoughdatatomovequestions'] = 'You need to provide the question ids of questions you want to move.';
$string['notflagged'] = 'Not flagged';
$string['novirtualquestiontype'] = 'No virtual question type for question type {$a}';
+$string['page-question-x'] = 'Any question page';
+$string['page-question-edit'] = 'Question editing page';
+$string['page-question-category'] = 'Question category page';
+$string['page-question-import'] = 'Question import page';
+$string['page-question-export'] = 'Question export page';
$string['parentcategory'] = 'Parent category';
$string['parentcategory_help'] = 'The parent category is the one in which the new category will be placed. "Top" means that this category is not contained in any other category. Category contexts are shown in bold type. There must be at least one category in each context.';
$string['parentcategory_link'] = 'question/category';
View
5 lang/en/tag.php
@@ -26,6 +26,7 @@
$string['addedotag'] = '"{$a}" was added as an official tag.';
$string['addotags'] = 'Add official tags';
$string['addtagtomyinterests'] = 'Add "{$a}" to my interests';
+$string['alltagpages'] = 'All tag pages';
$string['count'] = 'Count';
$string['delete'] = 'Delete';
$string['deleted'] = 'Deleted';
@@ -82,3 +83,7 @@
$string['updated'] = 'Updated';
$string['updatetag'] = 'Update';
$string['withselectedtags'] = 'With selected tags...';
+$string['page-tag-x'] = 'All tag pages';
+$string['page-tag-index'] = 'Single tag page';
+$string['page-tag-search'] = 'Tag search page';
+$string['page-tag-manage'] = 'Tag manage page';
View
143 lib/blocklib.php
@@ -53,6 +53,13 @@
define('BLOCKS_PINNED_BOTH',2);
/**#@-*/
+define('BUI_CONTEXTS_FRONTPAGE_ONLY', 0);
+define('BUI_CONTEXTS_FRONTPAGE_SUBS', 1);
+define('BUI_CONTEXTS_ENTIRE_SITE', 2);
+
+define('BUI_CONTEXTS_CURRENT', 0);
+define('BUI_CONTEXTS_CURRENT_SUBS', 1);
+
/**
* Exception thrown when someone tried to do something with a block that does
* not exist on a page.
@@ -1152,7 +1159,8 @@ public function process_url_edit() {
$editpage = new moodle_page();
$editpage->set_pagelayout('admin');
$editpage->set_course($this->page->course);
- $editpage->set_context($block->context);
+ //$editpage->set_context($block->context);
+ $editpage->set_context($this->page->context);
if ($this->page->cm) {
$editpage->set_cm($this->page->cm);
}
@@ -1204,8 +1212,9 @@ public function process_url_edit() {
$bi->showinsubcontexts = (int)(!empty($data->bui_contexts));
// If the block wants to be system-wide, then explicitly set that
- if ($data->bui_contexts == 2) { // Only possible on a frontpage or system page
+ if ($data->bui_contexts == BUI_CONTEXTS_ENTIRE_SITE) { // Only possible on a frontpage or system page
$bi->parentcontextid = $systemcontext->id;
+ $bi->showinsubcontexts = 1;
} else { // The block doesn't want to be system-wide, so let's ensure that
if ($parentcontext->id == $systemcontext->id) { // We need to move it to the front page
@@ -1216,6 +1225,25 @@ public function process_url_edit() {
}
}
+ $bits = explode('-', $bi->pagetypepattern);
+ // hacks for some contexts
+ if (($parentcontext->contextlevel == CONTEXT_COURSE) && ($parentcontext->instanceid != SITEID)) {
+ // For course context
+ // is page type pattern is mod-*, change showinsubcontext to 1
+ if ($bits[0] == 'mod' || $bi->pagetypepattern == '*') {
+ $bi->showinsubcontexts = 1;
+ } else {
+ $bi->showinsubcontexts = 0;
+ }
+ } else if ($parentcontext->contextlevel == CONTEXT_USER) {
+ // for user context
+ // subpagepattern should be null
+ if ($bits[0] == 'user' or $bits[0] == 'my') {
+ // we don't need subpagepattern in usercontext
+ $bi->subpagepattern = null;
+ }
+ }
+
$bi->defaultregion = $data->bui_defaultregion;
$bi->defaultweight = $data->bui_defaultweight;
$DB->update_record('block_instances', $bi);
@@ -1266,7 +1294,18 @@ public function process_url_edit() {
$strheading = get_string('blockconfiga', 'moodle', $block->get_title());
$editpage->set_title($strheading);
$editpage->set_heading($strheading);
- $editpage->navbar->add($strheading);
+ $bits = explode('-', $this->page->pagetype);
+ if ($bits[0] == 'tag' && !empty($this->page->subpage)) {
+ // better navbar for tag pages
+ $editpage->navbar->add(get_string('tags'), new moodle_url('/tag/'));
+ $tag = tag_get('id', $this->page->subpage, '*');
+ // tag search page doesn't have subpageid
+ if ($tag) {
+ $editpage->navbar->add($tag->name, new moodle_url('/tag/index.php', array('id'=>$tag->id)));
+ }
+ }
+ $editpage->navbar->add($block->get_title());
+ $editpage->navbar->add(get_string('configuration'));
$output = $editpage->get_renderer('core');
echo $output->header();
echo $output->heading($strheading, 2);
@@ -1508,6 +1547,104 @@ function matching_page_type_patterns($pagetype) {
return $patterns;
}
+/**
+ * Given a specific page type, parent context and currect context, return all the page type patterns
+ * that might be used by this block.
+ *
+ * @param string $pagetype for example 'course-view-weeks' or 'mod-quiz-view'.
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ * @return array an array of all the page type patterns that might match this page type.
+ */
+function generate_page_type_patterns($pagetype, $parentcontext = null, $currentcontext = null) {
+ global $CFG;
+ // always includes current page type: $PAGE->pagetype
+ // if plugin callbacks defined, it will be overwriten by a property description
+ $patterns = array($pagetype=>$pagetype);
+ $bits = explode('-', $pagetype);
+ switch ($bits[0]) {
+ case 'mod':
+ // for modules
+ $modname = $bits[1];
+ require_once("$CFG->dirroot/mod/$modname/lib.php");
+ $listfunction = $modname . '_pagetypelist';
+ if (function_exists($listfunction)) {
+ $module_pagetype = $listfunction($pagetype, $parentcontext, $currentcontext);
+ if ($parentcontext->contextlevel == CONTEXT_COURSE) {
+ // including course page type
+ require_once("$CFG->dirroot/course/lib.php");
+ return array_merge(course_pagetypelist($pagetype, $parentcontext, $currentcontext), $module_pagetype);
+ } else {
+ return $module_pagetype;
+ }
+ } else {
+ // if modules don't have callbacks
+ // generate two default page type patterns for modules only
+ if ($bits[2] == 'view') {
+ $patterns['mod-*-view'] = get_string('page-mod-x-view', 'pagetype');
+ } else if ($bits[2] == 'index') {
+ $patterns['mod-*-index'] = get_string('page-mod-x-index', 'pagetype');
+ }
+ }
+ break;
+
+ case 'my':
+ case 'user':
+ require_once("$CFG->dirroot/user/lib.php");
+ return user_pagetypelist($pagetype, $parentcontext, $currentcontext);
+ break;
+
+ case 'course':
+ require_once("$CFG->dirroot/course/lib.php");
+ return course_pagetypelist($pagetype, $parentcontext, $currentcontext);
+ break;
+
+ case 'tag':
+ require_once("$CFG->dirroot/tag/lib.php");
+ return tag_pagetypelist($pagetype, $parentcontext, $currentcontext);
+ break;
+
+ case 'blog':
+ require_once("$CFG->dirroot/blog/lib.php");
+ return blog_pagetypelist($pagetype, $parentcontext, $currentcontext);
+ break;
+
+ case 'note':
+ require_once("$CFG->dirroot/notes/lib.php");
+ return note_pagetypelist($pagetype, $parentcontext, $currentcontext);
+ break;
+
+ case 'question':
+ require_once("$CFG->libdir/questionlib.php");
+ return question_pagetypelist($pagetype, $parentcontext, $currentcontext);
+ break;
+
+ case 'local':
+ require_once("$CFG->dirroot/local/{$bits[1]}/lib.php");
+ $functionname = 'local_' . $bits[1] . '_pagetypelist';
+ if (function_exists($functionname)) {
+ return $functionname($pagetype, $parentcontext, $currentcontext);
+ }
+ break;
+ }
+
+ // Generate page type patterns based on current page type if
+ // callbacks haven't been defined
+ while (count($bits) > 0) {
+ $pattern = implode('-', $bits) . '-*';
+ $pagetypestringname = 'page-'.str_replace('*', 'x', $pattern);
+ // guessing page type description
+ if (get_string_manager()->string_exists($pagetypestringname, 'pagetype')) {
+ $patterns[$pattern] = get_string($pagetypestringname, 'pagetype');
+ } else {
+ $patterns[$pattern] = $pattern;
+ }
+ array_pop($bits);
+ }
+ $patterns['*'] = get_string('page-x', 'pagetype');
+ return $patterns;
+}
+
/// Functions update the blocks if required by the request parameters ==========
/**
View
23 lib/questionlib.php
@@ -3264,3 +3264,26 @@ function question_make_export_url($contextid, $categoryid, $format, $withcategor
$urlbase = "$CFG->httpswwwroot/pluginfile.php";
return moodle_url::make_file_url($urlbase, "/$contextid/question/export/{$categoryid}/{$format}/{$withcategories}/{$withcontexts}/{$filename}", true);
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function question_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ global $CFG;
+ $types = array(
+ 'question-*'=>get_string('page-question-x', 'question'),
+ 'question-edit'=>get_string('page-question-edit', 'question'),
+ 'question-category'=>get_string('page-question-category', 'question'),
+ 'question-export'=>get_string('page-question-export', 'question'),
+ 'question-import'=>get_string('page-question-import', 'question')
+ );
+ if ($currentcontext->contextlevel == CONTEXT_COURSE) {
+ require_once($CFG->dirroot . '/course/lib.php');
+ return array_merge(course_pagetypelist($pagetype, $parentcontext, $currentcontext), $types);
+ } else {
+ return $types;
+ }
+}
View
3  mod/assignment/lang/en/assignment.php
@@ -156,6 +156,9 @@
$string['operation'] = 'Operation';
$string['optionalsettings'] = 'Optional settings';
$string['overwritewarning'] = 'Warning: uploading again will REPLACE your current submission';
+$string['page-mod-assignment-x'] = 'Any assignment module page';
+$string['page-mod-assignment-view'] = 'Assignment module main page';
+$string['page-mod-assignment-submissions'] = 'Assignment module submission page';
$string['pagesize'] = 'Submissions shown per page';
$string['popupinnewwindow'] = 'Open in a popup window';
$string['pluginadministration'] = 'Assignment administration';
View
14 mod/assignment/lib.php
@@ -3716,3 +3716,17 @@ function assignment_get_file_areas($course, $cm, $context) {
return $areas;
}
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function assignment_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array(
+ 'mod-assignment-*'=>get_string('page-mod-assignment-x', 'assignment'),
+ 'mod-assignment-view'=>get_string('page-mod-assignment-view', 'assignment'),
+ 'mod-assignment-submissions'=>get_string('page-mod-assignment-submissions', 'assignment')
+ );
+ return $module_pagetype;
+}
View
1  mod/chat/lang/en/chat.php
@@ -90,6 +90,7 @@
$string['notlogged'] = 'You are not logged in!';
$string['nopermissiontoseethechatlog'] = 'You don\'t have permission to see the chat logs.';
$string['oldping'] = 'Disconnect timeout';
+$string['page-mod-chat-x'] = 'Any chat module page';
$string['pastchats'] = 'Past chat sessions';
$string['pluginadministration'] = 'Chat administration';
$string['pluginname'] = 'Chat';
View
11 mod/chat/lib.php
@@ -1305,3 +1305,14 @@ function chat_user_logout($user) {
global $DB;
$DB->delete_records('chat_users', array('userid'=>$user->id));
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function chat_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-chat-*'=>get_string('page-mod-chat-x', 'chat'));
+ return $module_pagetype;
+}
View
1  mod/choice/lang/en/choice.php
@@ -65,6 +65,7 @@
$string['notenrolledchoose'] = 'Sorry, only enrolled users are allowed to make choices.';
$string['notopenyet'] = 'Sorry, this activity is not available until {$a}';
$string['option'] = 'Option';
+$string['page-mod-choice-x'] = 'Any choice module page';
$string['pluginadministration'] = 'Choice administration';
$string['pluginname'] = 'Choice';
$string['privacy'] = 'Privacy of results';
View
11 mod/choice/lib.php
@@ -856,3 +856,14 @@ function choice_get_completion_state($course, $cm, $userid, $type) {
return $type;
}
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function choice_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-choice-*'=>get_string('page-mod-choice-x', 'choice'));
+ return $module_pagetype;
+}
View
1  mod/data/lang/en/data.php
@@ -252,6 +252,7 @@
$string['overwrite'] = 'Overwrite';
$string['overrwritedesc'] = 'Overwrite the preset if it already exists';
$string['overwritesettings'] = 'Overwrite current settings';
+$string['page-mod-data-x'] = 'Any data module page';
$string['pagesize'] = 'Entries per page';
$string['participants'] = 'Participants';
$string['picture'] = 'Picture';
View
11 mod/data/lib.php
@@ -3337,3 +3337,14 @@ function data_comment_validate($comment_param) {
}
return true;
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function data_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-data-*'=>get_string('page-mod-data-x', 'data'));
+ return $module_pagetype;
+}
View
1  mod/feedback/lang/en/feedback.php
@@ -201,6 +201,7 @@
$string['only_one_captcha_allowed'] = 'Only one captcha is allowed in a feedback';
$string['overview'] = 'Overview';
$string['page'] = 'Page';
+$string['page-mod-feedback-x'] = 'Any feedback module page';
$string['page_after_submit'] = 'Page after submit';
$string['pagebreak'] = 'Page break';
$string['parameters_missing'] = 'Parameters missing from';
View
11 mod/feedback/lib.php
@@ -2781,3 +2781,14 @@ function feedback_init_feedback_session() {
}
}
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function feedback_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-feedback-*'=>get_string('page-mod-feedback-x', 'feedback'));
+ return $module_pagetype;
+}
View
2  mod/folder/lang/en/folder.php
@@ -31,5 +31,7 @@
$string['modulename'] = 'Folder';
$string['modulenameplural'] = 'Folders';
$string['neverseen'] = 'Never seen';
+$string['page-mod-folder-x'] = 'Any folder module page';
+$string['page-mod-folder-view'] = 'Folder module main page';
$string['pluginadministration'] = 'Folder administration';
$string['pluginname'] = 'Folder';
View
11 mod/folder/lib.php
@@ -336,3 +336,14 @@ function folder_extend_navigation($navigation, $course, $module, $cm) {
*/
$navigation->nodetype = navigation_node::NODETYPE_LEAF;
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function folder_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-folder-*'=>get_string('page-mod-folder-x', 'folder'));
+ return $module_pagetype;
+}
View
3  mod/forum/lang/en/forum.php
@@ -273,6 +273,9 @@
$string['openmode2'] = 'Discussions and replies are allowed';
$string['overviewnumpostssince'] = 'posts since last login';
$string['overviewnumunread'] = 'total unread';
+$string['page-mod-forum-x'] = 'Any forum module page';
+$string['page-mod-forum-view'] = 'Forum module main page';
+$string['page-mod-forum-discuss'] = 'Forum module discuss page';
$string['parent'] = 'Show parent';
$string['parentofthispost'] = 'Parent of this post';
$string['pluginadministration'] = 'Forum administration';
View
15 mod/forum/lib.php
@@ -7954,3 +7954,18 @@ function forum_cm_info_view(cm_info $cm) {
}
}
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function forum_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $forum_pagetype = array(
+ 'mod-forum-*'=>get_string('page-mod-forum-x', 'forum'),
+ 'mod-forum-view'=>get_string('page-mod-forum-view', 'forum'),
+ 'mod-forum-discuss'=>get_string('page-mod-forum-discuss', 'forum')
+ );
+ return $forum_pagetype;
+}
View
3  mod/forum/view.php
@@ -57,6 +57,9 @@
if (! $forum = $DB->get_record("forum", array("id" => $cm->instance))) {
print_error('invalidforumid', 'forum');
}
+ if ($forum->type == 'single') {
+ $PAGE->set_pagetype('mod-forum-discuss');
+ }
// move require_course_login here to use forced language for course
// fix for MDL-6926
require_course_login($course, true, $cm);
View
1  mod/glossary/lang/en/glossary.php
@@ -219,6 +219,7 @@
$string['notapproved'] = 'glossary entry is not approved yet.';
$string['numberofentries'] = 'Number of entries';
$string['onebyline'] = '(one per line)';
+$string['page-mod-glossary-x'] = 'Any glossary module page';
$string['pluginadministration'] = 'Glossary administration';
$string['pluginname'] = 'Glossary';
$string['popupformat'] = 'Popup format';
View
11 mod/glossary/lib.php
@@ -2856,3 +2856,14 @@ function glossary_comment_validate($comment_param) {
}
return true;
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function glossary_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-glossary-*'=>get_string('page-mod-glossary-x', 'glossary'));
+ return $module_pagetype;
+}
View
1  mod/imscp/lang/en/imscp.php
@@ -35,6 +35,7 @@
$string['modulename_help'] = 'An IMS content package allows for packages created according to the IMS Content Packaging specification to be displayed in the course.';
$string['modulenameplural'] = 'IMS content packages';
$string['navigation'] = 'Navigation';
+$string['page-mod-imscp-x'] = 'Any imscp module page';
$string['packagefile'] = 'Package file';
$string['pluginadministration'] = 'IMSCP administration';
$string['pluginname'] = 'IMS content package';
View
11 mod/imscp/lib.php
@@ -400,3 +400,14 @@ function imscp_extend_navigation($navigation, $course, $module, $cm) {
*/
$navigation->nodetype = navigation_node::NODETYPE_LEAF;
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function imscp_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-imscp-*'=>get_string('page-mod-imscp-x', 'imscp'));
+ return $module_pagetype;
+}
View
1  mod/lesson/lang/en/lesson.php
@@ -307,6 +307,7 @@
$string['overview'] = 'Overview';
$string['overview_help'] = 'A lesson is made up of a number of pages and optionally content pages. A page contains some content and usually ends with a question. Associated with each answer to the question is a jump. The jump can be relative, such as this page or next page, or absolute, specifying any one of the pages in the lesson. A content page is a page containing a set of links to other pages in the lesson, for example a Table of Contents.';
$string['page'] = 'Page: {$a}';
+$string['page-mod-lesson-x'] = 'Any lesson module page';
$string['pagecontents'] = 'Page contents';
$string['pages'] = 'Pages';
$string['pagetitle'] = 'Page title';
View
12 mod/lesson/lib.php
@@ -988,3 +988,15 @@ function lesson_get_file_info($browser, $areas, $course, $cm, $context, $fileare
}
return new file_info_stored($browser, $context, $storedfile, $urlbase, $filearea, $itemid, true, true, false);
}
+
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function lesson_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-lesson-*'=>get_string('page-mod-lesson-x', 'lesson'));
+ return $module_pagetype;
+}
View
1  mod/page/lang/en/page.php
@@ -37,6 +37,7 @@
$string['modulenameplural'] = 'Pages';
$string['neverseen'] = 'Never seen';
$string['optionsheader'] = 'Options';
+$string['page-mod-page-x'] = 'Any page module page';
$string['page:view'] = 'View page content';
$string['pluginadministration'] = 'Page module administration';
$string['pluginname'] = 'Page';
View
11 mod/page/lib.php
@@ -404,3 +404,14 @@ function page_extend_navigation($navigation, $course, $module, $cm) {
*/
$navigation->nodetype = navigation_node::NODETYPE_LEAF;
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function page_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-page-*'=>get_string('page-mod-page-x', 'page'));
+ return $module_pagetype;
+}
View
1  mod/quiz/lang/en/quiz.php
@@ -574,6 +574,7 @@
$string['overrides'] = 'Overrides';
$string['overrideuser'] = 'Override user';
$string['overrideusereventname'] = '{$a->quiz} - Override';
+$string['page-mod-quiz-x'] = 'Any quiz module page';
$string['pagesize'] = 'Attempts shown per page:';
$string['paragraphquestion'] = 'Paragraph question not supported at line {$a}. The question will be ignored.';
$string['parent'] = 'Parent';
View
11 mod/quiz/lib.php
@@ -1816,3 +1816,14 @@ function quiz_question_pluginfile($course, $context, $component,
send_stored_file($file, 0, 0, $forcedownload);
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function quiz_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-quiz-*'=>get_string('page-mod-quiz-x', 'quiz'));
+ return $module_pagetype;
+}
View
1  mod/resource/lang/en/resource.php
@@ -68,6 +68,7 @@
$string['neverseen'] = 'Never seen';
$string['notmigrated'] = 'This legacy resource type ({$a}) was not yet migrated, sorry.';
$string['optionsheader'] = 'Options';
+$string['page-mod-resource-x'] = 'Any resource module page';
$string['pluginadministration'] = 'File module administration';
$string['pluginname'] = 'File';
$string['popupheight'] = 'Popup height (in pixels)';
View
11 mod/resource/lib.php
@@ -429,3 +429,14 @@ function resource_pluginfile($course, $cm, $context, $filearea, $args, $forcedow
// finally send the file
send_stored_file($file, 86400, $filter, $forcedownload);
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function resource_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-resource-*'=>get_string('page-mod-resource-x', 'resource'));
+ return $module_pagetype;
+}
View
1  mod/scorm/lang/en/scorm.php
@@ -186,6 +186,7 @@
$string['organizations'] = 'Organizations';
$string['othersettings'] = 'Additional settings';
$string['othertracks'] = 'Other tracks';
+$string['page-mod-scorm-x'] = 'Any scorm module page';
$string['pagesize'] = 'Page size';
$string['package'] = 'Package file';
$string['package_help'] = 'The package file is a zip (or pif) file containing SCORM/AICC course definition files.';
View
11 mod/scorm/lib.php
@@ -1068,3 +1068,14 @@ function scorm_print_overview($courses, &$htmlarray) {
}
}
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function scorm_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-scorm-*'=>get_string('page-mod-scorm-x', 'scorm'));
+ return $module_pagetype;
+}
View
1  mod/survey/lang/en/survey.php
@@ -214,6 +214,7 @@
$string['notdone'] = 'Not done yet';
$string['notes'] = 'Your private analysis and notes';
$string['othercomments'] = 'Do you have any other comments?';
+$string['page-mod-survey-x'] = 'Any survey module page';
$string['peoplecompleted'] = '{$a} people have completed this survey so far';
$string['pluginadministration'] = 'Survey administration';
$string['pluginname'] = 'Survey';
View
11 mod/survey/lib.php
@@ -864,3 +864,14 @@ function survey_extend_settings_navigation($settings, $surveynode) {
}
}
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function survey_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-survey-*'=>get_string('page-mod-survey-x', 'survey'));
+ return $module_pagetype;
+}
View
1  mod/url/lang/en/url.php
@@ -49,6 +49,7 @@
$string['modulenameplural'] = 'URLs';
$string['neverseen'] = 'Never seen';
$string['optionsheader'] = 'Options';
+$string['page-mod-url-x'] = 'Any url module page';
$string['parameterinfo'] = 'parameter=variable';
$string['parametersheader'] = 'Parameters';
$string['pluginadministration'] = 'URL module administration';
View
13 mod/url/lib.php
@@ -310,4 +310,15 @@ function url_extend_navigation($navigation, $course, $module, $cm) {
* you content.
*/
$navigation->nodetype = navigation_node::NODETYPE_LEAF;
-}
+}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function url_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-url-*'=>get_string('page-mod-url-x', 'url'));
+ return $module_pagetype;
+}
View
5 mod/wiki/lang/en/wiki.php
@@ -131,6 +131,11 @@
$string['orphaned_help'] = 'List of pages that are not linked from other page.';
$string['overridelocks'] = 'Override locks';
$string['overridinglocks'] = 'Overriding locks...';
+$string['page-mod-wiki-x'] = 'Any wiki module page';
+$string['page-mod-wiki-view'] = 'Wiki module main page';
+$string['page-mod-wiki-comments'] = 'Wiki module comments page';
+$string['page-mod-wiki-history'] = 'Wiki history page';
+$string['page-mod-wiki-map'] = 'Wiki map page';
$string['pageexists'] = 'This page already exists. Redirecting to it.';
$string['pageindex'] = 'Page Index';
$string['pageindex_help'] = 'This wiki\'s page tree';
View
17 mod/wiki/lib.php
@@ -639,3 +639,20 @@ function wiki_comment_validate($comment_param) {
}
return true;
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function wiki_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array(
+ 'mod-wiki-*'=>get_string('page-mod-wiki-x', 'wiki'),
+ 'mod-wiki-view'=>get_string('page-mod-wiki-view', 'wiki'),
+ 'mod-wiki-comments'=>get_string('page-mod-wiki-comments', 'wiki'),
+ 'mod-wiki-history'=>get_string('page-mod-wiki-history', 'wiki'),
+ 'mod-wiki-map'=>get_string('page-mod-wiki-map', 'wiki')
+ );
+ return $module_pagetype;
+}
View
1  mod/workshop/lang/en/workshop.php
@@ -162,6 +162,7 @@
$string['noworkshops'] = 'There are no workshops in this course';
$string['noyoursubmission'] = 'You have not submitted your work yet';
$string['nullgrade'] = '-';
+$string['page-mod-workshop-x'] = 'Any workshop module page';
$string['participant'] = 'Participant';
$string['participantrevierof'] = 'Participant is reviewer of';
$string['participantreviewedby'] = 'Participant is reviewed by';
View
11 mod/workshop/lib.php
@@ -1342,3 +1342,14 @@ function workshop_extend_settings_navigation(settings_navigation $settingsnav, n
$workshopnode->add(get_string('allocate', 'workshop'), $url, settings_navigation::TYPE_SETTING);
}
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function workshop_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ $module_pagetype = array('mod-workshop-*'=>get_string('page-mod-workshop-x', 'workshop'));
+ return $module_pagetype;
+}
View
10 notes/lib.php
@@ -277,3 +277,13 @@ function note_delete_all($courseid) {
return $DB->delete_records('post', array('module'=>'notes', 'courseid'=>$courseid));
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function note_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ return array('notes-*'=>get_string('page-notes-x', 'notes'));
+}
View
16 tag/lib.php
@@ -1093,3 +1093,19 @@ function tag_unset_flag($tagids) {
$timemodified = time();
return $DB->execute("UPDATE {tag} SET flag = 0, timemodified = ? WHERE id IN ($tagids)", array($timemodified));
}
+
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function tag_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ return array(
+ 'tag-*'=>get_string('page-tag-x', 'tag'),
+ 'tag-index'=>get_string('page-tag-index', 'tag'),
+ 'tag-search'=>get_string('page-tag-search', 'tag'),
+ 'tag-manage'=>get_string('page-tag-manage', 'tag')
+ );
+}
View
2  user/index.php
@@ -40,7 +40,7 @@
}
$course = $DB->get_record('course', array('id'=>$context->instanceid), '*', MUST_EXIST);
} else {
- $course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);
+ $course = $DB->get_record('course', array('id'=>SITEID), '*', MUST_EXIST);
$context = get_context_instance(CONTEXT_COURSE, $course->id, MUST_EXIST);
}
// not needed anymore
View
13 user/lib.php
@@ -95,3 +95,16 @@ function user_get_users_by_id($userids) {
global $DB;
return $DB->get_records_list('user', 'id', $userids);
}
+
+/**
+ * Return a list of page types
+ * @param string $pagetype current page type
+ * @param stdClass $parentcontext Block's parent context
+ * @param stdClass $currentcontext Current context of block
+ */
+function user_pagetypelist($pagetype, $parentcontext, $currentcontext) {
+ return array(
+ 'user-profile'=>get_string('page-user-profile', 'pagetype'),
+ 'my-index'=>get_string('page-my-index', 'pagetype')
+ );
+}
Please sign in to comment.
Something went wrong with that request. Please try again.