MDL-34916 theme_formal_white: added support for relative path of logos
[moodle.git] / theme / formal_white / layout / frontpage.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->frontpagelogourl)) {
33     $logourl = $PAGE->theme->settings->frontpagelogourl;
34 } else if (!empty($PAGE->theme->settings->customlogourl)) {
35     $logourl = $PAGE->theme->settings->customlogourl;
36 } else {
37     $logourl = $OUTPUT->pix_url('logo', 'theme');
38 }
39 if (strtolower(substr($logourl, 0, 4)) != 'http') {
40     $logourl = $CFG->wwwroot.'/'.$logourl;
41 }
43 $hasframe = !isset($PAGE->theme->settings->noframe) || !$PAGE->theme->settings->noframe;
45 $displaylogo = !isset($PAGE->theme->settings->headercontent) || $PAGE->theme->settings->headercontent;
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>
55 <body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
56     <?php echo $OUTPUT->standard_top_of_body_html(); ?>
57     <div id="page">
59     <?php if ($hasframe) { ?>
60         <div id="frametop">
61             <div id="framebottom">
62                 <div id="frametopright">
63                     <div>&nbsp;</div>
64                 </div>
65                 <div id="frameleft">
66                     <div id="frameright">
67                         <div id="wrapper">
68 <?php } ?>
70 <!-- begin of page-header -->
71                             <?php if ($hasheading) { ?>
72                             <div id="page-header">
73                             <?php if ($displaylogo) { ?>
74                                 <div id="headerlogo">
75                                     <img src="<?php echo $logourl ?>" alt="Custom logo here" />
76                                 </div>
77                             <?php } else { ?>
78                                 <h1 class="headerheading"><?php echo $PAGE->heading ?></h1>
79                             <?php } ?>
81                                 <div class="headermenu">
82                                     <?php
83                                     echo $OUTPUT->login_info();
84                                     if (($CFG->langmenu) && (!empty($PAGE->layout_options['langmenu']))) {
85                                         echo $OUTPUT->lang_menu();
86                                     }
87                                     echo $PAGE->headingmenu;
88                                 ?>
89                                 </div>
90                             </div>
91                             <?php } ?>
92 <!-- end of page-header -->
94 <!-- begin of custom menu -->
95                             <?php if ($hascustommenu) { ?>
96                             <div id="custommenu"><?php echo $custommenu; ?></div>
97                             <?php } ?>
98 <!-- end of custom menu -->
100 <!-- begin of navigation bar -->
101                             <?php if ($hasnavbar) { ?>
102                             <div class="navbar clearfix">
103                                 <div class="breadcrumb"><?php echo $OUTPUT->navbar(); ?></div>
104                                 <div class="navbutton"><?php echo $PAGE->button; ?></div>
105                             </div>
106                             <?php } ?>
107 <!-- end of navigation bar -->
109 <!-- start of moodle content -->
110                             <div id="page-content">
111                                 <div id="region-main-box">
112                                     <div id="region-post-box">
114                                         <!-- main mandatory content of the moodle page  -->
115                                         <div id="region-main-wrap">
116                                             <div id="region-main">
117                                                 <div class="region-content">
118                                                     <?php echo $OUTPUT->main_content() ?>
119                                                 </div>
120                                             </div>
121                                         </div>
122                                         <!-- end of main mandatory content of the moodle page -->
125                                         <!-- left column block - diplayed only if... -->
126                                         <?php if ($hassidepre) { ?>
127                                         <div id="region-pre" class="block-region">
128                                             <div class="region-content">
129                                                 <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
130                                             </div>
131                                         </div>
132                                         <?php } ?>
133                                         <!-- end of left column block - diplayed only if... -->
135                                         <!-- right column block - diplayed only if... -->
136                                         <?php if ($hassidepost) { ?>
137                                         <div id="region-post" class="block-region">
138                                             <div class="region-content">
139                                                 <?php echo $OUTPUT->blocks_for_region('side-post') ?>
140                                             </div>
141                                         </div>
142                                         <?php } ?>
143                                         <!-- end of right column block - diplayed only if... -->
145                                     </div>
146                                 </div>
147                             </div>
148 <!-- end of moodle content -->
150                             <div class="clearfix"></div>
152 <?php if ($hasframe) { ?>
153                         </div> <!-- </wrapper> -->
154                     </div> <!-- </frameright> -->
155                 </div> <!-- </frameleft> -->
156                 <div id="framebottomright">
157                     <div>&nbsp;</div>
158                 </div>
159             </div> <!-- </framebottom> -->
160         </div> <!-- </frametop> -->
162 <?php }
164 if ($hasfooter) {
165     if ($hasframe) { ?>
167         <!-- START OF FOOTER -->
168         <div id="page-footer">
169             <?php if (!empty($PAGE->theme->settings->footnote)) { ?>
170             <div id="footerframetop">
171                 <div id="footerframebottom">
172                     <div id="footerframetopright">
173                         <div>&nbsp;</div>
174                     </div>
175                     <div id="footerframeleft">
176                         <div id="footerframeright">
178                             <!-- the content to show -->
179                             <div id="footerwrapper">
180                                 <?php echo $PAGE->theme->settings->footnote; ?>
181                             </div> <!-- </footerwrapper> -->
183                         </div> <!-- </footerframeright> -->
184                     </div> <!-- </footerframeleft> -->
185                     <div id="footerframebottomright">
186                         <div>&nbsp;</div>
187                     </div>
188                 </div> <!-- </footerframebottom> -->
189             </div> <!-- </footerframetop> -->
190             <?php }
191             //one more div is waiting to be closed
193     } else { ?>
195         <!-- START OF FOOTER -->
196         <div id="page-footer" class="noframefooter">
197             <?php if (!empty($PAGE->theme->settings->footnote)) { ?>
198             <div id="page-footer-content">
200                 <!-- the content to show -->
201                 <div id="footerwrapper">
202                     <?php echo $PAGE->theme->settings->footnote; ?>
203                 </div> <!-- </footerwrapper> -->
205             </div> <!-- </page-footer-content> -->
206             <?php }
207             //one more div is waiting to be closed
209     } ?>
211             <div class="moodledocsleft">
212                 <?php
213                 echo $OUTPUT->login_info();
214                 if ($PAGE->theme->settings->creditstomoodleorg) {
215                     echo $OUTPUT->home_link();
216                 }
217                 echo $OUTPUT->standard_footer_html();
218                 ?>
219             </div>
220             <div class="moodledocs">
221                 <?php echo page_doc_link(get_string('moodledocslink')); ?>
222             </div>
223         </div> <!-- </page-footer> -->
224     </div> <!-- </page"> -->
226     <div class="clearfix"></div>
228 <?php  } //the waiting div has been closed: </page-footer>
229     echo $OUTPUT->standard_end_of_body_html(); ?>
230 </body>
231 </html>