MDL-29614 theme_formal_white: Change the way Formal White theme shrinks pages
[moodle.git] / theme / formal_white / layout / general.php
1 <?php
3 defined('MOODLE_INTERNAL') || die();
5 $hasheading = $PAGE->heading;
6 $hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());
7 $hasfooter = (empty($PAGE->layout_options['nofooter']));
9 $hassidepre = $PAGE->blocks->region_has_content('side-pre', $OUTPUT);
10 $hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT);
12 $showsidepre = $hassidepre && !$PAGE->blocks->region_completely_docked('side-pre', $OUTPUT);
13 $showsidepost = $hassidepost && !$PAGE->blocks->region_completely_docked('side-post', $OUTPUT);
15 $custommenu = $OUTPUT->custom_menu();
16 $hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu));
18 $bodyclasses = array();
19 if ($showsidepre && !$showsidepost) {
20     $bodyclasses[] = 'side-pre-only';
21 } else if ($showsidepost && !$showsidepre) {
22     $bodyclasses[] = 'side-post-only';
23 } else if (!$showsidepost && !$showsidepre) {
24     $bodyclasses[] = 'content-only';
25 }
27 if ($hascustommenu) {
28     $bodyclasses[] = 'has_custom_menu';
29 }
31 /************************************************************************************************/
32 if (!empty($PAGE->theme->settings->logo)) {
33     $logourl = $PAGE->theme->settings->logo;
34 } else {
35     $logourl = $OUTPUT->pix_url('logo_small', 'theme');
36 }
38 $hasframe = !isset($PAGE->theme->settings->noframe) || !$PAGE->theme->settings->noframe;
40 $displaylogo = !isset($PAGE->theme->settings->displaylogo) || $PAGE->theme->settings->displaylogo;
41 /************************************************************************************************/
43 echo $OUTPUT->doctype() ?>
44 <html <?php echo $OUTPUT->htmlattributes() ?>>
45 <head>
46     <title><?php echo $PAGE->title ?></title>
47     <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
48     <?php echo $OUTPUT->standard_head_html() ?>
49 </head>
50 <body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
51     <?php echo $OUTPUT->standard_top_of_body_html(); ?>
52     <div id="page">
54     <?php if ($hasframe) { ?>
55         <div id="frametop">
56             <div id="framebottom">
57                 <div id="frametopright">
58                     <div>&nbsp;</div>
59                 </div>
60                 <div id="frameleft">
61                     <div id="frameright">
62                         <div id="wrapper">
63 <?php } ?>
65 <!-- begin of page-header -->
66                             <?php if ($hasheading) { ?>
67                             <div id="page-header">
68                             <?php if ($displaylogo) { ?>
69                                 <div id="headerlogo">
70                                     <img src="<?php echo $logourl ?>" alt="Custom logo here" />
71                                 </div>
72                             <?php } else { ?>
73                                 <h1 class="headerheading"><?php echo $PAGE->heading ?></h1>
74                             <?php } ?>
76                                 <div class="headermenu">
77                                     <?php
78                                     echo $OUTPUT->login_info();
79                                     if (($CFG->langmenu) && (!empty($PAGE->layout_options['langmenu']))) {
80                                         echo $OUTPUT->lang_menu();
81                                     }
82                                     echo $PAGE->headingmenu;
83                                 ?>
84                                 </div>
85                             </div>
86                             <?php } ?>
87 <!-- end of page-header -->
89 <!-- begin of custom menu -->
90                             <?php if ($hascustommenu) { ?>
91                             <div id="custommenu"><?php echo $custommenu; ?></div>
92                             <?php } ?>
93 <!-- end of custom menu -->
95 <!-- begin of navigation bar -->
96                             <?php if ($hasnavbar) { ?>
97                             <div class="navbar clearfix">
98                                 <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
99                                 <div class="navbutton"><?php echo $PAGE->button; ?></div>
100                             </div>
101                             <?php } ?>
102 <!-- end of navigation bar -->
104 <!-- start of moodle content -->
105                             <div id="page-content">
106                                 <div id="region-main-box">
107                                     <div id="region-post-box">
109                                         <!-- main mandatory content of the moodle page  -->
110                                         <div id="region-main-wrap">
111                                             <div id="region-main">
112                                                 <div class="region-content">
113                                                     <?php echo $OUTPUT->main_content() ?>
114                                                 </div>
115                                             </div>
116                                         </div>
117                                         <!-- end of main mandatory content of the moodle page -->
120                                         <!-- left column block - diplayed only if... -->
121                                         <?php if ($hassidepre) { ?>
122                                         <div id="region-pre" class="block-region">
123                                             <div class="region-content">
124                                                 <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
125                                             </div>
126                                         </div>
127                                         <?php } ?>
128                                         <!-- end of left column block - diplayed only if... -->
130                                         <!-- right column block - diplayed only if... -->
131                                         <?php if ($hassidepost) { ?>
132                                         <div id="region-post" class="block-region">
133                                             <div class="region-content">
134                                                 <?php echo $OUTPUT->blocks_for_region('side-post') ?>
135                                             </div>
136                                         </div>
137                                         <?php } ?>
138                                         <!-- end of right column block - diplayed only if... -->
140                                     </div>
141                                 </div>
142                             </div>
143 <!-- end of moodle content -->
145                             <div class="clearfix"></div>
147 <?php if ($hasframe) { ?>
148                         </div> <!-- </wrapper> -->
149                     </div> <!-- </frameright> -->
150                 </div> <!-- </frameleft> -->
151                 <div id="framebottomright">
152                     <div>&nbsp;</div>
153                 </div>
154             </div> <!-- </framebottom> -->
155         </div> <!-- </frametop> -->
157 <?php }
159 if ($hasfooter) {
160     if ($hasframe) { ?>
162         <!-- START OF FOOTER -->
163         <div id="page-footer">
164             <?php if (!empty($PAGE->theme->settings->footnote)) { ?>
165             <div id="footerframetop">
166                 <div id="footerframebottom">
167                     <div id="footerframetopright">
168                         <div>&nbsp;</div>
169                     </div>
170                     <div id="footerframeleft">
171                         <div id="footerframeright">
173                             <!-- the content to show -->
174                             <div id="footerwrapper">
175                                 <?php echo $PAGE->theme->settings->footnote; ?>
176                             </div> <!-- </footerwrapper> -->
178                         </div> <!-- </footerframeright> -->
179                     </div> <!-- </footerframeleft> -->
180                     <div id="footerframebottomright">
181                         <div>&nbsp;</div>
182                     </div>
183                 </div> <!-- </footerframebottom> -->
184             </div> <!-- </footerframetop> -->
185             <?php }
186             //one more div is waiting to be closed
188     } else { ?>
190         <!-- START OF FOOTER -->
191         <div id="page-footer" class="noframefooter">
192             <?php if (!empty($PAGE->theme->settings->footnote)) { ?>
193             <div id="page-footer-content">
195                 <!-- the content to show -->
196                 <div id="footerwrapper">
197                     <?php echo $PAGE->theme->settings->footnote; ?>
198                 </div> <!-- </footerwrapper> -->
200             </div> <!-- </page-footer-content> -->
201             <?php }
202             //one more div is waiting to be closed
204     } ?>
205             <div class="moodledocsleft">
206                 <?php
207                 echo $OUTPUT->login_info();
208                 //echo $OUTPUT->home_link();
209                 ?>
210                 <div class="moodledocs">
211                     <?php echo page_doc_link(get_string('moodledocslink')); ?>
212                 </div>
213                 <?php
214                 if ($PAGE->theme->settings->creditstomoodleorg == 2) {
215                     // can not use $OUTPUT->home_link() here because whether $OUTPUT->page->pagetype != 'site-index'
216                     // the output of the function is not the classic nice moodle logo $this->pix_url('moodlelogo')
217                 ?>
218                     <div class="sitelink">
219                         <a title="Moodle" href="http://moodle.org/">
220                             <img style="width:100px;height:30px" src="<?php echo $this->pix_url('moodlelogo') ?>" alt="moodlelogo" />
221                         </a>
222                     </div>
223                 <?php
224                 }
225                 echo $OUTPUT->standard_footer_html();
226                 ?>
227             </div>
228         </div> <!-- </page-footer> -->
229     </div> <!-- </page"> -->
231     <div class="clearfix"></div>
233 <?php  } //the waiting div has been closed: </page-footer>
234     echo $OUTPUT->standard_end_of_body_html(); ?>
235 </body>
236 </html>