gjbarnard / moodle-format_topcoll Goto Github PK
View Code? Open in Web Editor NEWCollapsed Topics course format for Moodle.
Home Page: http://docs.moodle.org/en/Collapsed_Topics_course_format
License: GNU General Public License v3.0
Collapsed Topics course format for Moodle.
Home Page: http://docs.moodle.org/en/Collapsed_Topics_course_format
License: GNU General Public License v3.0
When restoring an mbz (made after moodle 3.3) to a Moodle 3.9.1 site we get this exception using the latest version of this plugin:
Default exception handler: Exception - Call to undefined method format_topics::restore_numsections() Debug:
Error code: generalexceptionmessage
* line 156 of /course/format/topcoll/backup/moodle2/restore_format_topcoll_plugin.class.php: Error thrown
* line 115 of /backup/moodle2/restore_plugin.class.php: call to restore_format_topcoll_plugin->after_restore_course()
* line 445 of /backup/util/plan/restore_structure_step.class.php: call to restore_plugin->launch_after_restore_methods()
* line 106 of /backup/util/plan/restore_task.class.php: call to restore_structure_step->launch_after_restore_methods()
* line 205 of /backup/util/plan/restore_plan.class.php: call to restore_task->execute_after_restore()
* line 135 of /backup/moodle2/restore_final_task.class.php: call to restore_plan->execute_after_restore()
* line 819 of /backup/moodle2/restore_stepslib.php: call to restore_final_task->launch_execute_after_restore()
* line 34 of /backup/util/plan/restore_execution_step.class.php: call to restore_execute_after_restore->define_execution()
* line 181 of /backup/util/plan/base_task.class.php: call to restore_execution_step->execute()
* line 178 of /backup/util/plan/base_plan.class.php: call to base_task->execute()
* line 168 of /backup/util/plan/restore_plan.class.php: call to base_plan->execute()
* line 384 of /backup/controller/restore_controller.class.php: call to restore_plan->execute()
* line 219 of /backup/util/ui/restore_ui.class.php: call to restore_controller->execute_plan()
* line 143 of /backup/restore.php: call to restore_ui->execute()
, referer: https://oursite/backup/restore.php
restore_numsections() was removed a long time ago (see https://tracker.moodle.org/browse/MDL-57769), but this plugin still calls it in the restore logic but it seems to be inverted.
If we look at other course formats, they have code like this:
public function after_restore_course() {
global $DB;
if (!$this->need_restore_numsections()) {
// Backup file was made in Moodle 3.3 or later, we don't need to process 'numsecitons'.
return;
}
However format_topcoll has this:
public function after_restore_course() {
if (!$this->need_restore_numsections()) {
/* Backup file was made in Moodle 3.3 or later and does not contain 'numsections',
so we don't need to process 'numsections' but we do need to set it! */
$courseid = $this->task->get_courseid();
global $DB;
if (!($course = $DB->get_record('course', array('id' => $courseid)))) {
print_error('invalidcourseid', 'error');
} // From /course/view.php.
$courseformat = course_get_format($course);
$maxsection = $DB->get_field_sql('SELECT max(section) FROM {course_sections} WHERE course = ?', [$courseid]);
$courseformat->restore_numsections($courseid, $maxsection);
return;
}
I think this code should only be executed if $this->need_restore_numsections()
is true, not false. The call to $courseformat->restore_numsections()
needs to be replaced with whatever logic it provides, because this is causing other course format plugins to fail on restore.
We have found an issue with the accuracy of the assignment meta information.
A student submitted to an assignment, subsequently restrict access conditions were set on the assignment, which meant she does not have access now.
The assignment is displayed if the conditions are not met, as opposed to being completely hidden.
The meta-information displayed for this is:
(this appears directly under the 1st image, but there was personally identifiable information in the Restrict Access set that I had to remove).
Which is not strictly accurate, whilst the student may no longer be subject to having to submit, they have submitted, and regardless of this, if they can see the activity but are not eligible to submit, the submissions status is irrelevant and shouldn't be displayed.
I believe the initial cause is an oversight on the RA conditions, but nevertheless under these legitimate conditions (Student submitted, student now cannot submit due to Restrict Access Conditions) that have been set up, I think the meta-information is wrong.
There doesn't appear to be any evaluation of how restrict access conditions could impact the activity meta information.
Deprecated constructor in:
https://github.com/gjb2048/moodle-format_topcoll/blob/master/js/tc_colourpopup.php#L42
See https://tracker.moodle.org/browse/MDL-65067 where the mere presence of format_topcoll can break core's analytics tasks, because it will try to use format_topcoll's get_section_dates wrongly.
These lines should have mod-indent-outer w-100
class:
https://github.com/gjb2048/moodle-format_topcoll/blob/db00bdffc07209889dedcdc208ca0ae04a3f81d0/tests/courseformatrenderer_test.php#L284
https://github.com/gjb2048/moodle-format_topcoll/blob/db00bdffc07209889dedcdc208ca0ae04a3f81d0/tests/courseformatrenderer_test.php#L331
https://github.com/gjb2048/moodle-format_topcoll/blob/db00bdffc07209889dedcdc208ca0ae04a3f81d0/tests/courseformatrenderer_test.php#L378
https://github.com/gjb2048/moodle-format_topcoll/blob/db00bdffc07209889dedcdc208ca0ae04a3f81d0/classes/course_renderer.php#L176
The option to display topics in multiple columns uses the old Bootstrap 2 column classes (i.e. "row-fluid", "span3", "span4" and "span6". This doesn't work in newer versions of Boostrap (used by the Boost theme).
These should be replaced with the newer Boostrap "col-[xs|sm|md|lg|xl]-*" class names.
Moodle 2.7 STABLE - latest release
Plugin Version 2.7.3
The Edit dropdown menu does not appear for the activities / resources across all themes when the course uses the topcoll format. This broke somewhere between version 2.7.1.5 and 2.7.3
After upgrading to 2.3 and using the Moodle_23 branch the code reports:
Notice: Undefined property: stdClass::$layoutcolumns in /htdocs/course/format/topcoll/renderer.php on line 392
Warning: Division by zero in /htdocs/course/format/topcoll/renderer.php on line 392
Notice: Undefined property: stdClass::$layoutcolumns in /htdocs/course/format/topcoll/renderer.php on line 394
This then displays the collapsed topics as only a tiny portion of the column.
Apply https://tracker.moodle.org/browse/MDL-64819 to M3.5 and 3.6 versions.
In Moodle 3.3, stealth activities were implemented but in doing so stealth / orphaned activities were also done away with. There is a tracker item to bring these back (https://tracker.moodle.org/browse/MDL-59481) but in the meantime all orphaned sections are being displayed and that tracker wouldn't fix things until 3.6 at the earliest.
It particularly affects us as we used subpages (https://github.com/moodleou/moodle-mod_subpage) so have now over 100 orphaned sections being displayed which shouldn't.
In Moodle 3.2 and prior the topcoll course format had a "Number of sections" setting. Re-implementing this as a filter of the maximum number of topics to display for that course would seem to be the most straightforward way of resolving our current situation.
Hi Gareth,
as discussed UCL report that open all/ close all buttons do not provide enough info as to what the screen reader user is opening/closing.
Once way to approach this would be to add the string 'Sections' for screen readers.
e.g. $string['topcollopened'] = 'Open all sections';
Alternatively you could add this in at the renderer.php - line 1158ish
$o .= html_writer::tag('span', get_string('topcollopened', 'format_topcoll').' '.get_string('sections'), array('class' => 'on ' . $this->tctoggleiconsize, 'id' => 'toggles-all-opened', 'role' => 'button', 'tabindex' => '0') );
I have migrated Moodle from 2.5.4 to 3.4.1 (ofcourse in stages). I have downloaded the Collapsed Topic format (ver: 2017110300) from the moodle plugin directory for 3.4. I use subpage activity under every section. While it has migrated all the content fine, it has the following issues,
All the sections have been migrated fine (along with the subpages, which has scorm packages / files in it), however there are additional sections created (Section 110, Section 114 etc) which contains the items under the subpages (from initial sections).
Hiding those sections hides the section, but also the packages/files under the section and it is not visible from the subpage in initial sections as well.
Removing those sections removes the section, but also the packages/files under the section.
Also, migrated course does not have the limit to specify for topics in the course settings, while the new course has that option.
I cannot re-add those packages/files since those have some statistics associated with it. So, it is a kind of blocker and I am not able to proceed further. It seems to be a bug, any help would be greatly appreciated.
Moodle: 3.2 latest Stable
topcoll: latest master
Debugging: Callback delete_course is deprecated. Function format_topcoll_delete_course should be converted to observer of event \core\event\course_content_deleted
https://travis-ci.org/aspark21/moodle/jobs/189218110#L1714
Hi gjb2048,
A patch that was recently accepted into core has caused unit test failures in courseformatrenderer_test.php on tests test_toggle_all and test_display_instructions due to an additional aria-hidden="true" tag being added. Moodle 3.5 and up are affected.
Tracker: https://tracker.moodle.org/browse/MDL-62680
Diff: damyon/moodle@4c6ae31...MDL-62680-35
Regards,
Paul
Hi... We're running Moodle 2.7.11+ (2014051211.01), and have been running the Collapsible Topics format a few months without any problems. We installed the latest version -- 2.7.4 (2014092005) for Moodle 2.7 -- on our test server, and now notice that section titles do not display in courses with using this format (new course, too). When we revert back to the previous version, the section titles come back. We are running PHP version 5.5.29. I also installed a fresh Moodle 2.7.11 version on my local machine and installed the collapsible formats topic, and notice the same problem.
Is there something else that we need to do for the update to work properly? Or perhaps is this a problem others have seen?
Thanks much..... Brian
When using the latest topcoll master, an upgrade is performed normally,
However doing a second upgrade for something unrelated fails due to a version mismatch in the topcol plugin.
Default exception handler: Cannot downgrade format_topcoll from 2017111301 to 2017110301. Debug:
Error code: cannotdowngrade
!!! Cannot downgrade format_topcoll from 2017111301 to 2017110301. !!!
!!
Error code: cannotdowngrade !!
!! Stack trace: * line 656 of /lib/upgradelib.php: downgrade_exception thrown
Courses that had more than 10 sections in the pre-numberofsections versions of topcoll suddenly now have only 10 sections along with lots of support calls, "lots of my content has vanished". It's still there, of course, but now in orphaned sections.
I use essential and moodle 3.2.2
When switching to edit mode, the section name color is not set correctly.
I guess because it becomes an "a" tag while in editmode to have a button etc.
It needs an additional css tag to set the color also in edit mode- but I cant find a solution.
Try with
text color: #ffffff background-color : #000000
hover text color: #000000 background-color: #ffffff
When editing a course and moving a section, the editing icon used to rename a section disappears. The word - toggle also is appended to the recently moved section.
Steps to replicate:
Create a course.
Use Collapsed Topics as the format.
Turn editing on.
Make sure you have more than 3 sections.
Move section 5 to the first section
Result: The "edit section name" icon will disappear and the word - Toggle will be appended.
Ref: https://moodle.org/mod/forum/discuss.php?d=278756
https://github.com/gjb2048/moodle-format_topcoll/blame/MOODLE_28/styles.css#L662-L664
Affects 2.7 and 2.8 versions.
Message from Alex....
Moodle3.2
Adaptable Theme
Relevant version of Collapsed Topics
The issue: the Course settings related to the Sections title and background colours override the Toggle foreground settings in the plugin.
I have also notices that the toggles are narrower on a different environment (Moodle 2.7, Essential theme and the relevant Collpsed Topic version).
version 3.2.1.1 (2016110102)
There's a BOM at the beginning of .gitattributes which causes git to display the following notice when checking out the repository:
behavior, is not a valid attribute name: .gitattributes:1
Additionally, this may be causing issues with COPYING.txt and .travis.yml. Immediately after cloning the repo those two files are listed as modified--the only changes being line endings. This makes it impossible, for example, to checkout the V2.9.2.2 tag without first getting rid of the modified status of COPYING.txt and .travis.yml. (git complains that it would have to overwrite the local modifications.) A git checkout on those files does not seem to fix the issue either.
Hello everyone,
from our lecturer we got the feedback, that they would like to hide the engagement information such as 'Due to' and 'submitted by x' since they have very large courses with large sections (which might not be recommendable, but it is hard to convince other people to change habits...). Anyway if you think that feature has the potential to be integrated I would provide a pull request.
Cheers,
Nina
I really like this course format, it solved a scroll of death issue we had with a 32 topic course. However we've found that if we need to move a section in Edit mode, it takes forever (10 minutes) for the busy cursor to disappear. It doesn't seem to matter whether the moved section has a lot or no content; the time is about the same.
As a workaround we change the course format back to the generic Topics format, move things around and then change back to your Collapsed Topics format.
Thanks for all your help.
Derek
Hi Gareth,
One of our clients has conducted an accessibility audit for their site. Below is one of the suggestions.
Description
Headings have been marked up with button roles using aria properties, however the state conveyed
using the aria-pressed property is not indicative of an accordion component.
Implications
Screen reader users may not understand the functionality of the component.
Recommendation
Ensure accordion/expand and collapse components the aria-expanded attribute to convey their state.
<div class="sectionhead toggle toggle-point" id="toggle-2">
<span class="the_toggle tc-small toggle_open" role="button" aria-expanded="true" tabindex="0"
id="yui_3_17_2_1_1546829310401_87">
<h2 class="sectionname" id="yui_3_17_2_1_1546829310401_86">
Topic 2: This is a very long topic title, which sometimes happens
</h2>
<div class="section_availability"></div>
</span>
</div>
The attribute should be set to true when the panel is open and false when closed. Additionally,
ensure the event which is triggered, is fired in the "onclick" event, to allow both keyboard and
screen reader users a method to activate the control.
Will submit pull requests later.
Thank you
John Y
One of our users really likes the duplicate section functionality available in the OneTopic Course format and was asking about having this in the Collapsed Topics course format. This creates a copy of the section including copies of all the activities in that section.
Had a quick glance and this seems to be how it's implemented - https://github.com/davidherney/moodle-format_onetopic/blob/master/duplicate.php
Hi @gjb2048
Our client that requires the accessibility changes I had made are still on 3.5, would it be possibly for you to port the changes back to the MOODLE_35 branch?
Thanks,
Rossco
Hi Gareth,
On Moodle 2.7 I got this notification with full debugging turned on:
$section->showavailability property has been deprecated. You can replace it by checking if $section->availableinfo has content.
Should be an easy fix :)
Ref: https://moodle.org/mod/forum/discuss.php?d=339785
NTS: Just need to change type when not editing so that text in clickable area is a pointer instead.
To reproduce
Analysis:
When a course is in the process of being created (on the settings page for the first time) and the course doesn't exist yet, the courseid defaults to 1 in the class format_topcoll, i.e. the 'front page' course. This is set in the class constructor. These users are assigned the Manager role in subcategories not the site itself. So, at this stage they do not have the 'changelayout' capability (because they have no site rights). Only when the settings page is saved and the course is created do they acquire these rights and can see the settings.
I think the fix is to make the context in which capabilities are checked become that of the parent category if no course currently exists.
Hello,
There is a problem with Collapsed topic and H5P Embed -feature (iframe).
Tested with Moodle 3.3, Mod_hvp 1.6 and format_topcoll 3.3.1.0 (2017042202) and Clean-theme
Steps to repeat;
Embed H5P activity to some section f.ex section 1
Click "close all" to fold all sections
Edit some random activity on the course (no need to edit it) and select "save and return to course"
Expand the section 1 and notice how the embedded H5P-activity isn't displayed, it only displays the bottom bar of the embedded H5P-activity
If you refresh the page with F5 then the embedded activity is displayed.
So the problem is that embedded H5P-activity isn't displayed if you fold all sections -> edit something -> return to the cousre frontpage until you manually refresh the page.
togglelib::get_toggle_state attempts to access an null as an array. This returned null in PHP7.2, in PHP7.4 it causes the test to fail. I will be submitting a PR for the test shortly.
Hi,
Just wondered if it would be possible to allow "transparent" as a colour option for "Toggle Background". Currently it'll only allow me to choose a hex RGB value.
Use case; making a topic show as "current topic", I'd like the topic title to match the "current topic" style.
I'm happy to use an CSS override, but I thought other users might find this useful too.
Many thanks
Hi Gareth
We are using format_topcoll on a project and its working very well. I wanted to add some icons to the header of each section, but I can't do much by overriding the renderer.
This is because the property variables (e.g $courseformat) are all declared "private" so subclasses can't access them. Is there a good reason why they are not declared "protected," which would allow renderer subclasses to use them?
Thanks
Hi Gareth,
as discussed screen reader users do not find the select menu useful to return to main course view.
Adding this code :
// When viewing a section page, add a link back to the course. if ($section->section == 0 && $onsectionpage) { $o .= '<a href="' .new moodle_url('/course/view.php', array('id' => $course->id)). '"><span class="fa fa-caret-up"></span> ' .get_string('maincoursepage', 'format_topcoll'). '</a>'; }
to renderer.php line 523 helps with this.
If the link is only for screen reader users you could add the class sr-only and remove the icon.
Best wishes
Stuart
Have you ever considered making the tool more accessible to users with disabilities? As it is now it's fairly good, but there are some improvements that need to be made for screen reader users - for instance, notifying users the status of whether or not a section is collapsed. You can do this with ARIA techniques. It would look something like Example 1 at the following.
I'm happy to work with you on this.
Need to apply MDL-55074 as affects navigation in M3.3 (missing sections in Boost nav drawer), however applies to M3.2 so need there +.
Several of the text/background colors used on the assignment/quiz/choice/etc show information alerts are not accessible. Please consider modifying the styles to meet color contrast requirements.
If you are interested, these are the style overrides I put in place in our theme:
// Collapsed topics success alerts
.format-topcoll .ct-activity-date-submitted {
background-color: #d4edda;
}
.format-topcoll .ct-activity-date-submitted a {
color: #155724;
}
// Collapsed topics warning alerts
.format-topcoll .ct-activity-date-nearly-due {
background-color: #FFF3CD;
}
.format-topcoll .ct-activity-date-nearly-due a {
color: #856404;
}
// Collapsed topics danger alerts
.format-topcoll .ct-activity-date-overdue {
background-color: #f8d7da;
}
.format-topcoll .ct-activity-date-overdue a {
color: #721c24;
}
.format-topcoll .ct-activity-date-overdue .text-warning {
color: #721C24 !important;
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.