Compare commits

...

287 Commits

Author SHA1 Message Date
Eloy Lafuente (stronk7) 8e4341402a Moodle release 3.3.1 2017-07-08 20:43:39 +02:00
AMOS bot 0a5af1649f Automatically generated installer lang files 2017-07-08 00:16:05 +08:00
Jake Dallimore b194f1a2e3 weekly release 3.3+ 2017-07-07 12:10:20 +08:00
Jake Dallimore 14ecaeea08 Merge branch 'install_33_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_33_STABLE 2017-07-07 12:10:18 +08:00
AMOS bot c28de2e556 Automatically generated installer lang files 2017-07-07 00:06:27 +08:00
Simey Lameze 706571e94f MDL-59456 auth_cas: patch phpCAS auth bypass vulnerability 2017-07-06 09:35:43 +01:00
Jun Pataleta 0801d7dc95 MDL-58651 logstore_database: Set dbhandlesoptions in test page 2017-07-05 23:04:37 +08:00
Dan Poltawski 77da99fe77 MDL-57021 passwords: only use unmask field with shared secrets
When a user is entering a password which isn't returned back to them
then its not correct to use the unmask element - this element was
designed for places where we are storing shared secrets.
2017-07-05 12:25:30 +02:00
Eloy Lafuente (stronk7) c88b34c0fa Merge branch 'MDL-59398-33-enfix' of git://github.com/mudrd8mz/moodle into MOODLE_33_STABLE 2017-07-05 11:52:27 +02:00
Eloy Lafuente (stronk7) 23dbc35541 Merge branch 'MDL-59294-33' of git://github.com/junpataleta/moodle into MOODLE_33_STABLE 2017-07-05 09:43:44 +02:00
Eloy Lafuente (stronk7) e9609517d2 Merge branch 'MDL-58286-33' of https://github.com/xow/moodle into MOODLE_33_STABLE 2017-07-05 09:40:39 +02:00
Eloy Lafuente (stronk7) efc9c7572b Merge branch 'wip-MDL-59412-33' of git://github.com/marinaglancy/moodle into MOODLE_33_STABLE 2017-07-05 09:35:13 +02:00
Helen Foster 05263df3b0 MDL-59398 lang: Merge English strings from the en_fix language pack 2017-07-05 09:31:39 +02:00
Marina Glancy dc30c8fa2f MDL-59412 course: do not display completion icon for unavailable mod 2017-07-05 09:58:35 +08:00
John Okely 8b3ee7d311 MDL-58286 enrol_ldap: Pass connection to ldap_paged_results_supported
Thanks to Bianco Veigel for the original patch.
2017-07-05 09:49:48 +08:00
Jun Pataleta 5823f7e1bd MDL-59294 block_login: Make display of ID provider buttons consistent 2017-07-05 09:08:11 +08:00
Jun Pataleta 4dfa466691 MDL-59294 theme_bootstrapbase: Fix display of ID provider buttons 2017-07-05 09:08:11 +08:00
Eloy Lafuente (stronk7) 226ca38be3 Merge branch 'MDL-58651_33' of git://github.com/aolley/moodle into MOODLE_33_STABLE 2017-07-05 01:23:22 +02:00
Eloy Lafuente (stronk7) 145e6deee7 Merge branch 'wip-MDL-59336-33' of git://github.com/marinaglancy/moodle into MOODLE_33_STABLE 2017-07-04 19:59:17 +02:00
Jake Dallimore d53a5789a8 Merge branch 'MDL-59380-33' of git://github.com/damyon/moodle into MOODLE_33_STABLE 2017-07-04 16:29:11 +08:00
Marina Glancy 640534676c MDL-59409 admin: set admin user in unittest 2017-07-04 11:05:11 +08:00
Ankit Agarwal 49371ca433 MDL-56565 forum: Add sitename as heading when there is nothing to display 2017-07-04 10:11:37 +08:00
Ankit Agarwal 5697a42fc2 MDL-56565 forum: Make sure userfullname is not disclosed 2017-07-04 10:11:37 +08:00
Jake Dallimore 0ba4ffe353 MDL-56565 navigation: fix for cap checks in nav and context header
Fix to:
- Make sure we properly check both user and course contexts in
the load_for_user function in navigation lib and user the
user_can_view_profile function for same-course access checks.
- Use user_can_view_profile in the renderer's context_header to
properly decide whether a user can view another user's picture
and messaging options in the page header.
2017-07-04 10:11:37 +08:00
Jake Dallimore 31bae37249 MDL-56565 navigation: fix user details disclosure in nav tree
Fixes a bug in which a user's full name might be disclosed via the
nav tree. Nav generation now checks the current user's access to the
user before adding the node, else adds a dummy node.
2017-07-04 10:11:37 +08:00
Jake Dallimore 2423a989fc MDL-56565 core: fix user details disclosure in page context header
Fixes a bug with context_header function in which user details were
displayed regardless of the current user's capabilities.
2017-07-04 10:11:37 +08:00
Mark Nelson 67103939ac MDL-59304 core_calendar: check if course is hidden in bailout callback 2017-07-04 10:11:37 +08:00
Marina Glancy 4f91eb0ba1 MDL-59409 admin: check access to every setting in category 2017-07-04 10:03:16 +08:00
Jake Dallimore 07cb3212c5 Merge branch 'MDL-59008-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-07-03 15:56:18 +08:00
Simey Lameze 550e03463b MDL-59008 repository: add reload parent window support to callback 2017-07-03 13:45:41 +08:00
Simey Lameze 4f2c5e18c0 MDL-59008 repository_onedrive: add method to serve login on a popup 2017-07-03 13:45:41 +08:00
Simey Lameze 73aad88f63 MDL-59008 repository_googledocs: add method to serve login on a popup
This commit also add a new string logintoaccount to make the login
button more clear.
2017-07-03 13:45:40 +08:00
Simey Lameze 88d7acff69 MDL-59008 mod_resource: add option to serve external files embed 2017-07-03 13:45:40 +08:00
Jake Dallimore 59f5f4a9df weekly release 3.3+ 2017-06-29 16:23:52 +08:00
Jake Dallimore 14509286e4 Merge branch 'install_33_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_33_STABLE 2017-06-29 16:23:51 +08:00
Mark Nelson 6b661ab0a2 MDL-56046 mod_quiz: do not close the sheet twice 2017-06-28 14:14:28 +08:00
Adam Olley 57cb067173 MDL-58651 logstore_database: Add ability to not send database options
In the core dml:
PostgreSQL connections now use advanced options to reduce connection overhead.
These options are not compatible with some connection poolers. The
dbhandlesoptions parameter has been added to allow the database to configure
the required defaults.

This item adds a setting to the logstore_database plugin to let you set the
same flag for your destination database - without it you won't be able to ship
logs to a postgresql database with a pgbouncer frontend.
2017-06-28 13:20:09 +09:30
Eloy Lafuente (stronk7) 65e5e9f454 Merge branch 'MDL-57809-33-progressbar' of https://github.com/roperto/moodle into MOODLE_33_STABLE 2017-06-27 20:17:34 +02:00
Eloy Lafuente (stronk7) 7984ae3581 Merge branch 'wip-MDL-59136-33' of git://github.com/marinaglancy/moodle into MOODLE_33_STABLE 2017-06-27 18:09:43 +02:00
David Monllao f786e59224 Merge branch 'MDL-32151-33' of git://github.com/junpataleta/moodle into MOODLE_33_STABLE 2017-06-27 17:47:00 +02:00
Eloy Lafuente (stronk7) c46c38d355 Merge branch 'MDL-59362_33' of git://github.com/markn86/moodle into MOODLE_33_STABLE 2017-06-27 17:22:02 +02:00
Danny Jung 67c112bf9c MDL-59073 Workshop: Prevent submission without content or file 2017-06-27 17:05:35 +02:00
David Monllao 61812e3dd8 Merge branch 'wip-MDL-59308-33' of git://github.com/marinaglancy/moodle into MOODLE_33_STABLE 2017-06-27 16:42:33 +02:00
David Monllao eaeed5b281 Merge branch 'MDL-59158-33' of git://github.com/junpataleta/moodle into MOODLE_33_STABLE 2017-06-27 16:39:56 +02:00
David Monllao d259cafd3c Merge branch 'MDL-57927-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-06-27 15:55:33 +02:00
Eloy Lafuente (stronk7) e632f4ece5 Merge branch 'MDL-58844-33' of git://github.com/andrewnicols/moodle into MOODLE_33_STABLE 2017-06-27 11:42:14 +02:00
Eloy Lafuente (stronk7) aff28d6243 Merge branch 'MDL-59296-33' of git://github.com/crazyserver/moodle into MOODLE_33_STABLE 2017-06-27 11:40:03 +02:00
Jake Dallimore 653ec0d0b0 Merge branch 'MDL-59312-33' of https://github.com/xow/moodle into MOODLE_33_STABLE 2017-06-27 15:08:23 +08:00
Jake Dallimore 62a71e4a17 Merge branch 'MDL-59275-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-06-27 13:59:14 +08:00
Damyon Wiese 35657809ed MDL-59380 fragments: Include js from templates
Mustache templates containing {{#js}} blocks are not returned via the
fragments API. This is because the requirements manager is assigned when the renderer is created
and not updated by the call to start collecting page requirements.
2017-06-27 13:35:37 +08:00
Jake Dallimore c61c5009a8 Merge branch 'MDL-56046_33-fix' of git://github.com/markn86/moodle into MOODLE_33_STABLE 2017-06-27 13:17:25 +08:00
Simey Lameze fe9e229248 MDL-59275 auth: prevent user login failed coding error 2017-06-27 13:07:13 +08:00
Mark Nelson db500a32a1 MDL-56046 dataformat: minor changes to PHPDocs and upgrade.txt 2017-06-27 11:25:22 +08:00
Andrew Nicols 75ead1e8cf MDL-58844 testing: Move to GCE build infrastructure
Switch back to GCE build infrastructure for Travis Builds and move
databases to RAM Disk.

This also adds a software entropy generator (haveged) which is
recommended when using a RAMdisk for the database.
2017-06-27 09:36:52 +08:00
Eloy Lafuente (stronk7) c7c9f4a46e Merge branch 'MDL-56046_33' of git://github.com/markn86/moodle into MOODLE_33_STABLE 2017-06-27 02:42:48 +02:00
Eloy Lafuente (stronk7) 8e9c8f6583 Merge branch 'MDL-40818-33' of git://github.com/junpataleta/moodle into MOODLE_33_STABLE 2017-06-27 01:50:39 +02:00
Eloy Lafuente (stronk7) 037bf82652 Merge branch 'MDL-59295-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-06-27 00:53:44 +02:00
Eloy Lafuente (stronk7) 5341d76031 MDL-58813 phpunit: pick test from 32_STABLE to fix expected behavior 2017-06-26 19:45:05 +02:00
Eloy Lafuente (stronk7) e71b162d09 Merge branch 'MDL-59297_myoverview_error_33' of git://github.com/davosmith/moodle into MOODLE_33_STABLE 2017-06-26 13:04:57 +02:00
Mark Nelson 58099bd24d MDL-56046 core: enable multiple sheets for flexible table 2017-06-26 13:56:38 +08:00
Mark Nelson c7da8264d0 MDL-56046 dataformat: added related information to upgrade.txt 2017-06-26 13:56:38 +08:00
Mark Nelson ca47e80375 MDL-56046 dataformat_*: convert core plugins 2017-06-26 13:30:56 +08:00
Mark Nelson 40e7ac2c70 MDL-56046 core: convert download_as_dataformat to use new API 2017-06-26 13:30:56 +08:00
Mark Nelson d7a2d1a2c8 MDL-56046 core_dataformat: added functions to support multiple sheets
Also removed write_header() and write_footer(). The reason for this
is because in core we want to know if the format being used supports
multiple sheets. To do this, and ensure we do not break third-party
dataformat plugins, we are using method_exist(). If write_header()
and write_footer() remain in the base class then this will always
be true.
2017-06-26 13:28:44 +08:00
Mark Nelson d971e7dffe MDL-59362 core: ensure we use 'new' when throwing exceptions 2017-06-26 13:10:31 +08:00
Marina Glancy 56855a2842 MDL-59136 roles: avoid double escaping in role names 2017-06-26 11:57:37 +08:00
Marina Glancy 7563339608 MDL-59336 themes: change FA mapping for i/new 2017-06-26 11:37:04 +08:00
Jake Dallimore 89d85f5a4b Merge branch 'MDL-49484-moodle33' of github.com:jebarviabb/moodle into MOODLE_33_STABLE 2017-06-26 10:52:15 +08:00
Josh Ebarvia 74823e4e45 MDL-49484 mod_lesson: Fix lesson page headers when editing 2017-06-24 05:23:52 +09:30
AMOS bot 7a0e1cd70c Automatically generated installer lang files 2017-06-24 00:08:53 +08:00
AMOS bot 4534c7b531 Merge branch 'MOODLE_33_STABLE' into install_33_STABLE 2017-06-24 00:08:53 +08:00
Pau Ferrer Ocaña 16f2fe5514 MDL-59296 data: Fix latlong field search 2017-06-23 09:15:35 +02:00
Andrew Nicols eee0d699c3 MDL-59312 js: Improve display of exception stacktrace 2017-06-23 10:50:05 +08:00
John Okely 0d74c11cf7 MDL-59312 notification: Normalise backtrace/stacktrace 2017-06-23 10:50:05 +08:00
Andrew Nicols 6aebb4375f MDL-59312 js: Add exception on AJAX error 2017-06-23 10:50:04 +08:00
Jun Pataleta 32f2e90522 MDL-32151 group: Use appropriate error langstring error key 2017-06-23 10:28:25 +08:00
Jun Pataleta 8e62bc79c7 MDL-32151 grade: Use appropriate error langstring error key 2017-06-23 10:28:25 +08:00
Jun Pataleta c36c507277 MDL-59158 theme_boost: Remove auto width and height for user picture 2017-06-23 10:12:54 +08:00
Jun Pataleta 813f289b60 MDL-40818 calendar: Require login to calendar pages
* Make sure that the course ID being passed points to an existing course
* Require user to login before granting access to calendar pages.
2017-06-23 09:21:16 +08:00
Daniel Thee Roperto e318be3772 MDL-57809 weblib: Added missing NO_OUTPUT_BUFFERING directive. 2017-06-23 09:43:32 +10:00
Daniel Thee Roperto a67ff779d5 MDL-57809 weblib: Added opening disclaimer and file-level phpdocs. 2017-06-23 09:43:32 +10:00
Daniel Thee Roperto 222a87ae98 MDL-57809 weblib: Progress bar and output buffer - added debugging
This fix makes Moodle show a debbuging message if using progressbar without defining NO_OUTPUT_BUFFERING.
2017-06-23 09:43:32 +10:00
AMOS bot 8d0dd90520 Automatically generated installer lang files 2017-06-23 00:07:50 +08:00
Dan Poltawski cccb1a6d21 weekly release 3.3+ 2017-06-22 15:40:49 +01:00
Marina Glancy 3d8a2c5cd9 MDL-59308 calendar: pass module context when known
this will protect us from exceptions when context for removed instance can not be retrieved
2017-06-22 16:01:33 +08:00
Simey Lameze ebe0cf3ed4 MDL-59295 tool_lp: remove useless ng-label attribute 2017-06-22 15:49:26 +08:00
Eloy Lafuente (stronk7) 9938165bb8 Merge branch 'MDL-59170-33' of https://github.com/xow/moodle into MOODLE_33_STABLE 2017-06-22 03:50:17 +02:00
John Okely 101271fd28 MDL-59170 fontawesome: Fix course total controls icon on grader report 2017-06-22 09:13:02 +08:00
Davo Smith 4ca3991e56 MDL-59297 block_myoverview: fix fatal error (missing require_once) 2017-06-21 08:01:53 +01:00
Eloy Lafuente (stronk7) f6736dedd1 Merge branch 'MDL-58985-33-bluebubbles' of git://github.com/mudrd8mz/moodle into MOODLE_33_STABLE 2017-06-21 00:43:53 +02:00
Eloy Lafuente (stronk7) 5be425cf9e Merge branch 'wip-MDL-59263-33' of git://github.com/marinaglancy/moodle into MOODLE_33_STABLE 2017-06-20 18:04:08 +02:00
Eloy Lafuente (stronk7) 0f0b45fd59 Merge branch 'MDL-59269-33-languninstall' of git://github.com/mudrd8mz/moodle into MOODLE_33_STABLE 2017-06-20 17:56:59 +02:00
Mathieu Petit-Clair f05e2e6690 MDL-58952 admin: use valid default for language selection dropdown. 2017-06-20 11:31:49 +01:00
Dan Poltawski b0b68a0bd4 Merge branch 'MDL-59005-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-06-20 09:52:12 +01:00
Dan Poltawski 7abe668bd6 Merge branch 'MDL-58472-33' of git://github.com/damyon/moodle into MOODLE_33_STABLE 2017-06-20 09:37:24 +01:00
Jun Pataleta b31f3097c2 Merge branch 'wip-MDL-58911-33' of git://github.com/marinaglancy/moodle into MOODLE_33_STABLE 2017-06-20 16:34:02 +08:00
Jun Pataleta 82b3050e72 Merge branch 'MDL-57770-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-06-20 16:28:20 +08:00
Marina Glancy 153f74956d MDL-58911 calendar: use the same callbacks in unittests and prod
Remove unittest-specific callbacks for checking access and displaying
the calendar events on the dashboard.

This will allow plugin developers unittest the full behavior
of how their plugins add events to the dashboard.

Reset all static caches between unittests.
2017-06-20 16:17:26 +08:00
Jake Dallimore 8b017ea78c Merge branch 'wip-MDL-58729-33' of git://github.com/abgreeve/moodle into MOODLE_33_STABLE 2017-06-20 15:18:37 +08:00
Jun Pataleta cea093be87 Merge branch 'MDL-58766_33-clean-tree-item-indent' of https://github.com/lucaboesch/moodle into MOODLE_33_STABLE 2017-06-20 15:10:19 +08:00
Jun Pataleta 970c74b280 Merge branch 'MDL-59270-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-06-20 10:00:19 +08:00
Simey Lameze 04e5ef2a3e MDL-57927 tool_lp: make both buttons consistent 2017-06-20 08:50:14 +08:00
Simey Lameze b2a90870ce MDL-59270 block_myoverview: tab setting logic to main template on clean 2017-06-20 08:46:05 +08:00
Damyon Wiese ae60722b14 MDL-58808 fontawesome: nav and settings blocks 2017-06-20 08:22:59 +08:00
Dan Poltawski 26277438ed Merge branch 'MDL-59048_33' of https://github.com/timhunt/moodle into MOODLE_33_STABLE 2017-06-19 15:43:25 +01:00
Dan Poltawski 17eb11f801 Merge branch 'MDL-59173-33' of git://github.com/tobiasreischmann/moodle into MOODLE_33_STABLE 2017-06-19 12:27:44 +01:00
Dan Poltawski 3ae9ed890f Merge branch 'wip-MDL-51917-33' of git://github.com/marinaglancy/moodle into MOODLE_33_STABLE 2017-06-19 12:21:46 +01:00
Dan Poltawski 0ff0caefc0 Merge branch 'MDL-46418-33-hiddenrepos' of git://github.com/mudrd8mz/moodle into MOODLE_33_STABLE 2017-06-19 10:33:35 +01:00
Jun Pataleta a5efab81c9 Merge branch 'MDL-44961-33' of git://github.com/ankitagarwal/moodle into MOODLE_33_STABLE 2017-06-19 16:25:03 +08:00
Jun Pataleta bc84e4e4ae Merge branch 'MDL-58310-33' of https://github.com/xow/moodle into MOODLE_33_STABLE 2017-06-19 13:26:13 +08:00
John Okely e70d1e66d6 MDL-58310 ajax: suppress errors upon page unload 2017-06-19 11:45:29 +08:00
John Okely e256446c75 MDL-58310 message: No longer need to supress errors from messaging 2017-06-19 11:45:29 +08:00
Jake Dallimore e4780bf151 Merge branch 'MDL-59230-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-06-19 09:13:22 +08:00
Vladimir Zhirov 4b8d403606 MDL-59005 resource: fixed zip extraction for filenames in CP-1251/CP-866 2017-06-19 08:50:59 +08:00
Luca Bösch 8a32c0fdb3 MDL-58766 css: clean theme block alignment 2017-06-16 16:12:28 +02:00
David Mudrák a27fa5b50e MDL-59269 lang: Fix ability to uninstall certain language packs
In the issue MDL-39319 (6ddf92c77), the ability to uninstall multiple
language packs at once was added. By a mistake, the PARAM_ALPHAEXT was
used as paramater type for the dash-separated list of language packs to
be uninstalled. Language packs with a number in the name (such as
en_us_k12) do not pass the ALPHAEXT cleaning.

This patch changes the parameter cleaning to PARAM_SAFEPATH which is
more appropriate for the given scenario as language code themselves must
be SAFEDIRs.
2017-06-16 14:05:31 +02:00
Simey Lameze 3cf5c5152e MDL-59230 block_myoverview: add missing core notification module 2017-06-16 16:40:02 +08:00
Tobias Reischmann c484b0574e MDL-59173 tablelib.php: changed default of $params in set_sql to array()
Default of $params = null leads to a problem in query_db().
There this value is used in array_merge, which can not handle null
values. If null is passed for one of the params the outcome will be null
independent of the value of the second param!
2017-06-16 10:27:17 +02:00
Jake Dallimore dec00f6a53 weekly release 3.3+ 2017-06-16 13:29:39 +08:00
Jake Dallimore d51518e24d Merge branch 'install_33_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_33_STABLE 2017-06-16 13:29:38 +08:00
Jean-Roch Meurisse - University of Namur - Belgium 94925c38d0 MDL-59263 roles: Wrong order of parameters in calls to pix_icon function 2017-06-16 10:07:22 +08:00
David Mudrák 7abd8de776 MDL-46418 repositories: Fix how enabled repositories are populated
Repository instances are stored in the 'repository' table. Repositories
in the table are either 'Enabled and visible' or 'Enabled but hidden'.
Hidden repositories still serve their files, but are not visible in the
filepicker UI. Disabling a repository instance removes its record from
the table.

In the original implementation of the plugin manager (see b9934a17), the
method plugintype_repository::get_enabled_repositories() correctly
returned all records from the repository table. Then as a part of the
bigger refactoring in MDL-41437, the commit bde002b8 replaced the
original method with the new get_enabled_plugins() one which started to
return visible repositories only.

As a consequence, the admin tree stopped populating setting page nodes
for hidden repository instances. So attempting to visit their setting
page threw a section error. Credit goes to Ike Quigley for debugging and
tracing this down.

This patch fixes the way how the list of enabled repositories is
populated by the plugin manager so that both visible and hidden
repositories are returned again. This does not affect the filepicker
itself as it is using its own methods for obtaining the list.
2017-06-15 21:20:03 +02:00
Jake Dallimore a358927e9e MDL-58248 theme: use pix icon for side panel menu icon instead of char
Replaces the trigram for heaven char with the fa-bars pix icon for
improved support with all screen readers.
2017-06-15 17:08:33 +08:00
Simey Lameze 49e5b8438c MDL-57770 tool_lp: style fixes for the competency rule dialog 2017-06-15 15:38:23 +08:00
Mark Nelson 2b026b44f7 MDL-59140 core: apply limit only on courses to be shown in specific nav
There can be a different number of courses displayed in the
'Navigation' block and in the 'Flat' navigation. This patch
decides what courses we want to display on each, then
applies the 'navcourselimit' setting individually.
2017-06-15 13:36:14 +08:00
Ankit Agarwal 63bfa5afdb MDL-44961 logs: Keep log dates constant during restore 2017-06-14 15:21:54 +05:30
Jake Dallimore d08cd28dae Merge branch 'MDL-59142-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-06-14 11:36:19 +08:00
Dan Poltawski 5d7d2c0a45 Merge branch 'MDL-59171-33' of git://github.com/junpataleta/moodle into MOODLE_33_STABLE 2017-06-13 14:40:45 +01:00
Dan Poltawski 9eb46e7d75 Merge branch 'MDL-59140_33' of git://github.com/markn86/moodle into MOODLE_33_STABLE 2017-06-13 13:23:33 +01:00
Mark Nelson 481220cb4c MDL-59140 core: upgrade 'navcourselimit' if set to old default value 2017-06-13 18:22:58 +08:00
Mark Nelson d47b680074 MDL-59140 core: limit the number of courses shown in the navigation
If the user is enrolled in more courses than the limit then a 'More...'
link is displayed which takes the user to the course/index.php page.
2017-06-13 18:21:58 +08:00
Mark Nelson 76b6407cb8 MDL-59140 core: changes to the 'navcourselimit' setting
Changed the default and description.
2017-06-13 18:21:18 +08:00
Eloy Lafuente (stronk7) ca1e040bbf Merge branch 'wip-MDL-58523-33' of git://github.com/marinaglancy/moodle into MOODLE_33_STABLE 2017-06-13 11:21:12 +02:00
Jun Pataleta 1312c844a1 Merge branch 'MDL-59012-33-linkurl' of git://github.com/mudrd8mz/moodle into MOODLE_33_STABLE 2017-06-14 17:11:47 +08:00
Jun Pataleta a21c3208ea Merge branch 'MDL-58991-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-06-14 16:56:23 +08:00
Dan Poltawski a1692f6362 Merge branch 'MDL-41426_33-block-completionstatus-spaces' of https://github.com/lucaboesch/moodle into MOODLE_33_STABLE 2017-06-13 09:53:59 +01:00
Eloy Lafuente (stronk7) 9bcb6e1bec MDL-46322 database: alias sort fields to avoid ambiguous naming 2017-06-13 09:17:04 +01:00
Jake Dallimore 192a355707 Merge branch 'MDL-58136-33' of git://github.com/damyon/moodle into MOODLE_33_STABLE 2017-06-13 15:54:42 +08:00
Damyon Wiese 3709386ed5 MDL-58136 course: Remove lines from unit test
Remove unused vars and logic from the unit test for classifying a course.
2017-06-13 15:07:50 +08:00
Marina Glancy c159483796 MDL-51917 course completion: order activities in reports
Thanks to Nick Phillips for initial patch
2017-06-13 14:49:35 +08:00
Marina Glancy 9bdff1611b MDL-58523 mod_feedback: deleting response should reset completion 2017-06-13 14:36:24 +08:00
Jake Dallimore ca18b0c33d Merge branch 'MDL-51691-moodle33' of https://github.com/jebarviabb/moodle into MOODLE_33_STABLE 2017-06-13 10:32:45 +08:00
Damyon Wiese 0fb6f059a9 MDL-58136 navigation: Ensure we have all course fields
To properly classify courses we need the start/end dates etc.
2017-06-13 10:09:44 +08:00
Marcus Green 7dc35ed9d2 MDL-58248 theme_boost: label/span for sidepanel expand button
Add string "Side panel" to make the purpose of
trigram/hamburger icon at top left clearer, particularly
when using screen readers e.g. Jaws/NVDA.
Currently it reads out only "expand"
2017-06-13 09:50:01 +08:00
Simey Lameze 481a5ce58b MDL-59142 core_theme: cache post-processed css
Thanks Cameron Ball for the base patch
2017-06-13 09:36:44 +08:00
Damyon Wiese af153671de MDL-58472 videojs: Force manual initialise
If we let videojs auto-init the video/audio tags present in the page - we cannot guarantee that the
youtube library will be loaded by the time video.js is processing the tag.

Video.js uses the presence of a data-setup attibute to signal that it should auto-init this tag, so
we have to rename our config attribute to something else.
2017-06-13 09:12:25 +08:00
Eloy Lafuente (stronk7) 48b929667e Merge branch 'MDL-59032-33' of git://github.com/damyon/moodle into MOODLE_33_STABLE 2017-06-13 01:28:22 +02:00
Eloy Lafuente (stronk7) 6dc00c8423 Merge branch 'MDL-40015-33' of git://github.com/jleyva/moodle into MOODLE_33_STABLE 2017-06-13 01:23:43 +02:00
Eloy Lafuente (stronk7) 290ec233f5 Merge branch 'mdl58161-moodle33' of https://github.com/tlock/moodle into MOODLE_33_STABLE 2017-06-13 01:21:54 +02:00
Eloy Lafuente (stronk7) 56aa74ed3c Merge branch 'MDL-59056_33-admin-allowstealth-select-checkbox' of https://github.com/lucaboesch/moodle into MOODLE_33_STABLE 2017-06-13 01:19:26 +02:00
Josh Ebarvia fe3d722d69 MDL-51691 assignsubmission_feedback: Fix delete comments 2017-06-13 08:35:25 +09:30
Eloy Lafuente (stronk7) 792560a608 Merge branch 'MDL-58907_33' of git://github.com/markn86/moodle into MOODLE_33_STABLE 2017-06-13 01:03:43 +02:00
Eloy Lafuente (stronk7) 7041dc6f8a Merge branch 'MDL-59132-33' of git://github.com/jleyva/moodle into MOODLE_33_STABLE 2017-06-13 00:45:09 +02:00
Tim Lock 57fb48743f MDL-58161 user: tests: user_can_view_profile fails under certain cases 2017-06-13 08:10:43 +09:30
Eloy Lafuente (stronk7) a9712dacbe Merge branch 'MDL-59112-33' of git://github.com/jleyva/moodle into MOODLE_33_STABLE 2017-06-12 14:39:14 +02:00
Dan Poltawski c0f4b8b3c1 Merge branch 'mdl46322-moodle33' of https://github.com/AndresMelo/moodle into MOODLE_33_STABLE 2017-06-12 10:29:18 +01:00
Damyon Wiese 9a9b9e53f0 MDL-58136 cache: Add a course completion cache
The last change added 1 db read per course per page which is not OK. Add a cache to compensate.
2017-06-12 16:08:57 +08:00
Damyon Wiese e1d15194bc MDL-58136 boost: Limit courses in flatnav
Only show "in-progress" courses in the boost flat navigation (as per the myoverview block).
2017-06-12 16:08:18 +08:00
David Mudrák 5b2f32ca92 MDL-58985 course: Fix display of availability information
The availability info text can be either a one line short text such as
"Hidden from students" but it can also be a long HTML formatted text
with the list of all restricted access conditions. For the latter, using
bootstrap labels was not appropriate.

This extends the template context data with some boolean flags that
allow to better distinguish the source and meaning of the availability
information and display it accordingly.

Credit goes to Marina Glancy for the solution idea.
2017-06-12 09:30:57 +02:00
Jun Pataleta a53a439c08 Merge branch 'MDL-59042-33-upgradefix' of github.com:snake/moodle into MOODLE_33_STABLE 2017-06-12 15:30:54 +08:00
Jake Dallimore 2c12e7f534 MDL-59042 upgrade: fix for non existent table in core upgrade.
Moved upgrade step to the assign mod where table is known to exist.
2017-06-12 15:26:03 +08:00
Adrian Greeve 7255306cc8 MDL-58729 database: Improve performance of CLI tool.
Imporve the speed with which mysql_collation converts to
a different collation.
2017-06-12 14:14:35 +08:00
Jake Dallimore b545e84294 Merge branch 'MDL-57103-33' of https://github.com/xow/moodle into MOODLE_33_STABLE 2017-06-12 14:00:25 +08:00
Jun Pataleta 72ebc73897 Merge branch 'MDL-59154-33' of git://github.com/andrewnicols/moodle into MOODLE_33_STABLE 2017-06-12 13:45:16 +08:00
Jun Pataleta 856e1c24c2 Merge branch 'MDL-59042-33' of git://github.com/snake/moodle into MOODLE_33_STABLE 2017-06-12 13:29:21 +08:00
Jake Dallimore 5b1dffd5b0 MDL-59042 upgrade: datafix assign group overrides with null priority
Find any events records for assign group overrides having null priority
and sets their priority to the sortorder value from the corresponding
assign_overrides table entry.
2017-06-12 13:19:28 +08:00
John Okely 6ebff58d8c MDL-57103 lib: Force ajax renderer for all ajax fatal errors 2017-06-12 10:36:59 +08:00
Mark Nelson 54bee25c65 MDL-58907 block_myoverview: change URL when tab is selected
We then check if this paramter exists in the URL and if it
does we display the specified tab.
2017-06-12 10:35:23 +08:00
Mark Nelson 355fefbe71 MDL-58907 block_myoverview: display last tab user was on 2017-06-12 10:35:23 +08:00
Mark Nelson 11a24a823b MDL-58907 block_myoverview: added setting to select default tab 2017-06-12 10:35:23 +08:00
Jun Pataleta 75797500ae MDL-59171 mod_lti: Set mod_lti_view_lti's type to 'read' 2017-06-12 08:35:03 +08:00
Jake Dallimore e2b8d30052 MDL-59042 assign: Group override edit no longer resets event priority
Fixed a bug in which $fromform->sortorder wasn't set before passing
$formdata to assign_update_events, resulting in the existing event
priority being incorrectly nulled and breaking the effective override.
2017-06-09 15:28:08 +08:00
Luca Bösch 571e862135 MDL-59056 admin: allowstealth yes/no checkbox instead of on/off 2017-06-08 21:09:54 +02:00
Luca Bösch 1e9ba1916b MDL-41426 block: Whitespace lacking in completion status block 2017-06-08 19:10:41 +02:00
AMOS bot ddd849e1d5 Automatically generated installer lang files 2017-06-09 00:18:26 +08:00
Dan Poltawski 760ed1dfde weekly release 3.3+ 2017-06-08 12:16:24 +01:00
Dan Poltawski 95a6fe8b05 Merge branch 'install_33_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_33_STABLE 2017-06-08 12:16:23 +01:00
Juan Leyva 0fca28e197 MDL-59132 mod_feedback: Fix anonymous responses numbering
This was done correctly by the web scrip but not by the WS.
2017-06-08 11:16:52 +01:00
Juan Leyva cc5235bb77 MDL-40015 core_course: Fix description of duplicate_course WS
It said that the duplication didn’t include user data, but that’s not
true since there is a parameter to include it.
2017-06-08 10:20:39 +01:00
Juan Leyva 1099b7ce1d MDL-59112 theme_clean: Always return expected moodle_url
The function was returned some times a moodle_url object and another
times just a string with a relative URL.
2017-06-08 09:40:39 +01:00
Andrew Nicols dc403b8386 MDL-59154 theme: Lock for all caching builds
The previous behaviour was to only lock when in theme designer mode.
As a result, when generating the theme for after a reset, each new
client was starting the generation afresh and no locking was taking
place at all.
2017-06-08 12:05:27 +08:00
Dan Poltawski 23bec87007 Merge branch 'MDL-59101-33' of git://github.com/junpataleta/moodle into MOODLE_33_STABLE 2017-06-07 16:26:19 +01:00
Jun Pataleta 924db1a0a6 MDL-59101 calendar: Properly calculate expected until date 2017-06-07 23:13:05 +08:00
Jake Dallimore f8326931a1 Merge branch 'MDL-59076_33' of git://github.com/markn86/moodle into MOODLE_33_STABLE 2017-06-07 09:24:57 +08:00
Damyon Wiese 0a98628841 MDL-58908 auth_oauth2: Don't kill gravatar
If gravatar is enabled, don't update profile pictures.
2017-06-06 17:29:56 +08:00
Dan Poltawski d72a096797 Merge branch 'MDL-58658' of https://github.com/sk-unikent/moodle into MOODLE_33_STABLE 2017-06-06 10:02:32 +01:00
Damyon Wiese a6379acaf3 MDL-59032 scorm: Don't show action events to teachers 2017-06-06 15:57:39 +08:00
Dan Poltawski e002d8c2db Merge branch 'MDL-59086_33' of git://github.com/markn86/moodle into MOODLE_33_STABLE 2017-06-06 08:44:49 +01:00
Simey Lameze 2b7268d645 MDL-58991 report_stats: use same date handling on chart rendering
This commmit fixes applies the same date handling used on stats
table render to the charts render.
2017-06-06 13:56:15 +08:00
Mark Nelson 6e34867b93 MDL-59076 format_weeks: if 'enddate' does not exist in backup then use 0 2017-06-06 12:42:36 +08:00
Jun Pataleta 9a6e95557f Merge branch 'MDL-58646-33' of git://github.com/danpoltawski/moodle into MOODLE_33_STABLE 2017-06-06 12:24:29 +08:00
Jake Dallimore 88daff0ff3 Merge branch 'MDL-58900-33' of git://github.com/lameze/moodle into MOODLE_33_STABLE 2017-06-06 11:39:43 +08:00
Eloy Lafuente (stronk7) 3309800768 Merge branch 'MDL-58826_33_STABLE' of https://github.com/marxjohnson/moodle into MOODLE_33_STABLE 2017-06-06 01:44:56 +02:00
Eloy Lafuente (stronk7) adbba36a63 Merge branch 'MDL-59096-m33' of https://github.com/sammarshallou/moodle into MOODLE_33_STABLE 2017-06-06 01:41:41 +02:00
Dan Poltawski 37ff4578be Merge branch 'MDL-59080_M33' of git://github.com/lazydaisy/moodle into MOODLE_33_STABLE 2017-06-05 12:49:46 +01:00
Mark Johnson cbc3742d71 MDL-58826 theme_boost: Prevent fatal errors in action menu behat steps 2017-06-05 09:05:34 +01:00
AMOS bot 56e407f8a0 Automatically generated installer lang files 2017-06-05 00:05:48 +08:00
AMOS bot 362e7721f5 Automatically generated installer lang files 2017-06-04 00:07:14 +08:00
AMOS bot 53fd95f715 Automatically generated installer lang files 2017-06-04 00:07:14 +08:00
Dan Poltawski 078aaae0cf Merge branch 'MDL-59091_gherkinlint_fix_33' of https://github.com/mrmark/moodle into MOODLE_33_STABLE 2017-06-03 08:54:44 +01:00
Mark Nielsen 4f66cd826f MDL-59091 behat: Fix gherkinlint errors
Just whitespace problems.
2017-06-02 09:36:31 -07:00
Mark Nielsen 028f587670 MDL-59091 behat: Properly propagate gherkinlint exit code 2017-06-02 09:36:18 -07:00
AMOS bot 0b2e862c7a Automatically generated installer lang files 2017-06-03 00:07:42 +08:00
sam marshall 8db0bcc018 MDL-59096 Tasks: Web running local plugin scheduled tasks fails 2017-06-02 17:07:01 +01:00
Dan Poltawski bb6a2082f8 MDL-58646 lib: import latest sabberworm/PHP-CSS-Parser
This version includes a fix[1] contributed by Frédéric Massart investigating
our compilation time issues, which significantly improves the speed of
processing font awesome.

Thanks, Fred!

[1] https://github.com/sabberworm/PHP-CSS-Parser/pull/120
2017-06-02 11:04:23 +01:00
Mary Evans dfac161651 MDL-59080 theme_boost: make drawer.scss variables default
--author="Urs Hunkler <urs.hunkler@unodo.de>"
2017-06-02 07:57:57 +01:00
Dan Poltawski f41c1f82bc weekly release 3.3+ 2017-06-01 09:28:28 +01:00
Dan Poltawski 443f993467 Merge branch 'install_33_STABLE' of https://git.in.moodle.com/amosbot/moodle-install into MOODLE_33_STABLE 2017-06-01 09:28:27 +01:00
Jake Dallimore 0e72aac68a Merge branch 'MDL-59094-33' of git://github.com/danpoltawski/moodle into MOODLE_33_STABLE 2017-06-01 15:28:34 +08:00
AMOS bot 4cd564dd65 Automatically generated installer lang files 2017-06-01 00:12:20 +08:00
Dan Poltawski c6c462903e Merge branch 'MDL-59093-33' of git://github.com/junpataleta/moodle into MOODLE_33_STABLE 2017-05-31 11:10:38 +01:00
Dan Poltawski be4a2e7773 MDL-59094 npm: Update shrinkwrap file to npm 5 generated
Starting with npm version 5, npm install will generate a lockfile
(now named package-lock.json) or update the existing npm-shrinkwrap.json

To prevent changes being generated in the codebase when this happens, we
need to commit the version 5 generated shrinkwrap.

This is related to a general overhaul [1] of how npm manages things. But
for our purposes, we the lockfile should be BC to previous versions [2].

Going forward, we need to ensure we generate the lockfile on npm >=5 to
prevent differences from the previously un-versioned lockfile.

[1] http://blog.npmjs.org/post/161081169345/v500
[2] https://github.com/npm/npm/issues/16728#issuecomment-305104149
2017-05-31 10:11:40 +01:00
Jun Pataleta 283140134b MDL-59093 calendar: Use a fixed start day for forever BYMONTH test 2017-05-31 15:02:04 +08:00
Simey Lameze c779c4fa0b MDL-58900 mod_assign: fix incorrect overrides ordering 2017-05-31 10:51:21 +08:00
Jake Dallimore 4577aa88fd Merge branch 'MDL-54887-33' of git://github.com/junpataleta/moodle into MOODLE_33_STABLE 2017-05-31 08:39:08 +08:00
Eloy Lafuente (stronk7) 3add309d96 Merge branch 'MDL-49988_fix_wiki_preview_33_STABLE' of https://github.com/DMaterka/moodle into MOODLE_33_STABLE 2017-05-31 00:30:19 +02:00
Dan Poltawski 1c2a935975 Merge branch 'MDL-58997_33-group-names-multilang' of https://github.com/lucaboesch/moodle into MOODLE_33_STABLE 2017-05-30 16:57:34 +01:00
Luca Bösch 574aa817c1 MDL-58997 calendar: Group names passing multilang filters. 2017-05-30 16:51:38 +02:00
Eloy Lafuente (stronk7) 98a7bb9cd5 Merge branch 'MDL-58994-33' of git://github.com/cameron1729/moodle into MOODLE_33_STABLE 2017-05-30 12:50:51 +02:00
Dan Poltawski f35ff40f4a Merge branch 'MDL-49040-moodle33' of https://github.com/jebarviabb/moodle into MOODLE_33_STABLE 2017-05-30 11:42:34 +01:00
Jun Pataleta 2529f11ce3 Merge branch 'MDL-57313-33-clibootswatch' of git://github.com/mudrd8mz/moodle into MOODLE_33_STABLE 2017-05-30 16:57:51 +08:00
Jun Pataleta 26f4cf3ad8 MDL-54887 calendar: PR fixes
* Use the calendar_event::description property and format it using
format_text() on it in order to apply the appropriate filters.
* Then use html_to_text() on it to strip the tags and convert the
description to plain text while converting <br> and <p> tags to
line breaks.
2017-05-30 16:54:05 +08:00
Soon-Systems 23ec9e80b4 MDL-54887 calendar: Format summary + description of an event for export 2017-05-30 16:54:05 +08:00
Dan Poltawski 8710174991 Merge branch 'MDL-59014-33' of git://github.com/junpataleta/moodle into MOODLE_33_STABLE 2017-05-30 08:33:37 +01:00
Mark Nelson e399833263 MDL-59086 gradereport_grader: style 'Save changes' button 2017-05-30 13:44:04 +08:00
AMOS bot 59411b45f6 Automatically generated installer lang files 2017-05-28 14:07:00 +08:00
David Mudrák 767622050e MDL-57313 boost: Fix the CLI utility import-bootswatch.php 2017-05-26 09:52:13 +02:00
Dan Poltawski 6696cff321 weekly release 3.3+ 2017-05-24 19:14:46 +01:00
Tim Hunt f59741cc6c MDL-59048 user tours: avoid white-on-white text in Clean 2017-05-24 17:28:02 +01:00
Andrew Nicols 524724c642 Merge branch 'MDL-59011-33' of git://github.com/ankitagarwal/moodle into MOODLE_33_STABLE 2017-05-24 14:18:58 +08:00
Ankit Agarwal ca31084da2 MDL-59011 restore: Check for userride only for activity events 2017-05-24 09:59:28 +05:30
Andrew Nicols 52ecbf8f4c MDL-58577 stats: Correct groupby when getting report options 2017-05-23 19:45:28 +08:00
Andrew Nicols d9c2abaa65 Merge branch 'MDL-58577_33-statistics-report-header-multilang' of https://github.com/lucaboesch/moodle into MOODLE_33_STABLE 2017-05-23 19:45:24 +08:00
David Mudrák 30613bca8d MDL-59012 auth_oauth2: Do not escape URL in plain text emails 2017-05-23 13:38:28 +02:00
Jun Pataleta cb3bad1d50 MDL-59014 calendar: Unescape event URL for the mini calendar 2017-05-23 17:21:18 +08:00
Luca Bösch e4eab531bf MDL-58577 stats: Use multilang with role in header 2017-05-23 11:12:22 +02:00
Jun Pataleta 068d573375 Merge branch 'MDL-58895-33' of git://github.com/ankitagarwal/moodle into MOODLE_33_STABLE 2017-05-23 16:53:45 +08:00
Jake Dallimore df78e4c8ab Merge branch 'MDL-58921_33-calculated-question-name-multilang' of https://github.com/lucaboesch/moodle into MOODLE_33_STABLE 2017-05-23 16:26:25 +08:00
Jun Pataleta 5fbe152a58 Merge branch 'MDL-58165-33' of https://github.com/abias/moodle into MOODLE_33_STABLE 2017-05-23 14:47:11 +08:00
Ankit Agarwal 7fe005f6d1 MDL-58895 groups: Add bootstrap classes to buttons 2017-05-23 12:05:56 +05:30
Alexander Bias 2a615a6031 MDL-58165 navigation: Add node key to private files navigation node 2017-05-23 07:22:23 +02:00
Josh Ebarvia cb065a2d2f MDL-49040 gradereport_grader: Fix feedback truncation after & char 2017-05-23 13:03:44 +09:30
Dan Poltawski e0adce5360 Merge branch 'MDL-58922_33-calculatedmulti-question-name-multilang' of https://github.com/lucaboesch/moodle into MOODLE_33_STABLE 2017-05-22 10:45:52 +01:00
Luca Bösch 613db5afcb MDL-58921 questions: Calculated question name passing multilang.
In edit calculated question the question name does pass format_string to process multilang tags.
2017-05-22 11:36:54 +02:00
Luca Bösch b38538fbdf MDL-58922 questions: Calculatedmulti question name passing multilang.
In edit calculatedmulti question the question name does pass format_string to process multilang tags.
2017-05-22 11:32:18 +02:00
David Monllao f96167c02e Merge branch 'MOODLE_33_STABLE_MDL-56973' of https://github.com/fwsl/moodle into MOODLE_33_STABLE 2017-05-22 15:14:09 +08:00
Jake Dallimore c708549705 Merge branch 'MDL-56617_33-course-cbm-grade-to-pass' of https://github.com/lucaboesch/moodle into MOODLE_33_STABLE 2017-05-22 14:32:17 +08:00
Jun Pataleta d14281e215 Merge branch 'MDL-58933_33' of git://github.com/stronk7/moodle into MOODLE_33_STABLE 2017-05-22 14:12:57 +08:00
Mark Nelson 19f6ca9457 MDL-58986 mod_quiz: add CSS classes to buttons on comment page 2017-05-22 12:23:04 +08:00
Dan Poltawski 7b4eb6082f MDL-58966 completion: improve dashboard string 2017-05-22 10:48:00 +08:00
Henning Bostelmann 8b8fbc6b84 MDL-57957 mod_assign: show feedback file in absence of grade item 2017-05-22 10:44:18 +08:00
Eloy Lafuente (stronk7) 906b385784 MDL-58933 upgrade: add 3.3.0 separation line to all upgrade scripts 2017-05-19 19:23:55 +02:00
Luca Bösch e13e5a42bc MDL-56617 mod_quiz: No grade to pass check if CBM used
When certainty-based marking is used, grades can 'exceed' the maximum grade
(because they are multiplied by factors). Therefore, in such cases, don't show
no warning.
2017-05-19 12:34:21 +02:00
Grzegorz Ziółek 1fcfc991b9 MDL-56973 wiki: New page title readonly after changing course language 2017-05-19 11:11:55 +02:00
Cameron Ball a4eaa35e23 MDL-58994 core_calendar: Coalesce event sort field
There are situations where we need to sort events on a field called
"timesort", but sometimes it is not set. So we can fall back to
"timestart" in this case.
2017-05-19 15:11:32 +08:00
David Monllao df6749b03b weekly release 3.3+ 2017-05-19 13:08:39 +08:00
Andres 6fc4a6c17a MDL-46322 mod_assign: Only list enrolled graders as potential markers 2017-05-18 22:32:59 -05:00
Andres Melo f13c34e4a9 MDL-46322 mod_assign: Only list enrolled graders as potential markers 2017-05-17 16:48:43 -05:00
Mark Nelson 0899f6b9f9 MDL-58776 core_tag: removed whitespace from id attribute
This was preventing the JS from finding the element.
2017-05-17 12:13:54 +01:00
Simey Lameze b68abdc7c2 MDL-58884 core_competency: add exporter required course fields 2017-05-17 15:01:05 +08:00
Jake Dallimore 7e68b9a0af Merge branch 'MDL-58947-m33' of https://github.com/sammarshallou/moodle into MOODLE_33_STABLE 2017-05-17 09:16:01 +08:00
Andrew Nicols 63752139c4 Merge branch 'MDL-58795-moodle33' of https://github.com/jebarviabb/moodle into MOODLE_33_STABLE 2017-05-17 07:00:49 +08:00
Daniel Materka 67803cb430 MDL-49988 wiki: fix broken page layout if html contains line breaks 2017-05-16 19:10:26 +01:00
Ankit Agarwal 54b24b8a24 MDL-58776 tags: Add bootstrap classes to buttons 2017-05-16 17:51:11 +01:00
Iñaki Arenaza 3e97f327cf MDL-57558 ldap: fix ldap_get_entries_moodle()
While ldap_get_entries_moodle() PHPdocs state that it returns "array
ldap-entries with lower-cased attributes as indexes.", this is not true. It
uses ldap_get_attributes() internally, which returns both numerically indexed
attribute names, and dictionary-like entries indexed by attribute names.

Current code lowercases the dictionary-like entries, but then uses the
numerically indexed entries for the attribute names used as keys in the
returned array. The numerically indexed names might or might not be lowercased,
depending on the LDAP server and PHP version) version. E.g., OpenLDAP 2.x,
Novell eDirectory 8.x and MS Active Directory return mixed-cased attribute
names, and PHP 5.x and PHP 7.x don't lowercase them inside ldap_get_entries().

This is probably why all calls to ldap_get_entries_moodle() are followed by
calls to array_change_key_case(), even if that shouldn't be necessary.

So make sure we always return lower-cased attributs as indexes and add some
unit tests to avoid regressions in the future.
2017-05-16 10:48:49 +01:00
Jun Pataleta e91ffe1531 Merge branch 'MDL-58811-33-extra-slash' of https://github.com/dmitriim/moodle into MOODLE_33_STABLE 2017-05-16 17:42:55 +08:00
Josh Ebarvia c4d5303ce0 MDL-58795 gradereport_grader: Prevent duplicates in grader report
Currently, the sorting being used for the grader report table
(asc/desc arrows) is just the grade_grades.finalgrade.
This adds grade_grades.userid in the sort to prevent duplicate
in records returned when using pages.
2017-05-16 18:49:45 +09:30
Jake Dallimore 0712ef7f54 Merge branch 'MDL-58723-33' of git://github.com/junpataleta/moodle into MOODLE_33_STABLE 2017-05-16 15:16:34 +08:00
Jun Pataleta ddf6c958f8 MDL-58723 calendar: Better testing of forever recurring events
* Change the start date of the parent event to the current date
  for tests that with events that recur forever.
* Limit query results to 100 for events that recur forever that can
  generate more than 100 event records.
2017-05-16 14:40:39 +08:00
Andrew Nicols fbf216799c Merge branch 'MDL-58756_33-statslib-roles-multilang' of https://github.com/lucaboesch/moodle into MOODLE_33_STABLE 2017-05-16 13:52:45 +08:00
Luca Bösch f8b0ee68bf MDL-58756 stats: Use multilang with role . 2017-05-16 07:27:00 +02:00
Dmitrii Metelkin 069683984a MDL-58811 backup: fix an extra slash on restore for the legacy files 2017-05-16 14:34:10 +10:00
Issam Taboubi 7a7dd2ff1f MDL-58884 competency: Inaccurate stats proficient competencies in course 2017-05-16 10:42:39 +08:00
Stephen Vickers 8a0ed98b81 MDL-58770 mod_lti: Strip HTML from parameters
Remove HTML tags from parameters which should be plain text.
2017-05-16 09:58:09 +08:00
sam marshall ce904a961d MDL-58947 Search: Label URLs not correctly calculated 2017-05-15 17:57:58 +01:00
Ankit Agarwal 5ff898804f MDL-58929 converters: Make link title consistent 2017-05-15 12:07:43 +01:00
Dan Poltawski 3bb50a471c Merge branch 'MDL-58936_33' of git://github.com/markn86/moodle into MOODLE_33_STABLE 2017-05-15 11:45:19 +01:00
Cameron Ball 660182a172 MDL-58496 mod_chat: Update timesort when updating timestart
Previously when a repeating chat was updating the calendar
it would only update the timestart column. It needs to also
update the timesort column to display correctly on the new
overview.
2017-05-15 11:14:50 +01:00
John Okely e8f0664d53 MDL-58916 user_profile: Pass site context when determining menu options 2017-05-15 11:01:34 +01:00
Cameron Ball cb495b995c MDL-58841 mod_assign: Style "view all" link on grading summary 2017-05-15 10:46:25 +01:00
Luca Bösch c37bbda3ef MDL-58852 choice: Use multilang for choice options in charts 2017-05-15 10:23:29 +01:00
Andrew Nicols 81432e74f4 Merge branch 'MDL-58893-33-missing-div' of https://github.com/dmitriim/moodle into MOODLE_33_STABLE 2017-05-15 15:13:04 +08:00
Luca Bösch d231bf1272 MDL-58920 questions: Calculated question name passing multilang.
In "Shared wild cards" table calculated question name do pass format_string to process multilang tags.
Thus, not breaking the layout any more.
2017-05-15 14:44:06 +08:00
Dmitrii Metelkin 1aee3e9394 MDL-58893 portfolio: add missing closing div 2017-05-15 15:56:34 +10:00
Mark Nelson 9362f598dd MDL-58936 core: ensure 'page->context' is not null
When using $page->context it calls magic_get_context() in lib/pagelib.php.
This method sets the context to context_system::instance() if it is currently
null and returns that as the context. However, when installing a new site
context_system::instance() also returns null.
2017-05-15 12:40:29 +08:00
Skylar Kelty 761ac5a0aa MDL-58658 caching: Add static acceleration unit test for empty arrays 2017-05-11 10:56:04 +01:00
Skylar Kelty 32ec2da151 MDL-58658 caching: Fix static acceleration for empty arrays 2017-04-20 09:49:09 +01:00
392 changed files with 5284 additions and 2007 deletions
+27 -1
View File
@@ -2,7 +2,7 @@
# process (which uses our internal CI system) this file is here for the benefit
# of community developers git clones - see MDL-51458.
sudo: false
sudo: required
# We currently disable Travis notifications entirely until https://github.com/travis-ci/travis-ci/issues/4976
# is fixed.
@@ -18,6 +18,10 @@ php:
addons:
postgresql: "9.3"
packages:
- mysql-server-5.6
- mysql-client-core-5.6
- mysql-client-5.6
services:
- redis-server
@@ -73,6 +77,28 @@ cache:
- $HOME/.npm
install:
- sudo apt-get -y install haveged
- sudo service haveged start
- >
if [ "$DB" = 'mysqli' ];
then
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
sudo stop mysql
sudo mv /var/lib/mysql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/mysql /var/lib/mysql
sudo start mysql
fi
- >
if [ "$DB" = 'pgsql' ];
then
sudo mkdir /mnt/ramdisk
sudo mount -t tmpfs -o size=1024m tmpfs /mnt/ramdisk
sudo service postgresql stop
sudo mv /var/lib/postgresql /mnt/ramdisk
sudo ln -s /mnt/ramdisk/postgresql /var/lib/postgresql
sudo service postgresql start 9.3
fi
- >
if [ "$TASK" = 'PHPUNIT' ];
then
+1 -1
View File
@@ -338,7 +338,7 @@ module.exports = function(grunt) {
opts: {stdio: 'inherit', env: process.env}
}, function(error, result, code) {
// Propagate the exit code.
done(code);
done(code === 0);
});
};
+1 -1
View File
@@ -89,7 +89,7 @@ if ($PAGE->user_allowed_editing()) {
$savebutton = false;
$outputhtml = '';
foreach ($settingspage->children as $childpage) {
if ($childpage->is_hidden()) {
if ($childpage->is_hidden() || !$childpage->check_access()) {
continue;
}
if ($childpage instanceof admin_externalpage) {
+40 -4
View File
@@ -53,7 +53,7 @@ Options:
-h, --help Print out this help
Example:
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8_general_ci
\$ sudo -u www-data /usr/bin/php admin/cli/mysql_collation.php --collation=utf8mb4_unicode_ci
";
if (!empty($options['collation'])) {
@@ -145,9 +145,22 @@ if (!empty($options['collation'])) {
$skipped++;
} else {
$DB->change_database_structure("ALTER TABLE $table->name DEFAULT CHARACTER SET $charset DEFAULT COLLATE = $collation");
echo "CONVERTED\n";
$converted++;
try {
$DB->change_database_structure("ALTER TABLE $table->name CONVERT TO CHARACTER SET $charset COLLATE $collation");
echo "CONVERTED\n";
$converted++;
} catch (ddl_exception $e) {
$result = mysql_set_row_format($table->name, $charset, $collation, $engine);
if ($result) {
echo "CONVERTED\n";
$converted++;
} else {
// We don't know what the problem is. Stop the conversion.
cli_error("Error: Tried to convert $table->name, but there was a problem. Please check the details of this
table and try again.");
die();
}
}
}
$sql = "SHOW FULL COLUMNS FROM $table->name WHERE collation IS NOT NULL";
@@ -290,3 +303,26 @@ function mysql_get_column_collations($tablename) {
$rs->close();
return $collations;
}
function mysql_set_row_format($tablename, $charset, $collation, $engine) {
global $DB;
$sql = "SELECT row_format
FROM INFORMATION_SCHEMA.TABLES
WHERE table_schema = DATABASE() AND table_name = ?";
$rs = $DB->get_record_sql($sql, array($tablename));
if ($rs) {
if ($rs->row_format == 'Compact' || $rs->row_format == 'Redundant') {
$rowformat = $DB->get_row_format_sql($engine, $collation);
// Try to convert to compressed format and then try updating the collation again.
$DB->change_database_structure("ALTER TABLE $tablename $rowformat");
$DB->change_database_structure("ALTER TABLE $tablename CONVERT TO CHARACTER SET $charset COLLATE $collation");
} else {
// Row format may not be the problem. Can not diagnose problem. Send fail reply.
return false;
}
} else {
return false;
}
return true;
}
+1 -1
View File
@@ -232,7 +232,7 @@ class site_registration_form extends moodleform {
}
$language = get_config('hub', 'site_language_' . $cleanhuburl);
if ($language === false) {
$language = current_language();
$language = explode('_', current_language())[0];
}
$geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl);
$contactable = get_config('hub', 'site_contactable_' . $cleanhuburl);
+2 -2
View File
@@ -193,8 +193,8 @@ function print_report_tree($contextid, $contexts, $systemcontext, $fullname, $al
$strgoto = get_string('gotoassignroles', 'core_role', $a);
$strcheck = get_string('checkuserspermissionshere', 'core_role', $a);
}
echo ' <a title="' . $strgoto . '" href="' . $raurl . '">' . $OUTPUT->pix_icon('t/edit', 'core', $stredit) . '</a> ';
echo ' <a title="' . $strcheck . '" href="' . $churl . '">' . $OUTPUT->pix_icon('t/preview', 'core', $strcheckpermissions) . '</a> ';
echo ' <a title="' . $strgoto . '" href="' . $raurl . '">' . $OUTPUT->pix_icon('t/edit', $stredit) . '</a> ';
echo ' <a title="' . $strcheck . '" href="' . $churl . '">' . $OUTPUT->pix_icon('t/preview', $strcheckpermissions) . '</a> ';
echo "</p>\n";
}
}
+2 -1
View File
@@ -179,7 +179,8 @@ preferences,moodle|/user/preferences.php|preferences',
'idnumber' => new lang_string('sort_idnumber', 'admin'),
);
$temp->add(new admin_setting_configselect('navsortmycoursessort', new lang_string('navsortmycoursessort', 'admin'), new lang_string('navsortmycoursessort_help', 'admin'), 'sortorder', $sortoptions));
$temp->add(new admin_setting_configtext('navcourselimit',new lang_string('navcourselimit','admin'),new lang_string('confignavcourselimit', 'admin'),20,PARAM_INT));
$temp->add(new admin_setting_configtext('navcourselimit', new lang_string('navcourselimit', 'admin'),
new lang_string('confignavcourselimit', 'admin'), 10, PARAM_INT));
$temp->add(new admin_setting_configcheckbox('usesitenameforsitepages', new lang_string('usesitenameforsitepages', 'admin'), new lang_string('configusesitenameforsitepages', 'admin'), 0));
$temp->add(new admin_setting_configcheckbox('linkadmincategories', new lang_string('linkadmincategories', 'admin'), new lang_string('linkadmincategories_help', 'admin'), 1));
$temp->add(new admin_setting_configcheckbox('linkcoursesections', new lang_string('linkcoursesections', 'admin'), new lang_string('linkcoursesections_help', 'admin'), 0));
+1 -1
View File
@@ -232,7 +232,7 @@ if ($hassiteconfig) {
// Convert plugins.
$ADMIN->add('modules', new admin_category('fileconverterplugins', new lang_string('type_fileconverter_plural', 'plugin')));
$temp = new admin_settingpage('managefileconverterplugins', new lang_string('type_fileconverter', 'plugin'));
$temp = new admin_settingpage('managefileconverterplugins', new lang_string('type_fileconvertermanage', 'plugin'));
$temp->add(new admin_setting_manage_fileconverter_plugins());
$ADMIN->add('fileconverterplugins', $temp);
+2 -5
View File
@@ -55,9 +55,6 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
$optionalsubsystems->add(new admin_setting_configcheckbox('enableglobalsearch', new lang_string('enableglobalsearch', 'admin'),
new lang_string('enableglobalsearch_desc', 'admin'), 0, 1, 0));
$choices = array();
$choices[0] = new lang_string('no');
$choices[1] = new lang_string('yes');
$optionalsubsystems->add(new admin_setting_configselect('allowstealth', new lang_string('allowstealthmodules'),
new lang_string('allowstealthmodules_help'), 0, $choices));
$optionalsubsystems->add(new admin_setting_configcheckbox('allowstealth', new lang_string('allowstealthmodules'),
new lang_string('allowstealthmodules_help'), 0, 1, 0));
}
+3
View File
@@ -44,5 +44,8 @@ function xmldb_tool_customlang_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -31,7 +31,7 @@ $string['delete_confirmation'] = 'Are you absolutely sure you want to remove <st
$string['deletea'] = 'Delete {$a}';
$string['deletefiletypes'] = 'Delete a file type';
$string['description'] = 'Custom description';
$string['description_help'] = 'Simple file type description, e.g. &lsquo;Kindle ebook&rsquo;. If your site supports multiple languages and uses the multi-language filter, you can enter multi-language tags in this field to supply a description in different languages.';
$string['description_help'] = 'Simple file type description, e.g. \'Kindle ebook\'. If your site supports multiple languages and uses the multi-language filter, you can enter multi-language tags in this field to supply a description in different languages.';
$string['descriptiontype'] = 'Description type';
$string['descriptiontype_help'] = 'There are three possible ways to specify a description.
@@ -49,15 +49,15 @@ $string['error_defaulticon'] = 'Another file extension with the same MIME type i
$string['error_extension'] = 'The file type extension <strong>{$a}</strong> already exists or is invalid. File extensions must be unique and must not contain special characters.';
$string['error_notfound'] = 'The file type with extension {$a} cannot be found.';
$string['extension'] = 'Extension';
$string['extension_help'] = 'File name extension without the dot, e.g. &lsquo;mobi&rsquo;';
$string['extension_help'] = 'File name extension without the dot, e.g. \'mobi\'';
$string['groups'] = 'Type groups';
$string['groups_help'] = 'Optional list of file type groups that this type belongs to. These are generic categories such as &lsquo;document&rsquo; and &lsquo;image&rsquo;.';
$string['groups_help'] = 'Optional list of file type groups that this type belongs to. These are generic categories such as \'document\' and \'image\'.';
$string['icon'] = 'File icon';
$string['icon_help'] = 'Icon filename.
The list of icons is taken from the /pix/f directory inside your Moodle installation. You can add custom icons to this folder if required.';
$string['mimetype'] = 'MIME type';
$string['mimetype_help'] = 'MIME type associated with this file type, e.g. &lsquo;application/x-mobipocket-ebook&rsquo;';
$string['mimetype_help'] = 'MIME type associated with this file type, e.g. \'application/x-mobipocket-ebook\'';
$string['pluginname'] = 'File types';
$string['revert'] = 'Restore {$a} to Moodle defaults';
$string['revert_confirmation'] = 'Are you sure you want to restore <strong>.{$a}</strong> to Moodle defaults, discarding your changes?';
+6 -4
View File
@@ -40,7 +40,7 @@ if (empty($CFG->langotherroot)) {
$mode = optional_param('mode', 0, PARAM_INT); // action
$pack = optional_param_array('pack', array(), PARAM_SAFEDIR); // pack to install
$uninstalllang = optional_param_array('uninstalllang', array(), PARAM_LANG);// installed pack to uninstall
$confirmtounistall = optional_param('confirmtouninstall', '', PARAM_ALPHAEXT); // uninstallation confirmation
$confirmtounistall = optional_param('confirmtouninstall', '', PARAM_SAFEPATH); // uninstallation confirmation
$purgecaches = optional_param('purgecaches', false, PARAM_BOOL); // explicit caches reset
if ($purgecaches) {
@@ -74,7 +74,7 @@ if ($mode == DELETION_OF_SELECTED_LANG and (!empty($uninstalllang) or !empty($co
// Actually deleting languages, languages to delete are passed as GET parameter as string
// ...need to populate them to array.
if (empty($uninstalllang)) {
$uninstalllang = explode('-', $confirmtounistall);
$uninstalllang = explode('/', $confirmtounistall);
}
if (in_array('en', $uninstalllang)) {
@@ -84,8 +84,10 @@ if ($mode == DELETION_OF_SELECTED_LANG and (!empty($uninstalllang) or !empty($co
} else if (empty($confirmtounistall) and confirm_sesskey()) { // User chose langs to be deleted, show confirmation.
echo $OUTPUT->header();
echo $OUTPUT->confirm(get_string('uninstallconfirm', 'tool_langimport', implode(', ', $uninstalllang)),
'index.php?mode='.DELETION_OF_SELECTED_LANG.'&confirmtouninstall='.implode('-', $uninstalllang),
'index.php');
new moodle_url($PAGE->url, array(
'mode' => DELETION_OF_SELECTED_LANG,
'confirmtouninstall' => implode('/', $uninstalllang),
)), $PAGE->url);
echo $OUTPUT->footer();
die;
@@ -84,8 +84,7 @@ abstract class restore_tool_log_logstore_subplugin extends restore_subplugin {
}
}
// Roll dates.
$data->timecreated = $this->apply_date_offset($data->timecreated);
// There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961.
// Revert other to its original php way.
$data->other = unserialize(base64_decode($data->other));
+3
View File
@@ -48,5 +48,8 @@ function xmldb_tool_log_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -88,6 +88,7 @@ class store implements \tool_log\log\writer, \core\log\sql_reader {
$dboptions['dbport'] = $this->get_config('dbport', '');
$dboptions['dbschema'] = $this->get_config('dbschema', '');
$dboptions['dbcollation'] = $this->get_config('dbcollation', '');
$dboptions['dbhandlesoptions'] = $this->get_config('dbhandlesoptions', false);
try {
$db->connect($this->get_config('dbhost'), $this->get_config('dbuser'), $this->get_config('dbpass'),
$this->get_config('dbname'), false, $dboptions);
@@ -42,5 +42,8 @@ function xmldb_logstore_database_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -31,6 +31,8 @@ $string['databasesettings_help'] = 'Connection details for the external log data
$string['databasepersist'] = 'Persistent database connections';
$string['databaseschema'] = 'Database schema';
$string['databasecollation'] = 'Database collation';
$string['databasehandlesoptions'] = 'Database handles options';
$string['databasehandlesoptions_help'] = 'Does the remote database handle its own options.';
$string['databasetable'] = 'Database table';
$string['databasetable_help'] = 'Name of the table where logs will be stored. This table should have a structure identical to the one used by logstore_standard (mdl_logstore_standard_log).';
$string['includeactions'] = 'Include actions of these types';
@@ -54,6 +54,8 @@ if ($hassiteconfig) {
'logstore_database'), '', ''));
$settings->add(new admin_setting_configtext('logstore_database/dbcollation', get_string('databasecollation',
'logstore_database'), '', ''));
$settings->add(new admin_setting_configcheckbox('logstore_database/dbhandlesoptions', get_string('databasehandlesoptions',
'logstore_database'), get_string('databasehandlesoptions_help', 'logstore_database'), '0'));
$settings->add(new admin_setting_configtext('logstore_database/buffersize', get_string('buffersize',
'logstore_database'), get_string('buffersize_help', 'logstore_database'), 50));
@@ -64,6 +64,7 @@ $dboptions['dbsocket'] = get_config('logstore_database', 'dbsocket');
$dboptions['dbport'] = get_config('logstore_database', 'dbport');
$dboptions['dbschema'] = get_config('logstore_database', 'dbschema');
$dboptions['dbcollation'] = get_config('logstore_database', 'dbcollation');
$dboptions['dbhandlesoptions'] = get_config('logstore_database', 'dbhandlesoptions');
try {
$db->connect(get_config('logstore_database', 'dbhost'), get_config('logstore_database', 'dbuser'),
@@ -83,6 +83,11 @@ class logstore_database_store_testcase extends advanced_testcase {
} else {
set_config('dbcollation', '', 'logstore_database');
}
if (!empty($CFG->dboptions['dbhandlesoptions'])) {
set_config('dbhandlesoptions', $CFG->dboptions['dbhandlesoptions'], 'logstore_database');
} else {
set_config('dbhandlesoptions', false, 'logstore_database');
}
// Enable logging plugin.
set_config('enabled_stores', 'logstore_database', 'tool_log');
+11
View File
@@ -0,0 +1,11 @@
This files describes API changes in the logstore_database code.
=== 3.3.1 ===
* PostgreSQL connections now use advanced options to reduce connection overhead. These options are not compatible
with some connection poolers. The dbhandlesoptions parameter has been added to allow the database to configure the
required defaults. The parameters that are required in the database are;
ALTER DATABASE moodle SET client_encoding = UTF8;
ALTER DATABASE moodle SET standard_conforming_strings = on;
ALTER DATABASE moodle SET search_path = 'moodle,public'; -- Optional, if you wish to use a custom schema.
You can set these options against the database or the moodle user who connects.
+1 -1
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2017051501; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2017050500; // Requires this Moodle version.
$plugin->component = 'logstore_database'; // Full name of the plugin (used for diagnostics).
@@ -59,5 +59,8 @@ function xmldb_logstore_standard_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
@@ -51,7 +51,7 @@
</div>
</div>
<div data-region="footer" class="pull-xs-right">
<input type="button" data-action="rate" value="{{#str}}rate, tool_lp{{/str}}" class="btn btn-primary">
<button data-action="rate" class="btn btn-primary">{{#str}}rate, tool_lp{{/str}}</button>
<button data-action="cancel" class="btn btn-secondary">{{#str}}cancel{{/str}}</button>
</div>
<div class="clearfix"></div>
@@ -60,7 +60,7 @@
<div data-region="rule-base" class="form">
<div data-region="rule-outcome" class="form-group">
<label>{{#str}}outcome, tool_lp{{/str}}</label>
<select name="outcome" class="custom-select" ng-label="{{#str}}outcome, tool_lp{{/str}}">
<select name="outcome" class="custom-select">
{{#outcomes}}
<option value="{{code}}" {{#selected}}selected{{/selected}}>{{name}}</option>
{{/outcomes}}
@@ -68,7 +68,7 @@
</div>
<div data-region="rule-type" class="form-group">
<label>{{#str}}when, tool_lp{{/str}}</label>
<select name="rule" class="custom-select" ng-label="{{#str}}when, tool_lp{{/str}}">
<select name="rule" class="custom-select">
<option value="-1">{{#str}}choosedots{{/str}}</option>
{{#rules}}
<option value="{{type}}" {{#selected}}selected{{/selected}}>{{name}}</option>
@@ -81,10 +81,11 @@
{{/config}}
</div>
<div data-region="footer" class="pull-xs-right">
<div data-region="footer" class="pull-xs-right m-t-1">
{{#config}}
<input type="button" class="btn btn-primary" data-action="save" value="{{#str}}savechanges{{/str}}"/>
{{/config}}
<input type="button" class="btn btn-secondary" data-action="cancel" value="{{#str}}cancel{{/str}}"/>
</div>
<div class="clearfix"></div>
</div>
+3
View File
@@ -97,5 +97,8 @@ function xmldb_tool_monitor_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017021300, 'tool', 'monitor');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+5 -5
View File
@@ -72,15 +72,15 @@ $string['issuerimage'] = 'Logo URL';
$string['issuerloginparams'] = 'Additional parameters included in a login request.';
$string['issuerloginparams_help'] = 'Some systems require additional parameters for a login request in order to read the user\'s basic profile.';
$string['issuerloginparamsoffline'] = 'Additional parameters included in a login request for offline access.';
$string['issuerloginparamsoffline_help'] = 'Each OAuth system defines a different way to request offline access. E.g. Google requires the additional params: "access_type=offline&prompt=consent" these parameters should be in url query parameter format.';
$string['issuerloginscopes_help'] = 'Some systems require additional scopes for a login request in order to read the users basic profile. The standard scopes for an OpenID Connect compliant system are "openid profile email".';
$string['issuerloginscopesoffline_help'] = 'Each OAuth system defines a different way to request offline access. E.g. Microsoft requires an additional scope "offline_access"';
$string['issuerloginparamsoffline_help'] = 'Each OAuth system defines a different way to request offline access. E.g. Google requires the additional params: "access_type=offline&prompt=consent". These parameters should be in URL query parameter format.';
$string['issuerloginscopes_help'] = 'Some systems require additional scopes for a login request in order to read the user\'s basic profile. The standard scopes for an OpenID Connect compliant system are "openid profile email".';
$string['issuerloginscopesoffline_help'] = 'Each OAuth system defines a different way to request offline access. E.g. Microsoft requires an additional scope "offline_access".';
$string['issuerloginscopesoffline'] = 'Scopes included in a login request for offline access.';
$string['issuerloginscopes'] = 'Scopes included in a login request.';
$string['issuername_help'] = 'Name of the identity issuer. May be displayed on login page.';
$string['issuername'] = 'Name';
$string['issuershowonloginpage_help'] = 'If the OpenID Connect Authentication plugin is enabled, this login issuer will be listed on the login page to allow users to log in with accounts from this issuer.';
$string['issuershowonloginpage'] = 'Show on login page.';
$string['issuershowonloginpage_help'] = 'If the OAuth 2 authentication plugin is enabled, this login issuer will be listed on the login page to allow users to log in with accounts from this issuer.';
$string['issuershowonloginpage'] = 'Show on login page';
$string['issuers'] = 'Issuers';
$string['loginissuer'] = 'Allow login';
$string['notconfigured'] = 'Not configured';
+2 -2
View File
@@ -31,7 +31,7 @@ $string['default'] = 'Default';
$string['disabled'] = 'Disabled';
$string['disabled_help'] = 'Disabled scheduled tasks are not executed from cron, however they can still be executed manually via the CLI tool.';
$string['edittaskschedule'] = 'Edit task schedule: {$a}';
$string['enablerunnow'] = 'Allow &lsquo;Run now&rsquo; for scheduled tasks';
$string['enablerunnow'] = 'Allow \'Run now\' for scheduled tasks';
$string['enablerunnow_desc'] = 'Allows administrators to run a single scheduled task immediately, rather than waiting for it to run as scheduled. The task runs on the web server, so some sites may wish to disable this feature to avoid potential performance issues.';
$string['faildelay'] = 'Fail delay';
$string['lastruntime'] = 'Last run';
@@ -41,7 +41,7 @@ $string['pluginname'] = 'Scheduled task configuration';
$string['resettasktodefaults'] = 'Reset task schedule to defaults';
$string['resettasktodefaults_help'] = 'This will discard any local changes and revert the schedule for this task back to its original settings.';
$string['runnow'] = 'Run now';
$string['runnow_confirm'] = 'Are you sure you want to run this task &lsquo;{$a}&rsquo; now? The task will run on the web server and may take some time to complete.';
$string['runnow_confirm'] = 'Are you sure you want to run this task \'{$a}\' now? The task will run on the web server and may take some time to complete.';
$string['scheduledtasks'] = 'Scheduled tasks';
$string['scheduledtaskchangesdisabled'] = 'Modifications to the list of scheduled tasks have been prevented in Moodle configuration';
$string['taskdisabled'] = 'Task disabled';
+3
View File
@@ -45,5 +45,8 @@ function xmldb_tool_usertours_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+12 -12
View File
@@ -3187,6 +3187,18 @@ class CAS_Client
false/*$no_response*/, true/*$bad_response*/, $text_response
);
$result = false;
} else if ( $tree_response->getElementsByTagName("authenticationFailure")->length != 0) {
// authentication failed, extract the error code and message and throw exception
$auth_fail_list = $tree_response
->getElementsByTagName("authenticationFailure");
throw new CAS_AuthenticationException(
$this, 'Ticket not validated', $validate_url,
false/*$no_response*/, false/*$bad_response*/,
$text_response,
$auth_fail_list->item(0)->getAttribute('code')/*$err_code*/,
trim($auth_fail_list->item(0)->nodeValue)/*$err_msg*/
);
$result = false;
} else if ($tree_response->getElementsByTagName("authenticationSuccess")->length != 0) {
// authentication succeded, extract the user name
$success_elements = $tree_response
@@ -3227,18 +3239,6 @@ class CAS_Client
$result = true;
}
}
} else if ( $tree_response->getElementsByTagName("authenticationFailure")->length != 0) {
// authentication succeded, extract the error code and message
$auth_fail_list = $tree_response
->getElementsByTagName("authenticationFailure");
throw new CAS_AuthenticationException(
$this, 'Ticket not validated', $validate_url,
false/*$no_response*/, false/*$bad_response*/,
$text_response,
$auth_fail_list->item(0)->getAttribute('code')/*$err_code*/,
trim($auth_fail_list->item(0)->nodeValue)/*$err_msg*/
);
$result = false;
} else {
throw new CAS_AuthenticationException(
$this, 'Ticket not validated', $validate_url,
+1
View File
@@ -2,3 +2,4 @@ Description of phpCAS 1.3.4 library import
* downloaded from http://downloads.jasig.org/cas-clients/php/current/
* MDL-59456 phpCAS library has been patched because of an authentication bypass security vulnerability.
+3
View File
@@ -66,5 +66,8 @@ function xmldb_auth_cas_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'cas');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -42,5 +42,8 @@ function xmldb_auth_db_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017032800, 'auth', 'db');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -42,5 +42,8 @@ function xmldb_auth_email_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'email');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -42,5 +42,8 @@ function xmldb_auth_fc_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'fc');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -42,5 +42,8 @@ function xmldb_auth_imap_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'imap');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+9 -9
View File
@@ -276,7 +276,7 @@ class auth_plugin_ldap extends auth_plugin_base {
}
$ldapval = NULL;
foreach ($values as $value) {
$entry = array_change_key_case($user_entry[0], CASE_LOWER);
$entry = $user_entry[0];
if (($value == 'dn') || ($value == 'distinguishedname')) {
$result[$key] = $user_dn;
continue;
@@ -634,7 +634,7 @@ class auth_plugin_ldap extends auth_plugin_base {
if ($sr) {
$info = ldap_get_entries_moodle($ldapconnection, $sr);
if (!empty ($info)) {
$info = array_change_key_case($info[0], CASE_LOWER);
$info = $info[0];
if (isset($info[$this->config->expireattr][0])) {
$expiretime = $this->ldap_expirationtime2unix($info[$this->config->expireattr][0], $ldapconnection, $user_dn);
if ($expiretime != 0) {
@@ -1201,7 +1201,7 @@ class auth_plugin_ldap extends auth_plugin_base {
return false;
}
$user_entry = array_change_key_case($user_entry[0], CASE_LOWER);
$user_entry = $user_entry[0];
foreach ($attrmap as $key => $ldapkeys) {
$profilefield = '';
@@ -1369,7 +1369,7 @@ class auth_plugin_ldap extends auth_plugin_base {
$sr = ldap_read($ldapconnection, $user_dn, '(objectClass=*)', $search_attribs);
if ($sr) {
$entry = ldap_get_entries_moodle($ldapconnection, $sr);
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
$newattrs = array();
if (!empty($info[$this->config->expireattr][0])) {
// Set expiration time only if passwordExpirationInterval is defined
@@ -1844,7 +1844,7 @@ class auth_plugin_ldap extends auth_plugin_base {
}
$entry = ldap_get_entries_moodle($ldapconn, $sr);
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
$useraccountcontrol = $info['useraccountcontrol'][0];
if ($useraccountcontrol & UF_DONT_EXPIRE_PASSWD) {
// Password doesn't expire.
@@ -1889,17 +1889,17 @@ class auth_plugin_ldap extends auth_plugin_base {
}
$entry = ldap_get_entries_moodle($ldapconn, $sr);
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
$domaindn = $info['defaultnamingcontext'][0];
$sr = ldap_read ($ldapconn, $domaindn, '(objectClass=*)',
array('maxPwdAge'));
$entry = ldap_get_entries_moodle($ldapconn, $sr);
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
$maxpwdage = $info['maxpwdage'][0];
if ($sr = ldap_read($ldapconn, $user_dn, '(objectClass=*)', array('msDS-ResultantPSO'))) {
if ($entry = ldap_get_entries_moodle($ldapconn, $sr)) {
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
$userpso = $info['msds-resultantpso'][0];
// If a PSO exists, FGPP is being utilized.
@@ -1907,7 +1907,7 @@ class auth_plugin_ldap extends auth_plugin_base {
if (!empty($userpso)) {
$sr = ldap_read($ldapconn, $userpso, '(objectClass=*)', array('msDS-MaximumPasswordAge'));
if ($entry = ldap_get_entries_moodle($ldapconn, $sr)) {
$info = array_change_key_case($entry[0], CASE_LOWER);
$info = $entry[0];
// Default value of msds-maximumpasswordage is 42 and is always set.
$maxpwdage = $info['msds-maximumpasswordage'][0];
}
+3
View File
@@ -66,5 +66,8 @@ function xmldb_auth_ldap_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'ldap');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -54,5 +54,8 @@ function xmldb_auth_manual_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'manual');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -53,5 +53,8 @@ function xmldb_auth_mnet_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'mnet');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -42,5 +42,8 @@ function xmldb_auth_nntp_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'nntp');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -42,5 +42,8 @@ function xmldb_auth_none_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'none');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+6 -5
View File
@@ -192,10 +192,10 @@ class api {
];
$confirmationurl = new moodle_url('/auth/oauth2/confirm-linkedlogin.php', $params);
// Remove data parameter just in case it was included in the confirmation so we can add it manually later.
$data->link = $confirmationurl->out();
$data->link = $confirmationurl->out(false);
$message = get_string('confirmlinkedloginemail', 'auth_oauth2', $data);
$message = get_string('confirmlinkedloginemail', 'auth_oauth2', $data);
$data->link = $confirmationurl->out();
$messagehtml = text_to_html(get_string('confirmlinkedloginemail', 'auth_oauth2', $data), false, false, true);
$user->mailformat = 1; // Always send HTML version as well.
@@ -303,9 +303,10 @@ class api {
];
$confirmationurl = new moodle_url('/auth/oauth2/confirm-account.php', $params);
$data->link = $confirmationurl->out();
$data->link = $confirmationurl->out(false);
$message = get_string('confirmaccountemail', 'auth_oauth2', $data);
$message = get_string('confirmaccountemail', 'auth_oauth2', $data);
$data->link = $confirmationurl->out();
$messagehtml = text_to_html(get_string('confirmaccountemail', 'auth_oauth2', $data), false, false, true);
$user->mailformat = 1; // Always send HTML version as well.
+7 -3
View File
@@ -247,6 +247,10 @@ class auth extends \auth_plugin_base {
if (!empty($user->picture)) {
return false;
}
if (!empty($CFG->enablegravatar)) {
return false;
}
$picture = $this->get_static_user_picture();
if (empty($picture)) {
return false;
@@ -342,7 +346,7 @@ class auth extends \auth_plugin_base {
* Complete the login process after oauth handshake is complete.
* @param \core\oauth2\client $client
* @param string $redirecturl
* @return none Either redirects or throws an exception
* @return void Either redirects or throws an exception
*/
public function complete_login(client $client, $redirecturl) {
global $CFG, $SESSION, $PAGE;
@@ -352,7 +356,7 @@ class auth extends \auth_plugin_base {
if (!$userinfo) {
// Trigger login failed event.
$failurereason = AUTH_LOGIN_NOUSER;
$event = \core\event\user_login_failed::create(['other' => ['username' => $userinfo['username'],
$event = \core\event\user_login_failed::create(['other' => ['username' => 'unknown',
'reason' => $failurereason]]);
$event->trigger();
@@ -364,7 +368,7 @@ class auth extends \auth_plugin_base {
if (empty($userinfo['username']) || empty($userinfo['email'])) {
// Trigger login failed event.
$failurereason = AUTH_LOGIN_NOUSER;
$event = \core\event\user_login_failed::create(['other' => ['username' => $userinfo['username'],
$event = \core\event\user_login_failed::create(['other' => ['username' => 'unknown',
'reason' => $failurereason]]);
$event->trigger();
+3
View File
@@ -38,5 +38,8 @@ function xmldb_auth_oauth2_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -42,5 +42,8 @@ function xmldb_auth_pam_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'pam');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -42,5 +42,8 @@ function xmldb_auth_pop3_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'pop3');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -42,5 +42,8 @@ function xmldb_auth_shibboleth_upgrade($oldversion) {
upgrade_plugin_savepoint(true, 2017020700, 'auth', 'shibboleth');
}
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+11
View File
@@ -15,6 +15,17 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* This script is used to configure and execute the backup proccess.
*
* @package core
* @subpackage backup
* @copyright Moodle
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../config.php');
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plan_builder.class.php');
+26
View File
@@ -1,5 +1,31 @@
<?php
// 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/>.
/**
* This script is used to configure and execute the import proccess.
*
* @package core
* @subpackage backup
* @copyright Moodle
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
// Require both the backup and restore libs
require_once('../config.php');
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
+7 -4
View File
@@ -2658,8 +2658,9 @@ class restore_calendarevents_structure_step extends restore_structure_step {
$isuseroverride = !$data->courseid && $data->modulename && $data->instance;
// If we don't want to include user data and this record is a user override event
// for an activity then we should not create it.
if (!$this->task->get_setting_value('userinfo') && $isuseroverride) {
// for an activity then we should not create it. (Only activity events can be user override events - which must have this
// setting).
if ($isuseroverride && $this->task->setting_exists('userinfo') && !$this->task->get_setting_value('userinfo')) {
return;
}
@@ -3082,7 +3083,8 @@ class restore_course_logs_structure_step extends restore_structure_step {
$data = (object)($data);
$data->time = $this->apply_date_offset($data->time);
// There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961.
$data->userid = $this->get_mappingid('user', $data->userid);
$data->course = $this->get_courseid();
$data->cmid = 0;
@@ -3129,7 +3131,8 @@ class restore_activity_logs_structure_step extends restore_course_logs_structure
$data = (object)($data);
$data->time = $this->apply_date_offset($data->time);
// There is no need to roll dates. Logs are supposed to be immutable. See MDL-44961.
$data->userid = $this->get_mappingid('user', $data->userid);
$data->course = $this->get_courseid();
$data->cmid = $this->task->get_moduleid();
@@ -0,0 +1,99 @@
<?php
// 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/>.
/**
* Tests for backup_xml_transformer class.
*
* @package core_backup
* @subpackage moodle2
* @category backup
* @copyright 2017 Dmitrii Metelkin (dmitriim@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/moodle2/backup_plan_builder.class.php');
/**
* Tests for backup_xml_transformer.
*
* @package core_backup
* @copyright 2017 Dmitrii Metelkin (dmitriim@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class backup_xml_transformer_testcase extends advanced_testcase {
/**
* Initial set up.
*/
public function setUp() {
parent::setUp();
$this->resetAfterTest(true);
}
/**
* Data provider for ::test_filephp_links_replace.
*
* @return array
*/
public function filephp_links_replace_data_provider() {
return array(
array('http://test.test/', 'http://test.test/'),
array('http://test.test/file.php/1', 'http://test.test/file.php/1'),
array('http://test.test/file.php/2/1.jpg', 'http://test.test/file.php/2/1.jpg'),
array('http://test.test/file.php/2', 'http://test.test/file.php/2'),
array('http://test.test/file.php/1/1.jpg', '$@FILEPHP@$$@SLASH@$1.jpg'),
array('http://test.test/file.php/1//1.jpg', '$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=/1', '$@FILEPHP@$'),
array('http://test.test/file.php?file=/2/1.jpg', 'http://test.test/file.php?file=/2/1.jpg'),
array('http://test.test/file.php?file=/2', 'http://test.test/file.php?file=/2'),
array('http://test.test/file.php?file=/1/1.jpg', '$@FILEPHP@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=/1//1.jpg', '$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=%2f1', '$@FILEPHP@$'),
array('http://test.test/file.php?file=%2f2%2f1.jpg', 'http://test.test/file.php?file=%2f2%2f1.jpg'),
array('http://test.test/file.php?file=%2f2', 'http://test.test/file.php?file=%2f2'),
array('http://test.test/file.php?file=%2f1%2f1.jpg', '$@FILEPHP@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=%2f1%2f%2f1.jpg', '$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=%2F1', '$@FILEPHP@$'),
array('http://test.test/file.php?file=%2F2%2F1.jpg', 'http://test.test/file.php?file=%2F2%2F1.jpg'),
array('http://test.test/file.php?file=%2F2', 'http://test.test/file.php?file=%2F2'),
array('http://test.test/file.php?file=%2F1%2F1.jpg', '$@FILEPHP@$$@SLASH@$1.jpg'),
array('http://test.test/file.php?file=%2F1%2F%2F1.jpg', '$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'),
);
}
/**
* Test that backup_xml_transformer replaces file php links to $@FILEPHP@$.
*
* @dataProvider filephp_links_replace_data_provider
* @param string $content Testing content.
* @param string $expected Expected result.
*/
public function test_filephp_links_replace($content, $expected) {
global $CFG;
$CFG->wwwroot = 'http://test.test';
$transformer = new backup_xml_transformer(1);
$this->assertEquals($expected, $transformer->process($content));
}
}
+25 -1
View File
@@ -1,5 +1,29 @@
<?php
//This script is used to configure and execute the restore proccess.
// 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/>.
/**
* This script is used to configure and execute the restore proccess.
*
* @package core
* @subpackage backup
* @copyright Moodle
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define('NO_OUTPUT_BUFFERING', true);
require_once('../config.php');
require_once($CFG->dirroot . '/backup/util/includes/restore_includes.php');
@@ -60,17 +60,26 @@ class restore_structure_parser_processor extends grouped_parser_processor {
} else if (strpos($cdata, '$@FILEPHP@$') === false) { // No $@FILEPHP@$, nothing to convert
return $cdata;
}
if ($CFG->slasharguments) {
$slash = '/';
$forcedownload = '?forcedownload=1';
} else {
$slash = '%2F';
$forcedownload = '&amp;forcedownload=1';
}
// We have to remove trailing slashes, otherwise file URLs will be restored with an extra slash.
$basefileurl = rtrim(moodle_url::make_legacyfile_url($this->courseid, null)->out(true), $slash);
// Decode file.php calls
$search = array ("$@FILEPHP@$");
$replace = array(moodle_url::make_legacyfile_url($this->courseid, null));
$replace = array($basefileurl);
$result = str_replace($search, $replace, $cdata);
// Now $@SLASH@$ and $@FORCEDOWNLOAD@$ MDL-18799
$search = array('$@SLASH@$', '$@FORCEDOWNLOAD@$');
if ($CFG->slasharguments) {
$replace = array('/', '?forcedownload=1');
} else {
$replace = array('%2F', '&amp;forcedownload=1');
}
$replace = array($slash, $forcedownload);
return str_replace($search, $replace, $result);
}
@@ -0,0 +1,132 @@
<?php
// 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/>.
/**
* Tests for restore_structure_parser_processor class.
*
* @package core_backup
* @category test
* @copyright 2017 Dmitrii Metelkin (dmitriim@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
global $CFG;
require_once($CFG->dirroot . '/backup/util/includes/backup_includes.php');
require_once($CFG->dirroot . '/backup/util/helper/restore_structure_parser_processor.class.php');
/**
* Tests for restore_structure_parser_processor class.
*
* @package core_backup
* @copyright 2017 Dmitrii Metelkin (dmitriim@catalyst-au.net)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class restore_structure_parser_processor_test extends advanced_testcase {
/**
* Initial set up.
*/
public function setUp() {
parent::setUp();
$this->resetAfterTest(true);
}
/**
* Data provider for ::test_process_cdata.
*
* @return array
*/
public function process_cdata_data_provider() {
return array(
array(null, null, true),
array("$@NULL@$", null, true),
array("$@NULL@$ ", "$@NULL@$ ", true),
array(1, 1, true),
array(" ", " ", true),
array("1", "1", true),
array("$@FILEPHP@$1.jpg", "$@FILEPHP@$1.jpg", true),
array(
"http://test.test/$@SLASH@$",
"http://test.test/$@SLASH@$",
true
),
array(
"<a href='$@FILEPHP@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php/11.jpg'>Image</a>",
true
),
array(
"<a href='$@FILEPHP@$$@SLASH@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php/1/1.jpg'>Image</a>",
true
),
array(
"<a href='$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php/1//1.jpg'>Image</a>",
true
),
array(
"<a href='$@FILEPHP@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php?file=%2F11.jpg'>Image</a>",
false
),
array(
"<a href='$@FILEPHP@$$@SLASH@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php?file=%2F1%2F1.jpg'>Image</a>",
false
),
array(
"<a href='$@FILEPHP@$$@SLASH@$$@SLASH@$1.jpg'>Image</a>",
"<a href='http://test.test/file.php?file=%2F1%2F%2F1.jpg'>Image</a>",
false
),
array(
"<a href='$@FILEPHP@$$@SLASH@$1.jpg$@FORCEDOWNLOAD@$'>Image</a>",
"<a href='http://test.test/file.php/1/1.jpg?forcedownload=1'>Image</a>",
true
),
array(
"<a href='$@FILEPHP@$$@SLASH@$1.jpg$@FORCEDOWNLOAD@$'>Image</a>",
"<a href='http://test.test/file.php?file=%2F1%2F1.jpg&amp;forcedownload=1'>Image</a>",
false
),
);
}
/**
* Test that restore_structure_parser_processor replaces $@FILEPHP@$ to correct file php links.
*
* @dataProvider process_cdata_data_provider
* @param string $content Testing content.
* @param string $expected Expected result.
* @param bool $slasharguments A value for $CFG->slasharguments setting.
*/
public function test_process_cdata($content, $expected, $slasharguments) {
global $CFG;
$CFG->slasharguments = $slasharguments;
$CFG->wwwroot = 'http://test.test';
$processor = new restore_structure_parser_processor(1, 1);
$this->assertEquals($expected, $processor->process_cdata($content));
}
}
+3
View File
@@ -88,5 +88,8 @@ function xmldb_block_badges_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -88,5 +88,8 @@ function xmldb_block_calendar_month_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -88,5 +88,8 @@ function xmldb_block_calendar_upcoming_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -61,5 +61,8 @@ function xmldb_block_community_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -63,5 +63,8 @@ function xmldb_block_completionstatus_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+4 -4
View File
@@ -90,7 +90,7 @@ echo html_writer::start_tag('tbody');
if ($USER->id != $user->id) {
echo html_writer::start_tag('tr');
echo html_writer::start_tag('td', array('colspan' => '2'));
echo html_writer::tag('b', get_string('showinguser', 'completion'));
echo html_writer::tag('b', get_string('showinguser', 'completion') . ' ');
$url = new moodle_url('/user/view.php', array('id' => $user->id, 'course' => $course->id));
echo html_writer::link($url, fullname($user));
echo html_writer::end_tag('td');
@@ -99,7 +99,7 @@ if ($USER->id != $user->id) {
echo html_writer::start_tag('tr');
echo html_writer::start_tag('td', array('colspan' => '2'));
echo html_writer::tag('b', get_string('status'));
echo html_writer::tag('b', get_string('status') . ' ');
// Is course complete?
$coursecomplete = $info->is_course_complete($user->id);
@@ -141,7 +141,7 @@ if (empty($completions)) {
} else {
echo html_writer::start_tag('tr');
echo html_writer::start_tag('td', array('colspan' => '2'));
echo html_writer::tag('b', get_string('required'));
echo html_writer::tag('b', get_string('required') . ' ');
// Get overall aggregation method.
$overall = $info->get_aggregation_method();
@@ -214,7 +214,7 @@ if (empty($completions)) {
echo core_text::strtolower(get_string('any', 'completion'));
}
echo html_writer::end_tag('i') .core_text::strtolower(get_string('required')).')';
echo ' ' . html_writer::end_tag('i') .core_text::strtolower(get_string('required')).')';
$agg_type = false;
}
}
+3
View File
@@ -63,5 +63,8 @@ function xmldb_block_course_summary_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -48,5 +48,8 @@ function xmldb_block_html_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+1 -1
View File
@@ -115,7 +115,7 @@ class block_login extends block_base {
$this->content->text .= '<div class="potentialidplist">';
foreach ($potentialidps as $idp) {
$this->content->text .= '<div class="potentialidp">';
$this->content->text .= '<a class="btn btn-secondary btn-block" ';
$this->content->text .= '<a class="btn btn-default btn-block" ';
$this->content->text .= 'href="' . $idp['url']->out() . '" title="' . s($idp['name']) . '">';
if (!empty($idp['iconurl'])) {
$this->content->text .= '<img src="' . s($idp['iconurl']) . '" width="24" height="24" class="m-r-1"/>';
+1
View File
@@ -0,0 +1 @@
define(["jquery","core/ajax","core/custom_interaction_events","core/notification"],function(a,b,c,d){var e=function(e){c.define(e,[c.events.activate]),e.on(c.events.activate,"[data-toggle='tab']",function(c){var e=a(c.currentTarget).data("tabname");"function"==typeof window.history.pushState&&window.history.pushState(null,null,"?myoverviewtab="+e);var f={methodname:"core_user_update_user_preferences",args:{preferences:[{type:"block_myoverview_last_tab",value:e}]}};b.call([f])[0].fail(d.exception)})};return{registerEventListeners:e}});
@@ -0,0 +1,61 @@
// 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/>.
/**
* Javascript used to save the user's tab preference.
*
* @package block_myoverview
* @copyright 2017 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery', 'core/ajax', 'core/custom_interaction_events',
'core/notification'], function($, Ajax, CustomEvents, Notification) {
/**
* Registers an event that saves the user's tab preference when switching between them.
*
* @param {object} root The container element
*/
var registerEventListeners = function(root) {
CustomEvents.define(root, [CustomEvents.events.activate]);
root.on(CustomEvents.events.activate, "[data-toggle='tab']", function(e) {
var tabname = $(e.currentTarget).data('tabname');
// Bootstrap does not change the URL when using BS tabs, so need to do this here.
// Also check to make sure the browser supports the history API.
if (typeof window.history.pushState === "function") {
window.history.pushState(null, null, '?myoverviewtab=' + tabname);
}
var request = {
methodname: 'core_user_update_user_preferences',
args: {
preferences: [
{
type: 'block_myoverview_last_tab',
value: tabname
}
]
}
};
Ajax.call([request])[0]
.fail(Notification.exception);
});
};
return {
registerEventListeners: registerEventListeners
};
});
+19 -1
View File
@@ -50,7 +50,16 @@ class block_myoverview extends block_base {
return $this->content;
}
$renderable = new \block_myoverview\output\main();
// Check if the tab to select wasn't passed in the URL, if so see if the user has any preference.
if (!$tab = optional_param('myoverviewtab', null, PARAM_ALPHA)) {
// Check if the user has no preference, if so get the site setting.
if (!$tab = get_user_preferences('block_myoverview_last_tab')) {
$config = get_config('block_myoverview');
$tab = $config->defaulttab;
}
}
$renderable = new \block_myoverview\output\main($tab);
$renderer = $this->page->get_renderer('block_myoverview');
$this->content = new stdClass();
@@ -68,4 +77,13 @@ class block_myoverview extends block_base {
public function applicable_formats() {
return array('my' => true);
}
/**
* This block does contain a configuration settings.
*
* @return boolean
*/
public function has_config() {
return true;
}
}
@@ -63,7 +63,8 @@ class courses_view implements renderable, templatable {
* @return array
*/
public function export_for_template(renderer_base $output) {
$today = time();
global $CFG;
require_once($CFG->dirroot.'/course/lib.php');
// Build courses view data structure.
$coursesview = [
@@ -73,8 +74,6 @@ class courses_view implements renderable, templatable {
// How many courses we have per status?
$coursesbystatus = ['past' => 0, 'inprogress' => 0, 'future' => 0];
foreach ($this->courses as $course) {
$startdate = $course->startdate;
$enddate = $course->enddate;
$courseid = $course->id;
$context = \context_course::instance($courseid);
$exporter = new course_summary_exporter($course, [
@@ -84,14 +83,17 @@ class courses_view implements renderable, templatable {
// Convert summary to plain text.
$exportedcourse->summary = content_to_text($exportedcourse->summary, $exportedcourse->summaryformat);
$courseprogress = null;
$classified = course_classify_for_timeline($course);
if (isset($this->coursesprogress[$courseid])) {
$coursecompleted = $this->coursesprogress[$courseid]['completed'];
$courseprogress = $this->coursesprogress[$courseid]['progress'];
$exportedcourse->hasprogress = !is_null($courseprogress);
$exportedcourse->progress = $courseprogress;
}
if ((isset($coursecompleted) && $coursecompleted) || (!empty($enddate) && $enddate < $today)) {
if ($classified == COURSE_TIMELINE_PAST) {
// Courses that have already ended.
$pastpages = floor($coursesbystatus['past'] / $this::COURSES_PER_PAGE);
@@ -100,7 +102,7 @@ class courses_view implements renderable, templatable {
$coursesview['past']['pages'][$pastpages]['page'] = $pastpages + 1;
$coursesview['past']['haspages'] = true;
$coursesbystatus['past']++;
} else if ($startdate > $today) {
} else if ($classified == COURSE_TIMELINE_FUTURE) {
// Courses that have not started yet.
$futurepages = floor($coursesbystatus['future'] / $this::COURSES_PER_PAGE);
+27 -1
View File
@@ -29,6 +29,7 @@ use renderer_base;
use templatable;
use core_completion\progress;
require_once($CFG->dirroot . '/blocks/myoverview/lib.php');
require_once($CFG->libdir . '/completionlib.php');
/**
@@ -39,6 +40,20 @@ require_once($CFG->libdir . '/completionlib.php');
*/
class main implements renderable, templatable {
/**
* @var string The tab to display.
*/
public $tab;
/**
* Constructor.
*
* @param string $tab The tab to display.
*/
public function __construct($tab) {
$this->tab = $tab;
}
/**
* Export this data so it can be used as the context for a mustache template.
*
@@ -73,13 +88,24 @@ class main implements renderable, templatable {
$nocoursesurl = $output->image_url('courses', 'block_myoverview')->out();
$noeventsurl = $output->image_url('activities', 'block_myoverview')->out();
// Now, set the tab we are going to be viewing.
$viewingtimeline = false;
$viewingcourses = false;
if ($this->tab == BLOCK_MYOVERVIEW_TIMELINE_VIEW) {
$viewingtimeline = true;
} else {
$viewingcourses = true;
}
return [
'midnight' => usergetmidnight(time()),
'coursesview' => $coursesview->export_for_template($output),
'urls' => [
'nocourses' => $nocoursesurl,
'noevents' => $noeventsurl
]
],
'viewingtimeline' => $viewingtimeline,
'viewingcourses' => $viewingcourses
];
}
}
@@ -22,6 +22,8 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$string['defaulttab'] = 'Default tab';
$string['defaulttab_desc'] = 'The tab that will be displayed when a user first views their course overview. When returning to their course overview, the user\'s active tab is remembered.';
$string['future'] = 'Future';
$string['inprogress'] = 'In progress';
$string['morecourses'] = 'More courses';
+52
View File
@@ -0,0 +1,52 @@
<?php
// 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/>.
/**
* Contains functions called by core.
*
* @package block_myoverview
* @copyright 2017 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* The timeline view.
*/
define('BLOCK_MYOVERVIEW_TIMELINE_VIEW', 'timeline');
/**
* The courses view.
*/
define('BLOCK_MYOVERVIEW_COURSES_VIEW', 'courses');
/**
* Returns the name of the user preferences as well as the details this plugin uses.
*
* @return array
*/
function block_myoverview_user_preferences() {
$preferences = array();
$preferences['block_myoverview_last_tab'] = array(
'type' => PARAM_ALPHA,
'null' => NULL_NOT_ALLOWED,
'default' => BLOCK_MYOVERVIEW_TIMELINE_VIEW,
'choices' => array(BLOCK_MYOVERVIEW_TIMELINE_VIEW, BLOCK_MYOVERVIEW_COURSES_VIEW)
);
return $preferences;
}
+39
View File
@@ -0,0 +1,39 @@
<?php
// 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/>.
/**
* Settings for the overview block.
*
* @package block_myoverview
* @copyright 2017 Mark Nelson <markn@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die;
require_once($CFG->dirroot . '/blocks/myoverview/lib.php');
if ($ADMIN->fulltree) {
$options = [
BLOCK_MYOVERVIEW_TIMELINE_VIEW => get_string('timeline', 'block_myoverview'),
BLOCK_MYOVERVIEW_COURSES_VIEW => get_string('courses')
];
$settings->add(new admin_setting_configselect('block_myoverview/defaulttab',
get_string('defaulttab', 'block_myoverview'),
get_string('defaulttab_desc', 'block_myoverview'), 'timeline', $options));
}
+11 -5
View File
@@ -24,26 +24,32 @@
}}
<div id="block-myoverview-{{uniqid}}" class="block-myoverview" data-region="myoverview">
<ul class="nav nav-tabs" role="tablist">
<ul id="block-myoverview-view-choices-{{uniqid}}" class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a class="nav-link active" href="#myoverview_timeline_view" role="tab" data-toggle="tab">
<a class="nav-link {{#viewingtimeline}}active{{/viewingtimeline}}" href="#myoverview_timeline_view" role="tab" data-toggle="tab" data-tabname="timeline">
{{#str}} timeline, block_myoverview {{/str}}
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#myoverview_courses_view" role="tab" data-toggle="tab">
<a class="nav-link {{#viewingcourses}}active{{/viewingcourses}}" href="#myoverview_courses_view" role="tab" data-toggle="tab" data-tabname="courses">
{{#str}} courses {{/str}}
</a>
</li>
</ul>
<div class="tab-content content-centred">
<div role="tabpanel" class="tab-pane fade in active" id="myoverview_timeline_view">
<div role="tabpanel" class="tab-pane fade {{#viewingtimeline}}in active{{/viewingtimeline}}" id="myoverview_timeline_view">
{{> block_myoverview/timeline-view }}
</div>
<div role="tabpanel" class="tab-pane fade" id="myoverview_courses_view">
<div role="tabpanel" class="tab-pane fade {{#viewingcourses}}in active{{/viewingcourses}}" id="myoverview_courses_view">
{{#coursesview}}
{{> block_myoverview/courses-view }}
{{/coursesview}}
</div>
</div>
</div>
{{#js}}
require(['jquery', 'block_myoverview/tab_preferences'], function($, TabPreferences) {
var root = $('#block-myoverview-view-choices-{{uniqid}}');
TabPreferences.registerEventListeners(root);
});
{{/js}}
@@ -53,6 +53,7 @@ Feature: Course overview block show users their progress on courses
And I am on "Course 1" course homepage
And I follow "Test choice 1"
And I follow "Dashboard" in the user menu
And I click on "Timeline" "link" in the "Course overview" "block"
And I click on "Sort by courses" "link" in the "Course overview" "block"
And I should see "100%" in the "Course overview" "block"
And I click on "Courses" "link" in the "Course overview" "block"
+1 -1
View File
@@ -24,6 +24,6 @@
defined('MOODLE_INTERNAL') || die();
$plugin->version = 2017051500; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2017051502; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2017050500; // Requires this Moodle version.
$plugin->component = 'block_myoverview'; // Full name of the plugin (used for diagnostics).
+1 -1
View File
@@ -1 +1 @@
define(["jquery"],function(a){function b(d,e){var f=a("<ul></ul>");f.attr("role","group"),f.attr("aria-hidden",!0),a.each(e,function(d,e){if("object"==typeof e){var g=a("<li></li>"),h=a("<p></p>"),i=e.id||e.key+"_tree_item",j=null,k=!(!e.expandable&&!e.haschildren);if(h.addClass("tree_item"),h.attr("id",i),h.attr("role","treeitem"),h.attr("tabindex","-1"),e.requiresajaxloading&&(h.attr("data-requires-ajax",!0),h.attr("data-node-id",e.id),h.attr("data-node-key",e.key),h.attr("data-node-type",e.type)),k&&(g.addClass("collapsed contains_branch"),h.attr("aria-expanded",!1),h.addClass("branch")),!e.icon||k&&e.type!==c.ACTIVITY&&e.type!==c.RESOURCE||(g.addClass("item_with_icon"),h.addClass("hasicon"),j=a("<img/>"),j.attr("alt",e.icon.alt),j.attr("title",e.icon.title),j.attr("src",M.util.image_url(e.icon.pix,e.icon.component)),a.each(e.icon.classes,function(a,b){j.addClass(b)})),e.link){var l=a('<a title="'+e.title+'" href="'+e.link+'"></a>');j?(l.append(j),l.append('<span class="item-content-wrap">'+e.name+"</span>")):l.append(e.name),e.hidden&&l.addClass("dimmed"),h.append(l)}else{var m=a("<span></span>");j?(m.append(j),m.append('<span class="item-content-wrap">'+e.name+"</span>")):m.append(e.name),e.hidden&&m.addClass("dimmed"),h.append(m)}g.append(h),f.append(g),e.children&&e.children.length?b(h,e.children):k&&!e.requiresajaxloading&&(g.removeClass("contains_branch"),h.addClass("emptybranch"))}}),d.parent().append(f);var g=d.attr("id")+"_group";f.attr("id",g),d.attr("aria-owns",g),d.attr("role","treeitem")}var c={ACTIVITY:40,RESOURCE:50};return{render:function(a,c){if(c.children&&c.children.length){b(a,c.children);var d=a.children("[role='treeitem']").first(),e=a.find("#"+d.attr("aria-owns"));d.attr("aria-expanded",!0),e.attr("aria-hidden",!1)}else a.parent().hasClass("contains_branch")&&(a.parent().removeClass("contains_branch"),a.addClass("emptybranch"))}}});
define(["jquery","core/templates","core/notification","core/url"],function(a,b,c,d){function e(g,h){var i=a("<ul></ul>");i.attr("role","group"),i.attr("aria-hidden",!0),a.each(h,function(g,h){if("object"==typeof h){var j=a("<li></li>"),k=a("<p></p>"),l=h.id||h.key+"_tree_item",m=null,n=!(!h.expandable&&!h.haschildren);k.addClass("tree_item"),k.attr("id",l),k.attr("role","treeitem"),k.attr("tabindex","-1"),h.requiresajaxloading&&(k.attr("data-requires-ajax",!0),k.attr("data-node-id",h.id),k.attr("data-node-key",h.key),k.attr("data-node-type",h.type)),n&&(j.addClass("collapsed contains_branch"),k.attr("aria-expanded",!1),k.addClass("branch"));var o=null;if(h.link){var p=a('<a title="'+h.title+'" href="'+h.link+'"></a>');o=p,p.append('<span class="item-content-wrap">'+h.name+"</span>"),h.hidden&&p.addClass("dimmed"),k.append(p)}else{var q=a("<span></span>");o=q,q.append('<span class="item-content-wrap">'+h.name+"</span>"),h.hidden&&q.addClass("dimmed"),k.append(q)}!h.icon||n&&h.type!==f.ACTIVITY&&h.type!==f.RESOURCE||(j.addClass("item_with_icon"),k.addClass("hasicon"),h.type===f.ACTIVITY||h.type===f.RESOURCE?(m=a("<img/>"),m.attr("alt",h.icon.alt),m.attr("title",h.icon.title),m.attr("src",d.imageUrl(h.icon.pix,h.icon.component)),a.each(h.icon.classes,function(a,b){m.addClass(b)}),o.prepend(m)):("moodle"==h.icon.component&&(h.icon.component="core"),b.renderPix(h.icon.pix,h.icon.component,h.icon.title).then(function(a){o.prepend(a)})["catch"](c.exception))),j.append(k),i.append(j),h.children&&h.children.length?e(k,h.children):n&&!h.requiresajaxloading&&(j.removeClass("contains_branch"),k.addClass("emptybranch"))}}),g.parent().append(i);var j=g.attr("id")+"_group";i.attr("id",j),g.attr("aria-owns",j),g.attr("role","treeitem")}var f={ACTIVITY:40,RESOURCE:50};return{render:function(a,b){if(b.children&&b.children.length){e(a,b.children);var c=a.children("[role='treeitem']").first(),d=a.find("#"+c.attr("aria-owns"));c.attr("aria-expanded",!0),d.attr("aria-hidden",!1)}else a.parent().hasClass("contains_branch")&&(a.parent().removeClass("contains_branch"),a.addClass("emptybranch"))}}});
@@ -22,7 +22,7 @@
* @copyright 2015 John Okely <john@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['jquery'], function($) {
define(['jquery', 'core/templates', 'core/notification', 'core/url'], function($, Templates, Notification, Url) {
// Mappings for the different types of nodes coming from the navigation.
// Copied from lib/navigationlib.php navigation_node constants.
@@ -75,28 +75,12 @@ define(['jquery'], function($) {
p.addClass('branch');
}
if (node.icon && (!isBranch || node.type === NODETYPE.ACTIVITY || node.type === NODETYPE.RESOURCE)) {
li.addClass('item_with_icon');
p.addClass('hasicon');
icon = $('<img/>');
icon.attr('alt', node.icon.alt);
icon.attr('title', node.icon.title);
icon.attr('src', M.util.image_url(node.icon.pix, node.icon.component));
$.each(node.icon.classes, function(index, className) {
icon.addClass(className);
});
}
var eleToAddIcon = null;
if (node.link) {
var link = $('<a title="' + node.title + '" href="' + node.link + '"></a>');
if (icon) {
link.append(icon);
link.append('<span class="item-content-wrap">' + node.name + '</span>');
} else {
link.append(node.name);
}
eleToAddIcon = link;
link.append('<span class="item-content-wrap">' + node.name + '</span>');
if (node.hidden) {
link.addClass('dimmed');
@@ -106,12 +90,8 @@ define(['jquery'], function($) {
} else {
var span = $('<span></span>');
if (icon) {
span.append(icon);
span.append('<span class="item-content-wrap">' + node.name + '</span>');
} else {
span.append(node.name);
}
eleToAddIcon = span;
span.append('<span class="item-content-wrap">' + node.name + '</span>');
if (node.hidden) {
span.addClass('dimmed');
@@ -120,6 +100,31 @@ define(['jquery'], function($) {
p.append(span);
}
if (node.icon && (!isBranch || node.type === NODETYPE.ACTIVITY || node.type === NODETYPE.RESOURCE)) {
li.addClass('item_with_icon');
p.addClass('hasicon');
if (node.type === NODETYPE.ACTIVITY || node.type === NODETYPE.RESOURCE) {
icon = $('<img/>');
icon.attr('alt', node.icon.alt);
icon.attr('title', node.icon.title);
icon.attr('src', Url.imageUrl(node.icon.pix, node.icon.component));
$.each(node.icon.classes, function(index, className) {
icon.addClass(className);
});
eleToAddIcon.prepend(icon);
} else {
if (node.icon.component == 'moodle') {
node.icon.component = 'core';
}
Templates.renderPix(node.icon.pix, node.icon.component, node.icon.title).then(function(html) {
// Prepend.
eleToAddIcon.prepend(html);
return;
}).catch(Notification.exception);
}
}
li.append(p);
ul.append(li);
+3
View File
@@ -70,5 +70,8 @@ function xmldb_block_navigation_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+1 -1
View File
@@ -71,6 +71,6 @@
display: block;
}
.block_navigation .block_tree [aria-hidden="true"] {
.block_navigation .block_tree [aria-hidden="true"]:not(.icon) {
display: none;
}
+3
View File
@@ -113,5 +113,8 @@ function xmldb_block_quiz_results_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -62,5 +62,8 @@ function xmldb_block_recent_activity_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -59,5 +59,8 @@ function xmldb_block_rss_client_upgrade($oldversion) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -64,5 +64,8 @@ function xmldb_block_section_links_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -63,5 +63,8 @@ function xmldb_block_selfcompletion_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+3
View File
@@ -70,5 +70,8 @@ function xmldb_block_settings_upgrade($oldversion, $block) {
// Automatically generated Moodle v3.2.0 release upgrade line.
// Put any upgrade step following this.
// Automatically generated Moodle v3.3.0 release upgrade line.
// Put any upgrade step following this.
return true;
}
+1 -1
View File
@@ -58,7 +58,7 @@
display: block;
}
.block_settings .block_tree [aria-hidden="true"] {
.block_settings .block_tree [aria-hidden="true"]:not(.icon) {
display: none;
}
+2 -2
View File
@@ -1077,7 +1077,7 @@ class cache implements cache_loader {
$result = $data;
}
}
if ($result) {
if ($result !== false) {
if ($this->perfdebug) {
cache_helper::record_cache_hit('** static acceleration **', $this->definition);
}
@@ -2162,4 +2162,4 @@ class cache_session extends cache {
*/
class cache_request extends cache {
// This comment appeases code pre-checker ;) !
}
}
+33
View File
@@ -2177,6 +2177,39 @@ class core_cache_testcase extends advanced_testcase {
$startstats[$requestid]['stores']['cachestore_static']['sets']);
}
public function test_static_cache() {
global $CFG;
$this->resetAfterTest(true);
$CFG->perfdebug = 15;
// Create cache store with static acceleration.
$instance = cache_config_testing::instance();
$applicationid = 'phpunit/applicationperf';
$instance->phpunit_add_definition($applicationid, array(
'mode' => cache_store::MODE_APPLICATION,
'component' => 'phpunit',
'area' => 'applicationperf',
'simplekeys' => true,
'staticacceleration' => true,
'staticaccelerationsize' => 3
));
$application = cache::make('phpunit', 'applicationperf');
// Check that stores register sets.
$this->assertTrue($application->set('setMe1', 1));
$this->assertTrue($application->set('setMe2', 0));
$this->assertTrue($application->set('setMe3', array()));
$this->assertTrue($application->get('setMe1') !== false);
$this->assertTrue($application->get('setMe2') !== false);
$this->assertTrue($application->get('setMe3') !== false);
// Check that the static acceleration worked, even on empty arrays and the number 0.
$endstats = cache_helper::get_stats();
$this->assertEquals(0, $endstats[$applicationid]['stores']['** static acceleration **']['misses']);
$this->assertEquals(3, $endstats[$applicationid]['stores']['** static acceleration **']['hits']);
}
public function test_performance_debug_off() {
global $CFG;
$this->resetAfterTest(true);
+87 -98
View File
@@ -71,11 +71,6 @@ class container {
*/
protected static $eventretrievalstrategy;
/**
* @var array A list of callbacks to use.
*/
protected static $callbacks = array();
/**
* @var \stdClass[] An array of cached courses to use with the event factory.
*/
@@ -91,16 +86,6 @@ class container {
*/
private static function init() {
if (empty(self::$eventfactory)) {
// When testing the container's components, we need to make sure
// the callback implementations in modules are not executed, since
// we cannot control their output from PHPUnit. To do this we have
// a set of 'testing' callbacks that the factory can use. This way
// we know exactly how the factory behaves when being tested.
$getcallback = function($which) {
return self::$callbacks[PHPUNIT_TEST ? 'testing' : 'production'][$which];
};
self::initcallbacks();
self::$actionfactory = new action_factory();
self::$eventmapper = new event_mapper(
// The event mapper we return from here needs to know how to
@@ -129,8 +114,8 @@ class container {
);
self::$eventfactory = new event_factory(
$getcallback('action'),
$getcallback('visibility'),
[self::class, 'apply_component_provide_event_action'],
[self::class, 'apply_component_is_event_visible'],
function ($dbrow) {
// At present we only have a bail-out check for events in course modules.
if (empty($dbrow->modulename)) {
@@ -152,10 +137,15 @@ class container {
// have that capability set on the "Authenticated User" role rather than
// on "Student" role, which means uservisible returns true even when the user
// is no longer enrolled in the course.
$modulecontext = \context_module::instance($cm->id);
// A user with the 'moodle/course:view' capability is able to see courses
// that they are not a participant in.
$canseecourse = (has_capability('moodle/course:view', $modulecontext) || is_enrolled($modulecontext));
// So, with the following we are checking -
// 1) Only process modules if $cm->uservisible is true.
// 2) Only process modules for courses a user has the capability to view OR they are enrolled in.
// 3) Only process modules for courses that are visible OR if the course is not visible, the user
// has the capability to view hidden courses.
$coursecontext = \context_course::instance($dbrow->courseid);
$canseecourse = has_capability('moodle/course:view', $coursecontext) || is_enrolled($coursecontext);
$canseecourse = $canseecourse &&
($cm->get_course()->visible || has_capability('moodle/course:viewhiddencourses', $coursecontext));
if (!$cm->uservisible || !$canseecourse) {
return true;
}
@@ -183,6 +173,19 @@ class container {
}
}
/**
* Reset all static caches, called between tests.
*/
public static function reset_caches() {
self::$eventfactory = null;
self::$eventmapper = null;
self::$eventvault = null;
self::$actionfactory = null;
self::$eventretrievalstrategy = null;
self::$coursecache = [];
self::$modulecache = [];
}
/**
* Gets the event factory.
*
@@ -214,88 +217,74 @@ class container {
}
/**
* Initialises the callbacks.
* Calls callback 'core_calendar_provide_event_action' from the component responsible for the event
*
* There are two sets here, one is used during PHPUnit runs.
* See the comment at the start of the init method for more
* detail.
* If no callback is present or callback returns null, there is no action on the event
* and it will not be displayed on the dashboard.
*
* @param event_interface $event
* @return action_event|event_interface
*/
private static function initcallbacks() {
self::$callbacks = array(
'testing' => array(
// Always return an action event.
'action' => function (event_interface $event) {
return new action_event(
$event,
new \core_calendar\local\event\value_objects\action(
'test',
new \moodle_url('http://example.com'),
420,
true
));
},
// Always be visible.
'visibility' => function (event_interface $event) {
return true;
}
),
'production' => array(
// This function has type event_interface -> event_interface.
// This is enforced by the event_factory.
'action' => function (event_interface $event) {
// Callbacks will get supplied a "legacy" version
// of the event class.
$mapper = self::$eventmapper;
$action = null;
if ($event->get_course_module()) {
// TODO MDL-58866 Only activity modules currently support this callback.
// Any other event will not be displayed on the dashboard.
$action = component_callback(
'mod_' . $event->get_course_module()->get('modname'),
'core_calendar_provide_event_action',
[
$mapper->from_event_to_legacy_event($event),
self::$actionfactory
]
);
}
public static function apply_component_provide_event_action(event_interface $event) {
// Callbacks will get supplied a "legacy" version
// of the event class.
$mapper = self::$eventmapper;
$action = null;
if ($event->get_course_module()) {
// TODO MDL-58866 Only activity modules currently support this callback.
// Any other event will not be displayed on the dashboard.
$action = component_callback(
'mod_' . $event->get_course_module()->get('modname'),
'core_calendar_provide_event_action',
[
$mapper->from_event_to_legacy_event($event),
self::$actionfactory
]
);
}
// If we get an action back, return an action event, otherwise
// continue piping through the original event.
//
// If a module does not implement the callback, component_callback
// returns null.
return $action ? new action_event($event, $action) : $event;
},
// This function has type event_interface -> bool.
// This is enforced by the event_factory.
'visibility' => function (event_interface $event) {
$mapper = self::$eventmapper;
$eventvisible = null;
if ($event->get_course_module()) {
// TODO MDL-58866 Only activity modules currently support this callback.
$eventvisible = component_callback(
'mod_' . $event->get_course_module()->get('modname'),
'core_calendar_is_event_visible',
[
$mapper->from_event_to_legacy_event($event)
]
);
}
// If we get an action back, return an action event, otherwise
// continue piping through the original event.
//
// If a module does not implement the callback, component_callback
// returns null.
return $action ? new action_event($event, $action) : $event;
}
// Do not display the event if there is nothing to action.
if ($event instanceof action_event_interface && $event->get_action()->get_item_count() === 0) {
return false;
}
/**
* Calls callback 'core_calendar_is_event_visible' from the component responsible for the event
*
* The visibility callback is optional, if not present it is assumed as visible.
* If it is an actionable event but the get_item_count() returns 0 the visibility
* is set to false.
*
* @param event_interface $event
* @return bool
*/
public static function apply_component_is_event_visible(event_interface $event) {
$mapper = self::$eventmapper;
$eventvisible = null;
if ($event->get_course_module()) {
// TODO MDL-58866 Only activity modules currently support this callback.
$eventvisible = component_callback(
'mod_' . $event->get_course_module()->get('modname'),
'core_calendar_is_event_visible',
[
$mapper->from_event_to_legacy_event($event)
]
);
}
// Module does not implement the callback, event should be visible.
if (is_null($eventvisible)) {
return true;
}
// Do not display the event if there is nothing to action.
if ($event instanceof action_event_interface && $event->get_action()->get_item_count() === 0) {
return false;
}
return $eventvisible ? true : false;
}
),
);
// Module does not implement the callback, event should be visible.
if (is_null($eventvisible)) {
return true;
}
return $eventvisible ? true : false;
}
}
@@ -164,7 +164,7 @@ class event_vault implements event_vault_interface {
$coursesfilter,
$where,
$params,
"e.timesort ASC, e.id ASC",
"COALESCE(e.timesort, e.timestart) ASC, e.id ASC",
$offset,
$limitnum,
$ignorehidden
+2 -1
View File
@@ -72,7 +72,8 @@ class event_form extends moodleform {
if (!empty($eventtypes->groups) && is_array($eventtypes->groups)) {
$groupoptions = array();
foreach ($eventtypes->groups as $group) {
$groupoptions[$group->id] = $group->name;
$groupoptions[$group->id] = format_string($group->name, true,
array('context' => context_course::instance($group->courseid)));
}
$mform->addElement('select', 'groupid', get_string('typegroup', 'calendar'), $groupoptions);
$mform->disabledIf('groupid', 'eventtype', 'noteq', 'group');
+3 -2
View File
@@ -77,7 +77,8 @@ if (!empty($day) && !empty($mon) && !empty($year)) {
}
if ($courseid != SITEID && !empty($courseid)) {
$course = $DB->get_record('course', array('id' => $courseid));
// Course ID must be valid and existing.
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$courses = array($course->id => $course);
$issite = false;
} else {
@@ -85,7 +86,7 @@ if ($courseid != SITEID && !empty($courseid)) {
$courses = calendar_get_default_courses();
$issite = true;
}
require_course_login($course);
require_login($course, false);
$url = new moodle_url('/calendar/export.php', array('time' => $time));
+13 -3
View File
@@ -194,10 +194,20 @@ foreach($events as $event) {
$hostaddress = str_replace('http://', '', $CFG->wwwroot);
$hostaddress = str_replace('https://', '', $hostaddress);
$ev = new iCalendar_event;
$me = new calendar_event($event); // To use moodle calendar event services.
$ev = new iCalendar_event; // To export in ical format.
$ev->add_property('uid', $event->id.'@'.$hostaddress);
$ev->add_property('summary', $event->name);
$ev->add_property('description', clean_param($event->description, PARAM_NOTAGS));
// Set iCal event summary from event name.
$ev->add_property('summary', format_string($event->name, true, ['context' => $me->context]));
// Format the description text.
$description = format_text($me->description, $me->format, ['context' => $me->context]);
// Then convert it to plain text, since it's the only format allowed for the event description property.
// We use html_to_text in order to convert <br> and <p> tags to new line characters for descriptions in HTML format.
$description = html_to_text($description, 0);
$ev->add_property('description', $description);
$ev->add_property('class', 'PUBLIC'); // PUBLIC / PRIVATE / CONFIDENTIAL
$ev->add_property('last-modified', Bennu::timestamp_to_datetime($event->timemodified));
$ev->add_property('dtstamp', Bennu::timestamp_to_datetime()); // now
+1 -1
View File
@@ -1481,7 +1481,7 @@ function calendar_get_mini($courses, $groups, $users, $calmonth = false, $calyea
$class .= ' duration_finish';
}
$data = array(
'url' => $dayhref,
'url' => $dayhref->out(false),
'day' => $day,
'content' => $popupdata['data-core_calendar-popupcontent'],
'title' => $popupdata['data-core_calendar-title']
+4 -2
View File
@@ -45,13 +45,15 @@ $PAGE->set_pagelayout('admin');
$PAGE->navbar->add(get_string('managesubscriptions', 'calendar'));
if ($courseid != SITEID && !empty($courseid)) {
$course = $DB->get_record('course', array('id' => $courseid));
// Course ID must be valid and existing.
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$courses = array($course->id => $course);
} else {
$course = get_site();
$courses = calendar_get_default_courses();
}
require_course_login($course);
require_login($course, false);
if (!calendar_user_can_add_event($course)) {
print_error('errorcannotimport', 'calendar');
}
+82
View File
@@ -183,6 +183,63 @@ class core_calendar_container_testcase extends advanced_testcase {
$this->assertNull($event);
}
/**
* Test that the event factory deals with invisible courses as an admin.
*
* @dataProvider get_event_factory_testcases()
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_when_course_visibility_is_toggled_as_admin($dbrow) {
$legacyevent = $this->create_event($dbrow);
$factory = \core_calendar\local\event\container::get_event_factory();
// Create a hidden course with an assignment.
$course = $this->getDataGenerator()->create_course(['visible' => 0]);
$generator = $this->getDataGenerator()->get_plugin_generator('mod_assign');
$moduleinstance = $generator->create_instance(['course' => $course->id]);
$dbrow->id = $legacyevent->id;
$dbrow->courseid = $course->id;
$dbrow->instance = $moduleinstance->id;
$dbrow->modulename = 'assign';
$event = $factory->create_instance($dbrow);
// Module is still visible to admins even if the course is invisible.
$this->assertInstanceOf(event_interface::class, $event);
}
/**
* Test that the event factory deals with invisible courses as a student.
*
* @dataProvider get_event_factory_testcases()
* @param \stdClass $dbrow Row from the "database".
*/
public function test_event_factory_when_course_visibility_is_toggled_as_student($dbrow) {
$legacyevent = $this->create_event($dbrow);
$factory = \core_calendar\local\event\container::get_event_factory();
// Create a hidden course with an assignment.
$course = $this->getDataGenerator()->create_course(['visible' => 0]);
$generator = $this->getDataGenerator()->get_plugin_generator('mod_assign');
$moduleinstance = $generator->create_instance(['course' => $course->id]);
// Enrol a student into this course.
$student = $this->getDataGenerator()->create_user();
$this->getDataGenerator()->enrol_user($student->id, $course->id);
// Set the user to the student.
$this->setUser($student);
$dbrow->id = $legacyevent->id;
$dbrow->courseid = $course->id;
$dbrow->instance = $moduleinstance->id;
$dbrow->modulename = 'assign';
$event = $factory->create_instance($dbrow);
// Module is invisible to students if the course is invisible.
$this->assertNull($event);
}
/**
* Test that the event factory deals with completion related events properly.
*/
@@ -285,6 +342,31 @@ class core_calendar_container_testcase extends advanced_testcase {
$this->assertInstanceOf(event_interface::class, $factory->create_instance($event));
}
/**
* Test that when course module is deleted all events are also deleted.
*/
public function test_delete_module_delete_events() {
global $DB;
$user = $this->getDataGenerator()->create_user();
// Create the course we will be using.
$course = $this->getDataGenerator()->create_course();
$group = $this->getDataGenerator()->create_group(['courseid' => $course->id]);
foreach (core_component::get_plugin_list('mod') as $modname => $unused) {
$module = $this->getDataGenerator()->create_module($modname, ['course' => $course->id]);
// Create bunch of events of different type (user override, group override, module event).
$this->create_event(['userid' => $user->id, 'modulename' => $modname, 'instance' => $module->id]);
$this->create_event(['groupid' => $group->id, 'modulename' => $modname, 'instance' => $module->id]);
$this->create_event(['modulename' => $modname, 'instance' => $module->id]);
$this->create_event(['modulename' => $modname, 'instance' => $module->id, 'courseid' => $course->id]);
// Delete module and make sure all events are deleted.
course_delete_module($module->cmid);
$this->assertEmpty($DB->get_record('event', ['modulename' => $modname, 'instance' => $module->id]));
}
}
/**
* Test getting the event mapper.
*/
+7 -4
View File
@@ -674,13 +674,15 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
*/
public function test_get_calendar_events_override() {
$user = $this->getDataGenerator()->create_user();
$user2 = $this->getDataGenerator()->create_user();
$teacher = $this->getDataGenerator()->create_user();
$anotheruser = $this->getDataGenerator()->create_user();
$course = $this->getDataGenerator()->create_course();
$generator = $this->getDataGenerator()->get_plugin_generator('mod_assign');
$moduleinstance = $generator->create_instance(['course' => $course->id]);
$this->getDataGenerator()->enrol_user($user->id, $course->id);
$this->getDataGenerator()->enrol_user($user->id, $course->id, 'student');
$this->getDataGenerator()->enrol_user($user2->id, $course->id, 'student');
$this->getDataGenerator()->enrol_user($teacher->id, $course->id, 'editingteacher');
$this->resetAfterTest(true);
$this->setAdminUser();
@@ -692,11 +694,12 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
];
$now = time();
// Create two events - one for everybody in the course and one only for the first student.
$event1 = $this->create_calendar_event('Base event', 0, 'due', 0, $now + DAYSECS, $params + ['courseid' => $course->id]);
$event2 = $this->create_calendar_event('User event', $user->id, 'due', 0, $now + 2*DAYSECS, $params + ['courseid' => 0]);
// Retrieve course events for teacher - only one "Base event" is returned.
$this->setUser($teacher);
// Retrieve course events for the second student - only one "Base event" is returned.
$this->setUser($user2);
$paramevents = array('courseids' => array($course->id));
$options = array ('siteevents' => true, 'userevents' => true);
$events = core_calendar_external::get_calendar_events($paramevents, $options);
@@ -705,7 +708,7 @@ class core_calendar_externallib_testcase extends externallib_advanced_testcase {
$this->assertEquals(0, count($events['warnings']));
$this->assertEquals('Base event', $events['events'][0]['name']);
// Retrieve events for user - both events are returned.
// Retrieve events for the first student - both events are returned.
$this->setUser($user);
$events = core_calendar_external::get_calendar_events($paramevents, $options);
$events = external_api::clean_returnvalue(core_calendar_external::get_calendar_events_returns(), $events);
+239 -115
View File
@@ -451,6 +451,9 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
*/
public function test_every_300_days_forever() {
global $DB;
// Change the start date for forever events to 9am of the current date.
$this->change_event_startdate(date('Ymd\T090000'));
$startdatetime = new DateTime(date('Y-m-d H:i:s', $this->event->timestart));
$interval = new DateInterval('P300D');
@@ -463,7 +466,8 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$mang = new rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', array('repeatid' => $this->event->id), 'timestart ASC');
// Get the first 100 samples. This should be enough to verify that we have generated the recurring events correctly.
$records = $DB->get_records('event', array('repeatid' => $this->event->id), 'timestart ASC', 0, 100);
$expecteddate = clone($startdatetime);
$first = true;
@@ -552,8 +556,20 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$expecteddate->add($interval);
}
}
}
// Forever event. This should generate events over time() + 10 year period, every 50th Monday.
/**
* Test recurrence rules for weekly frequency for RRULE with BYDAY rule set, recurring forever.
*/
public function test_weekly_byday_forever() {
global $DB;
// Set the next Monday as the starting date of this event.
$startdate = new DateTime('next Monday');
// Change the start date of the parent event.
$startdate = $this->change_event_startdate($startdate->format('Ymd\T090000'));
// Forever event. This should generate events over time() + 10 year period, every 50 weeks.
$rrule = 'FREQ=WEEKLY;BYDAY=MO;INTERVAL=50';
$mang = new rrule_manager($rrule);
@@ -564,13 +580,14 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$untildate->add(new DateInterval('P10Y'));
$until = $untildate->getTimestamp();
$interval = new DateInterval('P50W');
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
// First instance of this set of recurring events: Monday, 17-08-1998.
$interval = new DateInterval('P50W');
// First instance of this set of recurring events.
$expecteddate = clone($startdate);
$expecteddate->modify('1998-08-17');
$expecteddate->add($offsetinterval);
// Iterate over each record and increment the expected date accordingly.
foreach ($records as $record) {
$eventdateexpected = $expecteddate->format('Y-m-d H:i:s');
$eventdateactual = date('Y-m-d H:i:s', $record->timestart);
@@ -676,17 +693,21 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
public function test_monthly_events_with_bymonthday_forever() {
global $DB;
// Change the start date for forever events to 9am of the 2nd day of the current month and year.
$this->change_event_startdate(date('Ym02\T090000'));
$startdatetime = new DateTime(date('Y-m-d H:i:s', $this->event->timestart));
$startdate = new DateTime(date('Y-m-d', $this->event->timestart));
$offsetinterval = $startdatetime->diff($startdate, true);
$interval = new DateInterval('P12M');
// Forever event. This should generate events over 10 year period, on 2nd day of every 12th month.
// Forever event. This should generate events over a 10-year period, on 2nd day of the month, every 12 months.
$rrule = "FREQ=MONTHLY;INTERVAL=12;BYMONTHDAY=2";
$mang = new rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
$until = $untildate->getTimestamp();
$mang->parse_rrule();
$mang->create_events($this->event);
@@ -828,24 +849,33 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
public function test_monthly_events_with_byday_forever() {
global $DB;
// Change the start date for forever events to 9am of the 2nd day of the current month and year.
$this->change_event_startdate(date('Ym02\T090000'));
$startdatetime = new DateTime(date('Y-m-d H:i:s', $this->event->timestart));
$startdate = new DateTime(date('Y-m-d', $this->event->timestart));
$offsetinterval = $startdatetime->diff($startdate, true);
$interval = new DateInterval('P12M');
// Forever event. This should generate events over 10 year period, on 2nd day of every 12th month.
// Forever event. This should generate events over a 10 year period, on 1st Monday of the month every 12 months.
$rrule = "FREQ=MONTHLY;INTERVAL=12;BYDAY=1MO";
$mang = new rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
$until = $untildate->getTimestamp();
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
$expecteddate = new DateTime('first Monday of September 1998');
$expecteddate = new DateTime('first Monday of this month');
// Move to the next interval's first Monday if the calculated start date is after this month's first Monday.
if ($expecteddate->getTimestamp() < $startdatetime->getTimestamp()) {
$expecteddate->add($interval);
$expecteddate->modify('first Monday of this month');
}
foreach ($records as $record) {
$expecteddate->add($offsetinterval);
$this->assertLessThanOrEqual($until, $record->timestart);
@@ -890,7 +920,7 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
// Create a yearly event, until the time limit is hit.
$until = strtotime('+20 day +10 years', $this->event->timestart);
$until = date('Ymd\THis\Z', $until);
$rrule = "FREQ=YEARLY;BYMONTH=9;UNTIL=$until"; // Forever event.
$rrule = "FREQ=YEARLY;BYMONTH=9;UNTIL=$until";
$mang = new rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
@@ -917,18 +947,6 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$this->assertTrue($result);
}
$rrule = "FREQ=YEARLY;BYMONTH=9;INTERVAL=2"; // Forever event.
$mang = new rrule_manager($rrule);
$until = time() + (YEARSECS * $mang::TIME_UNLIMITED_YEARS);
$mang->parse_rrule();
$mang->create_events($this->event);
for ($i = 0, $time = $this->event->timestart; $time < $until; $i++, $yoffset = $i * 2,
$time = strtotime("+$yoffset years", $this->event->timestart)) {
$result = $DB->record_exists('event', array('repeatid' => $this->event->id,
'timestart' => ($time)));
$this->assertTrue($result);
}
$rrule = "FREQ=YEARLY;COUNT=3;BYMONTH=9;BYDAY=1MO"; // This should generate 3 events in total.
$mang = new rrule_manager($rrule);
$mang->parse_rrule();
@@ -1004,12 +1022,45 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
}
}
/**
* Test for rrule with FREQ=YEARLY and INTERVAL=2 with BYMONTH rule set, recurring forever.
*/
public function test_yearly_september_every_two_years_forever() {
global $DB;
// Change the start date for forever events to 9am on the 2nd day of September of the current year.
$this->change_event_startdate(date('Y0902\T090000'));
$rrule = "FREQ=YEARLY;BYMONTH=9;INTERVAL=2"; // Forever event.
$mang = new rrule_manager($rrule);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
$untiltimestamp = $untildate->getTimestamp();
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
$interval = new DateInterval('P2Y');
$expecteddate = new DateTime(date('Y0902\T090000'));
foreach ($records as $record) {
$this->assertLessThanOrEqual($untiltimestamp, $record->timestart);
$this->assertEquals($expecteddate->format('Y-m-d H:i:s'), date('Y-m-d H:i:s', $record->timestart));
// Go to the next expected date.
$expecteddate->add($interval);
}
}
/**
* Test for rrule with FREQ=YEARLY with BYMONTH and BYDAY rules set, recurring forever.
*/
public function test_yearly_bymonth_byday_forever() {
global $DB;
// Change the start date for forever events to the first day of September of the current year at 9am.
$this->change_event_startdate(date('Y0901\T090000'));
// Every 2 years on the first Monday of September.
$rrule = "FREQ=YEARLY;BYMONTH=9;INTERVAL=2;BYDAY=1MO";
$mang = new rrule_manager($rrule);
@@ -1028,9 +1079,9 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$offsetinterval = $startdatetime->diff($startdate, true);
$interval = new DateInterval('P2Y');
// First occurrence of this set of events is on the first Monday of September 1999.
// First occurrence of this set of events is on the first Monday of September.
$expecteddate = clone($startdatetime);
$expecteddate->modify('first Monday of September 1999');
$expecteddate->modify('first Monday of September');
$expecteddate->add($offsetinterval);
foreach ($records as $record) {
$this->assertLessThanOrEqual($untiltimestamp, $record->timestart);
@@ -1050,6 +1101,9 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
public function test_yearly_forever() {
global $DB;
// Change the start date for forever events to 9am of the current date.
$this->change_event_startdate(date('Ymd\T090000'));
$startdatetime = new DateTime(date('Y-m-d H:i:s', $this->event->timestart));
$interval = new DateInterval('P2Y');
@@ -1147,14 +1201,19 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Every other day - forever:
*
* DTSTART;TZID=US-Eastern:19970902T090000
* DTSTART;TZID=US-Eastern:[Current date]T090000
* RRULE:FREQ=DAILY;INTERVAL=2
* ==> (1997 9:00 AM EDT)September2,4,6,8...24,26,28,30;October 2,4,6...20,22,24
* (1997 9:00 AM EST)October 26,28,30;November 1,3,5,7...25,27,29;Dec 1,3,...
*
* Sample results (e.g. in the year 1997):
* (1997 9:00 AM EDT)September2,4,6,8...24,26,28,30;October 2,4,6...20,22,24
* (1997 9:00 AM EST)October 26,28,30;November 1,3,5,7...25,27,29;Dec 1,3,...
*/
public function test_every_other_day_forever() {
global $DB;
// Change the start date for forever events to 9am of the current date in US/Eastern time.
$this->change_event_startdate(date('Ymd\T090000'), 'US/Eastern');
$startdatetime = new DateTime(date('Y-m-d H:i:s', $this->event->timestart));
$interval = new DateInterval('P2D');
@@ -1163,7 +1222,8 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
// Get the first 100 samples. This should be enough to verify that we have generated the recurring events correctly.
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart', 0, 100);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
@@ -1341,16 +1401,21 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Every other week - forever:
*
* DTSTART;TZID=US-Eastern:19970902T090000
* DTSTART;TZID=US-Eastern:[Current date]T090000
* RRULE:FREQ=WEEKLY;INTERVAL=2;WKST=SU
* ==> (1997 9:00 AM EDT)September 2,16,30;October 14
* (1997 9:00 AM EST)October 28;November 11,25;December 9,23
* (1998 9:00 AM EST)January 6,20;February
* ...
*
* Sample results (e.g. in the year 1997):
* (1997 9:00 AM EDT)September 2,16,30;October 14
* (1997 9:00 AM EST)October 28;November 11,25;December 9,23
* (1998 9:00 AM EST)January 6,20;February
* ...
*/
public function test_every_other_week_forever() {
global $DB;
// Change the start date for forever events to 9am of the current date in US/Eastern time.
$this->change_event_startdate(date('Ymd\T090000'), 'US/Eastern');
$interval = new DateInterval('P2W');
$rrule = 'FREQ=WEEKLY;INTERVAL=2;WKST=SU';
@@ -1358,7 +1423,8 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
// Get the first 100 samples. This should be enough to verify that we have generated the recurring events correctly.
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart', 0, 100);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
@@ -1704,25 +1770,28 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Monthly on the third to the last day of the month, forever:
*
* DTSTART;TZID=US-Eastern:19970928T090000
* DTSTART;TZID=US-Eastern:[Current year]0928T090000
* RRULE:FREQ=MONTHLY;BYMONTHDAY=-3
* ==> (1997 9:00 AM EDT)September 28
* (1997 9:00 AM EST)October 29;November 28;December 29
* (1998 9:00 AM EST)January 29;February 26
* ...
*
* Sample results (e.g. in the year 1997):
* (1997 9:00 AM EDT)September 28
* (1997 9:00 AM EST)October 29;November 28;December 29
* (1998 9:00 AM EST)January 29;February 26
* ...
*/
public function test_third_to_the_last_day_of_the_month_forever() {
global $DB;
// Change our event's date to 05-09-1997, based on the example from the RFC.
$this->change_event_startdate('19970928T090000', 'US/Eastern');
// Change our event's date to 28 September of the current year, based on the example from the RFC.
$this->change_event_startdate(date('Y0928\T090000'), 'US/Eastern');
$rrule = 'FREQ=MONTHLY;BYMONTHDAY=-3';
$mang = new rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
// Get the first 100 samples. This should be enough to verify that we have generated the recurring events correctly.
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart', 0, 100);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
@@ -1878,22 +1947,29 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Every Tuesday, every other month:
*
* DTSTART;TZID=US-Eastern:19970902T090000
* DTSTART;TZID=US-Eastern:[Next Tuesday]T090000
* RRULE:FREQ=MONTHLY;INTERVAL=2;BYDAY=TU
* ==> (1997 9:00 AM EDT)September 2,9,16,23,30
* (1997 9:00 AM EST)November 4,11,18,25
* (1998 9:00 AM EST)January 6,13,20,27;March 3,10,17,24,31
* ...
*
* Sample results (e.g. in the year 1997):
* (1997 9:00 AM EDT)September 2,9,16,23,30
* (1997 9:00 AM EST)November 4,11,18,25
* (1998 9:00 AM EST)January 6,13,20,27;March 3,10,17,24,31
* ...
*/
public function test_every_tuesday_every_other_month_forever() {
global $DB;
// Change the start date for forever events to 9am of the Tuesday on or before of the current date in US/Eastern time.
$nexttuesday = new DateTime('next Tuesday');
$this->change_event_startdate($nexttuesday->format('Ymd\T090000'), 'US/Eastern');
$rrule = 'FREQ=MONTHLY;INTERVAL=2;BYDAY=TU';
$mang = new rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
// Get the first 100 samples. This should be enough to verify that we have generated the recurring events correctly.
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart', 0, 100);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
@@ -2063,18 +2139,22 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Every 20th Monday of the year, forever:
*
* DTSTART;TZID=US-Eastern:19970519T090000
* DTSTART;TZID=US-Eastern:[20th Monday of the current year]T090000
* RRULE:FREQ=YEARLY;BYDAY=20MO
* ==> (1997 9:00 AM EDT)May 19
* (1998 9:00 AM EDT)May 18
* (1999 9:00 AM EDT)May 17
* ...
*
* Sample results (e.g. in the year 1997):
* (1997 9:00 AM EDT)May 19
* (1998 9:00 AM EDT)May 18
* (1999 9:00 AM EDT)May 17
* ...
*/
public function test_yearly_every_20th_monday_forever() {
global $DB;
// Change our event's date to 19-05-1997, based on the example from the RFC.
$startdatetime = $this->change_event_startdate('19970519T090000', 'US/Eastern');
// Change our event's date to the 20th Monday of the current year.
$twentiethmonday = new DateTime(date('Y-01-01'));
$twentiethmonday->modify('+20 Monday');
$startdatetime = $this->change_event_startdate($twentiethmonday->format('Ymd\T090000'), 'US/Eastern');
$startdate = new DateTime($startdatetime->format('Y-m-d'));
@@ -2110,18 +2190,22 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Monday of week number 20 (where the default start of the week is Monday), forever:
*
* DTSTART;TZID=US-Eastern:19970512T090000
* DTSTART;TZID=US-Eastern:[1st day of the 20th week this year]T090000
* RRULE:FREQ=YEARLY;BYWEEKNO=20;BYDAY=MO
* ==> (1997 9:00 AM EDT)May 12
* (1998 9:00 AM EDT)May 11
* (1999 9:00 AM EDT)May 17
* ...
*
* Sample results (e.g. in the year 1997):
* (1997 9:00 AM EDT)May 12
* (1998 9:00 AM EDT)May 11
* (1999 9:00 AM EDT)May 17
* ...
*/
public function test_yearly_byweekno_forever() {
global $DB;
// Change our event's date to 12-05-1997, based on the example from the RFC.
$startdatetime = $this->change_event_startdate('19970512T090000', 'US/Eastern');
// Change our event's date to the start of the 20th week of the current year.
$twentiethweek = new DateTime(date('Y-01-01'));
$twentiethweek->setISODate($twentiethweek->format('Y'), 20);
$startdatetime = $this->change_event_startdate($twentiethweek->format('Ymd\T090000'), 'US/Eastern');
$startdate = clone($startdatetime);
$startdate->modify($startdate->format('Y-m-d'));
@@ -2156,18 +2240,21 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Every Thursday in March, forever:
*
* DTSTART;TZID=US-Eastern:19970313T090000
* DTSTART;TZID=US-Eastern:[First thursday of March of the current year]T090000
* RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=TH
* ==> (1997 9:00 AM EST)March 13,20,27
* (1998 9:00 AM EST)March 5,12,19,26
* (1999 9:00 AM EST)March 4,11,18,25
* ...
*
* Sample results (e.g. in the year 1997):
* (1997 9:00 AM EST)March 13,20,27
* (1998 9:00 AM EST)March 5,12,19,26
* (1999 9:00 AM EST)March 4,11,18,25
* ...
*/
public function test_every_thursday_in_march_forever() {
global $DB;
// Change our event's date to 12-05-1997, based on the example from the RFC.
$startdatetime = $this->change_event_startdate('19970313T090000', 'US/Eastern');
// Change our event's date to the first Thursday of March of the current year at 9am US/Eastern time.
$firstthursdayofmarch = new DateTime('first Thursday of March');
$startdatetime = $this->change_event_startdate($firstthursdayofmarch->format('Ymd\T090000'), 'US/Eastern');
$interval = new DateInterval('P1Y');
@@ -2176,7 +2263,8 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
// Get the first 100 samples. This should be enough to verify that we have generated the recurring events correctly.
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart', 0, 100);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
@@ -2186,7 +2274,7 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$startdate = new DateTime($startdatetime->format('Y-m-d'));
$offsetinterval = $startdatetime->diff($startdate, true);
$expecteddate->setTimezone(new DateTimeZone(get_user_timezone()));
$april1st = new DateTime('1997-04-01');
$april1st = new DateTime('April 1');
foreach ($records as $record) {
$this->assertLessThanOrEqual($untiltimestamp, $record->timestart);
$this->assertEquals($expecteddate->format('Y-m-d H:i:s'), date('Y-m-d H:i:s', $record->timestart));
@@ -2211,18 +2299,21 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Every Thursday, but only during June, July, and August, forever:
*
* DTSTART;TZID=US-Eastern:19970605T090000
* DTSTART;TZID=US-Eastern:[First Thursday of June of the current year]T090000
* RRULE:FREQ=YEARLY;BYDAY=TH;BYMONTH=6,7,8
* ==> (1997 9:00 AM EDT)June 5,12,19,26;July 3,10,17,24,31;August 7,14,21,28
* (1998 9:00 AM EDT)June 4,11,18,25;July 2,9,16,23,30;August 6,13,20,27
* (1999 9:00 AM EDT)June 3,10,17,24;July 1,8,15,22,29;August 5,12,19,26
* ...
*
* Sample results (e.g. in the year 1997):
* (1997 9:00 AM EDT)June 5,12,19,26;July 3,10,17,24,31;August 7,14,21,28
* (1998 9:00 AM EDT)June 4,11,18,25;July 2,9,16,23,30;August 6,13,20,27
* (1999 9:00 AM EDT)June 3,10,17,24;July 1,8,15,22,29;August 5,12,19,26
* ...
*/
public function test_every_thursday_june_july_august_forever() {
global $DB;
// Change our event's date to 05-06-1997, based on the example from the RFC.
$startdatetime = $this->change_event_startdate('19970605T090000', 'US/Eastern');
// Change our event's date to the first Thursday of June in the current year at 9am US/Eastern time.
$firstthursdayofjune = new DateTime('first Thursday of June');
$startdatetime = $this->change_event_startdate($firstthursdayofjune->format('Ymd\T090000'), 'US/Eastern');
$startdate = new DateTime($startdatetime->format('Y-m-d'));
@@ -2235,14 +2326,15 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
// Get the first 100 samples. This should be enough to verify that we have generated the recurring events correctly.
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart', 0, 100);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
$untiltimestamp = $untildate->getTimestamp();
$expecteddate = new DateTime(date('Y-m-d H:i:s', $startdatetime->getTimestamp()));
$september1st = new DateTime('1997-09-01');
$september1st = new DateTime('September 1');
foreach ($records as $record) {
$this->assertLessThanOrEqual($untiltimestamp, $record->timestart);
$this->assertEquals($expecteddate->format('Y-m-d H:i:s'), date('Y-m-d H:i:s', $record->timestart));
@@ -2264,22 +2356,28 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Every Friday the 13th, forever:
*
* DTSTART;TZID=US-Eastern:19970902T090000
* EXDATE;TZID=US-Eastern:19970902T090000
* DTSTART;TZID=US-Eastern:[Current date]T090000
* RRULE:FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13
* ==> (1998 9:00 AM EST)February 13;March 13;November 13
* (1999 9:00 AM EDT)August 13
* (2000 9:00 AM EDT)October 13
*
* Sample results (e.g. in the year 1997):
* (1998 9:00 AM EST)February 13;March 13;November 13
* (1999 9:00 AM EDT)August 13
* (2000 9:00 AM EDT)October 13
* ...
*/
public function test_friday_the_thirteenth_forever() {
global $DB;
// Change our event's date to the first Thursday of June in the current year at 9am US/Eastern time.
$this->change_event_startdate(date('Ymd\T090000'), 'US/Eastern');
$rrule = 'FREQ=MONTHLY;BYDAY=FR;BYMONTHDAY=13';
$mang = new rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
// Get the first 100 samples. This should be enough to verify that we have generated the recurring events correctly.
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart', 0, 100);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
@@ -2295,17 +2393,22 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* The first Saturday that follows the first Sunday of the month, forever:
*
* DTSTART;TZID=US-Eastern:19970913T090000
* DTSTART;TZID=US-Eastern:[The Saturday after the month's first Sunday]T090000
* RRULE:FREQ=MONTHLY;BYDAY=SA;BYMONTHDAY=7,8,9,10,11,12,13
* ==> (1997 9:00 AM EDT)September 13;October 11
* (1997 9:00 AM EST)November 8;December 13
* (1998 9:00 AM EST)January 10;February 7;March 7
* (1998 9:00 AM EDT)April 11;May 9;June 13...
*
* Sample results (e.g. from 13 September 1997):
* (1997 9:00 AM EDT)September 13;October 11
* (1997 9:00 AM EST)November 8;December 13
* (1998 9:00 AM EST)January 10;February 7;March 7
* (1998 9:00 AM EDT)April 11;May 9;June 13...
*/
public function test_first_saturday_following_first_sunday_forever() {
global $DB;
$startdatetime = $this->change_event_startdate('19970913T090000', 'US/Eastern');
// Change our event's date to the next Saturday after the first Sunday of the the current month at 9am US/Eastern time.
$firstsaturdayafterfirstsunday = new DateTime('first Sunday of this month');
$firstsaturdayafterfirstsunday->modify('next Saturday');
$startdatetime = $this->change_event_startdate($firstsaturdayafterfirstsunday->format('Ymd\T090000'), 'US/Eastern');
$startdate = new DateTime($startdatetime->format('Y-m-d'));
$offset = $startdatetime->diff($startdate, true);
@@ -2314,7 +2417,8 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
// Get the first 100 samples. This should be enough to verify that we have generated the recurring events correctly.
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart', 0, 100);
$untildate = new DateTime();
$untildate->add(new DateInterval('P' . $mang::TIME_UNLIMITED_YEARS . 'Y'));
@@ -2340,17 +2444,29 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Every four years, the first Tuesday after a Monday in November, forever (U.S. Presidential Election day):
*
* DTSTART;TZID=US-Eastern:19961105T090000
* DTSTART;TZID=US-Eastern:[Most recent election date]T090000
* RRULE:FREQ=YEARLY;INTERVAL=4;BYMONTH=11;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8
* ==> (1996 9:00 AM EST)November 5
* (2000 9:00 AM EST)November 7
* (2004 9:00 AM EST)November 2
* ...
*
* Sample results (e.g. from 05 November 1996):
* (1996 9:00 AM EST)November 5
* (2000 9:00 AM EST)November 7
* (2004 9:00 AM EST)November 2
* ...
*/
public function test_every_us_presidential_election_forever() {
global $DB;
$startdatetime = $this->change_event_startdate('19961105T090000', 'US/Eastern');
// Calculate the most recent election date, starting from 1996 (e.g. today's 2017 so the most recent election was in 2016).
$currentyear = (int) date('Y');
$electionyear = 1996;
while ($electionyear + 4 < $currentyear) {
$electionyear += 4;
}
$electiondate = new DateTime('first Monday of November ' . $electionyear);
$electiondate->modify('+1 Tuesday');
// Use the most recent election date as the starting date of our recurring events.
$startdatetime = $this->change_event_startdate($electiondate->format('Ymd\T090000'), 'US/Eastern');
$startdate = new DateTime($startdatetime->format('Y-m-d'));
$offset = $startdatetime->diff($startdate, true);
@@ -2417,23 +2533,27 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
* The 2nd to last weekday of the month:
*
* DTSTART;TZID=US-Eastern:19970929T090000
* RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2
* RRULE:FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2;COUNT=7
* ==> (1997 9:00 AM EDT)September 29
* (1997 9:00 AM EST)October 30;November 27;December 30
* (1998 9:00 AM EST)January 29;February 26;March 30
* ...
*
* (Original RFC example is set to recur forever. But we just want to verify that the results match the dates listed from
* the RFC example. So just limit the count to 7.)
*/
public function test_second_to_the_last_weekday_of_the_month_forever() {
public function test_second_to_the_last_weekday_of_the_month() {
global $DB;
$this->change_event_startdate('19970929T090000', 'US/Eastern');
$rrule = 'FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2';
$rrule = 'FREQ=MONTHLY;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2;COUNT=7';
$mang = new rrule_manager($rrule);
$mang->parse_rrule();
$mang->create_events($this->event);
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart');
// Get the first 7 samples. This should be enough to verify that we have generated the recurring events correctly.
$records = $DB->get_records('event', ['repeatid' => $this->event->id], 'timestart ASC', 'id, repeatid, timestart', 0, 7);
$expecteddates = [
(new DateTime('1997-09-29 09:00:00 EDT'))->getTimestamp(),
@@ -2454,10 +2574,8 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
$this->assertLessThanOrEqual($untiltimestamp, $record->timestart);
// Confirm that the first 7 records correspond to the expected dates listed above.
if ($i < 7) {
$this->assertEquals($expecteddates[$i], $record->timestart);
$i++;
}
$this->assertEquals($expecteddates[$i], $record->timestart);
$i++;
}
}
@@ -2757,13 +2875,19 @@ class core_calendar_rrule_manager_testcase extends advanced_testcase {
/**
* Change the event's timestart (DTSTART) based on the test's needs.
*
* @param string $datestr The date string. In YYYYmmddThhiiss format. e.g. 19990902T090000.
* @param string $timezonestr A valid timezone string. e.g. 'US/Eastern'.
* @param string $datestr The date string. In 'Ymd\This' format. e.g. 19990902T090000.
* @param null|string $timezonestr A valid timezone string. e.g. 'US/Eastern'.
* If not provided, the default timezone will be used.
* @return bool|DateTime
*/
protected function change_event_startdate($datestr, $timezonestr) {
$timezone = new DateTimeZone($timezonestr);
$newdatetime = DateTime::createFromFormat('Ymd\THis', $datestr, $timezone);
protected function change_event_startdate($datestr, $timezonestr = null) {
// Use default timezone if not provided.
if ($timezonestr === null) {
$newdatetime = DateTime::createFromFormat('Ymd\THis', $datestr);
} else {
$timezone = new DateTimeZone($timezonestr);
$newdatetime = DateTime::createFromFormat('Ymd\THis', $datestr, $timezone);
}
// Update the start date of the parent event.
$calevent = calendar_event::load($this->event->id);
+3 -2
View File
@@ -85,7 +85,8 @@ $url->param('time', $time);
$PAGE->set_url($url);
if ($courseid != SITEID && !empty($courseid)) {
$course = $DB->get_record('course', array('id' => $courseid));
// Course ID must be valid and existing.
$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
$courses = array($course->id => $course);
$issite = false;
navigation_node::override_active_url(new moodle_url('/course/view.php', array('id' => $course->id)));
@@ -95,7 +96,7 @@ if ($courseid != SITEID && !empty($courseid)) {
$issite = true;
}
require_course_login($course);
require_login($course, false);
$calendar = new calendar_information(0, 0, 0, $time);
$calendar->prepare_for_view($course, $courses);
+3 -1
View File
@@ -243,7 +243,9 @@ class course_competency extends persistent {
public static function list_courses($competencyid) {
global $DB;
$results = $DB->get_records_sql('SELECT course.id, course.visible, course.shortname, course.idnumber, course.fullname
$results = $DB->get_records_sql('SELECT course.id, course.visible, course.shortname, course.idnumber,
course.fullname, course.summary, course.summaryformat, course.startdate,
course.enddate
FROM {course} course
JOIN {' . self::TABLE . '} coursecomp
ON coursecomp.courseid = course.id

Some files were not shown because too many files have changed in this diff Show More