ecda10c55bf9d386e9ce70070f908797a58de2ff
[moodle.git] / theme / base / layout / general.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 $courseheader = $coursecontentheader = $coursecontentfooter = $coursefooter = '';
17 if (empty($PAGE->layout_options['nocourseheaderfooter'])) {
18     $courseheader = $OUTPUT->course_header();
19     $coursecontentheader = $OUTPUT->course_content_header();
20     if (empty($PAGE->layout_options['nocoursefooter'])) {
21         $coursecontentfooter = $OUTPUT->course_content_footer();
22         $coursefooter = $OUTPUT->course_footer();
23     }
24 }
26 $bodyclasses = array();
27 if ($showsidepre && !$showsidepost) {
28         $bodyclasses[] = 'side-pre-only';
29 } else if ($showsidepost && !$showsidepre) {
30         $bodyclasses[] = 'side-post-only';
31 } else if (!$showsidepost && !$showsidepre) {
32     $bodyclasses[] = 'content-only';
33 }
34 if ($hascustommenu) {
35     $bodyclasses[] = 'has_custom_menu';
36 }
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() ?>
47 <div id="page">
48 <?php if ($hasheading || $hasnavbar || !empty($courseheader)) { ?>
49     <div id="page-header">
50         <?php if ($hasheading) { ?>
51         <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
52         <div class="headermenu"><?php
53             if ($haslogininfo) {
54                 echo $OUTPUT->login_info();
55             }
56             if (!empty($PAGE->layout_options['langmenu'])) {
57                 echo $OUTPUT->lang_menu();
58             }
59             echo $PAGE->headingmenu
60         ?></div><?php } ?>
61         <?php if (!empty($courseheader)) { ?>
62             <div id="course-header"><?php echo $courseheader; ?></div>
63         <?php } ?>
64         <?php if ($hascustommenu) { ?>
65         <div id="custommenu"><?php echo $custommenu; ?></div>
66         <?php } ?>
67         <?php if ($hasnavbar) { ?>
68             <div class="navbar clearfix">
69                 <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
70                 <div class="navbutton"> <?php echo $PAGE->button; ?></div>
71             </div>
72         <?php } ?>
73     </div>
74 <?php } ?>
75 <!-- END OF HEADER -->
77     <div id="page-content">
78         <div id="region-main-box">
79             <div id="region-post-box">
81                 <div id="region-main-wrap">
82                     <div id="region-main">
83                         <div class="region-content">
84                             <?php echo $coursecontentheader; ?>
85                             <?php echo $OUTPUT->main_content() ?>
86                             <?php echo $coursecontentfooter; ?>
87                         </div>
88                     </div>
89                 </div>
91                 <?php if ($hassidepre) { ?>
92                 <div id="region-pre" class="block-region">
93                     <div class="region-content">
94                         <?php echo $OUTPUT->blocks_for_region('side-pre'); ?>
95                     </div>
96                 </div>
97                 <?php } ?>
99                 <?php if ($hassidepost) { ?>
100                 <div id="region-post" class="block-region">
101                     <div class="region-content">
102                         <?php echo $OUTPUT->blocks_for_region('side-post'); ?>
103                     </div>
104                 </div>
105                 <?php } ?>
107             </div>
108         </div>
109     </div>
111 <!-- START OF FOOTER -->
112     <?php if (!empty($coursefooter)) { ?>
113         <div id="course-footer"><?php echo $coursefooter; ?></div>
114     <?php } ?>
115     <?php if ($hasfooter) { ?>
116     <div id="page-footer" class="clearfix">
117         <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
118         <?php
119         echo $OUTPUT->login_info();
120         echo $OUTPUT->home_link();
121         echo $OUTPUT->standard_footer_html();
122         ?>
123     </div>
124     <?php } ?>
125     <div class="clearfix"></div>
126 </div>
127 <?php echo $OUTPUT->standard_end_of_body_html() ?>
128 </body>
129 </html>