芝麻web文件管理V1.00
编辑当前文件:/home2/sdektunc/public_html/cepali/admin/tool/analytics/restoredefault.php
. /** * Check and create missing default prediction models. * * @package tool_analytics * @copyright 2019 David Mudrák
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ require_once(__DIR__ . '/../../../config.php'); require_login(); \core_analytics\manager::check_can_manage_models(); $confirmed = optional_param('confirmed', false, PARAM_BOOL); $restoreids = optional_param_array('restoreid', [], PARAM_ALPHANUM); $returnurl = new \moodle_url('/admin/tool/analytics/index.php'); $myurl = new \moodle_url('/admin/tool/analytics/restoredefault.php'); \tool_analytics\output\helper::set_navbar(get_string('restoredefault', 'tool_analytics'), $myurl); if (data_submitted()) { require_sesskey(); if (empty($restoreids)) { $message = get_string('restoredefaultempty', 'tool_analytics'); $type = \core\output\notification::NOTIFY_WARNING; redirect($myurl, $message, null, $type); } $numcreated = 0; foreach (\core_analytics\manager::load_default_models_for_all_components() as $componentname => $modelslist) { foreach ($modelslist as $definition) { if (!in_array(\core_analytics\manager::model_declaration_identifier($definition), $restoreids)) { // This model has not been selected by the user. continue; } list($target, $indicators) = \core_analytics\manager::get_declared_target_and_indicators_instances($definition); if (\core_analytics\model::exists($target, $indicators)) { // This model exists (normally this should not happen as we do not show such models in the UI to select). continue; } \core_analytics\manager::create_declared_model($definition); $numcreated++; } } $message = get_string('restoredefaultsome', 'tool_analytics', ['count' => $numcreated]); $type = \core\output\notification::NOTIFY_SUCCESS; redirect($returnurl, $message, null, $type); } $models = \core_analytics\manager::load_default_models_for_all_components(); $ui = new \tool_analytics\output\restorable_models($models); echo $OUTPUT->header(); echo $PAGE->get_renderer('tool_analytics')->render($ui); echo $OUTPUT->footer();