Skip to content

Commit

Permalink
Merge pull request #213 from trema-tech/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
rmady authored Dec 12, 2024
2 parents 3ce910f + 592ddd5 commit 08e350f
Show file tree
Hide file tree
Showing 6 changed files with 79 additions and 50 deletions.
48 changes: 48 additions & 0 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -337,3 +337,51 @@ function theme_trema_pluginfile($course, $cm, $context, $filearea, $args, $force
send_file_not_found();
}
}


/**
* MoodlePage init for adding classes to body tag.
*
* @param moodle_page $page
* @throws coding_exception
*/
function theme_trema_page_init(moodle_page $page) {
global $COURSE, $USER;

// Add admin classes.
$page->add_body_class(is_siteadmin() ? "is_siteadmin" : "not_siteadmin");

// Add module idnumber class.
if (in_array($page->pagelayout, ['incourse']) && !empty($page->cm->idnumber)) {
$page->add_body_class("idnumber-{$page->cm->idnumber}");
}

// Add role classes.
if (in_array($page->pagelayout, ['course', 'incourse'])) {
$context = context_course::instance($COURSE->id);
if (user_has_role_assignment($USER->id, 5, $context->id)) {
$page->add_body_class('is_student');
}
if (user_has_role_assignment($USER->id, 4, $context->id)) {
$page->add_body_class('is_teacher');
}
if (user_has_role_assignment($USER->id, 3, $context->id)) {
$page->add_body_class('is_editingteacher');
}
}

// Show Login form if URL parameters include saml=off or auth=manual.
if (optional_param('saml', '', PARAM_ALPHA) === 'off' || optional_param('auth', '', PARAM_ALPHA) === 'manual') {
$page->add_body_class('local-login');
}

// Load course style by shortname from: /style/course/$shortname.css.
if ($COURSE->id > 1) {
$shortname = explode('|', $COURSE->shortname);
$shortname = trim($shortname[0]);
$coursestyle = "/style/course/{$shortname}.css";
if (file_exists($page->theme->dir.$coursestyle)) {
$page->requires->css(new moodle_url("/theme/trema{$coursestyle}"));
}
}
}
43 changes: 0 additions & 43 deletions locallib.php
Original file line number Diff line number Diff line change
Expand Up @@ -231,46 +231,3 @@ function theme_trema_setting_file_url($setting, $filearea, $theme) {

return $url;
}


/**
* MoodlePage init for adding classes to body tag.
*
* @param moodle_page $page
* @throws coding_exception
*/
function theme_trema_page_init(moodle_page $page) {
global $COURSE, $USER;

// Add admin classes.
$page->add_body_class(is_siteadmin() ? "is_siteadmin" : "not_siteadmin");

// Add module idnumber class.
if (in_array($page->pagelayout, ['incourse']) && !empty($page->cm->idnumber)) {
$page->add_body_class("idnumber-{$page->cm->idnumber}");
}

// Add role classes.
if (in_array($page->pagelayout, ['course', 'incourse'])) {
$context = context_course::instance($COURSE->id);
if (user_has_role_assignment($USER->id, 5, $context->id)) {
$page->add_body_class('is_student');
}
if (user_has_role_assignment($USER->id, 4, $context->id)) {
$page->add_body_class('is_teacher');
}
if (user_has_role_assignment($USER->id, 3, $context->id)) {
$page->add_body_class('is_editingteacher');
}
}

// Load course style by shortname from: /style/course/$shortname.css.
if ($COURSE->id > 1) {
$shortname = explode('|', $COURSE->shortname);
$shortname = trim($shortname[0]);
$coursestyle = "/style/course/{$shortname}.css";
if (file_exists($page->theme->dir.$coursestyle)) {
$page->requires->css(new moodle_url("/theme/trema{$coursestyle}"));
}
}
}
4 changes: 2 additions & 2 deletions scss/trema/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ footer#page-footer {
}

.performanceinfo {
background-color: $black;
color: $white;
background-color: $footer-bg-color;
color: choose-contrast-color($footer-bg-color);
table.table {
width: 100% !important;
th {
Expand Down
21 changes: 21 additions & 0 deletions scss/trema/login.scss
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,24 @@ body#page-admin-tool-mfa-auth {
}
}
}

body.local-login {
#login,
.loginform {
.login-form,
.login-form-forgotpassword,
.form-group {
display: block !important;
}
}
}

// Adjust form label and field alignment on small screens.
@media only screen and (max-width: 560px) {
body #page .signupform .form-group.row.fitem {
display: block;
}
body #page .signupform .form-group.row.fitem .col-form-label {
max-width: 100%!important;
}
}
9 changes: 6 additions & 3 deletions scss/trema/report.scss
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ body.path-admin-tool-spamcleaner {
background-color: transparent;
}
}
.table-dynamic {
overflow-x: auto;
}
.reportbuilder-sidebar-menu-cards {
max-height: max-content;
}
Expand All @@ -58,3 +55,9 @@ body.path-admin-tool-spamcleaner {
}
}
}

#page-admin-reportbuilder-edit {
#page {
padding: 0 2rem;
}
}
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024111400;
$plugin->release = '4.5.0.3';
$plugin->version = 2024121200;
$plugin->release = '4.5.0.4';
$plugin->maturity = MATURITY_STABLE;
$plugin->requires = 2022021800; // Moodle 4.0 - Build: 20220218.
$plugin->component = 'theme_trema';
Expand Down

0 comments on commit 08e350f

Please sign in to comment.