MDL-36048 Modify themes to add course headers and footers provided by course format
[moodle.git] / theme / afterburner / layout / default.php
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 $hasfootnote = (!empty($PAGE->theme->settings->footnote));
18 $courseheader = $coursecontentheader = $coursecontentfooter = $coursefooter = '';
19 if (empty($PAGE->layout_options['nocourseheaderfooter'])) {
20     $courseheader = $OUTPUT->course_header();
21     $coursecontentheader = $OUTPUT->course_content_header();
22     if (empty($PAGE->layout_options['nocoursefooter'])) {
23         $coursecontentfooter = $OUTPUT->course_content_footer();
24         $coursefooter = $OUTPUT->course_footer();
25     }
26 }
28 $bodyclasses = array();
29 if ($showsidepre && !$showsidepost) {
30     if (!right_to_left()) {
31         $bodyclasses[] = 'side-pre-only';
32     } else {
33         $bodyclasses[] = 'side-post-only';
34     }
35 } else if ($showsidepost && !$showsidepre) {
36     if (!right_to_left()) {
37         $bodyclasses[] = 'side-post-only';
38     } else {
39         $bodyclasses[] = 'side-pre-only';
40     }
41 } else if (!$showsidepost && !$showsidepre) {
42     $bodyclasses[] = 'content-only';
43 }
44 if ($hascustommenu) {
45     $bodyclasses[] = 'has_custom_menu';
46 }
48 echo $OUTPUT->doctype() ?>
49 <html <?php echo $OUTPUT->htmlattributes() ?>>
50 <head>
51     <title><?php echo $PAGE->title ?></title>
52     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
53     <?php echo $OUTPUT->standard_head_html() ?>
54 </head>
56 <body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
57 <?php echo $OUTPUT->standard_top_of_body_html() ?>
58 <div id="page-wrapper">
59   <div id="page">
60     <?php if ($hasheading) { ?>
61         <div id="page-header">
62          <a class="logo" href="<?php echo $CFG->wwwroot; ?>" title="<?php print_string('home'); ?>"></a>
63          <div class="headermenu"><?php
64             if ($haslogininfo) {
65                 echo $OUTPUT->login_info();
66             }
67             if (!empty($PAGE->layout_options['langmenu'])) {
68                 echo $OUTPUT->lang_menu();
69             }
70             echo $PAGE->headingmenu
71             ?></div>
72         </div>
73     <?php } ?>
74 <!-- END OF HEADER -->
75 <!-- START CUSTOMMENU AND NAVBAR -->
76     <div id="navcontainer">
77         <?php if ($hascustommenu) { ?>
78                 <div id="custommenu" class="javascript-disabled"><?php echo $custommenu; ?></div>
79         <?php } ?>
81     </div>
83         <?php if (!empty($courseheader)) { ?>
84             <div id="course-header"><?php echo $courseheader; ?></div>
85         <?php } ?>
87         <?php if ($hasnavbar) { ?>
88             <div class="navbar clearfix">
89                 <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
90                 <div class="navbutton"> <?php echo $PAGE->button; ?></div>
91             </div>
92         <?php } ?>
94 <!-- END OF CUSTOMMENU AND NAVBAR -->
95     <div id="page-content">
96        <div id="region-main-box">
97            <div id="region-pre-box">
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>
106                <?php if ($hassidepre OR (right_to_left() AND $hassidepost)) { ?>
107                <div id="region-pre" class="block-region">
108                    <div class="region-content">
109                            <?php
110                        if (!right_to_left()) {
111                            echo $OUTPUT->blocks_for_region('side-pre');
112                        } elseif ($hassidepost) {
113                            echo $OUTPUT->blocks_for_region('side-post');
114                    } ?>
116                    </div>
117                </div>
118                <?php } ?>
120                <?php if ($hassidepost OR (right_to_left() AND $hassidepre)) { ?>
121                <div id="region-post" class="block-region">
122                    <div class="region-content">
123                           <?php
124                       if (!right_to_left()) {
125                           echo $OUTPUT->blocks_for_region('side-post');
126                       } elseif ($hassidepre) {
127                           echo $OUTPUT->blocks_for_region('side-pre');
128                    } ?>
129                    </div>
130                </div>
131                <?php } ?>
133             </div>
134         </div>
135     </div>
137     <!-- START OF FOOTER -->
138     <?php if (!empty($coursefooter)) { ?>
139         <div id="course-footer"><?php echo $coursefooter; ?></div>
140     <?php } ?>
141     <?php if ($hasfooter) { ?>
142     <div id="page-footer" class="clearfix">
144         <div class="footer-left">
146             <?php if ($hasfootnote) { ?>
147                     <div id="footnote"><?php echo $PAGE->theme->settings->footnote;?></div>
148             <?php } ?>
150             <a href="http://moodle.org" title="Moodle">
151                 <img src="<?php echo $OUTPUT->pix_url('footer/moodle-logo','theme')?>" alt="Moodle logo" />
152             </a>
153         </div>
155         <div class="footer-right">
156             <?php echo $OUTPUT->login_info();?>
157         </div>
159         <?php echo $OUTPUT->standard_footer_html(); ?>
160     </div>
161     <?php } ?>
162     <div class="clearfix"></div>
163 </div>
164 </div>
165 <?php echo $OUTPUT->standard_end_of_body_html() ?>
166 </body>
167 </html>