Merge branch 'install_master' of https://git.in.moodle.com/amosbot/moodle-install
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 13 Oct 2016 18:02:15 +0000 (20:02 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 13 Oct 2016 18:02:15 +0000 (20:02 +0200)
510 files changed:
.eslintignore
.eslintrc
.stylelintignore
admin/index.php
admin/renderer.php
admin/settings/security.php
admin/tool/behat/tests/behat/datetime_strings.feature [new file with mode: 0644]
admin/tool/behat/tests/behat/nasty_strings.feature
admin/tool/monitor/tests/behat/subscription.feature
admin/tool/templatelibrary/classes/api.php
backup/cc/cc2moodle.php
blocks/course_overview/tests/behat/block_course_overview.feature
blocks/messages/tests/behat/block_messages_course.feature
blocks/messages/tests/behat/block_messages_dashboard.feature
blocks/messages/tests/behat/block_messages_frontpage.feature
blocks/online_users/block_online_users.php
blocks/participants/tests/behat/block_participants_course.feature
blocks/settings/amd/build/settingsblock.min.js
blocks/settings/amd/src/settingsblock.js
cache/locallib.php
cache/stores/apcu/lib.php
competency/classes/api.php
competency/tests/api_test.php
composer.json
composer.lock
course/format/lib.php
course/tests/behat/course_category_management_listing.feature
enrol/ajax.php
enrol/locallib.php
enrol/manual/yui/quickenrolment/quickenrolment.js
enrol/yui/otherusersmanager/otherusersmanager.js
enrol/yui/rolemanager/rolemanager.js
grade/edit/outcome/edit.php
grade/report/overview/classes/external.php [new file with mode: 0644]
grade/report/overview/db/services.php [new file with mode: 0644]
grade/report/overview/index.php
grade/report/overview/lib.php
grade/report/overview/tests/externallib_test.php [new file with mode: 0644]
grade/report/overview/version.php
grade/report/user/index.php
grade/report/user/lang/en/gradereport_user.php
grade/report/user/lib.php
grade/report/user/renderer.php
grade/report/user/styles.css
grade/report/user/tests/behat/user_view.feature [new file with mode: 0644]
grade/tests/behat/behat_grade.php
grade/tests/behat/grade_aggregation.feature
grade/tests/behat/grade_hidden_items.feature
iplookup/tests/geoip_test.php
lang/en/admin.php
lang/en/message.php
lang/en/moodle.php
lang/en/webservice.php
lib/accesslib.php
lib/adodb/adodb-active-record.inc.php
lib/adodb/adodb-active-recordx.inc.php
lib/adodb/adodb-csvlib.inc.php
lib/adodb/adodb-datadict.inc.php
lib/adodb/adodb-error.inc.php
lib/adodb/adodb-errorhandler.inc.php
lib/adodb/adodb-errorpear.inc.php
lib/adodb/adodb-exceptions.inc.php
lib/adodb/adodb-iterator.inc.php
lib/adodb/adodb-lib.inc.php
lib/adodb/adodb-memcache.lib.inc.php
lib/adodb/adodb-pager.inc.php
lib/adodb/adodb-pear.inc.php
lib/adodb/adodb-perf.inc.php
lib/adodb/adodb-php4.inc.php
lib/adodb/adodb-time.inc.php
lib/adodb/adodb-xmlschema.inc.php
lib/adodb/adodb-xmlschema03.inc.php
lib/adodb/adodb.inc.php
lib/adodb/datadict/datadict-access.inc.php
lib/adodb/datadict/datadict-db2.inc.php
lib/adodb/datadict/datadict-firebird.inc.php
lib/adodb/datadict/datadict-generic.inc.php
lib/adodb/datadict/datadict-ibase.inc.php
lib/adodb/datadict/datadict-informix.inc.php
lib/adodb/datadict/datadict-mssql.inc.php
lib/adodb/datadict/datadict-mssqlnative.inc.php
lib/adodb/datadict/datadict-mysql.inc.php
lib/adodb/datadict/datadict-oci8.inc.php
lib/adodb/datadict/datadict-postgres.inc.php
lib/adodb/datadict/datadict-sapdb.inc.php
lib/adodb/datadict/datadict-sqlite.inc.php
lib/adodb/datadict/datadict-sybase.inc.php
lib/adodb/drivers/adodb-access.inc.php
lib/adodb/drivers/adodb-ado.inc.php
lib/adodb/drivers/adodb-ado5.inc.php
lib/adodb/drivers/adodb-ado_access.inc.php
lib/adodb/drivers/adodb-ado_mssql.inc.php
lib/adodb/drivers/adodb-borland_ibase.inc.php
lib/adodb/drivers/adodb-csv.inc.php
lib/adodb/drivers/adodb-db2.inc.php
lib/adodb/drivers/adodb-db2oci.inc.php
lib/adodb/drivers/adodb-db2ora.inc.php
lib/adodb/drivers/adodb-fbsql.inc.php
lib/adodb/drivers/adodb-firebird.inc.php
lib/adodb/drivers/adodb-ibase.inc.php
lib/adodb/drivers/adodb-informix.inc.php
lib/adodb/drivers/adodb-informix72.inc.php
lib/adodb/drivers/adodb-ldap.inc.php
lib/adodb/drivers/adodb-mssql.inc.php
lib/adodb/drivers/adodb-mssqlnative.inc.php
lib/adodb/drivers/adodb-mssqlpo.inc.php
lib/adodb/drivers/adodb-mysql.inc.php
lib/adodb/drivers/adodb-mysqli.inc.php
lib/adodb/drivers/adodb-mysqlpo.inc.php
lib/adodb/drivers/adodb-mysqlt.inc.php
lib/adodb/drivers/adodb-netezza.inc.php
lib/adodb/drivers/adodb-oci8.inc.php
lib/adodb/drivers/adodb-oci805.inc.php
lib/adodb/drivers/adodb-oci8po.inc.php
lib/adodb/drivers/adodb-oci8quercus.inc.php
lib/adodb/drivers/adodb-odbc.inc.php
lib/adodb/drivers/adodb-odbc_db2.inc.php
lib/adodb/drivers/adodb-odbc_mssql.inc.php
lib/adodb/drivers/adodb-odbc_mssql2012.inc.php [new file with mode: 0644]
lib/adodb/drivers/adodb-odbc_oracle.inc.php
lib/adodb/drivers/adodb-odbtp.inc.php
lib/adodb/drivers/adodb-odbtp_unicode.inc.php
lib/adodb/drivers/adodb-oracle.inc.php
lib/adodb/drivers/adodb-pdo.inc.php
lib/adodb/drivers/adodb-pdo_mssql.inc.php
lib/adodb/drivers/adodb-pdo_mysql.inc.php
lib/adodb/drivers/adodb-pdo_oci.inc.php
lib/adodb/drivers/adodb-pdo_pgsql.inc.php
lib/adodb/drivers/adodb-pdo_sqlite.inc.php
lib/adodb/drivers/adodb-postgres.inc.php
lib/adodb/drivers/adodb-postgres64.inc.php
lib/adodb/drivers/adodb-postgres7.inc.php
lib/adodb/drivers/adodb-postgres8.inc.php
lib/adodb/drivers/adodb-postgres9.inc.php
lib/adodb/drivers/adodb-proxy.inc.php
lib/adodb/drivers/adodb-sapdb.inc.php
lib/adodb/drivers/adodb-sqlanywhere.inc.php
lib/adodb/drivers/adodb-sqlite.inc.php
lib/adodb/drivers/adodb-sqlite3.inc.php
lib/adodb/drivers/adodb-sqlitepo.inc.php
lib/adodb/drivers/adodb-sybase.inc.php
lib/adodb/drivers/adodb-sybase_ase.inc.php
lib/adodb/drivers/adodb-vfp.inc.php
lib/adodb/perf/perf-db2.inc.php
lib/adodb/perf/perf-informix.inc.php
lib/adodb/perf/perf-mssql.inc.php
lib/adodb/perf/perf-mssqlnative.inc.php
lib/adodb/perf/perf-mysql.inc.php
lib/adodb/perf/perf-oci8.inc.php
lib/adodb/perf/perf-postgres.inc.php
lib/adodb/pivottable.inc.php
lib/adodb/readme_moodle.txt
lib/adodb/rsfilter.inc.php
lib/adodb/toexport.inc.php
lib/adodb/tohtml.inc.php
lib/amd/build/auto_rows.min.js [new file with mode: 0644]
lib/amd/build/custom_interaction_events.min.js
lib/amd/build/modal.min.js
lib/amd/build/modal_confirm.min.js [new file with mode: 0644]
lib/amd/build/modal_events.min.js
lib/amd/build/modal_factory.min.js
lib/amd/build/popover_region_controller.min.js [new file with mode: 0644]
lib/amd/build/templates.min.js
lib/amd/build/url.min.js
lib/amd/src/auto_rows.js [new file with mode: 0644]
lib/amd/src/custom_interaction_events.js
lib/amd/src/modal.js
lib/amd/src/modal_confirm.js [new file with mode: 0644]
lib/amd/src/modal_events.js
lib/amd/src/modal_factory.js
lib/amd/src/popover_region_controller.js [new file with mode: 0644]
lib/amd/src/str.js
lib/amd/src/templates.js
lib/amd/src/url.js
lib/blocklib.php
lib/classes/component.php
lib/classes/minify.php
lib/db/install.xml
lib/db/services.php
lib/db/upgrade.php
lib/deprecatedlib.php
lib/enrollib.php
lib/externallib.php
lib/grade/grade_category.php
lib/grade/grade_grade.php
lib/javascript-static.js
lib/javascript.php
lib/messagelib.php
lib/minify/LICENSE.txt [deleted file]
lib/minify/config.php [deleted file]
lib/minify/groupsConfig.php [deleted file]
lib/minify/lib/CSSmin.php [deleted file]
lib/minify/lib/DooDigestAuth.php [deleted file]
lib/minify/lib/FirePHP.php [deleted file]
lib/minify/lib/HTTP/ConditionalGet.php [deleted file]
lib/minify/lib/HTTP/Encoder.php [deleted file]
lib/minify/lib/JSMinPlus.php [deleted file]
lib/minify/lib/Minify.php [deleted file]
lib/minify/lib/Minify/Build.php [deleted file]
lib/minify/lib/Minify/CSS.php [deleted file]
lib/minify/lib/Minify/CSS/Compressor.php [deleted file]
lib/minify/lib/Minify/CSS/UriRewriter.php [deleted file]
lib/minify/lib/Minify/CSSmin.php [deleted file]
lib/minify/lib/Minify/Cache/APC.php [deleted file]
lib/minify/lib/Minify/Cache/File.php [deleted file]
lib/minify/lib/Minify/Cache/Memcache.php [deleted file]
lib/minify/lib/Minify/Cache/WinCache.php [deleted file]
lib/minify/lib/Minify/Cache/XCache.php [deleted file]
lib/minify/lib/Minify/Cache/ZendPlatform.php [deleted file]
lib/minify/lib/Minify/ClosureCompiler.php [deleted file]
lib/minify/lib/Minify/CommentPreserver.php [deleted file]
lib/minify/lib/Minify/Controller/Base.php [deleted file]
lib/minify/lib/Minify/Controller/Files.php [deleted file]
lib/minify/lib/Minify/Controller/Groups.php [deleted file]
lib/minify/lib/Minify/Controller/MinApp.php [deleted file]
lib/minify/lib/Minify/Controller/Page.php [deleted file]
lib/minify/lib/Minify/Controller/Version1.php [deleted file]
lib/minify/lib/Minify/DebugDetector.php [deleted file]
lib/minify/lib/Minify/HTML.php [deleted file]
lib/minify/lib/Minify/HTML/Helper.php [deleted file]
lib/minify/lib/Minify/ImportProcessor.php [deleted file]
lib/minify/lib/Minify/JS/ClosureCompiler.php [deleted file]
lib/minify/lib/Minify/Lines.php [deleted file]
lib/minify/lib/Minify/Loader.php [deleted file]
lib/minify/lib/Minify/Logger.php [deleted file]
lib/minify/lib/Minify/Packer.php [deleted file]
lib/minify/lib/Minify/Source.php [deleted file]
lib/minify/lib/Minify/YUI/CssCompressor.java [deleted file]
lib/minify/lib/Minify/YUI/CssCompressor.php [deleted file]
lib/minify/lib/Minify/YUICompressor.php [deleted file]
lib/minify/lib/MrClay/Cli.php [deleted file]
lib/minify/lib/MrClay/Cli/Arg.php [deleted file]
lib/minify/matthiasmullie-minify/data/js/keywords_after.txt [new file with mode: 0644]
lib/minify/matthiasmullie-minify/data/js/keywords_before.txt [new file with mode: 0644]
lib/minify/matthiasmullie-minify/data/js/keywords_reserved.txt [new file with mode: 0644]
lib/minify/matthiasmullie-minify/data/js/operators.txt [new file with mode: 0644]
lib/minify/matthiasmullie-minify/data/js/operators_after.txt [new file with mode: 0644]
lib/minify/matthiasmullie-minify/data/js/operators_before.txt [new file with mode: 0644]
lib/minify/matthiasmullie-minify/src/CSS.php [new file with mode: 0644]
lib/minify/matthiasmullie-minify/src/Exception.php [new file with mode: 0644]
lib/minify/matthiasmullie-minify/src/Exceptions/BasicException.php [new file with mode: 0644]
lib/minify/matthiasmullie-minify/src/Exceptions/FileImportException.php [new file with mode: 0644]
lib/minify/matthiasmullie-minify/src/Exceptions/IOException.php [new file with mode: 0644]
lib/minify/matthiasmullie-minify/src/JS.php [new file with mode: 0644]
lib/minify/matthiasmullie-minify/src/Minify.php [new file with mode: 0644]
lib/minify/matthiasmullie-pathconverter/src/Converter.php [new file with mode: 0644]
lib/minify/readme_moodle.txt
lib/minify/utils.php [deleted file]
lib/moodlelib.php
lib/myprofilelib.php
lib/navigationlib.php
lib/oauthlib.php
lib/outputcomponents.php
lib/outputrenderers.php
lib/pagelib.php
lib/pear/HTML/QuickForm.php
lib/templates/hover_tooltip.mustache [new file with mode: 0644]
lib/templates/modal.mustache
lib/templates/modal_confirm.mustache [new file with mode: 0644]
lib/templates/modal_save_cancel.mustache
lib/templates/popover_region.mustache [new file with mode: 0644]
lib/templates/progress_bar.mustache [new file with mode: 0644]
lib/tests/behat/behat_transformations.php
lib/tests/minify_test.php
lib/tests/string_manager_standard_test.php
lib/thirdpartylibs.xml
lib/upgrade.txt
lib/upgradelib.php
lib/weblib.php
lib/xhprof/xhprof_moodle.php
login/change_password.php
login/change_password_form.php
message/ajax.php [deleted file]
message/amd/build/message_area.min.js [new file with mode: 0644]
message/amd/build/message_area_actions.min.js [new file with mode: 0644]
message/amd/build/message_area_contacts.min.js [new file with mode: 0644]
message/amd/build/message_area_events.min.js [new file with mode: 0644]
message/amd/build/message_area_messages.min.js [new file with mode: 0644]
message/amd/build/message_area_profile.min.js [new file with mode: 0644]
message/amd/build/message_area_search.min.js [new file with mode: 0644]
message/amd/build/message_area_tabs.min.js [new file with mode: 0644]
message/amd/build/message_notification_preference.min.js [new file with mode: 0644]
message/amd/build/message_preferences.min.js [new file with mode: 0644]
message/amd/build/message_repository.min.js [new file with mode: 0644]
message/amd/build/notification_preference.min.js [new file with mode: 0644]
message/amd/build/notification_processor.min.js [new file with mode: 0644]
message/amd/build/notification_processor_settings.min.js [new file with mode: 0644]
message/amd/build/preferences_notifications_list_controller.min.js [new file with mode: 0644]
message/amd/build/preferences_processor_form.min.js [new file with mode: 0644]
message/amd/build/toggle_contact_button.min.js [new file with mode: 0644]
message/amd/src/message_area.js [new file with mode: 0644]
message/amd/src/message_area_actions.js [new file with mode: 0644]
message/amd/src/message_area_contacts.js [new file with mode: 0644]
message/amd/src/message_area_events.js [new file with mode: 0644]
message/amd/src/message_area_messages.js [new file with mode: 0644]
message/amd/src/message_area_profile.js [new file with mode: 0644]
message/amd/src/message_area_search.js [new file with mode: 0644]
message/amd/src/message_area_tabs.js [new file with mode: 0644]
message/amd/src/message_notification_preference.js [new file with mode: 0644]
message/amd/src/message_preferences.js [new file with mode: 0644]
message/amd/src/message_repository.js [new file with mode: 0644]
message/amd/src/notification_preference.js [new file with mode: 0644]
message/amd/src/notification_processor.js [new file with mode: 0644]
message/amd/src/notification_processor_settings.js [new file with mode: 0644]
message/amd/src/preferences_notifications_list_controller.js [new file with mode: 0644]
message/amd/src/preferences_processor_form.js [new file with mode: 0644]
message/amd/src/toggle_contact_button.js [new file with mode: 0644]
message/bell.mp3 [deleted file]
message/bell.ogg [deleted file]
message/bell.wav [deleted file]
message/classes/api.php [new file with mode: 0644]
message/classes/helper.php [new file with mode: 0644]
message/classes/output/messagearea/contact.php [new file with mode: 0644]
message/classes/output/messagearea/contacts.php [new file with mode: 0644]
message/classes/output/messagearea/message.php [new file with mode: 0644]
message/classes/output/messagearea/message_area.php [new file with mode: 0644]
message/classes/output/messagearea/message_search_results.php [new file with mode: 0644]
message/classes/output/messagearea/messages.php [new file with mode: 0644]
message/classes/output/messagearea/profile.php [new file with mode: 0644]
message/classes/output/messagearea/user_search_results.php [new file with mode: 0644]
message/classes/output/preferences/message_notification_list.php [new file with mode: 0644]
message/classes/output/preferences/message_notification_list_component.php [new file with mode: 0644]
message/classes/output/preferences/notification_list.php [new file with mode: 0644]
message/classes/output/preferences/notification_list_component.php [new file with mode: 0644]
message/classes/output/preferences/notification_list_processor.php [new file with mode: 0644]
message/classes/output/preferences/processor.php [new file with mode: 0644]
message/classes/output/processor.php [new file with mode: 0644]
message/classes/output/renderer.php [new file with mode: 0644]
message/edit.php
message/externallib.php
message/index.php
message/lib.php
message/module.js
message/notificationpreferences.php [new file with mode: 0644]
message/output/airnotifier/lang/en/message_airnotifier.php
message/output/email/message_output_email.php
message/output/jabber/lang/en/message_jabber.php
message/output/lib.php
message/output/popup/amd/build/message_popover_controller.min.js [new file with mode: 0644]
message/output/popup/amd/build/notification_area_content_area.min.js [new file with mode: 0644]
message/output/popup/amd/build/notification_area_control_area.min.js [new file with mode: 0644]
message/output/popup/amd/build/notification_area_events.min.js [new file with mode: 0644]
message/output/popup/amd/build/notification_popover_controller.min.js [new file with mode: 0644]
message/output/popup/amd/build/notification_repository.min.js [new file with mode: 0644]
message/output/popup/amd/src/message_popover_controller.js [new file with mode: 0644]
message/output/popup/amd/src/notification_area_content_area.js [new file with mode: 0644]
message/output/popup/amd/src/notification_area_control_area.js [new file with mode: 0644]
message/output/popup/amd/src/notification_area_events.js [moved from message/yui/src/messenger/js/constants.js with 62% similarity]
message/output/popup/amd/src/notification_popover_controller.js [new file with mode: 0644]
message/output/popup/amd/src/notification_repository.js [new file with mode: 0644]
message/output/popup/classes/api.php [new file with mode: 0644]
message/output/popup/classes/output/popup_notification.php [new file with mode: 0644]
message/output/popup/db/events.php [new file with mode: 0644]
message/output/popup/db/install.xml [new file with mode: 0644]
message/output/popup/db/services.php [new file with mode: 0644]
message/output/popup/db/upgrade.php
message/output/popup/externallib.php [new file with mode: 0644]
message/output/popup/lang/en/message_popup.php
message/output/popup/lib.php [new file with mode: 0644]
message/output/popup/message_output_popup.php
message/output/popup/notifications.php [new file with mode: 0644]
message/output/popup/templates/message_content_item.mustache [new file with mode: 0644]
message/output/popup/templates/message_popover.mustache [new file with mode: 0644]
message/output/popup/templates/notification_area.mustache [new file with mode: 0644]
message/output/popup/templates/notification_area_content_area_content.mustache [new file with mode: 0644]
message/output/popup/templates/notification_area_content_area_footer.mustache [new file with mode: 0644]
message/output/popup/templates/notification_area_content_area_header.mustache [new file with mode: 0644]
message/output/popup/templates/notification_content_item.mustache [new file with mode: 0644]
message/output/popup/templates/notification_popover.mustache [new file with mode: 0644]
message/output/popup/tests/api_test.php [new file with mode: 0644]
message/output/popup/tests/base.php [new file with mode: 0644]
message/output/popup/tests/externallib_test.php [new file with mode: 0644]
message/output/popup/version.php
message/renderer.php
message/search.html [deleted file]
message/search_advanced.html [deleted file]
message/send_form.php [deleted file]
message/settings.html [deleted file]
message/templates/add_contact_button.mustache [new file with mode: 0644]
message/templates/message_area.mustache [new file with mode: 0644]
message/templates/message_area_contact.mustache [new file with mode: 0644]
message/templates/message_area_contacts.mustache [new file with mode: 0644]
message/templates/message_area_contacts_area.mustache [new file with mode: 0644]
message/templates/message_area_message.mustache [new file with mode: 0644]
message/templates/message_area_message_search_results.mustache [new file with mode: 0644]
message/templates/message_area_messages.mustache [new file with mode: 0644]
message/templates/message_area_messages_area.mustache [new file with mode: 0644]
message/templates/message_area_profile.mustache [new file with mode: 0644]
message/templates/message_area_response.mustache [new file with mode: 0644]
message/templates/message_area_user_search_results.mustache [new file with mode: 0644]
message/templates/message_preferences.mustache [new file with mode: 0644]
message/templates/message_preferences_component.mustache [new file with mode: 0644]
message/templates/message_preferences_notification_processor.mustache [new file with mode: 0644]
message/templates/notification_preferences.mustache [new file with mode: 0644]
message/templates/notification_preferences_component.mustache [new file with mode: 0644]
message/templates/notification_preferences_component_notification.mustache [new file with mode: 0644]
message/templates/notification_preferences_processor.mustache [new file with mode: 0644]
message/templates/preferences_processor.mustache [new file with mode: 0644]
message/templates/remove_contact_button.mustache [new file with mode: 0644]
message/tests/api_test.php [new file with mode: 0644]
message/tests/behat/behat_message.php
message/tests/behat/block_noncontacts.feature [deleted file]
message/tests/behat/block_users.feature [deleted file]
message/tests/behat/delete_messages.feature [deleted file]
message/tests/behat/display_history.feature [deleted file]
message/tests/behat/manage_contacts.feature [deleted file]
message/tests/behat/message_participants.feature [deleted file]
message/tests/behat/recent_conversations.feature [deleted file]
message/tests/behat/search_history.feature [deleted file]
message/tests/behat/send_message.feature [deleted file]
message/tests/events_test.php
message/tests/externallib_test.php
message/tests/messagelib_test.php
message/upgrade.txt
message/yui/build/moodle-core_message-messenger/moodle-core_message-messenger-debug.js [deleted file]
message/yui/build/moodle-core_message-messenger/moodle-core_message-messenger-min.js [deleted file]
message/yui/build/moodle-core_message-messenger/moodle-core_message-messenger.js [deleted file]
message/yui/build/moodle-core_message-toolbox/moodle-core_message-toolbox-debug.js [deleted file]
message/yui/build/moodle-core_message-toolbox/moodle-core_message-toolbox-min.js [deleted file]
message/yui/build/moodle-core_message-toolbox/moodle-core_message-toolbox.js [deleted file]
message/yui/src/messenger/build.json [deleted file]
message/yui/src/messenger/js/manager.js [deleted file]
message/yui/src/messenger/js/sendmessage.js [deleted file]
message/yui/src/messenger/meta/messenger.json [deleted file]
message/yui/src/toolbox/build.json [deleted file]
message/yui/src/toolbox/js/delete.js [deleted file]
message/yui/src/toolbox/meta/toolbox.json [deleted file]
mod/data/tests/generator_test.php
mod/lesson/tests/behat/completion_condition_end_reached.feature
mod/lesson/tests/behat/lesson_question_attempts.feature
mod/lti/amd/src/contentitem.js
mod/lti/mod_form.php
mod/lti/tests/behat/contentitem.feature
mod/quiz/report/attemptsreport.php
mod/quiz/report/attemptsreport_table.php
mod/quiz/report/grading/report.php
mod/quiz/report/grading/tests/behat/grading.feature [new file with mode: 0644]
mod/quiz/report/overview/overview_table.php
mod/quiz/report/overview/report.php
mod/quiz/report/overview/tests/behat/basic.feature [new file with mode: 0644]
mod/quiz/report/overview/tests/report_test.php
mod/quiz/report/reportlib.php
mod/quiz/report/responses/last_responses_table.php
mod/quiz/report/responses/report.php
mod/quiz/report/statistics/classes/calculator.php
mod/quiz/report/statistics/db/upgrade.php
mod/quiz/report/statistics/report.php
mod/quiz/report/statistics/statisticslib.php
mod/quiz/report/statistics/tests/statisticslib_test.php [deleted file]
mod/quiz/report/statistics/tests/stats_from_steps_walkthrough_test.php
mod/quiz/report/statistics/upgrade.txt
mod/quiz/report/statistics/version.php
mod/quiz/report/upgrade.txt
npm-shrinkwrap.json
package.json
pix/i/notifications.png [new file with mode: 0644]
pix/i/notifications.svg [new file with mode: 0644]
question/classes/bank/action_column_base.php
repository/dropbox/classes/authentication_exception.php [new file with mode: 0644]
repository/dropbox/classes/dropbox.php [new file with mode: 0644]
repository/dropbox/classes/dropbox_exception.php [new file with mode: 0644]
repository/dropbox/classes/provider_exception.php [new file with mode: 0644]
repository/dropbox/classes/rate_limit_exception.php [moved from message/discussion.php with 50% similarity]
repository/dropbox/db/upgrade.php
repository/dropbox/lang/en/repository_dropbox.php
repository/dropbox/lib.php
repository/dropbox/locallib.php [deleted file]
repository/dropbox/tests/api_test.php [new file with mode: 0644]
repository/dropbox/thumbnail.php
repository/dropbox/version.php
search/engine/solr/classes/engine.php
search/engine/solr/classes/schema.php
tag/templates/taglist.mustache
theme/boost/amd/build/loader.min.js
theme/boost/amd/src/loader.js
theme/boost/lib.php
theme/boost/pix/favicon.ico
theme/boost/scss/moodle.scss
theme/boost/scss/moodle/calendar.scss
theme/boost/scss/moodle/core.scss
theme/boost/scss/moodle/forms.scss
theme/boost/scss/moodle/message.scss
theme/boost/scss/moodle/popover-region.scss [new file with mode: 0644]
theme/boost/scss/moodle/question.scss
theme/boost/templates/core/modal.mustache [new file with mode: 0644]
theme/boost/templates/core/modal_backdrop.mustache [new file with mode: 0644]
theme/boost/templates/core/progress_bar.mustache [new file with mode: 0644]
theme/boost/templates/header.mustache
theme/bootstrapbase/less/moodle.less
theme/bootstrapbase/less/moodle/blocks.less
theme/bootstrapbase/less/moodle/core.less
theme/bootstrapbase/less/moodle/forms.less
theme/bootstrapbase/less/moodle/message.less
theme/bootstrapbase/less/moodle/popover_region.less [new file with mode: 0644]
theme/bootstrapbase/less/moodle/question.less
theme/bootstrapbase/less/moodle/responsive.less
theme/bootstrapbase/less/moodle/user.less
theme/bootstrapbase/style/moodle.css
theme/bootstrapbase/templates/theme_boost/admin_setting_tabs.mustache [new file with mode: 0644]
theme/clean/layout/columns1.php
theme/clean/layout/columns2.php
theme/clean/layout/columns3.php
user/editadvanced.php
user/editadvanced_form.php
user/externallib.php
user/tests/behat/user_grade_navigation.feature
user/tests/behat/view_full_profile.feature
user/tests/behat/view_preferences_page.feature
version.php
webservice/lib.php

index e35675a..73b2b4a 100644 (file)
@@ -20,7 +20,8 @@ lib/phpexcel/
 lib/google/
 lib/htmlpurifier/
 lib/jabber/
-lib/minify/
+lib/minify/matthiasmullie-minify/
+lib/minify/matthiasmullie-pathconverter/
 lib/flowplayer/
 lib/pear/Auth/RADIUS.php
 lib/pear/Crypt/CHAP.php
index c701962..3514759 100644 (file)
--- a/.eslintrc
+++ b/.eslintrc
@@ -31,7 +31,6 @@
     'no-inner-declarations': 'error',
     'no-invalid-regexp': 'error',
     'no-irregular-whitespace': 'error',
-    'no-negated-in-lhs': 'error',
     'no-obj-calls': 'error',
     'no-prototype-builtins': 'off',
     'no-regex-spaces': 'error',
@@ -39,6 +38,7 @@
     'no-unexpected-multiline': 'error',
     'no-unreachable': 'warn',
     'no-unsafe-finally': 'error',
+    'no-unsafe-negation': 'error',
     'use-isnan': 'error',
     'valid-jsdoc': ['warn', { 'requireReturn': false, 'requireParamDescription': false, 'requireReturnDescription': false }],
     'valid-typeof': 'error',
@@ -63,6 +63,7 @@
     'no-extra-bind': 'warn',
     'no-fallthrough': 'error',
     'no-floating-decimal': 'warn',
+    'no-global-assign': 'warn',
     // Enabled by grunt for AMD modules: 'no-implicit-globals': 'error',
     'no-implied-eval': 'error',
     'no-invalid-this': 'error',
@@ -71,7 +72,6 @@
     'no-loop-func': 'error',
     'no-multi-spaces': 'warn',
     'no-multi-str': 'error',
-    'no-native-reassign': 'warn',
     'no-new-func': 'error',
     'no-new-wrappers': 'error',
     'no-octal': 'error',
@@ -96,7 +96,7 @@
     'no-delete-var': 'error',
     'no-undef': 'error',
     'no-undef-init': 'error',
-    'no-unused-vars': ['error', { 'caughtErrors': 'none', 'argsIgnorePattern': "(e|event)" }],
+    'no-unused-vars': ['error', { 'caughtErrors': 'none' }],
 
     // === Stylistic Issues ===
     'array-bracket-spacing': 'warn',
     'computed-property-spacing': 'error',
     'consistent-this': 'off',
     'eol-last': 'off',
+    'func-call-spacing': ['warn', 'never'],
     'func-names': 'off',
     'func-style': 'off',
     // indent currently not doing well with our wrapping style, so disabled.
     'no-nested-ternary': 'warn',
     'no-new-object': 'off',
     'no-plusplus': 'off',
-    'no-spaced-func': 'warn',
+    'no-tabs': 'error',
     'no-ternary': 'off',
     'no-trailing-spaces': 'error',
     'no-underscore-dangle': 'off',
     'spaced-comment': 'warn',
     'unicode-bom': 'error',
     'wrap-regex': 'off',
+
+    // === Deprecations ===
+    "no-restricted-properties": ['warn', {
+        'object': 'M',
+        'property': 'str',
+        'message': 'Use AMD module "core/str" or M.util.get_string()'
+    }],
   }
 }
index 9a2dc50..b9e8b2c 100644 (file)
@@ -19,7 +19,8 @@ lib/phpexcel/
 lib/google/
 lib/htmlpurifier/
 lib/jabber/
-lib/minify/
+lib/minify/matthiasmullie-minify/
+lib/minify/matthiasmullie-pathconverter/
 lib/flowplayer/
 lib/pear/Auth/RADIUS.php
 lib/pear/Crypt/CHAP.php
index 2cf9d1a..6f87285 100644 (file)
@@ -851,6 +851,7 @@ $registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOOD
 $cachewarnings = cache_helper::warnings();
 // Check if there are events 1 API handlers.
 $eventshandlers = $DB->get_records_sql('SELECT DISTINCT component FROM {events_handlers}');
+$themedesignermode = !empty($CFG->themedesignermode);
 
 admin_externalpage_setup('adminnotifications');
 
@@ -858,4 +859,4 @@ $output = $PAGE->get_renderer('core', 'admin');
 
 echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems,
                                        $maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
-                                       $registered, $cachewarnings, $eventshandlers);
+                                       $registered, $cachewarnings, $eventshandlers, $themedesignermode);
index 7895c31..2b841d6 100644 (file)
@@ -281,7 +281,7 @@ class core_admin_renderer extends plugin_renderer_base {
      */
     public function admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
             $cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch,
-            $buggyiconvnomb, $registered, array $cachewarnings = array(), $eventshandlers = 0) {
+            $buggyiconvnomb, $registered, array $cachewarnings = array(), $eventshandlers = 0, $themedesignermode = false) {
         global $CFG;
         $output = '';
 
@@ -290,6 +290,7 @@ class core_admin_renderer extends plugin_renderer_base {
         $output .= $this->legacy_log_store_writing_error();
         $output .= empty($CFG->disableupdatenotifications) ? $this->available_updates($availableupdates, $availableupdatesfetch) : '';
         $output .= $this->insecure_dataroot_warning($insecuredataroot);
+        $output .= $this->themedesignermode_warning($themedesignermode);
         $output .= $this->display_errors_warning($errorsdisplayed);
         $output .= $this->buggy_iconv_warning($buggyiconvnomb);
         $output .= $this->cron_overdue_warning($cronoverdue);
@@ -532,6 +533,19 @@ class core_admin_renderer extends plugin_renderer_base {
         return $this->warning(get_string('displayerrorswarning', 'admin'));
     }
 
+    /**
+     * Render an appropriate message if themdesignermode is enabled.
+     * @param bool $themedesignermode true if enabled
+     * @return string HTML to output.
+     */
+    protected function themedesignermode_warning($themedesignermode) {
+        if (!$themedesignermode) {
+            return '';
+        }
+
+        return $this->warning(get_string('themedesignermodewarning', 'admin'));
+    }
+
     /**
      * Render an appropriate message if iconv is buggy and mbstring missing.
      * @param bool $buggyiconvnomb
index 946abbd..c892566 100644 (file)
@@ -96,6 +96,11 @@ if ($hassiteconfig) { // speedup for non-admins, add all caps used on this page
     $temp->add(new admin_setting_configcheckbox('passwordchangelogout',
         new lang_string('passwordchangelogout', 'admin'),
         new lang_string('passwordchangelogout_desc', 'admin'), 0));
+
+    $temp->add(new admin_setting_configcheckbox('passwordchangetokendeletion',
+        new lang_string('passwordchangetokendeletion', 'admin'),
+        new lang_string('passwordchangetokendeletion_desc', 'admin'), 0));
+
     $temp->add(new admin_setting_configcheckbox('groupenrolmentkeypolicy', new lang_string('groupenrolmentkeypolicy', 'admin'), new lang_string('groupenrolmentkeypolicy_desc', 'admin'), 1));
     $temp->add(new admin_setting_configcheckbox('disableuserimages', new lang_string('disableuserimages', 'admin'), new lang_string('configdisableuserimages', 'admin'), 0));
     $temp->add(new admin_setting_configcheckbox('emailchangeconfirmation', new lang_string('emailchangeconfirmation', 'admin'), new lang_string('configemailchangeconfirmation', 'admin'), 1));
diff --git a/admin/tool/behat/tests/behat/datetime_strings.feature b/admin/tool/behat/tests/behat/datetime_strings.feature
new file mode 100644 (file)
index 0000000..0b4e7e5
--- /dev/null
@@ -0,0 +1,25 @@
+@tool @tool_behat
+Feature: Transform date time string arguments
+  In order to write tests with relative date and time
+  As a user
+  I need to apply some transformations to the steps arguments
+
+  Scenario: Set date in table and check date with specific format
+    Given I am on site homepage
+    And the following "users" exist:
+      | username  | firstname | lastname |
+      | teacher1  | Teacher   | 1        |
+    And the following "courses" exist:
+      | fullname | shortname | category |
+      | Course 1 | C1        | 0        |
+    And the following "activities" exist:
+      | activity | course | idnumber | name                 | intro                       | duedate       |
+      | assign   | C1     | assign1  | Test assignment name | Test assignment description | ##yesterday## |
+    And the following "course enrolments" exist:
+      | user     | course | role    |
+      | teacher1 | C1     | editingteacher |
+    And I log in as "teacher1"
+    And I follow "Course 1"
+    And I follow "Test assignment name"
+    And I should see "##yesterday##l, j F Y##"
+    And I log out
index 4b4120d..f8d847d 100644 (file)
@@ -31,8 +31,9 @@ Feature: Transform steps arguments
     And I press "Update profile"
     And I follow "Edit profile"
     Then I should not see "NASTYSTRING"
-    And the field "Surname" matches value "$NASTYSTRING1"
-    And the field "City/town" matches value "$NASTYSTRING3"
+    # BEHAT Transformation regression - See MDL-56397
+    #And the field "Surname" matches value "$NASTYSTRING1"
+    #And the field "City/town" matches value "$NASTYSTRING3"
 
   Scenario: Use double quotes
     When I set the following fields to these values:
@@ -56,4 +57,5 @@ Feature: Transform steps arguments
     And I should see "My Firstname"
     And I should see "My Surname"
     And the field "First name" matches value "My Firstname $NASTYSTRING1"
-    And the field "Surname" matches value "My Surname $NASTYSTRING2"
+    # BEHAT Transformation regression - See MDL-56397
+    #And the field "Surname" matches value "My Surname $NASTYSTRING2"
index 496d709..bcf2ff6 100644 (file)
@@ -98,12 +98,13 @@ Feature: tool_monitor_subscriptions
     Then I should see "Subscription successfully removed"
     And "#toolmonitorsubs_r0" "css_element" should not exist
 
+  @_bug_phantomjs
   Scenario: Receiving notification on site level
     Given I log in as "admin"
     And I follow "Preferences" in the user menu
-    And I follow "Messaging"
-    And I click on "input[name^=tool_monitor_notification_loggedin]" "css_element"
-    And I press "Save changes"
+    And I click on "Notification preferences" "link" in the "#page-content" "css_element"
+    And I click on ".preference-state" "css_element" in the "Notifications of rule subscriptions" "table_row"
+    And I wait until the page is ready
     And I follow "Preferences" in the user menu
     And I follow "Event monitoring"
     And I set the field "Select a course" to "Acceptance test site"
@@ -113,16 +114,18 @@ Feature: tool_monitor_subscriptions
     And I am on site homepage
     And I trigger cron
     And I am on site homepage
-    When I follow "Messages" in the user menu
-    And I follow "Do not reply to this email (1)"
-    Then I should see "The course was viewed."
+    When I click on ".popover-region-notifications" "css_element"
+    And I click on "View more" "link" in the ".popover-region-notifications" "css_element"
+    Then I should see "New rule site level"
+    And I should see "The course was viewed"
 
+  @_bug_phantomjs
   Scenario: Receiving notification on course level
     Given I log in as "teacher1"
     And I follow "Preferences" in the user menu
-    And I follow "Messaging"
-    And I click on "input[name^=tool_monitor_notification_loggedin]" "css_element"
-    And I press "Save changes"
+    And I click on "Notification preferences" "link" in the "#page-content" "css_element"
+    And I click on ".preference-state" "css_element" in the "Notifications of rule subscriptions" "table_row"
+    And I wait until the page is ready
     And I follow "Preferences" in the user menu
     And I follow "Event monitoring"
     And I set the field "Select a course" to "Course 1"
@@ -133,9 +136,10 @@ Feature: tool_monitor_subscriptions
     And I follow "Course 1"
     And I trigger cron
     And I am on site homepage
-    When I follow "Messages" in the user menu
-    And I follow "Do not reply to this email (1)"
-    Then I should see "The course was viewed."
+    When I click on ".popover-region-notifications" "css_element"
+    And I click on "View more" "link" in the ".popover-region-notifications" "css_element"
+    Then I should see "New rule course level"
+    And I should see "The course was viewed"
 
   Scenario: Navigating via quick link to rules
     Given I log in as "admin"
index 2ef5d4c..23b7dcf 100644 (file)
@@ -117,17 +117,21 @@ class api {
         // Get the list of possible template directories.
         $dirs = mustache_template_finder::get_template_directories_for_component($component);
         $filename = false;
+        $themedir = core_component::get_plugin_types()['theme'];
 
         foreach ($dirs as $dir) {
             // Skip theme dirs - we only want the original plugin/core template.
-            if (strpos($dir, "/theme/") === false) {
-                $candidate = $dir . $template . '.mustache';
-                if (file_exists($candidate)) {
-                    $filename = $candidate;
-                    break;
-                }
+            if (strpos($dir, $themedir) === 0) {
+                continue;
+            }
+
+            $candidate = $dir . $template . '.mustache';
+            if (file_exists($candidate)) {
+                $filename = $candidate;
+                break;
             }
         }
+
         if ($filename === false) {
             throw new moodle_exception('filenotfound', 'error');
         }
index 3b323ad..6ecf6fe 100644 (file)
@@ -381,7 +381,7 @@ class cc2moodle {
         if (!empty($format['defaultblocks'])) {
             $blocknames = $format['defaultblocks'];
         } else {
-            if (!empty($CFG->defaultblocks)) {
+            if (isset($CFG->defaultblocks)) {
                 $blocknames = $CFG->defaultblocks;
             } else {
                 $blocknames = 'participants,activity_modules,search_forums,course_list:news_items,calendar_upcoming,recent_activity';
index 2758c82..bb86bdb 100644 (file)
@@ -98,8 +98,9 @@ Feature: View the course overview block on the dashboard and test it's functiona
     Then I should see "Welcome Student" in the "Course overview" "block"
     And I should see "You have no unread messages" in the "Course overview" "block"
     And I follow "messages"
-    And I should see "Contact list empty"
+    And I should see "No messages"
 
+  @javascript
   Scenario: View the block by a user with the welcome area and the user having messages.
     Given the following config values are set as admin:
       | showwelcomearea | 1 | block_course_overview |
index 068b0e0..43446c2 100644 (file)
@@ -31,8 +31,9 @@ Feature: The messages block allows users to list new messages an a course
     And I follow "Course 1"
     When I turn editing mode on
     And I add the "Messages" block
-    Then I should see "No messages waiting" in the "Messages" "block"
+    Then I should see "No messages" in the "Messages" "block"
 
+  @javascript
   Scenario: View the block by a user who has messages.
     Given I log in as "student1"
     And I follow "Messages" in the user menu
@@ -45,12 +46,13 @@ Feature: The messages block allows users to list new messages an a course
     And I add the "Messages" block
     Then I should see "Student 1" in the "Messages" "block"
 
+  @javascript
   Scenario: Use the block to send a message to a user.
     Given I log in as "teacher1"
     And I follow "Course 1"
     And I turn editing mode on
     And I add the "Messages" block
-    And I follow "Messages"
+    And I click on "//a[normalize-space(.) = 'Messages']" "xpath_element" in the "Messages" "block"
     And I send "This is message 1" message to "Student 1" user
     And I log out
     When I log in as "student1"
index 8eb1918..509057e 100644 (file)
@@ -22,8 +22,9 @@ Feature: The messages block allows users to list new messages on the dashboard
     Given I log in as "teacher1"
     And I press "Customise this page"
     When I add the "Messages" block
-    Then I should see "No messages waiting" in the "Messages" "block"
+    Then I should see "No messages" in the "Messages" "block"
 
+  @javascript
   Scenario: View the block by a user who has messages.
     Given I log in as "student1"
     And I follow "Messages" in the user menu
@@ -35,11 +36,12 @@ Feature: The messages block allows users to list new messages on the dashboard
     And I add the "Messages" block
     Then I should see "Student 1" in the "Messages" "block"
 
+  @javascript
   Scenario: Use the block to send a message to a user.
     Given I log in as "teacher1"
     And I press "Customise this page"
     And I add the "Messages" block
-    And I follow "Messages"
+    And I click on "//a[normalize-space(.) = 'Messages']" "xpath_element" in the "Messages" "block"
     And I send "This is message 1" message to "Student 1" user
     And I log out
     When I log in as "student1"
index df00991..2c71001 100644 (file)
@@ -28,13 +28,14 @@ Feature: The messages block allows users to list new messages on the frontpage
   Scenario: View the block by a user who does not have any messages.
     Given I log in as "teacher1"
     When I am on site homepage
-    Then I should see "No messages waiting" in the "Messages" "block"
+    Then I should see "No messages" in the "Messages" "block"
 
   Scenario: Try to view the block as a guest user.
     Given I log in as "guest"
     When I am on site homepage
     Then I should not see "Messages"
 
+  @javascript
   Scenario: View the block by a user who has messages.
     Given I log in as "student1"
     And I follow "Messages" in the user menu
@@ -45,10 +46,11 @@ Feature: The messages block allows users to list new messages on the frontpage
     And I am on site homepage
     Then I should see "Student 1" in the "Messages" "block"
 
+  @javascript
   Scenario: Use the block to send a message to a user.
     Given I log in as "teacher1"
     And I am on site homepage
-    And I follow "Messages"
+    And I click on "//a[normalize-space(.) = 'Messages']" "xpath_element" in the "Messages" "block"
     And I send "This is message 1" message to "Student 1" user
     And I log out
     When I log in as "student1"
index dcf3133..9b2e19e 100644 (file)
@@ -39,7 +39,7 @@ class block_online_users extends block_base {
     }
 
     function get_content() {
-        global $USER, $CFG, $DB, $OUTPUT, $PAGE;
+        global $USER, $CFG, $DB, $OUTPUT;
 
         if ($this->content !== NULL) {
             return $this->content;
@@ -106,7 +106,6 @@ class block_online_users extends block_base {
             if (isloggedin() && has_capability('moodle/site:sendmessage', $this->page->context)
                            && !empty($CFG->messaging) && !isguestuser()) {
                 $canshowicon = true;
-                message_messenger_requirejs();
             } else {
                 $canshowicon = false;
             }
@@ -126,10 +125,8 @@ class block_online_users extends block_base {
                 if ($canshowicon and ($USER->id != $user->id) and !isguestuser($user)) {  // Only when logged in and messaging active etc
                     $anchortagcontents = '<img class="iconsmall" src="'.$OUTPUT->pix_url('t/message') . '" alt="'. get_string('messageselectadd') .'" />';
                     $anchorurl = new moodle_url('/message/index.php', array('id' => $user->id));
-                    $anchortag = html_writer::link($anchorurl, $anchortagcontents, array_merge(
-                      message_messenger_sendmessage_link_params($user),
-                      array('title' => get_string('messageselectadd'))
-                    ));
+                    $anchortag = html_writer::link($anchorurl, $anchortagcontents,
+                        array('title' => get_string('messageselectadd')));
 
                     $this->content->text .= '<div class="message">'.$anchortag.'</div>';
                 }
index de4aed6..b50286e 100644 (file)
@@ -31,7 +31,7 @@ Feature: People Block used in a course
     When I log in as "student1"
     And I follow "Course 1"
     And I click on "Participants" "link" in the "People" "block"
-    Then I should see "All participants" in the "h3" "css_element"
+    Then I should see "All participants" in the "#page-content" "css_element"
     And the "My courses" select box should contain "C101"
 
   Scenario: Student without permission can not view participants link
index 8a8e746..1cebc85 100644 (file)
Binary files a/blocks/settings/amd/build/settingsblock.min.js and b/blocks/settings/amd/build/settingsblock.min.js differ
index bdccda5..f17553f 100644 (file)
@@ -40,9 +40,6 @@ define(['jquery', 'core/tree'], function($, Tree) {
             };
             adminTree.collapseGroup = function(item) {
                 Tree.prototype.collapseGroup.call(this, item);
-                Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {
-                    instanceid: instanceid
-                });
                 Y.use('moodle-core-event', function() {
                     Y.Global.fire(M.core.globalEvents.BLOCK_CONTENT_UPDATED, {
                         instanceid: instanceid
index 2e6813e..e97dd56 100644 (file)
@@ -691,7 +691,7 @@ abstract class cache_administration_helper extends cache_helper {
                 'plugin' => $details['plugin'],
                 'default' => $details['default'],
                 'isready' => $store->is_ready(),
-                'requirementsmet' => $store->are_requirements_met(),
+                'requirementsmet' => $class::are_requirements_met(),
                 'mappings' => 0,
                 'lock' => $lock,
                 'modes' => array(
index a0dd6b8..27cd2e6 100644 (file)
@@ -69,7 +69,8 @@ class cachestore_apcu extends cache_store implements cache_is_key_aware, cache_i
      * @return bool True if the stores software/hardware requirements have been met and it can be used. False otherwise.
      */
     public static function are_requirements_met() {
-        if (!extension_loaded('apcu') || !ini_get('apc.enabled')) {
+        $enabled = ini_get('apc.enabled') && (php_sapi_name() != "cli" || ini_get('apc.enable_cli'));
+        if (!extension_loaded('apcu') || !$enabled) {
             return false;
         }
 
index 043111e..a7f8b88 100644 (file)
@@ -2196,10 +2196,13 @@ class api {
      */
     public static function reorder_template_competency($templateid, $competencyidfrom, $competencyidto) {
         static::require_enabled();
-        // First we do a permissions check.
-        $context = context_system::instance();
+        $template = new template($templateid);
 
-        require_capability('moodle/competency:templatemanage', $context);
+        // First we do a permissions check.
+        if (!$template->can_manage()) {
+            throw new required_capability_exception($template->get_context(), 'moodle/competency:templatemanage',
+                'nopermissions', '');
+        }
 
         $down = true;
         $matches = template_competency::get_records(array('templateid' => $templateid, 'competencyid' => $competencyidfrom));
index cb815aa..d55446b 100644 (file)
@@ -1883,6 +1883,71 @@ class core_competency_api_testcase extends advanced_testcase {
         $this->assertInstanceOf('core_competency\\template_cohort', $result);
     }
 
+    public function test_reorder_template_competencies_permissions() {
+        $this->resetAfterTest(true);
+
+        $dg = $this->getDataGenerator();
+        $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
+        $cat = $dg->create_category();
+        $catcontext = context_coursecat::instance($cat->id);
+        $syscontext = context_system::instance();
+
+        $user = $dg->create_user();
+        $role = $dg->create_role();
+        assign_capability('moodle/competency:templatemanage', CAP_ALLOW, $role, $syscontext->id, true);
+        $dg->role_assign($role, $user->id, $syscontext->id);
+
+        // Create a template.
+        $template = $lpg->create_template(array('contextid' => $catcontext->id));
+
+        // Create a competency framework.
+        $framework = $lpg->create_framework(array('contextid' => $catcontext->id));
+
+        // Create competencies.
+        $competency1 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
+        $competency2 = $lpg->create_competency(array('competencyframeworkid' => $framework->get_id()));
+
+        // Add the competencies.
+        $lpg->create_template_competency(array(
+            'templateid' => $template->get_id(),
+            'competencyid' => $competency1->get_id()
+        ));
+        $lpg->create_template_competency(array(
+            'templateid' => $template->get_id(),
+            'competencyid' => $competency2->get_id()
+        ));
+        $this->setUser($user);
+        // Can reorder competencies with system context permissions in category context.
+        $result = api::reorder_template_competency($template->get_id(), $competency2->get_id(), $competency1->get_id());
+        $this->assertTrue($result);
+        unassign_capability('moodle/competency:templatemanage', $role, $syscontext->id);
+        accesslib_clear_all_caches_for_unit_testing();
+
+        try {
+            api::reorder_template_competency($template->get_id(), $competency2->get_id(), $competency1->get_id());
+            $this->fail('Exception expected due to not permissions to manage template competencies');
+        } catch (required_capability_exception $e) {
+            $this->assertEquals('nopermissions', $e->errorcode);
+        }
+
+        // Giving permissions in category context.
+        assign_capability('moodle/competency:templatemanage', CAP_ALLOW, $role, $catcontext->id, true);
+        $dg->role_assign($role, $user->id, $catcontext->id);
+        // User with templatemanage capability in category context can reorder competencies in temple.
+        $result = api::reorder_template_competency($template->get_id(), $competency1->get_id(), $competency2->get_id());
+        $this->assertTrue($result);
+        // Removing templatemanage capability in category context.
+        unassign_capability('moodle/competency:templatemanage', $role, $catcontext->id);
+        accesslib_clear_all_caches_for_unit_testing();
+
+        try {
+            api::reorder_template_competency($template->get_id(), $competency2->get_id(), $competency1->get_id());
+            $this->fail('Exception expected due to not permissions to manage template competencies');
+        } catch (required_capability_exception $e) {
+            $this->assertEquals('nopermissions', $e->errorcode);
+        }
+    }
+
     public function test_delete_template() {
         $this->resetAfterTest(true);
         $this->setAdminUser();
index 641d22b..3f7df7f 100644 (file)
@@ -5,7 +5,7 @@
     "type": "project",
     "homepage": "https://moodle.org",
     "require-dev": {
-        "phpunit/phpunit": "5.4.*",
+        "phpunit/phpunit": "5.5.*",
         "phpunit/dbUnit": "1.4.*",
         "moodlehq/behat-extension": "3.32.3"
     }
index f980783..8ebc23e 100644 (file)
@@ -4,8 +4,8 @@
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
         "This file is @generated automatically"
     ],
-    "hash": "c3da2812d8753f3fb2429366b373afa8",
-    "content-hash": "a4e8fa2277e59a3c14afb3ae729bf4e7",
+    "hash": "ec5f1e9d8b8134cf6a4490ba5dfe0082",
+    "content-hash": "583f9a915721de799118a396dc81f177",
     "packages": [],
     "packages-dev": [
         {
         },
         {
             "name": "phpunit/phpunit",
-            "version": "5.4.8",
+            "version": "5.5.7",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit.git",
-                "reference": "3132365e1430c091f208e120b8845d39c25f20e6"
+                "reference": "3f67cee782c9abfaee5e32fd2f57cdd54bc257ba"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3132365e1430c091f208e120b8845d39c25f20e6",
-                "reference": "3132365e1430c091f208e120b8845d39c25f20e6",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/3f67cee782c9abfaee5e32fd2f57cdd54bc257ba",
+                "reference": "3f67cee782c9abfaee5e32fd2f57cdd54bc257ba",
                 "shasum": ""
             },
             "require": {
                 "ext-dom": "*",
                 "ext-json": "*",
-                "ext-pcre": "*",
-                "ext-reflection": "*",
-                "ext-spl": "*",
+                "ext-libxml": "*",
+                "ext-mbstring": "*",
+                "ext-xml": "*",
                 "myclabs/deep-copy": "~1.3",
                 "php": "^5.6 || ^7.0",
                 "phpspec/prophecy": "^1.3.1",
             "conflict": {
                 "phpdocumentor/reflection-docblock": "3.0.2"
             },
+            "require-dev": {
+                "ext-pdo": "*"
+            },
             "suggest": {
+                "ext-tidy": "*",
+                "ext-xdebug": "*",
                 "phpunit/php-invoker": "~1.1"
             },
             "bin": [
             "type": "library",
             "extra": {
                 "branch-alias": {
-                    "dev-master": "5.4.x-dev"
+                    "dev-master": "5.5.x-dev"
                 }
             },
             "autoload": {
                 "testing",
                 "xunit"
             ],
-            "time": "2016-07-26 14:48:00"
+            "time": "2016-10-03 13:04:15"
         },
         {
             "name": "phpunit/phpunit-mock-objects",
-            "version": "3.2.7",
+            "version": "3.3.1",
             "source": {
                 "type": "git",
                 "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git",
-                "reference": "546898a2c0c356ef2891b39dd7d07f5d82c8ed0a"
+                "reference": "03500345483e1e17b52e2e4d34a89c9408ab2902"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/546898a2c0c356ef2891b39dd7d07f5d82c8ed0a",
-                "reference": "546898a2c0c356ef2891b39dd7d07f5d82c8ed0a",
+                "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/03500345483e1e17b52e2e4d34a89c9408ab2902",
+                "reference": "03500345483e1e17b52e2e4d34a89c9408ab2902",
                 "shasum": ""
             },
             "require": {
                 "mock",
                 "xunit"
             ],
-            "time": "2016-09-06 16:07:45"
+            "time": "2016-10-04 11:03:26"
         },
         {
             "name": "psr/http-message",
             ],
             "time": "2016-08-06 14:39:51"
         },
+        {
+            "name": "psr/log",
+            "version": "1.0.1",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/php-fig/log.git",
+                "reference": "5277094ed527a1c4477177d102fe4c53551953e0"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/php-fig/log/zipball/5277094ed527a1c4477177d102fe4c53551953e0",
+                "reference": "5277094ed527a1c4477177d102fe4c53551953e0",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "1.0.x-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Psr\\Log\\": "Psr/Log/"
+                }
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "PHP-FIG",
+                    "homepage": "http://www.php-fig.org/"
+                }
+            ],
+            "description": "Common interface for logging libraries",
+            "homepage": "https://github.com/php-fig/log",
+            "keywords": [
+                "log",
+                "psr",
+                "psr-3"
+            ],
+            "time": "2016-09-19 16:02:08"
+        },
         {
             "name": "sebastian/code-unit-reverse-lookup",
             "version": "1.0.0",
         },
         {
             "name": "symfony/browser-kit",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/browser-kit.git",
-                "reference": "d2a07cc11c5fa94820240b1e67592ffb18e347b9"
+                "reference": "901319a31c9b3cee7857b4aeeb81b5d64dfa34fc"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/browser-kit/zipball/d2a07cc11c5fa94820240b1e67592ffb18e347b9",
-                "reference": "d2a07cc11c5fa94820240b1e67592ffb18e347b9",
+                "url": "https://api.github.com/repos/symfony/browser-kit/zipball/901319a31c9b3cee7857b4aeeb81b5d64dfa34fc",
+                "reference": "901319a31c9b3cee7857b4aeeb81b5d64dfa34fc",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony BrowserKit Component",
             "homepage": "https://symfony.com",
-            "time": "2016-07-26 08:04:17"
+            "time": "2016-09-06 11:02:40"
         },
         {
             "name": "symfony/class-loader",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/class-loader.git",
-                "reference": "2d0ba77c46ecc96a6641009a98f72632216811ba"
+                "reference": "bcb072aba46ddf3b1a496438c63be6be647739aa"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/class-loader/zipball/2d0ba77c46ecc96a6641009a98f72632216811ba",
-                "reference": "2d0ba77c46ecc96a6641009a98f72632216811ba",
+                "url": "https://api.github.com/repos/symfony/class-loader/zipball/bcb072aba46ddf3b1a496438c63be6be647739aa",
+                "reference": "bcb072aba46ddf3b1a496438c63be6be647739aa",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony ClassLoader Component",
             "homepage": "https://symfony.com",
-            "time": "2016-08-23 13:39:15"
+            "time": "2016-09-06 23:30:54"
         },
         {
             "name": "symfony/config",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/config.git",
-                "reference": "431d28df9c7bb6e77f8f6289d8670b044fabb9e8"
+                "reference": "949e7e846743a7f9e46dc50eb639d5fde1f53341"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/config/zipball/431d28df9c7bb6e77f8f6289d8670b044fabb9e8",
-                "reference": "431d28df9c7bb6e77f8f6289d8670b044fabb9e8",
+                "url": "https://api.github.com/repos/symfony/config/zipball/949e7e846743a7f9e46dc50eb639d5fde1f53341",
+                "reference": "949e7e846743a7f9e46dc50eb639d5fde1f53341",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony Config Component",
             "homepage": "https://symfony.com",
-            "time": "2016-08-27 18:50:07"
+            "time": "2016-09-25 08:27:07"
         },
         {
             "name": "symfony/console",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/console.git",
-                "reference": "8ea494c34f0f772c3954b5fbe00bffc5a435e563"
+                "reference": "6cb0872fb57b38b3b09ff213c21ed693956b9eb0"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/console/zipball/8ea494c34f0f772c3954b5fbe00bffc5a435e563",
-                "reference": "8ea494c34f0f772c3954b5fbe00bffc5a435e563",
+                "url": "https://api.github.com/repos/symfony/console/zipball/6cb0872fb57b38b3b09ff213c21ed693956b9eb0",
+                "reference": "6cb0872fb57b38b3b09ff213c21ed693956b9eb0",
                 "shasum": ""
             },
             "require": {
                 "php": ">=5.5.9",
+                "symfony/debug": "~2.8|~3.0",
                 "symfony/polyfill-mbstring": "~1.0"
             },
             "require-dev": {
             ],
             "description": "Symfony Console Component",
             "homepage": "https://symfony.com",
-            "time": "2016-08-19 06:48:39"
+            "time": "2016-09-28 00:11:12"
         },
         {
             "name": "symfony/css-selector",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/css-selector.git",
-                "reference": "2851e1932d77ce727776154d659b232d061e816a"
+                "reference": "ca809c64072e0fe61c1c7fb3c76cdc32265042ac"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/css-selector/zipball/2851e1932d77ce727776154d659b232d061e816a",
-                "reference": "2851e1932d77ce727776154d659b232d061e816a",
+                "url": "https://api.github.com/repos/symfony/css-selector/zipball/ca809c64072e0fe61c1c7fb3c76cdc32265042ac",
+                "reference": "ca809c64072e0fe61c1c7fb3c76cdc32265042ac",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony CssSelector Component",
             "homepage": "https://symfony.com",
-            "time": "2016-06-29 05:41:56"
+            "time": "2016-09-06 11:02:40"
+        },
+        {
+            "name": "symfony/debug",
+            "version": "v3.1.5",
+            "source": {
+                "type": "git",
+                "url": "https://github.com/symfony/debug.git",
+                "reference": "e2b3f74a67fc928adc3c1b9027f73e1bc01190a8"
+            },
+            "dist": {
+                "type": "zip",
+                "url": "https://api.github.com/repos/symfony/debug/zipball/e2b3f74a67fc928adc3c1b9027f73e1bc01190a8",
+                "reference": "e2b3f74a67fc928adc3c1b9027f73e1bc01190a8",
+                "shasum": ""
+            },
+            "require": {
+                "php": ">=5.5.9",
+                "psr/log": "~1.0"
+            },
+            "conflict": {
+                "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2"
+            },
+            "require-dev": {
+                "symfony/class-loader": "~2.8|~3.0",
+                "symfony/http-kernel": "~2.8|~3.0"
+            },
+            "type": "library",
+            "extra": {
+                "branch-alias": {
+                    "dev-master": "3.1-dev"
+                }
+            },
+            "autoload": {
+                "psr-4": {
+                    "Symfony\\Component\\Debug\\": ""
+                },
+                "exclude-from-classmap": [
+                    "/Tests/"
+                ]
+            },
+            "notification-url": "https://packagist.org/downloads/",
+            "license": [
+                "MIT"
+            ],
+            "authors": [
+                {
+                    "name": "Fabien Potencier",
+                    "email": "fabien@symfony.com"
+                },
+                {
+                    "name": "Symfony Community",
+                    "homepage": "https://symfony.com/contributors"
+                }
+            ],
+            "description": "Symfony Debug Component",
+            "homepage": "https://symfony.com",
+            "time": "2016-09-06 11:02:40"
         },
         {
             "name": "symfony/dependency-injection",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/dependency-injection.git",
-                "reference": "6e4f3316afdc9783d7b48a136db89bd791b55698"
+                "reference": "8fa4be9a36f41e49b0c3969678c41c81ed463816"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/6e4f3316afdc9783d7b48a136db89bd791b55698",
-                "reference": "6e4f3316afdc9783d7b48a136db89bd791b55698",
+                "url": "https://api.github.com/repos/symfony/dependency-injection/zipball/8fa4be9a36f41e49b0c3969678c41c81ed463816",
+                "reference": "8fa4be9a36f41e49b0c3969678c41c81ed463816",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony DependencyInjection Component",
             "homepage": "https://symfony.com",
-            "time": "2016-08-23 13:39:15"
+            "time": "2016-09-24 15:56:48"
         },
         {
             "name": "symfony/dom-crawler",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/dom-crawler.git",
         },
         {
             "name": "symfony/event-dispatcher",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/event-dispatcher.git",
         },
         {
             "name": "symfony/filesystem",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/filesystem.git",
-                "reference": "bb29adceb552d202b6416ede373529338136e84f"
+                "reference": "682fd8fdb3135fdf05fc496a01579ccf6c85c0e5"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/filesystem/zipball/bb29adceb552d202b6416ede373529338136e84f",
-                "reference": "bb29adceb552d202b6416ede373529338136e84f",
+                "url": "https://api.github.com/repos/symfony/filesystem/zipball/682fd8fdb3135fdf05fc496a01579ccf6c85c0e5",
+                "reference": "682fd8fdb3135fdf05fc496a01579ccf6c85c0e5",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony Filesystem Component",
             "homepage": "https://symfony.com",
-            "time": "2016-07-20 05:44:26"
+            "time": "2016-09-14 00:18:46"
         },
         {
             "name": "symfony/polyfill-mbstring",
         },
         {
             "name": "symfony/process",
-            "version": "v2.8.11",
+            "version": "v2.8.12",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/process.git",
-                "reference": "05a03ed27073638658cab9405d99a67dd1014987"
+                "reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/process/zipball/05a03ed27073638658cab9405d99a67dd1014987",
-                "reference": "05a03ed27073638658cab9405d99a67dd1014987",
+                "url": "https://api.github.com/repos/symfony/process/zipball/024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f",
+                "reference": "024de37f8a6b9e5e8244d9eb3fcf3e467dd2a93f",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony Process Component",
             "homepage": "https://symfony.com",
-            "time": "2016-09-06 10:55:00"
+            "time": "2016-09-29 14:03:54"
         },
         {
             "name": "symfony/translation",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/translation.git",
-                "reference": "a35edc277513c9bc0f063ca174c36b346f974528"
+                "reference": "93013a18d272e59dab8e67f583155b78c68947eb"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/translation/zipball/a35edc277513c9bc0f063ca174c36b346f974528",
-                "reference": "a35edc277513c9bc0f063ca174c36b346f974528",
+                "url": "https://api.github.com/repos/symfony/translation/zipball/93013a18d272e59dab8e67f583155b78c68947eb",
+                "reference": "93013a18d272e59dab8e67f583155b78c68947eb",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony Translation Component",
             "homepage": "https://symfony.com",
-            "time": "2016-08-05 08:37:39"
+            "time": "2016-09-06 11:02:40"
         },
         {
             "name": "symfony/yaml",
-            "version": "v3.1.4",
+            "version": "v3.1.5",
             "source": {
                 "type": "git",
                 "url": "https://github.com/symfony/yaml.git",
-                "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d"
+                "reference": "368b9738d4033c8b93454cb0dbd45d305135a6d3"
             },
             "dist": {
                 "type": "zip",
-                "url": "https://api.github.com/repos/symfony/yaml/zipball/f291ed25eb1435bddbe8a96caaef16469c2a092d",
-                "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d",
+                "url": "https://api.github.com/repos/symfony/yaml/zipball/368b9738d4033c8b93454cb0dbd45d305135a6d3",
+                "reference": "368b9738d4033c8b93454cb0dbd45d305135a6d3",
                 "shasum": ""
             },
             "require": {
             ],
             "description": "Symfony Yaml Component",
             "homepage": "https://symfony.com",
-            "time": "2016-09-02 02:12:52"
+            "time": "2016-09-25 08:27:07"
         },
         {
             "name": "webmozart/assert",
index 302c5d9..f667427 100644 (file)
@@ -477,7 +477,7 @@ abstract class format_base {
      */
     public function get_default_blocks() {
         global $CFG;
-        if (!empty($CFG->defaultblocks)){
+        if (isset($CFG->defaultblocks)) {
             return blocks_parse_default_blocks_list($CFG->defaultblocks);
         }
         $blocknames = array(
index 78c85b3..26f2863 100644 (file)
@@ -13,7 +13,7 @@ Feature: Course category management interface performs as expected
     And I go to the courses management page
     And I should see "Course and category management" in the "h2" "css_element"
     And I should see "Course categories" in the ".view-mode-selector" "css_element"
-    And I should see "Course categories" in the "h3" "css_element"
+    And I should see "Course categories" in the "#page-content" "css_element"
     And I should see the "Course categories and courses" management page
 
   @javascript
index 2d41a98..4134c39 100644 (file)
@@ -88,7 +88,7 @@ switch ($action) {
         break;
     case 'getassignable':
         $otheruserroles = optional_param('otherusers', false, PARAM_BOOL);
-        $outcome->response = array_reverse($manager->get_assignable_roles($otheruserroles), true);
+        $outcome->response = $manager->get_assignable_roles_for_json($otheruserroles);
         break;
     case 'searchotherusers':
         $search = optional_param('search', '', PARAM_RAW);
index 2d918da..4699b3a 100644 (file)
@@ -621,6 +621,22 @@ class course_enrolment_manager {
         }
     }
 
+    /**
+     * Gets all of the assignable roles for this course, wrapped in an array to ensure
+     * role sort order is not lost during json deserialisation.
+     *
+     * @param boolean $otherusers whether to include the assignable roles for other users
+     * @return array
+     */
+    public function get_assignable_roles_for_json($otherusers = false) {
+        $rolesarray = array();
+        $assignable = $this->get_assignable_roles($otherusers);
+        foreach ($assignable as $id => $role) {
+            $rolesarray[] = array('id' => $id, 'name' => $role);
+        }
+        return $rolesarray;
+    }
+
     /**
      * Gets all of the groups for this course.
      *
index 5aeca32..012cafb 100644 (file)
@@ -198,8 +198,8 @@ YUI.add('moodle-enrol_manual-quickenrolment', function(Y) {
                 var index = 0, count = 0;
                 for (var i in roles) {
                     count++;
-                    var option = create('<option value="'+i+'">'+roles[i]+'</option>');
-                    if (i == v) {
+                    var option = create('<option value="' + roles[i].id + '">' + roles[i].name + '</option>');
+                    if (roles[i].id == v) {
                         index = count;
                     }
                     s.append(option);
index 89390ee..23d8ba9 100644 (file)
@@ -314,10 +314,10 @@ YUI.add('moodle-enrol-otherusersmanager', function(Y) {
                     )
                     .append(Y.Node.create('<div class="'+CSS.OPTIONS+'"><span class="label">'+M.util.get_string('assignrole', 'role')+': </span></div>'))
                 );
-            var id = 0, roles = this._manager.get(ASSIGNABLEROLES);
-            for (id in roles) {
-                var role = Y.Node.create('<a href="#" class="'+CSS.ROLEOPTION+'">'+roles[id]+'</a>');
-                role.on('click', this.assignRoleToUser, this, id, role);
+            var roles = this._manager.get(ASSIGNABLEROLES);
+            for (var i in roles) {
+                var role = Y.Node.create('<a href="#" class="' + CSS.ROLEOPTION + '">' + roles[i].name + '</a>');
+                role.on('click', this.assignRoleToUser, this, roles[i].id, role);
                 this._node.one('.'+CSS.OPTIONS).append(role);
             }
             return this._node;
index 8fd9f65..a75d61a 100644 (file)
@@ -94,7 +94,7 @@ YUI.add('moodle-enrol-rolemanager', function(Y) {
                             if (o.error) {
                                 new M.core.ajaxException(o);
                             } else {
-                                this.users[userid].addRoleToDisplay(args.roleid, this.get(ASSIGNABLEROLES)[args.roleid]);
+                                this.users[userid].addRoleToDisplay(args.roleid, this._getAssignableRole(args.roleid));
                             }
                         } catch (e) {
                             new M.core.exception(e);
@@ -152,6 +152,15 @@ YUI.add('moodle-enrol-rolemanager', function(Y) {
                 }
             });
         },
+        _getAssignableRole: function(roleid) {
+            var roles = this.get(ASSIGNABLEROLES);
+            for (var i in roles) {
+                if (roles[i].id == roleid) {
+                    return roles[i].name;
+                }
+            }
+            return null;
+        },
         _loadAssignableRoles : function() {
             var c = this.get(COURSEID), params = {
                 id : this.get(COURSEID),
@@ -277,7 +286,7 @@ YUI.add('moodle-enrol-rolemanager', function(Y) {
             var current = this.get(CURRENTROLES);
             var allroles = true, i = 0;
             for (i in roles) {
-                if (!current[i]) {
+                if (!current[roles[i].id]) {
                     allroles = false;
                     break;
                 }
@@ -353,8 +362,10 @@ YUI.add('moodle-enrol-rolemanager', function(Y) {
             var content = element.one('.content');
             var roles = m.get(ASSIGNABLEROLES);
             for (i in roles) {
-                var button = Y.Node.create('<input type="button" value="'+roles[i]+'" id="add_assignable_role_'+i+'" />');
-                button.on('click', this.submit, this, i);
+                var buttonid = 'add_assignable_role_' + roles[i].id;
+                var buttonhtml = '<input type="button" value="' + roles[i].name + '" id="' + buttonid + '" />';
+                var button = Y.Node.create(buttonhtml);
+                button.on('click', this.submit, this, roles[i].id);
                 content.append(button);
             }
             Y.one(document.body).append(element);
index 48164e2..f9132d0 100644 (file)
@@ -70,6 +70,7 @@ if ($id) {
         $outcome_rec->courseid = $courseid;
         require_login();
         require_capability('moodle/grade:manage', $systemcontext);
+        $PAGE->set_context($systemcontext);
     }
 
 } else if ($courseid){
@@ -87,6 +88,7 @@ if ($id) {
 } else {
     require_login();
     require_capability('moodle/grade:manage', $systemcontext);
+    $PAGE->set_context($systemcontext);
 
     /// adding new outcome from admin section
     $outcome_rec = new stdClass();
diff --git a/grade/report/overview/classes/external.php b/grade/report/overview/classes/external.php
new file mode 100644 (file)
index 0000000..abdb080
--- /dev/null
@@ -0,0 +1,224 @@
+<?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/>.
+
+/**
+ * External grade report overview API
+ *
+ * @package    gradereport_overview
+ * @copyright  2016 Juan Leyva <juan@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die;
+
+require_once($CFG->libdir . '/externallib.php');
+require_once($CFG->libdir . '/gradelib.php');
+require_once($CFG->dirroot . '/grade/lib.php');
+require_once($CFG->dirroot . '/grade/report/overview/lib.php');
+
+/**
+ * External grade overview report API implementation
+ *
+ * @package    gradereport_overview
+ * @copyright  2016 Juan Leyva <juan@moodle.com>
+ * @category   external
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class gradereport_overview_external extends external_api {
+
+    /**
+     * Describes the parameters for get_course_grades.
+     *
+     * @return external_external_function_parameters
+     * @since Moodle 3.2
+     */
+    public static function get_course_grades_parameters() {
+        return new external_function_parameters (
+            array(
+                'userid' => new external_value(PARAM_INT, 'Get grades for this user (optional, default current)', VALUE_DEFAULT, 0)
+            )
+        );
+    }
+
+    /**
+     * Get the given user courses final grades
+     *
+     * @param int $userid get grades for this user (optional, default current)
+     *
+     * @return array the grades tables
+     * @since Moodle 3.2
+     */
+    public static function get_course_grades($userid = 0) {
+        global $USER;
+
+        $warnings = array();
+
+        // Validate the parameter.
+        $params = self::validate_parameters(self::get_course_grades_parameters(),
+            array(
+                'userid' => $userid
+            )
+        );
+
+        $userid = $params['userid'];
+        if (empty($userid)) {
+            $userid = $USER->id;
+        }
+
+        $systemcontext = context_system::instance();
+        self::validate_context($systemcontext);
+
+        if ($USER->id != $userid) {
+            // We must check if the current user can view other users grades.
+            $user = core_user::get_user($userid, '*', MUST_EXIST);
+            core_user::require_active_user($user);
+            require_capability('moodle/grade:viewall', $systemcontext);
+        }
+
+        // We need the site course, and course context.
+        $course = get_course(SITEID);
+        $context = context_course::instance($course->id);
+
+        // Force a regrade if required.
+        grade_regrade_final_grades_if_required($course);
+        // Get the course final grades now.
+        $gpr = new grade_plugin_return(array('type' => 'report', 'plugin' => 'overview', 'courseid' => $course->id,
+                                        'userid' => $userid));
+        $report = new grade_report_overview($userid, $gpr, $context);
+        $coursesgrades = $report->setup_courses_data(true);
+
+        $grades = array();
+        foreach ($coursesgrades as $coursegrade) {
+            $gradeinfo = array(
+                'courseid' => $coursegrade['course']->id,
+                'grade' => grade_format_gradevalue($coursegrade['finalgrade'], $coursegrade['courseitem'], true),
+                'rawgrade' => $coursegrade['finalgrade'],
+            );
+            if (isset($coursegrade['rank'])) {
+                $gradeinfo['rank'] = $coursegrade['rank'];
+            }
+            $grades[] = $gradeinfo;
+        }
+
+        $result = array();
+        $result['grades'] = $grades;
+        $result['warnings'] = $warnings;
+        return $result;
+    }
+
+    /**
+     * Describes the get_course_grades return value.
+     *
+     * @return external_single_structure
+     * @since Moodle 3.2
+     */
+    public static function get_course_grades_returns() {
+        return new external_single_structure(
+            array(
+                'grades' => new external_multiple_structure(
+                    new external_single_structure(
+                        array(
+                            'courseid' => new external_value(PARAM_INT, 'Course id'),
+                            'grade' => new external_value(PARAM_RAW, 'Grade formatted'),
+                            'rawgrade' => new external_value(PARAM_RAW, 'Raw grade, not formatted'),
+                            'rank' => new external_value(PARAM_INT, 'Your rank in the course', VALUE_OPTIONAL),
+                        )
+                    )
+                ),
+                'warnings' => new external_warnings()
+            )
+        );
+    }
+
+    /**
+     * Returns description of method parameters
+     *
+     * @return external_function_parameters
+     * @since Moodle 3.2
+     */
+    public static function view_grade_report_parameters() {
+        return new external_function_parameters(
+            array(
+                'courseid' => new external_value(PARAM_INT, 'id of the course'),
+                'userid' => new external_value(PARAM_INT, 'id of the user, 0 means current user', VALUE_DEFAULT, 0)
+            )
+        );
+    }
+
+    /**
+     * Trigger the user report events, do the same that the web interface view of the report
+     *
+     * @param int $courseid id of course
+     * @param int $userid id of the user the report belongs to
+     * @return array of warnings and status result
+     * @since Moodle 3.2
+     * @throws moodle_exception
+     */
+    public static function view_grade_report($courseid, $userid = 0) {
+        global $USER;
+
+        $params = self::validate_parameters(self::view_grade_report_parameters(),
+            array(
+                'courseid' => $courseid,
+                'userid' => $userid
+            )
+        );
+
+        $warnings = array();
+        $course = get_course($params['courseid']);
+
+        $context = context_course::instance($course->id);
+        self::validate_context($context);
+
+        $userid = $params['userid'];
+        if (empty($userid)) {
+            $userid = $USER->id;
+        } else {
+            $user = core_user::get_user($userid, '*', MUST_EXIST);
+            core_user::require_active_user($user);
+        }
+        $systemcontext = context_system::instance();
+        $personalcontext = context_user::instance($userid);
+
+        $access = grade_report_overview::check_access($systemcontext, $context, $personalcontext, $course, $userid);
+
+        if (!$access) {
+            throw new moodle_exception('nopermissiontoviewgrades', 'error');
+        }
+
+        grade_report_overview::viewed($context, $course->id, $userid);
+
+        $result = array();
+        $result['status'] = true;
+        $result['warnings'] = $warnings;
+        return $result;
+    }
+
+    /**
+     * Returns description of method result value
+     *
+     * @return external_description
+     * @since Moodle 3.2
+     */
+    public static function view_grade_report_returns() {
+        return new external_single_structure(
+            array(
+                'status' => new external_value(PARAM_BOOL, 'status: true if success'),
+                'warnings' => new external_warnings()
+            )
+        );
+    }
+}
diff --git a/grade/report/overview/db/services.php b/grade/report/overview/db/services.php
new file mode 100644 (file)
index 0000000..56f4ea8
--- /dev/null
@@ -0,0 +1,44 @@
+<?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/>.
+
+/**
+ * Overview grade report external functions and service definitions.
+ *
+ * @package    gradereport_overview
+ * @copyright  2016 Juan Leyva <juan@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$functions = array(
+
+    'gradereport_overview_get_course_grades' => array(
+        'classname' => 'gradereport_overview_external',
+        'methodname' => 'get_course_grades',
+        'description' => 'Get the given user courses final grades',
+        'type' => 'read',
+        'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
+    ),
+    'gradereport_overview_view_grade_report' => array(
+        'classname' => 'gradereport_overview_external',
+        'methodname' => 'view_grade_report',
+        'description' => 'Trigger the report view event',
+        'type' => 'write',
+        'capabilities' => 'gradereport/overview:view',
+        'services' => array(MOODLE_OFFICIAL_MOBILE_SERVICE),
+    )
+);
index 14eef55..4125157 100644 (file)
@@ -71,27 +71,7 @@ if ($userid == $USER->id) {
     $PAGE->navigation->extend_for_user($user);
 }
 
-$access = false;
-if (has_capability('moodle/grade:viewall', $systemcontext)) {
-    // Ok - can view all course grades.
-    $access = true;
-
-} else if (has_capability('moodle/grade:viewall', $context)) {
-    // Ok - can view any grades in context.
-    $access = true;
-
-} else if ($userid == $USER->id and ((has_capability('moodle/grade:view', $context) and $course->showgrades)
-        || $courseid == SITEID)) {
-    // Ok - can view own course grades.
-    $access = true;
-
-} else if (has_capability('moodle/grade:viewall', $personalcontext) and $course->showgrades) {
-    // Ok - can view grades of this user - parent most probably.
-    $access = true;
-} else if (has_capability('moodle/user:viewuseractivitiesreport', $personalcontext) and $course->showgrades) {
-    // Ok - can view grades of this user - parent most probably.
-    $access = true;
-}
+$access = grade_report_overview::check_access($systemcontext, $context, $personalcontext, $course, $userid);
 
 if (!$access) {
     // no access to grades!
@@ -214,15 +194,6 @@ if (has_capability('moodle/grade:viewall', $context) && $courseid != SITEID) {
     }
 }
 
-$event = \gradereport_overview\event\grade_report_viewed::create(
-    array(
-        'context' => $context,
-        'courseid' => $courseid,
-        'relateduserid' => $userid,
-    )
-);
-$event->trigger();
+grade_report_overview::viewed($context, $courseid, $userid);
 
 echo $OUTPUT->footer();
-
-
index 923fc2f..d8bf895 100644 (file)
@@ -164,6 +164,97 @@ class grade_report_overview extends grade_report {
         $this->table->setup();
     }
 
+    /**
+     * Set up the courses grades data for the report.
+     *
+     * @param bool $studentcoursesonly Only show courses that the user is a student of.
+     * @return array of course grades information
+     */
+    public function setup_courses_data($studentcoursesonly) {
+        global $USER, $DB;
+
+        $coursesdata = array();
+        $numusers = $this->get_numusers(false);
+
+        foreach ($this->courses as $course) {
+            if (!$course->showgrades) {
+                continue;
+            }
+
+            // If we are only showing student courses and this course isn't part of the group, then move on.
+            if ($studentcoursesonly && !isset($this->studentcourseids[$course->id])) {
+                continue;
+            }
+
+            $coursecontext = context_course::instance($course->id);
+
+            if (!$course->visible && !has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
+                // The course is hidden and the user isn't allowed to see it.
+                continue;
+            }
+
+            if (!has_capability('moodle/user:viewuseractivitiesreport', context_user::instance($this->user->id)) &&
+                    ((!has_capability('moodle/grade:view', $coursecontext) || $this->user->id != $USER->id) &&
+                    !has_capability('moodle/grade:viewall', $coursecontext))) {
+                continue;
+            }
+
+            $coursesdata[$course->id]['course'] = $course;
+            $coursesdata[$course->id]['context'] = $coursecontext;
+
+            $canviewhidden = has_capability('moodle/grade:viewhidden', $coursecontext);
+
+            // Get course grade_item.
+            $courseitem = grade_item::fetch_course_item($course->id);
+
+            // Get the stored grade.
+            $coursegrade = new grade_grade(array('itemid' => $courseitem->id, 'userid' => $this->user->id));
+            $coursegrade->grade_item =& $courseitem;
+            $finalgrade = $coursegrade->finalgrade;
+
+            if (!$canviewhidden and !is_null($finalgrade)) {
+                if ($coursegrade->is_hidden()) {
+                    $finalgrade = null;
+                } else {
+                    $adjustedgrade = $this->blank_hidden_total_and_adjust_bounds($course->id,
+                                                                                 $courseitem,
+                                                                                 $finalgrade);
+
+                    // We temporarily adjust the view of this grade item - because the min and
+                    // max are affected by the hidden values in the aggregation.
+                    $finalgrade = $adjustedgrade['grade'];
+                    $courseitem->grademax = $adjustedgrade['grademax'];
+                    $courseitem->grademin = $adjustedgrade['grademin'];
+                }
+            } else {
+                // We must use the specific max/min because it can be different for
+                // each grade_grade when items are excluded from sum of grades.
+                if (!is_null($finalgrade)) {
+                    $courseitem->grademin = $coursegrade->get_grade_min();
+                    $courseitem->grademax = $coursegrade->get_grade_max();
+                }
+            }
+
+            $coursesdata[$course->id]['finalgrade'] = $finalgrade;
+            $coursesdata[$course->id]['courseitem'] = $courseitem;
+
+            if ($this->showrank['any'] && $this->showrank[$course->id] && !is_null($finalgrade)) {
+                // Find the number of users with a higher grade.
+                // Please note this can not work if hidden grades involved :-( to be fixed in 2.0.
+                $params = array($finalgrade, $courseitem->id);
+                $sql = "SELECT COUNT(DISTINCT(userid))
+                          FROM {grade_grades}
+                         WHERE finalgrade IS NOT NULL AND finalgrade > ?
+                               AND itemid = ?";
+                $rank = $DB->count_records_sql($sql, $params) + 1;
+
+                $coursesdata[$course->id]['rank'] = $rank;
+                $coursesdata[$course->id]['numusers'] = $numusers;
+            }
+        }
+        return $coursesdata;
+    }
+
     /**
      * Fill the table for displaying.
      *
@@ -179,30 +270,14 @@ class grade_report_overview extends grade_report {
 
         // Only show user's courses instead of all courses.
         if ($this->courses) {
-            $numusers = $this->get_numusers(false);
-
-            foreach ($this->courses as $course) {
-                if (!$course->showgrades) {
-                    continue;
-                }
-
-                // If we are only showing student courses and this course isn't part of the group, then move on.
-                if ($studentcoursesonly && !isset($this->studentcourseids[$course->id])) {
-                    continue;
-                }
-
-                $coursecontext = context_course::instance($course->id);
+            $coursesdata = $this->setup_courses_data($studentcoursesonly);
 
-                if (!$course->visible && !has_capability('moodle/course:viewhiddencourses', $coursecontext)) {
-                    // The course is hidden and the user isn't allowed to see it
-                    continue;
-                }
+            foreach ($coursesdata as $coursedata) {
 
-                if (!has_capability('moodle/user:viewuseractivitiesreport', context_user::instance($this->user->id)) &&
-                        ((!has_capability('moodle/grade:view', $coursecontext) || $this->user->id != $USER->id) &&
-                        !has_capability('moodle/grade:viewall', $coursecontext))) {
-                    continue;
-                }
+                $course = $coursedata['course'];
+                $coursecontext = $coursedata['context'];
+                $finalgrade = $coursedata['finalgrade'];
+                $courseitem = $coursedata['courseitem'];
 
                 $coursename = format_string(get_course_display_name_for_list($course), true, array('context' => $coursecontext));
                 // Link to the activity report version of the user grade report.
@@ -213,66 +288,25 @@ class grade_report_overview extends grade_report {
                     $courselink = html_writer::link(new moodle_url('/grade/report/user/index.php', array('id' => $course->id,
                         'userid' => $this->user->id)), $coursename);
                 }
-                $canviewhidden = has_capability('moodle/grade:viewhidden', $coursecontext);
-
-                // Get course grade_item
-                $course_item = grade_item::fetch_course_item($course->id);
 
-                // Get the stored grade
-                $course_grade = new grade_grade(array('itemid'=>$course_item->id, 'userid'=>$this->user->id));
-                $course_grade->grade_item =& $course_item;
-                $finalgrade = $course_grade->finalgrade;
+                $data = array($courselink, grade_format_gradevalue($finalgrade, $courseitem, true));
 
-                if (!$canviewhidden and !is_null($finalgrade)) {
-                    if ($course_grade->is_hidden()) {
-                        $finalgrade = null;
+                if ($this->showrank['any']) {
+                    if ($this->showrank[$course->id] && !is_null($finalgrade)) {
+                        $rank = $coursedata['rank'];
+                        $numusers = $coursedata['numusers'];
+                        $data[] = "$rank/$numusers";
                     } else {
-                        $adjustedgrade = $this->blank_hidden_total_and_adjust_bounds($course->id,
-                                                                                     $course_item,
-                                                                                     $finalgrade);
-
-                        // We temporarily adjust the view of this grade item - because the min and
-                        // max are affected by the hidden values in the aggregation.
-                        $finalgrade = $adjustedgrade['grade'];
-                        $course_item->grademax = $adjustedgrade['grademax'];
-                        $course_item->grademin = $adjustedgrade['grademin'];
+                        // No grade, no rank.
+                        // Or this course wants rank hidden.
+                        $data[] = '-';
                     }
-                } else {
-                    // We must use the specific max/min because it can be different for
-                    // each grade_grade when items are excluded from sum of grades.
-                    if (!is_null($finalgrade)) {
-                        $course_item->grademin = $course_grade->get_grade_min();
-                        $course_item->grademax = $course_grade->get_grade_max();
-                    }
-                }
-
-                $data = array($courselink, grade_format_gradevalue($finalgrade, $course_item, true));
-
-                if (!$this->showrank['any']) {
-                    //nothing to do
-
-                } else if ($this->showrank[$course->id] && !is_null($finalgrade)) {
-                    /// find the number of users with a higher grade
-                    /// please note this can not work if hidden grades involved :-( to be fixed in 2.0
-                    $params = array($finalgrade, $course_item->id);
-                    $sql = "SELECT COUNT(DISTINCT(userid))
-                              FROM {grade_grades}
-                             WHERE finalgrade IS NOT NULL AND finalgrade > ?
-                                   AND itemid = ?";
-                    $rank = $DB->count_records_sql($sql, $params) + 1;
-
-                    $data[] = "$rank/$numusers";
-
-                } else {
-                    // No grade, no rank.
-                    // Or this course wants rank hidden.
-                    $data[] = '-';
                 }
 
                 $this->table->add_data($data);
             }
-            return true;
 
+            return true;
         } else {
             echo $OUTPUT->notification(get_string('notenrolled', 'grades'), 'notifymessage');
             return false;
@@ -325,6 +359,63 @@ class grade_report_overview extends grade_report {
     public static function supports_mygrades() {
         return true;
     }
+
+    /**
+     * Check if the user can access the report.
+     *
+     * @param  stdClass $systemcontext   system context
+     * @param  stdClass $context         course context
+     * @param  stdClass $personalcontext personal context
+     * @param  stdClass $course          course object
+     * @param  int $userid               userid
+     * @return bool true if the user can access the report
+     * @since  Moodle 3.2
+     */
+    public static function check_access($systemcontext, $context, $personalcontext, $course, $userid) {
+        global $USER;
+
+        $access = false;
+        if (has_capability('moodle/grade:viewall', $systemcontext)) {
+            // Ok - can view all course grades.
+            $access = true;
+
+        } else if (has_capability('moodle/grade:viewall', $context)) {
+            // Ok - can view any grades in context.
+            $access = true;
+
+        } else if ($userid == $USER->id and ((has_capability('moodle/grade:view', $context) and $course->showgrades)
+                || $course->id == SITEID)) {
+            // Ok - can view own course grades.
+            $access = true;
+
+        } else if (has_capability('moodle/grade:viewall', $personalcontext) and $course->showgrades) {
+            // Ok - can view grades of this user - parent most probably.
+            $access = true;
+        } else if (has_capability('moodle/user:viewuseractivitiesreport', $personalcontext) and $course->showgrades) {
+            // Ok - can view grades of this user - parent most probably.
+            $access = true;
+        }
+        return $access;
+    }
+
+    /**
+     * Trigger the grade_report_viewed event
+     *
+     * @param  stdClass $context  course context
+     * @param  int $courseid      course id
+     * @param  int $userid        user id
+     * @since Moodle 3.2
+     */
+    public static function viewed($context, $courseid, $userid) {
+        $event = \gradereport_overview\event\grade_report_viewed::create(
+            array(
+                'context' => $context,
+                'courseid' => $courseid,
+                'relateduserid' => $userid,
+            )
+        );
+        $event->trigger();
+    }
 }
 
 function grade_report_overview_settings_definition(&$mform) {
diff --git a/grade/report/overview/tests/externallib_test.php b/grade/report/overview/tests/externallib_test.php
new file mode 100644 (file)
index 0000000..1301c0d
--- /dev/null
@@ -0,0 +1,231 @@
+<?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/>.
+
+/**
+ * Overview grade report functions unit tests
+ *
+ * @package    gradereport_overview
+ * @category   external
+ * @copyright  2015 Juan Leyva <juan@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+global $CFG;
+
+require_once($CFG->dirroot . '/webservice/tests/helpers.php');
+
+/**
+ * Overview grade report functions unit tests
+ *
+ * @package    gradereport_overview
+ * @category   external
+ * @copyright  2015 Juan Leyva <juan@moodle.com>
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class gradereport_overview_externallib_testcase extends externallib_advanced_testcase {
+
+    /**
+     * Set up for every test
+     */
+    public function setUp() {
+        global $DB;
+        $this->resetAfterTest(true);
+
+        $s1grade1 = 80;
+        $s1grade2 = 40;
+        $s2grade = 60;
+
+        $this->course1 = $this->getDataGenerator()->create_course();
+        $this->course2 = $this->getDataGenerator()->create_course();
+
+        $studentrole = $DB->get_record('role', array('shortname' => 'student'));
+        $teacherrole = $DB->get_record('role', array('shortname' => 'editingteacher'));
+        $this->student1 = $this->getDataGenerator()->create_user();
+        $this->teacher = $this->getDataGenerator()->create_user();
+        $this->getDataGenerator()->enrol_user($this->teacher->id, $this->course1->id, $teacherrole->id);
+        $this->getDataGenerator()->enrol_user($this->student1->id, $this->course1->id, $studentrole->id);
+        $this->getDataGenerator()->enrol_user($this->student1->id, $this->course2->id, $studentrole->id);
+
+        $this->student2 = $this->getDataGenerator()->create_user();
+        $this->getDataGenerator()->enrol_user($this->student2->id, $this->course1->id, $studentrole->id);
+        $this->getDataGenerator()->enrol_user($this->student2->id, $this->course2->id, $studentrole->id);
+
+        $assignment1 = $this->getDataGenerator()->create_module('assign', array('name' => "Test assign", 'course' => $this->course1->id));
+        $assignment2 = $this->getDataGenerator()->create_module('assign', array('name' => "Test assign", 'course' => $this->course2->id));
+        $modcontext1 = get_coursemodule_from_instance('assign', $assignment1->id, $this->course1->id);
+        $modcontext2 = get_coursemodule_from_instance('assign', $assignment2->id, $this->course2->id);
+        $assignment1->cmidnumber = $modcontext1->id;
+        $assignment2->cmidnumber = $modcontext2->id;
+
+        $this->student1grade1 = array('userid' => $this->student1->id, 'rawgrade' => $s1grade1);
+        $this->student1grade2 = array('userid' => $this->student1->id, 'rawgrade' => $s1grade2);
+        $this->student2grade = array('userid' => $this->student2->id, 'rawgrade' => $s2grade);
+        $studentgrades = array($this->student1->id => $this->student1grade1, $this->student2->id => $this->student2grade);
+        assign_grade_item_update($assignment1, $studentgrades);
+        $studentgrades = array($this->student1->id => $this->student1grade2);
+        assign_grade_item_update($assignment2, $studentgrades);
+
+        grade_get_setting($this->course1->id, 'report_overview_showrank', 1);
+    }
+
+    /**
+     * Test get_course_grades function case student
+     */
+    public function test_get_course_grades_student() {
+
+        // A user can see his own grades in both courses.
+        $this->setUser($this->student1);
+        $studentgrades = gradereport_overview_external::get_course_grades();
+        $studentgrades = external_api::clean_returnvalue(gradereport_overview_external::get_course_grades_returns(), $studentgrades);
+
+        $this->assertCount(0, $studentgrades['warnings']);
+        $this->assertCount(2, $studentgrades['grades']);
+        foreach ($studentgrades['grades'] as $grade) {
+            if ($grade['courseid'] == $this->course1->id) {
+                $this->assertEquals(80.00, $grade['grade']);
+                $this->assertEquals(80.0000, $grade['rawgrade']);
+                $this->assertEquals(1, $grade['rank']);
+            } else {
+                $this->assertEquals(40.00, $grade['grade']);
+                $this->assertEquals(40.0000, $grade['rawgrade']);
+                $this->assertArrayNotHasKey('rank', $grade);
+            }
+        }
+
+        // Second student, no grade in one course.
+        $this->setUser($this->student2);
+        $studentgrades = gradereport_overview_external::get_course_grades();
+        $studentgrades = external_api::clean_returnvalue(gradereport_overview_external::get_course_grades_returns(), $studentgrades);
+
+        $this->assertCount(0, $studentgrades['warnings']);
+        $this->assertCount(2, $studentgrades['grades']);
+        foreach ($studentgrades['grades'] as $grade) {
+            if ($grade['courseid'] == $this->course1->id) {
+                $this->assertEquals(60.00, $grade['grade']);
+                $this->assertEquals(60.0000, $grade['rawgrade']);
+                $this->assertEquals(2, $grade['rank']);
+            } else {
+                $this->assertEquals('-', $grade['grade']);
+                $this->assertEmpty($grade['rawgrade']);
+                $this->assertArrayNotHasKey('rank', $grade);
+            }
+        }
+    }
+
+    /**
+     * Test get_course_grades function case admin
+     */
+    public function test_get_course_grades_admin() {
+
+        // A admin must see all student grades.
+        $this->setAdminUser();
+
+        $studentgrades = gradereport_overview_external::get_course_grades($this->student1->id);
+        $studentgrades = external_api::clean_returnvalue(gradereport_overview_external::get_course_grades_returns(), $studentgrades);
+        $this->assertCount(0, $studentgrades['warnings']);
+        $this->assertCount(2, $studentgrades['grades']);
+        foreach ($studentgrades['grades'] as $grade) {
+            if ($grade['courseid'] == $this->course1->id) {
+                $this->assertEquals(80.00, $grade['grade']);
+                $this->assertEquals(80.0000, $grade['rawgrade']);
+            } else {
+                $this->assertEquals(40.00, $grade['grade']);
+                $this->assertEquals(40.0000, $grade['rawgrade']);
+            }
+        }
+
+        $studentgrades = gradereport_overview_external::get_course_grades($this->student2->id);
+        $studentgrades = external_api::clean_returnvalue(gradereport_overview_external::get_course_grades_returns(), $studentgrades);
+        $this->assertCount(0, $studentgrades['warnings']);
+        $this->assertCount(2, $studentgrades['grades']);
+
+        // Admins don't see grades.
+        $studentgrades = gradereport_overview_external::get_course_grades();
+        $studentgrades = external_api::clean_returnvalue(gradereport_overview_external::get_course_grades_returns(), $studentgrades);
+        $this->assertCount(0, $studentgrades['warnings']);
+        $this->assertCount(0, $studentgrades['grades']);
+    }
+
+    /**
+     * Test get_course_grades function case teacher
+     */
+    public function test_get_course_grades_teacher() {
+        // Teachers don't see grades.
+        $this->setUser($this->teacher);
+
+        $studentgrades = gradereport_overview_external::get_course_grades();
+        $studentgrades = external_api::clean_returnvalue(gradereport_overview_external::get_course_grades_returns(), $studentgrades);
+        $this->assertCount(0, $studentgrades['warnings']);
+        $this->assertCount(0, $studentgrades['grades']);
+    }
+
+    /**
+     * Test get_course_grades function case incorrect permissions
+     */
+    public function test_get_course_grades_permissions() {
+        // Student can't see other student grades.
+        $this->setUser($this->student2);
+
+        $this->expectException('required_capability_exception');
+        $studentgrade = gradereport_overview_external::get_course_grades($this->student1->id);
+    }
+
+    /**
+     * Test view_grade_report function
+     */
+    public function test_view_grade_report() {
+        global $USER;
+
+        // Redirect events to the sink, so we can recover them later.
+        $sink = $this->redirectEvents();
+
+        $this->setUser($this->student1);
+        $result = gradereport_overview_external::view_grade_report($this->course1->id);
+        $result = external_api::clean_returnvalue(gradereport_overview_external::view_grade_report_returns(), $result);
+        $events = $sink->get_events();
+        $this->assertCount(1, $events);
+        $event = reset($events);
+
+        // Check the event details are correct.
+        $this->assertInstanceOf('\gradereport_overview\event\grade_report_viewed', $event);
+        $this->assertEquals(context_course::instance($this->course1->id), $event->get_context());
+        $this->assertEquals($USER->id, $event->get_data()['relateduserid']);
+
+        $this->setUser($this->teacher);
+        $result = gradereport_overview_external::view_grade_report($this->course1->id, $this->student1->id);
+        $result = external_api::clean_returnvalue(gradereport_overview_external::view_grade_report_returns(), $result);
+        $events = $sink->get_events();
+        $event = reset($events);
+        $sink->close();
+
+        // Check the event details are correct.
+        $this->assertInstanceOf('\gradereport_overview\event\grade_report_viewed', $event);
+        $this->assertEquals(context_course::instance($this->course1->id), $event->get_context());
+        $this->assertEquals($this->student1->id, $event->get_data()['relateduserid']);
+    }
+
+    /**
+     * Test view_grade_report_permissions function
+     */
+    public function test_view_grade_report_permissions() {
+        $this->setUser($this->student2);
+
+        $this->expectException('moodle_exception');
+        $studentgrade = gradereport_overview_external::view_grade_report($this->course1->id, $this->student1->id);
+    }
+}
index 686718e..aeb122f 100644 (file)
@@ -24,6 +24,6 @@
 
 defined('MOODLE_INTERNAL') || die();
 
-$plugin->version   = 2016052300;        // The current plugin version (Date: YYYYMMDDXX)
+$plugin->version   = 2016052301;        // The current plugin version (Date: YYYYMMDDXX)
 $plugin->requires  = 2016051900;        // Requires this Moodle version
 $plugin->component = 'gradereport_overview'; // Full name of the plugin (used for diagnostics)
index 1e8460e..cad859f 100644 (file)
@@ -29,9 +29,16 @@ require_once $CFG->dirroot.'/grade/report/user/lib.php';
 
 $courseid = required_param('id', PARAM_INT);
 $userid   = optional_param('userid', $USER->id, PARAM_INT);
+$userview = optional_param('userview', 0, PARAM_INT);
 
 $PAGE->set_url(new moodle_url('/grade/report/user/index.php', array('id'=>$courseid)));
 
+if ($userview == 0) {
+    $userview = get_user_preferences('gradereport_user_view_user', GRADE_REPORT_USER_VIEW_USER);
+} else {
+    set_user_preference('gradereport_user_view_user', $userview);
+}
+
 /// basic access checks
 if (!$course = $DB->get_record('course', array('id' => $courseid))) {
     print_error('nocourseid');
@@ -103,6 +110,15 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
     $defaultgradeshowactiveenrol = !empty($CFG->grade_report_showonlyactiveenrol);
     $showonlyactiveenrol = get_user_preferences('grade_report_showonlyactiveenrol', $defaultgradeshowactiveenrol);
     $showonlyactiveenrol = $showonlyactiveenrol || !has_capability('moodle/course:viewsuspendedusers', $context);
+
+    $renderer = $PAGE->get_renderer('gradereport_user');
+
+    if ($userview == GRADE_REPORT_USER_VIEW_USER) {
+        $viewasuser = true;
+    } else {
+        $viewasuser = false;
+    }
+
     if (empty($userid)) {
         $gui = new graded_users_iterator($course, null, $currentgroup);
         $gui->require_active_enrolment($showonlyactiveenrol);
@@ -112,13 +128,14 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
         groups_print_course_menu($course, $gpr->get_return_url('index.php?id='.$courseid, array('userid'=>0)));
 
         if ($user_selector) {
-            $renderer = $PAGE->get_renderer('gradereport_user');
             echo $renderer->graded_users_selector('user', $course, $userid, $currentgroup, true);
         }
 
+        echo $renderer->view_user_selector($userid, $userview);
+
         while ($userdata = $gui->next_user()) {
             $user = $userdata->user;
-            $report = new grade_report_user($courseid, $gpr, $context, $user->id);
+            $report = new grade_report_user($courseid, $gpr, $context, $user->id, $viewasuser);
 
             $studentnamelink = html_writer::link(new moodle_url('/user/view.php', array('id' => $report->user->id, 'course' => $courseid)), fullname($report->user));
             echo $OUTPUT->heading(get_string('pluginname', 'gradereport_user') . ' - ' . $studentnamelink);
@@ -130,7 +147,7 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
         }
         $gui->close();
     } else { // Only show one user's report
-        $report = new grade_report_user($courseid, $gpr, $context, $userid);
+        $report = new grade_report_user($courseid, $gpr, $context, $userid, $viewasuser);
 
         $studentnamelink = html_writer::link(new moodle_url('/user/view.php', array('id' => $report->user->id, 'course' => $courseid)), fullname($report->user));
         print_grade_page_head($courseid, 'report', 'user', get_string('pluginname', 'gradereport_user') . ' - ' . $studentnamelink,
@@ -139,11 +156,12 @@ if (has_capability('moodle/grade:viewall', $context)) { //Teachers will see all
         groups_print_course_menu($course, $gpr->get_return_url('index.php?id='.$courseid, array('userid'=>0)));
 
         if ($user_selector) {
-            $renderer = $PAGE->get_renderer('gradereport_user');
             $showallusersoptions = true;
             echo $renderer->graded_users_selector('user', $course, $userid, $currentgroup, $showallusersoptions);
         }
 
+        echo $renderer->view_user_selector($userid, $userview);
+
         if ($currentgroup and !groups_is_member($currentgroup, $userid)) {
             echo $OUTPUT->notification(get_string('groupusernotmember', 'error'));
         } else {
index bf3f097..953b1e7 100644 (file)
@@ -25,4 +25,7 @@
 $string['eventgradereportviewed'] = 'Grade user report viewed';
 $string['pluginname'] = 'User report';
 $string['user:view'] = 'View your own grade report';
+$string['myself'] = 'Myself';
+$string['otheruser'] = 'User';
 $string['tablesummary'] = 'The table is arranged as a list of graded items including categories of graded items. When items are in a category they will be indicated as such.';
+$string['viewas'] = 'View report as';
index a6f15d1..c6978e4 100644 (file)
@@ -30,6 +30,9 @@ define("GRADE_REPORT_USER_HIDE_HIDDEN", 0);
 define("GRADE_REPORT_USER_HIDE_UNTIL", 1);
 define("GRADE_REPORT_USER_SHOW_HIDDEN", 2);
 
+define("GRADE_REPORT_USER_VIEW_SELF", 1);
+define("GRADE_REPORT_USER_VIEW_USER", 2);
+
 /**
  * Class providing an API for the user report building and displaying.
  * @uses grade_report
index c0270f3..7062bdd 100644 (file)
@@ -43,4 +43,29 @@ class gradereport_user_renderer extends plugin_renderer_base {
         return $output;
     }
 
+    /**
+     * Creates and renders the single select box for the user view.
+     *
+     * @param int $userid The selected userid
+     * @param int $userview The current view user setting constant
+     * @return string
+     */
+    public function view_user_selector($userid, $userview) {
+        global $PAGE, $USER;
+        $url = $PAGE->url;
+        if ($userid != $USER->id) {
+            $url->param('userid', $userid);
+        }
+
+        $options = array(GRADE_REPORT_USER_VIEW_USER => get_string('otheruser', 'gradereport_user'),
+                GRADE_REPORT_USER_VIEW_SELF => get_string('myself', 'gradereport_user'));
+        $select = new single_select($url, 'userview', $options, $userview, null);
+
+        $select->label = get_string('viewas', 'gradereport_user');
+
+        $output = html_writer::tag('div', $this->output->render($select), array('class' => 'view_users_selector'));
+
+        return $output;
+    }
+
 }
index fc336a0..7b94533 100644 (file)
@@ -3,7 +3,14 @@
     margin-bottom: 5px;
 }
 
-.path-grade-report-user #graded_users_selector .singleselect label {
+.path-grade-report-user .view_users_selector {
+    clear: both;
+    float: right;
+    margin-bottom: 5px;
+}
+
+.path-grade-report-user #graded_users_selector .singleselect label,
+.path-grade-report-user .view_users_selector .singleselect label {
     display: inline-block;
 }
 
diff --git a/grade/report/user/tests/behat/user_view.feature b/grade/report/user/tests/behat/user_view.feature
new file mode 100644 (file)
index 0000000..01794bf
--- /dev/null
@@ -0,0 +1,218 @@
+@core @core_grades @gradereport_user
+Feature: View the user report as the student will see it
+  In order to know what grades students will see
+  As a teacher
+  I need to be able to view the user report as that other user
+
+  Background:
+    Given the following "courses" exist:
+      | fullname | shortname | category | groupmode |
+      | Course 1 | C1 | 0 | 1 |
+    And the following "users" exist:
+      | username | firstname | lastname | email | idnumber |
+      | teacher1 | Teacher | 1 | teacher1@example.com | t1 |
+      | student1 | Student | 1 | student1@example.com | s1 |
+    And the following "course enrolments" exist:
+      | user | course | role |
+      | teacher1 | C1 | editingteacher |
+      | student1 | C1 | student |
+    And the following "grade categories" exist:
+      | fullname | course |
+      | Sub category 1 | C1 |
+      | Sub category 2 | C1 |
+    And the following "activities" exist:
+      | activity | course | idnumber | name | intro | gradecategory| grade |
+      | assign | C1 | a1 | Test assignment one | Submit something! | Sub category 1 | 100 |
+      | assign | C1 | a2 | Test assignment two | Submit something! | Sub category 1 | 100 |
+      | assign | C1 | a3 | Test assignment three | Submit something! | Sub category 2 | 100 |
+      | assign | C1 | a4 | Test assignment four | Submit something! | Sub category 2 | 100 |
+    And the following "activities" exist:
+      | activity | course | idnumber | name | intro | grade |
+      | assign | C1 | a5 | Test assignment five | Submit something! | 100 |
+      | assign | C1 | a6 | Test assignment six | Submit something! | 100 |
+    And I log in as "teacher1"
+    And I follow "Course 1"
+    And I navigate to "Gradebook setup" node in "Course administration"
+    And I hide the grade item "Test assignment six"
+    And I hide the grade item "Sub category 2"
+    And I navigate to "Grades" node in "Course administration"
+    And I turn editing mode on
+    And I change window size to "large"
+    And I give the grade "80.00" to the user "Student 1" for the grade item "Test assignment one"
+    And I give the grade "35.00" to the user "Student 1" for the grade item "Test assignment two"
+    And I give the grade "100.00" to the user "Student 1" for the grade item "Test assignment three"
+    And I give the grade "50.00" to the user "Student 1" for the grade item "Test assignment four"
+    And I give the grade "21.00" to the user "Student 1" for the grade item "Test assignment five"
+    And I give the grade "97.00" to the user "Student 1" for the grade item "Test assignment six"
+    And I press "Save changes"
+    And I change window size to "medium"
+
+  Scenario: View the report as the teacher themselves
+    When I navigate to "User report" node in "Grade administration"
+    And I select "Student 1" from the "Select all or one user" singleselect
+    And I select "Myself" from the "View report as" singleselect
+    Then the following should exist in the "user-grade" table:
+      | Grade item              | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
+      | Test assignment one     | 50.00 %           | 80.00  | 0–100 | 80.00 %    | 13.33 %                      |
+      | Test assignment two     | 50.00 %           | 35.00  | 0–100 | 35.00 %    | 5.83 %                       |
+      | Sub category 1 total    | 33.33 %           | 115.00 | 0–200 | 57.50 %    | -                            |
+      | Test assignment three   | 50.00 %           | 100.00 | 0–100 | 100.00 %   | 16.67 %                      |
+      | Test assignment four    | 50.00 %           | 50.00  | 0–100 | 50.00 %    | 8.33 %                       |
+      | Sub category 2 total    | 33.33 %           | 150.00 | 0–200 | 75.00 %    | -                            |
+      | Test assignment five    | 16.67 %           | 21.00  | 0–100 | 21.00 %    | 3.50 %                       |
+      | Test assignment six     | 16.67 %           | 97.00  | 0–100 | 97.00 %    | 16.17 %                      |
+      | Course total            | -                 | 383.00 | 0–600 | 63.83 %    | -                            |
+
+  Scenario: View the report as the student from both the teachers and students perspective
+    When I navigate to "User report" node in "Grade administration"
+    And I select "Student 1" from the "Select all or one user" singleselect
+    And I select "User" from the "View report as" singleselect
+    Then the following should exist in the "user-grade" table:
+      | Grade item              | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
+      | Test assignment one     | -                 | 80.00  | 0–100 | 80.00 %    | -                            |
+      | Test assignment two     | -                 | 35.00  | 0–100 | 35.00 %    | -                            |
+      | Sub category 1 total    | 33.33 %           | -      | 0–200 | -          | -                            |
+      | Test assignment five    | -                 | 21.00  | 0–100 | 21.00 %    | -                            |
+      | Course total            | -                 | -      | 0–600 | -          | -                            |
+    And the following should not exist in the "user-grade" table:
+      | Grade item              |
+      | Test assignment three   |
+      | Test assignment four    |
+      | Sub category 2 total    |
+      | Test assignment six     |
+    And I log out
+    And I log in as "student1"
+    And I follow "Course 1"
+    And I navigate to "Grades" node in "Course administration"
+    Then the following should exist in the "user-grade" table:
+      | Grade item              | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
+      | Test assignment one     | -                 | 80.00  | 0–100 | 80.00 %    | -                            |
+      | Test assignment two     | -                 | 35.00  | 0–100 | 35.00 %    | -                            |
+      | Sub category 1 total    | 33.33 %           | -      | 0–200 | -          | -                            |
+      | Test assignment five    | -                 | 21.00  | 0–100 | 21.00 %    | -                            |
+      | Course total            | -                 | -      | 0–600 | -          | -                            |
+    And the following should not exist in the "user-grade" table:
+      | Grade item              |
+      | Test assignment three   |
+      | Test assignment four    |
+      | Sub category 2 total    |
+      | Test assignment six     |
+
+  Scenario: View the report as the student from both the teachers and students perspective with totals excluding hidden
+    Given I navigate to "Course grade settings" node in "Grade administration > Setup"
+    And I set the field with xpath "//select[@name='report_user_showtotalsifcontainhidden']" to "Show totals excluding hidden items"
+    And I press "Save changes"
+    And I navigate to "User report" node in "Grade administration"
+    When I select "Student 1" from the "Select all or one user" singleselect
+    And I select "User" from the "View report as" singleselect
+    Then the following should exist in the "user-grade" table:
+      | Grade item              | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
+      | Test assignment one     | 50.00 %           | 80.00  | 0–100 | 80.00 %    | 26.67 %                      |
+      | Test assignment two     | 50.00 %           | 35.00  | 0–100 | 35.00 %    | 11.67 %                      |
+      | Sub category 1 total    | 66.67 %           | 115.00 | 0–200 | 57.50      | -                            |
+      | Test assignment five    | 33.33 %           | 21.00  | 0–100 | 21.00 %    | 7.00 %                       |
+      | Course total            | -                 | 136.00 | 0–300 | 45.33 %    | -                            |
+    And the following should not exist in the "user-grade" table:
+      | Grade item              |
+      | Test assignment three   |
+      | Test assignment four    |
+      | Sub category 2 total    |
+      | Test assignment six     |
+    And I log out
+    And I log in as "student1"
+    And I follow "Course 1"
+    And I navigate to "Grades" node in "Course administration"
+    Then the following should exist in the "user-grade" table:
+      | Grade item              | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
+      | Test assignment one     | 50.00 %           | 80.00  | 0–100 | 80.00 %    | 26.67 %                      |
+      | Test assignment two     | 50.00 %           | 35.00  | 0–100 | 35.00 %    | 11.67 %                      |
+      | Sub category 1 total    | 66.67 %           | 115.00 | 0–200 | 57.50      | -                            |
+      | Test assignment five    | 33.33 %           | 21.00  | 0–100 | 21.00 %    | 7.00 %                       |
+      | Course total            | -                 | 136.00 | 0–300 | 45.33 %    | -                            |
+    And the following should not exist in the "user-grade" table:
+      | Grade item              |
+      | Test assignment three   |
+      | Test assignment four    |
+      | Sub category 2 total    |
+      | Test assignment six     |
+
+  Scenario: View the report as the student from both the teachers and students perspective with totals including hidden
+    Given I navigate to "Course grade settings" node in "Grade administration > Setup"
+    And I set the field with xpath "//select[@name='report_user_showtotalsifcontainhidden']" to "Show totals including hidden items"
+    And I press "Save changes"
+    And I navigate to "User report" node in "Grade administration"
+    When I select "Student 1" from the "Select all or one user" singleselect
+    And I select "User" from the "View report as" singleselect
+    Then the following should exist in the "user-grade" table:
+      | Grade item              | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
+      | Test assignment one     | 50.00 %           | 80.00  | 0–100 | 80.00 %    | 13.33 %                      |
+      | Test assignment two     | 50.00 %           | 35.00  | 0–100 | 35.00 %    | 5.83 %                       |
+      | Sub category 1 total    | 33.33 %           | 115.00 | 0–200 | 57.50 %    | -                            |
+      | Test assignment five    | 16.67 %           | 21.00  | 0–100 | 21.00 %    | 3.50 %                       |
+      | Course total            | -                 | 383.00 | 0–600 | 63.83 %    | -                            |
+    And the following should not exist in the "user-grade" table:
+      | Grade item              |
+      | Test assignment three   |
+      | Test assignment four    |
+      | Sub category 2 total    |
+      | Test assignment six     |
+    And I log out
+    And I log in as "student1"
+    And I follow "Course 1"
+    And I navigate to "Grades" node in "Course administration"
+    Then the following should exist in the "user-grade" table:
+      | Grade item              | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
+      | Test assignment one     | 50.00 %           | 80.00  | 0–100 | 80.00 %    | 13.33 %                      |
+      | Test assignment two     | 50.00 %           | 35.00  | 0–100 | 35.00 %    | 5.83 %                       |
+      | Sub category 1 total    | 33.33 %           | 115.00 | 0–200 | 57.50 %    | -                            |
+      | Test assignment five    | 16.67 %           | 21.00  | 0–100 | 21.00 %    | 3.50 %                       |
+      | Course total            | -                 | 383.00 | 0–600 | 63.83 %    | -                            |
+    And the following should not exist in the "user-grade" table:
+      | Grade item              |
+      | Test assignment three   |
+      | Test assignment four    |
+      | Sub category 2 total    |
+      | Test assignment six     |
+
+  Scenario: View the report as the student from both the teachers and students perspective when the student can view hidden
+    Given I log out
+    And I log in as "admin"
+    And I set the following system permissions of "Student" role:
+      | capability | permission |
+      | moodle/grade:viewhidden | Allow |
+    And I log out
+    And I log in as "teacher1"
+    And I follow "Course 1"
+    And I navigate to "Gradebook setup" node in "Course administration"
+    And I navigate to "Course grade settings" node in "Grade administration > Setup"
+    And I set the field with xpath "//select[@name='report_user_showtotalsifcontainhidden']" to "Show totals excluding hidden items"
+    And I press "Save changes"
+    And I navigate to "User report" node in "Grade administration"
+    When I select "Student 1" from the "Select all or one user" singleselect
+    And I select "User" from the "View report as" singleselect
+    Then the following should exist in the "user-grade" table:
+      | Grade item              | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
+      | Test assignment one     | 50.00 %           | 80.00  | 0–100 | 80.00 %    | 13.33 %                      |
+      | Test assignment two     | 50.00 %           | 35.00  | 0–100 | 35.00 %    | 5.83 %                       |
+      | Sub category 1 total    | 33.33 %           | 115.00 | 0–200 | 57.50 %    | -                            |
+      | Test assignment three   | 50.00 %           | 100.00 | 0–100 | 100.00 %   | 16.67 %                      |
+      | Test assignment four    | 50.00 %           | 50.00  | 0–100 | 50.00 %    | 8.33 %                       |
+      | Sub category 2 total    | 33.33 %           | 150.00 | 0–200 | 75.00 %    | -                            |
+      | Test assignment five    | 16.67 %           | 21.00  | 0–100 | 21.00 %    | 3.50 %                       |
+      | Test assignment six     | 16.67 %           | 97.00  | 0–100 | 97.00 %    | 16.17 %                      |
+      | Course total            | -                 | 383.00 | 0–600 | 63.83 %    | -                            |
+    And I log out
+    And I log in as "student1"
+    And I follow "Course 1"
+    And I navigate to "Grades" node in "Course administration"
+    Then the following should exist in the "user-grade" table:
+      | Grade item              | Calculated weight | Grade  | Range | Percentage | Contribution to course total |
+      | Test assignment one     | 50.00 %           | 80.00  | 0–100 | 80.00 %    | 13.33 %                      |
+      | Test assignment two     | 50.00 %           | 35.00  | 0–100 | 35.00 %    | 5.83 %                       |
+      | Sub category 1 total    | 33.33 %           | 115.00 | 0–200 | 57.50 %    | -                            |
+      | Test assignment three   | 50.00 %           | 100.00 | 0–100 | 100.00 %   | 16.67 %                      |
+      | Test assignment four    | 50.00 %           | 50.00  | 0–100 | 50.00 %    | 8.33 %                       |
+      | Sub category 2 total    | 33.33 %           | 150.00 | 0–200 | 75.00 %    | -                            |
+      | Test assignment five    | 16.67 %           | 21.00  | 0–100 | 21.00 %    | 3.50 %                       |
+      | Test assignment six     | 16.67 %           | 97.00  | 0–100 | 97.00 %    | 16.17 %                      |
+      | Course total            | -                 | 383.00 | 0–600 | 63.83 %    | -                            |
index 40337fd..a22f391 100644 (file)
@@ -91,6 +91,31 @@ class behat_grade extends behat_base {
         $this->execute('behat_forms::press_button', $this->escape($savechanges));
     }
 
+    /**
+     * Hids a grade item or category.
+     *
+     * Teacher must be either on the grade setup page or on the Grader report page with editing mode turned on.
+     *
+     * @Given /^I hide the grade item "(?P<grade_item_string>(?:[^"]|\\")*)"$/
+     * @param string $gradeitem
+     */
+    public function i_hide_the_grade_item($gradeitem) {
+
+        $gradeitem = behat_context_helper::escape($gradeitem);
+
+        if ($this->running_javascript()) {
+            $xpath = "//tr[contains(.,$gradeitem)]//*[contains(@class,'moodle-actionmenu')]//a[contains(@class,'toggle-display')]";
+            if ($this->getSession()->getPage()->findAll('xpath', $xpath)) {
+                $this->execute("behat_general::i_click_on", array($this->escape($xpath), "xpath_element"));
+            }
+        }
+
+        $hide = behat_context_helper::escape(get_string('hide') . '  ');
+        $linkxpath = "//a[./img[starts-with(@title,$hide) and contains(@title,$gradeitem)]]";
+
+        $this->execute("behat_general::i_click_on", array($this->escape($linkxpath), "xpath_element"));
+    }
+
     /**
      * Sets a calculated manual grade item. Needs a table with item name - idnumber relation.
      * The step requires you to be in the 'Gradebook setup' page.
index 3e2ab94..54c2cb7 100644 (file)
@@ -345,6 +345,7 @@ Feature: We can use calculated grade totals
     And I set the field "Show weightings" to "Show"
     And I press "Save changes"
     And I select "User report" from the "Grade report" singleselect
+    And I select "Myself" from the "View report as" singleselect
     And I select "Student 1" from the "Select all or one user" singleselect
     And the following should exist in the "user-grade" table:
       | Grade item | Calculated weight | Grade | Range | Contribution to course total |
@@ -534,6 +535,7 @@ Feature: We can use calculated grade totals
     And I press "Save changes"
     Then I should see "75.00 (16.85 %)" in the ".course" "css_element"
     And I select "User report" from the "Grade report" singleselect
+    And I select "Myself" from the "View report as" singleselect
     And I select "Student 1" from the "Select all or one user" singleselect
     And the following should exist in the "user-grade" table:
       | Grade item            | Calculated weight | Grade           | Contribution to course total |
index 724fb0a..a85f780 100644 (file)
@@ -46,6 +46,7 @@ Feature: Student and teacher's view of aggregated grade items is consistent when
     And I follow "Course 1"
     And I navigate to "Grades" node in "Course administration"
     And I select "User report" from the "Grade report" singleselect
+    And I select "Myself" from the "View report as" singleselect
     And I select "Student 1" from the "Select all or one user" singleselect
     Then the following should exist in the "user-grade" table:
       | Grade item | Calculated weight | Grade | Range | Percentage | Contribution to course total |
index 2143bc0..bef4621 100644 (file)
@@ -86,8 +86,8 @@ class core_iplookup_geoip_testcase extends advanced_testcase {
 
         $this->assertEquals('array', gettype($result));
         $this->assertEquals('Cambridge', $result['city']);
-        $this->assertEquals(0.1249, $result['longitude'], '', 0.001);
-        $this->assertEquals(52.191000000000003, $result['latitude'], '', 0.001);
+        $this->assertEquals(0.1167, $result['longitude'], 'Coordinates are out of accepted tolerance', 0.01);
+        $this->assertEquals(52.2, $result['latitude'], 'Coordinates are out of accepted tolerance', 0.01);
         $this->assertNull($result['error']);
         $this->assertEquals('array', gettype($result['title']));
         $this->assertEquals('Cambridge', $result['title'][0]);
@@ -100,8 +100,8 @@ class core_iplookup_geoip_testcase extends advanced_testcase {
 
         $this->assertEquals('array', gettype($result));
         $this->assertEquals('Lancaster', $result['city']);
-        $this->assertEquals(-2.79970, $result['longitude'], '', 0.001);
-        $this->assertEquals(54.04650, $result['latitude'], '', 0.001);
+        $this->assertEquals(-2.7997, $result['longitude'], 'Coordinates are out of accepted tolerance', 0.01);
+        $this->assertEquals(54.0465, $result['latitude'], 'Coordinates are out of accepted tolerance', 0.01);
         $this->assertNull($result['error']);
         $this->assertEquals('array', gettype($result['title']));
         $this->assertEquals('Lancaster', $result['title'][0]);
index 29f09b1..0f833ac 100644 (file)
@@ -778,6 +778,8 @@ $string['order3'] = 'Third';
 $string['order4'] = 'Fourth';
 $string['passwordchangelogout'] = 'Log out after password change';
 $string['passwordchangelogout_desc'] = 'If enabled, when a password is changed, all browser sessions are terminated, apart from the one in which the new password is specified. (This setting does not affect password changes via bulk user upload.)';
+$string['passwordchangetokendeletion'] = 'Remove web service access tokens after password change';
+$string['passwordchangetokendeletion_desc'] = 'If enabled, when a password is changed, all the user web service access tokens are deleted.';
 $string['passwordpolicy'] = 'Password policy';
 $string['passwordresettime'] = 'Maximum time to validate password reset request';
 $string['passwordreuselimit'] = 'Password rotation limit';
@@ -1063,6 +1065,7 @@ $string['tasktagcron'] = 'Background processing for tags';
 $string['tasktempfilecleanup'] = 'Delete stale temp files';
 $string['tempdatafoldercleanup'] = 'Clean up temporary data files older than';
 $string['themedesignermode'] = 'Theme designer mode';
+$string['themedesignermodewarning'] = 'Theme designer mode is enabled. This should not be enabled on production sites as it can significantly reduce performance.';
 $string['themelist'] = 'Theme list';
 $string['themenoselected'] = 'No theme selected';
 $string['themeresetcaches'] = 'Clear theme caches';
index 76264ed..a4eeef8 100644 (file)
 $string['addcontact'] = 'Add contact';
 $string['addsomecontacts'] = 'To send a message to someone, or to add a shortcut for them on this page, use the <a href="{$a}">search tab</a> above.';
 $string['addsomecontactsincoming'] = 'These messages are from people who are not in your contact list. To add them to your contacts, click the "Add contact" icon next to their name.';
+$string['addtoyourcontacts'] = 'Add to your contacts';
 $string['ago'] = '{$a} ago';
 $string['ajax_gui'] = 'Ajax chat room';
 $string['allmine'] = 'All messages to me or from me';
 $string['allstudents'] = 'All messages between students in course';
 $string['allusers'] = 'All messages from all users';
+$string['alwayssend'] = 'Always send me';
 $string['backupmessageshelp'] = 'If enabled, then instant messages will be included in SITE automated backups';
 $string['beepnewmessage'] = 'Beep when popup notification is displayed';
 $string['blockcontact'] = 'Block contact';
 $string['blockedmessages'] = '{$a} message(s) to/from blocked users';
 $string['blockedusers'] = 'Blocked users ({$a})';
 $string['blocknoncontacts'] = 'Prevent non-contacts from messaging me';
+$string['collapsenotification'] = 'Collapse notification';
+$string['contactblocked'] = 'Contact blocked';
 $string['contactlistempty'] = 'Contact list empty';
 $string['contacts'] = 'Contacts';
 $string['context'] = 'context';
 $string['defaultmessageoutputs'] = 'Default message outputs';
 $string['defaults'] = 'Defaults';
+$string['deleteallconfirm'] = "Are you sure you would like to delete this entire conversation?";
 $string['deletemessage'] = 'Delete message';
 $string['deletemessageconfirmation'] = 'Are you sure you want to delete this message? It will only be deleted from your messaging history and will still be viewable by the user who sent or received the message.';
+$string['deleteselectedmessages'] = 'Delete selected messages';
 $string['deletemessagesdays'] = 'Number of days before old messages are automatically deleted';
-$string['disableall'] = 'Temporarily disable notifications';
-$string['disableall_help'] = 'Temporarily disable all notifications except those marked as "forced" by the site administrator';
+$string['disableall'] = 'Disable notifications';
 $string['disabled'] = 'Messaging is disabled on this site';
 $string['disallowed'] = 'Disallowed';
 $string['discussion'] = 'Discussion';
@@ -54,7 +59,6 @@ $string['emailtagline'] = 'This is a copy of a message sent to you at "{$a->site
 $string['emptysearchstring'] = 'You must search for something';
 $string['enabled'] = 'Enabled';
 $string['errorcallingprocessor'] = 'Error calling defined output';
-$string['errorwhilesendingmessage'] = 'An error occurred while sending the message; please try again later.';
 $string['errortranslatingdefault'] = 'Error translating default setting provided by plugin, using system defaults instead.';
 $string['eventmessagecontactadded'] = 'Message contact added';
 $string['eventmessagecontactblocked'] = 'Message contact blocked';
@@ -63,23 +67,30 @@ $string['eventmessagecontactunblocked'] = 'Message contact unblocked';
 $string['eventmessagedeleted'] = 'Message deleted';
 $string['eventmessageviewed'] = 'Message viewed';
 $string['eventmessagesent'] = 'Message sent';
-$string['forced'] = 'Forced';
+$string['expandnotification'] = 'Expand notification';
+$string['forced'] = 'Locked';
 $string['formorethan'] = 'For more than';
 $string['guestnoeditmessage'] = 'Guest user can not edit messaging options';
 $string['guestnoeditmessageother'] = 'Guest user can not edit other user messaging options';
 $string['gotomessages'] = 'Go to messages';
+$string['hidemessagewindow'] = 'Hide message window';
+$string['hidenotificationwindow'] = 'Hide notification window';
 $string['includeblockedusers'] = 'Include blocked users';
 $string['incomingcontacts'] = 'Incoming contacts ({$a})';
 $string['keywords'] = 'Keywords';
 $string['keywordssearchresults'] = 'Messages found: {$a}';
 $string['keywordssearchresultstoomany'] = 'More than {$a} messages found. Refine your search.';
+$string['loading'] = 'Loading ...';
 $string['loggedin'] = 'Online';
-$string['loggedindescription'] = 'When I\'m logged in';
-$string['loggedoff'] = 'Not online';
-$string['loggedoffdescription'] = 'When I\'m offline';
+$string['loggedin_help'] = 'Configure how you would like to receive notifications when you are logged into Moodle';
+$string['loggedindescription'] = 'When you are logged into Moodle';
+$string['loggedoff'] = 'Offline';
+$string['loggedoff_help'] = 'Configure how you would like to receive notifications when you are not logged into Moodle';
+$string['loggedoffdescription'] = 'When you are not logged into Moodle';
 $string['managecontacts'] = 'Manage my contacts';
 $string['managemessageoutputs'] = 'Manage message outputs';
 $string['messageoutputs'] = 'Message outputs';
+$string['messagepreferences'] = 'Message preferences';
 $string['mostrecent'] = 'Recent messages';
 $string['mostrecentconversations'] = 'Recent conversations';
 $string['mostrecentnotifications'] = 'Recent notifications';
@@ -89,21 +100,31 @@ $string['message'] = 'Message';
 $string['messagehistory'] = 'Message history';
 $string['messagehistoryfull'] = 'All messages';
 $string['messagenavigation'] = 'Message navigation:';
-$string['messagetosend'] = 'Message to send';
+$string['messagepreferences'] = 'Message preferences';
+$string['messageprocessors'] = 'Message processors';
 $string['messages'] = 'Messages';
-$string['messagesent'] = 'Message sent';
 $string['messaging'] = 'Messaging';
 $string['messagingblockednoncontact'] = '{$a} will not be able to reply as you have blocked non-contacts';
 $string['messagingdisabled'] = 'Messaging is disabled on this site, emails will be sent instead';
 $string['newonlymsg'] = 'Show only new';
 $string['newsearch'] = 'New search';
 $string['noframesjs'] = 'Use more accessible interface';
-$string['nomessages'] = 'No messages waiting';
+$string['nocontacts'] = 'No contacts';
+$string['nomessages'] = 'No messages';
 $string['nomessagesfound'] = 'No messages were found';
 $string['noreply'] = 'Do not reply to this message';
 $string['nosearchresults'] = 'There were no results from your search';
+$string['noncontacts'] = 'Non-contacts';
+$string['nonotifications'] = 'You have no notifications';
+$string['nonewnotifications'] = 'You have no new notifications';
+$string['notificationwindow'] = 'Notification window';
+$string['notificationpreferences'] = 'Notification preferences';
+$string['notificationimage'] = 'Notification image';
+$string['notifications'] = 'Notifications';
+$string['off'] = 'Off';
 $string['offline'] = 'Offline';
 $string['offlinecontacts'] = 'Offline contacts ({$a})';
+$string['on'] = 'On';
 $string['online'] = 'Online';
 $string['onlinecontacts'] = 'Online contacts ({$a})';
 $string['onlyfromme'] = 'Only messages from me';
@@ -118,37 +139,58 @@ $string['pagerefreshes'] = 'This page refreshes automatically every {$a} seconds
 $string['permitted'] = 'Permitted';
 $string['page-message-x'] = 'Any message pages';
 $string['private_config'] = 'Popup message window';
+$string['processorsettings'] = 'Processor settings';
 $string['processortag'] = 'Destination';
 $string['providers_config'] = 'Configure notification methods for incoming messages';
 $string['providerstag'] = 'Source';
 $string['recent'] = 'Recent';
 $string['readmessages'] = '{$a} read messages';
 $string['removecontact'] = 'Remove contact';
+$string['removefromyourcontacts'] = 'Remove from your contacts';
+$string['requiresconfiguration'] = 'Requires configuration';
 $string['savemysettings'] = 'Save my settings';
 $string['search'] = 'Search';
-$string['searchforperson'] = 'Search for a person';
+$string['searchforuser'] = 'Search for a user';
+$string['searchforuserorcourse'] = 'Search for a user or course';
 $string['searchmessages'] = 'Search messages';
 $string['searchcombined'] = 'Search people and messages';
+$string['selectmessagestodelete'] = 'Select messages to delete';
+$string['selectnotificationtoview'] = 'Select from the list of notifications on the side to view more details';
+$string['send'] = 'Send';
 $string['sendingvia'] = 'Sending "{$a->provider}" via "{$a->processor}"';
 $string['sendingviawhen'] = 'Sending "{$a->provider}" via "{$a->processor}" when {$a->state}';
-$string['sendingmessage'] = 'Sending message';
 $string['sendmessage'] = 'Send message';
 $string['sendmessageto'] = 'Send message to {$a}';
 $string['sendmessagetopopup'] = 'Send message to {$a} - new window';
 $string['settings'] = 'Settings';
 $string['settingssaved'] = 'Your settings have been saved';
 $string['showmessagewindow'] = 'Popup window on new message';
+$string['showmessagewindownonew'] = 'Show message window with no new messages';
+$string['showmessagewindowwithcount'] = 'Show message window with {$a} new messages';
+$string['showallnotifications'] = 'Show all notifications';
+$string['shownewnotifications'] = 'Show new notifications';
+$string['shownotificationwindownonew'] = 'Show notification window with no new notifications';
+$string['shownotificationwindowwithcount'] = 'Show notification window with {$a} new notifications';
 $string['strftimedaydatetime'] = '%A, %d %B %Y, %I:%M %p';
 $string['thisconversation'] = 'this conversation';
 $string['timenosee'] = 'Minutes since I was last seen online';
 $string['timesent'] = 'Time sent';
+$string['togglenotificationmenu'] = 'Toggle notification menu';
+$string['togglemessagemenu'] = 'Toggle message menu';
 $string['touserdoesntexist'] = 'You can not send a message to a user id ({$a}) that doesn\'t exist';
 $string['unabletomessageuser'] = 'You are not permitted to send a message to that user';
 $string['unblockcontact'] = 'Unblock contact';
 $string['unreadmessages'] = 'Unread messages ({$a})';
+$string['unreadnotification'] = 'Unread notification: {$a}';
 $string['unreadnewmessages'] = 'New messages ({$a})';
 $string['unreadnewmessage'] = 'New message from {$a}';
 $string['userisblockingyou'] = 'This user has blocked you from sending messages to them';
 $string['userisblockingyounoncontact'] = '{$a} only accepts messages from their contacts.';
 $string['userssearchresults'] = 'Users found: {$a}';
-$string['viewconversation'] = 'View conversation';
+$string['viewinganotherusersmessagearea'] = 'You are viewing another user\'s message area.';
+$string['viewmessages'] = 'View messages';
+$string['viewmessageswith'] = 'View messages with {$a}';
+$string['viewnotificationresource'] = 'Go to: {$a}';
+$string['viewunreadmessageswith'] = 'View unread messages with {$a}';
+$string['writeamessage'] = 'Write a message...';
+$string['you'] = 'You:';
index 632356e..d921534 100644 (file)
@@ -934,6 +934,7 @@ $string['hidepicture'] = 'Hide picture';
 $string['hidesection'] = 'Hide section {$a}';
 $string['hidesettings'] = 'Hide settings';
 $string['hideshowblocks'] = 'Hide or show blocks';
+$string['hidepopoverwindow'] = 'Hide popover window';
 $string['highlight'] = 'Highlight';
 $string['highlightoff'] = 'Remove highlight';
 $string['hits'] = 'Hits';
@@ -1052,6 +1053,7 @@ $string['list'] = 'List';
 $string['listfiles'] = 'List of files in {$a}';
 $string['listofallpeople'] = 'List of all people';
 $string['listofcourses'] = 'List of courses';
+$string['loading'] = 'Loading';
 $string['loadinghelp'] = 'Loading...';
 $string['local'] = 'Local';
 $string['localplugins'] = 'Local plugins';
@@ -1098,6 +1100,7 @@ $string['manageeditorfiles'] = 'Manage files used by editor';
 $string['managefilters'] = 'Filters';
 $string['managemodules'] = 'Modules';
 $string['manageroles'] = 'Roles and permissions';
+$string['markallread'] = 'Mark all as read';
 $string['markedthistopic'] = 'This topic is highlighted as the current topic';
 $string['markthistopic'] = 'Highlight this topic as the current topic';
 $string['matchingsearchandrole'] = 'Matching \'{$a->search}\' and {$a->role}';
@@ -1705,6 +1708,7 @@ $string['showlistofcourses'] = 'Show list of courses';
 $string['showmodulecourse'] = 'Show list of courses containing activity';
 $string['showonly'] = 'Show only';
 $string['showperpage'] = 'Show {$a} per page';
+$string['showpopoverwindow'] = 'Show popover window';
 $string['showrecent'] = 'Show recent activity';
 $string['showreports'] = 'Show activity reports';
 $string['showreports_help'] = 'Activity reports are available for each participant that show their activity in the course. As well as listings of their contributions, such as forum posts or assignment submissions, these reports also include access logs. This setting determines whether a student can view their own activity reports via their profile page.';
@@ -1712,6 +1716,8 @@ $string['showsettings'] = 'Show settings';
 $string['showtheselogs'] = 'Show these logs';
 $string['showthishelpinlanguage'] = 'Show this help in language: {$a}';
 $string['schedule'] = 'Schedule';
+$string['signoutofotherservices'] = 'Sign out everywhere';
+$string['signoutofotherservices_help'] = 'If ticked, the account will be signed out of all devices and systems which use web services, such as the mobile app.';
 $string['since'] = 'Since';
 $string['sincelast'] = 'since last login';
 $string['site'] = 'Site';
index 6eeb775..06cb7d1 100644 (file)
@@ -204,6 +204,7 @@ $string['usernameorid_help'] = 'Enter a username or a user id.';
 $string['usernameoridnousererror'] = 'No users were found with this username/user id.';
 $string['usernameoridoccurenceerror'] = 'More than one user was found with this username. Please enter the user id.';
 $string['usernotallowed'] = 'The user is not allowed for this service. First you need to allow this user on the {$a}\'s allowed users administration page.';
+$string['userservices'] = 'User services: {$a}';
 $string['usersettingssaved'] = 'User settings saved';
 $string['validuntil'] = 'Valid until';
 $string['validuntil_help'] = 'If set, the service will be inactivated after this date for this user.';
index ea059c5..8f2d0ab 100644 (file)
@@ -7279,10 +7279,12 @@ function get_suspended_userids(context $context, $usecache = false) {
 }
 
 /**
- * Gets sql for finding users with capability in the given context
+ * Gets sql for finding users with capability in the given context
  *
  * @param context $context
- * @param string $capability
+ * @param string|array $capability Capability name or array of names.
+ *      If an array is provided then this is the equivalent of a logical 'OR',
+ *      i.e. the user needs to have one of these capabilities.
  * @return array($sql, $params)
  */
 function get_with_capability_sql(context $context, $capability) {
@@ -7301,11 +7303,13 @@ function get_with_capability_sql(context $context, $capability) {
 }
 
 /**
- * Gets sql joins for finding users with capability in the given context
+ * Gets sql joins for finding users with capability in the given context
  *
- * @param context $context
- * @param string $capability
- * @param string $useridcolumn e.g. u.id
+ * @param context $context Context for the join
+ * @param string|array $capability Capability name or array of names.
+ *      If an array is provided then this is the equivalent of a logical 'OR',
+ *      i.e. the user needs to have one of these capabilities.
+ * @param string $useridcolumn e.g. 'u.id'
  * @return \core\dml\sql_join Contains joins, wheres, params
  */
 function get_with_capability_join(context $context, $capability, $useridcolumn) {
@@ -7328,14 +7332,15 @@ function get_with_capability_join(context $context, $capability, $useridcolumn)
     list($contextids, $contextpaths) = get_context_info_list($context);
 
     list($incontexts, $cparams) = $DB->get_in_or_equal($contextids, SQL_PARAMS_NAMED, 'ctx');
-    $cparams['cap'] = $capability;
+
+    list($incaps, $capsparams) = $DB->get_in_or_equal($capability, SQL_PARAMS_NAMED, 'cap');
 
     $defs = array();
     $sql = "SELECT rc.id, rc.roleid, rc.permission, ctx.path
               FROM {role_capabilities} rc
               JOIN {context} ctx on rc.contextid = ctx.id
-             WHERE rc.contextid $incontexts AND rc.capability = :cap";
-    $rcs = $DB->get_records_sql($sql, $cparams);
+             WHERE rc.contextid $incontexts AND rc.capability $incaps";
+    $rcs = $DB->get_records_sql($sql, array_merge($cparams, $capsparams));
     foreach ($rcs as $rc) {
         $defs[$rc->path][$rc->roleid] = $rc->permission;
     }
index 2c4b878..ae58564 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
 
-@version   v5.20.3  01-Jan-2016
+@version   v5.20.7  20-Sep-2016
 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
 @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Latest version is available at http://adodb.sourceforge.net
index 9e4f7c9..f7b5179 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /*
 
-@version   v5.20.3  01-Jan-2016
+@version   v5.20.7  20-Sep-2016
 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
 @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Latest version is available at http://adodb.sourceforge.net
index c306235..bded3ac 100644 (file)
@@ -8,7 +8,7 @@ $ADODB_INCLUDED_CSV = 1;
 
 /*
 
-  @version   v5.20.3  01-Jan-2016
+  @version   v5.20.7  20-Sep-2016
   @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
   @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Released under both BSD license and Lesser GPL library license.
index 5f2ffc9..f2b29a6 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  @version   v5.20.3  01-Jan-2016
+  @version   v5.20.7  20-Sep-2016
   @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
   @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Released under both BSD license and Lesser GPL library license.
index 307b8b5..3f2ab90 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version   v5.20.3  01-Jan-2016
+ * @version   v5.20.7  20-Sep-2016
  * @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
  * @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
  * Released under both BSD license and Lesser GPL library license.
index 3b20cc2..e8dcaab 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version   v5.20.3  01-Jan-2016
+ * @version   v5.20.7  20-Sep-2016
  * @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
  * @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
  * Released under both BSD license and Lesser GPL library license.
index 733eb17..db3e2a2 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version   v5.20.3  01-Jan-2016
+ * @version   v5.20.7  20-Sep-2016
  * @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
  * @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
  * Released under both BSD license and Lesser GPL library license.
index 1f92c4a..b3ffc38 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * @version   v5.20.3  01-Jan-2016
+ * @version   v5.20.7  20-Sep-2016
  * @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
  * @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
  * Released under both BSD license and Lesser GPL library license.
@@ -33,16 +33,16 @@ var $database = '';
                case 'EXECUTE':
                        $this->sql = is_array($p1) ? $p1[0] : $p1;
                        $this->params = $p2;
-                       $s = "$dbms error: [$errno: $errmsg] in $fn(\"$this->sql\")\n";
+                       $s = "$dbms error: [$errno: $errmsg] in $fn(\"$this->sql\")";
                        break;
 
                case 'PCONNECT':
                case 'CONNECT':
                        $user = $thisConnection->user;
-                       $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)\n";
+                       $s = "$dbms error: [$errno: $errmsg] in $fn($p1, '$user', '****', $p2)";
                        break;
                default:
-                       $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)\n";
+                       $s = "$dbms error: [$errno: $errmsg] in $fn($p1, $p2)";
                        break;
                }
 
index 6b75388..4c8dffc 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /*
-  @version   v5.20.3  01-Jan-2016
+  @version   v5.20.7  20-Sep-2016
   @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
   @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Released under both BSD license and Lesser GPL library license.
index 7711290..503bb15 100644 (file)
@@ -6,7 +6,7 @@ global $ADODB_INCLUDED_LIB;
 $ADODB_INCLUDED_LIB = 1;
 
 /*
-  @version   v5.20.3  01-Jan-2016
+  @version   v5.20.7  20-Sep-2016
   @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
   @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Released under both BSD license and Lesser GPL library license.
@@ -426,7 +426,7 @@ function _adodb_getcount(&$zthis, $sql,$inputarr=false,$secs2cache=0)
                if ( strpos($sql, '_ADODB_COUNT') !== FALSE ) {
                        $rewritesql = preg_replace('/^\s*?SELECT\s+_ADODB_COUNT(.*)_ADODB_COUNT\s/is','SELECT COUNT(*) ',$sql);
                } else {
-                       $rewritesql = preg_replace('/^\s*?SELECT\s.*?\s+(.*?)\s+FROM\s/is','SELECT COUNT(*) FROM ',$sql);
+                       $rewritesql = preg_replace('/^\s*SELECT\s.*\s+FROM\s/Uis','SELECT COUNT(*) FROM ',$sql);
                }
                // fix by alexander zhukov, alex#unipack.ru, because count(*) and 'order by' fails
                // with mssql, access and postgresql. Also a good speedup optimization - skips sorting!
index 0714561..4dde732 100644 (file)
@@ -11,7 +11,7 @@ if (empty($ADODB_INCLUDED_CSV)) include_once(ADODB_DIR.'/adodb-csvlib.inc.php');
 
 /*
 
-  @version   v5.20.3  01-Jan-2016
+  @version   v5.20.7  20-Sep-2016
   @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
   @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Released under both BSD license and Lesser GPL library license.
index 15c371b..0221975 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /*
-       @version   v5.20.3  01-Jan-2016
+       @version   v5.20.7  20-Sep-2016
        @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
        @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
          Released under both BSD license and Lesser GPL library license.
index 634eb15..237dcfe 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @version   v5.20.3  01-Jan-2016
+ * @version   v5.20.7  20-Sep-2016
  * @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
  * @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
  * Released under both BSD license and Lesser GPL library license.
index 1629996..3dfaab4 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /*
-@version   v5.20.3  01-Jan-2016
+@version   v5.20.7  20-Sep-2016
 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
 @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Released under both BSD license and Lesser GPL library license.
index 926dbac..50963f0 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /*
-  @version   v5.20.3  01-Jan-2016
+  @version   v5.20.7  20-Sep-2016
   @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
   @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Released under both BSD license and Lesser GPL library license.
index a2991f3..df718cf 100644 (file)
@@ -3,7 +3,7 @@
 ADOdb Date Library, part of the ADOdb abstraction library
 Download: http://adodb.sourceforge.net/#download
 
-@version   v5.20.3  01-Jan-2016
+@version   v5.20.7  20-Sep-2016
 @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
 @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
 
index 0890155..ca5fa56 100644 (file)
@@ -157,7 +157,6 @@ class dbObject {
        * Destroys the object
        */
        function destroy() {
-               unset( $this );
        }
 
        /**
@@ -265,12 +264,14 @@ class dbTable extends dbObject {
                switch( $this->currentElement ) {
                        case 'INDEX':
                                if( !isset( $attributes['PLATFORM'] ) OR $this->supportedPlatform( $attributes['PLATFORM'] ) ) {
-                                       xml_set_object( $parser, $this->addIndex( $attributes ) );
+                                       $index = $this->addIndex( $attributes );
+                                       xml_set_object( $parser,  $index );
                                }
                                break;
                        case 'DATA':
                                if( !isset( $attributes['PLATFORM'] ) OR $this->supportedPlatform( $attributes['PLATFORM'] ) ) {
-                                       xml_set_object( $parser, $this->addData( $attributes ) );
+                                       $data = $this->addData( $attributes );
+                                       xml_set_object( $parser, $data );
                                }
                                break;
                        case 'DROP':
@@ -2196,7 +2197,6 @@ class adoSchema {
        function Destroy() {
                ini_set("magic_quotes_runtime", $this->mgq );
                #set_magic_quotes_runtime( $this->mgq );
-               unset( $this );
        }
 }
 
index 45a59bb..c1ecb88 100644 (file)
@@ -175,7 +175,6 @@ class dbObject {
        * Destroys the object
        */
        function destroy() {
-               unset( $this );
        }
 
        /**
@@ -290,12 +289,14 @@ class dbTable extends dbObject {
                switch( $this->currentElement ) {
                        case 'INDEX':
                                if( !isset( $attributes['PLATFORM'] ) OR $this->supportedPlatform( $attributes['PLATFORM'] ) ) {
-                                       xml_set_object( $parser, $this->addIndex( $attributes ) );
+                                       $index = $this->addIndex( $attributes );
+                                       xml_set_object( $parser,  $index );
                                }
                                break;
                        case 'DATA':
                                if( !isset( $attributes['PLATFORM'] ) OR $this->supportedPlatform( $attributes['PLATFORM'] ) ) {
-                                       xml_set_object( $parser, $this->addData( $attributes ) );
+                                       $data = $this->addData( $attributes );
+                                       xml_set_object( $parser, $data );
                                }
                                break;
                        case 'DROP':
@@ -2378,7 +2379,6 @@ class adoSchema {
        function Destroy() {
                ini_set("magic_quotes_runtime", $this->mgq );
                #set_magic_quotes_runtime( $this->mgq );
-               unset( $this );
        }
 }
 
index b6496e6..4967f6a 100644 (file)
@@ -14,7 +14,7 @@
 /**
        \mainpage
 
-       @version   v5.20.3  01-Jan-2016
+       @version   v5.20.7  20-Sep-2016
        @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
        @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
 
 if (!defined('_ADODB_LAYER')) {
        define('_ADODB_LAYER',1);
 
+       // The ADOdb extension is no longer maintained and effectively unsupported
+       // since v5.04. The library will not function properly if it is present.
+       if(defined('ADODB_EXTENSION')) {
+               $msg = "Unsupported ADOdb Extension (v" . ADODB_EXTENSION . ") detected! "
+                       . "Disable it to use ADOdb";
+
+               $errorfn = defined('ADODB_ERROR_HANDLER') ? ADODB_ERROR_HANDLER : false;
+               if ($errorfn) {
+                       $conn = false;
+                       $errorfn('ADOdb', basename(__FILE__), -9999, $msg, null, null, $conn);
+               } else {
+                       die($msg . PHP_EOL);
+               }
+       }
+
        //==============================================================================================
        // CONSTANT DEFINITIONS
        //==============================================================================================
@@ -218,7 +233,7 @@ if (!defined('_ADODB_LAYER')) {
                /**
                 * ADODB version as a string.
                 */
-               $ADODB_vers = 'v5.20.3  01-Jan-2016';
+               $ADODB_vers = 'v5.20.7  20-Sep-2016';
 
                /**
                 * Determines whether recordset->RecordCount() is used.
@@ -659,23 +674,23 @@ if (!defined('_ADODB_LAYER')) {
                }
                if (isset($rez)) {
                        $err = $this->ErrorMsg();
+                       $errno = $this->ErrorNo();
                        if (empty($err)) {
                                $err = "Connection error to server '$argHostname' with user '$argUsername'";
                        }
-                       $ret = false;
                } else {
                        $err = "Missing extension for ".$this->dataProvider;
-                       $ret = 0;
+                       $errno = 0;
                }
                if ($fn = $this->raiseErrorFn) {
-                       $fn($this->databaseType,'CONNECT',$this->ErrorNo(),$err,$this->host,$this->database,$this);
+                       $fn($this->databaseType, 'CONNECT', $errno, $err, $this->host, $this->database, $this);
                }
 
                $this->_connectionID = false;
                if ($this->debug) {
                        ADOConnection::outp( $this->host.': '.$err);
                }
-               return $ret;
+               return false;
        }
 
        function _nconnect($argHostname, $argUsername, $argPassword, $argDatabaseName) {
@@ -1117,20 +1132,35 @@ if (!defined('_ADODB_LAYER')) {
                                $sqlarr = explode('?',$sql);
                                $nparams = sizeof($sqlarr)-1;
 
+                               if (!$array_2d) {
+                                       // When not Bind Bulk - convert to array of arguments list
+                                       $inputarr = array($inputarr);
+                               } else {
+                                       // Bulk bind - Make sure all list of params have the same number of elements
+                                       $countElements = array_map('count', $inputarr);
+                                       if (1 != count(array_unique($countElements))) {
+                                               $this->outp_throw(
+                                                       "[bulk execute] Input array has different number of params  [" . print_r($countElements, true) .  "].",
+                                                       'Execute'
+                                               );
+                                               return false;
+                                       }
+                                       unset($countElements);
+                               }
                                // Make sure the number of parameters provided in the input
                                // array matches what the query expects
-                               if ($nparams != count($inputarr)) {
+                               $element0 = reset($inputarr);
+                               if ($nparams != count($element0)) {
                                        $this->outp_throw(
-                                               "Input array has " . count($inputarr) .
+                                               "Input array has " . count($element0) .
                                                " params, does not match query: '" . htmlspecialchars($sql) . "'",
                                                'Execute'
                                        );
                                        return false;
                                }
 
-                               if (!$array_2d) {
-                                       $inputarr = array($inputarr);
-                               }
+                               // clean memory
+                               unset($element0);
 
                                foreach($inputarr as $arr) {
                                        $sql = ''; $i = 0;
index 0d2f36b..25a72a8 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  @version   v5.20.3  01-Jan-2016
+  @version   v5.20.7  20-Sep-2016
   @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
   @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Released under both BSD license and Lesser GPL library license.
index f5fb983..a3fa783 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /**
-  @version   v5.20.3  01-Jan-2016
+  @version   v5.20.7  20-Sep-2016
   @copyright (c) 2000-2013 John Lim (jlim#natsoft.com). All rights reserved.
   @copyright (c) 2014      Damien Regad, Mark Newnham and the ADOdb community
   Released under both BSD license and Lesser GPL library license.