PageRenderTime 55ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/theme/splash/layout/general.php

https://bitbucket.org/ngmares/moodle
PHP | 219 lines | 188 code | 10 blank | 21 comment | 30 complexity | bb2afb3f34794630bd46e042c225c039 MD5 | raw file
Possible License(s): LGPL-2.1, AGPL-3.0, MPL-2.0-no-copyleft-exception, GPL-3.0, Apache-2.0, BSD-3-Clause
  1. <?php
  2. // This file is part of Moodle - http://moodle.org/
  3. //
  4. // Moodle is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // Moodle is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU General Public License
  15. // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
  16. /**
  17. * General layout for the splash theme
  18. *
  19. * @package theme_splash
  20. * @copyright 2012 Caroline Kennedy - Synergy Learning
  21. * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22. */
  23. $hasheading = ($PAGE->heading);
  24. $hasnavbar = (empty($PAGE->layout_options['nonavbar']) && $PAGE->has_navbar());
  25. $hasfooter = (empty($PAGE->layout_options['nofooter']));
  26. $hassidepre = $PAGE->blocks->region_has_content('side-pre', $OUTPUT);
  27. $hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT);
  28. $custommenu = $OUTPUT->custom_menu();
  29. $hascustommenu = (empty($PAGE->layout_options['nocustommenu']) && !empty($custommenu));
  30. splash_check_colourswitch();
  31. splash_initialise_colourswitcher($PAGE);
  32. $bodyclasses = array();
  33. $bodyclasses[] = 'splash-'.splash_get_colour();
  34. if ($hassidepre && !$hassidepost) {
  35. $bodyclasses[] = 'side-pre-only';
  36. } else if ($hassidepost && !$hassidepre) {
  37. $bodyclasses[] = 'side-post-only';
  38. } else if (!$hassidepost && !$hassidepre) {
  39. $bodyclasses[] = 'content-only';
  40. }
  41. $haslogo = (!empty($PAGE->theme->settings->logo));
  42. $hasfootnote = (!empty($PAGE->theme->settings->footnote));
  43. $hidetagline = (!empty($PAGE->theme->settings->hide_tagline) && $PAGE->theme->settings->hide_tagline == 1);
  44. if (!empty($PAGE->theme->settings->tagline)) {
  45. $tagline = $PAGE->theme->settings->tagline;
  46. } else {
  47. $tagline = get_string('defaulttagline', 'theme_splash');
  48. }
  49. echo $OUTPUT->doctype() ?>
  50. <html <?php echo $OUTPUT->htmlattributes() ?>>
  51. <head>
  52. <title><?php echo $PAGE->title ?></title>
  53. <link rel="shortcut icon" href="<?php echo $OUTPUT->pix_url('favicon', 'theme')?>" />
  54. <meta name="description" content="<?php p(strip_tags(format_text($SITE->summary, FORMAT_HTML))) ?>" />
  55. <?php echo $OUTPUT->standard_head_html() ?>
  56. </head>
  57. <body id="<?php p($PAGE->bodyid) ?>" class="<?php p($PAGE->bodyclasses.' '.join(' ', $bodyclasses)) ?>">
  58. <?php echo $OUTPUT->standard_top_of_body_html() ?>
  59. <div id="page">
  60. <?php if ($hasheading || $hasnavbar) { ?>
  61. <div id="page-header">
  62. <div id="page-header-wrapper" class="wrapper clearfix">
  63. <?php
  64. if ($hasheading) { ?>
  65. <div id="headermenu">
  66. <?php
  67. if (isloggedin()) {
  68. echo html_writer::start_tag('div', array('id'=>'userdetails'));
  69. echo html_writer::tag('h1', get_string('usergreeting', 'theme_splash', $USER->firstname));
  70. echo html_writer::start_tag('p', array('class'=>'prolog'));
  71. echo html_writer::link(new moodle_url('/user/profile.php', array('id'=>$USER->id)),
  72. get_string('myprofile')).' | ';
  73. echo html_writer::link(new moodle_url('/login/logout.php', array('sesskey'=>sesskey())),
  74. get_string('logout'));
  75. echo html_writer::end_tag('p');
  76. echo html_writer::end_tag('div');
  77. echo html_writer::tag('div', $OUTPUT->user_picture($USER, array('size'=>55)), array('class'=>'userimg'));
  78. } else {
  79. echo html_writer::start_tag('div', array('id'=>'userdetails_loggedout'));
  80. $loginlink = html_writer::link(new moodle_url('/login/'), get_string('loginhere', 'theme_splash'));
  81. echo html_writer::tag('h1', get_string('welcome', 'theme_splash', $loginlink));
  82. echo html_writer::end_tag('div');
  83. } ?>
  84. <div class="clearer"></div>
  85. <div id="colourswitcher">
  86. <ul>
  87. <li><img src="<?php echo $OUTPUT->pix_url('colour', 'theme'); ?>" alt="colour" /></li>
  88. <li><a href="<?php echo new moodle_url($PAGE->url, array('splashcolour'=>'red')); ?>" class="styleswitch
  89. colour-red"><img src="<?php echo $OUTPUT->pix_url('red-theme2', 'theme'); ?>" alt="red" /></a></li>
  90. <li><a href="<?php echo new moodle_url($PAGE->url, array('splashcolour'=>'green')); ?>"
  91. class="styleswitch colour-green"><img src="<?php echo $OUTPUT->pix_url('green-theme2', 'theme'); ?>"
  92. alt="green" /></a></li>
  93. <li><a href="<?php echo new moodle_url($PAGE->url, array('splashcolour'=>'blue')); ?>"
  94. class="styleswitch colour-blue"><img src="<?php echo $OUTPUT->pix_url('blue-theme2', 'theme'); ?>"
  95. alt="blue" /></a></li>
  96. <li><a href="<?php echo new moodle_url($PAGE->url, array('splashcolour'=>'orange')); ?>"
  97. class="styleswitch colour-orange"><img src="<?php echo $OUTPUT->pix_url('orange-theme2', 'theme');
  98. ?>"
  99. alt="orange" /></a></li>
  100. </ul>
  101. </div>
  102. <?php echo $OUTPUT->lang_menu();?>
  103. </div>
  104. <div id="logobox">
  105. <?php
  106. if ($haslogo) {
  107. echo html_writer::link(new moodle_url('/'), "<img src='".$PAGE->theme->settings->logo."' alt='logo' />");
  108. } else {
  109. echo html_writer::link(new moodle_url('/'), $PAGE->heading, array('class'=>'nologoimage'));
  110. } ?>
  111. <?php
  112. if (!$hidetagline) { ?>
  113. <h4><?php echo $tagline ?></h4>
  114. <?php
  115. } ?>
  116. </div>
  117. <div class="clearer"></div>
  118. <?php
  119. if ($haslogo) { ?>
  120. <h4 class="headermain inside">&nbsp;</h4>
  121. <?php
  122. } else { ?>
  123. <h4 class="headermain inside"><?php echo $PAGE->heading ?></h4>
  124. <?php
  125. } ?>
  126. <?php
  127. } // End of if ($hasheading)?>
  128. <!-- CUSTOMMENU -->
  129. <div class="clearer"></div>
  130. <?php
  131. if ($hascustommenu) { ?>
  132. <div id="moodlemenu">
  133. <div id="custommenu"><?php echo $custommenu; ?></div>
  134. </div>
  135. <?php
  136. } ?>
  137. <!-- END CUSTOMMENU -->
  138. <div class="navbar">
  139. <div class="wrapper clearfix">
  140. <div class="breadcrumb">
  141. <?php
  142. if ($hasnavbar) {
  143. echo $OUTPUT->navbar();
  144. } ?>
  145. </div>
  146. <div class="navbutton"> <?php echo $PAGE->button; ?></div>
  147. </div>
  148. </div>
  149. </div>
  150. </div>
  151. <?php
  152. } // if ($hasheading || $hasnavbar) ?>
  153. <!-- END OF HEADER -->
  154. <!-- START OF CONTENT -->
  155. <div id="page-content">
  156. <div id="region-main-box">
  157. <div id="region-post-box">
  158. <div id="region-main-wrap">
  159. <div id="region-main">
  160. <div class="region-content">
  161. <?php echo $OUTPUT->main_content() ?>
  162. </div>
  163. </div>
  164. </div>
  165. <?php if ($hassidepre) { ?>
  166. <div id="region-pre" class="block-region">
  167. <div class="region-content">
  168. <?php echo $OUTPUT->blocks_for_region('side-pre') ?>
  169. </div>
  170. </div>
  171. <?php
  172. } ?>
  173. <?php if ($hassidepost) { ?>
  174. <div id="region-post" class="block-region">
  175. <div class="region-content">
  176. <?php echo $OUTPUT->blocks_for_region('side-post') ?>
  177. </div>
  178. </div>
  179. <?php
  180. } ?>
  181. </div>
  182. </div>
  183. </div>
  184. <!-- END OF CONTENT -->
  185. <div class="clearfix"></div>
  186. <!-- END OF #Page -->
  187. </div>
  188. <!-- START OF FOOTER -->
  189. <?php if ($hasfooter) { ?>
  190. <div id="page-footer">
  191. <div id="footer-wrapper">
  192. <?php
  193. if ($hasfootnote) { ?>
  194. <div id="footnote"><?php echo $PAGE->theme->settings->footnote; ?></div>
  195. <?php
  196. } ?>
  197. <p class="helplink"><?php echo page_doc_link(get_string('moodledocslink')) ?></p>
  198. <?php
  199. echo $OUTPUT->login_info();
  200. echo $OUTPUT->home_link();
  201. echo $OUTPUT->standard_footer_html();
  202. ?>
  203. </div>
  204. </div>
  205. <?php
  206. } ?>
  207. <?php echo $OUTPUT->standard_end_of_body_html() ?>
  208. </body>
  209. </html>