MDL-36048 Allow course formats to add course headers and footers
[moodle.git] / theme / canvas / layout / general.php
blob37f5ef3c26fdf332be933222b9db5c1d88b3a79e
1 <?php
3 $hasheading = ($PAGE->heading);
4 $hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());
5 $hasfooter = (empty($PAGE->layout_options['nofooter']));
6 $hassidepre = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-pre', $OUTPUT));
7 $hassidepost = (empty($PAGE->layout_options['noblocks']) && $PAGE->blocks->region_has_content('side-post', $OUTPUT));
8 $haslogininfo = (empty($PAGE->layout_options['nologininfo']));
10 $showsidepre = ($hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT));
11 $showsidepost = ($hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT));
13 $custommenu = $OUTPUT->custom_menu();
14 $hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu));
16 $bodyclasses = array();
17 if ($showsidepre && !$showsidepost) {
18 $bodyclasses[] = 'side-pre-only';
19 } else if ($showsidepost && !$showsidepre) {
20 $bodyclasses[] = 'side-post-only';
21 } else if (!$showsidepost && !$showsidepre) {
22 $bodyclasses[] = 'content-only';
24 if ($hascustommenu) {
25 $bodyclasses[] = 'has_custom_menu';
28 $courseheader = $coursecontentheader = $coursecontentfooter = $coursefooter = '';
29 if (empty($PAGE->layout_options['nocourseheaderfooter'])) {
30 $courseheader = $OUTPUT->course_header();
31 $coursecontentheader = $OUTPUT->course_content_header();
32 if (empty($PAGE->layout_options['nocoursefooter'])) {
33 $coursecontentfooter = $OUTPUT->course_content_footer();
34 $coursefooter = $OUTPUT->course_footer();
38 echo $OUTPUT->doctype() ?>
39 <html <?php echo $OUTPUT->htmlattributes() ?>>
40 <head>
41 <title><?php echo $PAGE->title ?></title>
42 <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
43 <?php echo $OUTPUT->standard_head_html() ?>
44 </head>
45 <body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
46 <?php echo $OUTPUT->standard_top_of_body_html() ?>
48 <div id="page">
50 <!-- START OF HEADER -->
52 <?php if ($hasheading || $hasnavbar || !empty($courseheader) || !empty($coursefooter)) { ?>
53 <div id="wrapper" class="clearfix">
54 <?php } ?>
56 <?php if ($hasheading) { ?>
57 <div id="page-header">
58 <div id="page-header-wrapper" class="clearfix">
59 <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
60 <div class="headermenu">
61 <?php
62 echo $OUTPUT->login_info();
63 if (!empty($PAGE->layout_options['langmenu'])) {
64 echo $OUTPUT->lang_menu();
66 echo $PAGE->headingmenu;
68 </div>
69 </div>
70 </div>
71 <?php } ?>
73 <?php if ($hascustommenu) { ?>
74 <div id="custommenu"><?php echo $custommenu; ?></div>
75 <?php } ?>
77 <?php if (!empty($courseheader)) { ?>
78 <div id="course-header"><?php echo $courseheader; ?></div>
79 <?php } ?>
81 <?php if ($hasnavbar) { ?>
82 <div class="navbar clearfix">
83 <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
84 <div class="navbutton"> <?php echo $PAGE->button; ?></div>
85 </div>
86 <?php } ?>
88 <!-- END OF HEADER -->
90 <!-- START OF CONTENT -->
92 <div id="page-content-wrapper" class="clearfix">
93 <div id="page-content">
94 <div id="region-main-box">
95 <div id="region-post-box">
97 <div id="region-main-wrap">
98 <div id="region-main">
99 <div class="region-content">
100 <?php echo $coursecontentheader; ?>
101 <?php echo $OUTPUT->main_content() ?>
102 <?php echo $coursecontentfooter; ?>
103 </div>
104 </div>
105 </div>
107 <?php if ($hassidepre) { ?>
108 <div id="region-pre" class="block-region">
109 <div class="region-content">
110 <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
111 </div>
112 </div>
113 <?php } ?>
115 <?php if ($hassidepost) { ?>
116 <div id="region-post" class="block-region">
117 <div class="region-content">
118 <?php echo $OUTPUT->blocks_for_region('side-post') ?>
119 </div>
120 </div>
121 <?php } ?>
123 </div>
124 </div>
125 </div>
126 </div>
128 <!-- END OF CONTENT -->
130 <!-- START OF FOOTER -->
132 <?php if (!empty($coursefooter)) { ?>
133 <div id="course-footer"><?php echo $coursefooter; ?></div>
134 <?php } ?>
135 <?php if ($hasfooter) { ?>
136 <div id="page-footer" class="clearfix">
137 <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
138 <?php
139 echo $OUTPUT->login_info();
140 echo $OUTPUT->home_link();
141 echo $OUTPUT->standard_footer_html();
143 </div>
144 <?php } ?>
146 <?php if ($hasheading || $hasnavbar || !empty($courseheader) || !empty($coursefooter)) { ?>
147 </div> <!-- END #wrapper -->
148 <?php } ?>
150 </div> <!-- END #page -->
152 <?php echo $OUTPUT->standard_end_of_body_html() ?>
153 </body>
154 </html>