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

Commit

Permalink
Fix #65 and add standard layouts with base having no blocks.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Bezemer committed Aug 11, 2014
1 parent f3caca5 commit 71be3ae
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 12 deletions.
4 changes: 4 additions & 0 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ Cool things to know about the theme.
- The entire colour scheme can be modified with theme settings (like on [Rocket](https://moodle.org/plugins/view.php?plugin=theme_rocket))
- The homepage main area is just a label. The theme will ship with custom classes that you can set for tables and links to modify their formatting. No knowledge of code is needed as you can use the text editor to do this. Documentation will be provided outlining what the additional classes are.

New in 2.5.6
========================
- Added standard 3 different column layout, and applied the one without blocks to base layout to fix issues with overflow

New in 2.5.5
========================
- Added ability to select from 21 preset Google Font combinations or disable their use completely.
Expand Down
18 changes: 9 additions & 9 deletions config.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@
$THEME->layouts = array(
// Most backwards compatible layout without the blocks - this is the layout used by default
'base' => array(
'file' => 'general.php',
'regions' => array('side-pre', 'side-post', 'footer-left', 'footer-middle', 'footer-right'),
'defaultregion' => 'side-post',
'file' => 'columns1.php',
'regions' => array('footer-left', 'footer-middle', 'footer-right', 'hidden-dock'),
'defaultregion' => 'hidden-dock',
),
// Front page.
'frontpage' => array(
Expand All @@ -65,39 +65,39 @@
),
// Standard layout with blocks, this is recommended for most pages with general information.
'standard' => array(
'file' => 'general.php',
'file' => 'columns2.php',
'regions' => array('side-pre', 'side-post', 'footer-left', 'footer-middle', 'footer-right', 'hidden-dock'),
'defaultregion' => 'side-post',
),
// Course page.
'course' => array(
'file' => 'course.php',
'file' => 'columns3.php',
'regions' => array('side-pre', 'side-post', 'footer-left', 'footer-middle', 'footer-right'),
'defaultregion' => 'side-post',
'options' => array('nonavbar'=>false),
),
// Page content and modules.
'incourse' => array(
'file' => 'general.php',
'file' => 'columns2.php',
'regions' => array('side-pre', 'side-post', 'footer-left', 'footer-middle', 'footer-right'),
'defaultregion' => 'side-post',
),
// Category listing page.
'coursecategory' => array(
'file' => 'general.php',
'file' => 'columns2.php',
'regions' => array('side-pre', 'side-post', 'footer-left', 'footer-middle', 'footer-right'),
'defaultregion' => 'side-post',
),
// My dashboard page.
'mydashboard' => array(
'file' => 'general.php',
'file' => 'columns2.php',
'regions' => array('side-pre', 'side-post', 'footer-left', 'footer-middle', 'footer-right'),
'defaultregion' => 'side-post',
'options' => array('langmenu'=>true),
),
// My public page.
'mypublic' => array(
'file' => 'general.php',
'file' => 'columns2.php',
'regions' => array('side-pre', 'side-post', 'footer-left', 'footer-middle', 'footer-right'),
'defaultregion' => 'side-post',
'options' => array('langmenu'=>true),
Expand Down
175 changes: 175 additions & 0 deletions layout/columns1.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* OUC theme with the underlying Bootstrap theme.
*
* @package theme
* @subpackage Essential
* @author Julian (@moodleman) Ridden
* @author Based on code originally written by G J Bernard, Mary Evans, Bas Brands, Stuart Lamour and David Scotson.
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/

$pre = 'side-pre';
$post = 'side-post';
$rtl = right_to_left();

if ($rtl) {
$regionbsid = 'region-bs-main-and-post';
// In RTL the sides are reversed, so swap the 'essentialblocks' method parameter....
$temp = $pre;
$pre = $post;
$post = $temp;
} else {
$regionbsid = 'region-bs-main-and-pre';
}

$haslogo = (!empty($PAGE->theme->settings->logo));
$hasboringlayout = (empty($PAGE->theme->settings->layout)) ? false : $PAGE->theme->settings->layout;
$hasanalytics = (empty($PAGE->theme->settings->useanalytics)) ? false : $PAGE->theme->settings->useanalytics;
$hassidepre = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-pre', $OUTPUT));
$hassidepost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-post', $OUTPUT));
$regionclass = 'span9';
$contentclass = 'span8';
$blockclass = 'span4';

if (!($hassidepre AND $hassidepost)) {
// Two columns.
$contentclass = 'span9';
$blockclass = 'span3';
if (!$PAGE->user_is_editing()) {
if (((!$hassidepre) && (!$rtl)) ||
((!$hassidepost) && ($rtl))) {
// Fill complete area when editing off and LTR and no side-pre content or RTL and no side-post content.
$contentclass = 'span12';
} else if ((!$hassidepre) && ($rtl)) {
// Fill complete area when editing off, RTL and no side pre.
$regionclass = 'span12';
}
} else {
if ((!$hassidepre) && ($rtl)) {
// Fill complete area when editing on, RTL and no side pre.
$contentclass = 'span8';
$blockclass = 'span4';
}
}
}

echo $OUTPUT->doctype() ?>
<html <?php echo $OUTPUT->htmlattributes(); ?>>
<head>
<title><?php echo $OUTPUT->page_title(); ?></title>
<link rel="shortcut icon" href="<?php echo $OUTPUT->favicon(); ?>" />
<?php echo $OUTPUT->standard_head_html() ?>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Google web fonts -->
<?php require_once(dirname(__FILE__).'/includes/fonts.php'); ?>
<!-- iOS Homescreen Icons -->
<?php require_once(dirname(__FILE__).'/includes/iosicons.php'); ?>
</head>

<body <?php echo $OUTPUT->body_attributes(); ?>>

<?php echo $OUTPUT->standard_top_of_body_html() ?>

<?php require_once(dirname(__FILE__).'/includes/header.php'); ?>

<header role="banner" class="navbar">
<nav role="navigation" class="navbar-inner">
<div class="container-fluid">
<a class="brand" href="<?php echo $CFG->wwwroot;?>"><i class="icon-home"></i>&nbsp;<?php print_string('home'); ?></a>
<a class="btn btn-navbar" data-toggle="workaround-collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<div class="nav-collapse collapse">
<?php echo $OUTPUT->custom_menu(); ?>
<ul class="nav pull-right">
<li><?php echo $OUTPUT->page_heading_menu(); ?></li>
<li class="navbar-text"><?php echo $OUTPUT->login_info() ?></li>
</ul>
</div>
</div>
</nav>
</header>

<!-- Start Main Regions -->
<div id="page" class="container-fluid">
<div id="page-content" class="row-fluid">
<div id="<?php echo $regionbsid ?>" class="<?php echo $regionclass; ?>">
<div class="row-fluid">
<?php if ($hasboringlayout) { ?>
<div id="region-main-essential" class="<?php echo $contentclass; ?> pull-right">
<?php } else { ?>
<div id="region-main-essential" class="<?php echo $contentclass; ?>">
<?php } ?>
<section id="region-main" class="row-fluid">
<div id="page-navbar" class="clearfix">
<nav class="breadcrumb-button"><?php echo $OUTPUT->page_heading_button(); ?></nav>
<div class="breadcrumb-nav"><?php echo $OUTPUT->navbar(); ?></div>
</div>
<?php
echo $OUTPUT->course_content_header();
echo $OUTPUT->main_content();
echo $OUTPUT->course_content_footer();
?>
</section>
</div>
</div>
</div>
</div>
</div>
<!-- End Main Regions -->

<a href="#top" class="back-to-top"><i class="icon-chevron-sign-up"></i><p><?php print_string('backtotop', 'theme_essential'); ?></p></a>

<footer id="page-footer" class="container-fluid">
<?php require_once(dirname(__FILE__).'/includes/footer.php'); ?>
</footer>

<?php echo $OUTPUT->standard_footer_html(); ?>

<?php echo $OUTPUT->standard_end_of_body_html() ?>

<!-- Start Google Analytics -->
<?php if ($hasanalytics) { ?>
<?php require_once(dirname(__FILE__).'/includes/analytics.php'); ?>
<?php } ?>
<!-- End Google Analytics -->

<script type="text/javascript">
jQuery(document).ready(function() {
var offset = 220;
var duration = 500;
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('.back-to-top').fadeIn(duration);
} else {
jQuery('.back-to-top').fadeOut(duration);
}
});

jQuery('.back-to-top').click(function(event) {
event.preventDefault();
jQuery('html, body').animate({scrollTop: 0}, duration);
return false;
})
});
</script>
</body>
</html>
1 change: 0 additions & 1 deletion layout/general.php → layout/columns2.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@
?>
</div>
</div>
<?php echo $OUTPUT->essentialblocks($post, 'span3'); ?>
</div>
</div>
<!-- End Main Regions -->
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@

defined('MOODLE_INTERNAL') || die;

$plugin->version = 2014070500; // YYYYMMDD.
$plugin->version = 2014081100; // YYYYMMDD.
$plugin->maturity = MATURITY_STABLE; // this version's maturity level.
$plugin->release = '2.5.5 (Build: 20140705)';
$plugin->release = '2.5.6 (Build: 2014081100)';
$plugin->requires = 2013051401; // Requires Moodle 2.5.1.
$plugin->component = 'theme_essential';
$plugin->dependencies = array(
Expand Down

0 comments on commit 71be3ae

Please sign in to comment.