diff --git a/config.php b/config.php index c0b56ef8..0856c21e 100644 --- a/config.php +++ b/config.php @@ -37,14 +37,14 @@ $THEME->sheets[] = 'moodle-rtl'; $THEME->sheets[] = 'bootstrap-pix'; $THEME->sheets[] = 'moodle-pix'; +$THEME->sheets[] = 'essential'; $THEME->sheets[] = 'essential-pix'; $THEME->sheets[] = 'essential-settings'; $THEME->sheets[] = 'fontawesome'; if ((get_config('theme_essential', 'enablealternativethemecolors1')) || (get_config('theme_essential', 'enablealternativethemecolors2')) || - (get_config('theme_essential', 'enablealternativethemecolors3')) -) { + (get_config('theme_essential', 'enablealternativethemecolors3'))) { $THEME->sheets[] = 'essential-alternative'; } diff --git a/lang/en/theme_essential.php b/lang/en/theme_essential.php index a5d63e30..7dec54c6 100644 --- a/lang/en/theme_essential.php +++ b/lang/en/theme_essential.php @@ -588,3 +588,13 @@ $string['blogpreferences'] = 'Blog preferences'; $string['badgepreferences'] = 'Badge preferences'; $string['messagepreferences'] = 'Message preferences'; + +// Slide show size +$string['slidesize'] = 'Slide show size'; +$string['slidesizedesc'] = 'The height of the slide show. Full corresponds to 368 pixel at full screen, Very small corresonds fo 36 pixel at full screen'; +$string['slide10percent'] = 'Very small'; +$string['slide25percent'] = 'Small'; +$string['slide50percent'] = 'Medium'; +$string['slide75percent'] = 'Big'; +$string['slide100percent'] = 'Full'; + diff --git a/layout/includes/guniversal.php b/layout/includes/guniversal.php index 9e6a9e87..f9840c79 100644 --- a/layout/includes/guniversal.php +++ b/layout/includes/guniversal.php @@ -93,7 +93,7 @@ function insert_analytics_tracking() })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', '" . $trackingid . "', {'siteSpeedSampleRate': 50}); ga('send', " . $addition . "); - + "; } diff --git a/less/essential/carousel.less b/less/essential/carousel.less index e6aaae41..1a5c9daa 100644 --- a/less/essential/carousel.less +++ b/less/essential/carousel.less @@ -1 +1 @@ -/* @group Carousel */ #essentialCarousel.carousel { margin-bottom: 10px; .carousel-inner { > .item { .carousel-image-container { text-align: center; width: 90%; padding-left: 5%; padding-right: 5%; } .carousel-image { width: auto; margin: 0 auto; margin-top: 8px; height: auto; max-height: 300px; vertical-align: middle; // See: http://www.vanseodesign.com/css/vertical-centering/. max-width: 100%; } &.side-caption { div.the-side-caption { padding-left: 7%; } } &.side-caption .carousel-image { box-shadow: 0px 0px 8px #222; padding: 8px; background-color: #fff; margin-left: -8px; } } a, a:hover, a:active { text-decoration: none; height: 100%; } // Caption for text below images. .carousel-caption { border-radius: @baseBorderRadius + 2; .carousel-caption-inner { margin: 0 auto; } h4, p { padding: 0px 20px; } p { line-height: 1; } } &.centred { .carousel-caption, div.the-side-caption { text-align: center; } } } // Left/right controls for nav. .carousel-control { display: none; // Shown when carousel hovered on, see below. background: none; border: 0px; font-size: 30px; &:hover, &:focus { background: none; border: 0px; } } &:hover .carousel-control{ display: block; } .carousel-indicators { border-radius: @baseBorderRadius; padding-right: 5px; padding-top: 2px; padding-bottom: 2px; background-color: #fff; background-color: rgba(255, 255, 255, .50); right: 5px; } // Responsive. .carousel-inner { > .item { &.side-caption { div.the-side-caption { h4 { font-size: 14px; line-height: 1; } p { font-size: 10px; line-height: 1; } } } } } // @screen-xs-min. @media(min-width: 480px) { .carousel-inner { > .item { &.side-caption { div.the-side-caption { h4 { font-size: 16px; } p { font-size: 12px; } } } } } .carousel-control { font-size: 36px; } } @media (max-width: 767px) { .carousel-inner { > .item { height: 200px; .carousel-image-container { line-height: 200px; // See: http://www.vanseodesign.com/css/vertical-centering/. } .carousel-image { max-height: 165px; } .carousel-caption { position: absolute; h4 { font-size: 1.2em; } } } > .item.side-caption { div.the-side-caption { padding-left: 0; } div.nocaption { margin-top: 6.5%; } } &.below > .item, > .item.side-caption { height: 280px; .carousel-caption { height: 45px; } .carousel-image-container.nocaption { line-height: 280px; } } } } // @screen-sm-min. @media(min-width: 768px) { .carousel-inner { > .item { height: 260px; .carousel-image-container { line-height: 260px; } .carousel-image { max-height: 225px; } &.side-caption { div.the-side-caption { // Variation on: http://css-tricks.com/centering-in-the-unknown/. height: 260px; // Addition to technique. &:before { content: ''; display: inline-block; height: 100%; vertical-align: middle; margin-right: -0.25em; /* Adjusts for spacing */ } .the-side-caption-content { display: inline-block; vertical-align: middle; width: 100%; } h4 { font-size: 20px; } p { font-size: 14px; } } } } &.below > .item { height: 345px; .carousel-caption { height: 55px; } .carousel-image-container.nocaption { line-height: 345px; } } } .carousel-control { font-size: 40px; } } @media (min-width: 768px) and (max-width: 979px) { .carousel-inner { > .item { .carousel-caption { h4 { font-size: 1.2em; } } } } } // @screen-md-min. @media(min-width: 992px) { .carousel-inner { > .item { height: 328px; .carousel-image-container { line-height: 328px; } .carousel-image { max-height: 293px; } &.side-caption { div.the-side-caption { height: 328px; // Addition to technique. h4 { font-size: 26px; } p { font-size: 18px; } } } } &.below > .item { height: 428px; .carousel-caption { height: 65px; } .carousel-image-container.nocaption { line-height: 428px; } } } .carousel-control { font-size: 50px; } } // @screen-lg-min. @media(min-width: 1200px) { .carousel-inner { > .item { height: 368px; .carousel-image-container { line-height: 368px; } .carousel-image { max-height: 333px; } &.side-caption { div.the-side-caption { height: 368px; // Addition to technique. h4 { font-size: 32px; } p { font-size: 20px; } } } } &.below > .item { height: 468px; .carousel-image-container.nocaption { line-height: 468px; } } } .carousel-control { font-size: 60px; } } } /* @end */ \ No newline at end of file +/* @group Carousel */ #essentialCarousel.carousel { margin-bottom: 10px; .carousel-inner { > .item { .carousel-image-container { text-align: center; width: 90%; padding-left: 5%; padding-right: 5%; } .carousel-image { width: auto; margin: 0 auto; margin-top: 8px; height: auto; max-height: 300px; vertical-align: middle; // See: http://www.vanseodesign.com/css/vertical-centering/. max-width: 100%; } &.side-caption { div.the-side-caption { padding-left: 7%; } } &.side-caption .carousel-image { box-shadow: 0px 0px 8px #222; padding: 8px; background-color: #fff; margin-left: -8px; } } a, a:hover, a:active { text-decoration: none; height: 100%; } // Caption for text below images. .carousel-caption { border-radius: @baseBorderRadius + 2; .carousel-caption-inner { margin: 0 auto; } h4, p { padding: 0px 20px; } p { line-height: 1; } } &.centred { .carousel-caption, div.the-side-caption { text-align: center; } } } // Left/right controls for nav. .carousel-control { display: none; // Shown when carousel hovered on, see below. background: none; border: 0px; font-size: 30px; &:hover, &:focus { background: none; border: 0px; } } &:hover .carousel-control{ display: block; } .carousel-indicators { border-radius: @baseBorderRadius; padding-right: 5px; padding-top: 2px; padding-bottom: 2px; background-color: #fff; background-color: rgba(255, 255, 255, .50); right: 5px; } // Responsive. .carousel-inner { > .item { &.side-caption { div.the-side-caption { h4 { font-size: 14px; line-height: 1; } p { font-size: 10px; line-height: 1; } } } } } // @screen-xs-min. @media(min-width: 480px) { .carousel-inner { > .item { &.side-caption { div.the-side-caption { h4 { font-size: 16px; } p { font-size: 12px; } } } } } .carousel-control { font-size: 36px; } } @media (max-width: 767px) { .carousel-inner { > .item { height: [[setting:slidesize_case1]]; .carousel-image-container { line-height: [[setting:slidesize_case1]]; // See: http://www.vanseodesign.com/css/vertical-centering/. } .carousel-image { max-height: [[setting:slidesize_case1_90percent]]; } .carousel-caption { position: absolute; h4 { font-size: 1.2em; } } } > .item.side-caption { div.the-side-caption { padding-left: 0; } div.nocaption { margin-top: 6.5%; } } &.below > .item, > .item.side-caption { height: [[setting:slidesize_case1_135percent]]; .carousel-caption { height: 45px; } .carousel-image-container.nocaption { line-height: [[setting:slidesize_case1_135percent]]; } } } } // @screen-sm-min. @media(min-width: 768px) { .carousel-inner { > .item { height: [[setting:slidesize_case2]]; .carousel-image-container { line-height: [[setting:slidesize_case2]]; } .carousel-image { max-height: [[setting:slidesize_case2_90percent]]; } &.side-caption { div.the-side-caption { // Variation on: http://css-tricks.com/centering-in-the-unknown/. height: [[setting:slidesize_case2]]; // Addition to technique. &:before { content: ''; display: inline-block; height: 100%; vertical-align: middle; margin-right: -0.25em; /* Adjusts for spacing */ } .the-side-caption-content { display: inline-block; vertical-align: middle; width: 100%; } h4 { font-size: 20px; } p { font-size: 14px; } } } } &.below > .item { height: [[setting:slidesize_case2_135percent]]; .carousel-caption { height: 55px; } .carousel-image-container.nocaption { line-height: [[setting:slidesize_case2_135percent]]; } } } .carousel-control { font-size: 40px; } } @media (min-width: 768px) and (max-width: 979px) { .carousel-inner { > .item { .carousel-caption { h4 { font-size: 1.2em; } } } } } // @screen-md-min. @media(min-width: 992px) { .carousel-inner { > .item { height: [[setting:slidesize_case3]]; .carousel-image-container { line-height: [[setting:slidesize_case3]]; } .carousel-image { max-height: [[setting:slidesize_case3_90percent]]; } &.side-caption { div.the-side-caption { height: [[setting:slidesize_case3]]; // Addition to technique. h4 { font-size: 26px; } p { font-size: 18px; } } } } &.below > .item { height: [[setting:slidesize_case4_135percent]]; .carousel-caption { height: 65px; } .carousel-image-container.nocaption { line-height: [[setting:slidesize_case4_135percent]]; } } } .carousel-control { font-size: 50px; } } // @screen-lg-min. @media(min-width: 1200px) { .carousel-inner { > .item { height: [[setting:slidesize_case4]]; .carousel-image-container { line-height: [[setting:slidesize_case4]]; } .carousel-image { max-height: [[setting:slidesize_case4_90percent]]; } &.side-caption { div.the-side-caption { height: [[setting:slidesize_case4]]; // Addition to technique. h4 { font-size: 32px; } p { font-size: 20px; } } } } &.below > .item { height: [[setting:slidesize_case4_135percent]]; .carousel-image-container.nocaption { line-height: [[setting:slidesize_case4_135percent]]; } } } .carousel-control { font-size: 60px; } } } /* @end */ \ No newline at end of file diff --git a/lib.php b/lib.php index eb5aa9d1..285f3bea 100644 --- a/lib.php +++ b/lib.php @@ -389,6 +389,55 @@ function theme_essential_hex2rgba($hex, $opacity) { return "rgba($r, $g, $b, $opacity)"; } +/** + * theme_essential_set_slide_size + * + * @param string $css The original CSS. + * @param string $slideheight The slide height in percent. + * @return string The modified CSS. + */ +function theme_essential_set_slide_size($css, $slidesize) { +// global $CFG; + + if ($slidesize > 100) { + $slidesize = 100; + } + + $slidesize /= 100; + + $cases = range(1, 4); + foreach ($cases as $case) { + $tagbase = '[[setting:slidesize_case'."$case"; + switch ($case) { + case 1: + $slideheight = $slidesize * 200; + break; + case 2: + $slideheight = $slidesize * 260; + break; + case 3: + $slideheight = $slidesize * 328; + break; + case 4: + $slideheight = $slidesize * 368; + break; + } + $tag = $tagbase.']]'; + $replacement = intval($slideheight); + $css = str_replace($tag, $replacement . 'px', $css); + + $tag = $tagbase.'_90percent]]'; + $replacement = intval($slideheight * 0.9); + $css = str_replace($tag, $replacement . 'px', $css); + + $tag = $tagbase.'_135percent]]'; + $replacement = intval($slideheight * 1.35); + $css = str_replace($tag, $replacement . 'px', $css); + } + + return $css; +} + /** * Adds any custom CSS to the CSS before it is cached. * @@ -417,6 +466,10 @@ function theme_essential_process_css($css, $theme) { $css = theme_essential_set_fontfiles($css, 'heading', $headingfont); $css = theme_essential_set_fontfiles($css, 'body', $bodyfont); + // Set the slide size. + $slidesize = theme_essential_get_setting('slidesize'); + $css = theme_essential_set_slide_size($css, $slidesize); + // Set the theme colour. $themecolor = theme_essential_get_setting('themecolor'); $css = theme_essential_set_color($css, $themecolor, '[[setting:themecolor]]', '#30ADD1'); diff --git a/renderers/core_renderer.php b/renderers/core_renderer.php index d23ad4d5..63379664 100644 --- a/renderers/core_renderer.php +++ b/renderers/core_renderer.php @@ -1309,7 +1309,7 @@ public function render_slide($i, $captionoptions, $theme = null) { if ($captionoptions == 0) { $slide .= '