Skip to content

Commit

Permalink
MDL-20790 more page layouts -see base theme for full list; also added…
Browse files Browse the repository at this point in the history
… new css body class for describing current layout; base layout is now default for beter BC; require_login() now sets 'incourse' layout automatically
  • Loading branch information
skodak committed Dec 27, 2009
1 parent 7dccaef commit 191b267
Show file tree
Hide file tree
Showing 40 changed files with 128 additions and 49 deletions.
1 change: 1 addition & 0 deletions admin/settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
$PAGE->set_context(get_context_instance(CONTEXT_SYSTEM));
$PAGE->set_url($CFG->admin . '/settings.php', array('section' => $section));
$PAGE->set_pagetype('admin-setting-' . $section);
$PAGE->set_pagelayout('admin');
$PAGE->navigation->clear_cache();

$adminroot = admin_get_root(); // need all settings
Expand Down
1 change: 0 additions & 1 deletion admin/upgradesettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

$adminroot = admin_get_root(); // need all settings
admin_externalpage_setup('upgradesettings'); // now hidden page
$PAGE->set_pagelayout('maintenance');

// now we'll deal with the case that the admin has submitted the form with new settings
if ($data = data_submitted() and confirm_sesskey()) {
Expand Down
2 changes: 1 addition & 1 deletion blocks/rss_client/editfeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ public static function autodiscover_feed_url($url){
$managefeeds = new moodle_url($CFG->wwwroot . '/blocks/rss_client/managefeeds.php', $urlparams);

$PAGE->set_url('blocks/rss_client/editfeed.php', $urlparams);
$PAGE->set_pagelayout('form');
$PAGE->set_pagelayout('base');

if ($rssid) {
$isadding = false;
Expand Down
2 changes: 1 addition & 1 deletion blocks/rss_client/managefeeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@

$strmanage = get_string('managefeeds', 'block_rss_client');

$PAGE->set_pagelayout('form');
$PAGE->set_pagelayout('base');
$PAGE->set_title($strmanage);
$PAGE->set_heading($strmanage);

Expand Down
1 change: 1 addition & 0 deletions course/category.php
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@
$PAGE->set_title("$site->shortname: $category->name");
$PAGE->set_heading("$site->fullname: $strcourses");
$PAGE->set_button(print_course_search('', true, 'navbar'));
$PAGE->set_pagelayout('coursecategory');
echo $OUTPUT->header();
}

Expand Down
2 changes: 1 addition & 1 deletion course/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
$id = optional_param('id', 0, PARAM_INT); // course id
$categoryid = optional_param('category', 0, PARAM_INT); // course category - can be changed in edit form

$PAGE->set_pagelayout('form');
$PAGE->set_pagelayout('base');

/// basic access control checks
if ($id) { // editing course
Expand Down
2 changes: 1 addition & 1 deletion course/modedit.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
$return = optional_param('return', 0, PARAM_BOOL); //return to course/view.php if false or mod/modname/view.php if true
$type = optional_param('type', '', PARAM_ALPHANUM); //TODO: hopefully will be removed in 2.0

$PAGE->set_pagelayout('form');
$PAGE->set_pagelayout('base');

$url = new moodle_url($CFG->wwwroot.'/course/modedit.php');
if (!empty($add)) {
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
$PAGE->set_other_editing_capability('moodle/course:manageactivities');
$PAGE->set_url('');
$PAGE->set_docs_path('');
$PAGE->set_pagelayout('home');
$PAGE->set_pagelayout('frontpage');
$editing = $PAGE->user_is_editing();
$PAGE->set_title($SITE->fullname);
$PAGE->set_heading($SITE->fullname);
Expand Down
2 changes: 1 addition & 1 deletion lib/blocklib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1056,7 +1056,7 @@ public function process_url_edit() {
}

$editpage = new moodle_page();
$editpage->set_pagelayout('form');
$editpage->set_pagelayout('base');
$editpage->set_course($this->page->course);
$editpage->set_context($block->context);
$editurlbase = str_replace($CFG->wwwroot . '/', '', $this->page->url->out(true));
Expand Down
5 changes: 5 additions & 0 deletions lib/moodlelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2049,6 +2049,9 @@ function get_login_url($loginguest=false) {
* If $cm is given and the coursemodule is hidden and the user is not a teacher
* in the course then the user is redirected to the course home page.
*
* When $cm parameter specified, this function sets page layout to 'module'.
* You need to change it manually later if some other layout needed.
*
* @global object
* @global object
* @global object
Expand Down Expand Up @@ -2083,6 +2086,7 @@ function require_login($courseorid=0, $autologinguest=true, $cm=null, $setwantsu
}
if ($cm) {
$PAGE->set_cm($cm, $course);
$PAGE->set_pagelayout('incourse');
} else {
$PAGE->set_course($course);
}
Expand Down Expand Up @@ -2388,6 +2392,7 @@ function require_course_login($courseorid, $autologinguest=true, $cm=null, $setw
}
if ($cm) {
$PAGE->set_cm($cm, $course);
$PAGE->set_pagelayout('incourse');
} else {
$PAGE->set_course($course);
}
Expand Down
6 changes: 4 additions & 2 deletions lib/outputlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ class theme_config {
* <pre>
* $THEME->layouts = array(
* // Most pages - if we encounter an unknown or amissing page type, this one is used.
* 'normal' => array(
* 'standard' => array(
* 'theme' = 'mytheme',
* 'file' => 'normal.php',
* 'regions' => array('side-pre', 'side-post'),
Expand Down Expand Up @@ -999,7 +999,8 @@ protected function layout_info_for_page($pagelayout) {
if (array_key_exists($pagelayout, $this->layouts)) {
return $this->layouts[$pagelayout];
} else {
return $this->layouts['normal'];
debugging('Invalid page layout specified: ' . $pagelayout);
return $this->layouts['standard'];
}
}

Expand Down Expand Up @@ -1028,6 +1029,7 @@ public function layout_file($pagelayout) {
}
}

debugging('Can not find layout file for: ' . $pagelayout);
// fallback to standard normal layout
return "$CFG->dirroot/theme/base/layout/general.php";
}
Expand Down
2 changes: 1 addition & 1 deletion lib/outputrenderers.php
Original file line number Diff line number Diff line change
Expand Up @@ -1692,7 +1692,7 @@ public function fatal_error($message, $moreinfourl, $link, $backtrace, $debuginf
@header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found');
}
$this->page->set_url(''); // no url
//$this->page->set_pagelayout('form'); //TODO: MDL-20676 blocks on error pages are weird, unfortunately it somehow detect the pagelayout from URL :-(
//$this->page->set_pagelayout('base'); //TODO: MDL-20676 blocks on error pages are weird, unfortunately it somehow detect the pagelayout from URL :-(
$this->page->set_title(get_string('error'));
$output .= $this->header();
}
Expand Down
8 changes: 5 additions & 3 deletions lib/pagelib.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ class moodle_page {

protected $_pagetype = null;

protected $_pagelayout = 'normal';
protected $_pagelayout = 'base';

/**
* List of theme layeout options, these are ignored by core.
Expand Down Expand Up @@ -292,7 +292,7 @@ protected function magic_get_pagetype() {

/**
* Please do not call this method directly, use the ->pagelayout syntax. {@link __get()}.
* @return string the general type of page this is. For example 'normal', 'popup', 'home'.
* @return string the general type of page this is. For example 'standard', 'popup', 'home'.
* Allows the theme to display things differently, if it wishes to.
*/
protected function magic_get_pagelayout() {
Expand Down Expand Up @@ -709,7 +709,7 @@ public function set_pagetype($pagetype) {

/**
* @param string $pagelayout the page layout this is. For example 'popup', 'home'.
* This properly defaults to 'normal', so you only need to call this function if
* This properly defaults to 'base', so you only need to call this function if
* you want something different. The exact range of supported layouts is specified
* in the standard theme.
*/
Expand Down Expand Up @@ -1175,6 +1175,8 @@ protected function initialise_standard_body_classes() {
$this->add_body_class('yui-skin-sam'); // Make YUI happy, if it is used.
$this->add_body_class($this->url_to_class_name($CFG->wwwroot));

$this->add_body_class('pagelayout-' . $this->_pagelayout); // extra class describing current page layout

if (!during_initial_install()) {
$this->add_body_class('course-' . $this->_course->id);
$this->add_body_class('context-' . $this->context->id);
Expand Down
1 change: 0 additions & 1 deletion lib/session-test.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
require '../config.php';

$PAGE->set_url(new moodle_url($CFG->wwwroot.'/lib/session-test.php'));
$PAGE->set_pagelayout('form');

error('session test not reimplemented yet'); //DO NOT localize or use print_error()!
//
Expand Down
2 changes: 1 addition & 1 deletion login/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

$context = get_context_instance(CONTEXT_SYSTEM);
$PAGE->set_course($SITE);
$PAGE->set_pagelayout('form');
$PAGE->set_pagelayout('login');

/// Initialize variables
$errormsg = '';
Expand Down
2 changes: 2 additions & 0 deletions mod/assignment/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
}

require_course_login($course);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, "assignment", "view all", "index.php?id=$course->id", "");

$strassignments = get_string("modulenameplural", "assignment");
Expand Down
2 changes: 1 addition & 1 deletion mod/chat/gui_basic/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
require_login($course->id, false, $cm);
require_capability('mod/chat:chat',$context);
$PAGE->set_pagelayout('form');
$PAGE->set_pagelayout('base');

/// Check to see if groups are being used here
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used
Expand Down
1 change: 1 addition & 0 deletions mod/chat/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}

require_course_login($course);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, 'chat', 'view all', "index.php?id=$course->id", '');

Expand Down
1 change: 1 addition & 0 deletions mod/choice/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}

require_course_login($course);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, "choice", "view all", "index?id=$course->id", "");

Expand Down
1 change: 1 addition & 0 deletions mod/data/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
}

require_course_login($course);
$PAGE->set_pagelayout('incourse');

$context = get_context_instance(CONTEXT_COURSE, $course->id);

Expand Down
1 change: 1 addition & 0 deletions mod/feedback/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$capabilities = feedback_load_course_capabilities($course->id);

require_login($course->id);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, 'feedback', 'view all', htmlspecialchars('index.php?id='.$course->id), $course->id);

Expand Down
1 change: 1 addition & 0 deletions mod/folder/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);

require_course_login($course, true);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, 'folder', 'view all', "index.php?id=$course->id", '');

Expand Down
1 change: 1 addition & 0 deletions mod/forum/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
}

require_course_login($course);
$PAGE->set_pagelayout('incourse');
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);


Expand Down
1 change: 1 addition & 0 deletions mod/glossary/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
}

require_course_login($course);
$PAGE->set_pagelayout('incourse');
$context = get_context_instance(CONTEXT_COURSE, $course->id);

add_to_log($course->id, "glossary", "view all", "index.php?id=$course->id", "");
Expand Down
1 change: 1 addition & 0 deletions mod/hotpot/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
}

require_login($course->id);
$PAGE->set_pagelayout('incourse');

$coursecontext = get_context_instance(CONTEXT_COURSE, $id);
$sitecontext = get_context_instance(CONTEXT_SYSTEM);
Expand Down
1 change: 1 addition & 0 deletions mod/imscp/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);

require_course_login($course, true);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, 'imscp', 'view all', "index.php?id=$course->id", '');

Expand Down
1 change: 1 addition & 0 deletions mod/lesson/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
}

require_login($course);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, "lesson", "view all", "index.php?id=$course->id", "");

Expand Down
1 change: 1 addition & 0 deletions mod/page/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);

require_course_login($course, true);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, 'page', 'view all', "index.php?id=$course->id", '');

Expand Down
2 changes: 1 addition & 1 deletion mod/quiz/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ function module_specific_controls($totalnumber, $recurse, $category, $cmid, $cmo
list($thispageurl, $contexts, $cmid, $cm, $quiz, $pagevars) =
question_edit_setup('editq', true);
$PAGE->set_url('mod/quiz/edit.php', $thispageurl->params());
$PAGE->set_pagelayout('form');
$PAGE->set_pagelayout('base');

$defaultcategoryobj = question_make_default_categories($contexts->all());
$defaultcategoryid = $defaultcategoryobj->id;
Expand Down
2 changes: 2 additions & 0 deletions mod/quiz/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
}
$coursecontext = get_context_instance(CONTEXT_COURSE, $id);
require_login($course->id);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, "quiz", "view all", "index.php?id=$course->id", "");

// Print the header
Expand Down
1 change: 1 addition & 0 deletions mod/resource/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);

require_course_login($course, true);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, 'resource', 'view all', "index.php?id=$course->id", '');

Expand Down
1 change: 1 addition & 0 deletions mod/scorm/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
}

require_course_login($course);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, "scorm", "view all", "index.php?id=$course->id", "");

Expand Down
1 change: 1 addition & 0 deletions mod/survey/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
}

require_course_login($course);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, "survey", "view all", "index.php?id=$course->id", "");

Expand Down
1 change: 1 addition & 0 deletions mod/url/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
$course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);

require_course_login($course, true);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, 'url', 'view all', "index.php?id=$course->id", '');

Expand Down
1 change: 1 addition & 0 deletions mod/wiki/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
}

require_course_login($course);
$PAGE->set_pagelayout('incourse');

add_to_log($course->id, "wiki", "view all", "index.php?id=$course->id", "");

Expand Down
2 changes: 1 addition & 1 deletion my/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

$PAGE->set_context(get_context_instance(CONTEXT_USER, $USER->id));
$PAGE->set_url('my/index.php');
$PAGE->set_pagelayout('my');
$PAGE->set_pagelayout('mydashboard');
$PAGE->set_blocks_editing_capability('moodle/my:manageblocks');

if (($edit != -1) and $PAGE->user_allowed_editing()) {
Expand Down
2 changes: 1 addition & 1 deletion tag/edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
$PAGE->set_subpage($tag->id);
$PAGE->set_context($systemcontext);
$PAGE->set_blocks_editing_capability('moodle/tag:editblocks');
$PAGE->set_pagelayout('form');
$PAGE->set_pagelayout('base');

$PAGE->requires->yui2_lib('animation');
$PAGE->requires->yui2_lib('autocomplete');
Expand Down
Loading

0 comments on commit 191b267

Please sign in to comment.