Skip to content

Commit

Permalink
Version 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
hribeir0 committed Aug 31, 2023
1 parent c7ad8ad commit 4168793
Show file tree
Hide file tree
Showing 18 changed files with 229 additions and 25 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 1.2 - 2023-08-14
- [ADD]Option to show course name, shortname or no heading in the course index
- [FIX]Remove the Back (to quiz hall) Button while taking a quiz
- [ADD]Setting to control slider's opacity

## Version 1.1 - 2023-06-15
- [ADD]Category widget setting to show course total number per category
- [FIX]Login image height
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The usual workflow. Please set up available options for a better end result. In
- Ability to add blocks before main content on the course page (check my course presentation block) and homepage
- Course header image from the course setting (defaults to theme image)
- Course completion in the course header
- Course name/shortname in course index
- Quick admin menu
- Capability to change theme settings - not only admin
- Frontpage widgets (categories with images, promobox, featured courses, ...)
Expand Down
46 changes: 46 additions & 0 deletions classes/output/mod_quiz_renderer.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.

/**
* Plugin version and other meta-data are defined here.
*
* @package theme_stream
* @copyright 2023 Hugo Ribeiro <ribeiro.hugo@gmail.com>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later.
*/

namespace theme_stream\output;

use html_writer;

/**
* Override Mod Quiz renderer
*
* @package theme_stream
* @copyright 2023 Hugo Ribeiro <ribeiro.hugo@gmail.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class mod_quiz_renderer extends \mod_quiz\output\renderer {
/**
* Remove back button while taking a quiz
*
* @param string $quizviewurl
* @return string
*/
public function during_attempt_tertiary_nav($quizviewurl): string {
return '';
}
}
2 changes: 1 addition & 1 deletion classes/privacy/provider.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
* Stream theme original privacy class -
*
* @package theme_stream
* @category privacy class
* @category privacy
* @copyright 2023 Hugo Ribeiro <ribeiro.hugo@gmail.com>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
Expand Down
5 changes: 5 additions & 0 deletions lang/en/theme_stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -168,3 +168,8 @@
$string['privacy:metadata'] = 'Stream theme does not store any personal data about any user.';
$string['featuredcategoriessubtitle'] = 'Categories widget subtitle';
$string['featuredcategoriessubtitle_desc'] = 'A simple text to use as subtitle for the widget. Will show nothing if setting is empy.';
// End of Privacy API.
$string['courseindexheading'] = 'Show extra info in the course index.';
$string['courseindexheading_desc'] = 'Show course name or shortname as heading in the course index.';
$string['homepageheroopacity'] = 'Overlay opacity';
$string['homepageheroopacity_desc'] = 'Overlay opacity. 0 transparent, 10 solid dark gray';
2 changes: 2 additions & 0 deletions lang/pt/theme_stream.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,3 +164,5 @@
$string['jumptoslide'] = 'Ir para slide';
// Privacy API.
$string['privacy:metadata'] = 'O tema Stream não guarda qualquer dado pessoal sobre qualquer utilizador.';
$string['homepageheroopacity'] = 'Opacidade sobre a foto';
$string['homepageheroopacity_desc'] = 'Opacidade. 0 transparente, 10 cinzento escuro opaco';
15 changes: 13 additions & 2 deletions layout/course.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@
$header = $PAGE->activityheader;
$headercontent = $header->export_for_template($renderer);

$theme = theme_config::load('stream');


$templatecontext = [
'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
'output' => $OUTPUT,
Expand Down Expand Up @@ -123,10 +126,18 @@
// Include the content for scrollspy feature.
require_once(__DIR__ . '/includes/scrollspy.php');

$showcompletion = get_config('theme_stream', 'backtotopbutton');
if ($showcompletion) {
// Loads backtotop button. hribeiro dec2022.
$backtotopbutton = $theme->settings->backtotopbutton;
if ($backtotopbutton) {
$PAGE->requires->js_call_amd('theme_stream/backtotop', 'init');
}

// Check for the option to print a course index heading.
$courseindexheading = $theme->settings->courseindexheading;
if ($courseindexheading != 0) {
$templatecontext['courseindexheading'] = format_string($this->page->course->$courseindexheading);
} else {
$templatecontext['courseindexheading'] = null;
}

echo $OUTPUT->render_from_template('theme_stream/course', $templatecontext);
13 changes: 11 additions & 2 deletions layout/drawers.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
$header = $PAGE->activityheader;
$headercontent = $header->export_for_template($renderer);

$theme = theme_config::load('stream');
$templatecontext = [
'sitename' => format_string($SITE->shortname, true, ['context' => context_course::instance(SITEID), "escape" => false]),
'output' => $OUTPUT,
Expand Down Expand Up @@ -116,9 +117,17 @@
require_once(__DIR__ . '/includes/scrollspy.php');

// Loads backtotop button. hribeiro dec2022.
$showcompletion = get_config('theme_stream', 'backtotopbutton');
if ($showcompletion) {
$backtotopbutton = $theme->settings->backtotopbutton;
if ($backtotopbutton) {
$PAGE->requires->js_call_amd('theme_stream/backtotop', 'init');
}

// Check for the option to print a course index heading.
$courseindexheading = $theme->settings->courseindexheading;
if ($courseindexheading != 0) {
$templatecontext['courseindexheading'] = format_string($this->page->course->$courseindexheading);
} else {
$templatecontext['courseindexheading'] = null;
}

echo $OUTPUT->render_from_template('theme_stream/drawers', $templatecontext);
6 changes: 5 additions & 1 deletion lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ function theme_stream_get_pre_scss($theme) {
'modiconcolorcommunication' => ['communication'],
'modiconcolorcontent' => ['content'],
'modiconcolorinterface' => ['interface'],

'homepageheroopacity0' => ['slider0-opacity'],
'homepageheroopacity1' => ['slider1-opacity'],
'homepageheroopacity2' => ['slider2-opacity'],
'homepageheroopacity3' => ['slider3-opacity'],
'homepageheroopacity4' => ['slider4-opacity'],
];

// Prepend variables first.
Expand Down
30 changes: 22 additions & 8 deletions scss/_incourse.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,26 @@
}
}
// Course index section spacing
.drawer-left .drawercontent {
.courseindex-section {
margin-bottom: 5px;
background-color: $gray-100;
.drawer-left {
.drawerheader {
.courseindexheading {
margin: 0 auto;
font-weight: bold;
}
.drawertoggle {
position: absolute;
right: 0;
}
}
.courseindex {
background-color: $white;
padding-right: 0;
.drawercontent {
.courseindex-section {
margin-bottom: 5px;
background-color: $gray-100;
}
.courseindex {
background-color: $white;
padding-right: 0;
}
}
}
// Fix Bulk Select position.
Expand All @@ -28,7 +40,9 @@
position: relative;
width: 0;
}

@media (max-width: 768px) {
.bulkenabled .course-content {
margin-left: 1.2rem; }
margin-left: 1.2rem;
}
}
16 changes: 15 additions & 1 deletion scss/_interface.scss
Original file line number Diff line number Diff line change
Expand Up @@ -270,9 +270,23 @@ header {
position: absolute;
width: 100%;
height: 100%;
background: #1d1d1d75;
top: 0;
}
.slide0 {
background: rgba($gray-900, $slider0-opacity);
}
.slide1 {
background: rgba($gray-900, $slider1-opacity);
}
.slide2 {
background: rgba($gray-900, $slider2-opacity);
}
.slide3 {
background: rgba($gray-900, $slider3-opacity);
}
.slide4 {
background: rgba($gray-900, $slider4-opacity);
}
.carousel-caption {
position: relative;
left: initial;
Expand Down
13 changes: 13 additions & 0 deletions settings/coursesettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,19 @@
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);

// Show ourse name/shortname in course index.
$choices = [
0 => 'No extra info',
'fullname' => 'Fullname',
'shortname' => 'Shortname'
];
$name = 'theme_stream/courseindexheading';
$title = get_string('courseindexheading', 'theme_stream');
$description = get_string('courseindexheading_desc', 'theme_stream');
$setting = new admin_setting_configselect($name, $title, $description, 'shortname', $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);

// Header logo setting.
$name = 'theme_stream/courseheaderimg';
$title = get_string('courseheaderimg', 'theme_stream');
Expand Down
24 changes: 22 additions & 2 deletions settings/frontpagesettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,31 @@
$setting->set_updatedcallback('theme_reset_all_caches');
$page->add($setting);

// Overlay Opacity.
$name = 'theme_stream/homepageheroopacity' . $i;
$title = get_string('homepageheroopacity', 'theme_stream') . $i;
$description = get_string('homepageheroopacity_desc', 'theme_stream');
$choices = [
'0' => '0',
'0.1' => '1',
'0.2' => '2',
'0.3' => '3',
'0.4' => '4',
'0.5' => '5',
'0.6' => '6',
'0.7' => '7',
'0.8' => '8',
'0.9' => '9',
'1' => '10',
];
$setting = new admin_setting_configselect($name, $title, $description, '0.5', $choices);
$setting->set_updatedcallback('theme_reset_all_caches');
$settings->hide_if('theme_stream/catwidgetcolumns', 'theme_stream/catwidget', 'notchecked');
$page->add($setting);

$i++;
}



// Cat Widget heading.
$page->add(new admin_setting_heading('theme_stream/catwidgetheading', get_string('catwidgetheading', 'theme_stream'), ''));

Expand Down
5 changes: 3 additions & 2 deletions templates/course.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@

{{> theme_boost/navbar }}
{{#courseindex}}
{{< theme_boost/drawer }}

{{< theme_stream/partials/drawer }}
{{$id}}theme_boost-drawers-courseindex{{/id}}
{{$drawerclasses}}drawer drawer-left {{#courseindexopen}}show{{/courseindexopen}}{{/drawerclasses}}
{{$drawercontent}}
Expand All @@ -72,7 +73,7 @@
{{$drawerstate}}show-drawer-left{{/drawerstate}}
{{$tooltipplacement}}right{{/tooltipplacement}}
{{$closebuttontext}}{{#str}}closecourseindex, core{{/str}}{{/closebuttontext}}
{{/ theme_boost/drawer}}
{{/ theme_stream/partials/drawer}}
{{/courseindex}}
{{#hasblocks}}
{{< theme_boost/drawer }}
Expand Down
4 changes: 2 additions & 2 deletions templates/drawers.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

{{> theme_boost/navbar }}
{{#courseindex}}
{{< theme_boost/drawer }}
{{< theme_stream/partials/drawer }}
{{$id}}theme_boost-drawers-courseindex{{/id}}
{{$drawerclasses}}drawer drawer-left {{#courseindexopen}}show{{/courseindexopen}}{{/drawerclasses}}
{{$drawercontent}}
Expand All @@ -69,7 +69,7 @@
{{$drawerstate}}show-drawer-left{{/drawerstate}}
{{$tooltipplacement}}right{{/tooltipplacement}}
{{$closebuttontext}}{{#str}}closecourseindex, core{{/str}}{{/closebuttontext}}
{{/ theme_boost/drawer}}
{{/ theme_stream/partials/drawer}}
{{/courseindex}}
{{#hasblocks}}
{{< theme_boost/drawer }}
Expand Down
59 changes: 59 additions & 0 deletions templates/partials/drawer.mustache
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{!
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 <http://www.gnu.org/licenses/>.
}}
{{!
@template theme_boost/drawer
Example context (json):
{
"drawerclasses": "drawer drawer-right",
"drawertrigger": "toggleblocks",
"tooltipplacement": "right",
"drawerconent": "Content for the blocks region",
"closebuttontext": "Close drawer",
"id": "5"
}
}}
<div {{!
}} class="{{$drawerclasses}}{{/drawerclasses}} d-print-none not-initialized"{{!
}} data-region="fixed-drawer"{{!
}} id="{{$id}}{{/id}}"{{!
}} data-preference="{{$drawerpreferencename}}{{/drawerpreferencename}}"{{!
}} data-state="{{$drawerstate}}{{/drawerstate}}"{{!
}} data-forceopen="{{$forceopen}}0{{/forceopen}}"{{!
}} data-close-on-resize="{{$drawercloseonresize}}0{{/drawercloseonresize}}"{{!
}}>
<div class="drawerheader">
<span class="p-4 courseindexheading">{{courseindexheading}}</span>
<button
class="btn drawertoggle icon-no-margin hidden"
data-toggler="drawers"
data-action="closedrawer"
data-target="{{$id}}{{/id}}"
data-toggle="tooltip"
data-placement="{{$tooltipplacement}}right{{/tooltipplacement}}"
title="{{$closebuttontext}}{{#str}}closedrawer, core{{/str}}{{/closebuttontext}}"
>
{{#pix}} e/cancel, core {{/pix}}
</button>
</div>
<div class="drawercontent drag-container" data-usertour="scroller">
{{$drawercontent}}{{/drawercontent}}
</div>
</div>
{{#js}}
require(['theme_boost/drawers']);
{{/js}}
4 changes: 2 additions & 2 deletions templates/partials/main_slider.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
<div class="carousel-inner">
{{#slides}}
<div class="carousel-item {{#active}}active{{/active}}">
<img class="d-block w-100" src="{{{sliderimage}}}" alt="First slide">
<div class="overlay">
<img class="d-block w-100" src="{{{sliderimage}}}" alt="Slide {{index}} image">
<div class="overlay slide{{index}}">
<div class="container">
<div class="carousel-caption d-none d-md-block">
<h1 class="display-4">{{herotitle}}</h1>
Expand Down
Loading

0 comments on commit 4168793

Please sign in to comment.