Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Commit

Permalink
Implement #734.
Browse files Browse the repository at this point in the history
  • Loading branch information
gjb2048 committed Jan 13, 2017
1 parent 033cdd4 commit 955266b
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 15 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ New in 3.1.1.6
==============
- FIX: Issue #798: Slider title needs to support multi-lang filter.
- FIX: Course category multi-lang, ref: https://moodle.org/mod/forum/discuss.php?d=344426#p1389008.
- NEW: Issue #734: Unable to disable the new "page top" block region.

New in 3.1.1.5
==============
Expand Down
2 changes: 1 addition & 1 deletion classes/toolbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ static private function check_corerenderer() {
global $PAGE;
$corerenderer = null;
try {
$corerenderer = $PAGE->get_renderer('theme_'.$PAGE->theme->name, 'core');
$corerenderer = $PAGE->get_renderer('theme_'.$page->theme->name, 'core');
} catch (\coding_exception $ce) {
// Specialised renderer may not exist in theme. This is not a coding fault. We just need to cope.
$corerenderer = null;
Expand Down
11 changes: 8 additions & 3 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,18 @@
$baseregions[] = 'header';
$fpaddregions[] = 'header';
}
$standardregions = array_merge(array('side-pre', 'page-top'), $baseregions);
$onecolumnregions = array_merge($baseregions);
$standardregions = array_merge(array('side-pre'), $baseregions);
if (get_config('theme_essential', 'pagetopblocks')) {
$onecolumnregions[] = 'page-top';
$standardregions[] = 'page-top';
}

$THEME->layouts = array(
// Most backwards compatible layout without the blocks - this is the layout used by default.
'base' => array(
'file' => 'columns1.php',
'regions' => $baseregions,
'regions' => $onecolumnregions,
'defaultregion' => 'footer-middle',
),
// Front page.
Expand Down Expand Up @@ -164,7 +169,7 @@
// Should display the content and basic headers only.
'print' => array(
'file' => 'columns1.php',
'regions' => $baseregions,
'regions' => $onecolumnregions,
'defaultregion' => '',
'options' => array('nofooter' => true),
),
Expand Down
10 changes: 7 additions & 3 deletions lang/en/theme_essential.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,10 @@
$string['stylestretch'] = 'Stretch';
$string['styletiled'] = 'Tiled';

$string['pagetopblocks'] = 'Enable additional page \'Page top\' blocks';
$string['pagetopblocksdesc'] = 'If enabled this will display an additional block location beside the side blocks and above the content area on all pages except the \'Front page\' which has its own setting. Note: The number of blocks per row depends on the setting \'pagetopblocksperrow\'.';
$string['pagetopblocksperrow'] = 'Page top blocks per row';
$string['pagetopblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for pages with \'Page top blocks\'. Current pages are: Admin, Course, Course Category, Dashboard, Frontpage, My Public.';
$string['pagetopblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for pages with \'Page top blocks\'. Current pages are: Course, Course Category, Dashboard, My Public and Print.';
$string['pagebottomblocksperrow'] = 'Page bottom blocks per row';
$string['pagebottomblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for pages with \'Page bottom blocks\'. Current pages are: Admin, Course management, Grading and Quiz edit.';

Expand Down Expand Up @@ -455,9 +457,11 @@
$string['frontpagemiddleblocks'] = 'Enable additional front page \'Home\' (was \'Middle\') blocks';
$string['frontpagemiddleblocksdesc'] = 'If enabled this will display an additional block location just under the marketing spots.';
$string['frontpagehomeblocksperrow'] = 'Home (was \'Middle\') blocks per row';
$string['frontpagehomeblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for the \'Home blocks\'.';
$string['frontpagehomeblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for the \'Home blocks\' block region.';
$string['fppagetopblocks'] = 'Enable additional front page \'Page top\' blocks';
$string['fppagetopblocksdesc'] = 'If enabled this will display an additional block location beside the side blocks and above the content area. Note: The number of blocks per row depends on the setting \'pagetopblocksperrow\'.';
$string['fppagetopblocksdesc'] = 'If enabled this will display an additional block location beside the side blocks and above the content area. Note: The number of blocks per row depends on the setting \'fppagetopblocksperrow\'.';
$string['fppagetopblocksperrow'] = 'Page top blocks per row';
$string['fppagetopblocksperrowdesc'] = 'State up to how many blocks per row between {$a->lower} and {$a->upper} for the \'Page top\' block region on the front page.';

// Slideshow.
$string['slideshowheading'] = 'Slide show';
Expand Down
14 changes: 9 additions & 5 deletions layout/columns1.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,16 @@
<!-- Start Main Regions -->
<div id="page-content" class="row-fluid">
<section id="region-main" class="span12">
<?php echo $OUTPUT->course_title(); ?>
<?php echo $OUTPUT->course_content_header(); ?>
<?php echo $OUTPUT->main_content(); ?>
<?php if (empty($PAGE->layout_options['nocoursefooter'])) {
<?php
if (\theme_essential\toolbox::get_setting('pagetopblocks')) {
echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow');
}
echo $OUTPUT->course_title();
echo $OUTPUT->course_content_header();
echo $OUTPUT->main_content();
if (empty($PAGE->layout_options['nocoursefooter'])) {
echo $OUTPUT->course_content_footer();
}
}
?>
</section>
</div>
Expand Down
4 changes: 3 additions & 1 deletion layout/columns3.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@
} else {
echo '<div id="content" class="span8 desktop-first-column">';
}
echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow');
if (\theme_essential\toolbox::get_setting('pagetopblocks')) {
echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow');
}
echo '<section id="region-main">';
echo $OUTPUT->course_title();
echo $OUTPUT->course_content_header();
Expand Down
2 changes: 1 addition & 1 deletion layout/tiles/fppagetopblocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow');
echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'fppagetopblocksperrow');
4 changes: 3 additions & 1 deletion layout/tiles/twocolumncontent.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@
} else {
echo '<div id="content" class="span9">';
}
echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow');
if (\theme_essential\toolbox::get_setting('pagetopblocks')) {
echo $OUTPUT->essential_blocks('page-top', 'row-fluid', 'aside', 'pagetopblocksperrow');
}
echo '<section id="region-main">';
echo $OUTPUT->course_title();
echo $OUTPUT->course_content_header();
Expand Down
20 changes: 20 additions & 0 deletions settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@
$setting->set_updatedcallback('theme_reset_all_caches');
$essentialsettingsgeneric->add($setting);

// Toggle page top blocks.
$name = 'theme_essential/pagetopblocks';
$title = get_string('pagetopblocks', 'theme_essential');
$description = get_string('pagetopblocksdesc', 'theme_essential');
$default = true;
$setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false);
$setting->set_updatedcallback('theme_reset_all_caches');
$essentialsettingsgeneric->add($setting);

// Page top blocks per row.
$name = 'theme_essential/pagetopblocksperrow';
$title = get_string('pagetopblocksperrow', 'theme_essential');
Expand Down Expand Up @@ -1625,6 +1634,17 @@
$setting->set_updatedcallback('theme_reset_all_caches');
$essentialsettingsfrontpage->add($setting);

// Page top blocks per row.
$name = 'theme_essential/fppagetopblocksperrow';
$title = get_string('fppagetopblocksperrow', 'theme_essential');
$default = 3;
$lower = 1;
$upper = 4;
$description = get_string('fppagetopblocksperrowdesc', 'theme_essential',
array('lower' => $lower, 'upper' => $upper));
$setting = new essential_admin_setting_configinteger($name, $title, $description, $default, $lower, $upper);
$essentialsettingsfrontpage->add($setting);

// Marketing spot settings.
$essentialsettingsfrontpage->add(new admin_setting_heading('theme_essential_marketing',
get_string('marketingheading', 'theme_essential'),
Expand Down

0 comments on commit 955266b

Please sign in to comment.