theme/boost/amd/src/bootstrap/toast.js
theme/boost/amd/src/bootstrap/tooltip.js
theme/boost/amd/src/bootstrap/util.js
-theme/boost/amd/src/tether.js
theme/boost/scss/fontawesome/
\ No newline at end of file
theme/boost/amd/src/bootstrap/toast.js
theme/boost/amd/src/bootstrap/tooltip.js
theme/boost/amd/src/bootstrap/util.js
-theme/boost/amd/src/tether.js
theme/boost/scss/fontawesome/
\ No newline at end of file
// Always verify plugin dependencies!
$failed = array();
if (!core_plugin_manager::instance()->all_plugins_ok($version, $failed, $CFG->branch)) {
- echo $output->unsatisfied_dependencies_page($version, $failed, $PAGE->url);
+ echo $output->unsatisfied_dependencies_page($version, $failed, new moodle_url($PAGE->url,
+ array('confirmplugincheck' => 0)));
die();
}
unset($failed);
$failed = array();
if (!$pluginman->all_plugins_ok($version, $failed, $CFG->branch)) {
$output = $PAGE->get_renderer('core', 'admin');
- echo $output->unsatisfied_dependencies_page($version, $failed, $PAGE->url);
+ echo $output->unsatisfied_dependencies_page($version, $failed, new moodle_url($PAGE->url,
+ array('confirmplugincheck' => 0)));
die();
}
unset($failed);
if (!empty($installabortable[$plugin->component])) {
$status .= $this->output->single_button(
- new moodle_url($this->page->url, array('abortinstall' => $plugin->component)),
+ new moodle_url($this->page->url, array('abortinstall' => $plugin->component, 'confirmplugincheck' => 0)),
get_string('cancelinstallone', 'core_plugin'),
'post',
array('class' => 'actionbutton cancelinstallone d-block mt-1')
if ($installabortable) {
$out .= $this->output->single_button(
- new moodle_url($this->page->url, array('abortinstallx' => 1)),
+ new moodle_url($this->page->url, array('abortinstallx' => 1, 'confirmplugincheck' => 0)),
get_string('cancelinstallall', 'core_plugin', count($installabortable)),
'post',
array('class' => 'singlebutton cancelinstallall mr-1')
// Search engine selection.
$temp->add(new admin_setting_heading('searchengineheading', new lang_string('searchengine', 'admin'), ''));
- $temp->add(new admin_setting_configselect('searchengine',
- new lang_string('selectsearchengine', 'admin'), '', 'simpledb', $engines));
+ $searchengineselect = new admin_setting_configselect('searchengine',
+ new lang_string('selectsearchengine', 'admin'), '', 'simpledb', $engines);
+ $searchengineselect->set_validate_function(function(string $value): string {
+ global $CFG;
+
+ // Check nobody's setting the indexing and query-only server to the same one.
+ if ($CFG->searchenginequeryonly === $value) {
+ return get_string('searchenginequeryonlysame', 'admin');
+ } else {
+ return '';
+ }
+ });
+ $temp->add($searchengineselect);
$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'),
new lang_string('searchhideallcategory_desc', 'admin'),
0));
+ $temp->add(new admin_setting_heading('searchmanagement', new lang_string('searchmanagement', 'admin'),
+ new lang_string('searchmanagement_desc', 'admin')));
+
+ // Get list of search engines including those with alternate settings.
+ $searchenginequeryonlyselect = new admin_setting_configselect('searchenginequeryonly',
+ new lang_string('searchenginequeryonly', 'admin'),
+ new lang_string('searchenginequeryonly_desc', 'admin'), '', function() use($engines) {
+ $options = ['' => new lang_string('searchenginequeryonly_none', 'admin')];
+ foreach ($engines as $name => $display) {
+ $options[$name] = $display;
+
+ $classname = '\search_' . $name . '\engine';
+ $engine = new $classname;
+ if ($engine->has_alternate_configuration()) {
+ $options[$name . '-alternate'] =
+ new lang_string('searchenginealternatesettings', 'admin', $display);
+ }
+ }
+ return $options;
+ });
+ $searchenginequeryonlyselect->set_validate_function(function(string $value): string {
+ global $CFG;
+
+ // Check nobody's setting the indexing and query-only server to the same one.
+ if ($CFG->searchengine === $value) {
+ return get_string('searchenginequeryonlysame', 'admin');
+ } else {
+ return '';
+ }
+ });
+ $temp->add($searchenginequeryonlyselect);
+ $temp->add(new admin_setting_configcheckbox('searchbannerenable',
+ new lang_string('searchbannerenable', 'admin'), new lang_string('searchbannerenable_desc', 'admin'),
+ 0));
+ $temp->add(new admin_setting_confightmleditor('searchbanner',
+ new lang_string('searchbanner', 'admin'), '', ''));
+
$ADMIN->add('searchplugins', $temp);
$ADMIN->add('searchplugins', new admin_externalpage('searchareas', new lang_string('searchareas', 'admin'),
new moodle_url('/admin/searchareas.php')));
new lang_string('onlynoreply', 'admin'));
$temp->add(new admin_setting_configselect('emailfromvia', new lang_string('emailfromvia', 'admin'),
new lang_string('configemailfromvia', 'admin'), 1, $choices));
- $temp->add(new admin_setting_configtext('emailsubjectprefix', new lang_string('emailsubjectprefix', 'admin'),
+
+$temp->add(new admin_setting_configtext('emailsubjectprefix', new lang_string('emailsubjectprefix', 'admin'),
new lang_string('configemailsubjectprefix', 'admin'), '', PARAM_RAW));
+$temp->add(new admin_setting_configtextarea('emailheaders', new lang_string('emailheaders', 'admin'),
+ new lang_string('configemailheaders', 'admin'), '', PARAM_RAW, '50', '3'));
$ADMIN->add('email', $temp);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_analytics'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'tool_availabilityconditions';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_behat'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_capability'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_cohortroles'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'tool_customlang'; // Full name of the plugin (used for diagnostics)
$showsummary = true;
}
- if ($showsummary) {
+ if ($showsummary && $iscurrentuser) {
$summaryurl = new moodle_url('/admin/tool/dataprivacy/summary.php');
$summarynode = new core_user\output\myprofile\node('privacyandpolicies', 'retentionsummary',
get_string('dataretentionsummary', 'tool_dataprivacy'), null, $summaryurl);
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061501;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'tool_dataprivacy';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_dbtransfer'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'tool_filetypes';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'tool_generator';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_health'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_httpsreplace'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_innodb'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'tool_installaddon';
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->maturity = MATURITY_STABLE;
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_langimport'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_licensemanager';
$plugin->maturity = MATURITY_STABLE;
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'logstore_database'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'logstore_legacy'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'logstore_standard'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_log'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_lp'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_lpimportcsv'; // Full name of the plugin (used for diagnostics).
-$plugin->dependencies = array('tool_lp' => 2020060900);
+$plugin->dependencies = array('tool_lp' => 2021052500);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_lpmigrate'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
'tool_lp' => ANY_VERSION
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'tool_messageinbound';
*/
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_mobile'; // Full name of the plugin (used for diagnostics).
$plugin->dependencies = array(
- 'webservice_rest' => 2020060900
+ 'webservice_rest' => 2021052500
);
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_monitor'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'tool_moodlenet';
-$plugin->version = 2020061502;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->maturity = MATURITY_ALPHA;
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_multilangupgrade'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_oauth2'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_phpunit'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_policy'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_profiling'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_recyclebin'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_replace'; // Full name of the plugin (used for diagnostics)
$plugin->maturity = MATURITY_ALPHA; // this version's maturity level
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'tool_spamcleaner'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_task'; // Full name of the plugin (used for diagnostics)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_templatelibrary'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_unsuproles'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_uploadcourse'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_uploaduser'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061501; // The current module version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current module version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'tool_usertours'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'tool_xmldb'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'auth_cas'; // Full name of the plugin (used for diagnostics)
-$plugin->dependencies = array('auth_ldap' => 2020060900);
+$plugin->dependencies = array('auth_ldap' => 2021052500);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'auth_db'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'auth_email'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'auth_ldap'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'auth_lti'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'auth_manual'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'auth_mnet'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'auth_nologin'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'auth_none'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'auth_oauth2'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'auth_shibboleth'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'auth_webservice'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'availability_completion';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'availability_date';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'availability_grade';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'availability_group';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'availability_grouping';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'availability_profile';
noneNode.appendChild(deleteIcon.span);
// Also if it's not the root, none is actually invalid, so add a label.
- noneNode.appendChild(Y.Node.create('<span class="mt-1 label label-warning">' +
+ noneNode.appendChild(Y.Node.create('<span class="mt-1 badge badge-warning">' +
M.util.get_string('invalid', 'availability') + '</span>'));
}
// Add the invalid marker (empty).
this.node.appendChild(document.createTextNode(' '));
- this.node.appendChild(Y.Node.create('<span class="label label-warning"/>'));
+ this.node.appendChild(Y.Node.create('<span class="badge badge-warning"/>'));
};
/**
errors.push('core_availability:item_unknowntype');
}
// If any errors were added, add the marker to this item.
- var errorLabel = this.node.one('> .label-warning');
+ var errorLabel = this.node.one('> .badge-warning');
if (errors.length !== before && !errorLabel.get('firstChild')) {
errorLabel.appendChild(document.createTextNode(M.util.get_string('invalid', 'availability')));
} else if (errors.length === before && errorLabel.get('firstChild')) {
* point is backup when some behavior/approach channged, in order to allow
* conditional coding based on it.
*/
- const VERSION = 2020061500;
+ const VERSION = 2021052500;
/**
* Usually same than major release zero version, mainly for informative/historic purposes.
*/
*/
function getAllCopyProgress() {
var copyids = [];
- var progressbars = $('.progress').find('.progress-bar').not('.complete');
+ var progressbars = $('.progress').find('.progress-bar[data-operation][data-backupid][data-restoreid]').not('.complete');
progressbars.each(function() {
let progressvars = {
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_activity_modules'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'block_activity_results'; // Full name of the plugin (used for diagnostics).
\ No newline at end of file
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_admin_bookmarks'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'block_badges';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_blog_menu'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_blog_recent'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_blog_tags'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_calendar_month'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_calendar_upcoming'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_comments'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'block_completionstatus';
-$plugin->dependencies = array('report_completion' => 2020060900);
+$plugin->dependencies = array('report_completion' => 2021052500);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_course_list'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_course_summary'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_feedback'; // Full name of the plugin (used for diagnostics)
-$plugin->dependencies = array('mod_feedback' => 2020060900);
+$plugin->dependencies = array('mod_feedback' => 2021052500);
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'block_globalsearch';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_glossary_random'; // Full name of the plugin (used for diagnostics)
-$plugin->dependencies = array('mod_glossary' => 2020060900);
+$plugin->dependencies = array('mod_glossary' => 2021052500);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_html'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_login'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'block_lp';
$plugin->dependencies = array(
'tool_lp' => ANY_VERSION
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_mentees'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_mnet_hosts'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'block_myoverview'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_myprofile'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_navigation'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_news_items'; // Full name of the plugin (used for diagnostics)
-$plugin->dependencies = array('mod_forum' => 2020060900);
+$plugin->dependencies = array('mod_forum' => 2021052500);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_online_users'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_private_files'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_quiz_results'; // Full name of the plugin (used for diagnostics)
-$plugin->dependencies = array('mod_quiz' => 2020060900);
+$plugin->dependencies = array('mod_quiz' => 2021052500);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_recent_activity'; // Full name of the plugin (used for diagnostics)
*/
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'block_recentlyaccessedcourses'; // Full name of the plugin (used for diagnostics).
* @return array Additional properties with values
*/
protected function get_other_values(renderer_base $output) {
- global $OUTPUT;
+ global $CFG;
+ require_once($CFG->libdir.'/modinfolib.php');
return array(
- 'viewurl' => (new moodle_url('/mod/'.$this->data->modname.'/view.php',
- array('id' => $this->data->cmid)))->out(false),
- 'courseviewurl' => (new moodle_url('/course/view.php', array('id' => $this->data->courseid)))->out(false),
- 'icon' => $OUTPUT->image_icon('icon', get_string('pluginname', $this->data->modname), $this->data->modname)
+ 'viewurl' => (new moodle_url('/mod/'.$this->data->modname.'/view.php',
+ array('id' => $this->data->cmid)))->out(false),
+ 'courseviewurl' => (new moodle_url('/course/view.php', array('id' => $this->data->courseid)))->out(false),
+ 'icon' => \html_writer::img(
+ get_fast_modinfo($this->data->courseid)->cms[$this->data->cmid]->get_icon_url(),
+ get_string('pluginname', $this->data->modname),
+ ['title' => get_string('pluginname', $this->data->modname), 'class' => 'icon']
+ )
);
}
)
);
}
-}
\ No newline at end of file
+}
*/
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'block_recentlyaccesseditems'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_rss_client'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_search_forums'; // Full name of the plugin (used for diagnostics)
-$plugin->dependencies = array('mod_forum' => 2020060900);
+$plugin->dependencies = array('mod_forum' => 2021052500);
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_section_links'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_selfcompletion'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_settings'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_site_main_menu'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_social_activities'; // Full name of the plugin (used for diagnostics)
*/
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->component = 'block_starredcourses';
\ No newline at end of file
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_tag_flickr'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_tag_youtube'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'block_tags'; // Full name of the plugin (used for diagnostics)
};
calendarEvents.forEach(function(calendarEvent) {
- var dayTimestamp = UserDate.getUserMidnightForTimestamp(calendarEvent.timesort, midnight);
+ var dayTimestamp = calendarEvent.timeusermidnight;
if (eventsByDay[dayTimestamp]) {
eventsByDay[dayTimestamp].push(calendarEvent);
} else {
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'block_timeline'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'cachelock_file'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
$plugin->maturity = MATURITY_STABLE;
$plugin->component = 'cachestore_apcu';
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current module version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'cachestore_file'; // Full name of the plugin.
\ No newline at end of file
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current module version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'cachestore_memcached'; // Full name of the plugin.
\ No newline at end of file
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current module version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'cachestore_mongodb'; // Full name of the plugin.
\ No newline at end of file
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->maturity = MATURITY_STABLE;
$plugin->component = 'cachestore_redis';
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current module version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'cachestore_session'; // Full name of the plugin.
\ No newline at end of file
defined('MOODLE_INTERNAL') || die;
-$plugin->version = 2020061500; // The current module version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current module version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'cachestore_static'; // Full name of the plugin.
\ No newline at end of file
$data->timestart = $starttimestamp;
$data->timeduration = $endtimestamp - $starttimestamp;
$data->timesort = $event->get_times()->get_sort_time()->getTimestamp();
+ $data->timeusermidnight = $event->get_times()->get_usermidnight_time()->getTimestamp();
$data->visible = $event->is_visible() ? 1 : 0;
$data->timemodified = $event->get_times()->get_modified_time()->getTimestamp();
$data->component = $event->get_component();
'timestart' => ['type' => PARAM_INT],
'timeduration' => ['type' => PARAM_INT],
'timesort' => ['type' => PARAM_INT],
+ 'timeusermidnight' => ['type' => PARAM_INT],
'visible' => ['type' => PARAM_INT],
'timemodified' => ['type' => PARAM_INT],
];
(new \DateTimeImmutable())->setTimestamp($dbrow->timestart),
(new \DateTimeImmutable())->setTimestamp($dbrow->timestart + $dbrow->timeduration),
(new \DateTimeImmutable())->setTimestamp($dbrow->timesort ? $dbrow->timesort : $dbrow->timestart),
- (new \DateTimeImmutable())->setTimestamp($dbrow->timemodified)
+ (new \DateTimeImmutable())->setTimestamp($dbrow->timemodified),
+ (new \DateTimeImmutable())->setTimestamp(usergetmidnight($dbrow->timesort))
),
!empty($dbrow->visible),
$subscription,
'timestart' => $event->get_times()->get_start_time()->getTimestamp(),
'timeduration' => $timeduration,
'timesort' => $event->get_times()->get_sort_time()->getTimestamp(),
+ 'timeusermidnight' => $event->get_times()->get_usermidnight_time()->getTimestamp(),
'visible' => $event->is_visible() ? 1 : 0,
'timemodified' => $event->get_times()->get_modified_time()->getTimestamp(),
'subscriptionid' => $event->get_subscription() ? $event->get_subscription()->get('id') : null,
*/
protected $modified;
+ /**
+ * @var \DateTimeImmutable $usermidnight User midnight for the event.
+ */
+ protected $usermidnight;
+
/**
* Constructor.
*
- * @param \DateTimeImmutable $start Event start time.
- * @param \DateTimeImmutable $end Event end time.
- * @param \DateTimeImmutable $sort Date used to sort events.
- * @param \DateTimeImmutable $modified Time event was last updated.
+ * @param \DateTimeImmutable $start Event start time.
+ * @param \DateTimeImmutable $end Event end time.
+ * @param \DateTimeImmutable $sort Date used to sort events.
+ * @param \DateTimeImmutable $modified Time event was last updated.
+ * @param \DateTimeImmutable $usermidnight User midnight for the event.
*/
public function __construct(
\DateTimeImmutable $start,
\DateTimeImmutable $end,
\DateTimeImmutable $sort,
- \DateTimeImmutable $modified
+ \DateTimeImmutable $modified,
+ \DateTimeImmutable $usermidnight
) {
$this->start = $start;
$this->end = $end;
$this->sort = $sort;
$this->modified = $modified;
+ $this->usermidnight = $usermidnight;
}
public function get_start_time() {
public function get_sort_time() {
return $this->sort;
}
+
+ /**
+ * Getter for usermidnight.
+ *
+ * @return \DateTimeImmutable
+ */
+ public function get_usermidnight_time() {
+ return $this->usermidnight;
+ }
}
* @return \DateTimeImmutable
*/
public function get_modified_time();
+
+ /**
+ * Get the user midnight time.
+ *
+ * @return \DateTimeImmutable
+ */
+ public function get_usermidnight_time();
}
* @property string $eventtype The event type
* @property int $timestart The start time as a timestamp
* @property int $timeduration The duration of the event in seconds
+ * @property int $timeusermidnight User midnight for the event
* @property int $visible 1 if the event is visible
* @property int $uuid ?
* @property int $sequence ?
(new \DateTimeImmutable())->setTimestamp(-386380800),
(new \DateTimeImmutable())->setTimestamp(115776000),
(new \DateTimeImmutable())->setTimestamp(115776000),
- (new \DateTimeImmutable())->setTimestamp(time())
+ (new \DateTimeImmutable())->setTimestamp(time()),
+ (new \DateTimeImmutable())->setTimestamp(115776000)
);
}
(new \DateTimeImmutable())->setTimestamp(-386380800),
(new \DateTimeImmutable())->setTimestamp(115776000),
(new \DateTimeImmutable())->setTimestamp(115776000),
- (new \DateTimeImmutable())->setTimestamp(time())
+ (new \DateTimeImmutable())->setTimestamp(time()),
+ (new \DateTimeImmutable())->setTimestamp(115776000)
),
'visible' => true,
'subscription' => new std_proxy(1, $lamecallable),
$constructorparams['start_time'],
$constructorparams['end_time'],
$constructorparams['sort_time'],
- $constructorparams['modified_time']
+ $constructorparams['modified_time'],
+ $constructorparams['usermidnight_time']
);
foreach ($constructorparams as $name => $value) {
'start_time' => (new \DateTimeImmutable())->setTimestamp(-386380800),
'end_time' => (new \DateTimeImmutable())->setTimestamp(115776000),
'sort_time' => (new \DateTimeImmutable())->setTimestamp(115776000),
- 'modified_time' => (new \DateTimeImmutable())->setTimestamp(time())
+ 'modified_time' => (new \DateTimeImmutable())->setTimestamp(time()),
+ 'usermidnight_time' => (new \DateTimeImmutable())->setTimestamp(115776000),
]
],
'Dataset 2' => [
'start_time' => (new \DateTimeImmutable())->setTimestamp(123456),
'end_time' => (new \DateTimeImmutable())->setTimestamp(12345678),
'sort_time' => (new \DateTimeImmutable())->setTimestamp(1111),
- 'modified_time' => (new \DateTimeImmutable())->setTimestamp(time())
+ 'modified_time' => (new \DateTimeImmutable())->setTimestamp(time()),
+ 'usermidnight_time' => (new \DateTimeImmutable())->setTimestamp(1111),
]
]
];
(new \DateTimeImmutable())->setTimestamp($record->timestart),
(new \DateTimeImmutable())->setTimestamp($record->timestart + $record->timeduration),
(new \DateTimeImmutable())->setTimestamp($record->timesort ? $record->timesort : $record->timestart),
- (new \DateTimeImmutable())->setTimestamp($record->timemodified)
+ (new \DateTimeImmutable())->setTimestamp($record->timemodified),
+ (new \DateTimeImmutable())->setTimestamp(usergetmidnight($record->timesort))
),
!empty($record->visible),
$subscription,
(new \DateTimeImmutable())->setTimestamp($dbrow->timestart),
(new \DateTimeImmutable())->setTimestamp($dbrow->timestart + $dbrow->timeduration),
(new \DateTimeImmutable())->setTimestamp($dbrow->timesort ? $dbrow->timesort : $dbrow->timestart),
- (new \DateTimeImmutable())->setTimestamp($dbrow->timemodified)
+ (new \DateTimeImmutable())->setTimestamp($dbrow->timemodified),
+ (new \DateTimeImmutable())->setTimestamp(usergetmidnight($dbrow->timesort))
),
!empty($dbrow->visible),
new std_proxy($dbrow->subscriptionid, $identity),
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'calendartype_gregorian'; // Full name of the plugin (used for diagnostics).
This files describes API changes in /calendar/* ,
information provided here is intended especially for developers.
+=== 4.0 ===
+* The core_calendar\local\event\value_objects\times_interface class now has new method get_usermidnight_time() which
+ returns the user midnight time for a given event.
+
=== 3.9 ===
* Plugins can now create their own calendar events, both standard and action ones. To do it they need to specify
$event->component when creating an event. Component events can not be edited or deleted manually.
return $this->content->configdata;
}
+ /**
+ * Import a file as a valid content.
+ *
+ * By default, all content has a public file area to interact with the content bank
+ * repository. This method should be overridden by contentypes which does not simply
+ * upload to the public file area.
+ *
+ * If any, the method will return the final stored_file. This way it can be invoked
+ * as parent::import_file in case any plugin want to store the file in the public area
+ * and also parse it.
+ *
+ * @throws file_exception If file operations fail
+ * @param stored_file $file File to store in the content file area.
+ * @return stored_file|null the stored content file or null if the file is discarted.
+ */
+ public function import_file(stored_file $file): ?stored_file {
+ $originalfile = $this->get_file();
+ if ($originalfile) {
+ $originalfile->replace_file_with($file);
+ return $originalfile;
+ } else {
+ $itemid = $this->get_id();
+ $fs = get_file_storage();
+ $filerecord = [
+ 'contextid' => $this->get_contextid(),
+ 'component' => 'contentbank',
+ 'filearea' => 'public',
+ 'itemid' => $this->get_id(),
+ 'filepath' => '/',
+ 'filename' => $file->get_filename(),
+ 'timecreated' => time(),
+ ];
+ return $fs->create_file_from_storedfile($filerecord, $file);
+ }
+ }
+
/**
* Returns the $file related to this content.
*
/**
* Create content from a file information.
*
+ * @throws file_exception If file operations fail
+ * @throws dml_exception if the content creation fails
* @param \context $context Context where to upload the file and content.
* @param int $userid Id of the user uploading the file.
* @param stored_file $file The file to get information from
$record->name = $filename;
$record->usercreated = $userid;
$contentype = new $classname($context);
- $content = $contentype->create_content($record);
+ $content = $contentype->upload_content($file, $record);
$event = \core\event\contentbank_content_uploaded::create_from_record($content->get_content());
$event->trigger();
return $content;
use core\event\contentbank_content_created;
use core\event\contentbank_content_deleted;
use core\event\contentbank_content_viewed;
+use stored_file;
+use Exception;
use moodle_url;
/**
/**
* Fills content_bank table with appropiate information.
*
+ * @throws dml_exception A DML specific exception is thrown for any creation error.
* @param \stdClass $record An optional content record compatible object (default null)
* @return content Object with content bank information.
*/
- public function create_content(\stdClass $record = null): ?content {
+ public function create_content(\stdClass $record = null): content {
global $USER, $DB;
$entry = new \stdClass();
$entry->configdata = $record->configdata ?? '';
$entry->instanceid = $record->instanceid ?? 0;
$entry->id = $DB->insert_record('contentbank_content', $entry);
- if ($entry->id) {
- $classname = '\\'.$entry->contenttype.'\\content';
- $content = new $classname($entry);
- // Trigger an event for creating the content.
- $event = contentbank_content_created::create_from_record($content->get_content());
- $event->trigger();
- return $content;
+ $classname = '\\'.$entry->contenttype.'\\content';
+ $content = new $classname($entry);
+ // Trigger an event for creating the content.
+ $event = contentbank_content_created::create_from_record($content->get_content());
+ $event->trigger();
+ return $content;
+ }
+
+ /**
+ * Create a new content from an uploaded file.
+ *
+ * @throws file_exception If file operations fail
+ * @throws dml_exception if the content creation fails
+ * @param stored_file $file the uploaded file
+ * @param \stdClass|null $record an optional content record
+ * @return content Object with content bank information.
+ */
+ public function upload_content(stored_file $file, \stdClass $record = null): content {
+ if (empty($record)) {
+ $record = new \stdClass();
+ $record->name = $file->get_filename();
}
- return null;
+ $content = $this->create_content($record);
+ try {
+ $content->import_file($file);
+ } catch (Exception $e) {
+ $this->delete_content($content);
+ throw $e;
+ }
+
+ return $content;
}
/**
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'contenttype_h5p'; // Full name of the plugin (used for diagnostics).
$this->assertEquals($newcontext->id, $content->get_contextid());
$this->assertEquals($newcontext->id, $file->get_contextid());
}
+
+ /**
+ * Tests for 'import_file' behaviour when replacing a file.
+ *
+ * @covers ::import_file
+ */
+ public function test_import_file_replace(): void {
+ global $USER;
+ $this->resetAfterTest();
+ $this->setAdminUser();
+ $context = context_system::instance();
+
+ // Add some content to the content bank.
+ $generator = $this->getDataGenerator()->get_plugin_generator('core_contentbank');
+ $contents = $generator->generate_contentbank_data('contenttype_testable', 3, 0, $context);
+ $content = reset($contents);
+
+ $originalfile = $content->get_file();
+
+ // Create a dummy file.
+ $filerecord = array(
+ 'contextid' => $context->id,
+ 'component' => 'contentbank',
+ 'filearea' => 'draft',
+ 'itemid' => $content->get_id(),
+ 'filepath' => '/',
+ 'filename' => 'example.txt'
+ );
+ $fs = get_file_storage();
+ $file = $fs->create_file_from_string($filerecord, 'Dummy content ');
+
+ $importedfile = $content->import_file($file);
+
+ $this->assertEquals($originalfile->get_filename(), $importedfile->get_filename());
+ $this->assertEquals($originalfile->get_filearea(), $importedfile->get_filearea());
+ $this->assertEquals($originalfile->get_filepath(), $importedfile->get_filepath());
+ $this->assertEquals($originalfile->get_mimetype(), $importedfile->get_mimetype());
+
+ $this->assertEquals($file->get_userid(), $importedfile->get_userid());
+ $this->assertEquals($file->get_contenthash(), $importedfile->get_contenthash());
+ }
+
+ /**
+ * Tests for 'import_file' behaviour when uploading a new file.
+ *
+ * @covers ::import_file
+ */
+ public function test_import_file_upload(): void {
+ global $USER;
+ $this->resetAfterTest();
+ $this->setAdminUser();
+ $context = context_system::instance();
+
+ $type = new contenttype($context);
+ $record = (object)[
+ 'name' => 'content name',
+ 'usercreated' => $USER->id,
+ ];
+ $content = $type->create_content($record);
+
+ // Create a dummy file.
+ $filerecord = array(
+ 'contextid' => $context->id,
+ 'component' => 'contentbank',
+ 'filearea' => 'draft',
+ 'itemid' => $content->get_id(),
+ 'filepath' => '/',
+ 'filename' => 'example.txt'
+ );
+ $fs = get_file_storage();
+ $file = $fs->create_file_from_string($filerecord, 'Dummy content ');
+
+ $importedfile = $content->import_file($file);
+
+ $this->assertEquals($file->get_filename(), $importedfile->get_filename());
+ $this->assertEquals($file->get_userid(), $importedfile->get_userid());
+ $this->assertEquals($file->get_mimetype(), $importedfile->get_mimetype());
+ $this->assertEquals($file->get_contenthash(), $importedfile->get_contenthash());
+ $this->assertEquals('public', $importedfile->get_filearea());
+ $this->assertEquals('/', $importedfile->get_filepath());
+
+ $contentfile = $content->get_file($file);
+ $this->assertEquals($importedfile->get_id(), $contentfile->get_id());
+ }
}
$this->resetAfterTest();
$cb = new contentbank();
- $expectedsupporters = [$extension => $expected];
$systemcontext = context_system::instance();
// All contexts allowed for admins.
$this->setAdminUser();
$contextsupporters = $cb->load_context_supported_extensions($systemcontext);
- $this->assertEquals($expectedsupporters, $contextsupporters);
+ $this->assertArrayHasKey($extension, $contextsupporters);
+ $this->assertEquals($expected, $contextsupporters[$extension]);
}
/**
$this->resetAfterTest();
$cb = new contentbank();
- $expectedsupporters = [$extension => $expected];
$course = $this->getDataGenerator()->create_course();
$teacher = $this->getDataGenerator()->create_and_enrol($course, 'editingteacher');
// Teachers has permission in their context to upload supported by H5P content type.
$contextsupporters = $cb->load_context_supported_extensions($coursecontext);
- $this->assertEquals($expectedsupporters, $contextsupporters);
+ $this->assertArrayHasKey($extension, $contextsupporters);
+ $this->assertEquals($expected, $contextsupporters[$extension]);
}
/**
use stdClass;
use context_system;
+use context_user;
+use Exception;
use contenttype_testable\contenttype as contenttype;
/**
* Test for content bank contenttype class.
$this->assertInstanceOf('\\contenttype_testable\\content', $content);
}
+ /**
+ * Tests for behaviour of upload_content() with a file and a record.
+ *
+ * @dataProvider upload_content_provider
+ * @param bool $userecord if a predefined record has to be used.
+ *
+ * @covers ::upload_content
+ */
+ public function test_upload_content(bool $userecord): void {
+ global $USER;
+
+ $this->resetAfterTest();
+ $this->setAdminUser();
+
+ $dummy = [
+ 'contextid' => context_user::instance($USER->id)->id,
+ 'component' => 'user',
+ 'filearea' => 'draft',
+ 'itemid' => 1,
+ 'filepath' => '/',
+ 'filename' => 'file.h5p',
+ 'userid' => $USER->id,
+ ];
+ $fs = get_file_storage();
+ $dummyfile = $fs->create_file_from_string($dummy, 'Dummy content');
+
+ // Create content.
+ if ($userecord) {
+ $record = new stdClass();
+ $record->name = 'Test content';
+ $record->configdata = '';
+ $record->contenttype = '';
+ $checkname = $record->name;
+ } else {
+ $record = null;
+ $checkname = $dummyfile->get_filename();
+ }
+
+ $contenttype = new contenttype(context_system::instance());
+ $content = $contenttype->upload_content($dummyfile, $record);
+
+ $this->assertEquals('contenttype_testable', $content->get_content_type());
+ $this->assertEquals($checkname, $content->get_name());
+ $this->assertInstanceOf('\\contenttype_testable\\content', $content);
+
+ $file = $content->get_file();
+ $this->assertEquals($dummyfile->get_filename(), $file->get_filename());
+ $this->assertEquals($dummyfile->get_userid(), $file->get_userid());
+ $this->assertEquals($dummyfile->get_mimetype(), $file->get_mimetype());
+ $this->assertEquals($dummyfile->get_contenthash(), $file->get_contenthash());
+ $this->assertEquals('contentbank', $file->get_component());
+ $this->assertEquals('public', $file->get_filearea());
+ $this->assertEquals('/', $file->get_filepath());
+ }
+
+ /**
+ * Data provider for test_rename_content.
+ *
+ * @return array
+ */
+ public function upload_content_provider() {
+ return [
+ 'With record' => [true],
+ 'Without record' => [false],
+ ];
+ }
+
+ /**
+ * Tests for behaviour of upload_content() with a file wrong file.
+ *
+ * @covers ::upload_content
+ */
+ public function test_upload_content_exception(): void {
+ global $USER, $DB;
+
+ $this->resetAfterTest();
+ $this->setAdminUser();
+
+ // The testing contenttype thows exception if filename is "error.*".
+ $dummy = [
+ 'contextid' => context_user::instance($USER->id)->id,
+ 'component' => 'user',
+ 'filearea' => 'draft',
+ 'itemid' => 1,
+ 'filepath' => '/',
+ 'filename' => 'error.txt',
+ 'userid' => $USER->id,
+ ];
+ $fs = get_file_storage();
+ $dummyfile = $fs->create_file_from_string($dummy, 'Dummy content');
+
+ $contenttype = new contenttype(context_system::instance());
+ $cbcontents = $DB->count_records('contentbank_content');
+
+ // We need to capture the exception to check no content is created.
+ try {
+ $content = $contenttype->upload_content($dummyfile);
+ $this->assertTrue(false);
+ } catch (Exception $e) {
+ $this->assertTrue(true);
+ }
+ $this->assertEquals($cbcontents, $DB->count_records('contentbank_content'));
+ $this->assertEquals(1, $DB->count_records('files', ['contenthash' => $dummyfile->get_contenthash()]));
+ }
+
/**
* Test the behaviour of can_delete().
*/
namespace contenttype_testable;
+use file_exception;
+use stored_file;
+
/**
* Testable content plugin class.
*
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class content extends \core_contentbank\content {
+
+ /**
+ * Import a file as a valid content.
+ *
+ * This method will thow an error if the filename is "error.*"
+ *
+ * @param stored_file $file File to store in the content file area.
+ * @return stored_file|null the stored content file or null if the file is discarted.
+ * @throws file_exception if the filename contains the word "error"
+ */
+ public function import_file(stored_file $file): ?stored_file {
+ $filename = $file->get_filename();
+ if (strrpos($filename, 'error') !== false) {
+ throw new file_exception('yourerrorthanks', 'contenttype_test');
+ }
+ return parent::import_file($file);
+ }
}
require('../config.php');
require_once("$CFG->dirroot/contentbank/files_form.php");
+use core\output\notification;
+
require_login();
$contextid = optional_param('contextid', \context_system::instance()->id, PARAM_INT);
$mform = new contentbank_files_form(null, ['contextid' => $contextid, 'data' => $data, 'options' => $options]);
+$error = '';
+
if ($mform->is_cancelled()) {
redirect($returnurl);
} else if ($formdata = $mform->get_data()) {
if (!empty($files)) {
$file = reset($files);
$content = $cb->create_content_from_file($context, $USER->id, $file);
- file_save_draft_area_files($formdata->file, $contextid, 'contentbank', 'public', $content->get_id());
$viewurl = new \moodle_url('/contentbank/view.php', ['id' => $content->get_id(), 'contextid' => $contextid]);
redirect($viewurl);
+ } else {
+ $error = get_string('errornofile', 'contentbank');
}
- redirect($returnurl);
}
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox');
+if (!empty($error)) {
+ echo $OUTPUT->notification($error, notification::NOTIFY_ERROR);
+}
+
$mform->display();
echo $OUTPUT->box_end();
}
require_capability('moodle/course:create', $context);
+ // Fullname and short name are required to be non-empty.
+ if (trim($course['fullname']) === '') {
+ throw new moodle_exception('errorinvalidparam', 'webservice', '', 'fullname');
+ } else if (trim($course['shortname']) === '') {
+ throw new moodle_exception('errorinvalidparam', 'webservice', '', 'shortname');
+ }
+
// Make sure lang is valid
if (array_key_exists('lang', $course)) {
if (empty($availablelangs[$course['lang']])) {
$course['category'] = $course['categoryid'];
}
- // Check if the user can change fullname.
+ // Check if the user can change fullname, and the new value is non-empty.
if (array_key_exists('fullname', $course) && ($oldcourse->fullname != $course['fullname'])) {
require_capability('moodle/course:changefullname', $context);
+ if (trim($course['fullname']) === '') {
+ throw new moodle_exception('errorinvalidparam', 'webservice', '', 'fullname');
+ }
}
- // Check if the user can change shortname.
+ // Check if the user can change shortname, and the new value is non-empty.
if (array_key_exists('shortname', $course) && ($oldcourse->shortname != $course['shortname'])) {
require_capability('moodle/course:changeshortname', $context);
+ if (trim($course['shortname']) === '') {
+ throw new moodle_exception('errorinvalidparam', 'webservice', '', 'shortname');
+ }
}
// Check if the user can change the idnumber.
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'format_singleactivity'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX)
-$plugin->requires = 2020060900; // Requires this Moodle version
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX)
+$plugin->requires = 2021052500; // Requires this Moodle version
$plugin->component = 'format_social'; // Full name of the plugin (used for diagnostics)
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'format_topics'; // Full name of the plugin (used for diagnostics).
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500; // The current plugin version (Date: YYYYMMDDXX).
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500; // The current plugin version (Date: YYYYMMDDXX).
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'format_weeks'; // Full name of the plugin (used for diagnostics).
if ($mform->is_cancelled()) {
if ($return && !empty($cm->id)) {
- redirect("$CFG->wwwroot/mod/$module->name/view.php?id=$cm->id");
+ $urlparams = [
+ 'id' => $cm->id, // We always need the activity id.
+ 'forceview' => 1, // Stop file downloads in resources.
+ ];
+ $activityurl = new moodle_url("/mod/$module->name/view.php", $urlparams);
+ redirect($activityurl);
} else {
redirect(course_get_url($course, $cw->section, array('sr' => $sectionreturn)));
}
$createdsubcats = core_course_external::create_courses($courses);
}
+ /**
+ * Data provider for testing empty fields produce expected exceptions
+ *
+ * @see test_create_courses_empty_field
+ * @see test_update_courses_empty_field
+ *
+ * @return array
+ */
+ public function course_empty_field_provider(): array {
+ return [
+ [[
+ 'fullname' => '',
+ 'shortname' => 'ws101',
+ ], 'fullname'],
+ [[
+ 'fullname' => ' ',
+ 'shortname' => 'ws101',
+ ], 'fullname'],
+ [[
+ 'fullname' => 'Web Services',
+ 'shortname' => '',
+ ], 'shortname'],
+ [[
+ 'fullname' => 'Web Services',
+ 'shortname' => ' ',
+ ], 'shortname'],
+ ];
+ }
+
+ /**
+ * Test creating courses with empty fields throws an exception
+ *
+ * @param array $course
+ * @param string $expectedemptyfield
+ *
+ * @dataProvider course_empty_field_provider
+ */
+ public function test_create_courses_empty_field(array $course, string $expectedemptyfield): void {
+ $this->resetAfterTest();
+ $this->setAdminUser();
+
+ // Create a category for the new course.
+ $course['categoryid'] = $this->getDataGenerator()->create_category()->id;
+
+ $this->expectException(moodle_exception::class);
+ $this->expectExceptionMessageRegExp("/{$expectedemptyfield}/");
+ core_course_external::create_courses([$course]);
+ }
+
+ /**
+ * Test updating courses with empty fields returns warnings
+ *
+ * @param array $course
+ * @param string $expectedemptyfield
+ *
+ * @dataProvider course_empty_field_provider
+ */
+ public function test_update_courses_empty_field(array $course, string $expectedemptyfield): void {
+ $this->resetAfterTest();
+ $this->setAdminUser();
+
+ // Create a course to update.
+ $course['id'] = $this->getDataGenerator()->create_course()->id;
+
+ $result = core_course_external::update_courses([$course]);
+ $result = core_course_external::clean_returnvalue(core_course_external::update_courses_returns(), $result);
+
+ $this->assertCount(1, $result['warnings']);
+
+ $warning = reset($result['warnings']);
+ $this->assertEquals('errorinvalidparam', $warning['warningcode']);
+ $this->assertContains($expectedemptyfield, $warning['message']);
+ }
+
/**
* Test delete_courses
*/
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'customfield_checkbox';
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="16px" viewBox="0 0 16 16" version="1.1" preserveAspectRatio="xMinYMid meet">
+<g id="surface1">
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(60%,60%,60%);fill-opacity:1;" d="M 13.144531 8.304688 L 13.144531 11.144531 C 13.144531 11.851562 12.890625 12.457031 12.386719 12.960938 C 11.886719 13.460938 11.28125 13.714844 10.570312 13.714844 L 3.144531 13.714844 C 2.433594 13.714844 1.828125 13.460938 1.324219 12.960938 C 0.824219 12.457031 0.570312 11.851562 0.570312 11.144531 L 0.570312 3.714844 C 0.570312 3.007812 0.824219 2.398438 1.324219 1.898438 C 1.828125 1.394531 2.433594 1.144531 3.144531 1.144531 L 10.570312 1.144531 C 10.945312 1.144531 11.292969 1.21875 11.617188 1.367188 C 11.707031 1.40625 11.757812 1.476562 11.777344 1.570312 C 11.792969 1.671875 11.769531 1.757812 11.695312 1.832031 L 11.257812 2.269531 C 11.199219 2.328125 11.132812 2.355469 11.054688 2.355469 C 11.035156 2.355469 11.007812 2.351562 10.972656 2.339844 C 10.835938 2.304688 10.703125 2.285156 10.570312 2.285156 L 3.144531 2.285156 C 2.75 2.285156 2.414062 2.425781 2.132812 2.707031 C 1.855469 2.984375 1.714844 3.320312 1.714844 3.714844 L 1.714844 11.144531 C 1.714844 11.535156 1.855469 11.871094 2.132812 12.152344 C 2.414062 12.429688 2.75 12.570312 3.144531 12.570312 L 10.570312 12.570312 C 10.964844 12.570312 11.300781 12.429688 11.582031 12.152344 C 11.859375 11.871094 12 11.535156 12 11.144531 L 12 8.875 C 12 8.796875 12.027344 8.730469 12.082031 8.679688 L 12.652344 8.105469 C 12.710938 8.046875 12.78125 8.019531 12.855469 8.019531 C 12.894531 8.019531 12.929688 8.027344 12.964844 8.042969 C 13.082031 8.09375 13.144531 8.179688 13.144531 8.304688 Z M 15.207031 3.9375 L 7.9375 11.207031 C 7.792969 11.347656 7.625 11.417969 7.429688 11.417969 C 7.230469 11.417969 7.0625 11.347656 6.917969 11.207031 L 3.082031 7.367188 C 2.9375 7.222656 2.867188 7.054688 2.867188 6.855469 C 2.867188 6.660156 2.9375 6.492188 3.082031 6.347656 L 4.0625 5.367188 C 4.207031 5.222656 4.375 5.152344 4.570312 5.152344 C 4.769531 5.152344 4.9375 5.222656 5.082031 5.367188 L 7.429688 7.714844 L 13.207031 1.9375 C 13.347656 1.792969 13.519531 1.722656 13.714844 1.722656 C 13.910156 1.722656 14.082031 1.792969 14.222656 1.9375 L 15.207031 2.917969 C 15.347656 3.0625 15.417969 3.230469 15.417969 3.429688 C 15.417969 3.625 15.347656 3.792969 15.207031 3.9375 Z M 15.207031 3.9375 "/>
+</g>
+</svg>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="16px" height="16px" viewBox="0 0 16 16" version="1.1" preserveAspectRatio="xMinYMid meet">
+<g id="surface1">
+<path style=" stroke:none;fill-rule:nonzero;fill:rgb(60%,60%,60%);fill-opacity:1;" d="M 11.714844 2.285156 L 4.285156 2.285156 C 3.894531 2.285156 3.554688 2.425781 3.277344 2.707031 C 2.996094 2.984375 2.855469 3.320312 2.855469 3.714844 L 2.855469 11.144531 C 2.855469 11.535156 2.996094 11.871094 3.277344 12.152344 C 3.554688 12.429688 3.894531 12.570312 4.285156 12.570312 L 11.714844 12.570312 C 12.105469 12.570312 12.445312 12.429688 12.722656 12.152344 C 13.003906 11.871094 13.144531 11.535156 13.144531 11.144531 L 13.144531 3.714844 C 13.144531 3.320312 13.003906 2.984375 12.722656 2.707031 C 12.445312 2.425781 12.105469 2.285156 11.714844 2.285156 Z M 14.285156 3.714844 L 14.285156 11.144531 C 14.285156 11.851562 14.035156 12.457031 13.53125 12.960938 C 13.027344 13.460938 12.421875 13.714844 11.714844 13.714844 L 4.285156 13.714844 C 3.578125 13.714844 2.972656 13.460938 2.46875 12.960938 C 1.964844 12.457031 1.714844 11.851562 1.714844 11.144531 L 1.714844 3.714844 C 1.714844 3.007812 1.964844 2.398438 2.46875 1.898438 C 2.972656 1.394531 3.578125 1.144531 4.285156 1.144531 L 11.714844 1.144531 C 12.421875 1.144531 13.027344 1.394531 13.53125 1.898438 C 14.035156 2.398438 14.285156 3.007812 14.285156 3.714844 Z M 14.285156 3.714844 "/>
+</g>
+</svg>
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'customfield_date';
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'customfield_select';
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'customfield_text';
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'customfield_textarea';
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900;
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500;
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'dataformat_csv';
defined('MOODLE_INTERNAL') || die();
-$plugin->version = 2020061500;
-$plugin->requires = 2020060900; // Requires this Moodle version.
+$plugin->version = 2021052500;
+$plugin->requires = 2021052500; // Requires this Moodle version.
$plugin->component = 'dataformat_excel';