diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a36b3b1..4e5d95d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -53,7 +53,7 @@ jobs: DB: ${{ matrix.database }} MOODLE_BRANCH: ${{ matrix.moodle-branch }} IGNORE_PATHS: 'templates/mod_assign,node_modules' - IGNORE_NAMES: '*.txt,behat_*.php,fallback.css,activity_navigation.mustache,message_drawer.mustache,overlaymenu.mustache,overlaymenuitem.mustache,savediscard.mustache,tabs.mustache,tourstep.mustache,admin_settingspage_tabs.php,secondarynav.mustache,overflow.mustache' + IGNORE_NAMES: '*.txt,behat_*.php,fallback.css,activity_navigation.mustache,message_drawer.mustache,overlaymenu.mustache,overlaymenuitem.mustache,savediscard.mustache,tabs.mustache,tourstep.mustache,admin_settingspage_tabs.php,secondarynav.mustache,overflow.mustache,head.mustache,footer.mustache,nofooter.mustache' - name: PHP Lint if: ${{ always() }} diff --git a/Changes.md b/Changes.md index 92b2867..09e956c 100644 --- a/Changes.md +++ b/Changes.md @@ -1,3 +1,26 @@ +Change Log in version 402.1.0 (2023092501) +=========================================== +1. Add the ability to show the marketing blocks when 'Logged out', 'Logged in' or 'Logged in or out', + 'marketingvisible' setting. +2. Tidy up header logic in relation to titles. +3. Navbar and breadcrumb tidy. +4. Add 'buttontexthovercolor' setting to fix button hovers. +5. Fix header search icon. +6. Add 'headerbgimagetextcolour' and 'headertextcolor2' to fix lower header text colours. +7. Fix position of '#savediscardsection'. +8. Refactored layouts as a progressional aim towards use of templating to a greater extent. +9. Put the course title back in the header. +10. New setting 'headertitle' replaces 'sitetitle'. +11. New CSS id 'headertitle' replaces 'sitetitle', now 'sitetitle' is on the actual site title for styling purposes. +12. New setting 'responsiveheadertitle' replaces 'responsivecoursetitle' / 'responsivesitetitle'. +13. New setting 'coursepageheaderhidetitle' replaces 'coursepageheaderhidesitetitle'. +14. Fix 'Wrong context for theme_adaptable/savediscard'. +15. Remove call to 'context_header' so that the course title is not duplicated on the page. +16. Improved header logic. On a course page then if the course title is set to show 'enablecoursetitle' then it is + shown with the 'categoryheadercustomtitleX' if there is one. If not then the site title will show if 'sitetitle' + is set and with 'categoryheadercustomtitleX' if there is one. On a site page, then just the 'sitetitle' logic. +17. Fix 'Module menu delete item hover colour'. + Change Log in version 402.0.1 (2023092500) =========================================== 1. Removed social wall format (https://moodle.org/plugins/format_socialwall/versions) as last known version was for Moodle 3.3. diff --git a/Support.md b/Support.md index 164e66a..53f9473 100644 --- a/Support.md +++ b/Support.md @@ -10,7 +10,7 @@ If you would like to sponsor me, get support or fund improvements, then please d - gMail eMail | gjbarnard at gMail dt com. - My website eMail | contact at gjbarnard dt co dt uk. -- GitHub | Please outline your issue / improvement on '[Adaptable issues](https://github.com/gjbarnard/moodle-theme_adaptable/issues'. +- GitHub | Please outline your issue / improvement on '[Adaptable issues](https://github.com/gjbarnard/moodle-theme_adaptable/issues)'. - @gjbarnard | [X](https://x.com/gjbarnard). Bespoke work diff --git a/classes/output/core_renderer.php b/classes/output/core_renderer.php index 4319055..0735363 100644 --- a/classes/output/core_renderer.php +++ b/classes/output/core_renderer.php @@ -35,5 +35,5 @@ * Core Renderer */ class core_renderer extends core_renderer_base { - use core_renderer_toolbox; + use core_renderer_toolbox, core_renderer_layout; } diff --git a/classes/output/core_renderer_layout.php b/classes/output/core_renderer_layout.php new file mode 100644 index 0000000..b587b2e --- /dev/null +++ b/classes/output/core_renderer_layout.php @@ -0,0 +1,1323 @@ +. + +/** + * A trait for the core renderer. + * + * @package theme_adaptable + * @copyright 2024 G J Barnard + * {@link https://moodle.org/user/profile.php?id=442195} + * {@link https://gjbarnard.co.uk} + * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. + */ + +namespace theme_adaptable\output; + +use moodle_url; +use stdClass; + +/** + * Trait for core and core maintenance renderers. + */ +trait core_renderer_layout { + + public function yesheader($sidepostdrawer) { + global $USER; + $themesettings = \theme_adaptable\toolbox::get_settings(); + + $bodyclasses = []; + $bodyclasses[] = 'theme_adaptable'; + $bodyclasses[] = 'two-column'; + + $pageclasses = []; + + // Screen size. + theme_adaptable_initialise_zoom(); + $bodyclasses[] = theme_adaptable_get_zoom(); + + theme_adaptable_initialise_full(); + $bodyclasses[] = theme_adaptable_get_full(); + + $bsoptionsdata = ['data' => []]; + + // Main navbar. + if (isset($themesettings->stickynavbar) && $themesettings->stickynavbar == 1) { + $bsoptionsdata['data']['stickynavbar'] = true; + } else { + $bsoptionsdata['data']['stickynavbar'] = false; + } + + // JS calls. + $this->page->requires->js_call_amd('theme_adaptable/adaptable', 'init'); + $this->page->requires->js_call_amd('theme_adaptable/bsoptions', 'init', $bsoptionsdata); + + // Layout. + $left = (!right_to_left()); + + // Navbar Menu. + $shownavbar = false; + if ((isloggedin() && !isguestuser()) || + (!empty($themesettings->enablenavbarwhenloggedout))) { + // Show navbar unless disabled by config. + if (empty($this->page->layout_options['nonavbar'])) { + $shownavbar = true; + } + } + // Load header background image if it exists. + $headerbg = ''; + + $localtoolbox = \theme_adaptable\toolbox::get_local_toolbox(); + if (is_object($localtoolbox)) { + ['currenttopcat' => $currenttopcat, 'headerbg' => $headerbg] = $localtoolbox->get_category_header($themesettings, $this->page); + } else { + $currenttopcat = false; + } + + if ((empty($headerbg)) && (!empty($themesettings->headerbgimage))) { + $headerbg = ' class="headerbgimage" style="background-image: ' . + 'url(\'' . $this->page->theme->setting_file_url('headerbgimage', 'headerbgimage') . '\');"'; + } + if (!empty($headerbg)) { + $bodyclasses[] = 'has-header-bg'; + } + + /* Choose the header style. There styles available are: + "style1" (original header) + "style2" (2 row header). + */ + + if (!empty($themesettings->headerstyle)) { + $adaptableheaderstyle = $themesettings->headerstyle; + } else { + $adaptableheaderstyle = "style1"; + } + $bodyclasses[] = 'header-' . $adaptableheaderstyle; + + // Block icons class. + if ($themesettings->blockicons == 1) { + $bodyclasses[] = 'showblockicons'; + } + + if (!empty($themesettings->standardscreenwidth)) { + $bodyclasses[] = $themesettings->standardscreenwidth; + } else { + $bodyclasses[] = 'standard'; + } + + $left = $themesettings->blockside; + + $courseindexheader = false; + $courseindexopen = false; + switch ($this->page->pagelayout) { + case 'base': + case 'standard': + case 'course': + case 'coursecategory': + case 'incourse': + case 'frontpage': + case 'admin': + case 'mycourses': + case 'mydashboard': + case 'mypublic': + case 'report': + [$courseindexopen, $courseindex, $courseindexmarkup, $courseindextogglemarkup] = $this->courseindexheader(); + $courseindexheader = true; + break; + default: + $courseindex = false; + } + + if ($sidepostdrawer) { + [$hassidepost, $sidepostmarkup, $sideposttogglemarkup] = $this->sidepostheader(); + } else { + $hassidepost = false; + } + + if ($courseindexheader) { + if ($courseindexopen) { + $bodyclasses[] = 'drawer-open-index'; + } + } + + if (($courseindex) || ($hassidepost)) { + $bodyclasses[] = 'uses-drawers'; + $pageclasses[] = 'drawers'; + } + + $nomobilenavigation = ''; + if (!empty($themesettings->responsivesectionnav)) { + $nomobilenavigation = 'nomobilenavigation'; + $bodyclasses[] = $nomobilenavigation; + } + + $this->head($bodyclasses); + + if (!empty($courseindexmarkup)) { + echo $courseindexmarkup; + } + if (!empty($sidepostmarkup)) { + echo $sidepostmarkup; + } + if (!$bsoptionsdata['data']['stickynavbar']) { + echo '
'; + } + + $headercontext = [ + 'output' => $this, + ]; + + if (!empty($nomobilenavigation)) { + $primary = new navigation\primary($this->page); + $renderer = $this->page->get_renderer('core'); + $primarymenu = $primary->export_for_template($renderer); + $headercontext['mobileprimarynav'] = $primarymenu['mobileprimarynav']; + $headercontext['mobileprimarynavicon'] = \theme_adaptable\toolbox::getfontawesomemarkup('bars'); + $headercontext['hasmobileprimarynav'] = true; + } + + if ((!isloggedin() || isguestuser()) && ($this->page->pagetype != "login-index")) { + if ($themesettings->displaylogin != 'no') { + $loginformcontext = [ + 'displayloginbox' => ($themesettings->displaylogin == 'box') ? true : false, + 'output' => $this, + 'token' => s(\core\session\manager::get_login_token()), + 'url' => new moodle_url('/login/index.php'), + ]; + if (!$loginformcontext['displayloginbox']) { + $authsequence = get_enabled_auth_plugins(); // Get all auths. + if (in_array('oidc', $authsequence)) { + $authplugin = get_auth_plugin('oidc'); + $oidc = $authplugin->loginpage_idp_list($this->page->url->out(false)); + if (!empty($oidc)) { + $loginformcontext['hasoidc'] = true; + $loginformcontext['oidcdata'] = \auth_plugin_base::prepare_identity_providers_for_output($oidc, $this); + } + } + } + $headercontext['loginoruser'] = ''; + } else { + $headercontext['loginoruser'] = ''; + } + } else { + // Display user profile menu. + // Only used when user is logged in and not on the secure layout. + if ((isloggedin()) && ($this->page->pagelayout != 'secure')) { + // User icon. + $userpic = $this->user_picture($USER, ['link' => false, 'visibletoscreenreaders' => false, + 'size' => 35, 'class' => 'userpicture', ]); + // User name. + $username = format_string(fullname($USER)); + + // User menu dropdown. + if (!empty($themesettings->usernameposition)) { + $usernameposition = $themesettings->usernameposition; + if ($usernameposition == 'right') { + $usernamepositionleft = false; + } else { + $usernamepositionleft = true; + } + } else { + $usernamepositionleft = true; + } + + // Set template context. + $usermenucontext = [ + 'username' => $username, + 'userpic' => $userpic, + 'showusername' => $themesettings->showusername, + 'usernamepositionleft' => $usernamepositionleft, + 'userprofilemenu' => $this->user_profile_menu(), + ]; + $usermenu = $this->render_from_template('theme_adaptable/usermenu', $usermenucontext); + $headercontext['loginoruser'] = ''; + } else { + $headercontext['loginoruser'] = ''; + } + } + + /* Check if this is a course or module page and check setting to hide site title. + If not one of these pages, by default show it (set $hideheadertitle to false). */ + if ((strstr($this->page->pagetype, 'course')) || + (strstr($this->page->pagetype, 'mod')) && ($this->page->course->id != SITEID)) { + $hideheadertitle = !empty(($themesettings->coursepageheaderhidetitle)) ? true : false; + } else { + $hideheadertitle = false; + } + if (!$hideheadertitle) { + $headercontext['headerlogo'] = $this->get_logo($currenttopcat, $shownavbar); + $headercontext['headertitle'] = $this->get_title($currenttopcat); + } + + $headercontext['headerbg'] = $headerbg; + $headercontext['shownavbar'] = $shownavbar; + + // Navbar Menu. + if ($shownavbar) { + $headercontext['shownavbar'] = [ + 'disablecustommenu' => (!empty($themesettings->disablecustommenu)), + 'navigationmenu' => $this->navigation_menu('main-navigation'), + 'navigationmenudrawer' => $this->navigation_menu('main-navigation-drawer'), + 'output' => $this, + 'toolsmenu' => $this->tools_menu(), + ]; + + $navbareditsettings = $themesettings->editsettingsbutton; + $headercontext['shownavbar']['showcog'] = true; + $showeditbuttons = false; + + if ($navbareditsettings == 'button') { + $showeditbuttons = true; + $headercontext['shownavbar']['showcog'] = false; + } else if ($navbareditsettings == 'cogandbutton') { + $showeditbuttons = true; + } + + if ($headercontext['shownavbar']['showcog']) { + $headercontext['shownavbar']['coursemenucontent'] = $this->context_header_settings_menu(); + $headercontext['shownavbar']['othermenucontent'] = $this->region_main_settings_menu(); + } + + /* Ensure to only hide the button on relevant pages. Some pages will need the button, such as the + dashboard page. Checking if the cog is being displayed above to figure out if it still needs to + show (when there is no cog). Also show mod pages (e.g. Forum, Lesson) as these sometimes have + a button for a specific purpose. */ + if (($showeditbuttons) || + (($headercontext['shownavbar']['showcog']) && + ((empty($headercontext['shownavbar']['coursemenucontent'])) && + (empty($headercontext['shownavbar']['othermenucontent'])))) || + (strstr($this->page->pagetype, 'mod-'))) { + $headercontext['shownavbar']['pageheadingbutton'] = $this->page_heading_button(); + } + + if (isloggedin()) { + if ($themesettings->enablezoom) { + $headercontext['shownavbar']['enablezoom'] = true; + $headercontext['shownavbar']['enablezoomshowtext'] = ($themesettings->enablezoomshowtext); + } + } + } + $headercontext['topmenus'] = $this->get_top_menus(false); + + if ($adaptableheaderstyle == "style1") { + $headercontext['menuslinkright'] = (!empty($themesettings->menuslinkright)); + $headercontext['langmenu'] = (empty($this->page->layout_options['langmenu']) || $this->page->layout_options['langmenu']); + $headercontext['responsiveheader'] = $themesettings->responsiveheader; + + if (!empty($themesettings->pageheaderlayout)) { + $headercontext['pageheaderoriginal'] = ($themesettings->pageheaderlayout == 'original'); + } else { + $headercontext['pageheaderoriginal'] = true; + } + + $headersearchandsocial = (!empty($themesettings->headersearchandsocial)) ? $themesettings->headersearchandsocial : 'none'; + + // Search box and social icons. + switch ($headersearchandsocial) { + case 'socialheader': + $headersocialcontext = [ + 'classes' => $themesettings->responsivesocial, + 'pageheaderoriginal' => $headercontext['pageheaderoriginal'], + 'output' => $this, + ]; + $headercontext['searchandsocialheader'] = $this->render_from_template('theme_adaptable/headersocial', $headersocialcontext); + break; + case 'searchmobilenav': + $headercontext['searchandsocialnavbar'] = $this->search_box(); + $headercontext['searchandsocialnavbarextra'] = ' d-md-block d-lg-none my-auto'; + $headersearchcontext = [ + 'pagelayout' => ($headercontext['pageheaderoriginal']) ? 'pagelayoutoriginal' : 'pagelayoutalternative', + 'search' => $this->search_box(), + ]; + $headercontext['searchandsocialheader'] = $this->render_from_template('theme_adaptable/headersearch', $headersearchcontext); + break; + case 'searchheader': + $headersearchcontext = [ + 'pagelayout' => ($headercontext['pageheaderoriginal']) ? 'pagelayoutoriginal' : 'pagelayoutalternative', + 'search' => $this->search_box(), + ]; + $headercontext['searchandsocialheader'] = $this->render_from_template('theme_adaptable/headersearch', $headersearchcontext); + break; + case 'searchnavbar': + $headercontext['searchandsocialnavbar'] = $this->search_box(); + break; + case 'searchnavbarsocialheader': + $headercontext['searchandsocialnavbar'] = $this->search_box(); + $headersocialcontext = [ + 'classes' => $themesettings->responsivesocial, + 'pageheaderoriginal' => $headercontext['pageheaderoriginal'], + 'output' => $this, + ]; + $headercontext['searchandsocialheader'] = $this->render_from_template('theme_adaptable/headersocial', $headersocialcontext); + break; + } + + echo $this->render_from_template('theme_adaptable/headerstyleone', $headercontext); + } else if ($adaptableheaderstyle == "style2") { + $headercontext['responsiveheader'] = $themesettings->responsiveheader; + if (!empty($themesettings->pageheaderlayouttwo)) { + $headercontext['pageheaderoriginal'] = ($themesettings->pageheaderlayouttwo == 'original'); + } else { + $headercontext['pageheaderoriginal'] = true; + } + + if ($headercontext['pageheaderoriginal']) { + $headercontext['navbarsearch'] = $this->search_box(); + } + + if (empty($this->page->layout_options['langmenu']) || $this->page->layout_options['langmenu']) { + $headercontext['langmenu'] = $this->lang_menu(false); + } + + echo $this->render_from_template('theme_adaptable/headerstyletwo', $headercontext); + } + if ($bsoptionsdata['data']['stickynavbar']) { + echo '
'; + } + if (!empty($courseindextogglemarkup)) { + echo $courseindextogglemarkup; + } + if (!empty($sideposttogglemarkup)) { + echo $sideposttogglemarkup; + } + echo $this->get_alert_messages(); + } + + public function noheader() { + $themesettings = \theme_adaptable\toolbox::get_settings(); + + $bodyclasses = []; + $bodyclasses[] = 'theme_adaptable'; + $bodyclasses[] = 'two-column'; + $standardscreenwidthclass = 'standard'; + if (!empty($themesettings->standardscreenwidth)) { + $bodyclasses[] = $themesettings->standardscreenwidth; + } else { + $bodyclasses[] = 'standard'; + } + + theme_adaptable_initialise_full(); + $bodyclasses[] = theme_adaptable_get_full(); + + // Include header. + $this->head($bodyclasses); + + echo '
'; + + // Display alerts. + echo $this->get_alert_messages(); + } + + protected function head($bodyclasses) { + global $SITE; + $themesettings = \theme_adaptable\toolbox::get_settings(); + + $headcontext = new stdClass; + $headcontext->output = $this; + $headcontext->sitefullname = $SITE->fullname; + $headcontext->pagetitle = $this->page_title(); + $siteurl = new moodle_url(''); + $headcontext->siteurl = $siteurl->out(); + $headcontext->maincolor = $themesettings->maincolor; + + if (!empty($themesettings->googlefonts)) { + // Select fonts used. + $fontssubset = ''; + if (!empty($themesettings->fontsubset)) { + // Get the Google fonts subset. + $fontssubset = '&subset='.$themesettings->fontsubset; + } + + if (!empty($themesettings->fontname)) { + switch ($themesettings->fontname) { + case 'default': + case 'sans-serif': + // Use 'sans-serif'. + break; + + default: + // Get the Google main font. + $fontname = str_replace(" ", "+", $themesettings->fontname); + $fontweight = ':'.$themesettings->fontweight.','.$themesettings->fontweight.'i'; + $headcontext->fontname = $fontname.$fontweight.$fontssubset; + break; + } + } + + if (!empty($themesettings->fontheadername)) { + switch ($themesettings->fontheadername) { + case 'default': + case 'sans-serif': + // Use 'sans-serif'. + break; + + default: + // Get the Google header font. + $fontheadername = str_replace(" ", "+", $themesettings->fontheadername); + $fontheaderweight = ':'.$themesettings->fontheaderweight.','.$themesettings->fontheaderweight.'i'; + $headcontext->fontheadername = $fontheadername.$fontheaderweight.$fontssubset; + break; + } + } + + if (!empty($themesettings->fonttitlename)) { + switch ($themesettings->fonttitlename) { + case 'default': + case 'sans-serif': + // Use 'sans-serif'. + break; + + default: + // Get the Google title font. + $fonttitlename = str_replace(" ", "+", $themesettings->fonttitlename); + $fonttitleweight = ':'.$themesettings->fonttitleweight.','.$themesettings->fonttitleweight.'i'; + $headcontext->fonttitlename = $fonttitlename.$fonttitleweight.$fontssubset; + break; + } + } + } + echo $this->render_from_template('theme_adaptable/head', $headcontext); + + echo 'body_attributes($bodyclasses).'>'; + echo $this->standard_top_of_body_html(); + echo '
'; + } + + protected function courseindexheader() { + global $CFG; + require_once($CFG->dirroot . '/course/lib.php'); + $left = \theme_adaptable\toolbox::get_setting('blockside'); + + if (isloggedin()) { + $courseindexopen = (get_user_preferences('drawer-open-index', true) == true); + } else { + $courseindexopen = false; + } + + $courseindex = core_course_drawer(); + + if (!$courseindex) { + $courseindexopen = false; + } + + $templatecontext = [ + 'courseindexopen' => $courseindexopen, + 'courseindex' => $courseindex, + 'left' => $left, + ]; + + $courseindexmarkup = $this->render_from_template('theme_adaptable/courseindex', $templatecontext); + $courseindextogglemarkup = $this->render_from_template('theme_adaptable/courseindextoggle', $templatecontext); + + return [$courseindexopen, $courseindex, $courseindexmarkup, $courseindextogglemarkup]; + } + + protected function sidepostheader() { + $left = \theme_adaptable\toolbox::get_setting('blockside'); + + if (isloggedin()) { + $sidepostopen = (get_user_preferences('drawer-open-block', true) == true); + } else { + $sidepostopen = false; + } + + // Add block button in editing mode. + $addblockbutton = $this->addblockbutton(); + + $sideposthtml = $this->blocks('side-post'); + $hassidepost = (strpos($sideposthtml, 'data-block=') !== false || !empty($addblockbutton)); + if (!$hassidepost) { + $sidepostopen = false; + } + + if (defined('BEHAT_SITE_RUNNING')) { + $sidepostopen = true; + } + + $sidepostcontext = [ + 'addblockbutton' => $addblockbutton, + 'hassidepost' => $hassidepost, + 'left' => $left, + 'sidepostopen' => $sidepostopen, + 'sidepost' => $sideposthtml, + ]; + + $sideposttogglecontext = [ + 'hassidepost' => $hassidepost, + 'left' => $left, + 'sidepostopen' => $sidepostopen, + ]; + + $sidepostmarkup = $this->render_from_template('theme_adaptable/sidepost', $sidepostcontext); + $sideposttogglemarkup = $this->render_from_template('theme_adaptable/sideposttoggle', $sideposttogglecontext); + + return [$hassidepost, $sidepostmarkup, $sideposttogglemarkup]; + } + + public function secondarynav() { + $secondarynavigation = ''; + $overflow = ''; + if ($this->page->has_secondary_navigation()) { + $tablistnav = $this->page->has_tablist_secondary_navigation(); + $moremenu = new \core\navigation\output\more_menu($this->page->secondarynav, 'nav-tabs', true, $tablistnav); + $secondarynavigation = $moremenu->export_for_template($this); + $secondarynavigation = $this->render_from_template('theme_adaptable/secondarynav', $secondarynavigation); + + $overflowdata = $this->page->secondarynav->get_overflow_menu_data(); + if (!is_null($overflowdata)) { + $overflow = $overflowdata->export_for_template($this); + $overflow = $this->render_from_template('theme_adaptable/overflow', $overflow); + } + } + + return [$secondarynavigation, $overflow]; + } + + public function yesfooter() { + global $USER; + + $themesettings = \theme_adaptable\toolbox::get_settings(); + + $context = new stdClass; + $context->output = $this; + $context->responsivepagefooter = $themesettings->responsivepagefooter; + $context->showfooterblocks = $themesettings->showfooterblocks; + + if ($themesettings->hidefootersocial == 1) { + $context->socialicons = $this->socialicons(); + } + + $context->footnote = \theme_adaptable\toolbox::get_setting('footnote', 'format_moodle'); + $context->moodledocs = $themesettings->moodledocs; + + $context->debug = $this->debug_footer_html(); + + // If admin settings page, show template for floating save / discard buttons. + if (strstr($this->page->pagetype, 'admin-setting')) { + if ($themesettings->enablesavecanceloverlay) { + $savediscardcontext = [ + 'topmargin' => ($themesettings->stickynavbar ? '35px' : '0'), + 'savetext' => get_string('savebuttontext', 'theme_adaptable'), + 'discardtext' => get_string('discardbuttontext', 'theme_adaptable'), + ]; + $context->savediscard = $this->render_from_template('theme_adaptable/savediscard', $savediscardcontext); + } + } + + $context->jssection = $themesettings->jssection; + + // Conditional javascript based on a user profile field. + if (!empty($themesettings->jssectionrestrictedprofilefield)) { + // Get custom profile field setting. (e.g. faculty=fbl). + $fields = explode('=', $themesettings->jssectionrestrictedprofilefield); + $ftype = $fields[0]; + $setvalue = $fields[1]; + + // Get user profile field (if it exists). + require_once($CFG->dirroot . '/user/profile/lib.php'); + require_once($CFG->dirroot . '/user/lib.php'); + profile_load_data($USER); + $ftype = "profile_field_$ftype"; + if (isset($USER->$ftype)) { + if ($USER->$ftype == $setvalue) { + // Match between user profile field value and value in setting. + + if (!empty($themesettings->jssectionrestricteddashboardonly)) { + // If this is set to restrict to dashboard only, check if we are on dashboard page. + if ($this->page->pagelayout == 'mydashboard') { + $context->jssectionrestricted = $themesettings->jssectionrestricted; + } + } else { + $context->jssectionrestricted = $themesettings->jssectionrestricted; + } + } + } + } + + echo $this->render_from_template('theme_adaptable/footer', $context); + } + + public function nofooter() { + $themesettings = \theme_adaptable\toolbox::get_settings(); + + $context = new stdClass; + $context->output = $this; + $context->jssection = $themesettings->jssection; + + echo $this->render_from_template('theme_adaptable/nofooter', $context); + } + + /* + * TODO - Template the layouts... somehow! + */ + + public function columns_one_layout() { + // Include header. + $this->yesheader(false); + // Include secondary navigation. + [$secondarynavigation, $overflow] = $this->secondarynav(); + + echo '
'; + echo $this->get_news_ticker(); + echo $this->page_navbar(); + echo '
'; + echo '
'; + echo '
'; + echo $this->course_content_header(); + if (!empty($secondarynavigation)) { + echo $secondarynavigation; + } + echo $this->activity_header(); + if (!empty($overflow)) { + echo $overflow; + } + echo $this->main_content(); + echo $this->activity_navigation(); + echo $this->course_content_footer(); + echo '
'; + echo '
'; + echo '
'; + echo '
'; + + if (empty($this->page->layout_options['nofooter'])) { + // Footer. + $this->yesfooter(); + } else { + $this->nofooter(); + } + } + + public function columns_two_layout() { + $themesettings = \theme_adaptable\toolbox::get_settings(); + + // Include header. + $this->yesheader(true); + + // Include secondary navigation. + [$secondarynavigation, $overflow] = $this->secondarynav(); + + echo '
'; + echo $this->get_news_ticker(); + echo $this->page_navbar(); + echo '
'; + echo '
'; + echo '
'; + echo $this->get_course_alerts(); + echo $this->course_content_header(); + if (!empty($secondarynavigation)) { + echo $secondarynavigation; + } + echo $this->activity_header(); + if (!empty($overflow)) { + echo $overflow; + } + echo $this->main_content(); + + // Display course page block activity bottom region if this is a mod page of type where you're viewing + // a section, page or book (chapter). + if (!empty($themesettings->coursepageblockactivitybottomenabled)) { + if (($this->page->pagetype == 'mod-book-view') || ($this->page->pagetype == 'mod-page-view')) { + echo $this->get_block_regions('customrowsetting', 'course-section-', '12-0-0-0'); + } + } + + echo $this->activity_navigation(); + echo $this->course_content_footer(); + + echo '
'; + echo '
'; + echo '
'; + echo '
'; + + // Footer. + $this->yesfooter(); + } + + public function course_layout() { + global $COURSE; + $themesettings = \theme_adaptable\toolbox::get_settings(); + + $sidepostdrawer = true; + $movesidebartofooter = !empty(($themesettings->coursepagesidebarinfooterenabled)) ? 2 : 1; + if ((!empty($movesidebartofooter)) && ($movesidebartofooter == 2)) { + $sidepostdrawer = false; + } + + // Include header. + $this->yesheader($sidepostdrawer); + + // Include secondary navigation. + [$secondarynavigation, $overflow] = $this->secondarynav(); + + // Definition of block regions for top and bottom. These are used in potentially retrieving + // any missing block regions. + $blocksarray = [ + ['settingsname' => 'coursepageblocklayoutlayouttoprow', + 'classnamebeginswith' => 'course-top-', ], + ['settingsname' => 'coursepageblocklayoutlayoutbottomrow', + 'classnamebeginswith' => 'course-bottom-', ], + ]; + + echo '
'; + echo $this->get_news_ticker(); + echo $this->page_navbar(); + echo '
'; + + // If course page, display course top block region. + if (!empty($themesettings->coursepageblocksenabled)) { + echo '
'; + echo '
'; + echo $this->get_block_regions('coursepageblocklayoutlayouttoprow', 'course-top-'); + echo '
'; + echo '
'; + } + + echo '
'; + echo '
'; + + if (!empty($themesettings->tabbedlayoutcoursepage)) { + // Use Adaptable tabbed layout. + $currentpage = theme_adaptable_get_current_page(); + + $taborder = explode('-', $themesettings->tabbedlayoutcoursepage); + + echo '
'; + + $sectionid = optional_param('sectionid', 0, PARAM_INT); + $section = optional_param('section', 0, PARAM_INT); + if ((!empty($themesettings->tabbedlayoutcoursepagelink)) && + (($sectionid) || ($section))) { + $courseurl = new moodle_url('/course/view.php', ['id' => $COURSE->id]); + echo '
'; + } + + $tabcount = 0; + foreach ($taborder as $tabnumber) { + if ($tabnumber == 0) { + $tabname = 'tab-content'; + $tablabel = get_string('tabbedlayouttablabelcourse', 'theme_adaptable'); + } else { + $tabname = 'tab' . $tabnumber; + $tablabel = get_string('tabbedlayouttablabelcourse' . $tabnumber, 'theme_adaptable'); + } + + $checkedstatus = ''; + if (($tabcount == 0 && $currentpage == 'coursepage') || + ($currentpage != 'coursepage' && $tabnumber == 0)) { + $checkedstatus = 'checked'; + } + + $extrastyles = ''; + + if ($currentpage == 'coursepage') { + $extrastyles = ' style="display: none"'; + } + + echo '' . + ''; + + $tabcount++; + } + + /* Basic array used by appropriately named blocks below (e.g. course-tab-one). All this is to re-use existing + functionality and the non-use of numbers in block region names. */ + $wordtonumber = [1 => 'one', 2 => 'two']; + + foreach ($taborder as $tabnumber) { + if ($tabnumber == 0) { + echo '
'; + + echo $this->get_course_alerts(); + if (!empty($themesettings->coursepageblocksliderenabled)) { + echo $this->get_block_regions('customrowsetting', 'news-slider-', '12-0-0-0'); + } + + echo $this->course_content_header(); + if (!empty($secondarynavigation)) { + echo $secondarynavigation; + } + if (!empty($overflow)) { + echo $overflow; + } + echo $this->main_content(); + echo $this->course_content_footer(); + + echo '
'; + } else { + echo '
'; + + echo $this->get_block_regions( + 'customrowsetting', + 'course-tab-' . $wordtonumber[$tabnumber] . '-', + '12-0-0-0' + ); + echo '
'; + } + } + echo '
'; + } else { + echo $this->get_course_alerts(); + if (!empty($themesettings->coursepageblocksliderenabled)) { + echo $this->get_block_regions('customrowsetting', 'news-slider-', '12-0-0-0'); + } + echo $this->course_content_header(); + if (!empty($secondarynavigation)) { + echo $secondarynavigation; + } + if (!empty($overflow)) { + echo $overflow; + } + echo $this->main_content(); + echo $this->course_content_footer(); + } + + /* Check if the block regions are disabled in settings. If it is and there were any blocks + assigned to those regions, they would obviously not display. This will allow to override + the call to get_missing_block_regions to just display them all. */ + $displayall = false; + if (empty($themesettings->coursepageblocksenabled)) { + $displayall = true; + } + + /* Check here if sidebar is configured to be in footer as we want to include + the sidebar information in the main content. */ + if ($movesidebartofooter == 1) { + echo '
'; + echo '
'; + + /* Get any missing blocks from changing layout settings. E.g. From 4-4-4-4 to 6-6-0-0, to recover + what was in the last 2 spans that are now 0. */ + echo $this->get_missing_block_regions($blocksarray, 'col-12', $displayall); + } + + // If course page, display course bottom block region. + if (!empty($themesettings->coursepageblocksenabled)) { + echo '
'; + echo '
'; + echo $this->get_block_regions('coursepageblocklayoutlayoutbottomrow', 'course-bottom-'); + echo '
'; + echo '
'; + } + + if ($movesidebartofooter == 2) { + $hassidepost = $this->page->blocks->region_has_content('side-post', $this); + + if ($hassidepost) { + echo $this->blocks('side-post', 'col-12 d-print-none'); + } + + /* Get any missing blocks from changing layout settings. E.g. From 4-4-4-4 to 6-6-0-0, to recover + what was in the last 2 spans that are now 0. */ + echo $this->get_missing_block_regions($blocksarray, [], $displayall); + + echo ''; + echo '
'; + } + + echo '
'; + echo '
'; + + // Include footer. + $this->yesfooter(); + + if (!empty($themesettings->tabbedlayoutcoursepage)) { + if (!empty($themesettings->tabbedlayoutcoursepagetabpersistencetime)) { + $tabbedlayoutcoursepagetabpersistencetime = $themesettings->tabbedlayoutcoursepagetabpersistencetime; + } else { + $tabbedlayoutcoursepagetabpersistencetime = 30; + } + $this->page->requires->js_call_amd('theme_adaptable/utils', 'init', ['currentpage' => $currentpage, + 'tabpersistencetime' => $tabbedlayoutcoursepagetabpersistencetime, ]); + } + } + + public function dashboard_layout() { + global $CFG, $USER; + $themesettings = \theme_adaptable\toolbox::get_settings(); + + // Include header. + $this->yesheader(true); + + // Include secondary navigation. + [$secondarynavigation, $overflow] = $this->secondarynav(); + + // Set layout. + $dashblocksposition = (!empty($themesettings->dashblocksposition)) ? $themesettings->dashblocksposition : 'abovecontent'; + + $dashblocklayoutlayoutrow = ''; + if (!empty($themesettings->dashblocksenabled)) { + $dashblocklayoutlayoutrow = '
'; + $dashblocklayoutlayoutrow .= $this->get_block_regions('dashblocklayoutlayoutrow'); + $dashblocklayoutlayoutrow .= '
'; + } + + echo '
'; + + echo $this->get_news_ticker(); + + if ((!empty($themesettings->dashblocksenabled)) && + (empty($themesettings->tabbedlayoutdashboard)) && ($dashblocksposition == 'abovecontent')) { + echo $dashblocklayoutlayoutrow; + } + + echo '
'; + if (!empty($themesettings->tabbedlayoutdashboard)) { + $showtabs = [0 => true, 1 => true, 2 => true]; + // Get any custom user profile field restriction for tab 1 and 2. (e.g. showtab1=false). + require_once($CFG->dirroot . '/user/profile/lib.php'); + require_once($CFG->dirroot . '/user/lib.php'); + profile_load_data($USER); + + if (!empty($themesettings->tabbedlayoutdashboardtab1condition)) { + $fields = explode('=', $themesettings->tabbedlayoutdashboardtab1condition); + $ftype = $fields[0]; + $setvalue = $fields[1]; + + // Get user profile field (if it exists). + $ftype = "profile_field_$ftype"; + if (isset($USER->$ftype)) { + if ($USER->$ftype != $setvalue) { + // Condition is true, so don't show this tab. + $showtabs[1] = false; + } + } + } + + if (!empty($themesettings->tabbedlayoutdashboardtab2condition)) { + $fields = explode('=', $themesettings->tabbedlayoutdashboardtab2condition); + $ftype = $fields[0]; + $setvalue = $fields[1]; + + // Get user profile field (if it exists). + $ftype = "profile_field_$ftype"; + if (isset($USER->$ftype)) { + if ($USER->$ftype != $setvalue) { + // Condition is true, so don't show this tab. + $showtabs[2] = false; + } + } + } + + $taborder = explode('-', $themesettings->tabbedlayoutdashboard); + echo '
'; + echo '
'; + + echo '
'; + + $tabcount = 0; + foreach ($taborder as $tabnumber) { + if ((!empty($showtabs[$tabnumber])) && ($showtabs[$tabnumber] == true)) { + // Tab 0 is the original content tab. + if ($tabnumber == 0) { + $tabname = 'dashboard-tab-content'; + $tablabel = get_string('tabbedlayouttablabeldashboard', 'theme_adaptable'); + } else { + $tabname = 'dashboard-tab' . $tabnumber; + $tablabel = get_string('tabbedlayouttablabeldashboard' . $tabnumber, 'theme_adaptable'); + } + + echo '' . + ''; + $tabcount++; + } + } + + // Basic array used by appropriately named blocks below (e.g. course-tab-one). All this is due to the re-use of + // existing functionality and non-use of numbers in block region names. + $wordtonumber = [1 => 'one', 2 => 'two']; + foreach ($taborder as $tabnumber) { + if ($tabnumber == 0) { + echo '
'; + + if ((!empty($themesettings->dashblocksenabled)) && ($dashblocksposition == 'abovecontent')) { + echo $dashblocklayoutlayoutrow; + } + echo $this->course_content_header(); + if (!empty($secondarynavigation)) { + echo $secondarynavigation; + } + if (!empty($overflow)) { + echo $overflow; + } + echo $this->main_content(); + echo $this->course_content_footer(); + if ((!empty($themesettings->dashblocksenabled)) && ($dashblocksposition == 'belowcontent')) { + echo $dashblocklayoutlayoutrow; + } + + echo '
'; + } else { + if ($showtabs[$tabnumber] == true) { + echo '
'; + echo $this->get_block_regions('customrowsetting', 'my-tab-' . $wordtonumber[$tabnumber] . + '-', '12-0-0-0'); + echo '
'; + } + } + } + + echo '
'; + echo '
'; + echo '
'; + } else { + echo '
'; + echo '
'; + echo $this->course_content_header(); + if (!empty($secondarynavigation)) { + echo $secondarynavigation; + } + if (!empty($overflow)) { + echo $overflow; + } + echo $this->main_content(); + echo $this->course_content_footer(); + echo '
'; + echo '
'; + } + echo '
'; + + if ((!empty($themesettings->dashblocksenabled)) && (empty($themesettings->tabbedlayoutdashboard)) + && ($dashblocksposition == 'belowcontent')) { + echo $dashblocklayoutlayoutrow; + } + + if (is_siteadmin()) { + echo '
'; + echo '
'; + echo '

' . get_string('frnt-footer', 'theme_adaptable') . '

'; + echo $this->blocks('frnt-footer', 'col-10'); + echo '
'; + echo '
'; + } + echo '
'; + + // Footer. + $this->yesfooter(); + } + + public function embedded_layout() { + echo $this->doctype(); + echo 'htmlattributes() . '>'; + echo ''; + echo ''. $this->page_title() .''; + echo ''; + echo $this->standard_head_html(); + echo ''; + echo ''; + echo 'body_attributes() . '>'; + + echo $this->standard_top_of_body_html(); + $fakeblocks = $this->blocks('side-pre', [], 'aside', true); + $hasfakeblocks = strpos($fakeblocks, 'data-block="_fake"') !== false; + + echo '
'; + if ($hasfakeblocks) { + echo '
'; + echo '
'; + echo $fakeblocks; + echo '
'; + } else { + echo '
'; + } + + echo '
'; + echo $this->main_content(); + echo '
'; + echo '
'; + echo '
'; + + $this->nofooter(); + } + + public function frontpage_layout() { + global $USER; + $themesettings = \theme_adaptable\toolbox::get_settings(); + + // Header. + $sidepostdrawer = false; + if (($themesettings->frontpageuserblocksenabled) || (is_siteadmin($USER))) { + $sidepostdrawer = true; + } + $this->yesheader($sidepostdrawer); + + // Include secondary navigation. + [$secondarynavigation, $overflow] = $this->secondarynav(); + + if (!empty($secondarynavigation)) { + echo $secondarynavigation; + } + if (!empty($overflow)) { + echo $overflow; + } + + echo $this->get_news_ticker(); + + // Slider. + echo $this->get_frontpage_slider(); + + // And let's show Infobox 1 if enabled. + if (!empty($themesettings->infobox)) { + if (!empty($themesettings->infoboxfullscreen)) { + echo '
'; + } else { + echo '
'; + } + echo '
'; + echo \theme_adaptable\toolbox::get_setting('infobox', 'format_moodle'); + echo '
'; + echo '
'; + } + + // If Marketing Blocks are enabled then let's show them. + if (!empty($themesettings->frontpagemarketenabled)) { + echo $this->get_marketing_blocks(); + } + + if (!empty($themesettings->frontpageblocksenabled)) { + echo '
'; + echo '
'; + echo $this->get_block_regions(); + echo '
'; + echo '
'; + } + + // And finally let's show the Infobox 2 if enabled. + if (!empty($themesettings->infobox2)) { + if (!empty($themesettings->infoboxfullscreen)) { + echo '
'; + } else { + echo '
'; + } + echo '
'; + echo \theme_adaptable\toolbox::get_setting('infobox2', 'format_moodle'); + echo '
'; + echo '
'; + } + + // The main content goes here. + echo '
'; + echo '
'; + echo ''; + + echo '
'; + echo '
'; + echo $this->course_content_header(); + echo $this->main_content(); + echo $this->course_content_footer(); + echo '
'; + echo '
'; + echo '
'; + + // Let's show the hidden blocks region ONLY for administrators. + if (is_siteadmin()) { + echo '
'; + echo '
'; + + if (!empty($themesettings->coursepageblocksliderenabled)) { + echo $this->get_block_regions('customrowsetting', 'news-slider-', '12-0-0-0'); + } + + if (!empty($themesettings->coursepageblockactivitybottomenabled)) { + echo $this->get_block_regions('customrowsetting', 'course-section-', '12-0-0-0'); + } + + if (!empty($themesettings->tabbedlayoutcoursepage)) { + echo $this->get_block_regions('customrowsetting', 'course-tab-one-', '12-0-0-0'); + echo $this->get_block_regions('customrowsetting', 'course-tab-two-', '12-0-0-0'); + } + + if (!empty($themesettings->tabbedlayoutdashboard)) { + echo $this->get_block_regions('customrowsetting', 'my-tab-one-', '12-0-0-0'); + echo $this->get_block_regions('customrowsetting', 'my-tab-two-', '12-0-0-0'); + } + + echo '

' . get_string('frnt-footer', 'theme_adaptable') . '

'; + echo $this->blocks('frnt-footer', 'col-10'); + echo '
'; + echo '
'; + } + echo '
'; + + // Footer. + $this->yesfooter(); + } + + public function login_layout() { + $logincontent = ''; + + $result = $this->generate_login($logincontent); + + if (!empty($result->header)) { + $this->yesheader(false); + } else { + $this->noheader(); + } + $this->page->set_secondary_navigation(false); + + echo '
'; + echo $this->page_navbar(); + echo '
'; + echo '
'; + echo '
'; + echo $logincontent; + echo '
'; + echo '
'; + echo '
'; + echo '
'; + + // Footer. + if (!empty($result->header)) { + $this->yesfooter(); + } else { + $this->nofooter(); + } + } + + public function secure_layout() { + // Header. + $this->yesheader(true); + + // Include secondary navigation. + [$secondarynavigation, $overflow] = $this->secondarynav(); + + echo '
'; + echo $this->page_navbar(); + echo '
'; + echo '
'; + echo '
'; + echo $this->get_course_alerts(); + echo $OUTPUT->course_content_header(); + if (!empty($secondarynavigation)) { + echo $secondarynavigation; + } + if (!empty($overflow)) { + echo $overflow; + } + echo $this->main_content(); + echo '
'; + echo '
'; + echo '
'; + echo '
'; + $this->nofooter(); + } +} diff --git a/classes/output/core_renderer_maintenance.php b/classes/output/core_renderer_maintenance.php index 7b407f9..7e8b75e 100644 --- a/classes/output/core_renderer_maintenance.php +++ b/classes/output/core_renderer_maintenance.php @@ -33,5 +33,5 @@ * The core maintenance renderer. */ class core_renderer_maintenance extends \core_renderer_maintenance { - use core_renderer_toolbox; + use core_renderer_toolbox, core_renderer_layout; } diff --git a/classes/output/core_renderer_toolbox.php b/classes/output/core_renderer_toolbox.php index f3f65be..34c0a79 100644 --- a/classes/output/core_renderer_toolbox.php +++ b/classes/output/core_renderer_toolbox.php @@ -785,6 +785,17 @@ public function get_missing_block_regions($blocksarray, $classes = [], $displaya * @return string Markup. */ public function get_marketing_blocks($layoutrow = 'marketlayoutrow', $settingname = 'market') { + $visiblestate = 3; + if (!empty($this->page->theme->settings->marketingvisible)) { + $visiblestate = $this->page->theme->settings->marketingvisible; + } + if ($visiblestate != 3) { + $loggedin = isloggedin(); + if ((($visiblestate == 1) && ($loggedin)) || (($visiblestate == 2) && (!$loggedin))) { + return ''; + } + } + $fields = []; $blockcount = 0; @@ -950,9 +961,7 @@ public function get_frontpage_slider() { $retval .= " slidestyle2"; } - $retval .= ' ' . $responsiveslider . '"> -
-
    '; + $retval .= ' ' . $responsiveslider . '">
      '; for ($i = 1; $i <= $noslides; $i++) { $sliderimage = 'p' . $i; @@ -1113,9 +1122,8 @@ public function navbar(): string { $classes = $this->page->theme->settings->responsivebreadcrumb; - return ''; + return ''; } /** @@ -1510,7 +1518,7 @@ public function tools_menu($menuid = '') { } /** - * Returns The HTML to render logo / title area. + * Returns The HTML to render logo in the header. * @param bool/int $currenttopcat The id of the current top category or false if none. * @param bool $shownavbar If the navbar is shown. * @@ -1524,7 +1532,7 @@ public function get_logo($currenttopcat, $shownavbar) { $localtoolbox = \theme_adaptable\toolbox::get_local_toolbox(); if (is_object($localtoolbox)) { - $localtoolbox->get_logo($currenttopcat, $logosetarea, $this->page->theme->settings); + $logosetarea = $localtoolbox->get_logo($currenttopcat, $logosetarea, $this->page->theme->settings); } if ((empty($logosetarea)) && (!empty($this->page->theme->settings->logo))) { @@ -1554,102 +1562,136 @@ public function get_logo($currenttopcat, $shownavbar) { } /** - * Returns html to render logo / title area. + * Returns html to render title in the header. * @param bool/int $currenttopcat The id of the current top category or false if none. * * @return string Markup. */ public function get_title($currenttopcat) { - global $COURSE, $SITE; - $retval = ''; + $themesettings = \theme_adaptable\toolbox::get_settings(); - $responsivecoursetitle = $this->page->theme->settings->responsivecoursetitle; - $coursetitlemaxwidth = - (!empty($this->page->theme->settings->coursetitlemaxwidth) ? $this->page->theme->settings->coursetitlemaxwidth : 0); - - // If it is a mobile and the site title/course is not hidden or it is a desktop then we display the site title / course. - $usedefault = false; + $titlemarkup = ''; $categoryheadercustomtitle = ''; - $localtoolbox = \theme_adaptable\toolbox::get_local_toolbox(); - if (is_object($localtoolbox)) { - $localtoolbox->get_title($currenttopcat, $categoryheadercustomtitle, $this->page->theme->settings); - } // If course id is not the site id then we display course title. - if ($COURSE->id != SITEID) { - // Select title. - $coursetitle = ''; + if ($this->page->course->id != SITEID) { + $localtoolbox = \theme_adaptable\toolbox::get_local_toolbox(); + if (is_object($localtoolbox)) { + $categoryheadercustomtitle = $localtoolbox->get_title($currenttopcat, $categoryheadercustomtitle, $themesettings); + } - switch ($this->page->theme->settings->enableheading) { - case 'fullname': - // Full Course Name. - $coursetitle = $COURSE->fullname; - break; + $coursetitle = $this->get_course_title(); + if (!empty($coursetitle)) { + $titlemarkup .= '
      '; + $titlemarkup .= '

      '; + if (!empty($categoryheadercustomtitle)) { + $titlemarkup .= '' . format_string($categoryheadercustomtitle) . '
      '; + } + $titlemarkup .= '' . $coursetitle . ''; + $titlemarkup .= '

      '; + $titlemarkup .= '
      '; + } + } - case 'shortname': - // Short Course Name. - $coursetitle = $COURSE->shortname; - break; + // If the course id is the site id or we're on a course and there is no title then we display the site title. + if (($this->page->course->id == SITEID) || (empty($titlemarkup))) { + $sitetitle = $this->get_site_title(); + if (empty($sitetitle)) { + if (!empty($categoryheadercustomtitle)) { + $titlemarkup .= '
      '; + $titlemarkup .= '

      ' . format_string($categoryheadercustomtitle) . '

      '; + $titlemarkup .= '
      '; + } + } else { + $titlemarkup .= '
      '; + $titlemarkup .= '

      '; + $titlemarkup .= '' . $sitetitle . ''; + if (!empty($categoryheadercustomtitle)) { + $titlemarkup .= '
      ' . format_string($categoryheadercustomtitle) . ''; + } + $titlemarkup .= '

      '; + $titlemarkup .= '
      '; } + } + + return $titlemarkup; + } + + protected function get_site_title() { + global $SITE; + + $sitetitle = ''; + $themesettings = \theme_adaptable\toolbox::get_settings(); + + switch ($themesettings->sitetitle) { + case 'default': + $sitetitle = format_string($SITE->fullname); + break; + case 'custom': + // Custom site title. + if (!empty($themesettings->sitetitletext)) { + $header = $themesettings->sitetitletext; + if (strpos($this->page->pagetype, 'course-view-') !== 0) { + $header = preg_replace("/^" . $SITE->fullname . "/", "", $header); + } + $header = format_string($header); + $this->page->set_heading($header); + $sitetitle = format_text($themesettings->sitetitletext, FORMAT_HTML); + } + break; + } + + return $sitetitle; + } + + protected function get_course_title() { + global $COURSE; + + $coursetitle = ''; + $themesettings = \theme_adaptable\toolbox::get_settings(); + + switch ($themesettings->enablecoursetitle) { + case 'fullname': + // Full Course Name. + $coursetitle = $COURSE->fullname; + break; + + case 'shortname': + // Short Course Name. + $coursetitle = $COURSE->shortname; + break; + } + + if (!empty($coursetitle)) { // Pre-process to avoid any filter issue. $coursetitle = format_string($coursetitle); + $coursetitlemaxwidth = + (!empty($themesettings->coursetitlemaxwidth) ? $themesettings->coursetitlemaxwidth : 0); // Check max width of course title and trim if appropriate. if (($coursetitlemaxwidth > 0) && ($coursetitle <> '')) { if (strlen($coursetitle) > $coursetitlemaxwidth) { $coursetitle = \core_text::substr($coursetitle, 0, $coursetitlemaxwidth) . " ..."; } } - - switch ($this->page->theme->settings->enableheading) { - // Full / Short Course Name. - case 'fullname': - case 'shortname': - $retval .= '
      '; - if (!empty($categoryheadercustomtitle)) { - $retval .= '

      ' . format_string($categoryheadercustomtitle) . '

      '; - } - $retval .= '

      ' . $coursetitle . '

      '; - $retval .= '
      '; - break; - default: - // Default is 'off'. - $usedefault = true; - break; - } } - // If the course id is one or 'enableheading' was 'off' above then we display the site title. - if (($COURSE->id == 1) || ($usedefault)) { - if (!empty($categoryheadercustomtitle)) { - $retval .= '
      '; - $retval .= '

      ' . format_string($categoryheadercustomtitle) . '

      '; - $retval .= '
      '; - } else { - switch ($this->page->theme->settings->sitetitle) { - case 'default': - $sitetitle = $SITE->fullname; - $retval .= '

      ' - . format_string($sitetitle) . '

      '; - break; - - case 'custom': - // Custom site title. - if (!empty($this->page->theme->settings->sitetitletext)) { - $header = theme_adaptable_remove_site_fullname($this->page->theme->settings->sitetitletext); - $sitetitlehtml = $this->page->theme->settings->sitetitletext; - $header = format_string($header); - $this->page->set_heading($header); - - $retval .= '
      ' - . format_text($sitetitlehtml, FORMAT_HTML) . '
      '; - } - } - } - } + return $coursetitle; + } - return $retval; + /** + * Currently not called, but will leave for reference! + * + * @param array $headerinfo Array of things, see parent. + * @param int $headinglevel Heading level, see parent. + * + * @return string Markup. + */ + public function context_header($headerinfo = null, $headinglevel = 1) : string { + $headerinfo = []; + $headerinfo['heading'] = $this->get_course_title(); + return parent::context_header($headerinfo, $headinglevel); } /** diff --git a/classes/icon_system_fontawesome.php b/classes/output/icon_system_fontawesome.php similarity index 100% rename from classes/icon_system_fontawesome.php rename to classes/output/icon_system_fontawesome.php diff --git a/lang/en/theme_adaptable.php b/lang/en/theme_adaptable.php index 266d393..9125d0c 100644 --- a/lang/en/theme_adaptable.php +++ b/lang/en/theme_adaptable.php @@ -340,6 +340,12 @@ $string['marketingsettingsheading'] = 'Customize the marketing blocks that appear on the front page.'; $string['marketingdesc'] = 'There are two full width info boxes with differing styles you can use.
      In addition to this there is a layout builder allowing you to decide how many blocks you need and define your own layout.
      Please see the \'Readme\' section on the \'Information\' settings tab for additional information.'; +$string['marketingvisible'] = 'Show the marketing blocks when'; +$string['marketingvisibledesc'] = 'Show the marketing blocks when \'Logged out\', \'Logged in\' or \'Logged in or out\'.'; +$string['marketingvisibleloggedout'] = 'Logged out'; +$string['marketingvisibleloggedin'] = 'Logged in'; +$string['marketingvisibleloggedinout'] = 'Logged in or out'; + $string['marketingbuilderheading'] = 'Marketing block layout builder'; $string['marketingbuilderdesc'] = 'Use the tool below to setup your marketing blocks. Once defined the block settings will appear further down the page.'; @@ -613,6 +619,9 @@ $string['headertextcolor'] = 'Header text and link colour'; $string['headertextcolordesc'] = 'Set the header text and link colour.'; +$string['headertextcolor2'] = 'Bottom header text colour'; +$string['headertextcolor2desc'] = 'Set the bottom header text colour.'; + $string['blockheadercolor'] = 'Block header font colour'; $string['blockheadercolordesc'] = 'Set the block header font colour.'; @@ -936,8 +945,11 @@ $string['buttoncolor'] = 'Button colour'; $string['buttoncolordesc'] = 'The colour of the main buttons used throughout the site.'; -$string['buttonhovercolor'] = 'Button hover colour'; -$string['buttonhovercolordesc'] = 'The colour that the button changes to when hovering over the button.'; +$string['buttonhovercolor'] = 'Button background hover colour'; +$string['buttonhovercolordesc'] = 'The colour that the button background changes to when hovering over the button.'; + +$string['buttontexthovercolor'] = 'Button text hover colour'; +$string['buttontexthovercolordesc'] = 'The colour that the button text changes to when hovering over the button.'; $string['buttonfocuscolor'] = 'Button focus colour'; $string['buttonfocuscolordesc'] = 'The colour that the button uses when focusing on the button.'; @@ -1011,11 +1023,14 @@ $string['headerbgimage'] = 'Background image'; $string['headerbgimagedesc'] = 'Set a background image in the header. Minimum size is 1600x180px (1900x180px recommended). The image cover the full header. You can add a colour in \'Top header background colour\' or use transparent to show the background image. In that case, modify the text colour to get displayed correctly over the image.'; +$string['headerbgimagetextcolour'] = 'Background image text colour'; +$string['headerbgimagetextcolourdesc'] = 'If you have a background image, then use this setting to set the colour of the text that is placed upon it.'; + $string['enableheading'] = 'Header course title'; -$string['enableheadingdesc'] = 'Set the mode to display the course title in the header when the default Moodle site title is enabled.'; +$string['enableheadingdesc'] = 'DEPRECATED, use \'enablecoursetitle\' instead.'; -$string['breadcrumbdisplay'] = 'Breadcrumb display'; -$string['breadcrumbdisplaydesc'] = 'Set the display of what should be in the breadcrumb area in a course.'; +$string['enablecoursetitle'] = 'Course title'; +$string['enablecoursetitledesc'] = 'Set the mode to display the course title.'; $string['sitetitlecoursesdisabled'] = 'Disabled - only show course titles in course pages'; $string['sitetitlecoursesenabled'] = 'Enabled - show site title and course titles in course pages'; @@ -1023,18 +1038,24 @@ $string['coursetitlemaxwidth'] = 'Course title maximum length'; $string['coursetitlemaxwidthdesc'] = 'Set the maximum number of characters of the course title area.'; +$string['coursetitlefullname'] = 'Course full name'; +$string['coursetitleshortname'] = 'Course short name / code'; + $string['pageheaderheight'] = 'Page header height'; $string['pageheaderheightdesc'] = 'Set the height of the main header area (containing logo and titles).'; +$string['coursepageheaderhidetitle'] = 'Hide header title on course pages'; +$string['coursepageheaderhidetitledesc'] = 'Hide header title, logo and search bar on course pages. Use this along with page header height setting to show a smaller header on course related pages.'; + $string['coursepageheaderhidesitetitle'] = 'Hide site title on course pages'; -$string['coursepageheaderhidesitetitledesc'] = 'Hide site title, logo and search bar on course pages. Use this along with page header height setting to show a smaller header on course-related pages.'; +$string['coursepageheaderhidesitetitledesc'] = 'DEPRECATED, use \'coursepageheaderhidetitle\' instead.'; $string['breadcrumb'] = 'Breadcrumb'; $string['breadcrumbtitle'] = 'Breadcrumb course name'; $string['breadcrumbtitledesc'] = 'Set the mode to display the course title in the breadcrumb.'; -$string['coursetitlefullname'] = 'Course full name'; -$string['coursetitleshortname'] = 'Course short name / code'; +$string['breadcrumbdisplay'] = 'Breadcrumb display'; +$string['breadcrumbdisplaydesc'] = 'Set the display of what should be in the breadcrumb area.'; $string['headerstyleheading'] = 'Header style settings'; $string['headerstyleheadingdesc'] = 'Adaptable supports two header styles, the original three row header and a newer simplified two row header.
      Be aware that if you switch to the newer two row header you will NOT be able to:
      1. Show social icons in the header.
      2. Display the site logo on mobile devices.
      '; @@ -1302,7 +1323,13 @@ $string['responsivesocialdesc'] = 'What sized screens would you like social icons to be displayed on?'; $string['responsivecoursetitle'] = 'Course / site title'; -$string['responsivecoursetitledesc'] = 'What sized screens would you like the site / course titles to be displayed on?'; +$string['responsivecoursetitledesc'] = 'DEPRECATED, use \'responsivesitetitle\' instead.'; + +$string['responsiveheadertitle'] = 'Header title'; +$string['responsiveheadertitledesc'] = 'What sized screens would you like the header title to be displayed on?'; + +$string['responsivesitetitle'] = 'Site title'; +$string['responsivesitetitledesc'] = 'DEPRECATED, use \'responsiveheadertitle\' instead.'; $string['responsivesectionnav'] = 'Activity / section navigation'; $string['responsivesectionnavdesc'] = 'Show / hide the the text for "prev" "next" activity / section navigation on small screens. By default we hide this text on smaller screens so only the icons for links display and not the full section / activity name.'; @@ -1840,6 +1867,9 @@ $string['categoryheaderbgimage'] = 'Category \'{$a->name}\' with id \'{$a->id}\' background image'; $string['categoryheaderbgimagedesc'] = 'Set a background image for the top level category \'{$a->name}\' with id \'{$a->id}\' in the header. Minimum size is 1600x180px (1900x180px recommended). The image will cover the full header.'; $string['categoryheaderbgimagedescchildren'] = 'Set a background image for the top level category \'{$a->name}\' with id \'{$a->id}\' and its children \'{$a->children}\' in the header. Minimum size is 1600x180px (1900x180px recommended). The image will cover the full header.'; +$string['categoryheaderbgimagetextcolour'] = 'Category \'{$a->name}\' with id \'{$a->id}\' background image text colour'; +$string['categoryheaderbgimagetextcolourdesc'] = 'Set a background image text colour for the top level category \'{$a->name}\' with id \'{$a->id}\' in the header.'; +$string['categoryheaderbgimagetextcolourdescchildren'] = 'Set a background image text colour for the top level category \'{$a->name}\' with id \'{$a->id}\' and its children \'{$a->children}\' in the header.'; $string['categoryheaderlogo'] = 'Category \'{$a->name}\' with id \'{$a->id}\' logo'; $string['categoryheaderlogodesc'] = 'Set a logo for the top level category \'{$a->name}\' with id \'{$a->id}\' in the header. Recommended size is 200px by 80px.'; $string['categoryheaderlogodescchildren'] = 'Set a logo for the top level category \'{$a->name}\' with id \'{$a->id}\' and its children \'{$a->children}\' in the header. Recommended size is 200px by 80px.'; diff --git a/layout/columns1.php b/layout/columns1.php index 691e0a8..b9250b8 100644 --- a/layout/columns1.php +++ b/layout/columns1.php @@ -28,43 +28,4 @@ defined('MOODLE_INTERNAL') || die; -// Include header. -$sidepostdrawer = false; -require_once(dirname(__FILE__) . '/includes/header.php'); -// Include secondary navigation. -require_once(dirname(__FILE__) . '/includes/secondarynav.php'); -?> - -
      - get_news_ticker(); - echo $OUTPUT->page_navbar(); - ?> -
      -
      -
      - course_content_header(); - if (!empty($secondarynavigation)) { - echo $secondarynavigation; - } - echo $OUTPUT->activity_header(); - if (!empty($overflow)) { - echo $overflow; - } - echo $OUTPUT->main_content(); - echo $OUTPUT->activity_navigation(); - echo $OUTPUT->course_content_footer(); - ?> -
      -
      -
      -
      - -layout_options['nofooter'])) { - // Include footer. - require_once(dirname(__FILE__) . '/includes/footer.php'); -} else { - require_once(dirname(__FILE__) . '/includes/nofooter.php'); -} +echo $OUTPUT->columns_one_layout(); diff --git a/layout/columns2.php b/layout/columns2.php index 8bf9b32..9a81009 100644 --- a/layout/columns2.php +++ b/layout/columns2.php @@ -28,58 +28,4 @@ defined('MOODLE_INTERNAL') || die; -// Include header. -$sidepostdrawer = true; -require_once(dirname(__FILE__) . '/includes/header.php'); -// Include secondary navigation. -require_once(dirname(__FILE__) . '/includes/secondarynav.php'); -?> - -
      - get_news_ticker(); - echo $OUTPUT->page_navbar(); - ?> -
      -
      -
      - get_course_alerts(); - echo $OUTPUT->course_content_header(); - if (!empty($secondarynavigation)) { - echo $secondarynavigation; - } - echo $OUTPUT->activity_header(); - if (!empty($overflow)) { - echo $overflow; - } - echo $OUTPUT->main_content(); - - if ($PAGE->has_set_url()) { - $currenturl = $PAGE->url; - } else { - $currenturl = $_SERVER["REQUEST_URI"]; - } - - // Display course page block activity bottom region if this is a mod page of type where you're viewing - // a section, page or book (chapter). - if (!empty($PAGE->theme->settings->coursepageblockactivitybottomenabled)) { - if ( - stristr($currenturl, "mod/page/view") || - stristr($currenturl, "mod/book/view") - ) { - echo $OUTPUT->get_block_regions('customrowsetting', 'course-section-', '12-0-0-0'); - } - } - - echo $OUTPUT->activity_navigation(); - echo $OUTPUT->course_content_footer(); - ?> -
      -
      -
      -
      - -columns_two_layout(); diff --git a/layout/course.php b/layout/course.php index 5e305be..5ab3485 100644 --- a/layout/course.php +++ b/layout/course.php @@ -29,216 +29,4 @@ defined('MOODLE_INTERNAL') || die; -$sidepostdrawer = true; -$movesidebartofooter = !empty(($PAGE->theme->settings->coursepagesidebarinfooterenabled)) ? 2 : 1; -if ((!empty($movesidebartofooter)) && ($movesidebartofooter == 2)) { - $sidepostdrawer = false; -} - -// Include header. -require_once(dirname(__FILE__) . '/includes/header.php'); -// Include secondary navigation. -require_once(dirname(__FILE__) . '/includes/secondarynav.php'); - -// Definition of block regions for top and bottom. These are used in potentially retrieving -// any missing block regions. -$blocksarray = [ - ['settingsname' => 'coursepageblocklayoutlayouttoprow', - 'classnamebeginswith' => 'course-top-', ], - ['settingsname' => 'coursepageblocklayoutlayoutbottomrow', - 'classnamebeginswith' => 'course-bottom-', ], -]; -?> - -
      - get_news_ticker(); - echo $OUTPUT->page_navbar(); - ?> -
      - theme->settings->coursepageblocksenabled)) { - echo '
      '; - echo '
      '; - echo $OUTPUT->get_block_regions('coursepageblocklayoutlayouttoprow', 'course-top-'); - echo '
      '; - echo '
      '; - } - ?> - -
      -
      - theme->settings->tabbedlayoutcoursepage)) { - // Use Adaptable tabbed layout. - $currentpage = theme_adaptable_get_current_page(); - - $taborder = explode('-', $PAGE->theme->settings->tabbedlayoutcoursepage); - $count = 0; - - echo '
      '; - - $sectionid = optional_param('sectionid', 0, PARAM_INT); - $section = optional_param('section', 0, PARAM_INT); - if ( - (!empty($PAGE->theme->settings->tabbedlayoutcoursepagelink)) && - (($sectionid) || ($section)) - ) { - global $COURSE; - $courseurl = new moodle_url('/course/view.php', ['id' => $COURSE->id]); - echo '
      '; - } - - foreach ($taborder as $tabnumber) { - if ($tabnumber == 0) { - $tabname = 'tab-content'; - $tablabel = get_string('tabbedlayouttablabelcourse', 'theme_adaptable'); - } else { - $tabname = 'tab' . $tabnumber; - $tablabel = get_string('tabbedlayouttablabelcourse' . $tabnumber, 'theme_adaptable'); - } - - $checkedstatus = ''; - - if ( - ($count == 0 && $currentpage == 'coursepage') || - ($currentpage != 'coursepage' && $tabnumber == 0) - ) { - $checkedstatus = 'checked'; - } - - $extrastyles = ''; - - if ($currentpage == 'coursepage') { - $extrastyles = ' style="display: none"'; - } - - echo '' . - ''; - - $count++; - } - - /* Basic array used by appropriately named blocks below (e.g. course-tab-one). All this is to re-use existing - functionality and the non-use of numbers in block region names. */ - $wordtonumber = [1 => 'one', 2 => 'two']; - - foreach ($taborder as $tabnumber) { - if ($tabnumber == 0) { - echo '
      '; - - echo $OUTPUT->get_course_alerts(); - if (!empty($PAGE->theme->settings->coursepageblocksliderenabled)) { - echo $OUTPUT->get_block_regions('customrowsetting', 'news-slider-', '12-0-0-0'); - } - - echo $OUTPUT->course_content_header(); - if (!empty($secondarynavigation)) { - echo $secondarynavigation; - } - if (!empty($overflow)) { - echo $overflow; - } - echo $OUTPUT->main_content(); - echo $OUTPUT->course_content_footer(); - - echo '
      '; - } else { - echo '
      '; - - echo $OUTPUT->get_block_regions( - 'customrowsetting', - 'course-tab-' . $wordtonumber[$tabnumber] . '-', - '12-0-0-0' - ); - echo '
      '; - } - } - echo '
      '; - } else { - echo $OUTPUT->get_course_alerts(); - if (!empty($PAGE->theme->settings->coursepageblocksliderenabled)) { - echo $OUTPUT->get_block_regions('customrowsetting', 'news-slider-', '12-0-0-0'); - } - echo $OUTPUT->context_header(); - echo $OUTPUT->course_content_header(); - if (!empty($secondarynavigation)) { - echo $secondarynavigation; - } - if (!empty($overflow)) { - echo $overflow; - } - echo $OUTPUT->main_content(); - echo $OUTPUT->course_content_footer(); - } - ?> - -
      -
      -theme->settings->coursepageblocksenabled)) { - $displayall = true; -} - -if ($movesidebartofooter == 1) { - /* Get any missing blocks from changing layout settings. E.g. From 4-4-4-4 to 6-6-0-0, to recover - what was in the last 2 spans that are now 0. */ - echo $OUTPUT->get_missing_block_regions($blocksarray, 'col-12', $displayall); -} - -// If course page, display course bottom block region. -if (!empty($PAGE->theme->settings->coursepageblocksenabled)) { - echo '
      '; - echo '
      '; - echo $OUTPUT->get_block_regions('coursepageblocklayoutlayoutbottomrow', 'course-bottom-'); - echo '
      '; - echo '
      '; -} - -if ($movesidebartofooter == 2) { - $hassidepost = $PAGE->blocks->region_has_content('side-post', $OUTPUT); - - if ($hassidepost) { - echo $OUTPUT->blocks('side-post', ' col-12 d-print-none '); - } - - /* Get any missing blocks from changing layout settings. E.g. From 4-4-4-4 to 6-6-0-0, to recover - what was in the last 2 spans that are now 0. */ - echo $OUTPUT->get_missing_block_regions($blocksarray, [], $displayall); -} - -if ($movesidebartofooter == 2) { ?> - -
      - -
      -
    - -theme->settings->tabbedlayoutcoursepagetabpersistencetime)) { - $tabbedlayoutcoursepagetabpersistencetime = $PAGE->theme->settings->tabbedlayoutcoursepagetabpersistencetime; -} else { - $tabbedlayoutcoursepagetabpersistencetime = 30; -} -if (!empty($PAGE->theme->settings->tabbedlayoutcoursepage)) { - $PAGE->requires->js_call_amd('theme_adaptable/utils', 'init', ['currentpage' => $currentpage, - 'tabpersistencetime' => $tabbedlayoutcoursepagetabpersistencetime, ]); - - echo '
-embedded_layout(); diff --git a/layout/frontpage.php b/layout/frontpage.php index c1fc17a..0f69576 100644 --- a/layout/frontpage.php +++ b/layout/frontpage.php @@ -29,126 +29,4 @@ defined('MOODLE_INTERNAL') || die; -$sidepostdrawer = false; -if ((\theme_adaptable\toolbox::get_setting('frontpageuserblocksenabled')) || (is_siteadmin($USER))) { - $sidepostdrawer = true; -} - -// Let's go to include first the common header file. -require_once(dirname(__FILE__) . '/includes/header.php'); -// Include secondary navigation. -require_once(dirname(__FILE__) . '/includes/secondarynav.php'); - -if (!empty($secondarynavigation)) { - echo $secondarynavigation; -} -if (!empty($overflow)) { - echo $overflow; -} - -echo $OUTPUT->get_news_ticker(); - -// Slider. -echo $OUTPUT->get_frontpage_slider(); - -// And let's show Infobox 1 if enabled. -if (!empty(\theme_adaptable\toolbox::get_setting('infobox'))) { - if (!empty(\theme_adaptable\toolbox::get_setting('infoboxfullscreen'))) { - echo '
'; - } else { - echo '
'; - } - echo '
'; - echo \theme_adaptable\toolbox::get_setting('infobox', 'format_moodle'); - echo '
'; - echo '
'; -} - -// If Marketing Blocks are enabled then let's show them. -if (!empty(\theme_adaptable\toolbox::get_setting('frontpagemarketenabled'))) { - echo $OUTPUT->get_marketing_blocks(); -} - -if (!empty(\theme_adaptable\toolbox::get_setting('frontpageblocksenabled'))) { ?> -
-
- get_block_regions(); ?> -
-
- '; - } else { - echo '
'; - } - echo '
'; - echo \theme_adaptable\toolbox::get_setting('infobox2', 'format_moodle'); - echo '
'; - echo '
'; -} - -// The main content goes here. -?> -
-
- - -
-
- course_content_header(); - echo $OUTPUT->main_content(); - echo $OUTPUT->course_content_footer(); - ?> -
-
-
- - -
-
- - theme->settings->coursepageblocksliderenabled)) { - echo $OUTPUT->get_block_regions('customrowsetting', 'news-slider-', '12-0-0-0'); - } - - if (!empty($PAGE->theme->settings->coursepageblockactivitybottomenabled)) { - echo $OUTPUT->get_block_regions('customrowsetting', 'course-section-', '12-0-0-0'); - } - - if (!empty($PAGE->theme->settings->tabbedlayoutcoursepage)) { - echo $OUTPUT->get_block_regions('customrowsetting', 'course-tab-one-', '12-0-0-0'); - echo $OUTPUT->get_block_regions('customrowsetting', 'course-tab-two-', '12-0-0-0'); - } - - if (!empty($PAGE->theme->settings->tabbedlayoutdashboard)) { - echo $OUTPUT->get_block_regions('customrowsetting', 'my-tab-one-', '12-0-0-0'); - echo $OUTPUT->get_block_regions('customrowsetting', 'my-tab-two-', '12-0-0-0'); - } - - ?> - -

- blocks('frnt-footer', 'col-10'); - ?> -
-
- -
- -frontpage_layout(); diff --git a/layout/includes/courseindexheader.php b/layout/includes/courseindexheader.php deleted file mode 100644 index ef19014..0000000 --- a/layout/includes/courseindexheader.php +++ /dev/null @@ -1,52 +0,0 @@ -. - -/** - * Course Index header. - * - * @package theme_adaptable - * @copyright 2022 G J Barnard - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */ - -defined('MOODLE_INTERNAL') || die; - -require_once($CFG->dirroot . '/course/lib.php'); - -user_preference_allow_ajax_update('drawer-open-index', PARAM_BOOL); - -if (isloggedin()) { - $courseindexopen = (get_user_preferences('drawer-open-index', true) == true); -} else { - $courseindexopen = false; -} - -$courseindex = core_course_drawer(); - -if (!$courseindex) { - $courseindexopen = false; -} - -$templatecontext = [ - 'courseindexopen' => $courseindexopen, - 'courseindex' => $courseindex, - 'left' => $left, -]; - -$courseindexmarkup = $OUTPUT->render_from_template('theme_adaptable/courseindex', $templatecontext); -$courseindextogglemarkup = $OUTPUT->render_from_template('theme_adaptable/courseindextoggle', $templatecontext); diff --git a/layout/includes/footer.php b/layout/includes/footer.php deleted file mode 100644 index c1696db..0000000 --- a/layout/includes/footer.php +++ /dev/null @@ -1,158 +0,0 @@ -. - -/** - * Version details - * - * @package theme_adaptable - * @copyright 2015 Jeremy Hopkins (Coventry University) - * @copyright 2015-2017 Fernando Acedo (3-bits.com) - * @copyright 2019 G J Barnard - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */ - -defined('MOODLE_INTERNAL') || die; - -// Load messages / notifications. -echo $OUTPUT->standard_after_main_region_html(); -?> - -
- -' . $OUTPUT->course_footer() . '
'; - -if ($PAGE->theme->settings->showfooterblocks) { - echo $OUTPUT->get_footer_blocks(); -} - -if ($PAGE->theme->settings->hidefootersocial == 1) { - $socialicons = $OUTPUT->socialicons(); - if (!empty($socialicons)) { - echo '
'; - echo '
'; - echo '
'; - } -} -?> -
-
-
-
- theme->settings->moodledocs) { - $footnoteclass = 'col-md-4'; - } else { - $footnoteclass = 'col-md-8'; - } - $footnoteclass .= ' my-md-0 my-2'; - echo '
' . $footnote . '
'; - } - if ($PAGE->theme->settings->moodledocs) { - echo ''; - } - ?> -
- standard_footer_html(); ?> -
-
- debug_footer_html(); - if (!empty($debug)) { - echo '
'; - echo $debug; - echo '
'; - } - ?> -
-
- - -
- - ($PAGE->theme->settings->stickynavbar ? '35px' : '0'), - 'savetext' => get_string('savebuttontext', 'theme_adaptable'), - 'discardtext' => get_string('discardbuttontext', 'theme_adaptable'), -]; -if (strstr($PAGE->pagetype, 'admin-setting')) { - if ($PAGE->theme->settings->enablesavecanceloverlay) { - echo $OUTPUT->render_from_template('theme_adaptable/savediscard', $templatecontext); - } -} -echo '
'; // End #page. -echo '
'; // End #page-wrapper. -echo $OUTPUT->standard_end_of_body_html(); -echo $PAGE->theme->settings->jssection; - -// Conditional javascript based on a user profile field. -if (!empty($PAGE->theme->settings->jssectionrestrictedprofilefield)) { - // Get custom profile field setting. (e.g. faculty=fbl). - $fields = explode('=', $PAGE->theme->settings->jssectionrestrictedprofilefield); - $ftype = $fields[0]; - $setvalue = $fields[1]; - - // Get user profile field (if it exists). - require_once($CFG->dirroot . '/user/profile/lib.php'); - require_once($CFG->dirroot . '/user/lib.php'); - profile_load_data($USER); - $ftype = "profile_field_$ftype"; - if (isset($USER->$ftype)) { - if ($USER->$ftype == $setvalue) { - // Match between user profile field value and value in setting. - - if (!empty($PAGE->theme->settings->jssectionrestricteddashboardonly)) { - // If this is set to restrict to dashboard only, check if we are on dashboard page. - if ($PAGE->has_set_url()) { - $url = $PAGE->url; - } else if ($ME !== null) { - $url = new moodle_url(str_ireplace('/my/', '/', $ME)); - } - - // In practice, $url should always be valid. - if ($url !== null) { - // Check if this is the dashboard page. - if (strstr($url->raw_out(), '/my/')) { - echo $PAGE->theme->settings->jssectionrestricted; - } - } - } else { - echo $PAGE->theme->settings->jssectionrestricted; - } - } - } -} -echo $OUTPUT->get_all_tracking_methods(); -?> - - - diff --git a/layout/includes/head.php b/layout/includes/head.php deleted file mode 100644 index 66518e5..0000000 --- a/layout/includes/head.php +++ /dev/null @@ -1,98 +0,0 @@ -. - -/** - * Head - * - * @package theme_adaptable - * @copyright 2020 G J Barnard - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */ - -defined('MOODLE_INTERNAL') || die(); - -// HTML head. -echo $OUTPUT->standard_head_html(); -$siteurl = new moodle_url(''); -?> - - - - - - - - - - - - - - - - - - - - - - - - theme->settings->googlefonts)) { - $fontssubset = ''; - - $fontsettings = ['fontname', 'fontheadername', 'fonttitlename']; - $fontstoload = []; - foreach ($fontsettings as $fontsetting) { - switch ($PAGE->theme->settings->$fontsetting) { - case 'sans-serif': - break; - default: - // Google font name. - $fontname = str_replace(" ", "+", $PAGE->theme->settings->$fontsetting); - if (!in_array($fontname, $fontstoload)) { - $fontstoload[] = $fontname; - } - break; - } - } - - if (!empty($fontstoload)) { - // Get the Google Font weights. - $fontweight = ':' . $PAGE->theme->settings->fontweight . ',' . $PAGE->theme->settings->fontweight . 'i'; - $fontheaderweight = ':' . $PAGE->theme->settings->fontheaderweight . ',' . $PAGE->theme->settings->fontheaderweight . 'i'; - $fonttitleweight = ':' . $PAGE->theme->settings->fonttitleweight . ',' . $PAGE->theme->settings->fonttitleweight . 'i'; - - // Get the Google fonts subset. - if (!empty($PAGE->theme->settings->fontsubset)) { - $fontssubset = '&subset=' . $PAGE->theme->settings->fontsubset; - } - - // Load Google fonts. - echo ''; - foreach ($fontstoload as $googlefontname) { - echo ''; - } - } - } - ?> - -. - -/** - * Header - * - * @package theme_adaptable - * @copyright 2015-2019 Jeremy Hopkins (Coventry University) - * @copyright 2015-2019 Fernando Acedo (3-bits.com) - * @copyright 2017-2019 Manoj Solanki (Coventry University) - * @copyright 2019 G J Barnard - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - */ - -defined('MOODLE_INTERNAL') || die(); - -$bodyclasses = []; -$bodyclasses[] = 'theme_adaptable'; -$bodyclasses[] = 'two-column'; - -$pageclasses = []; - -/* Check if this is a course or module page and check setting to hide site title. - If not one of these pages, by default show it (set $hidesitetitle to false). */ -if ( - (strstr($PAGE->pagetype, 'course')) || - (strstr($PAGE->pagetype, 'mod')) && ($this->page->course->id > 1) -) { - $hidesitetitle = !empty(($PAGE->theme->settings->coursepageheaderhidesitetitle)) ? true : false; -} else { - $hidesitetitle = false; -} - -// Screen size. -theme_adaptable_initialise_zoom(); -$bodyclasses[] = theme_adaptable_get_zoom(); - -theme_adaptable_initialise_full(); -$bodyclasses[] = theme_adaptable_get_full(); - -$bsoptionsdata = ['data' => []]; - -// Main navbar. -if (isset($PAGE->theme->settings->stickynavbar) && $PAGE->theme->settings->stickynavbar == 1) { - $bsoptionsdata['data']['stickynavbar'] = true; -} else { - $bsoptionsdata['data']['stickynavbar'] = false; -} - -// JS calls. -$PAGE->requires->js_call_amd('theme_adaptable/adaptable', 'init'); -$PAGE->requires->js_call_amd('theme_adaptable/bsoptions', 'init', $bsoptionsdata); - -// Layout. -$left = (!right_to_left()); // To know if to add 'pull-right' and 'desktop-first-column' classes in the layout for LTR. - -// Navbar Menu. -$shownavbar = false; -if ( - (isloggedin() && !isguestuser()) || - (!empty($PAGE->theme->settings->enablenavbarwhenloggedout)) -) { - // Show navbar unless disabled by config. - if (empty($PAGE->layout_options['nonavbar'])) { - $shownavbar = true; - } -} -// Load header background image if it exists. -$headerbg = ''; - -$localtoolbox = \theme_adaptable\toolbox::get_local_toolbox(); -if (is_object($localtoolbox)) { - $themesettings = \theme_adaptable\toolbox::get_settings(); - ['currenttopcat' => $currenttopcat, 'headerbg' => $headerbg] = $localtoolbox->get_category_header($themesettings, $PAGE); -} else { - $currenttopcat = false; -} - -if ((empty($headerbg)) && (!empty($PAGE->theme->settings->headerbgimage))) { - $headerbg = ' class="headerbgimage" style="background-image: ' . - 'url(\'' . $PAGE->theme->setting_file_url('headerbgimage', 'headerbgimage') . '\');"'; -} -if (!empty($headerbg)) { - $bodyclasses[] = 'has-header-bg'; -} - -/* Choose the header style. There styles available are: - "style1" (original header) - "style2" (2 row header). -*/ - -if (!empty($PAGE->theme->settings->headerstyle)) { - $adaptableheaderstyle = $PAGE->theme->settings->headerstyle; -} else { - $adaptableheaderstyle = "style1"; -} -$bodyclasses[] = 'header-' . $adaptableheaderstyle; - -// Block icons class. -if ($PAGE->theme->settings->blockicons == 1) { - $bodyclasses[] = 'showblockicons'; -} - -if (!empty($PAGE->theme->settings->standardscreenwidth)) { - $bodyclasses[] = $PAGE->theme->settings->standardscreenwidth; -} else { - $bodyclasses[] = 'standard'; -} - -// HTML header. -echo $OUTPUT->doctype(); -?> -htmlattributes(); ?>> - - <?php echo $OUTPUT->page_title(); ?> - - -theme->settings->blockside; - -$courseindexheader = false; -switch ($PAGE->pagelayout) { - case 'base': - case 'standard': - case 'course': - case 'coursecategory': - case 'incourse': - case 'frontpage': - case 'admin': - case 'mycourses': - case 'mydashboard': - case 'mypublic': - case 'report': - require_once(dirname(__FILE__) . '/courseindexheader.php'); - $courseindexheader = true; - break; - default: - $courseindex = false; -} - -if ($sidepostdrawer) { - require_once(dirname(__FILE__) . '/sidepostheader.php'); -} else { - $hassidepost = false; -} - -if ($courseindexheader) { - if ($courseindexopen) { - $bodyclasses[] = 'drawer-open-index'; - } -} - -if (($courseindex) || ($hassidepost)) { - $bodyclasses[] = 'uses-drawers'; - $pageclasses[] = 'drawers'; -} - -$nomobilenavigation = ''; -if (!empty($PAGE->theme->settings->responsivesectionnav)) { - $nomobilenavigation = 'nomobilenavigation'; - $bodyclasses[] = $nomobilenavigation; -} - -?> -body_attributes($bodyclasses); ?>> - -standard_top_of_body_html(); -?> - -
- '; - } - - $headercontext = [ - 'output' => $OUTPUT, - ]; - - if (!empty($nomobilenavigation)) { - $primary = new theme_adaptable\output\navigation\primary($PAGE); - $renderer = $PAGE->get_renderer('core'); - $primarymenu = $primary->export_for_template($renderer); - $headercontext['mobileprimarynav'] = $primarymenu['mobileprimarynav']; - $headercontext['mobileprimarynavicon'] = \theme_adaptable\toolbox::getfontawesomemarkup('bars'); - $headercontext['hasmobileprimarynav'] = true; - } - - if ((!isloggedin() || isguestuser()) && ($PAGE->pagetype != "login-index")) { - if ($PAGE->theme->settings->displaylogin != 'no') { - $loginformcontext = [ - 'displayloginbox' => ($PAGE->theme->settings->displaylogin == 'box') ? true : false, - 'output' => $OUTPUT, - 'token' => s(\core\session\manager::get_login_token()), - 'url' => new moodle_url('/login/index.php'), - ]; - if (!$loginformcontext['displayloginbox']) { - $authsequence = get_enabled_auth_plugins(); // Get all auths. - if (in_array('oidc', $authsequence)) { - $authplugin = get_auth_plugin('oidc'); - $oidc = $authplugin->loginpage_idp_list($this->page->url->out(false)); - if (!empty($oidc)) { - $loginformcontext['hasoidc'] = true; - $loginformcontext['oidcdata'] = \auth_plugin_base::prepare_identity_providers_for_output($oidc, $OUTPUT); - } - } - } - $headercontext['loginoruser'] = ''; - } else { - $headercontext['loginoruser'] = ''; - } - } else { - // Display user profile menu. - // Only used when user is logged in and not on the secure layout. - if ((isloggedin()) && ($PAGE->pagelayout != 'secure')) { - // User icon. - $userpic = $OUTPUT->user_picture($USER, ['link' => false, 'visibletoscreenreaders' => false, - 'size' => 35, 'class' => 'userpicture', ]); - // User name. - $username = format_string(fullname($USER)); - - // User menu dropdown. - if (!empty($PAGE->theme->settings->usernameposition)) { - $usernameposition = $PAGE->theme->settings->usernameposition; - if ($usernameposition == 'right') { - $usernamepositionleft = false; - } else { - $usernamepositionleft = true; - } - } else { - $usernamepositionleft = true; - } - - // Set template context. - $usermenucontext = [ - 'username' => $username, - 'userpic' => $userpic, - 'showusername' => $PAGE->theme->settings->showusername, - 'usernamepositionleft' => $usernamepositionleft, - 'userprofilemenu' => $OUTPUT->user_profile_menu(), - ]; - $usermenu = $OUTPUT->render_from_template('theme_adaptable/usermenu', $usermenucontext); - $headercontext['loginoruser'] = ''; - } else { - $headercontext['loginoruser'] = ''; - } - } - - if (!$hidesitetitle) { - $headercontext['sitelogo'] = $OUTPUT->get_logo($currenttopcat, $shownavbar); - $headercontext['sitetitle'] = $OUTPUT->get_title($currenttopcat); - } - - $headercontext['headerbg'] = $headerbg; - $headercontext['shownavbar'] = $shownavbar; - - // Navbar Menu. - if ($shownavbar) { - $headercontext['shownavbar'] = [ - 'disablecustommenu' => (!empty($PAGE->theme->settings->disablecustommenu)), - 'navigationmenu' => $OUTPUT->navigation_menu('main-navigation'), - 'navigationmenudrawer' => $OUTPUT->navigation_menu('main-navigation-drawer'), - 'output' => $OUTPUT, - 'toolsmenu' => $OUTPUT->tools_menu(), - ]; - - $navbareditsettings = $PAGE->theme->settings->editsettingsbutton; - $headercontext['shownavbar']['showcog'] = true; - $showeditbuttons = false; - - if ($navbareditsettings == 'button') { - $showeditbuttons = true; - $headercontext['shownavbar']['showcog'] = false; - } else if ($navbareditsettings == 'cogandbutton') { - $showeditbuttons = true; - } - - if ($headercontext['shownavbar']['showcog']) { - $headercontext['shownavbar']['coursemenucontent'] = $OUTPUT->context_header_settings_menu(); - $headercontext['shownavbar']['othermenucontent'] = $OUTPUT->region_main_settings_menu(); - } - - /* Ensure to only hide the button on relevant pages. Some pages will need the button, such as the - dashboard page. Checking if the cog is being displayed above to figure out if it still needs to - show (when there is no cog). Also show mod pages (e.g. Forum, Lesson) as these sometimes have - a button for a specific purpose. */ - if ( - ($showeditbuttons) || - (($headercontext['shownavbar']['showcog']) && - ((empty($headercontext['shownavbar']['coursemenucontent'])) && - (empty($headercontext['shownavbar']['othermenucontent'])))) || - (strstr($PAGE->pagetype, 'mod-')) - ) { - $headercontext['shownavbar']['pageheadingbutton'] = $OUTPUT->page_heading_button(); - } - - if (isloggedin()) { - if ($PAGE->theme->settings->enablezoom) { - $headercontext['shownavbar']['enablezoom'] = true; - $headercontext['shownavbar']['enablezoomshowtext'] = ($PAGE->theme->settings->enablezoomshowtext); - } - } - } - $headercontext['topmenus'] = $OUTPUT->get_top_menus(false); - - if ($adaptableheaderstyle == "style1") { - $headercontext['menuslinkright'] = (!empty($PAGE->theme->settings->menuslinkright)); - $headercontext['langmenu'] = (empty($PAGE->layout_options['langmenu']) || $PAGE->layout_options['langmenu']); - $headercontext['responsiveheader'] = $PAGE->theme->settings->responsiveheader; - - if (!empty($PAGE->theme->settings->pageheaderlayout)) { - $headercontext['pageheaderoriginal'] = ($PAGE->theme->settings->pageheaderlayout == 'original'); - } else { - $headercontext['pageheaderoriginal'] = true; - } - - $headersearchandsocial = (!empty($PAGE->theme->settings->headersearchandsocial)) ? $PAGE->theme->settings->headersearchandsocial : 'none'; - - // Search box and social icons. - switch ($headersearchandsocial) { - case 'socialheader': - $headersocialcontext = [ - 'classes' => $PAGE->theme->settings->responsivesocial, - 'pageheaderoriginal' => $headercontext['pageheaderoriginal'], - 'output' => $OUTPUT, - ]; - $headercontext['searchandsocialheader'] = $OUTPUT->render_from_template('theme_adaptable/headersocial', $headersocialcontext); - break; - case 'searchmobilenav': - $headercontext['searchandsocialnavbar'] = $OUTPUT->search_box(); - $headercontext['searchandsocialnavbarextra'] = ' d-md-block d-lg-none my-auto'; - $headersearchcontext = [ - 'pagelayout' => ($headercontext['pageheaderoriginal']) ? 'pagelayoutoriginal' : 'pagelayoutalternative', - 'search' => $OUTPUT->search_box(), - ]; - $headercontext['searchandsocialheader'] = $OUTPUT->render_from_template('theme_adaptable/headersearch', $headersearchcontext); - break; - case 'searchheader': - $headersearchcontext = [ - 'pagelayout' => ($headercontext['pageheaderoriginal']) ? 'pagelayoutoriginal' : 'pagelayoutalternative', - 'search' => $OUTPUT->search_box(), - ]; - $headercontext['searchandsocialheader'] = $OUTPUT->render_from_template('theme_adaptable/headersearch', $headersearchcontext); - break; - case 'searchnavbar': - $headercontext['searchandsocialnavbar'] = $OUTPUT->search_box(); - break; - case 'searchnavbarsocialheader': - $headercontext['searchandsocialnavbar'] = $OUTPUT->search_box(); - $headersocialcontext = [ - 'classes' => $PAGE->theme->settings->responsivesocial, - 'pageheaderoriginal' => $headercontext['pageheaderoriginal'], - 'output' => $OUTPUT, - ]; - $headercontext['searchandsocialheader'] = $OUTPUT->render_from_template('theme_adaptable/headersocial', $headersocialcontext); - break; - } - - echo $OUTPUT->render_from_template('theme_adaptable/headerstyleone', $headercontext); - } else if ($adaptableheaderstyle == "style2") { - $headercontext['responsiveheader'] = $PAGE->theme->settings->responsiveheader; - if (!empty($PAGE->theme->settings->pageheaderlayouttwo)) { - $headercontext['pageheaderoriginal'] = ($PAGE->theme->settings->pageheaderlayouttwo == 'original'); - } else { - $headercontext['pageheaderoriginal'] = true; - } - - if ($headercontext['pageheaderoriginal']) { - $headercontext['navbarsearch'] = $OUTPUT->search_box(); - } - - if (empty($PAGE->layout_options['langmenu']) || $PAGE->layout_options['langmenu']) { - $headercontext['langmenu'] = $OUTPUT->lang_menu(false); - } - - echo $OUTPUT->render_from_template('theme_adaptable/headerstyletwo', $headercontext); - } - if ($bsoptionsdata['data']['stickynavbar']) { - echo '
'; - } - if (!empty($courseindextogglemarkup)) { - echo $courseindextogglemarkup; - } - if (!empty($sideposttogglemarkup)) { - echo $sideposttogglemarkup; - } - echo $OUTPUT->get_alert_messages(); diff --git a/layout/includes/nofooter.php b/layout/includes/nofooter.php deleted file mode 100644 index 1a28498..0000000 --- a/layout/includes/nofooter.php +++ /dev/null @@ -1,43 +0,0 @@ -. - -/** - * No footer - * - * @package theme_adaptable - * @copyright 2021 G J Barnard - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */ - -defined('MOODLE_INTERNAL') || die; - -echo $OUTPUT->standard_after_main_region_html(); -echo '
'; // End #page. -echo '
'; // End #page-wrapper. -echo $OUTPUT->standard_end_of_body_html(); -echo $PAGE->theme->settings->jssection; -echo $OUTPUT->get_all_tracking_methods(); ?> - - - -. - -/** - * No header - * - * @package theme_adaptable - * @copyright 2019 G J Barnard - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */ - -defined('MOODLE_INTERNAL') || die(); - -// Set HTTPS if needed. -if (empty($CFG->loginhttps)) { - $wwwroot = $CFG->wwwroot; -} else { - $wwwroot = str_replace("http://", "https://", $CFG->wwwroot); -} - -$bodyclasses = []; -$bodyclasses[] = 'theme_adaptable'; -$bodyclasses[] = 'two-column'; -$standardscreenwidthclass = 'standard'; -if (!empty($PAGE->theme->settings->standardscreenwidth)) { - $bodyclasses[] = $PAGE->theme->settings->standardscreenwidth; -} else { - $bodyclasses[] = 'standard'; -} - -// HTML header. -echo $OUTPUT->doctype(); -?> -htmlattributes(); ?>> - - <?php echo $OUTPUT->page_title(); ?> - - - - -body_attributes($bodyclasses); ?>> - -standard_top_of_body_html(); -?> - -
-
- - get_alert_messages(); diff --git a/layout/includes/secondarynav.php b/layout/includes/secondarynav.php deleted file mode 100644 index 1acb431..0000000 --- a/layout/includes/secondarynav.php +++ /dev/null @@ -1,42 +0,0 @@ -. - -/** - * Secondary navigation and overflow. - * - * @package theme_adaptable - * @copyright 2023 G J Barnard - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */ - -defined('MOODLE_INTERNAL') || die; - -$secondarynavigation = ''; -$overflow = ''; -if ($PAGE->has_secondary_navigation()) { - $tablistnav = $PAGE->has_tablist_secondary_navigation(); - $moremenu = new \core\navigation\output\more_menu($PAGE->secondarynav, 'nav-tabs', true, $tablistnav); - $secondarynavigation = $moremenu->export_for_template($OUTPUT); - $secondarynavigation = $OUTPUT->render_from_template('theme_adaptable/secondarynav', $secondarynavigation); - - $overflowdata = $PAGE->secondarynav->get_overflow_menu_data(); - if (!is_null($overflowdata)) { - $overflow = $overflowdata->export_for_template($OUTPUT); - $overflow = $OUTPUT->render_from_template('theme_adaptable/overflow', $overflow); - } -} diff --git a/layout/includes/sidepostheader.php b/layout/includes/sidepostheader.php deleted file mode 100644 index 4382dec..0000000 --- a/layout/includes/sidepostheader.php +++ /dev/null @@ -1,65 +0,0 @@ -. - -/** - * Side post header. - * - * @package theme_adaptable - * @copyright 2022 G J Barnard - * {@link https://moodle.org/user/profile.php?id=442195} - * {@link https://gjbarnard.co.uk} - * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. - */ - -defined('MOODLE_INTERNAL') || die; - -user_preference_allow_ajax_update('drawer-open-block', PARAM_BOOL); - -if (isloggedin()) { - $sidepostopen = (get_user_preferences('drawer-open-block', true) == true); -} else { - $sidepostopen = false; -} - -// Add block button in editing mode. -$addblockbutton = $OUTPUT->addblockbutton(); - -$sideposthtml = $OUTPUT->blocks('side-post'); -$hassidepost = (strpos($sideposthtml, 'data-block=') !== false || !empty($addblockbutton)); -if (!$hassidepost) { - $sidepostopen = false; -} - -if (defined('BEHAT_SITE_RUNNING')) { - $sidepostopen = true; -} - -$sidepostcontext = [ - 'addblockbutton' => $addblockbutton, - 'hassidepost' => $hassidepost, - 'left' => $left, - 'sidepostopen' => $sidepostopen, - 'sidepost' => $sideposthtml, -]; - -$sideposttogglecontext = [ - 'hassidepost' => $hassidepost, - 'left' => $left, - 'sidepostopen' => $sidepostopen, -]; - -$sidepostmarkup = $OUTPUT->render_from_template('theme_adaptable/sidepost', $sidepostcontext); -$sideposttogglemarkup = $OUTPUT->render_from_template('theme_adaptable/sideposttoggle', $sideposttogglecontext); diff --git a/layout/login.php b/layout/login.php index 3cf602c..b1fee9a 100644 --- a/layout/login.php +++ b/layout/login.php @@ -28,41 +28,4 @@ defined('MOODLE_INTERNAL') || die; -// Include header. -global $OUTPUT; - -$logincontent = ''; - -$result = $OUTPUT->generate_login($logincontent); - -if (!empty($result->header)) { - $sidepostdrawer = false; - require_once(dirname(__FILE__) . '/includes/header.php'); -} else { - require_once(dirname(__FILE__) . '/includes/noheader.php'); -} -$PAGE->set_secondary_navigation(false); - -echo '
'; - echo $OUTPUT->page_navbar(); -?> -
-
-
- -
-
-
-
- -header)) { - require_once(dirname(__FILE__) . '/includes/footer.php'); -} else { - require_once(dirname(__FILE__) . '/includes/nofooter.php'); -} +echo $OUTPUT->login_layout(); diff --git a/layout/secure.php b/layout/secure.php index 0be49ca..dec7e20 100644 --- a/layout/secure.php +++ b/layout/secure.php @@ -28,43 +28,4 @@ defined('MOODLE_INTERNAL') || die; -// Include header. -$sidepostdrawer = true; -require_once(dirname(__FILE__) . '/includes/header.php'); -// Include secondary navigation. -require_once(dirname(__FILE__) . '/includes/secondarynav.php'); -?> - -
- page_navbar(); - ?> -
-
-
- get_course_alerts(); - echo $OUTPUT->course_content_header(); - if (!empty($secondarynavigation)) { - echo $secondarynavigation; - } - if (!empty($overflow)) { - echo $overflow; - } - echo $OUTPUT->main_content(); - if ($PAGE->has_set_url()) { - $currenturl = $PAGE->url; - } else { - $currenturl = $_SERVER["REQUEST_URI"]; - } ?> -
-
-
-
- - - -secure_layout(); diff --git a/lib.php b/lib.php index 91d4045..6576d2f 100644 --- a/lib.php +++ b/lib.php @@ -104,6 +104,7 @@ function theme_adaptable_get_main_scss_content($theme) { 'button', 'course', 'extras', + 'header', 'login', 'menu', 'responsive', @@ -182,6 +183,7 @@ function theme_adaptable_process_scss($scss, $theme) { '[[setting:buttoncolor]]' => '#51666C', '[[setting:buttontextcolor]]' => '#ffffff', '[[setting:buttonhovercolor]]' => '#009688', + '[[setting:buttontexthovercolor]]' => '#eeeeee', '[[setting:buttoncolorscnd]]' => '#51666C', '[[setting:buttontextcolorscnd]]' => '#ffffff', '[[setting:buttonhovercolorscnd]]' => '#009688', @@ -211,7 +213,9 @@ function theme_adaptable_process_scss($scss, $theme) { '[[setting:footerlinkcolor]]' => '#ffffff', '[[setting:headerbkcolor]]' => '#00796B', '[[setting:headerbkcolor2]]' => '#009688', + '[[setting:headerbgimagetextcolour]]' => '#ffffff', '[[setting:headertextcolor]]' => '#ffffff', + '[[setting:headertextcolor2]]' => '#ffffff', '[[setting:msgbadgecolor]]' => '#E53935', '[[setting:blockbackgroundcolor]]' => '#FFFFFF', '[[setting:blockheaderbackgroundcolor]]' => '#FFFFFF', @@ -675,21 +679,6 @@ function theme_adaptable_page_init(moodle_page $page) { } } -/** - * Strip full site title from header - * @param string $heading - */ -function theme_adaptable_remove_site_fullname($heading) { - global $SITE, $PAGE; - if (strpos($PAGE->pagetype, 'course-view-') === 0) { - return $heading; - } - - $header = preg_replace("/^" . $SITE->fullname . "/", "", $heading); - - return $header; -} - /** * * Get the current page to allow us to check if the block is allowed to display. diff --git a/scss/nosettings/_header.scss b/scss/nosettings/_header.scss index 69305ad..dabe0fb 100644 --- a/scss/nosettings/_header.scss +++ b/scss/nosettings/_header.scss @@ -29,8 +29,11 @@ background-size: cover; } -#sitetitle img { - max-height: 107px; - max-width: 100%; - width: auto; +#headertitle, +#sitetitle { + img { + max-height: 107px; + max-width: 100%; + width: auto; + } } diff --git a/scss/settings/adaptable.scss b/scss/settings/adaptable.scss index 710aaaa..66c15bf 100644 --- a/scss/settings/adaptable.scss +++ b/scss/settings/adaptable.scss @@ -86,16 +86,6 @@ a:focus { outline-offset: -2px; } -// Lists. -#adaptable-page-header-wrapper { - .dropdown-menu > li > a:hover, - .dropdown-menu > li > a:focus, - .dropdown-submenu:hover > a, - .dropdown-submenu:focus > a { - background-image: none; - } -} - // Text Selection. ::selection, ::-moz-selection { @@ -203,6 +193,7 @@ div.signuppanel h2 { // Header. #adaptable-page-header-wrapper { background-color: [[setting:headerbkcolor2]]; + color: [[setting:headertextcolor2]]; z-index: 10; &.sticky { @@ -211,6 +202,14 @@ div.signuppanel h2 { top: 0; width: 100%; } + + // Lists. + .dropdown-menu > li > a:hover, + .dropdown-menu > li > a:focus, + .dropdown-submenu:hover > a, + .dropdown-submenu:focus > a { + background-image: none; + } } #page-header { @@ -237,15 +236,15 @@ div.signuppanel h2 { margin: 5px 15px 10px 0; } -#sitetitle, -#sitetitle a, -#sitetitle p, -#sitetitle h1, -#sitetitle h2, -#sitetitle h3, -#sitetitle h4, -#sitetitle h5, -#sitetitle h6 { +#headertitle, +#headertitle a, +#headertitle p, +#headertitle h1, +#headertitle h2, +#headertitle h3, +#headertitle h4, +#headertitle h5, +#headertitle h6 { color: [[setting:fonttitlecolor]]; font-family: [[setting:fonttitlename]], sans-serif; @@ -682,56 +681,41 @@ langmenu a:hover { } .breadcrumb { - background: none !important; - background-color: [[setting:breadcrumb]] !important; - padding: 5px; -} - -.breadcrumb li { - margin: 5px 0; - text-shadow: none; -} - -.breadcrumb li span a { - text-decoration: none; -} - -.breadcrumb li span.divider { - display: none !important; -} - -.breadcrumb > a { - display: inline-block; - margin: 5px 0; -} - -.breadcrumb .fa { - display: inline; - margin: 12px 0; + background-color: [[setting:breadcrumb]]; + padding: 0 10px; + li { + margin: 5px 0; + text-shadow: none; + span { + a { + text-decoration: none; + } + &.divider { + border-bottom: 0 solid [[setting:maincolor]]; + display: none !important; + } + } + a.firstli { + padding-left: 15px; + padding-right: 20px; + } + } + > a { + display: inline-block; + margin: 5px 0; + } + ul i, + li.lastli span { + color: [[setting:breadcrumbtextcolor]]; + text-decoration: none; + } } .separator { margin: 9px; -} - -.separator i { - margin-left: 5px; -} - -.breadcrumb ul i, -.breadcrumb li.lastli span { - color: [[setting:breadcrumbtextcolor]]; - text-decoration: none; -} - -.breadcrumb li a.firstli { - padding-left: 15px; - padding-right: 20px; -} - -.breadcrumb li span.divider { - border-bottom: 0 solid [[setting:maincolor]]; - display: none !important; + i { + margin-left: 5px; + } } .breadcrumb-button { @@ -1313,10 +1297,10 @@ button.search-box__button { } .search-box__button:hover { - background: [[setting:buttonhovercolor]]; + background-color: [[setting:buttonhovercolor]]; border: 1px solid rgba(#000, .05); box-shadow: 1px 1px 2px rgba(255, 255, 255, .2); - color: [[setting:buttontextcolor]]; + color: [[setting:buttontexthovercolor]]; opacity: 0.9; text-decoration: none; text-shadow: -1px -1px 0 [[setting:buttonhovercolor]]; @@ -1872,7 +1856,6 @@ a.dimmed_text:visited, #savediscardsection { background-color: #eee; filter: alpha(opacity=80); - min-width: 100%; min-height: 30px; opacity: 0.8; padding: 10px; @@ -1881,6 +1864,38 @@ a.dimmed_text:visited, width: 100%; } +@media (min-width: 992px) { + #page.drawers { + #savediscardsection { + margin-left: -1.25rem; + padding-left: 1.5rem; + padding-right: 1.5rem; + } + &.show-drawer-left, + &.show-drawer-right { + #savediscardsection { + min-width: auto; + } + } + &.show-drawer-left { + #savediscardsection { + margin-left: 0; + width: calc(100% - #{$drawer-left-width}); + } + } + &.show-drawer-right { + #savediscardsection { + width: calc(100% - #{$drawer-right-width}); + } + } + &.show-drawer-left.show-drawer-right { + #savediscardsection { + width: calc(100% - #{$drawer-left-width} - #{$drawer-right-width}); + } + } + } +} + img.smallicon { height: 16px; width: 16px; @@ -2096,12 +2111,17 @@ img.smallicon { color: #000 !important; } -// Danger icon. -.text-danger, + +.text-danger .icon, .notconnected, .que .validationerror, .text-error { color: [[setting:dangericoncolor]] !important; +} + +.notconnected, +.que .validationerror, +.text-error { margin-right: 1px !important; margin-top: 8px !important; } diff --git a/scss/settings/button.scss b/scss/settings/button.scss index 74bb2b6..c3ef628 100644 --- a/scss/settings/button.scss +++ b/scss/settings/button.scss @@ -42,6 +42,19 @@ text-shadow: none; } +.btn { + &.btn-icon { + @include hover-focus { + background-color: [[setting:buttonhovercolor]]; + color: [[setting:buttontexthovercolor]]; + } + } + // Caret. + .caret { + border-top-color: [[setting:buttontextcolor]] !important; + } +} + // Primary button. .btn-primary, .backup-restore .singlebutton button[type="submit"], @@ -64,7 +77,6 @@ td.submit input, div.discussionsubscription > a.discussiontoggle, .btn-outline-secondary, .paging-morelink a, -.btn-link, a#adaptable-message-user-button, // Add Restrictions Dialogue. @@ -91,7 +103,7 @@ a#adaptable-message-user-button, .btn-primary:hover { background-color: [[setting:buttonhovercolor]] !important; text-decoration: none !important; - color: [[setting:buttontextcolor]] !important; + color: [[setting:buttontexthovercolor]] !important; } // Secondary button. @@ -131,7 +143,6 @@ a.submit:hover, .submitbutton:hover, .nav-pills > .active > a:hover, .nav-pills > .active > a:focus, .btn-outline-secondary:hover, -.btn-link:hover, div.discussionsubscription > a.discussiontoggle:hover, a#adaptable-message-user-button:hover, @@ -145,7 +156,7 @@ a#adaptable-message-user-button:hover, background-position: 0 -100%; background-color: [[setting:buttonhovercolor]] !important; text-decoration: none !important; - color: [[setting:buttontextcolor]] !important; + color: [[setting:buttontexthovercolor]] !important; } input[type="submit"]:focus, @@ -156,7 +167,7 @@ a.submit:focus, #notice .singlebutton + .singlebutton input:focus, background-color: [[setting:buttonhovercolor]] !important; background-position: 0 -100%; text-decoration: none !important; - color: [[setting:buttontextcolor]] !important; + color: [[setting:buttontexthovercolor]] !important; } button.close { @@ -228,7 +239,7 @@ input#id_submitbutton2[disabled], td.submit input[disabled] { background-image: none; background-color: [[setting:buttonhovercolor]] !important; - color: [[setting:buttontextcolor]] !important; + color: [[setting:buttontexthovercolor]] !important; box-shadow: 0 [[setting:buttondropshadow]] 0 0 rgba(0, 0, 0, 0.5) inset; } @@ -348,11 +359,6 @@ button[name="resetbutton"]:hover, border: none; } -// Caret. -.btn .caret { - border-top-color: [[setting:buttontextcolor]] !important; -} - // Message Drawer styles (moodle 3.6 and higher). // Hide messages drawer unused buttons. @@ -391,27 +397,42 @@ a.btn[data-toggle="popover"] { } // .btn-link styles. -.btn-link { - background-color: transparent; - color: [[setting:linkcolor]] !important; +.btn-link, +a.btn-link { + background-color: [[setting:buttoncolor]]; box-shadow: none; -} + color: [[setting:buttontextcolor]] !important; -.btn-link:hover, -.btn-link:focus { - background-color: transparent !important; - color: [[setting:linkhover]] !important; -} + &:hover, + :focus { + background-color: [[setting:buttonhovercolor]]; + color: [[setting:buttontexthovercolor]] !important; + } -.btn-link .icon { - margin-right: 0; -} + &.add-sections, + &.section-modchooser-link { + background-color: transparent; + color: [[setting:linkcolor]] !important; -.btn-link .menu-action-text .icon { - margin-top: 8px; -} + &:hover, + :focus { + background-color: transparent; + color: [[setting:linkhover]] !important; + } + } + &.text-reset { + color: [[setting:buttontextcolor]] !important; + } + .icon { + margin-right: 0; + } + + .menu-action-text .icon { + margin-top: 8px; + } +} .discussiontoggle { padding: 10px; diff --git a/scss/settings/course.scss b/scss/settings/course.scss index 9a78252..a3d8a33 100644 --- a/scss/settings/course.scss +++ b/scss/settings/course.scss @@ -33,7 +33,7 @@ } #coursetitle, -#sitetitle #coursetitle { +#headertitle #coursetitle { color: [[setting:fonttitlecolorcourse]]; } diff --git a/scss/settings/extras.scss b/scss/settings/extras.scss index cc4fa11..3770eb0 100644 --- a/scss/settings/extras.scss +++ b/scss/settings/extras.scss @@ -508,7 +508,7 @@ ul.teachers { background-image: none; background-color: [[setting:buttonhovercolor]]; box-shadow: 0 -2px 0 0 rgba(0, 0, 0, 0.5) inset; - color: [[setting:buttontextcolor]] !important; + color: [[setting:buttontexthovercolor]] !important; } .box { diff --git a/scss/settings/header.scss b/scss/settings/header.scss new file mode 100644 index 0000000..22fc5aa --- /dev/null +++ b/scss/settings/header.scss @@ -0,0 +1,41 @@ +// +// This file is part of Moodle - http://moodle.org/ +// +// Moodle is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// Moodle is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with Moodle. If not, see . +// +// +// Adaptable Header Style sheet +// +// @package theme_adaptable +// @copyright © 2024 - G J Barnard +// @author G J Barnard - {@link http://moodle.org/user/profile.php?id=442195} +// @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later +// + +.headerbgimage { + color: [[setting:headerbgimagetextcolour]]; + + .headersearch .btn, + #headertitle, + #headertitle a, + #headertitle p, + #headertitle h1, + #headertitle h2, + #headertitle h3, + #headertitle h4, + #headertitle h5, + #headertitle h6 { + color: [[setting:headerbgimagetextcolour]]; + } +} diff --git a/scss/settings/menu.scss b/scss/settings/menu.scss index 455d4fa..f9a17f7 100644 --- a/scss/settings/menu.scss +++ b/scss/settings/menu.scss @@ -75,6 +75,10 @@ transition: all [[setting:navbardropdowntransitiontime]]; } +#adaptable-page-header-wrapper #main-navbar .navbar-nav { + margin-left: -[[setting:menufontpadding]]; +} + #adaptable-page-header-wrapper .dropdown-menu ul { margin: 0; padding: 0; @@ -309,6 +313,16 @@ color: [[setting:navbardropdowntexthovercolor]]; } +// Add dropdown menu items styles for each theme color (mantainning default hover colour for contrast). +@each $color, $value in $theme-colors { + .dropdown-item.text-#{$color} { + color: $value; + &:hover { + color: [[setting:navbardropdowntexthovercolor]] !important; /* stylelint-disable-line declaration-no-important */ + } + } +} + .dropdown-item:focus-within a { color: [[setting:navbardropdowntexthovercolor]]; } @@ -447,8 +461,13 @@ margin-right: 0; } -#adaptable-page-header-wrapper #main-navbar .nav-item .nav-link .fa:not(.sections-menu) { - margin-right: 2px; +#adaptable-page-header-wrapper #main-navbar .nav-item { + .nav-link .fa:not(.sections-menu) { + margin-right: 2px; + } + &:first-of-type .nav-link .fa:not(.sections-menu) { + margin-left: 2px; + } } #adaptable-page-header-wrapper #main-navbar .nav-item .fa-circle { diff --git a/scss/settings/responsive.scss b/scss/settings/responsive.scss index cf9e026..523940b 100644 --- a/scss/settings/responsive.scss +++ b/scss/settings/responsive.scss @@ -131,8 +131,8 @@ margin: 0 auto; } - // Site title. - #sitetitle { + // Header title. + #headertitle { clear: both; display: block; height: auto; diff --git a/scss/settings/search.scss b/scss/settings/search.scss index 251fee9..811f2a2 100644 --- a/scss/settings/search.scss +++ b/scss/settings/search.scss @@ -23,23 +23,20 @@ // .headersearch { - color: [[setting:fonttitlecolor]]; padding: [[setting:searchboxpadding]]; + .btn { + color: [[setting:headertextcolor2]]; + } } -.headersearch .btn-close, -.navbarsearchsocial .btn-close { - border-width: 0; -} - -.headersearch .btn-open { - border-radius: 0; - color: [[setting:fonttitlecolorcourse]]; -} - -.headersearch .btn, -.navbarsearchsocial .btn { - box-shadow: none; +.headersearch, +.navbarsearchsocial { + .btn { + box-shadow: none; + } + .btn-close { + border-width: 0; + } } #adaptable-page-header-wrapper #header2 a.btn-open i { diff --git a/settings/array_definitions.php b/settings/array_definitions.php index 70139de..aaa1af4 100644 --- a/settings/array_definitions.php +++ b/settings/array_definitions.php @@ -285,7 +285,7 @@ // Fonts and Google ones. $fontlist = [ - 'sans-serif' => new lang_string('fontdefault', 'theme_adaptable'), + 'default' => new lang_string('fontdefault', 'theme_adaptable'), 'ABeeZee' => 'ABeeZee', 'Abel' => 'Abel', 'Abhaya Libre' => 'Abhaya Libre', diff --git a/settings/buttons.php b/settings/buttons.php index 985475a..6f79c97 100644 --- a/settings/buttons.php +++ b/settings/buttons.php @@ -61,6 +61,15 @@ $setting->set_updatedcallback('theme_reset_all_caches'); $page->add($setting); + // Buttons text hover color. + $name = 'theme_adaptable/buttontexthovercolor'; + $title = get_string('buttontexthovercolor', 'theme_adaptable'); + $description = get_string('buttontexthovercolordesc', 'theme_adaptable'); + $previewconfig = null; + $setting = new admin_setting_configcolourpicker($name, $title, $description, '#eeeeee', $previewconfig); + $setting->set_updatedcallback('theme_reset_all_caches'); + $page->add($setting); + // Buttons focus color. $name = 'theme_adaptable/buttonfocuscolor'; $title = get_string('buttonfocuscolor', 'theme_adaptable'); diff --git a/settings/category_headers.php b/settings/category_headers.php index 072e5d9..7c5de6e 100644 --- a/settings/category_headers.php +++ b/settings/category_headers.php @@ -105,6 +105,25 @@ $setting = new admin_setting_configstoredfile($name, $title, $description, 'categoryheaderbgimage' . $customheaderid); $page->add($setting); + // Background image text colour. + $name = 'theme_adaptable/categoryheaderbgimagetextcolour' . $customheaderid; + $title = get_string('categoryheaderbgimagetextcolour', 'theme_adaptable', ['id' => $customheaderid, + 'name' => $catinfo['name'], ]); + $previewconfig = null; + if (empty($catinfo['children'])) { + $description = get_string('categoryheaderbgimagetextcolourdesc', 'theme_adaptable', ['id' => $customheaderid, + 'name' => $catinfo['name'], ]); + } else { + $description = get_string( + 'categoryheaderbgimagetextcolourdescchildren', + 'theme_adaptable', + ['id' => $customheaderid, 'name' => $catinfo['name'], 'children' => $childrentext] + ); + } + $setting = new admin_setting_configcolourpicker($name, $title, $description, '#ffffff', $previewconfig); + $setting->set_updatedcallback('theme_reset_all_caches'); + $page->add($setting); + // Logo. $name = 'theme_adaptable/categoryheaderlogo' . $customheaderid; $title = get_string('categoryheaderlogo', 'theme_adaptable', ['id' => $customheaderid, diff --git a/settings/colors.php b/settings/colors.php index fe67ab4..806b3c9 100644 --- a/settings/colors.php +++ b/settings/colors.php @@ -178,6 +178,15 @@ $setting->set_updatedcallback('theme_reset_all_caches'); $page->add($setting); + // Bottom header text color. + $name = 'theme_adaptable/headertextcolor2'; + $title = get_string('headertextcolor2', 'theme_adaptable'); + $description = get_string('headertextcolor2desc', 'theme_adaptable'); + $previewconfig = null; + $setting = new admin_setting_configcolourpicker($name, $title, $description, '#ffffff', $previewconfig); + $setting->set_updatedcallback('theme_reset_all_caches'); + $page->add($setting); + // Market blocks colors heading. $name = 'theme_adaptable/settingsmarketingcolors'; $heading = get_string('settingsmarketingcolors', 'theme_adaptable'); diff --git a/settings/fonts.php b/settings/fonts.php index 845b389..85145c2 100644 --- a/settings/fonts.php +++ b/settings/fonts.php @@ -79,7 +79,7 @@ $name = 'theme_adaptable/fontname'; $title = get_string('fontname', 'theme_adaptable'); $description = get_string('fontnamedesc', 'theme_adaptable'); - $default = 'sans-serif'; + $default = 'default'; $setting = new admin_setting_configselect($name, $title, $description, $default, $fontlist); $setting->set_updatedcallback('theme_reset_all_caches'); $page->add($setting); @@ -157,7 +157,7 @@ $name = 'theme_adaptable/fontheadername'; $title = get_string('fontheadername', 'theme_adaptable'); $description = get_string('fontheadernamedesc', 'theme_adaptable'); - $default = 'sans-serif'; + $default = 'default'; $setting = new admin_setting_configselect($name, $title, $description, $default, $fontlist); $setting->set_updatedcallback('theme_reset_all_caches'); $page->add($setting); @@ -182,7 +182,7 @@ $name = 'theme_adaptable/fonttitlename'; $title = get_string('fonttitlename', 'theme_adaptable'); $description = get_string('fonttitlenamedesc', 'theme_adaptable'); - $default = 'sans-serif'; + $default = 'default'; $setting = new admin_setting_configselect($name, $title, $description, $default, $fontlist); $setting->set_updatedcallback('theme_reset_all_caches'); $page->add($setting); diff --git a/settings/header.php b/settings/header.php index 036e253..92e2edd 100644 --- a/settings/header.php +++ b/settings/header.php @@ -36,12 +36,21 @@ )); // Header image. - $name = 'theme_adaptable/headerbgimage'; // TODO - served by 'theme_adaptable_pluginfile'? + $name = 'theme_adaptable/headerbgimage'; $title = get_string('headerbgimage', 'theme_adaptable'); $description = get_string('headerbgimagedesc', 'theme_adaptable'); $setting = new admin_setting_configstoredfile($name, $title, $description, 'headerbgimage'); $page->add($setting); + // Header image text colour. + $name = 'theme_adaptable/headerbgimagetextcolour'; + $title = get_string('headerbgimagetextcolour', 'theme_adaptable'); + $description = get_string('headerbgimagetextcolourdesc', 'theme_adaptable'); + $previewconfig = null; + $setting = new admin_setting_configcolourpicker($name, $title, $description, '#ffffff', $previewconfig); + $setting->set_updatedcallback('theme_reset_all_caches'); + $page->add($setting); + // Select type of login. $name = 'theme_adaptable/displaylogin'; $title = get_string('displaylogin', 'theme_adaptable'); @@ -78,6 +87,18 @@ $page->add($setting); // Course page header title. + $name = 'theme_adaptable/coursepageheaderhidetitle'; + $title = get_string('coursepageheaderhidetitle', 'theme_adaptable'); + $description = get_string('coursepageheaderhidetitledesc', 'theme_adaptable'); + $existing = get_config('theme_adaptable', 'coursepageheaderhidesitetitle'); + if (!empty($existing)) { + $default = $existing; + } else { + $default = false; + } + $setting = new admin_setting_configcheckbox($name, $title, $description, $default); + $page->add($setting); + $name = 'theme_adaptable/coursepageheaderhidesitetitle'; $title = get_string('coursepageheaderhidesitetitle', 'theme_adaptable'); $description = get_string('coursepageheaderhidesitetitledesc', 'theme_adaptable'); @@ -123,16 +144,22 @@ $setting = new admin_setting_configselect($name, $title, $description, 'fullname', $radchoices); $page->add($setting); - // Display Breadcrumb or Course title where the breadcrumb normally is. - $name = 'theme_adaptable/breadcrumbdisplay'; - $title = get_string('breadcrumbdisplay', 'theme_adaptable'); - $description = get_string('breadcrumbdisplaydesc', 'theme_adaptable'); + // Display Course title. + $name = 'theme_adaptable/enablecoursetitle'; + $title = get_string('enablecoursetitle', 'theme_adaptable'); + $description = get_string('enablecoursetitledesc', 'theme_adaptable'); $radchoices = [ - 'breadcrumb' => get_string('breadcrumb', 'theme_adaptable'), 'fullname' => get_string('coursetitlefullname', 'theme_adaptable'), 'shortname' => get_string('coursetitleshortname', 'theme_adaptable'), + 'off' => get_string('hide'), ]; - $setting = new admin_setting_configselect($name, $title, $description, 'breadcrumb', $radchoices); + $existing = get_config('theme_adaptable', 'enableheading'); + if (!empty($existing)) { + $default = $existing; + } else { + $default = 'fullname'; + } + $setting = new admin_setting_configselect($name, $title, $description, $default, $radchoices); $page->add($setting); // Course Title Maximum Width. @@ -142,6 +169,18 @@ $setting = new admin_setting_configtext($name, $title, $description, '20', PARAM_INT); $page->add($setting); + // Display Breadcrumb or Course title where the breadcrumb normally is. + $name = 'theme_adaptable/breadcrumbdisplay'; + $title = get_string('breadcrumbdisplay', 'theme_adaptable'); + $description = get_string('breadcrumbdisplaydesc', 'theme_adaptable'); + $radchoices = [ + 'breadcrumb' => get_string('breadcrumb', 'theme_adaptable'), + 'fullname' => get_string('coursetitlefullname', 'theme_adaptable'), + 'shortname' => get_string('coursetitleshortname', 'theme_adaptable'), + ]; + $setting = new admin_setting_configselect($name, $title, $description, 'breadcrumb', $radchoices); + $page->add($setting); + // Breadcrumb home. $name = 'theme_adaptable/breadcrumbhome'; $title = get_string('breadcrumbhome', 'theme_adaptable'); diff --git a/settings/layout_responsive.php b/settings/layout_responsive.php index 0cd360b..48fa61f 100644 --- a/settings/layout_responsive.php +++ b/settings/layout_responsive.php @@ -77,6 +77,34 @@ $setting = new admin_setting_configselect($name, $title, $description, $default, $choices); $page->add($setting); + // Hide header title. + $name = 'theme_adaptable/responsiveheadertitle'; + $title = get_string('responsiveheadertitle', 'theme_adaptable'); + $description = get_string('responsiveheadertitledesc', 'theme_adaptable'); + $existing = get_config('theme_adaptable', 'responsivecoursetitle'); + if (!empty($existing)) { + $default = $existing; + } else { + $default = 'd-none d-lg-inline-block'; + } + $choices = $screensizeinlineblock; + $setting = new admin_setting_configselect($name, $title, $description, $default, $choices); + $page->add($setting); + + // Hide site title. + $name = 'theme_adaptable/responsivesitetitle'; + $title = get_string('responsivesitetitle', 'theme_adaptable'); + $description = get_string('responsivesitetitledesc', 'theme_adaptable'); + $existing = get_config('theme_adaptable', 'responsivecoursetitle'); + if (!empty($existing)) { + $default = $existing; + } else { + $default = 'd-none d-lg-inline-block'; + } + $choices = $screensizeinlineblock; + $setting = new admin_setting_configselect($name, $title, $description, $default, $choices); + $page->add($setting); + // Hide activity / section navigation. $name = 'theme_adaptable/responsivesectionnav'; $title = get_string('responsivesectionnav', 'theme_adaptable'); diff --git a/settings/marketing_blocks.php b/settings/marketing_blocks.php index f817560..f9757c0 100644 --- a/settings/marketing_blocks.php +++ b/settings/marketing_blocks.php @@ -61,6 +61,17 @@ $setting = new admin_setting_configcheckbox($name, $title, $description, $default, true, false); $page->add($setting); + $name = 'theme_adaptable/marketingvisible'; + $title = get_string('marketingvisible', 'theme_adaptable'); + $description = get_string('marketingvisibledesc', 'theme_adaptable'); + $options = [ + 1 => get_string('marketingvisibleloggedout', 'theme_adaptable'), + 2 => get_string('marketingvisibleloggedin', 'theme_adaptable'), + 3 => get_string('marketingvisibleloggedinout', 'theme_adaptable'), + ]; + $setting = new admin_setting_configselect($name, $title, $description, 3, $options); + $page->add($setting); + $name = 'theme_adaptable/frontpagemarketoption'; $title = get_string('frontpagemarketoption', 'theme_adaptable'); $description = get_string('frontpagemarketoptiondesc', 'theme_adaptable'); diff --git a/templates/footer.mustache b/templates/footer.mustache new file mode 100644 index 0000000..06b58dc --- /dev/null +++ b/templates/footer.mustache @@ -0,0 +1,89 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . + + @copyright 2024 G J Barnard + {@link https://moodle.org/user/profile.php?id=442195} + {@link https://gjbarnard.co.uk} + @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later. +}} +{{! + @template theme_adaptable/footer + + Footer. + + Example context (json): + { + } +}} +{{{output.standard_after_main_region_html}}} +
+ + {{#showfooterblocks}}{{{output.get_footer_blocks}}}{{/showfooterblocks}} + {{#socialicons}} +
+
+ +
+
+ {{/socialicons}} +
+
+
+
+ {{#footnote}} +
{{{footnote}}}
+ {{/footnote}} + {{#moodledocs}} + + {{/moodledocs}} +
{{{output.standard_footer_html}}}
+
+ {{#debug}} +
+
+ {{{debug}}} +
+
+ {{/debug}} +
+
+
+
+{{#savediscard}}{{{savediscard}}}{{/savediscard}} + +
{{! End #page. }} +
{{! End #page-wrapper. }} + +{{{output.standard_end_of_body_html}}} +{{#jssection}} +{{#js}} +{{{jssection}}} +{{/js}} +{{/jssection}} +{{#jssectionrestricted}}{{{jssectionrestricted}}}{{/jssectionrestricted}} +{{{output.get_all_tracking_methods}}} + + + +{{#js}} + M.util.js_pending('theme_boost/loader'); + require(['theme_boost/loader', 'theme_boost/drawer'], function(Loader, Drawer) { + Drawer.init(); + M.util.js_complete('theme_boost/loader'); + }); +{{/js}} diff --git a/templates/head.mustache b/templates/head.mustache new file mode 100644 index 0000000..95cc885 --- /dev/null +++ b/templates/head.mustache @@ -0,0 +1,70 @@ +{{! + This file is part of Moodle - http://moodle.org/ + + Moodle is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + Moodle is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Moodle. If not, see . +}} +{{! + @template theme_adaptable/head + + This template renders the head. + + Example context (json): + { + "sitefullname": "My site", + "pagetitle": "Denise Emma Bug", + "siteurl": "https://local.localhost/", + "maincolor": "#ffaabb" + } +}} +{{{ output.doctype }}} + + + {{{ output.page_title }}} + + {{{ output.standard_head_html }}} + + + + + + + + + + + + + + + + + + + + + + + {{#fontname}} + + + {{/fontname}} + {{#fontheadername}} + + + {{/fontheadername}} + {{#fonttitlename}} + + + {{/fonttitlename}} + \ No newline at end of file diff --git a/templates/headernavbar.mustache b/templates/headernavbar.mustache index 3563849..55a09e4 100644 --- a/templates/headernavbar.mustache +++ b/templates/headernavbar.mustache @@ -36,61 +36,65 @@ }}