Revert "MDL-39871 Find a solution to handling RTL switching in CSS"
[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     if (!right_to_left()) {
29         $bodyclasses[] = 'side-pre-only';
30     }else{
31         $bodyclasses[] = 'side-post-only';
32     }
33 } else if ($showsidepost && !$showsidepre) {
34     if (!right_to_left()) {
35         $bodyclasses[] = 'side-post-only';
36     }else{
37         $bodyclasses[] = 'side-pre-only';
38     }
39 } else if (!$showsidepost && !$showsidepre) {
40     $bodyclasses[] = 'content-only';
41 }
42 if ($hascustommenu) {
43     $bodyclasses[] = 'has_custom_menu';
44 }
46 echo $OUTPUT->doctype() ?>
47 <html <?php echo $OUTPUT->htmlattributes() ?>>
48 <head>
49     <title><?php echo $PAGE->title ?></title>
50     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
51     <?php echo $OUTPUT->standard_head_html() ?>
52 </head>
53 <body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
54 <?php echo $OUTPUT->standard_top_of_body_html() ?>
55 <div id="page">
56 <?php if ($hasheading || $hasnavbar || !empty($courseheader)) { ?>
57     <div id="page-header">
58         <?php if ($hasheading) { ?>
59         <h1 class="headermain"><?php echo $PAGE->heading ?></h1>
60         <div class="headermenu"><?php
61             if ($haslogininfo) {
62                 echo $OUTPUT->login_info();
63             }
64             if (!empty($PAGE->layout_options['langmenu'])) {
65                 echo $OUTPUT->lang_menu();
66             }
67             echo $PAGE->headingmenu
68         ?></div><?php } ?>
69         <?php if (!empty($courseheader)) { ?>
70             <div id="course-header"><?php echo $courseheader; ?></div>
71         <?php } ?>
72         <?php if ($hascustommenu) { ?>
73         <div id="custommenu"><?php echo $custommenu; ?></div>
74         <?php } ?>
75         <?php if ($hasnavbar) { ?>
76             <div class="navbar clearfix">
77                 <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
78                 <div class="navbutton"> <?php echo $PAGE->button; ?></div>
79             </div>
80         <?php } ?>
81     </div>
82 <?php } ?>
83 <!-- END OF HEADER -->
85     <div id="page-content">
86         <div id="region-main-box">
87             <div id="region-post-box">
89                 <div id="region-main-wrap">
90                     <div id="region-main">
91                         <div class="region-content">
92                             <?php echo $coursecontentheader; ?>
93                             <?php echo $OUTPUT->main_content() ?>
94                             <?php echo $coursecontentfooter; ?>
95                         </div>
96                     </div>
97                 </div>
99                 <?php if ($hassidepre OR (right_to_left() AND $hassidepost)) { ?>
100                 <div id="region-pre" class="block-region">
101                     <div class="region-content">
102                             <?php
103                         if (!right_to_left()) {
104                             echo $OUTPUT->blocks_for_region('side-pre');
105                         } elseif ($hassidepost) {
106                             echo $OUTPUT->blocks_for_region('side-post');
107                     } ?>
109                     </div>
110                 </div>
111                 <?php } ?>
113                 <?php if ($hassidepost OR (right_to_left() AND $hassidepre)) { ?>
114                 <div id="region-post" class="block-region">
115                     <div class="region-content">
116                            <?php
117                        if (!right_to_left()) {
118                            echo $OUTPUT->blocks_for_region('side-post');
119                        } elseif ($hassidepre) {
120                            echo $OUTPUT->blocks_for_region('side-pre');
121                     } ?>
122                     </div>
123                 </div>
124                 <?php } ?>
126             </div>
127         </div>
128     </div>
130 <!-- START OF FOOTER -->
131     <?php if (!empty($coursefooter)) { ?>
132         <div id="course-footer"><?php echo $coursefooter; ?></div>
133     <?php } ?>
134     <?php if ($hasfooter) { ?>
135     <div id="page-footer" class="clearfix">
136         <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
137         <?php
138         echo $OUTPUT->login_info();
139         echo $OUTPUT->home_link();
140         echo $OUTPUT->standard_footer_html();
141         ?>
142     </div>
143     <?php } ?>
144     <div class="clearfix"></div>
145 </div>
146 <?php echo $OUTPUT->standard_end_of_body_html() ?>
147 </body>
148 </html>