mirrored from git://git.moodle.org/moodle.git
/
general.php
224 lines (214 loc) · 8.46 KB
/
general.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* General layout for the splash theme
*
* @package theme_splash
* @copyright 2012 Caroline Kennedy - Synergy Learning
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$hasheading = ($PAGE->heading);
$hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());
$hasfooter = (empty($PAGE->layout_options['nofooter']));
$hassidepre = $PAGE->blocks->region_has_content('side-pre', $OUTPUT);
$hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT);
$custommenu = $OUTPUT->custom_menu();
$hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu));
splash_check_colourswitch();
splash_initialise_colourswitcher($PAGE);
$bodyclasses = array();
$bodyclasses[] = 'splash-'.splash_get_colour();
if ($hassidepre && !$hassidepost) {
$bodyclasses[] = 'side-pre-only';
} else if ($hassidepost && !$hassidepre) {
$bodyclasses[] = 'side-post-only';
} else if (!$hassidepost && !$hassidepre) {
$bodyclasses[] = 'content-only';
}
$haslogo = (!empty($PAGE->theme->settings->logo));
$hasfootnote = (!empty($PAGE->theme->settings->footnote));
$hidetagline = (!empty($PAGE->theme->settings->hide_tagline) && $PAGE->theme->settings->hide_tagline == 1);
if (!empty($PAGE->theme->settings->tagline)) {
$tagline = $PAGE->theme->settings->tagline;
} else {
$tagline = get_string('defaulttagline', 'theme_splash');
}
echo $OUTPUT->doctype() ?>
<html <?php echo $OUTPUT->htmlattributes() ?>>
<head>
<title><?php echo $PAGE->title ?></title>
<link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
<meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
<?php echo $OUTPUT->standard_head_html() ?>
</head>
<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
<?php echo $OUTPUT->standard_top_of_body_html() ?>
<div id="page">
<?php if ($hasheading || $hasnavbar) { ?>
<div id="page-header">
<div id="page-header-wrapper" class="wrapper clearfix">
<?php
if ($hasheading) { ?>
<div id="headermenu">
<?php
if (isloggedin()) {
echo html_writer::start_tag('div', array('id'=>'userdetails'));
echo html_writer::tag('h1', get_string('usergreeting', 'theme_splash', $USER->firstname));
echo html_writer::start_tag('p', array('class'=>'prolog'));
echo html_writer::link(new moodle_url('/user/profile.php', array('id'=>$USER->id)),
get_string('myprofile')).' | ';
echo html_writer::link(new moodle_url('/login/logout.php', array('sesskey'=>sesskey())),
get_string('logout'));
echo html_writer::end_tag('p');
echo html_writer::end_tag('div');
echo html_writer::tag('div', $OUTPUT->user_picture($USER, array('size'=>55)), array('class'=>'userimg'));
} else {
echo html_writer::start_tag('div', array('id'=>'userdetails_loggedout'));
$loginlink = html_writer::link(new moodle_url('/login/'), get_string('loginhere', 'theme_splash'));
echo html_writer::tag('h1', get_string('welcome', 'theme_splash', $loginlink));
echo html_writer::end_tag('div');
} ?>
<div class="clearer"></div>
<div id="colourswitcher">
<ul>
<li><img src="<?php echo $OUTPUT->pix_url('colour', 'theme'); ?>" alt="colour" /></li>
<li><a href="<?php echo new moodle_url($PAGE->url, array('splashcolour'=>'red')); ?>" class="styleswitch
colour-red"><img src="<?php echo $OUTPUT->pix_url('red-theme2', 'theme'); ?>" alt="red" /></a></li>
<li><a href="<?php echo new moodle_url($PAGE->url, array('splashcolour'=>'green')); ?>"
class="styleswitch colour-green"><img src="<?php echo $OUTPUT->pix_url('green-theme2', 'theme'); ?>"
alt="green" /></a></li>
<li><a href="<?php echo new moodle_url($PAGE->url, array('splashcolour'=>'blue')); ?>"
class="styleswitch colour-blue"><img src="<?php echo $OUTPUT->pix_url('blue-theme2', 'theme'); ?>"
alt="blue" /></a></li>
<li><a href="<?php echo new moodle_url($PAGE->url, array('splashcolour'=>'orange')); ?>"
class="styleswitch colour-orange"><img src="<?php echo $OUTPUT->pix_url('orange-theme2', 'theme');
?>"
alt="orange" /></a></li>
</ul>
</div>
<?php
if (!empty($PAGE->layout_options['langmenu'])) {
echo $OUTPUT->lang_menu();
}
echo $PAGE->headingmenu
?>
</div>
<div id="logobox">
<?php
if ($haslogo) {
echo html_writer::link(new moodle_url('/'), "<img src='".$PAGE->theme->settings->logo."' alt='logo' />");
} else {
echo html_writer::link(new moodle_url('/'), $PAGE->heading, array('class'=>'nologoimage'));
} ?>
<?php
if (!$hidetagline) { ?>
<h4><?php echo $tagline ?></h4>
<?php
} ?>
</div>
<div class="clearer"></div>
<?php
if ($haslogo) { ?>
<h4 class="headermain inside"> </h4>
<?php
} else { ?>
<h4 class="headermain inside"><?php echo $PAGE->heading ?></h4>
<?php
} ?>
<?php
} // End of if ($hasheading)?>
<!-- CUSTOMMENU -->
<div class="clearer"></div>
<?php
if ($hascustommenu) { ?>
<div id="moodlemenu">
<div id="custommenu"><?php echo $custommenu; ?></div>
</div>
<?php
} ?>
<!-- END CUSTOMMENU -->
<div class="navbar">
<div class="wrapper clearfix">
<div class="breadcrumb">
<?php
if ($hasnavbar) {
echo $OUTPUT->navbar();
} ?>
</div>
<div class="navbutton"> <?php echo $PAGE->button; ?></div>
</div>
</div>
</div>
</div>
<?php
} // if ($hasheading || $hasnavbar) ?>
<!-- END OF HEADER -->
<!-- START OF CONTENT -->
<div id="page-content">
<div id="region-main-box">
<div id="region-post-box">
<div id="region-main-wrap">
<div id="region-main">
<div class="region-content">
<?php echo $OUTPUT->main_content() ?>
</div>
</div>
</div>
<?php if ($hassidepre) { ?>
<div id="region-pre" class="block-region">
<div class="region-content">
<?php echo $OUTPUT->blocks_for_region('side-pre') ?>
</div>
</div>
<?php
} ?>
<?php if ($hassidepost) { ?>
<div id="region-post" class="block-region">
<div class="region-content">
<?php echo $OUTPUT->blocks_for_region('side-post') ?>
</div>
</div>
<?php
} ?>
</div>
</div>
</div>
<!-- END OF CONTENT -->
<div class="clearfix"></div>
<!-- END OF #Page -->
</div>
<!-- START OF FOOTER -->
<?php if ($hasfooter) { ?>
<div id="page-footer">
<div id="footer-wrapper">
<?php
if ($hasfootnote) { ?>
<div id="footnote"><?php echo $PAGE->theme->settings->footnote; ?></div>
<?php
} ?>
<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();
?>
</div>
</div>
<?php
} ?>
<?php echo $OUTPUT->standard_end_of_body_html() ?>
</body>
</html>