6079 Commits

Author SHA1 Message Date
Sara Arjona
dbb63cfffc Merge branch 'MDL-73863-master' of https://github.com/mihailges/moodle 2022-03-17 11:33:58 +01:00
Jun Pataleta
23ea7d6b43 Merge branch 'MDL-74112-master' of https://github.com/andrewnicols/moodle 2022-03-17 17:08:47 +08:00
Huong Nguyen
bfe14e2312 MDL-72991 Course: Partial course cache rebuild with cache versioning 2022-03-17 15:34:26 +07:00
Huong Nguyen
457d10a49f MDL-72991 Course: Fix move_section_to is not updating correct section
When we change the position of two sections, we just need to update
the position of the affected sections, not all the sections in the course.
This will improve the performance since the system only executes the queries to affected sections.
Also, the system only clears the cache for affected sections, not all the sections in the course.
2022-03-17 15:34:26 +07:00
Huong Nguyen
273fbac739 MDL-72991 Course: Create PHPUnit for course_modinfo and move_section_to
Newly PHPUnit tests were created to verify the below methods
 - course_modinfo::purge_section_cache_by_id()
 - course_modinfo::purge_section_cache_by_number()
 - move_section_to()
2022-03-17 15:34:26 +07:00
Dongsheng Cai
f97b86e841 MDL-72991 Course: Partial course cache rebuild
When updating/deleting a section/module, the system now only
invalidate of the element (section/module), not the whole course cache
Also, the system now only recalculate the cache for element (section/module)
if necessary, not the whole course cache

Move module/section purging to course_modinfo:
  + course_modinfo::purge_course_section_cache_by_id was created to purge section by id
  + course_modinfo::purge_course_section_cache_by_number was created to purge section by number
  + course_modinfo::purge_course_module_cache was created to purge module
2022-03-17 15:34:01 +07:00
Andrew Nicols
44a4e78075 MDL-74112 course: Support multiple mforms in format chooser
The format chooser JS assumes that it is the only mform on the page. If
it is not, and another mform appears before it, then the jump will not
work.

This change:
* updates the formatchooser to modern JS
* allows multiple forms to exist on the page
* stops using id fields
* always hide the format selection button
2022-03-17 11:11:53 +08:00
Sara Arjona
dd7d03a50e Merge branch 'MDL-74073-master-2' of https://github.com/junpataleta/moodle 2022-03-16 12:17:08 +01:00
Sara Arjona
9261157cc3 MDL-73233 course: Remove make_active() call
When accessing to User grades and then to the grades from a
specific course, this call was causing several behat errors
because the dashboard node was not found.
The code causing this issue can be safely removed because it
isn't used (the current node is calculated a few lines below).
2022-03-16 11:35:09 +01:00
Sara Arjona
40894d7c31 MDL-73233 frontpage: Display link to My courses
Before MDL-70801, the "My courses" page didn't exist so the "More"
button displayed bellow the "Enrolled courses" in frontpage pointed
to Dashboard.
I think this is a leftover from the issue when the "My courses" page
was added and it makes more sense using the "My courses" page here
always.
2022-03-16 11:35:08 +01:00
Jun Pataleta
b9ff0ff99b MDL-74073 courseformat: Toggle Collapse/Expand all via space key
* Add 'space' keydown event handler on the Collapse/Expand all element
on the course homepage.
* Set aria-expanded attribute of the Expand/Collapse all element
accordingly

Reference:
https://www.w3.org/TR/wai-aria-practices-1.1/#disclosure
2022-03-16 14:09:15 +08:00
Víctor Déniz
4da9f3a03a Merge branch 'MDL-74098' of https://github.com/stronk7/moodle 2022-03-15 16:14:17 +00:00
Eloy Lafuente (stronk7)
820cdbc9e1 Merge branch 'MDL-74100' of https://github.com/paulholden/moodle 2022-03-15 15:07:02 +01:00
Eloy Lafuente (stronk7)
abc57c853a MDL-74098 phpunit: Normalise dir separator to match expectations 2022-03-14 16:46:52 +01:00
Bas Brands
c3f0f59134 MDL-73952 core_course: update section badges using JS 2022-03-14 09:10:07 +01:00
Jun Pataleta
b364b8437a Merge branch 'MDL-74087-master-1' of git://github.com/mihailges/moodle 2022-03-11 09:28:46 +08:00
Mihail Geshoski
748ce930b4 MDL-74087 theme_boost: Add behat tests 2022-03-10 22:30:00 +08:00
Mihail Geshoski
135e1a2dce MDL-73863 course: Deprecate unused methods 2022-03-10 12:28:39 +08:00
Mihail Geshoski
36fe5695fe MDL-73863 course: Add tertiary navigation in completion pages 2022-03-10 12:28:39 +08:00
Sara Arjona
9b5da4de17 Merge branch 'MDL-73993-master' of https://github.com/golenkovm/moodle 2022-03-09 13:24:29 +01:00
Ilya Tregubov
bf842246c6 Merge branch 'MDL-73549-master-2' of https://github.com/HuongNV13/moodle 2022-03-09 16:41:02 +06:00
Paul Holden
598698bc10 MDL-74100 course: relax initial parameter types of external methods.
These methods can be called via UI, and would throw confusing exceptions
if a user entered "unsafe" characters in a search input (e.g. "<").

Defer cleaning of supplied text to inside the methods.
2022-03-08 21:13:02 +00:00
Huong Nguyen
481cfdc3f0 MDL-73549 Course: My course page menu improvement
- Introduce core_course_category::get_nearest_editable_subcategory()
 - This function will return the first creatable/manageable category
for current user
 - With this new function, we can fix the issue that the users with
course management or creation permision at category level cannot see
the manage menu on My courses page
2022-03-08 14:25:19 +07:00
Víctor Déniz
2ac75e55a9 Merge branch 'MDL-74090-master' of https://github.com/junpataleta/moodle 2022-03-08 00:00:19 +00:00
Jun Pataleta
3314000eaf MDL-74090 core: Proper RTL/LTR display of collapsed icons 2022-03-05 00:45:32 +08:00
Eloy Lafuente (stronk7)
87791a13a4 Merge branch 'MDL-74020' of https://github.com/paulholden/moodle 2022-03-04 16:52:21 +01:00
Jun Pataleta
e9ee905619 Merge branch 'MDL-73785' of https://github.com/stronk7/moodle 2022-03-04 14:36:47 +08:00
Jake Dallimore
9be31a19dd Merge branch 'MDL-73457-master-2' of https://github.com/HuongNV13/moodle 2022-03-04 11:59:26 +08:00
Eloy Lafuente (stronk7)
4003e31983 MDL-73785 phpunit: Move more tests to use correct names and namespaces
Applied the following changes to various testcase classes:

- Namespaced with component[\level2-API]
- Moved to level2-API subdirectory when required.
- Fixed incorrect use statements with leading backslash.
- Remove file phpdoc block
- Remove MOODLE_INTERNAL if not needed.
- Changed code to point to global scope when needed.
- Fix some relative paths and comments here and there.
- All them passing individually.
- Complete runs passing too.

Special mention to:

- When belonging to other components and being valid api:
  - analytics related tests have been moved to tests/analytics subdir.
  - backup & restore related tests have been moved to tests/backup subdir.
  - events related tests have been moved to tests/event subdir.
  - privacy related tests have been moved to tests/privacy.
  - task related tests have been moved to tests/task subdir.
- Some simple renames, not including the component part anymore (not
  needed now that they are namespaced):
  - some xxxlib_test.php have been renamed lib_test.php
    (when they where testing the corresponding lib.php).
  - cache stores tests have been all renamed store_test, originally
    each one had its own name (file_test, apcu_test, redis_test...)
  - assign feedback tests have been all renamed feedback_test, originally
    each one had its own name (file_test, editpdf_test...)
2022-03-03 12:19:30 +01:00
Mikhail Golenkov
8c914c8756 MDL-73993 phpdoc: get_module_types_names returns lang_string objects 2022-03-03 10:39:09 +11:00
Sara Arjona
ee480f04fb Merge branch 'MDL-73169-integration-master' of git://github.com/mihailges/moodle 2022-03-02 18:23:12 +01:00
Mihail Geshoski
9452555b35 MDL-73169 theme_boost: Add behat tests 2022-03-02 19:34:08 +08:00
Ferran Recio
ce887084fe MDL-73880 core_courseformat: fix section availability box 2022-03-02 10:31:59 +01:00
Mihail Geshoski
805a9eebf5 MDL-73169 core_course: Update course category breadcrumb nodes 2022-03-02 17:27:38 +08:00
Mihail Geshoski
3a333176d1 MDL-73169 course: Add a general setup method for the category pages 2022-03-02 17:27:35 +08:00
Jake Dallimore
c08caf57c5 Merge branch 'MDL-73645-master-1' of git://github.com/mihailges/moodle 2022-03-02 14:10:19 +08:00
Jun Pataleta
7ac5deaced Merge branch 'MDL-73462-master' of https://github.com/peterRd/moodle 2022-03-02 13:46:10 +08:00
Mihail Geshoski
3e24811c00 MDL-73645 course: Update breadcrumb nodes in the course reset page 2022-03-02 13:00:25 +08:00
Peter Dias
4d5a25ffde MDL-73462 navigation: Leverage participants bar for category 2022-03-02 12:27:02 +08:00
Jun Pataleta
0f35a9b7f9 Merge branch 'MDL-72737-master-2' of https://github.com/bmbrands/moodle 2022-03-01 19:06:52 +08:00
Bas Brands
2faf5e8e48 MDL-72737 theme_boost: update for section header styles 2022-03-01 12:01:59 +01:00
Jun Pataleta
d8cadf7ecf Merge branch 'MDL-73462-master' of https://github.com/peterRd/moodle 2022-03-01 18:32:05 +08:00
Peter Dias
081b255ab0 MDL-73462 navigation: Behat test update 2022-03-01 17:57:24 +08:00
Peter Dias
f1959af7f6 MDL-73462 course: Introduce course category tertiary navigation
Update the category management page.
2022-03-01 17:57:24 +08:00
Paul Holden
5f810c4724 MDL-74020 course: update how required libraries are loaded in test.
Test data providers are executed before `setUpBeforeClass`, so any
library constants used by the providers must already be present.

Reverts part of the change in 691c5b83.
2022-03-01 09:33:35 +00:00
Jun Pataleta
1569398c56 Merge branch 'wip_MDL-73877_master' of https://github.com/gjb2048/moodle 2022-03-01 10:09:18 +01:00
Andrew Nicols
1c7a3712fd MDL-73679 core_courseformat: Move section content to separate template
Course formats may want to preserve the existing section information,
but either change the wrapper (.section .course-section-header), or
prepend and append additional content to it.

Prior to this change, the only way to do this was by copying the entire
content of the template.

This change moves the content of the .course-section-header to a
separate template.

This means that a course format can replace the .section
.course-section-header wrapper whilst retaining its content by
overriding the content/section template and including the
content/section/content template. For example:

```
<li id="section-{{num}}"{{!
    }} class="section course-section main clearfix{{!
    }}{{#onlysummary}} section-summary{{/onlysummary}}{{!
    }}{{#ishidden}} hidden{{/ishidden}}{{!
    }}{{#iscurrent}} current{{/iscurrent}}{{!
    }}{{#isstealth}} orphaned{{/isstealth}}{{!
    }}"
    data-sectionid="{{num}}"
    data-sectionreturnid="{{sectionreturnid}}"
    data-for="section"
    data-id="{{id}}"
    data-number="{{num}}"{{!
}}>

  <!--
      Add a custom div to the existing wrapper, without replacing the
      entire content of the section/content.
  -->
  <div class="my-custom-content">

    <!--
        The upstream content is here:
    -->
    <div class="course-section-header d-flex"
        data-for="section_title"
        data-id="{{id}}"
        data-number="{{num}}"
    >
        {{$ core_courseformat/local/content/cm/section/content }}
            {{> core_courseformat/local/content/cm/section/content }}
        {{/ core_courseformat/local/content/cm/section/content }}
    </div>

  </div>

</li>
```

It also means that a course format can append additional information to
this wrapper, for example:

```
{{< core_courseformat/local/content/section }}
    {{$ core_courseformat/local/content/cm/section/content }}
        <div class="some-custom-class">
            <!--
                Some custom content appended _before_ the course section
                content but within the wrapper
            -->
        </div>

        {{> core_courseformat/local/content/cm/section/content }}

        <div class="some-custom-class">
            <!--
                Some custom content appended _after_ the course section
                content but within the wrapper
            -->
        </div>
    {{/ core_courseformat/local/content/cm/section/content }}
{{/ core_courseformat/local/content/section }}
```
2022-03-01 12:03:47 +08:00
Andrew Nicols
9771a81a12 MDL-73679 core_courseformat: Move activity content to separate template
Course formats may want to preserve the existing activity information,
but either change the wrapper (.activity-item), or prepend and append
additional content to it.

Prior to this change, the only way to do this was by copying the entire
content of the template.

This change moves the content of the activity-item to a separate
template.

This means that a course format can replace the activity-item wrapper
whilst retaining its content by overriding the cm template and including
the cm/activity template. For example:

```
<div class="my-custom-activity-item {{!
        }}{{#modstealth}}hiddenactivity{{/modstealth}}{{!
        }}{{#modhiddenfromstudents}}hiddenactivity{{/modhiddenfromstudents}}{{!
        }}{{#modinline}}activityinline{{/modinline}}" data-activityname="{{activityname}}">
    {{#moveicon}} {{{moveicon}}} {{/moveicon}}
    {{$ core_courseformat/local/content/cm/activity }}
        {{> core_courseformat/local/content/cm/activity }}
    {{/ core_courseformat/local/content/cm/activity }}
</div>
```

It also means that a course format can append additional information to
this wrapper, for example:

```
{{< core_courseformat/local/content/cm }}
    {{$ core_courseformat/local/content/cm/activity }}
        {{> core_courseformat/local/content/cm/activity }}
    {{#cmmeta}}
    <div class="ct-activity-meta-container">
        {{{cmmeta}}}
    </div>
    {{/cmmeta}}
    {{/ core_courseformat/local/content/cm/activity }}
{{/ core_courseformat/local/content/cm }}
```
2022-03-01 12:03:47 +08:00
Andrew Nicols
ccb7d6db62 MDL-73679 courseformat: Wrap template inclusions in blocks 2022-03-01 12:03:47 +08:00
Andrew Nicols
d6052154a6 MDL-73679 courseformat: Add support for course format templating 2022-03-01 12:03:46 +08:00