SlideShare uma empresa Scribd logo
1 de 107
Baixar para ler offline
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
themes edition
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
What is a Theme?
Unit 1: Getting Started
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
H E L L O
my name is
Julian Ridden
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
H E L L O
my name is
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Theme History
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Perth - Sydney - Melbourne - Hong Kong - Beijing - Kuala Lumpur
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Unit: Setting the Scene
Why have Themes?
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
Why have Themes?
themes edition
many ask
the wrong question
after some
deep thought....
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
Why have Themes?
❖ Meet brand requirements
❖ Match an existing site
❖ Present a more engaging design for your particular audience
❖ Establish a unique look and feel for your site. be a Stand out!
themes edition
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
The room you’re in matters!
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
moodle
{ }All sites need to
look the same
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
What is your
’s purpose?
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Built as a Portal
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Built for Ease of use
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Built as a Website
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
❖ Blocks can go anywhere
❖ Many options set by developer who created
the theme
❖ Easy to add dropdown menu’s
❖ No code needed to personalise site
Highly Customisable
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
All sites need to
look the same
moodle
{ }
BUSTED
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Day One Agenda
❖ Getting Started
❖ What is a Theme?
❖ Tools we need
❖ Setting up Moodle locally
❖ Duplicating a theme
❖ Theme Construction
❖ How Themes are structured
❖ Working with CSS
❖ Building Layouts
❖ Advanced Themeing
❖ Custom Settings Screen
❖ Custom Renderers
Our workshop highlights
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
❖ What is a moodle Theme?
❖ Moodle theme settings
❖ Tools we need
❖ Setting up Moodle locally
❖ Duplicating a theme
In this session we will cover
Getting Started
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
moodle theme settings
Unit 2: Theme Design
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Theme Settings
❖ Theme list
❖ Theme designer mode
❖ Allow User / Course / Category Themes
❖ Allow users to hide blocks
❖ Allow users to use Dock
❖ Custom Menu Items
❖ Device Detection
Theme Selector
The theme selector allows you to apply a selected theme
at a site level.
Moodle Administration Settings
Setting theme orders
There is a new setting you can
put in your sites config.php
$CFG->themeorder =
array('page', 'course',
'category', 'session',
'user', 'site');
Set how you want themes
displayed
Best Practice Tips
You don’t have to drill down
through the Administration to
hunt down theme settings. Just
type in ‘theme’ into the admin
search field to see the available
options.
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Tools we need to
build themes
Unit 1: Getting Started
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
❖ There is no Moodle ‘theme dev development’ tool
❖ Building in Dreamweaver is extremely difficult. I usually edit using a
text editing tool.
❖ Easiest to deploy a moodle on your machine and edit this directly.
See changes instantly as you make them
❖ When finished local build, then upload to your server
Build locally, deploy globally
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Build locally, deploy globally
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
❖ Google Chrome with Developer Tools
CSS Interrogation Tools
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
HANDS ON
DEMONSTRATION
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Text and CSS Editors
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Text and CSS Editors
Text Wrangler
http://www.barebones.com
Sublime 2
http://www.sublimetext.com/
Notepad ++
http://notepad-plus-plus.org
Espresso
http://macrabbit.com
Simple CSS
http://www.hostm.com/css
MY FAV
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
❖ Download the version for YOUR OS from
http://download.moodle.org
Run moodle on your computer
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Setting up a local .
Unit 1: Getting Started
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
HANDS ON
DEMONSTRATION
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Duplicating a theme
Unit 1: Getting Started
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
❖ Small Scale changes
❖ Create a new theme using standard sheets
❖ Large Scale changes
❖ Start with a theme that is similar to your need
❖ Just duplicate it’s folder and rename to use
Don’t re-invent the wheel
Themes are very time consuming to build from scratch Best Practice Tips
When creating/editing themes
be sure to enable the “Theme
Developer Mode” in Admin
settings. Otherwise the caching
will drive you insane!
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Duplicating a moodle theme
1. Duplicate the folder of the theme you wish to copy and rename
(for this example ‘sky_high’ is becoming ‘my theme’)
2. Rename the language file (/lang/en/theme_sky_high)
3. Open your renamed lang file in an editor and change the
‘pluginname’ to your new one
4. If the theme contains a lib.php, renderer.php or settings.php each
of these files will need to be opened and using “find and replace”
find all references to the old name and change to the new.
Important Note
The GPL license allows you to
clone and change themes.
However you must leave all
credits to the original author
intact in the files within it.
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
❖ How themes are structured
❖ Configure your theme
❖ Working with CSS
❖ Building Page Layouts
In this session we will cover
Theme Construction
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Planning is important!
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
How themes
are structured
Unit 2: Theme Design
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Themes are always stored in the ‘themes’ folder in your moodle directory
Files in a “typical” theme
Directory File Description
config.php Contains all of the configuration and definitions for each theme
lib.php Contains speciality classes and functions that are used by theme
renderers.php Contains any custom renderers for the theme
settings.php Contains custom theme settings.
/javascript All specialty JavaScript files the theme requires should be located in here.
/lang Any special language files the theme requires should be located in here
/layout Contains the layout files for the theme
/pix Contains any images the theme makes use of either in CSS or in the layout files
/pix The favicon to display for this theme
/pix A screenshot of the theme to be displayed in on the theme selection screen
/style Default location for CSS files
*.css CSS files the theme requires
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Configure your theme
Unit 2: Theme Design
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
This file contains a few configuration variables that control
how Moodle uses this theme.
Theme Settings
❖ $THEME->name
❖ $THEME->parents
❖ $THEME->sheets
❖ $THEME->layouts
❖ $THEME->enable_dock
❖ $THEME->renderfactory
PHP Files | config.php
Want more control
This is just a list of the core
options used in most themes.
Dozens more are available and
can be viewed in the Moodle
Docs:
http://docs.moodle.org/dev/
Themes_2.0
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
Very simply this tells Moodle the name of your theme, and if
you ever have several config.php files open this will help you
identify which one you are looking at
Demonstration
$THEME->name = 'excitement';
PHP Files | config.php
$THEME->name Best Practice Tips
While you can call your
stylesheets anything you like,
or even just have one, the listed
example is considered ‘best
practice’ to make the theme
easier to edit if passed around
the community.
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
A theme can extend any number of themes. Rather than creating an entirely new theme
and copying all of the CSS, you can simply create a new theme, extend the theme you like
and just add the changes you want to your theme. Also worth noting is the purpose of the
base theme: it provides us with a basic layout and just enough CSS to make everything fall
into place.
Demonstration
$THEME->parents = array('canvas','base',);
PHP Files | config.php
$THEME->parents
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This variable allows the developer to define what stylesheets (css)
they wish to use in this theme. While it is entirely up to you as to
how you create and organise your CSS, please note that within the
themes provided in the standard install by Moodle there is a very
clear organisation of CSS. Moodle now has to main css files built
into all core themes.
Demonstration
$THEME->sheets = array('core','pagelayout',);
PHP Files | config.php
$THEME->sheetsname Lots of Changes
For those who are familiar with
Moodle 1.9 theme's, this
organisation will be a big
change. In 1.9, CSS was
organised by its nature (for
example: colours, layout, other)
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
The ‘pagelout.css’ file
This contains the CSS required to give the layouts their look and
feel. It doesn't contain any rules that affect the content generated
by Moodle
The ‘core.css’ file
This contains all manner of general (usually simple) rules that don't relate to a specific section
of Moodle but to Moodle as a whole.
PHP Files | config.php
$THEME->sheetsname
...continued
Lots of Changes
For those who are familiar with
Moodle 1.9 theme's, this
organisation will be a big
change. In 1.9, CSS was
organised by its nature (for
example: colours, layout, other)
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
As the name may suggest, ‘layouts‘ determine how a page is structured or ‘laid out’. There
is one for every general type of page. Most developers don’t create custom layouts as they,
like CSS, extend from the base and they instead use CSS for their changes.
Demonstration
mydashboard' => array('file' => 'standard.php','regions' => array('side-pre', 'side-
post'),'defaultregion' => 'side-post','options' => array('langmenu'=>true),);
PHP Files | config.php
$THEME->layouts
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
For each layout you can set:
file  - This is the name of the layout file we want to use, it should always be located in the above themes
layout directory.
regions  - This is an array of block regions that the theme has. Each entry in here can be used to put
blocks in.
defaultregion  - If a layout has regions it should have a default region, this is where blocks get put when
first added.
options - These are special settings, anything that gets put into the options array is available later on when
we are writing our layout file.
PHP Files | config.php
$THEME->layouts
...continued
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This really is as simple as it looks. This allows the developer to state if this theme will utilise
Moodle’s new Dock function or not.
Demonstration
$THEME->enable_dock = true;
PHP Files | config.php
$THEME->enable_dock
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
The final setting is to include a JavaScript file. Much like
stylesheets, you only need to provide the files name.
Moodle will assume it is in your themes JavaScript directory
and be a .js file.
Demonstration
$THEME->javascripts = array('jquery');
PHP Files | config.php
$THEME->javascripts Important Note
Javascript files need to be
stored in a directory in your
theme folder called /javascript
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
The ‘pagelout.css’ file
This contains the CSS required to give the layouts their look and
feel. It doesn't contain any rules that affect the content generated
by Moodle
The ‘core.css’ file
This contains all manner of general (usually simple) rules that don't relate to a specific section
of Moodle but to Moodle as a whole.
PHP Files | config.php
$THEME->sheetsname
...continued
Lots of Changes
For those who are familiar with
Moodle 1.9 theme's, this
organisation will be a big
change. In 1.9, CSS was
organised by its nature (for
example: colours, layout, other)
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This variable tells Moodle that for this theme we want to use the
theme_overridden_renderer_factory, a special class tells Moodle
to look for renderers first within the theme and then in all of the other default locations.
Renderers will allow developers to override how moodle renders its predefined functions
allowing for truly unlimited design possibilities.
Demonstration
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
PHP Files | config.php
$THEME->renderfactory Additional Info
For more information on this
function please visit - http://
docs.moodle.org/dev/
Themes_2.0_overriding_a_renderer
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Working with CSS
Unit 2: Theme Design
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
You will often find yourself wishing to utilise images in your CSS.
Never put a full or relative path as these will break depending on
which page is pulling in the css. Instead we use a custom Moodle
tag.
Images are stored in a folder called “pix” in your theme directory
Demonstration
background: url([[pix:theme|mbar]]) repeat-y;
CSS Files | Images
Additional Info
Important Note
When referencing an image you
do not add the filetype. Moodle
is smart enough to figure that
part out itself
[[pix:theme|yuiarrows]]
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
You will often find yourself wishing to utilise images in your CSS.
Never put a full or relative path as these will break depending on
which page is pulling in the css. Instead we use a custom Moodle
tag.
Images are stored in a folder called “pix” in your theme directory
Demonstration
background: url([[pix:theme|mbar]]) repeat-y;
CSS Files | Overriding Moodle Images
Additional Info
Important Note
When referencing an image you
do not add the filetype. Moodle
is smart enough to figure that
part out itself
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Building page layouts
Unit 2: Theme Design
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
There are many custom Layouts available to developers who wish
to take advantage of them.
All themes are required to define the layouts they wish
to be responsible for as well as create; however, many
layout files are required by those layouts.
The Layout Files
Available Standard LayoutsAvailable Standard LayoutsAvailable Standard Layouts
general popup course
base frametop incourse
standard maintenance print
coursecategory login mypublic
frontpage mydashboard admin
Useful Information
If the theme is overriding
another theme then it is a case
of deciding which layouts this
new theme should override.
If the theme is a completely
fresh start then you will need to
define a layout for each of the
different possibilities.
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
A layout file is a file that contains the core HTML
structure for a layout including the header, footer,
content and block regions.
It is not all HTML, there are bits of HTML and content that
Moodle needs to put into the page, within each layout
file this will be done by a couple of simple PHP calls to
get bits and pieces including content.
The Layout Files
<?php echo $OUTPUT->doctype() ?>
<html <?php echo $OUTPUT->htmlattributes() ?>>
<head>
<title><?php echo $PAGE->title ?></title>
<?php echo $OUTPUT->standard_head_html() ?>
</head>
<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses) ?>">
<?php echo $OUTPUT->standard_top_of_body_html() ?>
<table id="page">
<tr>
<td colspan="3">
<h1 class="headermain"><?php echo $PAGE->heading ?></h1>
<div class="headermenu"><?php echo $OUTPUT->login_info(); echo $PAGE-
>headingmenu; ?></div>
</td>
</tr>
<tr>
<td>
<?php echo $OUTPUT->blocks_for_region('side-pre') ?>
</td>
<td>
<?php echo core_renderer::MAIN_CONTENT_TOKEN ?>
</td>
<td>
<?php echo $OUTPUT->blocks_for_region('side-post') ?>
</td>
</tr>
<tr>
<td colspan="3">
<p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
<?php
echo $OUTPUT->login_info();
echo $OUTPUT->home_link();
echo $OUTPUT->standard_footer_html();
?>
</td>
</tr>
</table>
<?php echo $OUTPUT->standard_end_of_body_html() ?>
</body>
</html>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
This file contains a few php tags that control how Moodle outputs elements of this theme.
IMPORTANT PHP Tags
❖ echo $CFG->wwwroot
❖ echo $OUTPUT->pix_url('', '')
❖ echo print_string('', '')
The Layout Files | PHP Tags
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This is used whenever you wish your theme to link to a file within Moodle. It will dynamically
generate the full Moodle url pulled from the site’s config.php file
Demonstration
<a class="logo" href="<?php echo $CFG->wwwroot; ?>" title="Home"></a>
The Layout Files | PHP Tags
echo $CFG->wwwroot
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This tag is used when wishing to load an image from your theme
via html in the theme. The first variable is the filename (without
type) and path within the theme’s pix directory. The second variable tells moodle that it is based
within this theme.
Demonstration
<?php echo $OUTPUT->pix_url('favicon', 'theme')?>
The Layout Files | PHP Tags
echo $OUTPUT->pix_url('', '') Best Practice Tip
Where possible it is always best
to display images via css. This
is better for performance as
Moodle will cache these
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This is used to display custom language strings for your thee to
display. Especially important should you wish your theme to be
multilingual
Demonstration
<?php print_string('findcourse', 'theme_moodlemoot'); ?>
The Layout Files | PHP Tags
echo $OUTPUT->pix_url('favicon', 'theme') Best Practice Tip
All text displayed in a theme
should be stored as a language
string.
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
This file contains a few php tags that control how Moodle outputs elements of this theme.
Common PHP Tags
❖ <?php echo $OUTPUT->doctype() ?>
❖ <html <?php echo $OUTPUT->htmlattributes() ?>>
❖ <?php echo $PAGE->title ?>
❖ <?php echo $OUTPUT->standard_head_html() ?>
❖ <?php p($PAGE->bodyid); ?> and <?php p($PAGE->bodyclasses); ?>
❖ <?php echo $PAGE->heading; ?>
❖ <?php echo $OUTPUT->login_info(); ?>
❖ <?php echo $PAGE->headingmenu; ?>
The Layout Files | PHP Tags
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
This file contains a few php tags that control how Moodle outputs elements of this theme.
Common PHP Tags
❖ <?php echo $OUTPUT->blocks_for_region('side-pre') ?> and <?php echo $OUTPUT-
>blocks_for_region('side-post') ?>
❖ echo $OUTPUT->main_content()
❖ echo $OUTPUT->login_info();
❖ echo $OUTPUT->home_link();
❖ echo $OUTPUT->standard_footer_html();
❖ echo $SITE->summary
The Layout Files | PHP Tags
...continued
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This occurs at the VERY top of the page, it must be the first bit of output and is responsible
for adding the (X)HTML document type definition to the page. This of course is determined
by the settings of the site and is one of the things that the theme designer has no control
over.
Demonstration
<?php echo $OUTPUT->doctype() ?>
The Layout Files | PHP Tags
<?php echo $OUTPUT->doctype() ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This must be placed in the opening html tag and will generate the HTML attributes that
should be applied to it. This again is determined by several settings within the actual HTML
install.
Demonstration
<html <?php echo $OUTPUT->htmlattributes() ?>>
The Layout Files | PHP Tags
<?php echo $OUTPUT->htmlattributes() ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates the title of the page.
Demonstration
<title> <?php echo $PAGE->title ?> </title>
The Layout Files | PHP Tags
<?php echo $PAGE->title ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates the description of either the site on the forntpage or the course description
on a course page. This variant will also strip out HTML tags from the description to ensure it
does not break code surrounding it.
Demonstration
<meta name="description" content="<?php p(strip_tags(format_text($SITE->summary,
FORMAT_HTML))) ?>" />
The Layout Files | PHP Tags
<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This very important call gets us the standard head HTML that needs to be within the HEAD
tag of the page. This is where CSS and JavaScript requirements for the top of the page will
be output as well as any special script or style tags.
Demonstration
<html <?php echo $OUTPUT->htmlattributes() ?>>
The Layout Files | PHP Tags
<?php echo $OUTPUT->standard_head_html() ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
These two calls should be placed within your <body> tag and will ask Moodle to generate
the desired ID and classes that should be applied to it.
Demonstration
<body id="<?php p($PAGE->bodyid); ?>" class="<?php p($PAGE->bodyclasses); ?>">
The Layout Files | PHP Tags
<?php p($PAGE->bodyid); ?>
<?php p($PAGE->bodyclasses); ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates the heading (or title if you prefer) of the page.
Demonstration
<h1 class="headermain"><?php echo $PAGE->heading; ?></h1>
The Layout Files | PHP Tags
<?php echo $PAGE->heading; ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates the standard dropdown header menu
Demonstration
<div class="headermenu">
<?php echo $PAGE->headingmenu ?>
</div>
The Layout Files | PHP Tags
<?php echo $PAGE->headingmenu; ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
If your theme wished to use the new custom dropdown menu function added in Moodle 2
then this call tells moodle where to place it.
Demonstration
<?php if ($hascustommenu) { ?>
<div id="custommenu"><?php echo $custommenu; ?></div>
<?php } ?>
The Layout Files | PHP Tags
<?php echo $PAGE->custommenu; ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates the breadcrumb navigation
Demonstration
<div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
The Layout Files | PHP Tags
<?php echo $OUTPUT->navbar(); ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates the “Turn editing on” button
Demonstration
<div class="navbutton"> <?php echo $PAGE->button; ?></div>
The Layout Files | PHP Tags
<?php echo $PAGE->button; ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This tells moodle where to place the blocks. Pre and Post are two Moodle defined locations
(referred to as areas). Pre is typically the left column and post the right.
Demonstration
<div class="region-content">
<?php echo $OUTPUT->blocks_for_region('side-pre') ?>
</div>
The Layout Files | PHP Tags
<?php echo $OUTPUT->blocks_for_region('side-pre') ?>
<?php echo $OUTPUT->blocks_for_region('side-post') ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This is one of the most important calls within the file, it tells Moodle where to generate the
actual content of the page
Demonstration
<div class="region-content">
<?php echo $OUTPUT->main_content() ?>
</div>
The Layout Files | PHP Tags
<?php echo $OUTPUT->main_content() ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates the link that ether allows the user to log in, or tells them that they are logged
in and provides a link to their profile screen
Demonstration
<?php echo $OUTPUT->login_info(); ?>
The Layout Files | PHP Tags
echo $OUTPUT->login_info();
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates a link pointing back to your own Moodle’s homepage (otherwise known as
frontpage)
Demonstration
<?php echo $OUTPUT->home_link(); ?>
The Layout Files | PHP Tags
echo $OUTPUT->home_link();
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates a link pointing to the relevant help page on docs.moodle.org
Demonstration
<p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
The Layout Files | PHP Tags
echo page_doc_link(get_string('moodledocslink'))
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates the standard footer HTML which like the
standard head HTML contains all of the script and style tags
required by the page and requested to go in the footer
Demonstration
<?php echo $OUTPUT->standard_footer_html(); ?>
The Layout Files | PHP Tags
echo $OUTPUT->standard_footer_html(); Nice to know
Within Moodle 2.0 most of the
JavaScript for the page will be
included in the footer. This
greatly helps reduce the
loading time of the page
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This generates the standard footer HTML which like the standard
head HTML contains all of the script and style tags required by the
page and requested to go in the footer
Demonstration
<?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?>
The Layout Files | Little Known Tags
<?php echo $SITE->summary ?> Best Practice Tip
It is often best when using this
tag to strip out additional HTML
that may have been added by
the user
<?php echo
strip_tags(format_text($SITE
->summary, FORMAT_HTML)) ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This conditional detects if there are breadcrumbs to show. If not, it can then display
something else of your choosing.
Demonstration
<?php if ($hasnavbar) { ?>
<div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
<?php } ?>
The Layout Files | Useful Conditionals
<?php if ($hasnavbar) { ?>
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This conditional detects if the user is yet logged in and allows for content to be displayed
accordingly.
Demonstration
if (isloggedin()) {
echo ''.$OUTPUT->user_picture($USER, array('size'=>55)).'';
echo $OUTPUT->login_info();
}
else {
?>
The Layout Files | Useful Conditionals
if (isloggedin()){
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
One of the best new features of Moodle 2 is the ability to move beyond “standard”
limitations. For instance, in the past blocks could only be placed in the left and right columns.
Now blocks can be placed in any location that the developer wishes to utilise
Steps required to setup custom block locations
❖ Specify new location names in theme config
❖ Add new names in lang file
❖ Define new variable at top of layout file
❖ Insert new region where-ever you like in your layout.
The Layout Files | Creating Custom block locations
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
❖ Advanced Theme Design
❖ Custom Settings Screen
❖ Custom Renderers
❖ Plating up a perfect dish
❖ The HTML and Main Menu Blocks
❖ Clever use of Labels
Day Two Agenda
Our cooking highlights
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
❖ Create a settings screen
❖ Creating custom theme renderes
In this session we will cover
Advanced theme design
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Create a custom
settings screen
Unit 3: Advanced Theme Design
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
This is an optional component of theme development. When
used in conjunction with lib.php it allows the developer to create
a custom Settings page in Moodle administration to allow users
to override preset variables such as colors, widths, etc.
Implementation
To implement settings we will first need to
❖ create a settings screen
❖ create a supporting library function
❖ implement the settings via css and layout changes
PHP Files | Settings
Additional Info
For more information on this
function please visit - http://
docs.moodle.org/dev/
Themes_2.0_adding_a_settings
_page
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
When we are creating a settings screen we are effectively creating an online form which
admins can use to change elements that we have specified. The form consists of various
fields defined by the developer. To specify a new field we use following 6 elements.
Theme Settings
❖ $name
❖ $title
❖ $description
❖ $default
❖ $setting
❖ $settings
PHP Files | settings.php
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
What is the name of this particular setting. This will be how it is stored in Moodle’s DB
Demonstration
$name = 'theme_mydemotheme/sitename';
PHP Files | settings.php | Form elements
$name
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This is the title that is shown to the user. It should be short but obvious. Instead of typing in
the title here directly we will instead pull it from our lang file.
Demonstration
$title = get_string('sitename','theme_mydemotheme');
PHP Files | settings.php | Form elements
$title
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
As the name suggests, this is a more detailed description of what this theme setting will
accomplish. Instructions can also be given here. Instead of typing in the title here directly we
will instead pull it from our lang file.
Demonstration
$description = get_string('sitenamedesc', 'theme_mydemotheme');
PHP Files | settings.php | Form elements
$description
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
Does this particular field have a default value. If so you can define it here.
Demonstration
$default = 'Welcome to my site';
PHP Files | settings.php | Form elements
$default
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
Does this particular field have a default value. If so you can define it here.
Demonstration
$setting = new admin_setting_configtext($name, $title, $description, $default);
PHP Files | settings.php | Form elements
$default
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This defines the entire input by combining the previous elements and specifying one of a
variety of form input types based on the need.
Demonstration
$setting = new admin_setting_configcolourpicker($name, $title, $description, $default,
$previewconfig);
PHP Files | settings.php | Form elements
$setting
Text Field admin_setting_configtext
Text Box admin_setting_configtextarea
HTML Editor admin_setting_confightmleditor
Radio Button admin_setting_configselect
Color Picker admin_setting_configcolourpicker
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
Don’t forget this as it is the most important element. This is essentially a close that tells
moodle that this form element is complete and can now be added to the form
PHP Files | settings.php | Form elements
$settings->add($setting);
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
<?php
defined('MOODLE_INTERNAL') || die;
if ($ADMIN->fulltree) {
// Footer text or link
$name = 'theme_rocket/footnote';
$title = get_string('footnote','theme_mydemotheme');
$description = get_string('footnotedesc', 'theme_mydemotheme');
$default = '';
$setting = new admin_setting_confightmleditor($name, $title, $description, $default);
$settings->add($setting);
// Custom CSS file
$name = 'theme_mydemotheme/customcss';
$title = get_string('customcss','theme_mydemotheme');
$description = get_string('customcssdesc', 'theme_mydemotheme');
$setting = new admin_setting_configtextarea($name, $title, $description, '');
$settings->add($setting);
}
PHP Files | settings.php | Sample Completed form
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
The lib.php file is a location where any custom function needed by the theme is stored.
Again, what can be done here is limited by the imagination of the developer. But there is one
function that most developers will need to define. This is the process_css function.
The process_css function takes settings we created that were going to be rendered into our
css files. This will allow us to define them as variables that Moodle will recognise
PHP Files | lib.php
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
function rocket_process_css($css, $theme) {
// Set the theme background and highlites
if (!empty($theme->settings->themecolor)) {
$themecolor = $theme->settings->themecolor;
} else {
$themecolor = null;
}
$css = rocket_set_themecolor($css, $themecolor);
return $css;
}
function rocket_set_themecolor($css, $themecolor) {
$tag = '[[setting:themecolor]]';
$replacement = $themecolor;
if (is_null($replacement)) {
$replacement = '#5faff2';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
PHP Files | lib.php
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Creating custom theme
renderers
Unit 3: Advanced Theme Design
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Additional Info
For more information on this
function please visit - http://
docs.moodle.org/dev/
Themes_2.0_overriding_a_rend
erer
Definition
This file contains override renderers used by theme. As this leads
into advanced theme development we will not be going in-depth
into lib.php in this presentation.
Demonstration
Look at advanced themes on moodle.org such as ‘Moodlebook’ and ‘Rocket’ to see
examples of themes starting to use the renderers.php file.
PHP Files | renderers.php
Facilitating Education
www.pukunui.com / info@pukunui.com
Phone: 1300 466 635 or +61 8 9328 4545
themes edition
Definition
This file contains speciality classes and functions that are used by theme. As this leads into
advanced theme developement we will not be going indepth into lib.php in this presentation.
Demonstration
function mytheme_set_customcss($css, $customcss) {
$tag = '[[setting:customcss]]';
$replacement = $customcss;
if (is_null($replacement)) {
$replacement = '';
}
$css = str_replace($tag, $replacement, $css);
return $css;
}
PHP Files | lib.php

Mais conteúdo relacionado

Semelhante a Moodle 2 Theme masterclass

Moodle Moot IE/UK 2017 Creating a child theme for Boost
Moodle Moot IE/UK 2017 Creating a child theme for BoostMoodle Moot IE/UK 2017 Creating a child theme for Boost
Moodle Moot IE/UK 2017 Creating a child theme for BoostRichard Oelmann
 
Keysfacultydevelopment5
Keysfacultydevelopment5Keysfacultydevelopment5
Keysfacultydevelopment5Pelham Mead
 
Blackboard Masterclass #1 for FOHS
Blackboard Masterclass #1 for FOHSBlackboard Masterclass #1 for FOHS
Blackboard Masterclass #1 for FOHSMatthew Deeprose
 
How to install a new moodle 2.4 theme
How to install a new moodle 2.4 themeHow to install a new moodle 2.4 theme
How to install a new moodle 2.4 themeParadiso LMS
 
Keyboarding II video
Keyboarding II videoKeyboarding II video
Keyboarding II videoKaty Adams
 
Powerpoint keyboarding II
Powerpoint keyboarding IIPowerpoint keyboarding II
Powerpoint keyboarding IIKaty Adams
 
Keysfacultydevelopment6
Keysfacultydevelopment6Keysfacultydevelopment6
Keysfacultydevelopment6Pelham Mead
 
MoodleCloud manual for learners
MoodleCloud manual for learnersMoodleCloud manual for learners
MoodleCloud manual for learnersZuleika Winfrey
 
Webstock Workshop: Creating Simple
Webstock Workshop: Creating SimpleWebstock Workshop: Creating Simple
Webstock Workshop: Creating SimpleDaniel Burka
 
Cloud storage imd113
Cloud storage imd113Cloud storage imd113
Cloud storage imd113Tasha Schaa
 
Creating Moodle Mobile remote themes (Moodle Moot US 2016)
Creating Moodle Mobile remote themes (Moodle Moot US 2016)Creating Moodle Mobile remote themes (Moodle Moot US 2016)
Creating Moodle Mobile remote themes (Moodle Moot US 2016)Dani Palou Sala
 
KIMIA MEDISINAL
KIMIA MEDISINALKIMIA MEDISINAL
KIMIA MEDISINALAsrunJr
 
Download Environmental PowerPoint Template- Slide World
Download Environmental PowerPoint Template- Slide WorldDownload Environmental PowerPoint Template- Slide World
Download Environmental PowerPoint Template- Slide Worldhttp://www.slideworld.com/
 
Word Processing Orientation Video
Word Processing Orientation VideoWord Processing Orientation Video
Word Processing Orientation VideoKaty Adams
 
office administration orientation video
office administration orientation videooffice administration orientation video
office administration orientation videoKaty Adams
 
Getting All Your Web Apps To Wear The Company Brand
Getting All Your Web Apps To Wear The Company BrandGetting All Your Web Apps To Wear The Company Brand
Getting All Your Web Apps To Wear The Company Brandknappt
 
Object oriented css graeme blackwood
Object oriented css graeme blackwoodObject oriented css graeme blackwood
Object oriented css graeme blackwooddrupalconf
 
Welcome to your course
Welcome to your courseWelcome to your course
Welcome to your courseBCcampus
 
Object oriented css. Graeme Blackwood
Object oriented css. Graeme BlackwoodObject oriented css. Graeme Blackwood
Object oriented css. Graeme BlackwoodPVasili
 

Semelhante a Moodle 2 Theme masterclass (20)

Moodle Moot IE/UK 2017 Creating a child theme for Boost
Moodle Moot IE/UK 2017 Creating a child theme for BoostMoodle Moot IE/UK 2017 Creating a child theme for Boost
Moodle Moot IE/UK 2017 Creating a child theme for Boost
 
Keysfacultydevelopment5
Keysfacultydevelopment5Keysfacultydevelopment5
Keysfacultydevelopment5
 
Blackboard Masterclass #1 for FOHS
Blackboard Masterclass #1 for FOHSBlackboard Masterclass #1 for FOHS
Blackboard Masterclass #1 for FOHS
 
How to install a new moodle 2.4 theme
How to install a new moodle 2.4 themeHow to install a new moodle 2.4 theme
How to install a new moodle 2.4 theme
 
Keyboarding II video
Keyboarding II videoKeyboarding II video
Keyboarding II video
 
Powerpoint keyboarding II
Powerpoint keyboarding IIPowerpoint keyboarding II
Powerpoint keyboarding II
 
Keysfacultydevelopment6
Keysfacultydevelopment6Keysfacultydevelopment6
Keysfacultydevelopment6
 
MoodleCloud manual for learners
MoodleCloud manual for learnersMoodleCloud manual for learners
MoodleCloud manual for learners
 
Webstock Workshop: Creating Simple
Webstock Workshop: Creating SimpleWebstock Workshop: Creating Simple
Webstock Workshop: Creating Simple
 
Cloud storage imd113
Cloud storage imd113Cloud storage imd113
Cloud storage imd113
 
Creating Moodle Mobile remote themes (Moodle Moot US 2016)
Creating Moodle Mobile remote themes (Moodle Moot US 2016)Creating Moodle Mobile remote themes (Moodle Moot US 2016)
Creating Moodle Mobile remote themes (Moodle Moot US 2016)
 
Technology Tips for Administrators
Technology Tips for AdministratorsTechnology Tips for Administrators
Technology Tips for Administrators
 
KIMIA MEDISINAL
KIMIA MEDISINALKIMIA MEDISINAL
KIMIA MEDISINAL
 
Download Environmental PowerPoint Template- Slide World
Download Environmental PowerPoint Template- Slide WorldDownload Environmental PowerPoint Template- Slide World
Download Environmental PowerPoint Template- Slide World
 
Word Processing Orientation Video
Word Processing Orientation VideoWord Processing Orientation Video
Word Processing Orientation Video
 
office administration orientation video
office administration orientation videooffice administration orientation video
office administration orientation video
 
Getting All Your Web Apps To Wear The Company Brand
Getting All Your Web Apps To Wear The Company BrandGetting All Your Web Apps To Wear The Company Brand
Getting All Your Web Apps To Wear The Company Brand
 
Object oriented css graeme blackwood
Object oriented css graeme blackwoodObject oriented css graeme blackwood
Object oriented css graeme blackwood
 
Welcome to your course
Welcome to your courseWelcome to your course
Welcome to your course
 
Object oriented css. Graeme Blackwood
Object oriented css. Graeme BlackwoodObject oriented css. Graeme Blackwood
Object oriented css. Graeme Blackwood
 

Mais de Julian Ridden

Open badges and the LMS
Open badges and the LMSOpen badges and the LMS
Open badges and the LMSJulian Ridden
 
Moodle 2 Masterclass
Moodle 2 MasterclassMoodle 2 Masterclass
Moodle 2 MasterclassJulian Ridden
 
Integrating Mahara with Moodle
Integrating Mahara with MoodleIntegrating Mahara with Moodle
Integrating Mahara with MoodleJulian Ridden
 
Theme guru's (Moodle 2 Edition)
Theme guru's (Moodle 2 Edition)Theme guru's (Moodle 2 Edition)
Theme guru's (Moodle 2 Edition)Julian Ridden
 
Bridging The Digital Divide
Bridging The Digital DivideBridging The Digital Divide
Bridging The Digital DivideJulian Ridden
 
Turbo Charging Moodle
Turbo Charging MoodleTurbo Charging Moodle
Turbo Charging MoodleJulian Ridden
 
Moodle and the Foss Revolution
Moodle and the Foss RevolutionMoodle and the Foss Revolution
Moodle and the Foss RevolutionJulian Ridden
 
Podcasting In Moodle
Podcasting In MoodlePodcasting In Moodle
Podcasting In MoodleJulian Ridden
 
Turbo Charging Moodle
Turbo Charging MoodleTurbo Charging Moodle
Turbo Charging MoodleJulian Ridden
 

Mais de Julian Ridden (11)

Open badges and the LMS
Open badges and the LMSOpen badges and the LMS
Open badges and the LMS
 
Moodle 2 Masterclass
Moodle 2 MasterclassMoodle 2 Masterclass
Moodle 2 Masterclass
 
Integrating Mahara with Moodle
Integrating Mahara with MoodleIntegrating Mahara with Moodle
Integrating Mahara with Moodle
 
Moodle for mobiles
Moodle for mobilesMoodle for mobiles
Moodle for mobiles
 
Theme guru's (Moodle 2 Edition)
Theme guru's (Moodle 2 Edition)Theme guru's (Moodle 2 Edition)
Theme guru's (Moodle 2 Edition)
 
Bridging The Digital Divide
Bridging The Digital DivideBridging The Digital Divide
Bridging The Digital Divide
 
Turbo Charging Moodle
Turbo Charging MoodleTurbo Charging Moodle
Turbo Charging Moodle
 
Theme Gurus
Theme GurusTheme Gurus
Theme Gurus
 
Moodle and the Foss Revolution
Moodle and the Foss RevolutionMoodle and the Foss Revolution
Moodle and the Foss Revolution
 
Podcasting In Moodle
Podcasting In MoodlePodcasting In Moodle
Podcasting In Moodle
 
Turbo Charging Moodle
Turbo Charging MoodleTurbo Charging Moodle
Turbo Charging Moodle
 

Último

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docxPoojaSen20
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...RKavithamani
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 

Último (20)

BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
mini mental status format.docx
mini    mental       status     format.docxmini    mental       status     format.docx
mini mental status format.docx
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
Privatization and Disinvestment - Meaning, Objectives, Advantages and Disadva...
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 

Moodle 2 Theme masterclass

  • 1. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition themes edition
  • 2. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition What is a Theme? Unit 1: Getting Started
  • 3. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition H E L L O my name is Julian Ridden
  • 4. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition H E L L O my name is
  • 5. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Theme History
  • 6. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Perth - Sydney - Melbourne - Hong Kong - Beijing - Kuala Lumpur
  • 7. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Unit: Setting the Scene Why have Themes?
  • 8. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 Why have Themes? themes edition many ask the wrong question after some deep thought....
  • 9. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 Why have Themes? ❖ Meet brand requirements ❖ Match an existing site ❖ Present a more engaging design for your particular audience ❖ Establish a unique look and feel for your site. be a Stand out! themes edition
  • 10. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition The room you’re in matters!
  • 11. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition
  • 12. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition
  • 13. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition
  • 14. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition
  • 15. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition moodle { }All sites need to look the same
  • 16. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition What is your ’s purpose?
  • 17. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Built as a Portal
  • 18. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Built for Ease of use
  • 19. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Built as a Website
  • 20. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 ❖ Blocks can go anywhere ❖ Many options set by developer who created the theme ❖ Easy to add dropdown menu’s ❖ No code needed to personalise site Highly Customisable
  • 21. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition All sites need to look the same moodle { } BUSTED
  • 22. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Day One Agenda ❖ Getting Started ❖ What is a Theme? ❖ Tools we need ❖ Setting up Moodle locally ❖ Duplicating a theme ❖ Theme Construction ❖ How Themes are structured ❖ Working with CSS ❖ Building Layouts ❖ Advanced Themeing ❖ Custom Settings Screen ❖ Custom Renderers Our workshop highlights
  • 23. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition ❖ What is a moodle Theme? ❖ Moodle theme settings ❖ Tools we need ❖ Setting up Moodle locally ❖ Duplicating a theme In this session we will cover Getting Started
  • 24. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition moodle theme settings Unit 2: Theme Design
  • 25. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Theme Settings ❖ Theme list ❖ Theme designer mode ❖ Allow User / Course / Category Themes ❖ Allow users to hide blocks ❖ Allow users to use Dock ❖ Custom Menu Items ❖ Device Detection Theme Selector The theme selector allows you to apply a selected theme at a site level. Moodle Administration Settings Setting theme orders There is a new setting you can put in your sites config.php $CFG->themeorder = array('page', 'course', 'category', 'session', 'user', 'site'); Set how you want themes displayed Best Practice Tips You don’t have to drill down through the Administration to hunt down theme settings. Just type in ‘theme’ into the admin search field to see the available options.
  • 26. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Tools we need to build themes Unit 1: Getting Started
  • 27. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition ❖ There is no Moodle ‘theme dev development’ tool ❖ Building in Dreamweaver is extremely difficult. I usually edit using a text editing tool. ❖ Easiest to deploy a moodle on your machine and edit this directly. See changes instantly as you make them ❖ When finished local build, then upload to your server Build locally, deploy globally
  • 28. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Build locally, deploy globally
  • 29. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition ❖ Google Chrome with Developer Tools CSS Interrogation Tools
  • 30. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition
  • 31. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition HANDS ON DEMONSTRATION
  • 32. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Text and CSS Editors
  • 33. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Text and CSS Editors Text Wrangler http://www.barebones.com Sublime 2 http://www.sublimetext.com/ Notepad ++ http://notepad-plus-plus.org Espresso http://macrabbit.com Simple CSS http://www.hostm.com/css MY FAV
  • 34. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition ❖ Download the version for YOUR OS from http://download.moodle.org Run moodle on your computer
  • 35. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition
  • 36. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Setting up a local . Unit 1: Getting Started
  • 37. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition HANDS ON DEMONSTRATION
  • 38. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Duplicating a theme Unit 1: Getting Started
  • 39. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition ❖ Small Scale changes ❖ Create a new theme using standard sheets ❖ Large Scale changes ❖ Start with a theme that is similar to your need ❖ Just duplicate it’s folder and rename to use Don’t re-invent the wheel Themes are very time consuming to build from scratch Best Practice Tips When creating/editing themes be sure to enable the “Theme Developer Mode” in Admin settings. Otherwise the caching will drive you insane!
  • 40. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Duplicating a moodle theme 1. Duplicate the folder of the theme you wish to copy and rename (for this example ‘sky_high’ is becoming ‘my theme’) 2. Rename the language file (/lang/en/theme_sky_high) 3. Open your renamed lang file in an editor and change the ‘pluginname’ to your new one 4. If the theme contains a lib.php, renderer.php or settings.php each of these files will need to be opened and using “find and replace” find all references to the old name and change to the new. Important Note The GPL license allows you to clone and change themes. However you must leave all credits to the original author intact in the files within it.
  • 41. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition ❖ How themes are structured ❖ Configure your theme ❖ Working with CSS ❖ Building Page Layouts In this session we will cover Theme Construction
  • 42. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Planning is important!
  • 43. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition How themes are structured Unit 2: Theme Design
  • 44. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Themes are always stored in the ‘themes’ folder in your moodle directory Files in a “typical” theme Directory File Description config.php Contains all of the configuration and definitions for each theme lib.php Contains speciality classes and functions that are used by theme renderers.php Contains any custom renderers for the theme settings.php Contains custom theme settings. /javascript All specialty JavaScript files the theme requires should be located in here. /lang Any special language files the theme requires should be located in here /layout Contains the layout files for the theme /pix Contains any images the theme makes use of either in CSS or in the layout files /pix The favicon to display for this theme /pix A screenshot of the theme to be displayed in on the theme selection screen /style Default location for CSS files *.css CSS files the theme requires
  • 45. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Configure your theme Unit 2: Theme Design
  • 46. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition This file contains a few configuration variables that control how Moodle uses this theme. Theme Settings ❖ $THEME->name ❖ $THEME->parents ❖ $THEME->sheets ❖ $THEME->layouts ❖ $THEME->enable_dock ❖ $THEME->renderfactory PHP Files | config.php Want more control This is just a list of the core options used in most themes. Dozens more are available and can be viewed in the Moodle Docs: http://docs.moodle.org/dev/ Themes_2.0
  • 47. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition Very simply this tells Moodle the name of your theme, and if you ever have several config.php files open this will help you identify which one you are looking at Demonstration $THEME->name = 'excitement'; PHP Files | config.php $THEME->name Best Practice Tips While you can call your stylesheets anything you like, or even just have one, the listed example is considered ‘best practice’ to make the theme easier to edit if passed around the community.
  • 48. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition A theme can extend any number of themes. Rather than creating an entirely new theme and copying all of the CSS, you can simply create a new theme, extend the theme you like and just add the changes you want to your theme. Also worth noting is the purpose of the base theme: it provides us with a basic layout and just enough CSS to make everything fall into place. Demonstration $THEME->parents = array('canvas','base',); PHP Files | config.php $THEME->parents
  • 49. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This variable allows the developer to define what stylesheets (css) they wish to use in this theme. While it is entirely up to you as to how you create and organise your CSS, please note that within the themes provided in the standard install by Moodle there is a very clear organisation of CSS. Moodle now has to main css files built into all core themes. Demonstration $THEME->sheets = array('core','pagelayout',); PHP Files | config.php $THEME->sheetsname Lots of Changes For those who are familiar with Moodle 1.9 theme's, this organisation will be a big change. In 1.9, CSS was organised by its nature (for example: colours, layout, other)
  • 50. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition The ‘pagelout.css’ file This contains the CSS required to give the layouts their look and feel. It doesn't contain any rules that affect the content generated by Moodle The ‘core.css’ file This contains all manner of general (usually simple) rules that don't relate to a specific section of Moodle but to Moodle as a whole. PHP Files | config.php $THEME->sheetsname ...continued Lots of Changes For those who are familiar with Moodle 1.9 theme's, this organisation will be a big change. In 1.9, CSS was organised by its nature (for example: colours, layout, other)
  • 51. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition As the name may suggest, ‘layouts‘ determine how a page is structured or ‘laid out’. There is one for every general type of page. Most developers don’t create custom layouts as they, like CSS, extend from the base and they instead use CSS for their changes. Demonstration mydashboard' => array('file' => 'standard.php','regions' => array('side-pre', 'side- post'),'defaultregion' => 'side-post','options' => array('langmenu'=>true),); PHP Files | config.php $THEME->layouts
  • 52. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition For each layout you can set: file  - This is the name of the layout file we want to use, it should always be located in the above themes layout directory. regions  - This is an array of block regions that the theme has. Each entry in here can be used to put blocks in. defaultregion  - If a layout has regions it should have a default region, this is where blocks get put when first added. options - These are special settings, anything that gets put into the options array is available later on when we are writing our layout file. PHP Files | config.php $THEME->layouts ...continued
  • 53. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This really is as simple as it looks. This allows the developer to state if this theme will utilise Moodle’s new Dock function or not. Demonstration $THEME->enable_dock = true; PHP Files | config.php $THEME->enable_dock
  • 54. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition The final setting is to include a JavaScript file. Much like stylesheets, you only need to provide the files name. Moodle will assume it is in your themes JavaScript directory and be a .js file. Demonstration $THEME->javascripts = array('jquery'); PHP Files | config.php $THEME->javascripts Important Note Javascript files need to be stored in a directory in your theme folder called /javascript
  • 55. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition The ‘pagelout.css’ file This contains the CSS required to give the layouts their look and feel. It doesn't contain any rules that affect the content generated by Moodle The ‘core.css’ file This contains all manner of general (usually simple) rules that don't relate to a specific section of Moodle but to Moodle as a whole. PHP Files | config.php $THEME->sheetsname ...continued Lots of Changes For those who are familiar with Moodle 1.9 theme's, this organisation will be a big change. In 1.9, CSS was organised by its nature (for example: colours, layout, other)
  • 56. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This variable tells Moodle that for this theme we want to use the theme_overridden_renderer_factory, a special class tells Moodle to look for renderers first within the theme and then in all of the other default locations. Renderers will allow developers to override how moodle renders its predefined functions allowing for truly unlimited design possibilities. Demonstration $THEME->rendererfactory = 'theme_overridden_renderer_factory'; PHP Files | config.php $THEME->renderfactory Additional Info For more information on this function please visit - http:// docs.moodle.org/dev/ Themes_2.0_overriding_a_renderer
  • 57. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Working with CSS Unit 2: Theme Design
  • 58. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition You will often find yourself wishing to utilise images in your CSS. Never put a full or relative path as these will break depending on which page is pulling in the css. Instead we use a custom Moodle tag. Images are stored in a folder called “pix” in your theme directory Demonstration background: url([[pix:theme|mbar]]) repeat-y; CSS Files | Images Additional Info Important Note When referencing an image you do not add the filetype. Moodle is smart enough to figure that part out itself [[pix:theme|yuiarrows]]
  • 59. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition You will often find yourself wishing to utilise images in your CSS. Never put a full or relative path as these will break depending on which page is pulling in the css. Instead we use a custom Moodle tag. Images are stored in a folder called “pix” in your theme directory Demonstration background: url([[pix:theme|mbar]]) repeat-y; CSS Files | Overriding Moodle Images Additional Info Important Note When referencing an image you do not add the filetype. Moodle is smart enough to figure that part out itself
  • 60. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Building page layouts Unit 2: Theme Design
  • 61. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition There are many custom Layouts available to developers who wish to take advantage of them. All themes are required to define the layouts they wish to be responsible for as well as create; however, many layout files are required by those layouts. The Layout Files Available Standard LayoutsAvailable Standard LayoutsAvailable Standard Layouts general popup course base frametop incourse standard maintenance print coursecategory login mypublic frontpage mydashboard admin Useful Information If the theme is overriding another theme then it is a case of deciding which layouts this new theme should override. If the theme is a completely fresh start then you will need to define a layout for each of the different possibilities.
  • 62. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition A layout file is a file that contains the core HTML structure for a layout including the header, footer, content and block regions. It is not all HTML, there are bits of HTML and content that Moodle needs to put into the page, within each layout file this will be done by a couple of simple PHP calls to get bits and pieces including content. The Layout Files <?php echo $OUTPUT->doctype() ?> <html <?php echo $OUTPUT->htmlattributes() ?>> <head> <title><?php echo $PAGE->title ?></title> <?php echo $OUTPUT->standard_head_html() ?> </head> <body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses) ?>"> <?php echo $OUTPUT->standard_top_of_body_html() ?> <table id="page"> <tr> <td colspan="3"> <h1 class="headermain"><?php echo $PAGE->heading ?></h1> <div class="headermenu"><?php echo $OUTPUT->login_info(); echo $PAGE- >headingmenu; ?></div> </td> </tr> <tr> <td> <?php echo $OUTPUT->blocks_for_region('side-pre') ?> </td> <td> <?php echo core_renderer::MAIN_CONTENT_TOKEN ?> </td> <td> <?php echo $OUTPUT->blocks_for_region('side-post') ?> </td> </tr> <tr> <td colspan="3"> <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p> <?php echo $OUTPUT->login_info(); echo $OUTPUT->home_link(); echo $OUTPUT->standard_footer_html(); ?> </td> </tr> </table> <?php echo $OUTPUT->standard_end_of_body_html() ?> </body> </html>
  • 63. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition This file contains a few php tags that control how Moodle outputs elements of this theme. IMPORTANT PHP Tags ❖ echo $CFG->wwwroot ❖ echo $OUTPUT->pix_url('', '') ❖ echo print_string('', '') The Layout Files | PHP Tags
  • 64. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This is used whenever you wish your theme to link to a file within Moodle. It will dynamically generate the full Moodle url pulled from the site’s config.php file Demonstration <a class="logo" href="<?php echo $CFG->wwwroot; ?>" title="Home"></a> The Layout Files | PHP Tags echo $CFG->wwwroot
  • 65. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This tag is used when wishing to load an image from your theme via html in the theme. The first variable is the filename (without type) and path within the theme’s pix directory. The second variable tells moodle that it is based within this theme. Demonstration <?php echo $OUTPUT->pix_url('favicon', 'theme')?> The Layout Files | PHP Tags echo $OUTPUT->pix_url('', '') Best Practice Tip Where possible it is always best to display images via css. This is better for performance as Moodle will cache these
  • 66. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This is used to display custom language strings for your thee to display. Especially important should you wish your theme to be multilingual Demonstration <?php print_string('findcourse', 'theme_moodlemoot'); ?> The Layout Files | PHP Tags echo $OUTPUT->pix_url('favicon', 'theme') Best Practice Tip All text displayed in a theme should be stored as a language string.
  • 67. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition This file contains a few php tags that control how Moodle outputs elements of this theme. Common PHP Tags ❖ <?php echo $OUTPUT->doctype() ?> ❖ <html <?php echo $OUTPUT->htmlattributes() ?>> ❖ <?php echo $PAGE->title ?> ❖ <?php echo $OUTPUT->standard_head_html() ?> ❖ <?php p($PAGE->bodyid); ?> and <?php p($PAGE->bodyclasses); ?> ❖ <?php echo $PAGE->heading; ?> ❖ <?php echo $OUTPUT->login_info(); ?> ❖ <?php echo $PAGE->headingmenu; ?> The Layout Files | PHP Tags
  • 68. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition This file contains a few php tags that control how Moodle outputs elements of this theme. Common PHP Tags ❖ <?php echo $OUTPUT->blocks_for_region('side-pre') ?> and <?php echo $OUTPUT- >blocks_for_region('side-post') ?> ❖ echo $OUTPUT->main_content() ❖ echo $OUTPUT->login_info(); ❖ echo $OUTPUT->home_link(); ❖ echo $OUTPUT->standard_footer_html(); ❖ echo $SITE->summary The Layout Files | PHP Tags ...continued
  • 69. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This occurs at the VERY top of the page, it must be the first bit of output and is responsible for adding the (X)HTML document type definition to the page. This of course is determined by the settings of the site and is one of the things that the theme designer has no control over. Demonstration <?php echo $OUTPUT->doctype() ?> The Layout Files | PHP Tags <?php echo $OUTPUT->doctype() ?>
  • 70. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This must be placed in the opening html tag and will generate the HTML attributes that should be applied to it. This again is determined by several settings within the actual HTML install. Demonstration <html <?php echo $OUTPUT->htmlattributes() ?>> The Layout Files | PHP Tags <?php echo $OUTPUT->htmlattributes() ?>
  • 71. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates the title of the page. Demonstration <title> <?php echo $PAGE->title ?> </title> The Layout Files | PHP Tags <?php echo $PAGE->title ?>
  • 72. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates the description of either the site on the forntpage or the course description on a course page. This variant will also strip out HTML tags from the description to ensure it does not break code surrounding it. Demonstration <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" /> The Layout Files | PHP Tags <?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>
  • 73. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This very important call gets us the standard head HTML that needs to be within the HEAD tag of the page. This is where CSS and JavaScript requirements for the top of the page will be output as well as any special script or style tags. Demonstration <html <?php echo $OUTPUT->htmlattributes() ?>> The Layout Files | PHP Tags <?php echo $OUTPUT->standard_head_html() ?>
  • 74. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition These two calls should be placed within your <body> tag and will ask Moodle to generate the desired ID and classes that should be applied to it. Demonstration <body id="<?php p($PAGE->bodyid); ?>" class="<?php p($PAGE->bodyclasses); ?>"> The Layout Files | PHP Tags <?php p($PAGE->bodyid); ?> <?php p($PAGE->bodyclasses); ?>
  • 75. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates the heading (or title if you prefer) of the page. Demonstration <h1 class="headermain"><?php echo $PAGE->heading; ?></h1> The Layout Files | PHP Tags <?php echo $PAGE->heading; ?>
  • 76. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates the standard dropdown header menu Demonstration <div class="headermenu"> <?php echo $PAGE->headingmenu ?> </div> The Layout Files | PHP Tags <?php echo $PAGE->headingmenu; ?>
  • 77. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition If your theme wished to use the new custom dropdown menu function added in Moodle 2 then this call tells moodle where to place it. Demonstration <?php if ($hascustommenu) { ?> <div id="custommenu"><?php echo $custommenu; ?></div> <?php } ?> The Layout Files | PHP Tags <?php echo $PAGE->custommenu; ?>
  • 78. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates the breadcrumb navigation Demonstration <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div> The Layout Files | PHP Tags <?php echo $OUTPUT->navbar(); ?>
  • 79. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates the “Turn editing on” button Demonstration <div class="navbutton"> <?php echo $PAGE->button; ?></div> The Layout Files | PHP Tags <?php echo $PAGE->button; ?>
  • 80. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This tells moodle where to place the blocks. Pre and Post are two Moodle defined locations (referred to as areas). Pre is typically the left column and post the right. Demonstration <div class="region-content"> <?php echo $OUTPUT->blocks_for_region('side-pre') ?> </div> The Layout Files | PHP Tags <?php echo $OUTPUT->blocks_for_region('side-pre') ?> <?php echo $OUTPUT->blocks_for_region('side-post') ?>
  • 81. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This is one of the most important calls within the file, it tells Moodle where to generate the actual content of the page Demonstration <div class="region-content"> <?php echo $OUTPUT->main_content() ?> </div> The Layout Files | PHP Tags <?php echo $OUTPUT->main_content() ?>
  • 82. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates the link that ether allows the user to log in, or tells them that they are logged in and provides a link to their profile screen Demonstration <?php echo $OUTPUT->login_info(); ?> The Layout Files | PHP Tags echo $OUTPUT->login_info();
  • 83. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates a link pointing back to your own Moodle’s homepage (otherwise known as frontpage) Demonstration <?php echo $OUTPUT->home_link(); ?> The Layout Files | PHP Tags echo $OUTPUT->home_link();
  • 84. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates a link pointing to the relevant help page on docs.moodle.org Demonstration <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p> The Layout Files | PHP Tags echo page_doc_link(get_string('moodledocslink'))
  • 85. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates the standard footer HTML which like the standard head HTML contains all of the script and style tags required by the page and requested to go in the footer Demonstration <?php echo $OUTPUT->standard_footer_html(); ?> The Layout Files | PHP Tags echo $OUTPUT->standard_footer_html(); Nice to know Within Moodle 2.0 most of the JavaScript for the page will be included in the footer. This greatly helps reduce the loading time of the page
  • 86. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This generates the standard footer HTML which like the standard head HTML contains all of the script and style tags required by the page and requested to go in the footer Demonstration <?php echo strip_tags(format_text($SITE->summary, FORMAT_HTML)) ?> The Layout Files | Little Known Tags <?php echo $SITE->summary ?> Best Practice Tip It is often best when using this tag to strip out additional HTML that may have been added by the user <?php echo strip_tags(format_text($SITE ->summary, FORMAT_HTML)) ?>
  • 87. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This conditional detects if there are breadcrumbs to show. If not, it can then display something else of your choosing. Demonstration <?php if ($hasnavbar) { ?> <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div> <?php } ?> The Layout Files | Useful Conditionals <?php if ($hasnavbar) { ?>
  • 88. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This conditional detects if the user is yet logged in and allows for content to be displayed accordingly. Demonstration if (isloggedin()) { echo ''.$OUTPUT->user_picture($USER, array('size'=>55)).''; echo $OUTPUT->login_info(); } else { ?> The Layout Files | Useful Conditionals if (isloggedin()){
  • 89. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition One of the best new features of Moodle 2 is the ability to move beyond “standard” limitations. For instance, in the past blocks could only be placed in the left and right columns. Now blocks can be placed in any location that the developer wishes to utilise Steps required to setup custom block locations ❖ Specify new location names in theme config ❖ Add new names in lang file ❖ Define new variable at top of layout file ❖ Insert new region where-ever you like in your layout. The Layout Files | Creating Custom block locations
  • 90. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition ❖ Advanced Theme Design ❖ Custom Settings Screen ❖ Custom Renderers ❖ Plating up a perfect dish ❖ The HTML and Main Menu Blocks ❖ Clever use of Labels Day Two Agenda Our cooking highlights
  • 91. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition ❖ Create a settings screen ❖ Creating custom theme renderes In this session we will cover Advanced theme design
  • 92. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Create a custom settings screen Unit 3: Advanced Theme Design
  • 93. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition This is an optional component of theme development. When used in conjunction with lib.php it allows the developer to create a custom Settings page in Moodle administration to allow users to override preset variables such as colors, widths, etc. Implementation To implement settings we will first need to ❖ create a settings screen ❖ create a supporting library function ❖ implement the settings via css and layout changes PHP Files | Settings Additional Info For more information on this function please visit - http:// docs.moodle.org/dev/ Themes_2.0_adding_a_settings _page
  • 94. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition When we are creating a settings screen we are effectively creating an online form which admins can use to change elements that we have specified. The form consists of various fields defined by the developer. To specify a new field we use following 6 elements. Theme Settings ❖ $name ❖ $title ❖ $description ❖ $default ❖ $setting ❖ $settings PHP Files | settings.php
  • 95. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition What is the name of this particular setting. This will be how it is stored in Moodle’s DB Demonstration $name = 'theme_mydemotheme/sitename'; PHP Files | settings.php | Form elements $name
  • 96. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This is the title that is shown to the user. It should be short but obvious. Instead of typing in the title here directly we will instead pull it from our lang file. Demonstration $title = get_string('sitename','theme_mydemotheme'); PHP Files | settings.php | Form elements $title
  • 97. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition As the name suggests, this is a more detailed description of what this theme setting will accomplish. Instructions can also be given here. Instead of typing in the title here directly we will instead pull it from our lang file. Demonstration $description = get_string('sitenamedesc', 'theme_mydemotheme'); PHP Files | settings.php | Form elements $description
  • 98. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition Does this particular field have a default value. If so you can define it here. Demonstration $default = 'Welcome to my site'; PHP Files | settings.php | Form elements $default
  • 99. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition Does this particular field have a default value. If so you can define it here. Demonstration $setting = new admin_setting_configtext($name, $title, $description, $default); PHP Files | settings.php | Form elements $default
  • 100. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This defines the entire input by combining the previous elements and specifying one of a variety of form input types based on the need. Demonstration $setting = new admin_setting_configcolourpicker($name, $title, $description, $default, $previewconfig); PHP Files | settings.php | Form elements $setting Text Field admin_setting_configtext Text Box admin_setting_configtextarea HTML Editor admin_setting_confightmleditor Radio Button admin_setting_configselect Color Picker admin_setting_configcolourpicker
  • 101. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition Don’t forget this as it is the most important element. This is essentially a close that tells moodle that this form element is complete and can now be added to the form PHP Files | settings.php | Form elements $settings->add($setting);
  • 102. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition <?php defined('MOODLE_INTERNAL') || die; if ($ADMIN->fulltree) { // Footer text or link $name = 'theme_rocket/footnote'; $title = get_string('footnote','theme_mydemotheme'); $description = get_string('footnotedesc', 'theme_mydemotheme'); $default = ''; $setting = new admin_setting_confightmleditor($name, $title, $description, $default); $settings->add($setting); // Custom CSS file $name = 'theme_mydemotheme/customcss'; $title = get_string('customcss','theme_mydemotheme'); $description = get_string('customcssdesc', 'theme_mydemotheme'); $setting = new admin_setting_configtextarea($name, $title, $description, ''); $settings->add($setting); } PHP Files | settings.php | Sample Completed form
  • 103. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition The lib.php file is a location where any custom function needed by the theme is stored. Again, what can be done here is limited by the imagination of the developer. But there is one function that most developers will need to define. This is the process_css function. The process_css function takes settings we created that were going to be rendered into our css files. This will allow us to define them as variables that Moodle will recognise PHP Files | lib.php
  • 104. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition function rocket_process_css($css, $theme) { // Set the theme background and highlites if (!empty($theme->settings->themecolor)) { $themecolor = $theme->settings->themecolor; } else { $themecolor = null; } $css = rocket_set_themecolor($css, $themecolor); return $css; } function rocket_set_themecolor($css, $themecolor) { $tag = '[[setting:themecolor]]'; $replacement = $themecolor; if (is_null($replacement)) { $replacement = '#5faff2'; } $css = str_replace($tag, $replacement, $css); return $css; } PHP Files | lib.php
  • 105. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Creating custom theme renderers Unit 3: Advanced Theme Design
  • 106. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Additional Info For more information on this function please visit - http:// docs.moodle.org/dev/ Themes_2.0_overriding_a_rend erer Definition This file contains override renderers used by theme. As this leads into advanced theme development we will not be going in-depth into lib.php in this presentation. Demonstration Look at advanced themes on moodle.org such as ‘Moodlebook’ and ‘Rocket’ to see examples of themes starting to use the renderers.php file. PHP Files | renderers.php
  • 107. Facilitating Education www.pukunui.com / info@pukunui.com Phone: 1300 466 635 or +61 8 9328 4545 themes edition Definition This file contains speciality classes and functions that are used by theme. As this leads into advanced theme developement we will not be going indepth into lib.php in this presentation. Demonstration function mytheme_set_customcss($css, $customcss) { $tag = '[[setting:customcss]]'; $replacement = $customcss; if (is_null($replacement)) { $replacement = ''; } $css = str_replace($tag, $replacement, $css); return $css; } PHP Files | lib.php