Merge branch 'mdl59843-master' of https://github.com/tlock/moodle
authorJun Pataleta <jun@moodle.com>
Thu, 19 Oct 2017 00:22:01 +0000 (13:22 +1300)
committerJun Pataleta <jun@moodle.com>
Thu, 19 Oct 2017 00:22:01 +0000 (13:22 +1300)
904 files changed:
.eslintignore
.stylelintignore
admin/index.php
admin/registration/confirmregistration.php
admin/registration/forms.php
admin/registration/index.php
admin/registration/lib.php
admin/registration/register.php
admin/registration/renderer.php
admin/registration/renewregistration.php
admin/renderer.php
admin/search.php
admin/settings/analytics.php
admin/settings/plugins.php
admin/settings/server.php
admin/settings/top.php
admin/tool/analytics/amd/build/model.min.js [new file with mode: 0644]
admin/tool/analytics/amd/src/model.js [new file with mode: 0644]
admin/tool/analytics/classes/output/form/edit_model.php
admin/tool/analytics/classes/output/models_list.php
admin/tool/analytics/classes/output/renderer.php
admin/tool/analytics/lang/en/tool_analytics.php
admin/tool/analytics/model.php
admin/tool/analytics/templates/models_list.mustache
admin/tool/httpsreplace/classes/form.php [new file with mode: 0644]
admin/tool/httpsreplace/classes/url_finder.php [new file with mode: 0644]
admin/tool/httpsreplace/cli/url_replace.php [new file with mode: 0644]
admin/tool/httpsreplace/index.php [new file with mode: 0644]
admin/tool/httpsreplace/lang/en/tool_httpsreplace.php [new file with mode: 0644]
admin/tool/httpsreplace/settings.php [new file with mode: 0644]
admin/tool/httpsreplace/tests/behat/httpsreplace.feature [new file with mode: 0644]
admin/tool/httpsreplace/tests/httpsreplace_test.php [new file with mode: 0644]
admin/tool/httpsreplace/tool.php [new file with mode: 0644]
admin/tool/httpsreplace/version.php [moved from blocks/messages/version.php with 68% similarity]
admin/tool/mobile/classes/api.php
admin/tool/mobile/classes/external.php
admin/tool/mobile/db/services.php
admin/tool/mobile/lang/en/tool_mobile.php
admin/tool/mobile/tests/api_test.php
admin/tool/mobile/tests/externallib_test.php
admin/tool/mobile/upgrade.txt
admin/tool/mobile/version.php
admin/tool/templatelibrary/classes/external.php
admin/tool/usertours/amd/build/usertours.min.js
admin/tool/usertours/amd/src/usertours.js
admin/tool/usertours/templates/resettour.mustache [new file with mode: 0644]
admin/webservice/testclient.php
admin/webservice/testclient_forms.php
analytics/classes/admin_setting_predictor.php
analytics/classes/calculable.php
analytics/classes/dataset_manager.php
analytics/classes/local/analyser/base.php
analytics/classes/local/analyser/by_course.php
analytics/classes/local/analyser/sitewide.php
analytics/classes/local/indicator/base.php
analytics/classes/local/target/base.php
analytics/classes/local/target/discrete.php
analytics/classes/local/target/linear.php
analytics/classes/local/time_splitting/base.php
analytics/classes/manager.php
analytics/classes/model.php
analytics/classes/prediction.php
analytics/classes/predictor.php
analytics/tests/dataset_manager_test.php
analytics/tests/fixtures/test_analyser.php [new file with mode: 0644]
analytics/tests/fixtures/test_target_course_level_shortname.php [new file with mode: 0644]
analytics/tests/manager_test.php [new file with mode: 0644]
analytics/tests/model_test.php
analytics/tests/prediction_test.php
auth/cas/CAS/CAS/Autoload.php
auth/cas/CAS/moodle_readme.txt
auth/email/classes/external.php
auth/ldap/classes/admin_setting_special_contexts_configtext.php
backup/backupfilesedit.php
backup/moodle2/backup_stepslib.php
backup/moodle2/restore_activity_task.class.php
backup/moodle2/restore_block_task.class.php
backup/moodle2/restore_course_task.class.php
backup/moodle2/restore_final_task.class.php
backup/moodle2/restore_stepslib.php
backup/moodle2/tests/moodle2_test.php
backup/restorefile.php
backup/util/structure/base_nested_element.class.php
backup/util/ui/renderer.php
badges/award.php
badges/criteria/award_criteria.php
badges/criteria/award_criteria_manual.php
badges/criteria/award_criteria_profile.php
badges/renderer.php
blocks/activity_results/block_activity_results.php
blocks/calendar_month/block_calendar_month.php
blocks/calendar_upcoming/block_calendar_upcoming.php
blocks/community/communitycourse.php
blocks/community/forms.php
blocks/community/locallib.php
blocks/community/renderer.php
blocks/community/styles.css
blocks/messages/block_messages.php [deleted file]
blocks/messages/styles.css [deleted file]
blocks/messages/tests/behat/block_messages_course.feature [deleted file]
blocks/messages/tests/behat/block_messages_dashboard.feature [deleted file]
blocks/messages/tests/behat/block_messages_frontpage.feature [deleted file]
blocks/upgrade.txt
cache/disabledlib.php
calendar/amd/build/calendar.min.js
calendar/amd/build/calendar_filter.min.js
calendar/amd/build/calendar_threemonth.min.js
calendar/amd/build/calendar_view.min.js [new file with mode: 0644]
calendar/amd/build/crud.min.js [new file with mode: 0644]
calendar/amd/build/drag_drop_data_store.min.js
calendar/amd/build/event_form.min.js
calendar/amd/build/events.min.js
calendar/amd/build/modal_event_form.min.js
calendar/amd/build/month_navigation_drag_drop.min.js
calendar/amd/build/month_view_drag_drop.min.js
calendar/amd/build/repository.min.js
calendar/amd/build/selectors.min.js
calendar/amd/build/summary_modal.min.js
calendar/amd/build/view_manager.min.js
calendar/amd/src/calendar.js
calendar/amd/src/calendar_filter.js
calendar/amd/src/calendar_threemonth.js
calendar/amd/src/calendar_view.js [new file with mode: 0644]
calendar/amd/src/crud.js [new file with mode: 0644]
calendar/amd/src/drag_drop_data_store.js
calendar/amd/src/event_form.js
calendar/amd/src/events.js
calendar/amd/src/modal_event_form.js
calendar/amd/src/month_navigation_drag_drop.js
calendar/amd/src/month_view_drag_drop.js
calendar/amd/src/repository.js
calendar/amd/src/selectors.js
calendar/amd/src/summary_modal.js
calendar/amd/src/view_manager.js
calendar/classes/external/calendar_day_exporter.php [new file with mode: 0644]
calendar/classes/external/calendar_event_exporter.php
calendar/classes/external/calendar_upcoming_exporter.php [new file with mode: 0644]
calendar/classes/external/day_exporter.php
calendar/classes/external/event_exporter.php
calendar/classes/external/event_exporter_base.php
calendar/classes/external/event_icon_exporter.php
calendar/classes/external/event_subscription_exporter.php
calendar/classes/external/footer_options_exporter.php
calendar/classes/external/month_exporter.php
calendar/classes/external/week_day_exporter.php
calendar/classes/local/api.php
calendar/classes/local/event/container.php
calendar/classes/local/event/data_access/event_vault.php
calendar/classes/local/event/data_access/event_vault_interface.php
calendar/classes/local/event/entities/action_event.php
calendar/classes/local/event/entities/event.php
calendar/classes/local/event/entities/event_interface.php
calendar/classes/local/event/entities/repeat_event_collection.php
calendar/classes/local/event/factories/event_abstract_factory.php
calendar/classes/local/event/forms/create.php
calendar/classes/local/event/mappers/create_update_form_mapper.php
calendar/classes/local/event/mappers/event_mapper.php
calendar/classes/local/event/proxies/coursecat_proxy.php [new file with mode: 0644]
calendar/classes/local/event/strategies/raw_event_retrieval_strategy.php
calendar/classes/local/event/strategies/raw_event_retrieval_strategy_interface.php
calendar/event.php
calendar/export.php
calendar/externallib.php
calendar/lib.php
calendar/renderer.php
calendar/templates/add_event_button.mustache [new file with mode: 0644]
calendar/templates/calendar_day.mustache [new file with mode: 0644]
calendar/templates/calendar_upcoming.mustache [new file with mode: 0644]
calendar/templates/day_detailed.mustache
calendar/templates/day_navigation.mustache
calendar/templates/event_filter_key.mustache
calendar/templates/event_icon.mustache [new file with mode: 0644]
calendar/templates/event_item.mustache
calendar/templates/event_list.mustache
calendar/templates/event_subscription.mustache
calendar/templates/event_summary_body.mustache
calendar/templates/footer_options.mustache
calendar/templates/header.mustache
calendar/templates/month_detailed.mustache
calendar/templates/month_mini.mustache
calendar/templates/month_navigation.mustache
calendar/templates/upcoming_detailed.mustache [new file with mode: 0644]
calendar/templates/upcoming_mini.mustache [new file with mode: 0644]
calendar/tests/action_event_test.php
calendar/tests/behat/calendar.feature
calendar/tests/behat/calendar_lookahead.feature
calendar/tests/behat/category_events.feature [new file with mode: 0644]
calendar/tests/calendar_event_exporter_test.php [new file with mode: 0644]
calendar/tests/container_test.php
calendar/tests/coursecat_proxy_test.php [new file with mode: 0644]
calendar/tests/event_factory_test.php
calendar/tests/event_mapper_test.php
calendar/tests/event_test.php
calendar/tests/externallib_test.php
calendar/tests/helpers.php
calendar/tests/lib_test.php
calendar/tests/raw_event_retrieval_strategy_test.php
calendar/tests/repeat_event_collection_test.php
calendar/tests/rrule_manager_test.php
calendar/view.php
cohort/externallib.php
cohort/lib.php
comment/classes/external.php
competency/tests/api_test.php
completion/classes/external.php
completion/tests/externallib_test.php
composer.json
composer.lock
config-dist.php
course/classes/analytics/indicator/no_student.php [new file with mode: 0644]
course/classes/search/mycourse.php
course/externallib.php
course/lib.php
course/publish/backup.php
course/publish/forms.php
course/publish/hubselector.php
course/publish/index.php
course/publish/lib.php
course/publish/metadata.php
course/publish/renderer.php
course/renderer.php
course/tests/courselib_test.php
course/tests/search_test.php
enrol/cohort/lib.php
enrol/cohort/tests/cohortlib_test.php
enrol/database/lib.php
enrol/database/tests/lib_test.php [new file with mode: 0644]
enrol/flatfile/lib.php
enrol/flatfile/tests/flatfile_test.php
enrol/locallib.php
enrol/lti/lib.php
enrol/lti/tests/lib_test.php
enrol/manual/lib.php
enrol/manual/tests/lib_test.php
enrol/meta/lib.php
enrol/meta/tests/behat/enrol_meta.feature
enrol/meta/tests/plugin_test.php
enrol/paypal/lib.php
enrol/paypal/tests/paypal_test.php
enrol/self/lib.php
enrol/self/tests/behat/self_enrolment.feature
enrol/self/tests/self_test.php
files/externallib.php
filter/classes/external.php [new file with mode: 0644]
filter/mathjaxloader/db/upgrade.php
filter/mathjaxloader/db/upgradelib.php
filter/mathjaxloader/filter.php
filter/mathjaxloader/readme_moodle.txt
filter/mathjaxloader/settings.php
filter/mathjaxloader/tests/filter_test.php [new file with mode: 0644]
filter/mathjaxloader/tests/upgradelib_test.php
filter/mathjaxloader/version.php
filter/tests/external_test.php [new file with mode: 0644]
filter/urltolink/filter.php
group/externallib.php
group/tests/behat/create_groups.feature
install/lang/et/install.php
install/lang/ja/install.php
install/lang/lt/admin.php
install/lang/lt/install.php
install/lang/mi/langconfig.php
lang/en/admin.php
lang/en/analytics.php
lang/en/calendar.php
lang/en/completion.php
lang/en/deprecated.txt
lang/en/error.php
lang/en/hub.php
lang/en/moodle.php
lang/en/role.php
lib/accesslib.php
lib/adminlib.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.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 [deleted file]
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-text.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/chartjs-lazy.min.js
lib/amd/build/loglevel.min.js
lib/amd/build/mustache.min.js
lib/amd/src/chartjs-lazy.js
lib/amd/src/loglevel.js
lib/amd/src/mustache.js
lib/behat/classes/partial_named_selector.php
lib/behat/form_field/behat_form_select.php
lib/bennu/readme_moodle.txt
lib/classes/access/get_user_capability_course_helper.php [new file with mode: 0644]
lib/classes/analytics/analyser/student_enrolments.php
lib/classes/analytics/target/course_dropout.php
lib/classes/analytics/target/no_teaching.php
lib/classes/component.php
lib/classes/event/course_module_completion_updated.php
lib/classes/event/user_info_category_created.php [new file with mode: 0644]
lib/classes/event/user_info_category_deleted.php [new file with mode: 0644]
lib/classes/event/user_info_category_updated.php [new file with mode: 0644]
lib/classes/event/user_info_field_created.php [new file with mode: 0644]
lib/classes/event/user_info_field_deleted.php [new file with mode: 0644]
lib/classes/event/user_info_field_updated.php [new file with mode: 0644]
lib/classes/external/coursecat_summary_exporter.php [new file with mode: 0644]
lib/classes/hub/api.php [new file with mode: 0644]
lib/classes/hub/course_publication_form.php [new file with mode: 0644]
lib/classes/hub/publication.php [new file with mode: 0644]
lib/classes/hub/registration.php [new file with mode: 0644]
lib/classes/hub/site_registration_form.php [new file with mode: 0644]
lib/classes/hub/site_unregistration_form.php [new file with mode: 0644]
lib/classes/oauth2/client.php
lib/classes/output/icon_system_fontawesome.php
lib/classes/plugin_manager.php
lib/classes/task/analytics_cleanup_task.php [moved from blocks/messages/db/access.php with 50% similarity]
lib/classes/task/registration_cron_task.php
lib/classes/task/search_index_task.php
lib/classes/task/search_optimize_task.php
lib/classes/text.php
lib/completionlib.php
lib/coursecatlib.php
lib/db/access.php
lib/db/install.xml
lib/db/services.php
lib/db/tasks.php
lib/db/upgrade.php
lib/dml/moodle_database.php
lib/dml/mysqli_native_moodle_database.php
lib/dml/pgsql_native_moodle_database.php
lib/dml/tests/dml_test.php
lib/enrollib.php
lib/filebrowser/file_info_context_course.php
lib/filebrowser/tests/file_browser_test.php
lib/filelib.php
lib/filestorage/file_storage.php
lib/filestorage/file_system.php
lib/flickrclient.php [new file with mode: 0644]
lib/flickrlib.php
lib/form/form.js
lib/formslib.php
lib/html2text/Html2Text.php
lib/htmlpurifier/HTMLPurifier.php
lib/htmlpurifier/HTMLPurifier.safe-includes.php
lib/htmlpurifier/HTMLPurifier/AttrDef.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS.php
lib/htmlpurifier/HTMLPurifier/AttrDef/CSS/Color.php
lib/htmlpurifier/HTMLPurifier/AttrDef/URI/Host.php
lib/htmlpurifier/HTMLPurifier/AttrTransform/TargetNoopener.php [new file with mode: 0644]
lib/htmlpurifier/HTMLPurifier/ChildDef/List.php
lib/htmlpurifier/HTMLPurifier/Config.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema.php
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema.ser
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.AggressivelyRemoveScript.txt [new file with mode: 0644]
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/Core.LegacyEntityDecoder.txt [new file with mode: 0644]
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/HTML.TargetNoopener.txt [new file with mode: 0644]
lib/htmlpurifier/HTMLPurifier/ConfigSchema/schema/URI.DefaultScheme.txt
lib/htmlpurifier/HTMLPurifier/DefinitionCache/Serializer.php
lib/htmlpurifier/HTMLPurifier/Encoder.php
lib/htmlpurifier/HTMLPurifier/EntityParser.php
lib/htmlpurifier/HTMLPurifier/Filter/ExtractStyleBlocks.php
lib/htmlpurifier/HTMLPurifier/Generator.php
lib/htmlpurifier/HTMLPurifier/HTMLModule/TargetNoopener.php [new file with mode: 0644]
lib/htmlpurifier/HTMLPurifier/HTMLModuleManager.php
lib/htmlpurifier/HTMLPurifier/Lexer.php
lib/htmlpurifier/HTMLPurifier/Lexer/DOMLex.php
lib/htmlpurifier/HTMLPurifier/Lexer/DirectLex.php
lib/htmlpurifier/HTMLPurifier/Lexer/PH5P.php
lib/htmlpurifier/HTMLPurifier/Strategy/MakeWellFormed.php
lib/htmlpurifier/HTMLPurifier/Token.php
lib/htmlpurifier/HTMLPurifier/URI.php
lib/htmlpurifier/readme_moodle.txt
lib/jquery/jquery-3.1.0.min.js [deleted file]
lib/jquery/jquery-3.2.1.js [moved from lib/jquery/jquery-3.1.0.js with 94% similarity]
lib/jquery/jquery-3.2.1.min.js [new file with mode: 0644]
lib/jquery/plugins.php
lib/markdown/License.md
lib/markdown/Markdown.php
lib/markdown/MarkdownExtra.php
lib/markdown/MarkdownInterface.php
lib/markdown/Readme.md
lib/markdown/readme_moodle.txt
lib/maxmind/GeoIp2/Database/Reader.php
lib/maxmind/GeoIp2/Exception/HttpException.php
lib/maxmind/GeoIp2/Exception/InvalidRequestException.php
lib/maxmind/GeoIp2/Model/AbstractModel.php
lib/maxmind/GeoIp2/Model/AnonymousIp.php
lib/maxmind/GeoIp2/Model/Asn.php [new file with mode: 0644]
lib/maxmind/GeoIp2/Model/City.php
lib/maxmind/GeoIp2/Model/ConnectionType.php
lib/maxmind/GeoIp2/Model/Country.php
lib/maxmind/GeoIp2/Model/Domain.php
lib/maxmind/GeoIp2/Model/Enterprise.php
lib/maxmind/GeoIp2/Model/Insights.php
lib/maxmind/GeoIp2/Model/Isp.php
lib/maxmind/GeoIp2/ProviderInterface.php
lib/maxmind/GeoIp2/Record/AbstractPlaceRecord.php
lib/maxmind/GeoIp2/Record/AbstractRecord.php
lib/maxmind/GeoIp2/Record/City.php
lib/maxmind/GeoIp2/Record/Continent.php
lib/maxmind/GeoIp2/Record/Country.php
lib/maxmind/GeoIp2/Record/Location.php
lib/maxmind/GeoIp2/Record/MaxMind.php
lib/maxmind/GeoIp2/Record/Postal.php
lib/maxmind/GeoIp2/Record/RepresentedCountry.php
lib/maxmind/GeoIp2/Record/Subdivision.php
lib/maxmind/GeoIp2/Record/Traits.php
lib/maxmind/GeoIp2/WebService/Client.php
lib/maxmind/MaxMind/Db/Reader.php
lib/maxmind/readme_moodle.txt [moved from lib/maxmind/README_moodle.txt with 77% similarity]
lib/minify/matthiasmullie-minify/data/js/keywords_before.txt
lib/minify/matthiasmullie-minify/data/js/operators_after.txt
lib/minify/matthiasmullie-minify/src/CSS.php
lib/minify/matthiasmullie-minify/src/JS.php
lib/minify/matthiasmullie-minify/src/Minify.php
lib/minify/matthiasmullie-pathconverter/src/Converter.php
lib/minify/matthiasmullie-pathconverter/src/ConverterInterface.php [new file with mode: 0644]
lib/minify/matthiasmullie-pathconverter/src/NoConverter.php [new file with mode: 0644]
lib/minify/readme_moodle.txt
lib/mlbackend/php/classes/processor.php
lib/mlbackend/python/classes/processor.php
lib/moodlelib.php
lib/mustache/readme_moodle.txt
lib/mustache/src/Mustache/Autoloader.php
lib/mustache/src/Mustache/Cache.php
lib/mustache/src/Mustache/Cache/AbstractCache.php
lib/mustache/src/Mustache/Cache/FilesystemCache.php
lib/mustache/src/Mustache/Cache/NoopCache.php
lib/mustache/src/Mustache/Compiler.php
lib/mustache/src/Mustache/Context.php
lib/mustache/src/Mustache/Engine.php
lib/mustache/src/Mustache/Exception.php
lib/mustache/src/Mustache/Exception/InvalidArgumentException.php
lib/mustache/src/Mustache/Exception/LogicException.php
lib/mustache/src/Mustache/Exception/RuntimeException.php
lib/mustache/src/Mustache/Exception/SyntaxException.php
lib/mustache/src/Mustache/Exception/UnknownFilterException.php
lib/mustache/src/Mustache/Exception/UnknownHelperException.php
lib/mustache/src/Mustache/Exception/UnknownTemplateException.php
lib/mustache/src/Mustache/HelperCollection.php
lib/mustache/src/Mustache/LambdaHelper.php
lib/mustache/src/Mustache/Loader.php
lib/mustache/src/Mustache/Loader/ArrayLoader.php
lib/mustache/src/Mustache/Loader/CascadingLoader.php
lib/mustache/src/Mustache/Loader/FilesystemLoader.php
lib/mustache/src/Mustache/Loader/InlineLoader.php
lib/mustache/src/Mustache/Loader/MutableLoader.php
lib/mustache/src/Mustache/Loader/ProductionFilesystemLoader.php [new file with mode: 0644]
lib/mustache/src/Mustache/Loader/StringLoader.php
lib/mustache/src/Mustache/Logger.php
lib/mustache/src/Mustache/Logger/AbstractLogger.php
lib/mustache/src/Mustache/Logger/StreamLogger.php
lib/mustache/src/Mustache/Parser.php
lib/mustache/src/Mustache/Source.php [new file with mode: 0644]
lib/mustache/src/Mustache/Source/FilesystemSource.php [new file with mode: 0644]
lib/mustache/src/Mustache/Template.php
lib/mustache/src/Mustache/Tokenizer.php
lib/myprofilelib.php
lib/navigationlib.php
lib/oauthlib.php
lib/outputcomponents.php
lib/pear/HTML/QuickForm/Rule/Compare.php
lib/pear/HTML/QuickForm/date.php
lib/pear/PEAR.php
lib/pear/README_MOODLE.txt
lib/phpmailer/README.md
lib/phpmailer/README_MOODLE.txt
lib/phpmailer/VERSION
lib/phpmailer/changelog.md
lib/phpmailer/language/phpmailer.lang-ba.php [new file with mode: 0644]
lib/phpmailer/language/phpmailer.lang-cs.php [moved from lib/phpmailer/language/phpmailer.lang-cz.php with 95% similarity]
lib/phpmailer/language/phpmailer.lang-da.php [moved from lib/phpmailer/language/phpmailer.lang-dk.php with 100% similarity]
lib/phpmailer/language/phpmailer.lang-fr.php
lib/phpmailer/language/phpmailer.lang-nb.php [new file with mode: 0644]
lib/phpmailer/language/phpmailer.lang-nl.php
lib/phpmailer/language/phpmailer.lang-no.php [deleted file]
lib/phpmailer/language/phpmailer.lang-pt_br.php [moved from lib/phpmailer/language/phpmailer.lang-br.php with 65% similarity]
lib/phpmailer/language/phpmailer.lang-rs.php [moved from lib/phpmailer/language/phpmailer.lang-sr.php with 96% similarity]
lib/phpmailer/language/phpmailer.lang-sv.php [moved from lib/phpmailer/language/phpmailer.lang-se.php with 73% similarity]
lib/phpmailer/language/phpmailer.lang-tr.php
lib/phpmailer/language/phpmailer.lang-zh_cn.php
lib/phpmailer/moodle_phpmailer.php
lib/phpmailer/src/Exception.php [new file with mode: 0644]
lib/phpmailer/src/PHPMailer.php [moved from lib/phpmailer/class.phpmailer.php with 66% similarity]
lib/phpmailer/src/SMTP.php [moved from lib/phpmailer/class.smtp.php with 70% similarity]
lib/phpunit/classes/base_testcase.php
lib/requirejs/moodle-config.js
lib/requirejs/require.js
lib/requirejs/require.min.js
lib/scssphp/Base/Range.php
lib/scssphp/Block.php
lib/scssphp/Colors.php
lib/scssphp/Compiler.php
lib/scssphp/Compiler/Environment.php
lib/scssphp/Exception/CompilerException.php
lib/scssphp/Exception/ParserException.php
lib/scssphp/Exception/RangeException.php [new file with mode: 0644]
lib/scssphp/Exception/ServerException.php
lib/scssphp/Formatter.php
lib/scssphp/Formatter/Compact.php
lib/scssphp/Formatter/Compressed.php
lib/scssphp/Formatter/Crunched.php
lib/scssphp/Formatter/Debug.php
lib/scssphp/Formatter/Expanded.php
lib/scssphp/Formatter/Nested.php
lib/scssphp/Formatter/OutputBlock.php
lib/scssphp/Node.php
lib/scssphp/Node/Number.php
lib/scssphp/Parser.php
lib/scssphp/Server.php
lib/scssphp/Type.php
lib/scssphp/Util.php
lib/scssphp/Version.php
lib/scssphp/moodle_readme.txt
lib/setuplib.php
lib/simplepie/LICENSE.txt [new file with mode: 0644]
lib/simplepie/autoloader.php
lib/simplepie/library/SimplePie.php
lib/simplepie/library/SimplePie/Category.php
lib/simplepie/library/SimplePie/Content/Type/Sniffer.php
lib/simplepie/library/SimplePie/File.php
lib/simplepie/library/SimplePie/Item.php
lib/simplepie/library/SimplePie/Locator.php
lib/simplepie/library/SimplePie/Misc.php
lib/simplepie/library/SimplePie/Parse/Date.php
lib/simplepie/library/SimplePie/Sanitize.php
lib/simplepie/readme_moodle.txt
lib/spout/readme_moodle.txt
lib/spout/src/Spout/Common/Escaper/ODS.php
lib/spout/src/Spout/Common/Escaper/XLSX.php
lib/spout/src/Spout/Common/Helper/FileSystemHelper.php
lib/spout/src/Spout/Reader/AbstractReader.php
lib/spout/src/Spout/Reader/CSV/Reader.php
lib/spout/src/Spout/Reader/CSV/ReaderOptions.php [new file with mode: 0644]
lib/spout/src/Spout/Reader/CSV/RowIterator.php
lib/spout/src/Spout/Reader/CSV/Sheet.php
lib/spout/src/Spout/Reader/CSV/SheetIterator.php
lib/spout/src/Spout/Reader/Common/ReaderOptions.php [new file with mode: 0644]
lib/spout/src/Spout/Reader/Common/XMLProcessor.php [new file with mode: 0644]
lib/spout/src/Spout/Reader/ODS/Helper/CellValueFormatter.php
lib/spout/src/Spout/Reader/ODS/Helper/SettingsHelper.php [new file with mode: 0644]
lib/spout/src/Spout/Reader/ODS/Reader.php
lib/spout/src/Spout/Reader/ODS/ReaderOptions.php [new file with mode: 0644]
lib/spout/src/Spout/Reader/ODS/RowIterator.php
lib/spout/src/Spout/Reader/ODS/Sheet.php
lib/spout/src/Spout/Reader/ODS/SheetIterator.php
lib/spout/src/Spout/Reader/Wrapper/SimpleXMLElement.php [deleted file]
lib/spout/src/Spout/Reader/Wrapper/XMLReader.php
lib/spout/src/Spout/Reader/XLSX/Helper/CellHelper.php
lib/spout/src/Spout/Reader/XLSX/Helper/CellValueFormatter.php
lib/spout/src/Spout/Reader/XLSX/Helper/DateFormatHelper.php
lib/spout/src/Spout/Reader/XLSX/Helper/SharedStringsHelper.php
lib/spout/src/Spout/Reader/XLSX/Helper/SheetHelper.php
lib/spout/src/Spout/Reader/XLSX/Helper/StyleHelper.php
lib/spout/src/Spout/Reader/XLSX/Reader.php
lib/spout/src/Spout/Reader/XLSX/ReaderOptions.php [new file with mode: 0644]
lib/spout/src/Spout/Reader/XLSX/RowIterator.php
lib/spout/src/Spout/Reader/XLSX/Sheet.php
lib/spout/src/Spout/Reader/XLSX/SheetIterator.php
lib/spout/src/Spout/Writer/AbstractWriter.php
lib/spout/src/Spout/Writer/Common/Helper/AbstractStyleHelper.php
lib/spout/src/Spout/Writer/Common/Helper/CellHelper.php
lib/spout/src/Spout/Writer/Common/Internal/AbstractWorkbook.php
lib/spout/src/Spout/Writer/Common/Sheet.php
lib/spout/src/Spout/Writer/ODS/Helper/FileSystemHelper.php
lib/spout/src/Spout/Writer/ODS/Helper/StyleHelper.php
lib/spout/src/Spout/Writer/ODS/Internal/Workbook.php
lib/spout/src/Spout/Writer/ODS/Internal/Worksheet.php
lib/spout/src/Spout/Writer/ODS/Writer.php
lib/spout/src/Spout/Writer/Style/Style.php
lib/spout/src/Spout/Writer/Style/StyleBuilder.php
lib/spout/src/Spout/Writer/WriterInterface.php
lib/spout/src/Spout/Writer/XLSX/Helper/FileSystemHelper.php
lib/spout/src/Spout/Writer/XLSX/Internal/Workbook.php
lib/spout/src/Spout/Writer/XLSX/Internal/Worksheet.php
lib/tcpdf/CHANGELOG.TXT
lib/tcpdf/README.TXT
lib/tcpdf/composer.json
lib/tcpdf/include/tcpdf_static.php
lib/tcpdf/readme_moodle.txt
lib/tcpdf/tcpdf.php
lib/templates/pix_icon_fontawesome.mustache
lib/testing/generator/data_generator.php
lib/tests/accesslib_test.php
lib/tests/behat/behat_data_generators.php
lib/tests/completionlib_test.php
lib/tests/coursecatlib_test.php
lib/tests/event_profile_field_test.php [new file with mode: 0644]
lib/tests/filelib_test.php
lib/tests/htmlpurifier_test.php
lib/tests/markdown_test.php
lib/tests/moodlelib_test.php
lib/tests/setuplib_test.php
lib/thirdpartylibs.xml
lib/upgrade.txt
lib/upgradelib.php
lib/webdavlib.php
media/player/videojs/amd/build/Youtube-lazy.min.js
media/player/videojs/amd/build/loader.min.js
media/player/videojs/amd/build/video-lazy.min.js
media/player/videojs/amd/build/videojs-flash-lazy.min.js [new file with mode: 0644]
media/player/videojs/amd/src/Youtube-lazy.js
media/player/videojs/amd/src/loader.js
media/player/videojs/amd/src/video-lazy.js
media/player/videojs/amd/src/videojs-flash-lazy.js [new file with mode: 0644]
media/player/videojs/classes/plugin.php
media/player/videojs/readme_moodle.txt
media/player/videojs/styles.css
media/player/videojs/thirdpartylibs.xml
media/player/videojs/videojs/lang/ar.js
media/player/videojs/videojs/lang/de.js
media/player/videojs/videojs/lang/en.js
media/player/videojs/videojs/lang/es.js
media/player/videojs/videojs/lang/fr.js
media/player/videojs/videojs/lang/gl.js [new file with mode: 0644]
media/player/videojs/videojs/lang/nl.js
media/player/videojs/videojs/lang/pt-PT.js [new file with mode: 0644]
media/player/videojs/videojs/lang/sk.js [new file with mode: 0644]
media/player/videojs/videojs/lang/tr.js
media/player/videojs/videojs/lang/vi.js
media/player/videojs/videojs/lang/zh-CN.js
media/player/videojs/videojs/video-js.swf
media/player/vimeo/wsplayer.php [new file with mode: 0644]
message/classes/search/base_message.php
message/classes/search/message_received.php
message/classes/search/message_sent.php
message/externallib.php
message/tests/api_test.php
message/tests/behat/delete_all_messages.feature
message/tests/search_received_test.php [moved from message/tests/search_test_received.php with 77% similarity]
message/tests/search_sent_test.php [moved from message/tests/search_test_sent.php with 75% similarity]
mod/assign/amd/build/grading_actions.min.js
mod/assign/amd/build/grading_navigation.min.js
mod/assign/amd/build/grading_panel.min.js
mod/assign/amd/src/grading_actions.js
mod/assign/amd/src/grading_navigation.js
mod/assign/amd/src/grading_panel.js
mod/assign/feedback/editpdf/fpdi/LICENSE
mod/assign/feedback/editpdf/fpdi/filters/FilterASCII85.php
mod/assign/feedback/editpdf/fpdi/filters/FilterASCIIHexDecode.php
mod/assign/feedback/editpdf/fpdi/filters/FilterLZW.php
mod/assign/feedback/editpdf/fpdi/fpdf_tpl.php
mod/assign/feedback/editpdf/fpdi/fpdi.php
mod/assign/feedback/editpdf/fpdi/fpdi_bridge.php
mod/assign/feedback/editpdf/fpdi/fpdi_pdf_parser.php
mod/assign/feedback/editpdf/fpdi/pdf_context.php
mod/assign/feedback/editpdf/fpdi/pdf_parser.php
mod/assign/feedback/editpdf/fpdi/readme_moodle.txt
mod/assign/feedback/editpdf/thirdpartylibs.xml
mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-debug.js
mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor-min.js
mod/assign/feedback/editpdf/yui/build/moodle-assignfeedback_editpdf-editor/moodle-assignfeedback_editpdf-editor.js
mod/assign/feedback/editpdf/yui/src/editor/js/comment.js
mod/assign/lib.php
mod/assign/locallib.php
mod/assign/templates/grading_actions.mustache
mod/assign/tests/lib_test.php
mod/book/classes/search/chapter.php
mod/book/lang/en/book.php
mod/book/lib.php
mod/book/tests/behat/reorganize_chapters.feature [new file with mode: 0644]
mod/book/tests/search_test.php
mod/chat/chatd.php
mod/choice/lib.php
mod/choice/tests/lib_test.php
mod/data/backup/moodle2/backup_data_stepslib.php
mod/data/backup/moodle2/restore_data_stepslib.php
mod/data/classes/search/entry.php
mod/data/db/tag.php [moved from blocks/messages/lang/en/block_messages.php with 67% similarity]
mod/data/edit.php
mod/data/export.php
mod/data/export_form.php
mod/data/import.php
mod/data/lang/en/data.php
mod/data/lib.php
mod/data/locallib.php
mod/data/styles.css
mod/data/templates.php
mod/data/tests/behat/view_entries.feature
mod/data/tests/generator/lib.php
mod/data/tests/generator_test.php
mod/data/tests/lib_test.php
mod/data/tests/search_test.php
mod/data/version.php
mod/feedback/lang/en/feedback.php
mod/feedback/lib.php
mod/feedback/tests/lib_test.php
mod/forum/classes/search/post.php
mod/forum/db/install.xml
mod/forum/db/upgrade.php
mod/forum/lang/en/forum.php
mod/forum/lib.php
mod/forum/tests/search_test.php
mod/forum/version.php
mod/glossary/classes/search/entry.php
mod/glossary/lang/en/glossary.php
mod/glossary/lib.php
mod/glossary/tests/search_test.php
mod/lti/locallib.php
mod/lti/view.php
mod/quiz/attemptlib.php
mod/quiz/classes/structure.php
mod/quiz/lang/en/quiz.php
mod/quiz/locallib.php
mod/quiz/report/overview/report.php
mod/quiz/report/overview/tests/report_test.php
mod/quiz/report/responses/report.php
mod/quiz/report/statistics/tests/statistics_test.php
mod/quiz/tests/behat/editing_section_headings.feature
mod/quiz/tests/structure_test.php
mod/scorm/aicc.php
mod/survey/classes/search/activity.php
mod/survey/graph.php
mod/survey/lib.php
mod/survey/tests/search_test.php [new file with mode: 0644]
mod/wiki/classes/search/collaborative_page.php
mod/wiki/diff/diff_nwiki.php
mod/wiki/diff/difflib.php
mod/wiki/lang/en/wiki.php
mod/wiki/tests/search_test.php
mod/workshop/allocation/random/lib.php
mod/workshop/assessment.php
mod/workshop/classes/external.php
mod/workshop/classes/external/assessment_exporter.php [new file with mode: 0644]
mod/workshop/classes/external/submission_exporter.php [new file with mode: 0644]
mod/workshop/db/services.php
mod/workshop/form/assessment_form.php
mod/workshop/lib.php
mod/workshop/locallib.php
mod/workshop/submission.php
mod/workshop/tests/external_test.php
mod/workshop/tests/lib_test.php
mod/workshop/version.php
notes/externallib.php
phpunit.xml.dist
pix/i/categoryevent.svg [new file with mode: 0644]
pix/i/completion-auto-n-override.png [new file with mode: 0644]
pix/i/completion-auto-n-override.svg [new file with mode: 0644]
pix/i/completion-auto-y-override.png [new file with mode: 0644]
pix/i/completion-auto-y-override.svg [new file with mode: 0644]
pix/i/completion-manual-n-override.png [new file with mode: 0644]
pix/i/completion-manual-n-override.svg [new file with mode: 0644]
pix/i/completion-manual-y-override.png [new file with mode: 0644]
pix/i/completion-manual-y-override.svg [new file with mode: 0644]
portfolio/flickr/lib.php
question/classes/external.php
question/classes/statistics/questions/calculator.php
question/type/multianswer/questiontype.php
report/insights/classes/output/insight.php
report/insights/classes/output/insights_list.php
report/insights/lang/en/report_insights.php
report/insights/templates/insight.mustache
report/insights/templates/insight_details.mustache
report/insights/templates/insights_list.mustache
report/progress/amd/build/completion_override.min.js [new file with mode: 0644]
report/progress/amd/src/completion_override.js [new file with mode: 0644]
report/progress/index.php
report/progress/tests/behat/activity_completion_report.feature [new file with mode: 0644]
report/security/lang/en/report_security.php
repository/flickr/db/upgrade.php [new file with mode: 0644]
repository/flickr/lib.php
repository/flickr/version.php
repository/googledocs/lib.php
repository/onedrive/lib.php
repository/tests/behat/cancel_add_file.feature
search/classes/base.php
search/classes/base_activity.php
search/classes/base_block.php
search/classes/base_mod.php
search/classes/engine.php
search/classes/manager.php
search/classes/skip_future_documents_iterator.php [new file with mode: 0644]
search/cli/indexer.php
search/engine/solr/classes/engine.php
search/tests/base_activity_test.php
search/tests/base_block_test.php
search/tests/manager_test.php
search/upgrade.txt
tag/classes/external.php
tag/classes/tag.php
tags.txt [deleted file]
theme/boost/lang/en/theme_boost.php
theme/boost/lib.php
theme/boost/scss/moodle/calendar.scss
theme/boost/settings.php
theme/boost/templates/columns2.mustache
theme/boost/templates/mod_assign/grading_actions.mustache
theme/boost/tests/behat/behat_theme_boost_behat_blocks.php
theme/bootstrapbase/layout/columns2.php
theme/bootstrapbase/less/moodle/bs4-compat.less
theme/bootstrapbase/less/moodle/calendar.less
theme/bootstrapbase/style/moodle.css
theme/bootstrapbase/templates/report_insights/insight.mustache [deleted file]
theme/bootstrapbase/templates/report_insights/insight_details.mustache [deleted file]
theme/bootstrapbase/templates/report_insights/insights_list.mustache [deleted file]
theme/upgrade.txt
user/amd/build/unified_filter.min.js
user/amd/src/unified_filter.js
user/classes/search/user.php
user/editlib.php
user/externallib.php
user/lib.php
user/profile/definelib.php
user/profile/field/checkbox/field.class.php
user/profile/field/menu/field.class.php
user/profile/field/upgrade.txt [new file with mode: 0644]
user/profile/lib.php
user/templates/unified_filter.mustache
user/tests/behat/edit_user_enrolment.feature
user/tests/behat/filter_participants.feature
user/tests/search_test.php
user/tests/userlib_test.php
version.php
webservice/upgrade.txt
webservice/upload.php
webservice/xmlrpc/lib.php

index 0622612..7d19e9c 100644 (file)
@@ -62,6 +62,8 @@ lib/validateurlsyntax.php
 media/player/videojs/amd/src/video-lazy.js
 media/player/videojs/amd/src/Youtube-lazy.js
 media/player/videojs/videojs/
+media/player/videojs/amd/src/videojs-flash-lazy.js
+media/player/videojs/videojs/video-js.swf
 mod/assign/feedback/editpdf/fpdi/
 repository/s3/S3.php
 theme/boost/scss/bootstrap/
index cfcf702..c35c560 100644 (file)
@@ -63,6 +63,8 @@ lib/validateurlsyntax.php
 media/player/videojs/amd/src/video-lazy.js
 media/player/videojs/amd/src/Youtube-lazy.js
 media/player/videojs/videojs/
+media/player/videojs/amd/src/videojs-flash-lazy.js
+media/player/videojs/videojs/video-js.swf
 mod/assign/feedback/editpdf/fpdi/
 repository/s3/S3.php
 theme/boost/scss/bootstrap/
index ba80a96..e8f0816 100644 (file)
@@ -857,15 +857,16 @@ if ($updateschecker->enabled()) {
 
 $buggyiconvnomb = (!function_exists('mb_convert_encoding') and @iconv('UTF-8', 'UTF-8//IGNORE', '100'.chr(130).'€') !== '100€');
 //check if the site is registered on Moodle.org
-$registered = $DB->count_records('registration_hubs', array('huburl' => HUB_MOODLEORGHUBURL, 'confirmed' => 1));
+$registered = \core\hub\registration::is_registered();
 // Check if there are any cache warnings.
 $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);
+$mobileconfigured = !empty($CFG->enablemobilewebservice);
 
 // Check if a directory with development libraries exists.
-if (is_dir($CFG->dirroot.'/vendor') || is_dir($CFG->dirroot.'/node_modules')) {
+if (empty($CFG->disabledevlibdirscheck) && (is_dir($CFG->dirroot.'/vendor') || is_dir($CFG->dirroot.'/node_modules'))) {
     $devlibdir = true;
 } else {
     $devlibdir = false;
@@ -877,4 +878,5 @@ $output = $PAGE->get_renderer('core', 'admin');
 
 echo $output->admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed, $cronoverdue, $dbproblems,
                                        $maintenancemode, $availableupdates, $availableupdatesfetch, $buggyiconvnomb,
-                                       $registered, $cachewarnings, $eventshandlers, $themedesignermode, $devlibdir);
+                                       $registered, $cachewarnings, $eventshandlers, $themedesignermode, $devlibdir,
+                                       $mobileconfigured);
index 77b2fb2..7fe7689 100644 (file)
@@ -20,7 +20,7 @@
 //                                                                       //
 ///////////////////////////////////////////////////////////////////////////
 
-/*
+/**
  * @package    moodle
  * @subpackage registration
  * @author     Jerome Mouneyrac <jerome@mouneyrac.com>
@@ -36,7 +36,6 @@
 
 require('../../config.php');
 require_once($CFG->libdir . '/adminlib.php');
-require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
 
 $newtoken = optional_param('newtoken', '', PARAM_ALPHANUM);
 $url = optional_param('url', '', PARAM_URL);
@@ -44,7 +43,11 @@ $hubname = optional_param('hubname', '', PARAM_TEXT);
 $token = optional_param('token', '', PARAM_TEXT);
 $error = optional_param('error', '', PARAM_ALPHANUM);
 
-admin_externalpage_setup('registrationhubs');
+admin_externalpage_setup('registrationmoodleorg');
+
+if ($url !== HUB_MOODLEORGHUBURL) {
+    throw new moodle_exception('errorotherhubsnotsupported', 'hub');
+}
 
 if (!empty($error) and $error == 'urlalreadyexist') {
     throw new moodle_exception('urlalreadyregistered', 'hub',
@@ -52,38 +55,20 @@ if (!empty($error) and $error == 'urlalreadyexist') {
 }
 
 //check that we are waiting a confirmation from this hub, and check that the token is correct
-$registrationmanager = new registration_manager();
-$registeredhub = $registrationmanager->get_unconfirmedhub($url);
-if (!empty($registeredhub) and $registeredhub->token == $token) {
-
-    echo $OUTPUT->header();
-    echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
+core\hub\registration::confirm_registration($token, $newtoken, $hubname);
 
-    $registeredhub->token = $newtoken;
-    $registeredhub->confirmed = 1;
-    $registeredhub->hubname = $hubname;
-    $registrationmanager->update_registeredhub($registeredhub);
+echo $OUTPUT->header();
+echo $OUTPUT->heading(get_string('registrationconfirmed', 'hub'), 3, 'main');
 
-    // Display notification message.
-    echo $OUTPUT->notification(get_string('registrationconfirmedon', 'hub'), 'notifysuccess');
+// Display notification message.
+echo $OUTPUT->notification(get_string('registrationconfirmedon', 'hub'), 'notifysuccess');
 
-    //display continue button
-    $registrationpage = new moodle_url('/admin/registration/index.php');
-    $continuebutton = $OUTPUT->render(new single_button($registrationpage, get_string('continue', 'hub')));
-    $continuebutton = html_writer::tag('div', $continuebutton, array('class' => 'mdl-align'));
-    echo $continuebutton;
+// Display continue button.
+$registrationpage = new moodle_url('/admin/registration/index.php');
+$continuebutton = $OUTPUT->render(new single_button($registrationpage, get_string('continue')));
+$continuebutton = html_writer::tag('div', $continuebutton, array('class' => 'mdl-align'));
+echo $continuebutton;
 
-    if (!extension_loaded('xmlrpc')) {
-        //display notice about xmlrpc
-        $xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
-        $xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub');
-        echo $OUTPUT->notification($xmlrpcnotification);
-    }
-
-    echo $OUTPUT->footer();
-} else {
-    throw new moodle_exception('wrongtoken', 'hub',
-            $CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
-}
+echo $OUTPUT->footer();
 
 
index 0d70879..6fe9553 100644 (file)
@@ -20,7 +20,7 @@
 //                                                                       //
 ///////////////////////////////////////////////////////////////////////////
 
-/*
+/**
  * @package    moodle
  * @subpackage registration
  * @author     Jerome Mouneyrac <jerome@mouneyrac.com>
  * The forms needed by registration pages.
  */
 
+defined('MOODLE_INTERNAL') || die();
 
-require_once($CFG->libdir . '/formslib.php');
-require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
-
-/**
- * This form display a unregistration form.
- */
-class site_unregistration_form extends moodleform {
-
-    public function definition() {
-        $mform = & $this->_form;
-        $mform->addElement('header', 'site', get_string('unregister', 'hub'));
-
-        $huburl = $this->_customdata['huburl'];
-        $hubname = $this->_customdata['hubname'];
-
-        $unregisterlabel = get_string('unregister', 'hub');
-        $mform->addElement('checkbox', 'unpublishalladvertisedcourses', '',
-                ' ' . get_string('unpublishalladvertisedcourses', 'hub'));
-        $mform->setType('unpublishalladvertisedcourses', PARAM_INT);
-        $mform->addElement('checkbox', 'unpublishalluploadedcourses', '',
-                ' ' . get_string('unpublishalluploadedcourses', 'hub'));
-        $mform->setType('unpublishalluploadedcourses', PARAM_INT);
-
-        $mform->addElement('hidden', 'confirm', 1);
-        $mform->setType('confirm', PARAM_INT);
-        $mform->addElement('hidden', 'unregistration', 1);
-        $mform->setType('unregistration', PARAM_INT);
-        $mform->addElement('hidden', 'huburl', $huburl);
-        $mform->setType('huburl', PARAM_URL);
-        $mform->addElement('hidden', 'hubname', $hubname);
-        $mform->setType('hubname', PARAM_TEXT);
-
-        $this->add_action_buttons(true, $unregisterlabel);
-    }
-
-}
-
-/**
- * This form display a clean registration data form.
- */
-class site_clean_registration_data_form extends moodleform {
-
-    public function definition() {
-        $mform = & $this->_form;
-        $mform->addElement('header', 'site', get_string('unregister', 'hub'));
-
-        $huburl = $this->_customdata['huburl'];
-        $hubname = $this->_customdata['hubname'];
-
-
-        $unregisterlabel = get_string('forceunregister', 'hub');
-        $mform->addElement('static', '', get_string('warning', 'hub'), get_string('forceunregisterconfirmation', 'hub', $hubname));
-
-        $mform->addElement('hidden', 'confirm', 1);
-        $mform->setType('confirm', PARAM_INT);
-        $mform->addElement('hidden', 'unregistration', 1);
-        $mform->setType('unregistration', PARAM_INT);
-        $mform->addElement('hidden', 'cleanregdata', 1);
-        $mform->setType('cleanregdata', PARAM_INT);
-        $mform->addElement('hidden', 'huburl', $huburl);
-        $mform->setType('huburl', PARAM_URL);
-        $mform->addElement('hidden', 'hubname', $hubname);
-        $mform->setType('hubname', PARAM_TEXT);
-
-        $this->add_action_buttons(true, $unregisterlabel);
-    }
-
-}
-
-/**
- * This form display a hub selector.
- * The hub list is retrieved from Moodle.org hub directory.
- * Also displayed, a text field to enter private hub url + its password
- */
-class hub_selector_form extends moodleform {
-
-    public function definition() {
-        global $CFG, $OUTPUT;
-        $mform = & $this->_form;
-        $mform->addElement('header', 'site', get_string('selecthub', 'hub'));
-
-        //retrieve the hub list on the hub directory by web service
-        $function = 'hubdirectory_get_hubs';
-        $params = array();
-        $serverurl = HUB_HUBDIRECTORYURL . "/local/hubdirectory/webservice/webservices.php";
-        require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
-        $xmlrpcclient = new webservice_xmlrpc_client($serverurl, 'publichubdirectory');
-        try {
-            $hubs = $xmlrpcclient->call($function, $params);
-        } catch (Exception $e) {
-            $error = $OUTPUT->notification(get_string('errorhublisting', 'hub', $e->getMessage()));
-            $mform->addElement('static', 'errorhub', '', $error);
-            $hubs = array();
-        }
-
-        //remove moodle.org from the hub list
-        foreach ($hubs as $key => $hub) {
-            if ($hub['url'] == HUB_MOODLEORGHUBURL || $hub['url'] == HUB_OLDMOODLEORGHUBURL) {
-                unset($hubs[$key]);
-            }
-        }
-
-        //Public hub list
-        $options = array();
-        foreach ($hubs as $hub) {
-            //to not display a name longer than 100 character (too big)
-            if (core_text::strlen($hub['name']) > 100) {
-                $hubname = core_text::substr($hub['name'], 0, 100);
-                $hubname = $hubname . "...";
-            } else {
-                $hubname = $hub['name'];
-            }
-            $options[$hub['url']] = $hubname;
-            $mform->addElement('hidden', clean_param($hub['url'], PARAM_ALPHANUMEXT), $hubname);
-            $mform->setType(clean_param($hub['url'], PARAM_ALPHANUMEXT), PARAM_ALPHANUMEXT);
-        }
-        if (!empty($hubs)) {
-            $mform->addElement('select', 'publichub', get_string('publichub', 'hub'),
-                    $options, array("size" => 15));
-            $mform->setType('publichub', PARAM_URL);
-        }
-
-        $mform->addElement('static', 'or', '', get_string('orenterprivatehub', 'hub'));
-
-        //Private hub
-        $mform->addElement('text', 'unlistedurl', get_string('privatehuburl', 'hub'),
-                array('class' => 'registration_textfield'));
-        $mform->setType('unlistedurl', PARAM_URL);
-        $mform->addElement('text', 'password', get_string('password'),
-                array('class' => 'registration_textfield'));
-        $mform->setType('password', PARAM_RAW);
-
-        $this->add_action_buttons(false, get_string('selecthub', 'hub'));
-    }
-
-    /**
-     * Check the unlisted URL is a URL
-     */
-    function validation($data, $files) {
-        global $CFG;
-        $errors = parent::validation($data, $files);
-
-        $unlistedurl = $this->_form->_submitValues['unlistedurl'];
-
-        if (empty($unlistedurl)) {
-            $errors['unlistedurl'] = get_string('badurlformat', 'hub');
-        }
-
-        return $errors;
-    }
-
-}
-
-/**
- * The site registration form. Information will be sent to a given hub.
- */
-class site_registration_form extends moodleform {
-
-    public function definition() {
-        global $CFG, $DB;
-
-        $strrequired = get_string('required');
-        $mform = & $this->_form;
-        $huburl = $this->_customdata['huburl'];
-        $hubname = $this->_customdata['hubname'];
-        $password = $this->_customdata['password'];
-        $admin = get_admin();
-        $site = get_site();
-
-        //retrieve config for this hub and set default if they don't exist
-        $cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
-        $sitename = get_config('hub', 'site_name_' . $cleanhuburl);
-        if ($sitename === false) {
-            $sitename = format_string($site->fullname, true, array('context' => context_course::instance(SITEID)));
-        }
-        $sitedescription = get_config('hub', 'site_description_' . $cleanhuburl);
-        if ($sitedescription === false) {
-            $sitedescription = $site->summary;
-        }
-        $contactname = get_config('hub', 'site_contactname_' . $cleanhuburl);
-        if ($contactname === false) {
-            $contactname = fullname($admin, true);
-        }
-        $contactemail = get_config('hub', 'site_contactemail_' . $cleanhuburl);
-        if ($contactemail === false) {
-            $contactemail = $admin->email;
-        }
-        $contactphone = get_config('hub', 'site_contactphone_' . $cleanhuburl);
-        if ($contactphone === false) {
-            $contactphone = $admin->phone1;
-        }
-        $imageurl = get_config('hub', 'site_imageurl_' . $cleanhuburl);
-        $privacy = get_config('hub', 'site_privacy_' . $cleanhuburl);
-        $address = get_config('hub', 'site_address_' . $cleanhuburl);
-        if ($address === false) {
-            $address = '';
-        }
-        $region = get_config('hub', 'site_region_' . $cleanhuburl);
-        $country = get_config('hub', 'site_country_' . $cleanhuburl);
-        if (empty($country)) {
-            $country = $admin->country ?: $CFG->country;
-        }
-        $language = get_config('hub', 'site_language_' . $cleanhuburl);
-        if ($language === false) {
-            $language = explode('_', current_language())[0];
-        }
-        $geolocation = get_config('hub', 'site_geolocation_' . $cleanhuburl);
-        if ($geolocation === false) {
-            $geolocation = '';
-        }
-        $contactable = get_config('hub', 'site_contactable_' . $cleanhuburl);
-        $emailalert = get_config('hub', 'site_emailalert_' . $cleanhuburl);
-        $emailalert = ($emailalert === false || $emailalert) ? 1 : 0;
-        $coursesnumber = get_config('hub', 'site_coursesnumber_' . $cleanhuburl);
-        $usersnumber = get_config('hub', 'site_usersnumber_' . $cleanhuburl);
-        $roleassignmentsnumber = get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl);
-        $postsnumber = get_config('hub', 'site_postsnumber_' . $cleanhuburl);
-        $questionsnumber = get_config('hub', 'site_questionsnumber_' . $cleanhuburl);
-        $resourcesnumber = get_config('hub', 'site_resourcesnumber_' . $cleanhuburl);
-        $badgesnumber = get_config('hub', 'site_badges_' . $cleanhuburl);
-        $issuedbadgesnumber = get_config('hub', 'site_issuedbadges_' . $cleanhuburl);
-        $mediancoursesize = get_config('hub', 'site_mediancoursesize_' . $cleanhuburl);
-        $participantnumberaveragecfg = get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl);
-        $modulenumberaveragecfg = get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl);
-        // Mobile related information.
-        $mobileservicesenabled = get_config('hub', 'site_mobileservicesenabled_' . $cleanhuburl);
-        $mobilenotificationsenabled = get_config('hub', 'site_mobilenotificationsenabled_' . $cleanhuburl);
-        $registereduserdevices = get_config('hub', 'site_registereduserdevices_' . $cleanhuburl);
-        $registeredactiveuserdevices = get_config('hub', 'site_registeredactiveuserdevices_' . $cleanhuburl);
-
-        //hidden parameters
-        $mform->addElement('hidden', 'huburl', $huburl);
-        $mform->setType('huburl', PARAM_URL);
-        $mform->addElement('hidden', 'hubname', $hubname);
-        $mform->setType('hubname', PARAM_TEXT);
-        $mform->addElement('hidden', 'password', $password);
-        $mform->setType('password', PARAM_RAW);
-
-        //the input parameters
-        $mform->addElement('header', 'moodle', get_string('registrationinfo', 'hub'));
-
-        $mform->addElement('text', 'name', get_string('sitename', 'hub'),
-                array('class' => 'registration_textfield'));
-        $mform->addRule('name', $strrequired, 'required', null, 'client');
-        $mform->setType('name', PARAM_TEXT);
-        $mform->setDefault('name', $sitename);
-        $mform->addHelpButton('name', 'sitename', 'hub');
-
-        $options = array();
-        $registrationmanager = new registration_manager();
-        $options[HUB_SITENOTPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITENOTPUBLISHED);
-        $options[HUB_SITENAMEPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITENAMEPUBLISHED);
-        $options[HUB_SITELINKPUBLISHED] = $registrationmanager->get_site_privacy_string(HUB_SITELINKPUBLISHED);
-        $mform->addElement('select', 'privacy', get_string('siteprivacy', 'hub'), $options);
-        $mform->setDefault('privacy', $privacy);
-        $mform->setType('privacy', PARAM_ALPHA);
-        $mform->addHelpButton('privacy', 'privacy', 'hub');
-        unset($options);
-
-        $mform->addElement('textarea', 'description', get_string('sitedesc', 'hub'),
-                array('rows' => 8, 'cols' => 41));
-        $mform->addRule('description', $strrequired, 'required', null, 'client');
-        $mform->setDefault('description', $sitedescription);
-        $mform->setType('description', PARAM_TEXT);
-        $mform->addHelpButton('description', 'sitedesc', 'hub');
-
-        $languages = get_string_manager()->get_list_of_languages();
-        core_collator::asort($languages);
-        $mform->addElement('select', 'language', get_string('sitelang', 'hub'),
-                $languages);
-        $mform->setType('language', PARAM_ALPHANUMEXT);
-        $mform->addHelpButton('language', 'sitelang', 'hub');
-        $mform->setDefault('language', $language);
-
-        $mform->addElement('textarea', 'address', get_string('postaladdress', 'hub'),
-                array('rows' => 4, 'cols' => 41));
-        $mform->setType('address', PARAM_TEXT);
-        $mform->setDefault('address', $address);
-        $mform->addHelpButton('address', 'postaladdress', 'hub');
-
-        //TODO: use the region array I generated
-//        $mform->addElement('select', 'region', get_string('selectaregion'), array('-' => '-'));
-//        $mform->setDefault('region', $region);
-        $mform->addElement('hidden', 'regioncode', '-');
-        $mform->setType('regioncode', PARAM_ALPHANUMEXT);
-
-        $countries = ['' => ''] + get_string_manager()->get_list_of_countries();
-        $mform->addElement('select', 'countrycode', get_string('sitecountry', 'hub'), $countries);
-        $mform->setDefault('countrycode', $country);
-        $mform->setType('countrycode', PARAM_ALPHANUMEXT);
-        $mform->addHelpButton('countrycode', 'sitecountry', 'hub');
-        $mform->addRule('countrycode', $strrequired, 'required', null, 'client');
-
-        $mform->addElement('text', 'geolocation', get_string('sitegeolocation', 'hub'),
-                array('class' => 'registration_textfield'));
-        $mform->setDefault('geolocation', $geolocation);
-        $mform->setType('geolocation', PARAM_RAW);
-        $mform->addHelpButton('geolocation', 'sitegeolocation', 'hub');
-
-        $mform->addElement('text', 'contactname', get_string('siteadmin', 'hub'),
-                array('class' => 'registration_textfield'));
-        $mform->addRule('contactname', $strrequired, 'required', null, 'client');
-        $mform->setType('contactname', PARAM_TEXT);
-        $mform->setDefault('contactname', $contactname);
-        $mform->addHelpButton('contactname', 'siteadmin', 'hub');
-
-        $mform->addElement('text', 'contactphone', get_string('sitephone', 'hub'),
-                array('class' => 'registration_textfield'));
-        $mform->setType('contactphone', PARAM_TEXT);
-        $mform->setDefault('contactphone', $contactphone);
-        $mform->addHelpButton('contactphone', 'sitephone', 'hub');
-        $mform->setForceLtr('contactphone');
-
-        $mform->addElement('text', 'contactemail', get_string('siteemail', 'hub'),
-                array('class' => 'registration_textfield'));
-        $mform->addRule('contactemail', $strrequired, 'required', null, 'client');
-        $mform->setType('contactemail', PARAM_EMAIL);
-        $mform->setDefault('contactemail', $contactemail);
-        $mform->addHelpButton('contactemail', 'siteemail', 'hub');
-
-        $options = array();
-        $options[0] = get_string("registrationcontactno");
-        $options[1] = get_string("registrationcontactyes");
-        $mform->addElement('select', 'contactable', get_string('siteregistrationcontact', 'hub'), $options);
-        $mform->setDefault('contactable', $contactable);
-        $mform->setType('contactable', PARAM_INT);
-        $mform->addHelpButton('contactable', 'siteregistrationcontact', 'hub');
-        unset($options);
-
-        $options = array();
-        $options[0] = get_string("registrationno");
-        $options[1] = get_string("registrationyes");
-        $mform->addElement('select', 'emailalert', get_string('siteregistrationemail', 'hub'), $options);
-        $mform->setDefault('emailalert', $emailalert);
-        $mform->setType('emailalert', PARAM_INT);
-        $mform->addHelpButton('emailalert', 'siteregistrationemail', 'hub');
-        unset($options);
-
-        //TODO site logo
-        $mform->addElement('hidden', 'imageurl', ''); //TODO: temporary
-        $mform->setType('imageurl', PARAM_URL);
-
-        $mform->addElement('static', 'urlstring', get_string('siteurl', 'hub'), $CFG->wwwroot);
-        $mform->addHelpButton('urlstring', 'siteurl', 'hub');
-
-        $mform->addElement('static', 'versionstring', get_string('siteversion', 'hub'), $CFG->version);
-        $mform->addElement('hidden', 'moodleversion', $CFG->version);
-        $mform->setType('moodleversion', PARAM_INT);
-        $mform->addHelpButton('versionstring', 'siteversion', 'hub');
-
-        $mform->addElement('static', 'releasestring', get_string('siterelease', 'hub'), $CFG->release);
-        $mform->addElement('hidden', 'moodlerelease', $CFG->release);
-        $mform->setType('moodlerelease', PARAM_TEXT);
-        $mform->addHelpButton('releasestring', 'siterelease', 'hub');
-
-        /// Display statistic that are going to be retrieve by the hub
-        $coursecount = $DB->count_records('course') - 1;
-        $usercount = $DB->count_records('user', array('deleted' => 0));
-        $roleassigncount = $DB->count_records('role_assignments');
-        $postcount = $DB->count_records('forum_posts');
-        $questioncount = $DB->count_records('question');
-        $resourcecount = $DB->count_records('resource');
-        require_once($CFG->dirroot . "/course/lib.php");
-        $participantnumberaverage = number_format(average_number_of_participants(), 2);
-        $modulenumberaverage = number_format(average_number_of_courses_modules(), 2);
-        require_once($CFG->libdir . '/badgeslib.php');
-        $badges = $DB->count_records_select('badge', 'status <> ' . BADGE_STATUS_ARCHIVED);
-        $issuedbadges = $DB->count_records('badge_issued');
-        // Mobile related information.
-        $ismobileenabled = false;
-        $aremobilenotificationsenabled = false;
-        $registereduserdevicescount = 0;
-        $registeredactiveuserdevicescount = 0;
-        if (!empty($CFG->enablewebservices) && !empty($CFG->enablemobilewebservice)) {
-            $ismobileenabled = true;
-            $registereduserdevicescount = $DB->count_records('user_devices');
-            $airnotifierextpath = $CFG->dirroot . '/message/output/airnotifier/externallib.php';
-            if (file_exists($airnotifierextpath)) { // Maybe some one uninstalled the plugin.
-                require_once($airnotifierextpath);
-                $aremobilenotificationsenabled = (bool) message_airnotifier_external::is_system_configured();
-                $registeredactiveuserdevicescount = $DB->count_records('message_airnotifier_devices', array('enable' => 1));
-            }
-        }
-
-        if (HUB_MOODLEORGHUBURL != $huburl) {
-            $mform->addElement('checkbox', 'courses', get_string('sendfollowinginfo', 'hub'),
-                    " " . get_string('coursesnumber', 'hub', $coursecount));
-            $mform->setDefault('courses', $coursesnumber != -1);
-            $mform->setType('courses', PARAM_INT);
-            $mform->addHelpButton('courses', 'sendfollowinginfo', 'hub');
-
-            $mform->addElement('checkbox', 'users', '',
-                    " " . get_string('usersnumber', 'hub', $usercount));
-            $mform->setDefault('users', $usersnumber != -1);
-            $mform->setType('users', PARAM_INT);
-
-            $mform->addElement('checkbox', 'roleassignments', '',
-                    " " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
-            $mform->setDefault('roleassignments', $roleassignmentsnumber != -1);
-            $mform->setType('roleassignments', PARAM_INT);
-
-            $mform->addElement('checkbox', 'posts', '',
-                    " " . get_string('postsnumber', 'hub', $postcount));
-            $mform->setDefault('posts', $postsnumber != -1);
-            $mform->setType('posts', PARAM_INT);
-
-            $mform->addElement('checkbox', 'questions', '',
-                    " " . get_string('questionsnumber', 'hub', $questioncount));
-            $mform->setDefault('questions', $questionsnumber != -1);
-            $mform->setType('questions', PARAM_INT);
-
-            $mform->addElement('checkbox', 'resources', '',
-                    " " . get_string('resourcesnumber', 'hub', $resourcecount));
-            $mform->setDefault('resources', $resourcesnumber != -1);
-            $mform->setType('resources', PARAM_INT);
-
-            $mform->addElement('checkbox', 'badges', '',
-                    " " . get_string('badgesnumber', 'hub', $badges));
-            $mform->setDefault('badges', $badgesnumber != -1);
-            $mform->setType('badges', PARAM_INT);
-
-            $mform->addElement('checkbox', 'issuedbadges', '',
-                    " " . get_string('issuedbadgesnumber', 'hub', $issuedbadges));
-            $mform->setDefault('issuedbadges', $issuedbadgesnumber != -1);
-            $mform->setType('issuedbadges', PARAM_INT);
-
-            $mform->addElement('checkbox', 'participantnumberaverage', '',
-                    " " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
-            $mform->setDefault('participantnumberaverage', $participantnumberaveragecfg != -1);
-            $mform->setType('participantnumberaverage', PARAM_FLOAT);
-
-            $mform->addElement('checkbox', 'modulenumberaverage', '',
-                    " " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
-            $mform->setDefault('modulenumberaverage', $modulenumberaveragecfg != -1);
-            $mform->setType('modulenumberaverage', PARAM_FLOAT);
-
-            $mobileservicestatus = $ismobileenabled ? 'yes' : 'no';
-            $mform->addElement('checkbox', 'mobileservicesenabled', '',
-                    " " . get_string('mobileservicesenabled', 'hub', $mobileservicestatus));
-            $mform->setDefault('mobileservicesenabled', $mobileservicesenabled != -1);
-            $mform->setType('mobileservicesenabled', PARAM_INT);
-
-            $mobilenotificationsstatus = $aremobilenotificationsenabled ? 'yes' : 'no';
-            $mform->addElement('checkbox', 'mobilenotificationsenabled', '',
-                    " " . get_string('mobilenotificationsenabled', 'hub', $mobilenotificationsstatus));
-            $mform->setDefault('mobilenotificationsenabled', $mobilenotificationsenabled != -1);
-            $mform->setType('mobilenotificationsenabled', PARAM_INT);
-
-            $mform->addElement('checkbox', 'registereduserdevices', '',
-                    " " . get_string('registereduserdevices', 'hub', $registereduserdevicescount));
-            $mform->setDefault('registereduserdevices', $registereduserdevices != -1);
-            $mform->setType('registereduserdevices', PARAM_INT);
-
-            $mform->addElement('checkbox', 'registeredactiveuserdevices', '',
-                    " " . get_string('registeredactiveuserdevices', 'hub', $registeredactiveuserdevicescount));
-            $mform->setDefault('registeredactiveuserdevices', $registeredactiveuserdevices != -1);
-            $mform->setType('registeredactiveuserdevices', PARAM_INT);
-        } else {
-            $mform->addElement('static', 'courseslabel', get_string('sendfollowinginfo', 'hub'),
-                    " " . get_string('coursesnumber', 'hub', $coursecount));
-            $mform->addElement('hidden', 'courses', 1);
-            $mform->setType('courses', PARAM_INT);
-            $mform->addHelpButton('courseslabel', 'sendfollowinginfo', 'hub');
-
-            $mform->addElement('static', 'userslabel', '',
-                    " " . get_string('usersnumber', 'hub', $usercount));
-            $mform->addElement('hidden', 'users', 1);
-            $mform->setType('users', PARAM_INT);
-
-            $mform->addElement('static', 'roleassignmentslabel', '',
-                    " " . get_string('roleassignmentsnumber', 'hub', $roleassigncount));
-            $mform->addElement('hidden', 'roleassignments', 1);
-            $mform->setType('roleassignments', PARAM_INT);
-
-            $mform->addElement('static', 'postslabel', '',
-                    " " . get_string('postsnumber', 'hub', $postcount));
-            $mform->addElement('hidden', 'posts', 1);
-            $mform->setType('posts', PARAM_INT);
-
-            $mform->addElement('static', 'questionslabel', '',
-                    " " . get_string('questionsnumber', 'hub', $questioncount));
-            $mform->addElement('hidden', 'questions', 1);
-            $mform->setType('questions', PARAM_INT);
-
-            $mform->addElement('static', 'resourceslabel', '',
-                    " " . get_string('resourcesnumber', 'hub', $resourcecount));
-            $mform->addElement('hidden', 'resources', 1);
-            $mform->setType('resources', PARAM_INT);
-
-            $mform->addElement('static', 'badgeslabel', '',
-                    " " . get_string('badgesnumber', 'hub', $badges));
-            $mform->addElement('hidden', 'badges', 1);
-            $mform->setType('badges', PARAM_INT);
-
-            $mform->addElement('static', 'issuedbadgeslabel', '',
-                    " " . get_string('issuedbadgesnumber', 'hub', $issuedbadges));
-            $mform->addElement('hidden', 'issuedbadges', true);
-            $mform->setType('issuedbadges', PARAM_INT);
-
-            $mform->addElement('static', 'participantnumberaveragelabel', '',
-                    " " . get_string('participantnumberaverage', 'hub', $participantnumberaverage));
-            $mform->addElement('hidden', 'participantnumberaverage', 1);
-            $mform->setType('participantnumberaverage', PARAM_FLOAT);
-
-            $mform->addElement('static', 'modulenumberaveragelabel', '',
-                    " " . get_string('modulenumberaverage', 'hub', $modulenumberaverage));
-            $mform->addElement('hidden', 'modulenumberaverage', 1);
-            $mform->setType('modulenumberaverage', PARAM_FLOAT);
-
-            $mobileservicestatus = $ismobileenabled ? 'yes' : 'no';
-            $mform->addElement('static', 'mobileservicesenabledlabel', '',
-                    " " . get_string('mobileservicesenabled', 'hub', $mobileservicestatus));
-            $mform->addElement('hidden', 'mobileservicesenabled', 1);
-            $mform->setType('mobileservicesenabled', PARAM_INT);
-
-            $mobilenotificationsstatus = $aremobilenotificationsenabled ? 'yes' : 'no';
-            $mform->addElement('static', 'mobilenotificationsenabledlabel', '',
-                    " " . get_string('mobilenotificationsenabled', 'hub', $mobilenotificationsstatus));
-            $mform->addElement('hidden', 'mobilenotificationsenabled', 1);
-            $mform->setType('mobilenotificationsenabled', PARAM_INT);
-
-            $mform->addElement('static', 'registereduserdeviceslabel', '',
-                    " " . get_string('registereduserdevices', 'hub', $registereduserdevicescount));
-            $mform->addElement('hidden', 'registereduserdevices', 1);
-            $mform->setType('registereduserdevices', PARAM_INT);
-
-            $mform->addElement('static', 'registeredactiveuserdeviceslabel', '',
-                    " " . get_string('registeredactiveuserdevices', 'hub', $registeredactiveuserdevicescount));
-            $mform->addElement('hidden', 'registeredactiveuserdevices', 1);
-            $mform->setType('registeredactiveuserdevices', PARAM_INT);
-        }
-
-        //check if it's a first registration or update
-        $hubregistered = $registrationmanager->get_registeredhub($huburl);
-
-        if (!empty($hubregistered)) {
-            $buttonlabel = get_string('updatesite', 'hub',
-                            !empty($hubname) ? $hubname : $huburl);
-            $mform->addElement('hidden', 'update', true);
-            $mform->setType('update', PARAM_BOOL);
-        } else {
-            $buttonlabel = get_string('registersite', 'hub',
-                            !empty($hubname) ? $hubname : $huburl);
-        }
-
-        $this->add_action_buttons(false, $buttonlabel);
-    }
-
-}
-
+debugging('Support for alternative hubs has been removed from Moodle in 3.4. For communication with moodle.net ' .
+    'see lib/classes/hub/ .', DEBUG_DEVELOPER);
index b9aeb18..0adb27b 100644 (file)
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-/*
+/**
  * @package    moodle
  * @subpackage registration
  * @author     Jerome Mouneyrac <jerome@mouneyrac.com>
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL
  * @copyright  (C) 1999 onwards Martin Dougiamas  http://dougiamas.com
  *
- * On this page the administrator selects which hub he wants to register (except for moodle.net)
- * Admins can register with moodle.net via the site admin menu "Registration" link.
- * On this page the administrator can also unregister from any hubs including moodle.net.
+ * This page displays the site registration form for Moodle.net.
+ * It handles redirection to the hub to continue the registration workflow process.
+ * It also handles update operation by web service.
  */
 
-require('../../config.php');
-
+require_once('../../config.php');
 require_once($CFG->libdir . '/adminlib.php');
-require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
-require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php');
-require_once($CFG->dirroot . '/course/publish/lib.php');
-require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
-
-admin_externalpage_setup('registrationhubs');
 
-$renderer = $PAGE->get_renderer('core', 'register');
+admin_externalpage_setup('registrationmoodleorg');
 
 $unregistration = optional_param('unregistration', 0, PARAM_INT);
-$cleanregdata = optional_param('cleanregdata', 0, PARAM_BOOL);
-$confirm = optional_param('confirm', 0, PARAM_INT);
-$huburl = optional_param('huburl', '', PARAM_URL);
-$cancel = optional_param('cancel', null, PARAM_ALPHA);
-
-$registrationmanager = new registration_manager();
-$publicationmanager = new course_publish_manager();
-$errormessage = '';
-if (empty($cancel) and $unregistration and $confirm and confirm_sesskey()) {
-
-    $hub = $registrationmanager->get_registeredhub($huburl);
-
-    //unpublish course and unregister the site by web service
-    if (!$cleanregdata) {
-
-        //check if we need to unpublish courses
-        //enrollable courses
-        $unpublishalladvertisedcourses = optional_param('unpublishalladvertisedcourses', 0, PARAM_INT);
-        $hubcourseids = array();
-        if ($unpublishalladvertisedcourses) {
-            $enrollablecourses = $publicationmanager->get_publications($huburl, null, 1);
-            if (!empty($enrollablecourses)) {
-                foreach ($enrollablecourses as $enrollablecourse) {
-                    $hubcourseids[] = $enrollablecourse->hubcourseid;
-                }
-            }
-        }
-        //downloadable courses
-        $unpublishalluploadedcourses = optional_param('unpublishalluploadedcourses', 0, PARAM_INT);
-        if ($unpublishalluploadedcourses) {
-            $downloadablecourses = $publicationmanager->get_publications($huburl, null, 0);
-            if (!empty($downloadablecourses)) {
-                foreach ($downloadablecourses as $downloadablecourse) {
-                    $hubcourseids[] = $downloadablecourse->hubcourseid;
-                }
-            }
-        }
 
-        //unpublish the courses by web service
-        if (!empty($hubcourseids)) {
-            $function = 'hub_unregister_courses';
-            $params = array('courseids' => $hubcourseids);
-            $serverurl = $huburl . "/local/hub/webservice/webservices.php";
-            $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
-            try {
-                $result = $xmlrpcclient->call($function, $params);
-                //delete the published courses
-                if (!empty($enrollablecourses)) {
-                    $publicationmanager->delete_hub_publications($huburl, 1);
-                }
-                if (!empty($downloadablecourses)) {
-                    $publicationmanager->delete_hub_publications($huburl, 0);
-                }
-            } catch (Exception $e) {
-                $errormessage = $e->getMessage();
-                $errormessage .= html_writer::empty_tag('br') .
-                        get_string('errorunpublishcourses', 'hub');
-                $confirm = false;
-                $cleanregdata = 1;
-            }
-        }
-    }
+if ($unregistration && \core\hub\registration::is_registered()) {
+    $siteunregistrationform = new \core\hub\site_unregistration_form();
 
-    //course unpublish went ok, unregister the site now
-    if ($confirm) {
-        $function = 'hub_unregister_site';
-        $params = array();
-        $serverurl = $huburl . "/local/hub/webservice/webservices.php";
-        $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
-        try {
-            $result = $xmlrpcclient->call($function, $params);
-        } catch (Exception $e) {
-            if (!$cleanregdata) {
-                $errormessage = $e->getMessage();
-                $confirm = false;
-                $cleanregdata = 1;
-            }
+    if ($siteunregistrationform->is_cancelled()) {
+        redirect(new moodle_url('/admin/registration/index.php'));
+    } else if ($data = $siteunregistrationform->get_data()) {
+        if (\core\hub\registration::unregister($data->unpublishalladvertisedcourses,
+            $data->unpublishalluploadedcourses)) {
+            redirect(new moodle_url('/admin/registration/index.php'));
         }
     }
 
-    //check that we are still processing the unregistration,
-    //it could have been unset if an exception were previsouly catched
-    if ($confirm) {
-        $registrationmanager->delete_registeredhub($huburl);
-    }
+    echo $OUTPUT->header();
+    echo $OUTPUT->heading(get_string('unregisterfrom', 'hub', 'Moodle.net'), 3, 'main');
+    $siteunregistrationform->display();
+    echo $OUTPUT->footer();
+    exit;
 }
 
-if (empty($cancel) and $unregistration and !$confirm) {
-
-    echo $OUTPUT->header();
+$siteregistrationform = new \core\hub\site_registration_form();
+if ($fromform = $siteregistrationform->get_data()) {
 
-    //do not check sesskey if confirm = false because this script is linked into email message
-    if (!empty($errormessage)) {
-        echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
-    }
+    // Save the settings.
+    \core\hub\registration::save_site_info($fromform);
 
-    $hub = $registrationmanager->get_registeredhub($huburl);
-    echo $OUTPUT->heading(get_string('unregisterfrom', 'hub', $hub->hubname), 3, 'main');
-    if ($cleanregdata) {
-        $siteunregistrationform = new site_clean_registration_data_form('',
-                        array('huburl' => $huburl, 'hubname' => $hub->hubname));
+    if (\core\hub\registration::is_registered()) {
+        \core\hub\registration::update_manual();
+        redirect(new moodle_url('/admin/registration/index.php'));
     } else {
-        $siteunregistrationform = new site_unregistration_form('',
-                        array('huburl' => $huburl, 'hubname' => $hub->hubname));
+        \core\hub\registration::register();
+        // This method will redirect away.
     }
 
-    $siteunregistrationform->display();
-} else {
-    $registeredonmoodleorg = false;
-    $moodleorghub = $registrationmanager->get_registeredhub(HUB_MOODLEORGHUBURL);
-    if (!empty($moodleorghub)) {
-        $registeredonmoodleorg = true;
-    }
-
-    // load the hub selector form
-    $hubselectorform = new hub_selector_form();
-    $fromform = $hubselectorform->get_data();
-    $selectedhuburl = optional_param('publichub', false, PARAM_URL);
-    $unlistedhuburl = optional_param('unlistedurl', false, PARAM_TEXT);
-    $password = optional_param('password', '', PARAM_RAW);
-    $registeringhuburl = null;
-    if (!empty($unlistedhuburl)) {
-        if (clean_param($unlistedhuburl, PARAM_URL) !== '') {
-            $registeringhuburl = $unlistedhuburl;
-        }
-    } else if (!empty($selectedhuburl)) {
-        $registeringhuburl = $selectedhuburl;
-    }
+}
 
-    // a hub has been selected, redirect to the hub registration page
-    if (empty($cancel) and !empty($registeringhuburl) and confirm_sesskey()) {
-        $hubname = optional_param(clean_param($registeringhuburl, PARAM_ALPHANUMEXT), '', PARAM_TEXT);
-        $params = array('sesskey' => sesskey(), 'huburl' => $registeringhuburl,
-            'password' => $password, 'hubname' => $hubname);
-        redirect(new moodle_url($CFG->wwwroot . "/" . $CFG->admin . "/registration/register.php",
-                        $params));
-    }
+// OUTPUT SECTION.
 
-    echo $OUTPUT->header();
+echo $OUTPUT->header();
 
-    //check if the site is registered on Moodle.org and display a message about registering on MOOCH
-    $adminrenderer = $PAGE->get_renderer('core', 'admin');
-    echo $adminrenderer->warn_if_not_registered();
+// Current status of registration on Moodle.net.
 
-    //do not check sesskey if confirm = false because this script is linked into email message
-    if (!empty($errormessage)) {
-        echo $OUTPUT->notification(get_string('unregistrationerror', 'hub', $errormessage));
+$notificationtype = \core\output\notification::NOTIFY_ERROR;
+if (\core\hub\registration::is_registered()) {
+    $lastupdated = \core\hub\registration::get_last_updated();
+    if ($lastupdated == 0) {
+        $registrationmessage = get_string('pleaserefreshregistrationunknown', 'admin');
+    } else {
+        $lastupdated = userdate($lastupdated, get_string('strftimedate', 'langconfig'));
+        $registrationmessage = get_string('pleaserefreshregistration', 'admin', $lastupdated);
+        $notificationtype = \core\output\notification::NOTIFY_INFO;
     }
+    echo $OUTPUT->notification($registrationmessage, $notificationtype);
+} else {
+    $registrationmessage = get_string('registrationwarning', 'admin');
+    echo $OUTPUT->notification($registrationmessage, $notificationtype);
+}
 
-    echo $OUTPUT->heading(get_string('registerwith', 'hub'));
+// Heading.
+if (\core\hub\registration::is_registered()) {
+    echo $OUTPUT->heading(get_string('updatesite', 'hub', 'Moodle.net'));
+} else {
+    echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
+}
 
-    $hubselectorform->display();
+$renderer = $PAGE->get_renderer('core', 'register');
+echo $renderer->moodleorg_registration_message();
 
-    if (extension_loaded('xmlrpc')) {
-        $hubs = $registrationmanager->get_registered_on_hubs();
-        if (!empty($hubs)) {
-            echo $OUTPUT->heading(get_string('registeredon', 'hub'), 3, 'main');
-            echo $renderer->registeredonhublisting($hubs);
-        }
-    } else { //display notice about xmlrpc
-        $xmlrpcnotification = $OUTPUT->doc_link('admin/environment/php_extension/xmlrpc', '');
-        $xmlrpcnotification .= get_string('xmlrpcdisabledregistration', 'hub');
-        echo $OUTPUT->notification($xmlrpcnotification);
-    }
+$siteregistrationform->display();
+
+if (\core\hub\registration::is_registered()) {
+    // Unregister link.
+    $unregisterhuburl = new moodle_url("/admin/registration/index.php", ['unregistration' => 1]);
+    echo html_writer::div(html_writer::link($unregisterhuburl, get_string('unregister', 'hub')), 'unregister');
 }
 echo $OUTPUT->footer();
index 8d1f8db..72330f6 100644 (file)
@@ -1,5 +1,4 @@
 <?php
-
 // This file is part of Moodle - http://moodle.org/
 //
 // Moodle is free software: you can redistribute it and/or modify
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
 
-
-
-
-//// SITE PRIVACY /////
-
-/**
- * Site privacy: private
- */
-define('HUB_SITENOTPUBLISHED', 'notdisplayed');
-
-/**
- * Site privacy: public
- */
-define('HUB_SITENAMEPUBLISHED', 'named');
-
-/**
- * Site privacy: public and global
- */
-define('HUB_SITELINKPUBLISHED', 'linked');
-
-/**
- *
- * Site registration library
- *
- * @package   course
- * @copyright 2010 Moodle Pty Ltd (http://moodle.com)
- * @author    Jerome Mouneyrac
- * @copyright 1999 onwards Martin Dougiamas  {@link http://moodle.com}
- * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class registration_manager {
-
-    /**
-     * Automatically update the registration on all hubs
-     */
-    public function cron() {
-        global $CFG;
-        if (extension_loaded('xmlrpc')) {
-            $function = 'hub_update_site_info';
-            require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
-
-            // Update all hubs where the site is registered.
-            $hubs = $this->get_registered_on_hubs();
-            if (empty($hubs)) {
-                mtrace(get_string('registrationwarning', 'admin'));
-            }
-            foreach ($hubs as $hub) {
-                // Update the registration.
-                $siteinfo = $this->get_site_info($hub->huburl);
-                $params = array('siteinfo' => $siteinfo);
-                $serverurl = $hub->huburl . "/local/hub/webservice/webservices.php";
-                $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $hub->token);
-                try {
-                    $result = $xmlrpcclient->call($function, $params);
-                    $this->update_registeredhub($hub); // To update timemodified.
-                    mtrace(get_string('siteupdatedcron', 'hub', $hub->hubname));
-                } catch (Exception $e) {
-                    $errorparam = new stdClass();
-                    $errorparam->errormessage = $e->getMessage();
-                    $errorparam->hubname = $hub->hubname;
-                    mtrace(get_string('errorcron', 'hub', $errorparam));
-                }
-            }
-        } else {
-            mtrace(get_string('errorcronnoxmlrpc', 'hub'));
-        }
-    }
-
-    /**
-     * Return the site secret for a given hub
-     * site identifier is assigned to Mooch
-     * each hub has a unique and personal site secret.
-     * @param string $huburl
-     * @return string site secret
-     */
-    public function get_site_secret_for_hub($huburl) {
-        global $DB;
-
-        $existingregistration = $DB->get_record('registration_hubs',
-                    array('huburl' => $huburl));
-
-        if (!empty($existingregistration)) {
-            return $existingregistration->secret;
-        }
-
-        if ($huburl == HUB_MOODLEORGHUBURL) {
-            $siteidentifier =  get_site_identifier();
-        } else {
-            $siteidentifier = random_string(32) . $_SERVER['HTTP_HOST'];
-        }
-
-        return $siteidentifier;
-
-    }
-
-    /**
-     * When the site register on a hub, he must call this function
-     * @param object $hub where the site is registered on
-     * @return integer id of the record
-     */
-    public function add_registeredhub($hub) {
-        global $DB;
-        $hub->timemodified = time();
-        $id = $DB->insert_record('registration_hubs', $hub);
-        return $id;
-    }
-
-    /**
-     * When a site unregister from a hub, he must call this function
-     * @param string $huburl the huburl to delete
-     */
-    public function delete_registeredhub($huburl) {
-        global $DB;
-        $DB->delete_records('registration_hubs', array('huburl' => $huburl));
-    }
-
-    /**
-     * Get a hub on which the site is registered for a given url or token
-     * Mostly use to check if the site is registered on a specific hub
-     * @param string $huburl
-     * @param string $token
-     * @return object the  hub
-     */
-    public function get_registeredhub($huburl = null, $token = null) {
-        global $DB;
-
-        $params = array();
-        if (!empty($huburl)) {
-            $params['huburl'] = $huburl;
-        }
-        if (!empty($token)) {
-            $params['token'] = $token;
-        }
-        $params['confirmed'] = 1;
-        $token = $DB->get_record('registration_hubs', $params);
-        return $token;
-    }
-
-    /**
-     * Get the hub which has not confirmed that the site is registered on,
-     * but for which a request has been sent
-     * @param string $huburl
-     * @return object the  hub
-     */
-    public function get_unconfirmedhub($huburl) {
-        global $DB;
-
-        $params = array();
-        $params['huburl'] = $huburl;
-        $params['confirmed'] = 0;
-        $token = $DB->get_record('registration_hubs', $params);
-        return $token;
-    }
-
-    /**
-     * Update a registered hub (mostly use to update the confirmation status)
-     * @param object $hub the hub
-     */
-    public function update_registeredhub($hub) {
-        global $DB;
-        $hub->timemodified = time();
-        $DB->update_record('registration_hubs', $hub);
-    }
-
-    /**
-     * Return all hubs where the site is registered
-     */
-    public function get_registered_on_hubs() {
-        global $DB;
-        $hubs = $DB->get_records('registration_hubs', array('confirmed' => 1));
-        return $hubs;
-    }
-
-    /**
-     * Return site information for a specific hub
-     * @param string $huburl
-     * @return array site info
-     */
-    public function get_site_info($huburl) {
-        global $CFG, $DB;
-
-        $siteinfo = array();
-        $cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
-        $siteinfo['name'] = get_config('hub', 'site_name_' . $cleanhuburl);
-        $siteinfo['description'] = get_config('hub', 'site_description_' . $cleanhuburl);
-        $siteinfo['contactname'] = get_config('hub', 'site_contactname_' . $cleanhuburl);
-        $siteinfo['contactemail'] = get_config('hub', 'site_contactemail_' . $cleanhuburl);
-        $siteinfo['contactphone'] = get_config('hub', 'site_contactphone_' . $cleanhuburl);
-        $siteinfo['imageurl'] = get_config('hub', 'site_imageurl_' . $cleanhuburl);
-        $siteinfo['privacy'] = get_config('hub', 'site_privacy_' . $cleanhuburl);
-        $siteinfo['street'] = get_config('hub', 'site_address_' . $cleanhuburl);
-        $siteinfo['regioncode'] = get_config('hub', 'site_region_' . $cleanhuburl);
-        $siteinfo['countrycode'] = get_config('hub', 'site_country_' . $cleanhuburl);
-        $siteinfo['geolocation'] = get_config('hub', 'site_geolocation_' . $cleanhuburl);
-        $siteinfo['contactable'] = get_config('hub', 'site_contactable_' . $cleanhuburl);
-        $siteinfo['emailalert'] = get_config('hub', 'site_emailalert_' . $cleanhuburl);
-        if (get_config('hub', 'site_coursesnumber_' . $cleanhuburl) == -1) {
-            $coursecount = -1;
-        } else {
-            $coursecount = $DB->count_records('course') - 1;
-        }
-        $siteinfo['courses'] = $coursecount;
-        if (get_config('hub', 'site_usersnumber_' . $cleanhuburl) == -1) {
-            $usercount = -1;
-        } else {
-            $usercount = $DB->count_records('user', array('deleted' => 0));
-        }
-        $siteinfo['users'] = $usercount;
-
-        if (get_config('hub', 'site_roleassignmentsnumber_' . $cleanhuburl) == -1) {
-            $roleassigncount = -1;
-        } else {
-            $roleassigncount = $DB->count_records('role_assignments');
-        }
-        $siteinfo['enrolments'] = $roleassigncount;
-        if (get_config('hub', 'site_postsnumber_' . $cleanhuburl) == -1) {
-            $postcount = -1;
-        } else {
-            $postcount = $DB->count_records('forum_posts');
-        }
-        $siteinfo['posts'] = $postcount;
-        if (get_config('hub', 'site_questionsnumber_' . $cleanhuburl) == -1) {
-            $questioncount = -1;
-        } else {
-            $questioncount = $DB->count_records('question');
-        }
-        $siteinfo['questions'] = $questioncount;
-        if (get_config('hub', 'site_resourcesnumber_' . $cleanhuburl) == -1) {
-            $resourcecount = -1;
-        } else {
-            $resourcecount = $DB->count_records('resource');
-        }
-        $siteinfo['resources'] = $resourcecount;
-        // Badge statistics.
-        require_once($CFG->libdir . '/badgeslib.php');
-        if (get_config('hub', 'site_badges_' . $cleanhuburl) == -1) {
-            $badges = -1;
-        } else {
-            $badges = $DB->count_records_select('badge', 'status <> ' . BADGE_STATUS_ARCHIVED);
-        }
-        $siteinfo['badges'] = $badges;
-        if (get_config('hub', 'site_issuedbadges_' . $cleanhuburl) == -1) {
-            $issuedbadges = -1;
-        } else {
-            $issuedbadges = $DB->count_records('badge_issued');
-        }
-        $siteinfo['issuedbadges'] = $issuedbadges;
-        //TODO
-        require_once($CFG->dirroot . "/course/lib.php");
-        if (get_config('hub', 'site_participantnumberaverage_' . $cleanhuburl) == -1) {
-            $participantnumberaverage = -1;
-        } else {
-            $participantnumberaverage = average_number_of_participants();
-        }
-        $siteinfo['participantnumberaverage'] = $participantnumberaverage;
-        if (get_config('hub', 'site_modulenumberaverage_' . $cleanhuburl) == -1) {
-            $modulenumberaverage = -1;
-        } else {
-            $modulenumberaverage = average_number_of_courses_modules();
-        }
-        $siteinfo['modulenumberaverage'] = $modulenumberaverage;
-        $siteinfo['language'] = get_config('hub', 'site_language_' . $cleanhuburl);
-        $siteinfo['moodleversion'] = $CFG->version;
-        $siteinfo['moodlerelease'] = $CFG->release;
-        $siteinfo['url'] = $CFG->wwwroot;
-        // Mobile related information.
-        $siteinfo['mobileservicesenabled'] = 0;
-        $siteinfo['mobilenotificationsenabled'] = 0;
-        $siteinfo['registereduserdevices'] = 0;
-        $siteinfo['registeredactiveuserdevices'] = 0;
-        if (!empty($CFG->enablewebservices) && !empty($CFG->enablemobilewebservice)) {
-            $siteinfo['mobileservicesenabled'] = 1;
-            $siteinfo['registereduserdevices'] = $DB->count_records('user_devices');
-            $airnotifierextpath = $CFG->dirroot . '/message/output/airnotifier/externallib.php';
-            if (file_exists($airnotifierextpath)) { // Maybe some one uninstalled the plugin.
-                require_once($airnotifierextpath);
-                $siteinfo['mobilenotificationsenabled'] = message_airnotifier_external::is_system_configured();
-                $siteinfo['registeredactiveuserdevices'] = $DB->count_records('message_airnotifier_devices', array('enable' => 1));
-            }
-        }
-
-        return $siteinfo;
-    }
-
-    /**
-     * Retrieve the site privacy string matching the define value
-     * @param string $privacy must match the define into moodlelib.php
-     * @return string
-     */
-    public function get_site_privacy_string($privacy) {
-        switch ($privacy) {
-            case HUB_SITENOTPUBLISHED:
-                $privacystring = get_string('siteprivacynotpublished', 'hub');
-                break;
-            case HUB_SITENAMEPUBLISHED:
-                $privacystring = get_string('siteprivacypublished', 'hub');
-                break;
-            case HUB_SITELINKPUBLISHED:
-                $privacystring = get_string('siteprivacylinked', 'hub');
-                break;
-        }
-        if (empty($privacystring)) {
-            throw new moodle_exception('unknownprivacy');
-        }
-        return $privacystring;
-    }
-
-}
-?>
+defined('MOODLE_INTERNAL') || die();
index 2b7cf96..ee2d534 100644 (file)
@@ -20,7 +20,7 @@
 //                                                                       //
 ///////////////////////////////////////////////////////////////////////////
 
-/*
+/**
  * @package    moodle
  * @subpackage registration
  * @author     Jerome Mouneyrac <jerome@mouneyrac.com>
 
 
 require_once('../../config.php');
-require_once($CFG->libdir . '/adminlib.php');
-require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/forms.php');
-require_once($CFG->dirroot . '/webservice/lib.php');
-require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
 
-require_sesskey();
-
-$huburl = required_param('huburl', PARAM_URL);
-$huburl = rtrim($huburl, "/");
-
-if ($huburl == HUB_MOODLEORGHUBURL) { // register to Moodle.org
-    admin_externalpage_setup('registrationmoodleorg');
-} else { //register to a hub
-    admin_externalpage_setup('registrationhub');
-}
-
-$password = optional_param('password', '', PARAM_TEXT);
-$hubname = optional_param('hubname', '', PARAM_TEXT);
-
-$registrationmanager = new registration_manager();
-
-$registeredhub = $registrationmanager->get_registeredhub($huburl);
-
-$siteregistrationform = new site_registration_form('',
-                array('alreadyregistered' => !empty($registeredhub->token),
-                    'huburl' => $huburl, 'hubname' => $hubname,
-                    'password' => $password));
-$fromform = $siteregistrationform->get_data();
-
-if (!empty($fromform) and confirm_sesskey()) {
-
-    // Set to -1 all optional data marked as "don't send" by the admin.
-    // The function get_site_info() will not calculate the optional data if config is set to -1.
-    $inputnames = array('courses', 'users', 'roleassignments', 'posts', 'questions', 'resources',
-        'badges', 'issuedbadges', 'modulenumberaverage', 'participantnumberaverage',
-        'mobileservicesenabled', 'mobilenotificationsenabled', 'registereduserdevices', 'registeredactiveuserdevices');
-    foreach ($inputnames as $inputname) {
-        if (empty($fromform->{$inputname})) {
-            $fromform->{$inputname} = -1;
-        }
-    }
-
-    // Save the settings.
-    $cleanhuburl = clean_param($huburl, PARAM_ALPHANUMEXT);
-    set_config('site_name_' . $cleanhuburl, $fromform->name, 'hub');
-    set_config('site_description_' . $cleanhuburl, $fromform->description, 'hub');
-    set_config('site_contactname_' . $cleanhuburl, $fromform->contactname, 'hub');
-    set_config('site_contactemail_' . $cleanhuburl, $fromform->contactemail, 'hub');
-    set_config('site_contactphone_' . $cleanhuburl, $fromform->contactphone, 'hub');
-    set_config('site_imageurl_' . $cleanhuburl, $fromform->imageurl, 'hub');
-    set_config('site_privacy_' . $cleanhuburl, $fromform->privacy, 'hub');
-    set_config('site_address_' . $cleanhuburl, $fromform->address, 'hub');
-    set_config('site_region_' . $cleanhuburl, $fromform->regioncode, 'hub');
-    set_config('site_country_' . $cleanhuburl, $fromform->countrycode, 'hub');
-    set_config('site_language_' . $cleanhuburl, $fromform->language, 'hub');
-    set_config('site_geolocation_' . $cleanhuburl, $fromform->geolocation, 'hub');
-    set_config('site_contactable_' . $cleanhuburl, $fromform->contactable, 'hub');
-    set_config('site_emailalert_' . $cleanhuburl, $fromform->emailalert, 'hub');
-    set_config('site_coursesnumber_' . $cleanhuburl, $fromform->courses, 'hub');
-    set_config('site_usersnumber_' . $cleanhuburl, $fromform->users, 'hub');
-    set_config('site_roleassignmentsnumber_' . $cleanhuburl, $fromform->roleassignments, 'hub');
-    set_config('site_postsnumber_' . $cleanhuburl, $fromform->posts, 'hub');
-    set_config('site_questionsnumber_' . $cleanhuburl, $fromform->questions, 'hub');
-    set_config('site_resourcesnumber_' . $cleanhuburl, $fromform->resources, 'hub');
-    set_config('site_badges_' . $cleanhuburl, $fromform->badges, 'hub');
-    set_config('site_issuedbadges_' . $cleanhuburl, $fromform->issuedbadges, 'hub');
-    set_config('site_modulenumberaverage_' . $cleanhuburl, $fromform->modulenumberaverage, 'hub');
-    set_config('site_participantnumberaverage_' . $cleanhuburl, $fromform->participantnumberaverage, 'hub');
-    set_config('site_mobileservicesenabled_' . $cleanhuburl, $fromform->mobileservicesenabled, 'hub');
-    set_config('site_mobilenotificationsenabled_' . $cleanhuburl, $fromform->mobilenotificationsenabled, 'hub');
-    set_config('site_registereduserdevices_' . $cleanhuburl, $fromform->registereduserdevices, 'hub');
-    set_config('site_registeredactiveuserdevices_' . $cleanhuburl, $fromform->registeredactiveuserdevices, 'hub');
-}
-
-/////// UPDATE ACTION ////////
-
-// update the hub registration
-$update = optional_param('update', 0, PARAM_INT);
-if ($update and confirm_sesskey()) {
-
-    //update the registration
-    $function = 'hub_update_site_info';
-    $siteinfo = $registrationmanager->get_site_info($huburl);
-    $params = array('siteinfo' => $siteinfo);
-    $serverurl = $huburl . "/local/hub/webservice/webservices.php";
-    require_once($CFG->dirroot . "/webservice/xmlrpc/lib.php");
-    $xmlrpcclient = new webservice_xmlrpc_client($serverurl, $registeredhub->token);
-    try {
-        $result = $xmlrpcclient->call($function, $params);
-        $registrationmanager->update_registeredhub($registeredhub); // To update timemodified.
-    } catch (Exception $e) {
-        $error = $OUTPUT->notification(get_string('errorregistration', 'hub', $e->getMessage()));
-    }
-}
-
-/////// FORM REGISTRATION ACTION //////
-
-if (!empty($fromform) and empty($update) and confirm_sesskey()) {
-
-    if (!empty($fromform) and confirm_sesskey()) { // if the register button has been clicked
-
-        // Retrieve the optional info (specially course number, user number, module number average...).
-        $siteinfo = $registrationmanager->get_site_info($huburl);
-        $fromform->courses = $siteinfo['courses'];
-        $fromform->users = $siteinfo['users'];
-        $fromform->enrolments = $siteinfo['enrolments'];
-        $fromform->posts = $siteinfo['posts'];
-        $fromform->questions = $siteinfo['questions'];
-        $fromform->resources = $siteinfo['resources'];
-        $fromform->badges = $siteinfo['badges'];
-        $fromform->issuedbadges = $siteinfo['issuedbadges'];
-        $fromform->modulenumberaverage = $siteinfo['modulenumberaverage'];
-        $fromform->participantnumberaverage = $siteinfo['participantnumberaverage'];
-        $fromform->street = $siteinfo['street'];
-        $fromform->mobileservicesenabled = $siteinfo['mobileservicesenabled'];
-        $fromform->mobilenotificationsenabled = $siteinfo['mobilenotificationsenabled'];
-        $fromform->registereduserdevices = $siteinfo['registereduserdevices'];
-        $fromform->registeredactiveuserdevices = $siteinfo['registeredactiveuserdevices'];
-
-        $params = (array) $fromform; //we are using the form input as the redirection parameters (token, url and name)
-
-        $unconfirmedhub = $registrationmanager->get_unconfirmedhub($huburl);
-        if (empty($unconfirmedhub)) {
-            //we save the token into the communication table in order to have a reference
-            $unconfirmedhub = new stdClass();
-            $unconfirmedhub->token = $registrationmanager->get_site_secret_for_hub($huburl);
-            $unconfirmedhub->secret = $unconfirmedhub->token;
-            $unconfirmedhub->huburl = $huburl;
-            $unconfirmedhub->hubname = $hubname;
-            $unconfirmedhub->confirmed = 0;
-            $unconfirmedhub->id = $registrationmanager->add_registeredhub($unconfirmedhub);
-        }
-
-        $params['token'] = $unconfirmedhub->token;
-        $params['url'] = $CFG->wwwroot;
-        redirect(new moodle_url($huburl . '/local/hub/siteregistration.php', $params));
-    }
-}
-
-/////// OUTPUT SECTION /////////////
-
-echo $OUTPUT->header();
-//Display update notification result
-if (!empty($registeredhub->confirmed)) {
-    if (!empty($result)) {
-        echo $OUTPUT->notification(get_string('siteregistrationupdated', 'hub'), 'notifysuccess');
-    }
-}
-
-if (!empty($error)) {
-    echo $error;
-}
-
-// Some Moodle.org registration explanation.
-if ($huburl == HUB_MOODLEORGHUBURL) {
-    $notificationtype = \core\output\notification::NOTIFY_ERROR;
-    if (!empty($registeredhub->token)) {
-        if ($registeredhub->timemodified == 0) {
-            $registrationmessage = get_string('pleaserefreshregistrationunknown', 'admin');
-        } else {
-            $lastupdated = userdate($registeredhub->timemodified, get_string('strftimedate', 'langconfig'));
-            $registrationmessage = get_string('pleaserefreshregistration', 'admin', $lastupdated);
-            $notificationtype = \core\output\notification::NOTIFY_INFO;
-        }
-    } else {
-        $registrationmessage = get_string('registrationwarning', 'admin');
-    }
-    echo $OUTPUT->notification($registrationmessage, $notificationtype);
-
-    echo $OUTPUT->heading(get_string('registerwithmoodleorg', 'admin'));
-    $renderer = $PAGE->get_renderer('core', 'register');
-    echo $renderer->moodleorg_registration_message();
-}
-
-$siteregistrationform->display();
-echo $OUTPUT->footer();
+redirect(new moodle_url('/admin/registration/index.php'));
\ No newline at end of file
index 09d2735..196d680 100644 (file)
@@ -46,50 +46,4 @@ class core_register_renderer extends plugin_renderer_base {
         $moodleorgregmsg .= html_writer::alist($items);
         return $moodleorgregmsg;
     }
-
-    /**
-     * Display a box message confirming a site registration (add or update)
-     * @param string $confirmationmessage
-     * @return string
-     */
-    public function registration_confirmation($confirmationmessage) {
-        $linktositelist = html_writer::tag('a', get_string('sitelist', 'hub'),
-                        array('href' => new moodle_url('/local/hub/index.php')));
-        $message = $confirmationmessage . html_writer::empty_tag('br') . $linktositelist;
-        return $this->output->box($message);
-    }
-
-    /**
-     * Display the listing of registered on hub
-     */
-    public function registeredonhublisting($hubs) {
-        global $CFG;
-        $table = new html_table();
-        $table->head = array(get_string('hub', 'hub'), get_string('operation', 'hub'));
-        $table->size = array('80%', '20%');
-
-        foreach ($hubs as $hub) {
-            if ($hub->huburl == HUB_MOODLEORGHUBURL) {
-                $hub->hubname = get_string('registeredmoodleorg', 'hub', $hub->hubname);
-            }
-            $hublink = html_writer::tag('a', $hub->hubname, array('href' => $hub->huburl));
-            $hublinkcell = html_writer::tag('div', $hublink, array('class' => 'registeredhubrow'));
-
-            $unregisterhuburl = new moodle_url("/" . $CFG->admin . "/registration/index.php",
-                            array('sesskey' => sesskey(), 'huburl' => $hub->huburl,
-                                'unregistration' => 1));
-            $unregisterbutton = new single_button($unregisterhuburl,
-                            get_string('unregister', 'hub'));
-            $unregisterbutton->class = 'centeredbutton';
-            $unregisterbuttonhtml = $this->output->render($unregisterbutton);
-
-            //add button cells
-            $cells = array($hublinkcell, $unregisterbuttonhtml);
-            $row = new html_table_row($cells);
-            $table->data[] = $row;
-        }
-
-        return html_writer::table($table);
-    }
-
 }
index dd15463..7926e0f 100644 (file)
@@ -20,7 +20,7 @@
 //                                                                       //
 ///////////////////////////////////////////////////////////////////////////
 
-/*
+/**
  * @package    moodle
  * @subpackage registration
  * @author     Jerome Mouneyrac <jerome@mouneyrac.com>
 
 require('../../config.php');
 require_once($CFG->libdir . '/adminlib.php');
-require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
 
 $url = optional_param('url', '', PARAM_URL);
-$hubname = optional_param('hubname', '', PARAM_TEXT);
 $token = optional_param('token', '', PARAM_TEXT);
 
-admin_externalpage_setup('registrationhubs');
+admin_externalpage_setup('registrationmoodleorg');
 
-//check that we are waiting a confirmation from this hub, and check that the token is correct
-$registrationmanager = new registration_manager();
-$registeredhub = $registrationmanager->get_unconfirmedhub($url);
-if (!empty($registeredhub) and $registeredhub->token == $token) {
-
-    echo $OUTPUT->header();
-    echo $OUTPUT->heading(get_string('renewregistration', 'hub'), 3, 'main');
-    $hublink = html_writer::tag('a', $hubname, array('href' => $url));
+if ($url !== HUB_MOODLEORGHUBURL) {
+    throw new moodle_exception('errorotherhubsnotsupported', 'hub');
+}
 
-    $registrationmanager->delete_registeredhub($url);
+// Check that we are waiting a confirmation from this hub, and check that the token is correct.
+\core\hub\registration::reset_site_identifier($token);
 
-    //Mooch case, need to recreate the siteidentifier
-    if ($url == HUB_MOODLEORGHUBURL) {
-        $CFG->siteidentifier = null;
-        get_site_identifier();
-    }
+echo $OUTPUT->header();
+echo $OUTPUT->heading(get_string('renewregistration', 'hub'), 3, 'main');
+$hublink = html_writer::tag('a', 'Moodle.net', array('href' => HUB_MOODLEORGHUBURL));
 
-    $deletedregmsg = get_string('previousregistrationdeleted', 'hub', $hublink);
+$deletedregmsg = get_string('previousregistrationdeleted', 'hub', $hublink);
 
-    $button = new single_button(new moodle_url('/admin/registration/index.php'),
-                    get_string('restartregistration', 'hub'));
-    $button->class = 'restartregbutton';
+$button = new single_button(new moodle_url('/admin/registration/index.php'),
+                get_string('restartregistration', 'hub'));
+$button->class = 'restartregbutton';
 
-    echo html_writer::tag('div', $deletedregmsg . $OUTPUT->render($button),
-            array('class' => 'mdl-align'));
+echo html_writer::tag('div', $deletedregmsg . $OUTPUT->render($button),
+        array('class' => 'mdl-align'));
 
-    echo $OUTPUT->footer();
-} else {
-    throw new moodle_exception('wrongtoken', 'hub',
-            $CFG->wwwroot . '/' . $CFG->admin . '/registration/index.php');
-}
+echo $OUTPUT->footer();
 
 
index 561b24a..1fd8cb5 100644 (file)
@@ -278,13 +278,14 @@ class core_admin_renderer extends plugin_renderer_base {
      * @param array $eventshandlers Events 1 API handlers.
      * @param bool $themedesignermode Warn about the theme designer mode.
      * @param bool $devlibdir Warn about development libs directory presence.
+     * @param bool $mobileconfigured Whether the mobile web services have been enabled
      *
      * @return string HTML to output.
      */
     public function admin_notifications_page($maturity, $insecuredataroot, $errorsdisplayed,
             $cronoverdue, $dbproblems, $maintenancemode, $availableupdates, $availableupdatesfetch,
             $buggyiconvnomb, $registered, array $cachewarnings = array(), $eventshandlers = 0,
-            $themedesignermode = false, $devlibdir = false) {
+            $themedesignermode = false, $devlibdir = false, $mobileconfigured = false) {
         global $CFG;
         $output = '';
 
@@ -303,6 +304,7 @@ class core_admin_renderer extends plugin_renderer_base {
         $output .= $this->cache_warnings($cachewarnings);
         $output .= $this->events_handlers($eventshandlers);
         $output .= $this->registration_warning($registered);
+        $output .= $this->mobile_configuration_warning($mobileconfigured);
 
         //////////////////////////////////////////////////////////////////////////////////////////////////
         ////  IT IS ILLEGAL AND A VIOLATION OF THE GPL TO HIDE, REMOVE OR MODIFY THIS COPYRIGHT NOTICE ///
@@ -805,8 +807,7 @@ class core_admin_renderer extends plugin_renderer_base {
         if (!$registered) {
 
             if (has_capability('moodle/site:config', context_system::instance())) {
-                $registerbutton = $this->single_button(new moodle_url('/admin/registration/register.php',
-                    array('huburl' =>  HUB_MOODLEORGHUBURL, 'hubname' => 'Moodle.net')),
+                $registerbutton = $this->single_button(new moodle_url('/admin/registration/index.php'),
                     get_string('register', 'admin'));
                 $str = 'registrationwarning';
             } else {
@@ -828,10 +829,24 @@ class core_admin_renderer extends plugin_renderer_base {
      * @return string
      */
     public function warn_if_not_registered() {
-        global $CFG;
-        require_once($CFG->dirroot . '/' . $CFG->admin . '/registration/lib.php');
-        $registrationmanager = new registration_manager();
-        return $this->registration_warning($registrationmanager->get_registeredhub(HUB_MOODLEORGHUBURL) ? true : false);
+        return $this->registration_warning(\core\hub\registration::is_registered());
+    }
+
+    /**
+     * Display a warning about the Mobile Web Services being disabled.
+     *
+     * @param boolean $mobileconfigured true if mobile web services are enabled
+     * @return string HTML to output.
+     */
+    protected function mobile_configuration_warning($mobileconfigured) {
+        $output = '';
+        if (!$mobileconfigured) {
+            $settingslink = new moodle_url('/admin/settings.php', ['section' => 'mobilesettings']);
+            $configurebutton = $this->single_button($settingslink, get_string('enablemobilewebservice', 'admin'));
+            $output .= $this->warning(get_string('mobilenotconfiguredwarning', 'admin') . '&nbsp;' . $configurebutton);
+        }
+
+        return $output;
     }
 
     /**
index fb38431..623cf1c 100644 (file)
@@ -5,11 +5,19 @@
 require_once('../config.php');
 require_once($CFG->libdir.'/adminlib.php');
 
+redirect_if_major_upgrade_required();
+
 $query = trim(optional_param('query', '', PARAM_NOTAGS));  // Search string
 
 $context = context_system::instance();
 $PAGE->set_context($context);
 
+$hassiteconfig = has_capability('moodle/site:config', $context);
+
+if ($hassiteconfig && moodle_needs_upgrading()) {
+    redirect(new moodle_url('/admin/index.php'));
+}
+
 admin_externalpage_setup('search', '', array('query' => $query)); // now hidden page
 
 $adminroot = admin_get_root(); // need all settings here
@@ -55,7 +63,7 @@ if ($errormsg !== '') {
 
 $showsettingslinks = true;
 
-if (has_capability('moodle/site:config', $context)) {
+if ($hassiteconfig) {
     require_once("admin_settings_search_form.php");
     $form = new admin_settings_search_form();
     $form->display();
index e8247c8..b42a252 100644 (file)
@@ -101,5 +101,10 @@ if ($hassiteconfig) {
         // Disable web interface evaluation and get predictions.
         $settings->add(new admin_setting_configcheckbox('analytics/onlycli', new lang_string('onlycli', 'analytics'),
             new lang_string('onlycliinfo', 'analytics'), 1));
+
+        // Training and prediction time limit per model.
+        $settings->add(new admin_setting_configduration('analytics/modeltimelimit', new lang_string('modeltimelimit', 'analytics'),
+            new lang_string('modeltimelimitinfo', 'analytics'), 20 * MINSECS));
+
     }
 }
index 3bb3c4a..4444ff0 100644 (file)
@@ -557,13 +557,21 @@ if ($hassiteconfig) {
     $temp->add(new admin_setting_heading('searchengineheading', new lang_string('searchengine', 'admin'), ''));
     $temp->add(new admin_setting_configselect('searchengine',
                                 new lang_string('selectsearchengine', 'admin'), '', 'solr', $engines));
-    $temp->add(new admin_setting_heading('searchindexingheading', new lang_string('searchoptions', 'admin'), ''));
+    $temp->add(new admin_setting_heading('searchoptionsheading', new lang_string('searchoptions', 'admin'), ''));
     $temp->add(new admin_setting_configcheckbox('searchindexwhendisabled',
             new lang_string('searchindexwhendisabled', 'admin'), new lang_string('searchindexwhendisabled_desc', 'admin'),
             0));
     $temp->add(new admin_setting_configduration('searchindextime',
             new lang_string('searchindextime', 'admin'), new lang_string('searchindextime_desc', 'admin'),
             600));
+    $options = [
+        0 => new lang_string('searchallavailablecourses_off', 'admin'),
+        1 => new lang_string('searchallavailablecourses_on', 'admin')
+    ];
+    $temp->add(new admin_setting_configselect('searchallavailablecourses',
+            new lang_string('searchallavailablecourses', 'admin'),
+            new lang_string('searchallavailablecourses_desc', 'admin'),
+            0, $options));
 
     $ADMIN->add('searchplugins', $temp);
     $ADMIN->add('searchplugins', new admin_externalpage('searchareas', new lang_string('searchareas', 'admin'),
index e847077..c0d57c3 100644 (file)
@@ -211,9 +211,6 @@ $temp->add(new admin_setting_configtext('curltimeoutkbitrate', new lang_string('
 $ADMIN->add('server', $temp);
 
 
-$ADMIN->add('server', new admin_externalpage('adminregistration', new lang_string('hubs', 'admin'),
-    "$CFG->wwwroot/$CFG->admin/registration/index.php"));
-
 // E-mail settings.
 $ADMIN->add('server', new admin_category('email', new lang_string('categoryemail', 'admin')));
 
index be45ef6..17621cb 100644 (file)
@@ -11,14 +11,7 @@ $hassiteconfig = has_capability('moodle/site:config', $systemcontext);
 $ADMIN->add('root', new admin_externalpage('adminnotifications', new lang_string('notifications'), "$CFG->wwwroot/$CFG->admin/index.php"));
 
 $ADMIN->add('root', new admin_externalpage('registrationmoodleorg', new lang_string('registration', 'admin'),
-        "$CFG->wwwroot/$CFG->admin/registration/register.php?huburl=" . HUB_MOODLEORGHUBURL . "&hubname=Moodle.net&sesskey=" . sesskey()));
-$ADMIN->add('root', new admin_externalpage('registrationhub', new lang_string('registerwith', 'hub'),
-        "$CFG->wwwroot/$CFG->admin/registration/register.php", 'moodle/site:config', true));
-$ADMIN->add('root', new admin_externalpage('registrationhubs', new lang_string('hubs', 'admin'),
-        "$CFG->wwwroot/$CFG->admin/registration/index.php", 'moodle/site:config', true));
-$ADMIN->add('root', new admin_externalpage('siteregistrationconfirmed',
-        new lang_string('registrationconfirmed', 'hub'),
-        $CFG->wwwroot."/".$CFG->admin."/registration/confirmregistration.php", 'moodle/site:config', true));
+        new moodle_url("/admin/registration/index.php")));
  // hidden upgrade script
 $ADMIN->add('root', new admin_externalpage('upgradesettings', new lang_string('upgradesettings', 'admin'), "$CFG->wwwroot/$CFG->admin/upgradesettings.php", 'moodle/site:config', true));
 
diff --git a/admin/tool/analytics/amd/build/model.min.js b/admin/tool/analytics/amd/build/model.min.js
new file mode 100644 (file)
index 0000000..e9e2e3c
Binary files /dev/null and b/admin/tool/analytics/amd/build/model.min.js differ
diff --git a/admin/tool/analytics/amd/src/model.js b/admin/tool/analytics/amd/src/model.js
new file mode 100644 (file)
index 0000000..8913431
--- /dev/null
@@ -0,0 +1,94 @@
+// 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/>.
+
+/**
+ * AMD module for model actions confirmation.
+ *
+ * @module     tool_analytics/model
+ * @copyright  2017 David Monllao
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+define(['jquery', 'core/str', 'core/log', 'core/notification', 'core/modal_factory', 'core/modal_events'],
+    function($, Str, log, Notification, ModalFactory, ModalEvents) {
+
+    /**
+     * List of actions that require confirmation and confirmation message.
+     */
+    var actionsList = {
+        clear: {
+            title: {
+                key: 'clearpredictions',
+                component: 'tool_analytics'
+            }, body: {
+                key: 'clearmodelpredictions',
+                component: 'tool_analytics'
+            }
+
+        }
+    };
+
+    /**
+     * Returns the model name.
+     *
+     * @param {Object} actionItem The action item DOM node.
+     * @return {String}
+     */
+    var getModelName = function(actionItem) {
+        return $(actionItem.closest('tr')[0]).find('span.target-name').text();
+    };
+
+    /** @alias module:tool_analytics/model */
+    return {
+
+        /**
+         * Displays a confirm modal window before executing the action.
+         *
+         * @param {String} actionId
+         * @param {String} actionType
+         */
+        confirmAction: function(actionId, actionType) {
+            $('[data-action-id="' + actionId + '"]').on('click', function(ev) {
+                ev.preventDefault();
+
+                var a = $(ev.currentTarget);
+
+                if (typeof actionsList[actionType] === "undefined") {
+                    log.error('Action "' + actionType + '" is not allowed.');
+                    return;
+                }
+
+                var reqStrings = [
+                    actionsList[actionType].title,
+                    actionsList[actionType].body
+                ];
+                reqStrings[1].param = getModelName(a);
+
+                var stringsPromise = Str.get_strings(reqStrings);
+                var modalPromise = ModalFactory.create({type: ModalFactory.types.SAVE_CANCEL});
+
+                $.when(stringsPromise, modalPromise).then(function(strings, modal) {
+                    modal.setTitle(strings[0]);
+                    modal.setBody(strings[1]);
+                    modal.setSaveButtonText(strings[0]);
+                    modal.getRoot().on(ModalEvents.save, function() {
+                        window.location.href = a.attr('href');
+                    });
+                    modal.show();
+                    return modal;
+                }).fail(Notification.exception);
+            });
+        }
+    };
+});
index c8f7129..66270b2 100644 (file)
@@ -45,7 +45,7 @@ class edit_model extends \moodleform {
 
         $mform = $this->_form;
 
-        if ($this->_customdata['model']->get_model_obj()->trained == 1) {
+        if ($this->_customdata['model']->is_trained()) {
             $message = get_string('edittrainedwarning', 'tool_analytics');
             $mform->addElement('html', $OUTPUT->notification($message, \core\output\notification::NOTIFY_WARNING));
         }
index b05e102..cc499ef 100644 (file)
@@ -59,6 +59,7 @@ class models_list implements \renderable, \templatable {
      * @return \stdClass
      */
     public function export_for_template(\renderer_base $output) {
+        global $PAGE;
 
         $data = new \stdClass();
 
@@ -120,11 +121,13 @@ class models_list implements \renderable, \templatable {
                 }
             }
 
+            // Has this model generated predictions?.
+            $predictioncontexts = $model->get_predictions_contexts();
+
             // Model predictions list.
             if (!$model->is_enabled()) {
                 $modeldata->noinsights = get_string('disabledmodel', 'analytics');
             } else if ($model->uses_insights()) {
-                $predictioncontexts = $model->get_predictions_contexts();
                 if ($predictioncontexts) {
 
                     foreach ($predictioncontexts as $contextid => $unused) {
@@ -166,9 +169,39 @@ class models_list implements \renderable, \templatable {
             $actionsmenu->set_owner_selector('model-actions-' . $model->get_id());
             $actionsmenu->set_alignment(\action_menu::TL, \action_menu::BL);
 
+            $urlparams = ['id' => $model->get_id(), 'sesskey' => sesskey()];
+
+            // Get predictions.
+            if (!$onlycli && $modeldata->enabled && !empty($modeldata->timesplitting)) {
+                $urlparams['action'] = 'getpredictions';
+                $url = new \moodle_url('model.php', $urlparams);
+                $icon = new \action_menu_link_secondary($url, new \pix_icon('i/notificat