MDL-44213 theme_standardold: unified @package use and improved coding style
[moodle.git] / theme / standardold / layout / general.php
CommitLineData
d0355eba 1<?php
4048f825
SH
2// This file is part of Moodle - http://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
16
17/**
18 * The default layout.
19 *
20 * @package theme_standardold
21 * @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
d0355eba
SH
24
25$hasheading = ($PAGE->heading);
26$hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());
27$hasfooter = (empty($PAGE->layout_options['nofooter']));
28$hassidepre = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-pre', $OUTPUT));
29$hassidepost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-post', $OUTPUT));
30
31$showsidepre = ($hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT));
32$showsidepost = ($hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT));
33
34$custommenu = $OUTPUT->custom_menu();
35$hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu));
36
c8f9faba
MG
37$courseheader = $coursecontentheader = $coursecontentfooter = $coursefooter = '';
38if (empty($PAGE->layout_options['nocourseheaderfooter'])) {
39 $courseheader = $OUTPUT->course_header();
40 $coursecontentheader = $OUTPUT->course_content_header();
41 if (empty($PAGE->layout_options['nocoursefooter'])) {
42 $coursecontentfooter = $OUTPUT->course_content_footer();
43 $coursefooter = $OUTPUT->course_footer();
44 }
45}
46
d0355eba
SH
47$bodyclasses = array();
48if ($showsidepre && !$showsidepost) {
49 $bodyclasses[] = 'side-pre-only';
50} else if ($showsidepost && !$showsidepre) {
51 $bodyclasses[] = 'side-post-only';
52} else if (!$showsidepost && !$showsidepre) {
53 $bodyclasses[] = 'content-only';
54}
55if ($hascustommenu) {
56 $bodyclasses[] = 'has_custom_menu';
57}
58
59echo $OUTPUT->doctype() ?>
60<html <?php echo $OUTPUT->htmlattributes() ?>>
61<head>
62 <title><?php echo $PAGE->title ?></title>
63 <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
64 <?php echo $OUTPUT->standard_head_html() ?>
65</head>
0ae36f66 66<body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
d0355eba
SH
67<?php echo $OUTPUT->standard_top_of_body_html() ?>
68<div id="page">
69<?php if ($hasheading || $hasnavbar) { ?>
70 <div id="page-header">
71 <?php if ($hasheading) { ?>
72 <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
73 <div class="headermenu"><?php
74 echo $OUTPUT->login_info();
75 if (!empty($PAGE->layout_options['langmenu'])) {
76 echo $OUTPUT->lang_menu();
77 }
78 echo $PAGE->headingmenu
79 ?></div><?php } ?>
80 <?php if ($hascustommenu) { ?>
81 <div id="custommenu"><?php echo $custommenu; ?></div>
82 <?php } ?>
c8f9faba
MG
83 <?php if (!empty($courseheader)) { ?>
84 <div id="course-header"><?php echo $courseheader; ?></div>
85 <?php } ?>
d0355eba
SH
86 <?php if ($hasnavbar) { ?>
87 <div class="navbar clearfix">
88 <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
89 <div class="navbutton"> <?php echo $PAGE->button; ?></div>
90 </div>
91 <?php } ?>
92 </div>
93<?php } ?>
94<!-- END OF HEADER -->
95
96 <div id="page-content">
97 <table id="region-main-box" class="layout-table" summary="layout">
98 <tr id="region-post-box">
15e08444 99 <?php if ($hassidepre) { ?>
d0355eba
SH
100 <td id="region-pre" class="block-region">
101 <div class="region-content">
102 <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
103 </div>
104 </td>
15e08444 105 <?php } ?>
d0355eba
SH
106 <td id="region-main-wrap">
107 <div id="region-main">
108 <div class="region-content">
c8f9faba 109 <?php echo $coursecontentheader; ?>
3b3f3028 110 <?php echo $OUTPUT->main_content() ?>
c8f9faba 111 <?php echo $coursecontentfooter; ?>
d0355eba
SH
112 </div>
113 </div>
114 </td>
15e08444 115 <?php if ($hassidepost) { ?>
d0355eba
SH
116 <td id="region-post" class="block-region">
117 <div class="region-content">
118 <?php echo $OUTPUT->blocks_for_region('side-post') ?>
119 </div>
120 </td>
121 <?php } ?>
122 </tr>
123 </table>
124 </div>
c8f9faba
MG
125 <?php if (!empty($coursefooter)) { ?>
126 <div id="course-footer"><?php echo $coursefooter; ?></div>
127 <?php } ?>
d0355eba
SH
128
129<!-- START OF FOOTER -->
130 <?php if ($hasfooter) { ?>
131 <div id="page-footer" class="clearfix">
132 <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
133 <?php
134 echo $OUTPUT->login_info();
135 echo $OUTPUT->home_link();
136 echo $OUTPUT->standard_footer_html();
137 ?>
138 </div>
139 <?php } ?>
140</div>
141<?php echo $OUTPUT->standard_end_of_body_html() ?>
142</body>
143</html>