Skip to content

Commit

Permalink
Merge pull request #93 from WisdmLabs/dev40
Browse files Browse the repository at this point in the history
Merge Dev40 into Stable40
  • Loading branch information
abhikushwah authored Apr 26, 2024
2 parents b9bc9ac + dcf3d0b commit 458002c
Show file tree
Hide file tree
Showing 29 changed files with 194 additions and 50 deletions.
7 changes: 6 additions & 1 deletion changes.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
CHANGES LOG

Version 4.1.7
=============
Feature - Compatibility with Moodle 4.4.
Tweak   - Further UI/UX improvements done

Version 4.1.6
=============
Tweak - UI improvement in Course header for teachers information.
Expand Down Expand Up @@ -34,7 +39,7 @@ Version 4.1.1
=============
Fix - Input field editable text visibility when background image is available on section cards.
Tweak - Next/Prev button design changes.
Tweak - Minor design updates on card width of section and activities.
Tweak - Minor design updates on card width of section and activities.

Version 4.1.0
=============
Expand Down
24 changes: 21 additions & 3 deletions classes/course_format_data_common_trait.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
use core_completion\progress;
use core\activity_dates;
use core_course\output\activity_completion;
use core_tag\reportbuilder\local\entities\instance;

require_once($CFG->dirroot.'/course/format/remuiformat/classes/mod_stats.php');

/**
Expand Down Expand Up @@ -234,7 +236,7 @@ public function get_list_activities_details($section, $course, $courserenderer,
* @return array Sections data
*/
public function get_all_section_data($renderer, $editing, $rformat, $settings, $course, $courseformat, $courserenderer) {
global $USER;
global $USER , $OUTPUT, $CFG;
$modinfo = get_fast_modinfo($course);
$context = context_course::instance($course->id);
$startfrom = 1;
Expand All @@ -249,7 +251,7 @@ public function get_all_section_data($renderer, $editing, $rformat, $settings, $
$data->index = $sectionindex;
$data->num = $section->section;
$data->id = $section->id;
$data->sectionreturnid = course_get_format($course)->get_section_number();
$data->sectionreturnid = $this->edw_get_section_num(course_get_format($course));
$data->insertafter = false;

// Check if the user has permission to view this section or not.
Expand Down Expand Up @@ -311,6 +313,9 @@ public function get_all_section_data($renderer, $editing, $rformat, $settings, $
if (!$section->visible) {
$data->ishidden = true;
$data->notavailable = true;
// $visibilityclass = $courseformat->get_output_classname('content\\section\\visibility');
// $visibility = new $visibilityclass($courseformat, $section);
// $data->visibility = $visibility->export_for_template($OUTPUT);
if (has_capability('moodle/course:viewhiddensections', $context, $USER)) {
$data->hiddenfromstudents = true;
$data->notavailable = false;
Expand Down Expand Up @@ -367,6 +372,10 @@ public function get_all_section_data($renderer, $editing, $rformat, $settings, $
$data->activityinfostring = implode($extradetails['activityinfo']);
$data->progressinfo = $extradetails['progressinfo'];
$data->checkrightsidecontent = true;
if($CFG->backup_release > '4.3'){
$data->sectionpageurl = $CFG->wwwroot."/course/section.php?id=".$section->id;
$data->showsectionpageurlbtn = true;
}
if(!$course->enablecompletion){
$data->progressinfo = false;
}
Expand Down Expand Up @@ -939,7 +948,7 @@ public function get_opendue_status(&$activitydetails, $availstatus, $mod) {
* @return array Output array
*/
private function get_activities_details($section, $course, $courserenderer, $settings, $displayoptions = array()) {
global $PAGE, $USER;
global $PAGE, $USER, $CFG;
$modinfo = get_fast_modinfo($course);
$output = array();

Expand Down Expand Up @@ -1147,4 +1156,13 @@ public function add_generalsection_data(&$export, $renderer, $editing, $course,
}
}

public function edw_get_section_num($obj){
global $CFG;
if($CFG->backup_release > '4.3'){
return $obj->get_sectionnum();
}else{
return $obj->get_section_number();
}

}
}
2 changes: 1 addition & 1 deletion classes/output/card_all_sections_summary_renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
use templatable;
use stdClass;

require_once($CFG->dirroot.'/course/format/renderer.php');
// require_once($CFG->dirroot.'/course/format/renderer.php');
require_once($CFG->dirroot.'/course/renderer.php');
require_once($CFG->dirroot.'/course/format/remuiformat/classes/mod_stats.php');
require_once($CFG->dirroot.'/course/format/remuiformat/classes/course_format_data_common_trait.php');
Expand Down
2 changes: 1 addition & 1 deletion classes/output/card_one_section_renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use html_writer;
use context_course;
use core_completion\progress;
require_once($CFG->dirroot.'/course/format/renderer.php');
// require_once($CFG->dirroot.'/course/format/renderer.php');
require_once($CFG->dirroot.'/course/format/remuiformat/classes/mod_stats.php');
require_once($CFG->dirroot.'/course/format/remuiformat/classes/course_format_data_common_trait.php');
require_once($CFG->dirroot.'/course/format/remuiformat/lib.php');
Expand Down
3 changes: 2 additions & 1 deletion classes/output/courseformat/content/section.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ public function export_for_template(\renderer_base $output): stdClass {
$format = $this->format;

$data = parent::export_for_template($output);
$courseformatdatacommontrait = \format_remuiformat\course_format_data_common_trait::getinstance();

if (!$this->format->get_section_number()) {
if (!$courseformatdatacommontrait->edw_get_section_num($this->format)) {
$addsectionclass = $format->get_output_classname('content\\addsection');
$addsection = new $addsectionclass($format);
$data->numsections = $addsection->export_for_template($output);
Expand Down
3 changes: 2 additions & 1 deletion classes/output/courseformat/content/section/controlmenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public function section_control_items() {
$format = $this->format;
$section = $this->section;
$course = $format->get_course();
$sectionreturn = $format->get_section_number();
$courseformatdatacommontrait = \format_remuiformat\course_format_data_common_trait::getinstance();
$sectionreturn = $courseformatdatacommontrait->edw_get_section_num($format);;

$coursecontext = context_course::instance($course->id);

Expand Down
2 changes: 1 addition & 1 deletion classes/output/list_all_sections_renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use stdClass;
use context_course;

require_once($CFG->dirroot.'/course/format/renderer.php');
// require_once($CFG->dirroot.'/course/format/renderer.php');
require_once($CFG->dirroot.'/course/renderer.php');
require_once($CFG->dirroot.'/course/format/remuiformat/classes/mod_stats.php');
require_once($CFG->dirroot.'/course/format/remuiformat/classes/course_format_data_common_trait.php');
Expand Down
2 changes: 1 addition & 1 deletion classes/output/list_all_sections_summary_renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
use stdClass;
use context_course;

require_once($CFG->dirroot.'/course/format/renderer.php');
// require_once($CFG->dirroot.'/course/format/renderer.php');
require_once($CFG->dirroot.'/course/renderer.php');
require_once($CFG->dirroot.'/course/format/remuiformat/classes/mod_stats.php');
require_once($CFG->dirroot.'/course/format/remuiformat/classes/course_format_data_common_trait.php');
Expand Down
2 changes: 1 addition & 1 deletion classes/output/list_one_section_renderable.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use html_writer;
use context_course;
use core_completion\progress;
require_once($CFG->dirroot.'/course/format/renderer.php');
// require_once($CFG->dirroot.'/course/format/renderer.php');
require_once($CFG->dirroot.'/course/format/remuiformat/classes/mod_stats.php');
require_once($CFG->dirroot.'/course/format/remuiformat/lib.php');

Expand Down
2 changes: 1 addition & 1 deletion lang/en/format_remuiformat.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

// Plugin Name.
$string['pluginname'] = 'Edwiser course formats';

$string['plugin_description'] = 'Courses are presented as collapsible lists OR as cards of sections with a responsive design for better navigation.';
// Settings.
$string['defaultcoursedisplay'] = 'Course display default';
$string['defaultcoursedisplay_desc'] = "Either show all the sections on a single page or section zero and the chosen section on page.";
Expand Down
10 changes: 8 additions & 2 deletions lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ public function allow_stealth_module_visibility($cm, $section) {
* @return null|array|stdClass any data for the Javascript post-processor (must be json-encodeable)
*/
public function section_action($section, $action, $sr) {
global $PAGE;
global $PAGE, $CFG;

if ($action == 'deleteSection') {
return null;
Expand All @@ -652,7 +652,13 @@ public function section_action($section, $action, $sr) {
// For show/hide actions call the parent method and return the new content for .section_availability element.
$rv = parent::section_action($section, $action, $sr);
$renderer = $PAGE->get_renderer('format_topics');
$rv['section_availability'] = $renderer->section_availability($this->get_section($section));
$format = course_get_format($this->courseid);
if($CFG->backup_release > '4.3'){
$rv['section_availability'] = new \core_courseformat\output\local\content\section\availability($format, $this->get_section($section));
}else{
$rv['section_availability'] = $renderer->section_availability($this->get_section($section));
}

return $rv;
}

Expand Down
5 changes: 3 additions & 2 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/

defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot.'/course/format/renderer.php');
// require_once($CFG->dirroot.'/course/format/renderer.php');
require_once($CFG->dirroot.'/course/format/remuiformat/classes/mod_stats.php');

use core_courseformat\output\section_renderer;
Expand Down Expand Up @@ -80,7 +80,8 @@ public function __construct(moodle_page $page, $target) {
* @return object courserenderer
*/
public function get_base_renderer() {
return $this->courserenderer;
global $PAGE;
return $PAGE->get_renderer('core_course');
}

/**
Expand Down
2 changes: 2 additions & 0 deletions scss/card-layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,8 @@
}
// Toggle row column button styling
.toggle-row-column {
padding: 6px 5px;
width: 33px;
border: $border-height solid #e4eaec;
img.icon {
margin: 0;
Expand Down
9 changes: 9 additions & 0 deletions scss/list-layout.scss
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,11 @@
border: $border-height solid $light-border;
}

&.collapsed{
.summary.card-text{
display: none;
}
}
.content {

.panel-title,
Expand Down Expand Up @@ -431,7 +436,11 @@
li:not(:last-child) {
margin-bottom: $margin-16;
}
li:has(.divider.bulk-hidden){
margin-bottom: 0px;
}
.activity{
border-top: 0;
.activitytitle {
gap: $gap-24;
@media (max-width:$sm-screen-bp) {
Expand Down
26 changes: 24 additions & 2 deletions scss/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -273,9 +273,23 @@ body#page-course-view-remuiformat {
}
.action-menu-trigger,
.action-menu {
.dropdown-toggle::after {
display: none;
.dropdown-toggle::after {
display: none;
}

.dropdown-subpanel {
.dropdown-toggle{
display: flex;
justify-content: space-between;
align-items: center;
&::before {
display: inline-block;
order: 3;
transform: rotate(180deg);
font-size: 10px;
}
}
}
}
.stretched-link::after {
display: none;
Expand Down Expand Up @@ -653,6 +667,9 @@ body#page-course-view-remuiformat {
text-align: left;
color: $paragraph-color;
}
.activityinstance{
position: relative;
}
}
}
}
Expand Down Expand Up @@ -1023,3 +1040,8 @@ body#page-course-view-remuiformat {
}
}
}
.section{
.dndupload-preview-overlay,.dndupload-preview-wrapper{
display: none;
}
}
48 changes: 41 additions & 7 deletions styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,8 @@ body#page-course-view-remuiformat .remui-format-card.single-section-format .acti

body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards .activity .toggle-row-column,
body#page-course-view-remuiformat .remui-format-card.single-section-format .activity-cards.section .activity .toggle-row-column {
padding: 6px 5px;
width: 33px;
border: 1px solid #e4eaec;
}

Expand Down Expand Up @@ -964,6 +966,10 @@ body#page-course-view-remuiformat .remui-format-list .sections .section:not(#sec
border: 1px solid #EBF0F9;
}

body#page-course-view-remuiformat .remui-format-list .sections .section.collapsed .summary.card-text {
display: none;
}

body#page-course-view-remuiformat .remui-format-list .sections .section .content .panel-title,
body#page-course-view-remuiformat .remui-format-list .sections .section .content h3 a {
margin: 0px;
Expand Down Expand Up @@ -1189,6 +1195,16 @@ body#page-course-view-remuiformat .remui-format-list .card-footer ul.section li:
margin-bottom: 16px;
}

body#page-course-view-remuiformat .remui-format-list .activities-list ul.section li:has(.divider.bulk-hidden),
body#page-course-view-remuiformat .remui-format-list .card-footer ul.section li:has(.divider.bulk-hidden) {
margin-bottom: 0px;
}

body#page-course-view-remuiformat .remui-format-list .activities-list ul.section .activity,
body#page-course-view-remuiformat .remui-format-list .card-footer ul.section .activity {
border-top: 0;
}

body#page-course-view-remuiformat .remui-format-list .activities-list ul.section .activity .activitytitle,
body#page-course-view-remuiformat .remui-format-list .card-footer ul.section .activity .activitytitle {
gap: 24px;
Expand Down Expand Up @@ -1354,13 +1370,7 @@ body#page-course-view-remuiformat .remui-format-list .section_availability.cours
body#page-course-view-remuiformat .remui-format-list .activity-item .activity-grid {
grid-template-rows: 1fr repeat(6, -webkit-min-content);
grid-template-rows: 1fr repeat(6, min-content);
grid-template-areas: "icon name groupmode completion actions"
"icon visibility groupmode completion actions"
"icon visibility groupmode completion actions"
"dates dates dates dates dates"
"altcontent altcontent altcontent altcontent altcontent"
"afterlink afterlink afterlink afterlink afterlink"
"availability availability availability availability availability";
grid-template-areas: "icon name groupmode completion actions" "icon visibility groupmode completion actions" "icon visibility groupmode completion actions" "dates dates dates dates dates" "altcontent altcontent altcontent altcontent altcontent" "afterlink afterlink afterlink afterlink afterlink" "availability availability availability availability availability";
}

body#page-course-view-remuiformat .remui-format-list .activity-item .activity-grid .activity-dates {
Expand Down Expand Up @@ -1689,6 +1699,22 @@ body#page-course-view-remuiformat.editing .action-menu .dropdown-toggle::after {
display: none;
}

body#page-course-view-remuiformat.editing .action-menu-trigger .dropdown-subpanel .dropdown-toggle,
body#page-course-view-remuiformat.editing .action-menu .dropdown-subpanel .dropdown-toggle {
display: flex;
justify-content: space-between;
align-items: center;
}

body#page-course-view-remuiformat.editing .action-menu-trigger .dropdown-subpanel .dropdown-toggle::before,
body#page-course-view-remuiformat.editing .action-menu .dropdown-subpanel .dropdown-toggle::before {
display: inline-block;
order: 3;
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
font-size: 10px;
}

body#page-course-view-remuiformat.editing .stretched-link::after {
display: none;
}
Expand Down Expand Up @@ -2068,6 +2094,10 @@ body#page-course-view-remuiformat .course-content .sections #section-0 .general-
color: #4C5A73;
}

body#page-course-view-remuiformat .course-content .sections #section-0 .general-section .activities-wrapper .general-section-activities .activity .activityinstance {
position: relative;
}

body#page-course-view-remuiformat .course-content .sections #section-0 .general-section .showactivity {
font-size: 14px;
line-height: 17px;
Expand Down Expand Up @@ -2396,3 +2426,7 @@ body#page-course-view-remuiformat .availabilityinfo.isrestricted ul {
body#page-course-view-remuiformat.limitedwidth header.hasbackground.design-1 .header-sub-section .progress-resume-wrapper {
flex-direction: column;
}

.section .dndupload-preview-overlay, .section .dndupload-preview-wrapper {
display: none;
}
Expand Down
3 changes: 2 additions & 1 deletion templates/card_general_section.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
</div>
{{#modhiddenfromstudents}}
<div data-region="sectionbadges" class="sectionbadges d-flex align-items-center">
{{> core_courseformat/local/content/section/badges }}
{{!> core_courseformat/local/content/section/badges }}
{{>format_remuiformat/edwbadges}}
</div>
{{/modhiddenfromstudents}}
{{#modstealth}}
Expand Down
Loading

0 comments on commit 458002c

Please sign in to comment.