MDL-34916 theme_formal_white: added support for relative path of logos
[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->customlogourl)) {
33     $logourl = $PAGE->theme->settings->customlogourl;
34     if (strtolower(substr($logourl, 0, 4)) != 'http') {
35         $logourl = $CFG->wwwroot.'/'.$logourl;
36     }
37 } else {
38     $logourl = $OUTPUT->pix_url('logo_small', 'theme');
39 }
41 $hasframe = !isset($PAGE->theme->settings->noframe) || !$PAGE->theme->settings->noframe;
43 $displaylogo = !isset($PAGE->theme->settings->headercontent) || $PAGE->theme->settings->headercontent;
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">
57     <?php if ($hasframe) { ?>
58         <div id="frametop">
59             <div id="framebottom">
60                 <div id="frametopright">
61                     <div>&nbsp;</div>
62                 </div>
63                 <div id="frameleft">
64                     <div id="frameright">
65                         <div id="wrapper">
66 <?php } ?>
68 <!-- begin of page-header -->
69                             <?php if ($hasheading) { ?>
70                             <div id="page-header">
71                             <?php if ($displaylogo) { ?>
72                                 <div id="headerlogo">
73                                     <img src="<?php echo $logourl ?>" alt="Custom logo here" />
74                                 </div>
75                             <?php } else { ?>
76                                 <h1 class="headerheading"><?php echo $PAGE->heading ?></h1>
77                             <?php } ?>
79                                 <div class="headermenu">
80                                     <?php
81                                     echo $OUTPUT->login_info();
82                                     if (($CFG->langmenu) && (!empty($PAGE->layout_options['langmenu']))) {
83                                         echo $OUTPUT->lang_menu();
84                                     }
85                                     echo $PAGE->headingmenu;
86                                 ?>
87                                 </div>
88                             </div>
89                             <?php } ?>
90 <!-- end of page-header -->
92 <!-- begin of custom menu -->
93                             <?php if ($hascustommenu) { ?>
94                             <div id="custommenu"><?php echo $custommenu; ?></div>
95                             <?php } ?>
96 <!-- end of custom menu -->
98 <!-- begin of navigation bar -->
99                             <?php if ($hasnavbar) { ?>
100                             <div class="navbar clearfix">
101                                 <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
102                                 <div class="navbutton"><?php echo $PAGE->button; ?></div>
103                             </div>
104                             <?php } ?>
105 <!-- end of navigation bar -->
107 <!-- start of moodle content -->
108                             <div id="page-content">
109                                 <div id="region-main-box">
110                                     <div id="region-post-box">
112                                         <!-- main mandatory content of the moodle page  -->
113                                         <div id="region-main-wrap">
114                                             <div id="region-main">
115                                                 <div class="region-content">
116                                                     <?php echo $OUTPUT->main_content() ?>
117                                                 </div>
118                                             </div>
119                                         </div>
120                                         <!-- end of main mandatory content of the moodle page -->
122                                         <!-- left column block - diplayed only if... -->
123                                         <?php if ($hassidepre) { ?>
124                                         <div id="region-pre" class="block-region">
125                                             <div class="region-content">
126                                                 <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
127                                             </div>
128                                         </div>
129                                         <?php } ?>
130                                         <!-- end of left column block - diplayed only if... -->
132                                         <!-- right column block - diplayed only if... -->
133                                         <?php if ($hassidepost) { ?>
134                                         <div id="region-post" class="block-region">
135                                             <div class="region-content">
136                                                 <?php echo $OUTPUT->blocks_for_region('side-post') ?>
137                                             </div>
138                                         </div>
139                                         <?php } ?>
140                                         <!-- end of right column block - diplayed only if... -->
142                                     </div>
143                                 </div>
144                             </div>
145 <!-- end of moodle content -->
147                             <div class="clearfix"></div>
149 <?php if ($hasframe) { ?>
150                         </div> <!-- </wrapper> -->
151                     </div> <!-- </frameright> -->
152                 </div> <!-- </frameleft> -->
153                 <div id="framebottomright">
154                     <div>&nbsp;</div>
155                 </div>
156             </div> <!-- </framebottom> -->
157         </div> <!-- </frametop> -->
159 <?php }
161 if ($hasfooter) {
162     if ($hasframe) { ?>
164         <!-- START OF FOOTER -->
165         <div id="page-footer">
166             <?php if (!empty($PAGE->theme->settings->footnote)) { ?>
167             <div id="footerframetop">
168                 <div id="footerframebottom">
169                     <div id="footerframetopright">
170                         <div>&nbsp;</div>
171                     </div>
172                     <div id="footerframeleft">
173                         <div id="footerframeright">
175                             <!-- the content to show -->
176                             <div id="footerwrapper">
177                                 <?php echo $PAGE->theme->settings->footnote; ?>
178                             </div> <!-- </footerwrapper> -->
180                         </div> <!-- </footerframeright> -->
181                     </div> <!-- </footerframeleft> -->
182                     <div id="footerframebottomright">
183                         <div>&nbsp;</div>
184                     </div>
185                 </div> <!-- </footerframebottom> -->
186             </div> <!-- </footerframetop> -->
187             <?php }
188             //one more div is waiting to be closed
190     } else { ?>
192         <!-- START OF FOOTER -->
193         <div id="page-footer" class="noframefooter">
194             <?php if (!empty($PAGE->theme->settings->footnote)) { ?>
195             <div id="page-footer-content">
197                 <!-- the content to show -->
198                 <div id="footerwrapper">
199                     <?php echo $PAGE->theme->settings->footnote; ?>
200                 </div> <!-- </footerwrapper> -->
202             </div> <!-- </page-footer-content> -->
203             <?php }
204             //one more div is waiting to be closed
206     } ?>
207             <div class="moodledocsleft">
208                 <?php
209                 echo $OUTPUT->login_info();
210                 //echo $OUTPUT->home_link();
211                 ?>
212                 <div class="moodledocs">
213                     <?php echo page_doc_link(get_string('moodledocslink')); ?>
214                 </div>
215                 <?php
216                 if ($PAGE->theme->settings->creditstomoodleorg == 2) {
217                     // can not use $OUTPUT->home_link() here because whether $OUTPUT->page->pagetype != 'site-index'
218                     // the output of the function is not the classic nice moodle logo $this->pix_url('moodlelogo')
219                 ?>
220                     <div class="sitelink">
221                         <a title="Moodle" href="http://moodle.org/">
222                             <img style="width:100px;height:30px" src="<?php echo $this->pix_url('moodlelogo') ?>" alt="moodlelogo" />
223                         </a>
224                     </div>
225                 <?php
226                 }
227                 echo $OUTPUT->standard_footer_html();
228                 ?>
229             </div>
230         </div> <!-- </page-footer> -->
231     </div> <!-- </page"> -->
233     <div class="clearfix"></div>
235 <?php  } //the waiting div has been closed: </page-footer>
236     echo $OUTPUT->standard_end_of_body_html(); ?>
237 </body>
238 </html>