Moodle code style fixes part 10

This commit is contained in:
PMKuipers 2023-08-25 13:34:31 +02:00
parent 00b38f0a49
commit f8fd27528a
12 changed files with 533 additions and 536 deletions

View File

@ -59,7 +59,7 @@ abstract class aggregator {
} }
} }
public static function createOrDefault($mod, $configstr) { public static function createordefault($mod, $configstr) {
try { try {
return self::create($mod, $configstr); return self::create($mod, $configstr);
} catch (\ValueError $x) { } catch (\ValueError $x) {
@ -74,17 +74,17 @@ abstract class aggregator {
protected function initialize($configstr) { protected function initialize($configstr) {
} }
abstract public function needSelectGradables(); abstract public function select_gradables();
abstract public function isDeprecated(); abstract public function deprecated();
abstract public function aggregate_course(courseinfo $courseinfo, studyitem $studyitem, $userid); abstract public function aggregate_course(courseinfo $courseinfo, studyitem $studyitem, $userid);
abstract public function aggregate_junction(array $completion, studyitem $studyitem, $userid); abstract public function aggregate_junction(array $completion, studyitem $studyitem, $userid);
abstract public function grade_completion(gradeinfo $gradeinfo, $userid); abstract public function grade_completion(gradeinfo $gradeinfo, $userid);
// Aggregation method makes use of "required grades" in a course/module. // Aggregation method makes use of "required grades" in a course/module.
abstract public function useRequiredGrades(); abstract public function use_required_grades();
// Aggregation method makes use of . // Aggregation method makes use of .
abstract public function useItemConditions(); abstract public function use_item_conditions();
// Whether the aggregation method uses core_completion, or treestudyplan custom completion. // Whether the aggregation method uses core_completion, or treestudyplan custom completion.
public function usecorecompletioninfo() { public function usecorecompletioninfo() {
@ -107,8 +107,8 @@ abstract class aggregator {
public function basic_model() { public function basic_model() {
return [ return [
"useRequiredGrades" => $this->useRequiredGrades(), "useRequiredGrades" => $this->use_required_grades(),
"useItemConditions" => $this->useItemConditions(), "useItemConditions" => $this->use_item_conditions(),
]; ];
} }
@ -130,7 +130,7 @@ abstract class aggregator {
$list[] = [ $list[] = [
'id' => $agid, 'id' => $agid,
'name' => get_string("{$agid}_aggregator_title", "local_treestudyplan"), 'name' => get_string("{$agid}_aggregator_title", "local_treestudyplan"),
'deprecated' => $a->isDeprecated(), 'deprecated' => $a->deprecated(),
'defaultconfig' => $a->config_string(), 'defaultconfig' => $a->config_string(),
]; ];
} }

View File

@ -1,475 +1,474 @@
<?php <?php
// This file is part of the Studyplan plugin for Moodle // This file is part of the Studyplan plugin for Moodle
// //
// Moodle is free software: you can redistribute it and/or modify // Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or // the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// Moodle is distributed in the hope that it will be useful, // Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <https://www.gnu.org/licenses/>. // along with Moodle. If not, see <https://www.gnu.org/licenses/>.
/** /**
* *
* @package local_treestudyplan * @package local_treestudyplan
* @copyright 2023 P.M. Kuipers * @copyright 2023 P.M. Kuipers
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
namespace local_treestudyplan; namespace local_treestudyplan;
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
use local_treestudyplan\local\helpers\webservicehelper; use local_treestudyplan\local\helpers\webservicehelper;
require_once($CFG->libdir.'/externallib.php'); require_once($CFG->libdir.'/externallib.php');
class associationservice extends \external_api { class associationservice extends \external_api {
const CAP_EDIT = "local/treestudyplan:editstudyplan"; const CAP_EDIT = "local/treestudyplan:editstudyplan";
const CAP_VIEW = "local/treestudyplan:viewuserreports"; const CAP_VIEW = "local/treestudyplan:viewuserreports";
public static function user_structure() { public static function user_structure() {
return new \external_single_structure([ return new \external_single_structure([
"id" => new \external_value(PARAM_INT, 'user id'), "id" => new \external_value(PARAM_INT, 'user id'),
"username" => new \external_value(PARAM_TEXT, 'username'), "username" => new \external_value(PARAM_TEXT, 'username'),
"firstname" => new \external_value(PARAM_TEXT, 'first name'), "firstname" => new \external_value(PARAM_TEXT, 'first name'),
"lastname" => new \external_value(PARAM_TEXT, 'last name'), "lastname" => new \external_value(PARAM_TEXT, 'last name'),
"idnumber" => new \external_value(PARAM_TEXT, 'id number'), "idnumber" => new \external_value(PARAM_TEXT, 'id number'),
"email" => new \external_value(PARAM_TEXT, 'email address'), "email" => new \external_value(PARAM_TEXT, 'email address'),
]); ]);
} }
public static function make_user_model($r) { public static function make_user_model($r) {
return [ return [
"id" => $r->id, "id" => $r->id,
"username" => $r->username, "username" => $r->username,
"firstname" => $r->firstname, "firstname" => $r->firstname,
"lastname" => $r->lastname, "lastname" => $r->lastname,
"idnumber" => $r->idnumber, "idnumber" => $r->idnumber,
"email" => $r->email, "email" => $r->email,
]; ];
} }
public static function cohort_structure() { public static function cohort_structure() {
return new \external_single_structure([ return new \external_single_structure([
"id" => new \external_value(PARAM_INT, 'cohort id'), "id" => new \external_value(PARAM_INT, 'cohort id'),
"name" => new \external_value(PARAM_TEXT, 'name'), "name" => new \external_value(PARAM_TEXT, 'name'),
"idnumber" => new \external_value(PARAM_TEXT, 'id number'), "idnumber" => new \external_value(PARAM_TEXT, 'id number'),
"description" => new \external_value(PARAM_TEXT, 'description'), "description" => new \external_value(PARAM_TEXT, 'description'),
"visible" => new \external_value(PARAM_BOOL, 'is visible'), "visible" => new \external_value(PARAM_BOOL, 'is visible'),
"context" => new \external_single_structure([ "context" => new \external_single_structure([
"name" => new \external_value(PARAM_TEXT, 'context name'), "name" => new \external_value(PARAM_TEXT, 'context name'),
"shortname" => new \external_value(PARAM_TEXT, 'context short name'), "shortname" => new \external_value(PARAM_TEXT, 'context short name'),
"path" => new \external_multiple_structure( new \external_value(PARAM_TEXT)), "path" => new \external_multiple_structure( new \external_value(PARAM_TEXT)),
"shortpath" => new \external_multiple_structure( new \external_value(PARAM_TEXT)), "shortpath" => new \external_multiple_structure( new \external_value(PARAM_TEXT)),
], 'context information', VALUE_OPTIONAL), ], 'context information', VALUE_OPTIONAL),
]); ]);
} }
public static function make_cohort_model($r) { public static function make_cohort_model($r) {
global $DB; global $DB;
$ctx = \context::instance_by_id($r->contextid); $ctx = \context::instance_by_id($r->contextid);
$ctxPath = array_reverse($ctx->get_parent_context_ids(true)); $ctxpath = array_reverse($ctx->get_parent_context_ids(true));
if (count($ctxPath) > 1 && $ctxPath[0] == 1) { if (count($ctxpath) > 1 && $ctxpath[0] == 1) {
array_shift($ctxPath); array_shift($ctxpath);
} }
$result = [ $result = [
"id" => $r->id, "id" => $r->id,
"name" => $r->name, "name" => $r->name,
"idnumber" => $r->idnumber, "idnumber" => $r->idnumber,
"description" => $r->description, "description" => $r->description,
"visible" => $r->visible, "visible" => $r->visible,
"context" => [ "context" => [
"name" => $ctx->get_context_name(false, false), "name" => $ctx->get_context_name(false, false),
"shortname" => $ctx->get_context_name(false, true), "shortname" => $ctx->get_context_name(false, true),
"path" => array_map(function($c) { "path" => array_map(function($c) {
return \context::instance_by_id($c)->get_context_name(false, false); return \context::instance_by_id($c)->get_context_name(false, false);
}, $ctxPath), }, $ctxpath),
"shortpath" => array_map(function($c) { "shortpath" => array_map(function($c) {
return \context::instance_by_id($c)->get_context_name(false, true); return \context::instance_by_id($c)->get_context_name(false, true);
}, $ctxPath), }, $ctxpath),
] ]
]; ];
return $result; return $result;
} }
public static function list_cohort_parameters() { public static function list_cohort_parameters() {
return new \external_function_parameters( [ return new \external_function_parameters( [
'like' => new \external_value(PARAM_TEXT, 'search text', VALUE_OPTIONAL), 'like' => new \external_value(PARAM_TEXT, 'search text', VALUE_OPTIONAL),
'exclude_id' => new \external_value(PARAM_INT, 'exclude members of this studyplan', VALUE_OPTIONAL), 'exclude_id' => new \external_value(PARAM_INT, 'exclude members of this studyplan', VALUE_OPTIONAL),
'context_ic' => new \external_value(PARAM_INT, 'context for this request', VALUE_OPTIONAL), 'context_ic' => new \external_value(PARAM_INT, 'context for this request', VALUE_OPTIONAL),
] ); ] );
} }
public static function list_cohort_returns() { public static function list_cohort_returns() {
return new \external_multiple_structure(self::cohort_structure()); return new \external_multiple_structure(self::cohort_structure());
} }
// Actual functions. // Actual functions.
public static function list_cohort($like = '', $excludeid = null, $contextid = 1) { public static function list_cohort($like = '', $excludeid = null, $contextid = 1) {
global $CFG, $DB; global $CFG, $DB;
// Only allow this if the user has the right to edit in this context. // Only allow this if the user has the right to edit in this context.
$context = webservicehelper::find_context($contextid); $context = webservicehelper::find_context($contextid);
webservicehelper::require_capabilities(self::CAP_EDIT, $context); webservicehelper::require_capabilities(self::CAP_EDIT, $context);
$pattern = "%{$like}%"; $pattern = "%{$like}%";
$params = ["pattern_nm" => $pattern, "pattern_id" => $pattern, ]; $params = ["pattern_nm" => $pattern, "pattern_id" => $pattern, ];
$sql = "SELECT c.* from {cohort} c LEFT JOIN {local_treestudyplan_cohort} j ON c.id = j.cohort_id"; $sql = "SELECT c.* from {cohort} c LEFT JOIN {local_treestudyplan_cohort} j ON c.id = j.cohort_id";
$sql .= " WHERE c.visible = 1 AND(name LIKE :pattern_nm OR idnumber LIKE :pattern_id)"; $sql .= " WHERE c.visible = 1 AND(name LIKE :pattern_nm OR idnumber LIKE :pattern_id)";
if (isset($excludeid) && is_numeric($excludeid)) { if (isset($excludeid) && is_numeric($excludeid)) {
$sql .= " AND (j.studyplan_id IS NULL OR j.studyplan_id != :exclude_id)"; $sql .= " AND (j.studyplan_id IS NULL OR j.studyplan_id != :exclude_id)";
$params['exclude_id'] = $excludeid; $params['exclude_id'] = $excludeid;
} }
if ($contextid > 1) { if ($contextid > 1) {
// System context returns all cohorts, including system cohorts. // System context returns all cohorts, including system cohorts.
// Otherwise, . // Otherwise, .
$sql .= " AND contextid = :context_id"; $sql .= " AND contextid = :context_id";
$params['context_id'] = $contextid; $params['context_id'] = $contextid;
} }
$cohorts = []; $cohorts = [];
$rs = $DB->get_recordset_sql($sql, $params); $rs = $DB->get_recordset_sql($sql, $params);
foreach ($rs as $r) { foreach ($rs as $r) {
$cohorts[] = static::make_cohort_model($r); $cohorts[] = static::make_cohort_model($r);
} }
$rs->close(); $rs->close();
return $cohorts; return $cohorts;
} }
public static function find_user_parameters() { public static function find_user_parameters() {
return new \external_function_parameters( [ return new \external_function_parameters( [
'like' => new \external_value(PARAM_TEXT, 'search text'), 'like' => new \external_value(PARAM_TEXT, 'search text'),
'exclude_id' => new \external_value(PARAM_INT, 'exclude members of this studyplan', VALUE_OPTIONAL), 'exclude_id' => new \external_value(PARAM_INT, 'exclude members of this studyplan', VALUE_OPTIONAL),
'context_id' => new \external_value(PARAM_INT, 'context for this request', VALUE_OPTIONAL), 'context_id' => new \external_value(PARAM_INT, 'context for this request', VALUE_OPTIONAL),
] ); ] );
} }
public static function find_user_returns() { public static function find_user_returns() {
return new \external_multiple_structure(self::user_structure()); return new \external_multiple_structure(self::user_structure());
} }
// Actual functions. // Actual functions.
public static function find_user($like, $excludeid = null, $contextid = 1) { public static function find_user($like, $excludeid = null, $contextid = 1) {
global $CFG, $DB; global $CFG, $DB;
// Only allow this if the user has the right to edit in this context. // Only allow this if the user has the right to edit in this context.
$context = webservicehelper::find_context($contextid); $context = webservicehelper::find_context($contextid);
webservicehelper::require_capabilities(self::CAP_EDIT, $context); webservicehelper::require_capabilities(self::CAP_EDIT, $context);
$pattern = "%{$like}%"; $pattern = "%{$like}%";
$params = ["pattern_fn" => $pattern, $params = ["pattern_fn" => $pattern,
"pattern_ln" => $pattern, "pattern_ln" => $pattern,
"pattern_un" => $pattern, "pattern_un" => $pattern,
]; ];
$sql = "SELECT u.* from {user} u LEFT JOIN {local_treestudyplan_user} j ON u.id = j.user_id"; $sql = "SELECT u.* from {user} u LEFT JOIN {local_treestudyplan_user} j ON u.id = j.user_id";
$sql .= " WHERE u.deleted != 1 AND (firstname LIKE :pattern_fn OR lastname LIKE :pattern_ln OR username LIKE :pattern_un)"; $sql .= " WHERE u.deleted != 1 AND (firstname LIKE :pattern_fn OR lastname LIKE :pattern_ln OR username LIKE :pattern_un)";
if (isset($excludeid) && is_numeric($excludeid)) { if (isset($excludeid) && is_numeric($excludeid)) {
$sql .= " AND (j.studyplan_id IS NULL OR j.studyplan_id != :exclude_id)"; $sql .= " AND (j.studyplan_id IS NULL OR j.studyplan_id != :exclude_id)";
$params['exclude_id'] = $excludeid; $params['exclude_id'] = $excludeid;
} }
$users = []; $users = [];
$rs = $DB->get_recordset_sql($sql, $params); $rs = $DB->get_recordset_sql($sql, $params);
foreach ($rs as $r) { foreach ($rs as $r) {
$users[] = static::make_user_model($r); $users[] = static::make_user_model($r);
} }
$rs->close(); $rs->close();
self::sortusermodels($users); self::sortusermodels($users);
return $users; return $users;
} }
public static function connect_cohort_parameters() { public static function connect_cohort_parameters() {
return new \external_function_parameters( [ return new \external_function_parameters( [
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL), "studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL),
"cohort_id" => new \external_value(PARAM_INT, 'id of cohort to link', VALUE_OPTIONAL), "cohort_id" => new \external_value(PARAM_INT, 'id of cohort to link', VALUE_OPTIONAL),
] ); ] );
} }
public static function connect_cohort_returns() { public static function connect_cohort_returns() {
return new \external_single_structure([ return new \external_single_structure([
"success" => new \external_value(PARAM_BOOL, 'operation completed succesfully'), "success" => new \external_value(PARAM_BOOL, 'operation completed succesfully'),
"msg" => new \external_value(PARAM_TEXT, 'message'), "msg" => new \external_value(PARAM_TEXT, 'message'),
]); ]);
} }
// Actual functions. // Actual functions.
public static function connect_cohort($studyplanid, $cohortid) { public static function connect_cohort($studyplanid, $cohortid) {
global $CFG, $DB; global $CFG, $DB;
$studyplan = studyplan::findById($studyplanid); $studyplan = studyplan::findById($studyplanid);
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context()); webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
if (!$DB->record_exists('local_treestudyplan_cohort', ['studyplan_id' => $studyplanid, 'cohort_id' => $cohortid])) { if (!$DB->record_exists('local_treestudyplan_cohort', ['studyplan_id' => $studyplanid, 'cohort_id' => $cohortid])) {
$id = $DB->insert_record('local_treestudyplan_cohort', [ $id = $DB->insert_record('local_treestudyplan_cohort', [
'studyplan_id' => $studyplanid, 'studyplan_id' => $studyplanid,
'cohort_id' => $cohortid, 'cohort_id' => $cohortid,
]); ]);
$studyplan->mark_csync_changed(); $studyplan->mark_csync_changed();
return ['success' => true, 'msg' => 'Cohort connected']; return ['success' => true, 'msg' => 'Cohort connected'];
} else { } else {
return ['success' => true, 'msg' => 'Cohort already connected']; return ['success' => true, 'msg' => 'Cohort already connected'];
} }
} }
public static function disconnect_cohort_parameters() { public static function disconnect_cohort_parameters() {
return new \external_function_parameters( [ return new \external_function_parameters( [
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL), "studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL),
"cohort_id" => new \external_value(PARAM_INT, 'id of cohort to link', VALUE_OPTIONAL), "cohort_id" => new \external_value(PARAM_INT, 'id of cohort to link', VALUE_OPTIONAL),
] ); ] );
} }
public static function disconnect_cohort_returns() { public static function disconnect_cohort_returns() {
return new \external_single_structure([ return new \external_single_structure([
"success" => new \external_value(PARAM_BOOL, 'operation completed succesfully'), "success" => new \external_value(PARAM_BOOL, 'operation completed succesfully'),
"msg" => new \external_value(PARAM_TEXT, 'message'), "msg" => new \external_value(PARAM_TEXT, 'message'),
]); ]);
} }
// Actual functions. // Actual functions.
public static function disconnect_cohort($studyplanid, $cohortid) { public static function disconnect_cohort($studyplanid, $cohortid) {
global $CFG, $DB; global $CFG, $DB;
$studyplan = studyplan::findById($studyplanid); $studyplan = studyplan::findById($studyplanid);
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context()); webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
if ($DB->record_exists('local_treestudyplan_cohort', ['studyplan_id' => $studyplanid, 'cohort_id' => $cohortid])) { if ($DB->record_exists('local_treestudyplan_cohort', ['studyplan_id' => $studyplanid, 'cohort_id' => $cohortid])) {
$DB->delete_records('local_treestudyplan_cohort', [ $DB->delete_records('local_treestudyplan_cohort', [
'studyplan_id' => $studyplanid, 'studyplan_id' => $studyplanid,
'cohort_id' => $cohortid, 'cohort_id' => $cohortid,
]); ]);
$studyplan->mark_csync_changed(); $studyplan->mark_csync_changed();
return ['success' => true, 'msg' => 'Cohort Disconnected']; return ['success' => true, 'msg' => 'Cohort Disconnected'];
} else { } else {
return ['success' => true, 'msg' => 'Connection does not exist']; return ['success' => true, 'msg' => 'Connection does not exist'];
} }
} }
public static function connect_user_parameters() { public static function connect_user_parameters() {
return new \external_function_parameters( [ return new \external_function_parameters( [
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL), "studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL),
"user_id" => new \external_value(PARAM_INT, 'id of user to link', VALUE_OPTIONAL), "user_id" => new \external_value(PARAM_INT, 'id of user to link', VALUE_OPTIONAL),
] ); ] );
} }
public static function connect_user_returns() { public static function connect_user_returns() {
return new \external_single_structure([ return new \external_single_structure([
"success" => new \external_value(PARAM_BOOL, 'operation completed succesfully'), "success" => new \external_value(PARAM_BOOL, 'operation completed succesfully'),
"msg" => new \external_value(PARAM_TEXT, 'message'), "msg" => new \external_value(PARAM_TEXT, 'message'),
]); ]);
} }
// Actual functions. // Actual functions.
public static function connect_user($studyplanid, $userid) { public static function connect_user($studyplanid, $userid) {
global $CFG, $DB; global $CFG, $DB;
$studyplan = studyplan::findById($studyplanid); $studyplan = studyplan::findById($studyplanid);
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context()); webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
if (!$DB->record_exists('local_treestudyplan_user', ['studyplan_id' => $studyplanid, 'user_id' => $userid])) { if (!$DB->record_exists('local_treestudyplan_user', ['studyplan_id' => $studyplanid, 'user_id' => $userid])) {
$id = $DB->insert_record('local_treestudyplan_user', [ $id = $DB->insert_record('local_treestudyplan_user', [
'studyplan_id' => $studyplanid, 'studyplan_id' => $studyplanid,
'user_id' => $userid, 'user_id' => $userid,
]); ]);
$studyplan->mark_csync_changed(); $studyplan->mark_csync_changed();
return ['success' => true, 'msg' => 'Cohort connected']; return ['success' => true, 'msg' => 'Cohort connected'];
} else { } else {
return ['success' => true, 'msg' => 'Cohort already connected']; return ['success' => true, 'msg' => 'Cohort already connected'];
} }
} }
public static function disconnect_user_parameters() { public static function disconnect_user_parameters() {
return new \external_function_parameters( [ return new \external_function_parameters( [
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL), "studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL),
"user_id" => new \external_value(PARAM_INT, 'id of user to link', VALUE_OPTIONAL), "user_id" => new \external_value(PARAM_INT, 'id of user to link', VALUE_OPTIONAL),
] ); ] );
} }
public static function disconnect_user_returns() { public static function disconnect_user_returns() {
return new \external_single_structure([ return new \external_single_structure([
"success" => new \external_value(PARAM_BOOL, 'operation completed succesfully'), "success" => new \external_value(PARAM_BOOL, 'operation completed succesfully'),
"msg" => new \external_value(PARAM_TEXT, 'message'), "msg" => new \external_value(PARAM_TEXT, 'message'),
]); ]);
} }
// Actual functions. // Actual functions.
public static function disconnect_user($studyplanid, $userid) { public static function disconnect_user($studyplanid, $userid) {
global $CFG, $DB; global $CFG, $DB;
$studyplan = studyplan::findById($studyplanid); $studyplan = studyplan::findById($studyplanid);
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context()); webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
if ($DB->record_exists('local_treestudyplan_user', ['studyplan_id' => $studyplanid, 'user_id' => $userid])) { if ($DB->record_exists('local_treestudyplan_user', ['studyplan_id' => $studyplanid, 'user_id' => $userid])) {
$DB->delete_records('local_treestudyplan_user', [ $DB->delete_records('local_treestudyplan_user', [
'studyplan_id' => $studyplanid, 'studyplan_id' => $studyplanid,
'user_id' => $userid, 'user_id' => $userid,
]); ]);
$studyplan->mark_csync_changed(); $studyplan->mark_csync_changed();
return ['success' => true, 'msg' => 'User Disconnected']; return ['success' => true, 'msg' => 'User Disconnected'];
} else { } else {
return ['success' => true, 'msg' => 'Connection does not exist']; return ['success' => true, 'msg' => 'Connection does not exist'];
} }
} }
public static function associated_users_parameters() { public static function associated_users_parameters() {
return new \external_function_parameters( [ return new \external_function_parameters( [
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL), "studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL),
] ); ] );
} }
public static function associated_users_returns() { public static function associated_users_returns() {
return new \external_multiple_structure(self::user_structure()); return new \external_multiple_structure(self::user_structure());
} }
// Actual functions. // Actual functions.
public static function associated_users($studyplanid) { public static function associated_users($studyplanid) {
global $CFG, $DB; global $CFG, $DB;
$studyplan = studyplan::findById($studyplanid); $studyplan = studyplan::findById($studyplanid);
webservicehelper::require_capabilities(self::CAP_VIEW, $studyplan->context()); webservicehelper::require_capabilities(self::CAP_VIEW, $studyplan->context());
$sql = "SELECT DISTINCT u.* FROM {user} u INNER JOIN {local_treestudyplan_user} j ON j.user_id = u.id"; $sql = "SELECT DISTINCT u.* FROM {user} u INNER JOIN {local_treestudyplan_user} j ON j.user_id = u.id";
$sql .= " WHERE j.studyplan_id = :studyplan_id"; $sql .= " WHERE j.studyplan_id = :studyplan_id";
$rs = $DB->get_recordset_sql($sql, ['studyplan_id' => $studyplanid]); $rs = $DB->get_recordset_sql($sql, ['studyplan_id' => $studyplanid]);
$users = []; $users = [];
foreach ($rs as $u) { foreach ($rs as $u) {
$users[] = self::make_user_model($u); $users[] = self::make_user_model($u);
} }
$rs->close(); $rs->close();
self::sortusermodels($users); self::sortusermodels($users);
return $users; return $users;
} }
public static function associated_cohorts_parameters() { public static function associated_cohorts_parameters() {
return new \external_function_parameters( [ return new \external_function_parameters( [
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL), "studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL),
] ); ] );
} }
public static function associated_cohorts_returns() { public static function associated_cohorts_returns() {
return new \external_multiple_structure(self::cohort_structure()); return new \external_multiple_structure(self::cohort_structure());
} }
// Actual functions. // Actual functions.
public static function associated_cohorts($studyplanid) { public static function associated_cohorts($studyplanid) {
global $CFG, $DB; global $CFG, $DB;
$studyplan = studyplan::findById($studyplanid); $studyplan = studyplan::findById($studyplanid);
webservicehelper::require_capabilities(self::CAP_VIEW, $studyplan->context()); webservicehelper::require_capabilities(self::CAP_VIEW, $studyplan->context());
$sql = "SELECT DISTINCT c.* FROM {cohort} c INNER JOIN {local_treestudyplan_cohort} j ON j.cohort_id = c.id"; $sql = "SELECT DISTINCT c.* FROM {cohort} c INNER JOIN {local_treestudyplan_cohort} j ON j.cohort_id = c.id";
$sql .= " WHERE j.studyplan_id = :studyplan_id"; $sql .= " WHERE j.studyplan_id = :studyplan_id";
$rs = $DB->get_recordset_sql($sql, ['studyplan_id' => $studyplanid]); $rs = $DB->get_recordset_sql($sql, ['studyplan_id' => $studyplanid]);
$cohorts = []; $cohorts = [];
foreach ($rs as $c) { foreach ($rs as $c) {
$cohorts[] = self::make_cohort_model($c); $cohorts[] = self::make_cohort_model($c);
} }
$rs->close(); $rs->close();
return $cohorts; return $cohorts;
} }
public static function all_associated_parameters() { public static function all_associated_parameters() {
return new \external_function_parameters( [ return new \external_function_parameters( [
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL), "studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL),
] ); ] );
} }
public static function all_associated_returns() { public static function all_associated_returns() {
return new \external_multiple_structure(self::user_structure()); return new \external_multiple_structure(self::user_structure());
} }
// Actual functions. // Actual functions.
public static function all_associated($studyplanid) { public static function all_associated($studyplanid) {
global $CFG, $DB; global $CFG, $DB;
$studyplan = studyplan::findById($studyplanid); $studyplan = studyplan::findById($studyplanid);
webservicehelper::require_capabilities(self::CAP_VIEW, $studyplan->context()); webservicehelper::require_capabilities(self::CAP_VIEW, $studyplan->context());
$users = []; $users = [];
// SQL JOIN script selecting all users that have a cohort linked to this studyplan . // SQL JOIN script selecting all users that have a cohort linked to this studyplan .
// Or are directly linked. // Or are directly linked.
$sql = "SELECT DISTINCT u.id, u.username, u.firstname, u.lastname, u.idnumber, u.email" $sql = "SELECT DISTINCT u.id, u.username, u.firstname, u.lastname, u.idnumber, u.email"
."FROM {user} u" ."FROM {user} u"
."LEFT JOIN {cohort_members} cm ON u.id = cm.userid" ."LEFT JOIN {cohort_members} cm ON u.id = cm.userid"
."LEFT JOIN {local_treestudyplan_cohort} tc ON cm.cohortid = tc.cohort_id" ."LEFT JOIN {local_treestudyplan_cohort} tc ON cm.cohortid = tc.cohort_id"
."LEFT JOIN {local_treestudyplan_user} tu ON u.id = tu.user_id" ."LEFT JOIN {local_treestudyplan_user} tu ON u.id = tu.user_id"
."WHERE tc.studyplan_id = {$studyplan->id()}" ."WHERE tc.studyplan_id = {$studyplan->id()}"
."OR tu.studyplan_id = {$studyplan->id()}" ."OR tu.studyplan_id = {$studyplan->id()}"
."ORDER BY u.lastname, u.firstname"; ."ORDER BY u.lastname, u.firstname";
$rs = $DB->get_recordset_sql($sql); $rs = $DB->get_recordset_sql($sql);
foreach ($rs as $u) { foreach ($rs as $u) {
$users[] = self::make_user_model($u); $users[] = self::make_user_model($u);
} }
$rs->close(); $rs->close();
self::sortusermodels($users); self::sortusermodels($users);
return $users; return $users;
} }
public static function sortusermodels(&$list) { public static function sortusermodels(&$list) {
return usort($list, function($a, $b) { return usort($list, function($a, $b) {
$m = []; $m = [];
if (preg_match("/.*?([A-Z].*)/", $a['lastname'], $m)) { if (preg_match("/.*?([A-Z].*)/", $a['lastname'], $m)) {
$sortln_a = $m[1]; $sortlna = $m[1];
} else { } else {
$sortln_a = $a['lastname']; $sortlna = $a['lastname'];
} }
if (preg_match("/.*?([A-Z].*)/", $b['lastname'], $m)) { if (preg_match("/.*?([A-Z].*)/", $b['lastname'], $m)) {
$sortln_b = $m[1]; $sortlnb = $m[1];
} else { } else {
$sortln_b = $b['lastname']; $sortlnb = $b['lastname'];
} }
$cmp = $sortln_a <=> $sortln_b; $cmp = $sortlna <=> $sortlnb;
return ($cmp != 0) ? $cmp : $a['firstname'] <=> $b['firstname']; return ($cmp != 0) ? $cmp : $a['firstname'] <=> $b['firstname'];
}); });
} }
public static function cascade_cohortsync_parameters() { public static function cascade_cohortsync_parameters() {
return new \external_function_parameters( [ return new \external_function_parameters( [
"studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL), "studyplan_id" => new \external_value(PARAM_INT, 'id of studyplan', VALUE_OPTIONAL),
] ); ] );
} }
public static function cascade_cohortsync_returns() { public static function cascade_cohortsync_returns() {
return success::structure(); return success::structure();
} }
// Actual functions. // Actual functions.
public static function cascade_cohortsync($studyplanid) { public static function cascade_cohortsync($studyplanid) {
$studyplan = studyplan::findById($studyplanid); $studyplan = studyplan::findById($studyplanid);
webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context()); webservicehelper::require_capabilities(self::CAP_EDIT, $studyplan->context());
$enroller = new cascadecohortsync($studyplan); $enroller = new cascadecohortsync($studyplan);
$enroller->sync(); $enroller->sync();
if (get_config("local_treestudyplan", "csync_users")) { if (get_config("local_treestudyplan", "csync_users")) {
$userenroller = new cascadeusersync($studyplan); $userenroller = new cascadeusersync($studyplan);
$userenroller->sync(); $userenroller->sync();
} }
$studyplan->clear_csync_changed(); // Clear the csync required flag. $studyplan->clear_csync_changed(); // Clear the csync required flag.
return success::success()->model(); return success::success()->model();
} }
}
}

View File

@ -37,7 +37,7 @@ class cascadecohortsync {
$this->studyplanid = $studyplan->id(); $this->studyplanid = $studyplan->id();
} }
static private function array_remove_value($array, $value) { private static function array_remove_value($array, $value) {
$a = []; $a = [];
foreach ($array as $v) { foreach ($array as $v) {
if ($v != $value) { if ($v != $value) {
@ -47,7 +47,7 @@ class cascadecohortsync {
return $a; return $a;
} }
static function uploadenrolmentmethods_get_group($courseid, $groupname) { private static function uploadenrolmentmethods_get_group($courseid, $groupname) {
// Function shamelessly copied from tool/uploadenrolmentmethods/locallib.php. // Function shamelessly copied from tool/uploadenrolmentmethods/locallib.php.
global $DB, $CFG; global $DB, $CFG;
@ -92,7 +92,6 @@ class cascadecohortsync {
foreach ($cohortids as $cohortid) { foreach ($cohortids as $cohortid) {
$cohort = $DB->get_record('cohort', ['id' => $cohortid]); $cohort = $DB->get_record('cohort', ['id' => $cohortid]);
$instanceparams = [ $instanceparams = [
'courseid' => $courseid, 'courseid' => $courseid,
'customint1' => $cohortid, 'customint1' => $cohortid,
@ -152,16 +151,12 @@ class cascadecohortsync {
$instance = $DB->get_record('enrol', array('id' => $instanceid)); $instance = $DB->get_record('enrol', array('id' => $instanceid));
$enrol->update_instance($instance, (object)["customtext4" => json_encode([(int)($this->studyplanid)])]); $enrol->update_instance($instance, (object)["customtext4" => json_encode([(int)($this->studyplanid)])]);
// Successfully added a valid new instance, so now instantiate it. // Successfully added a valid new instance, so now instantiate it.
// First synchronise the enrolment. // First synchronise the enrolment.
$cohorttrace = new \null_progress_trace(); $cohorttrace = new \null_progress_trace();
$result = enrol_cohort_sync($cohorttrace, $cohortid); $result = enrol_cohort_sync($cohorttrace, $cohortid);
$cohorttrace->finished(); $cohorttrace->finished();
} else {
// Instance not added for some reason, so report an error somewhere.
// (or not).
} }
} }
} }

View File

@ -39,17 +39,19 @@ class contextinfo {
public function model() { public function model() {
$ctxPath = array_reverse($this->context->get_parent_context_ids(true)); $ctxpath = array_reverse($this->context->get_parent_context_ids(true));
if (count($ctxPath) > 1 && $ctxPath[0] == 1) { if (count($ctxpath) > 1 && $ctxpath[0] == 1) {
array_shift($ctxPath); array_shift($ctxpath);
} }
return [ return [
"name" => $this->context->get_context_name(false, false), "name" => $this->context->get_context_name(false, false),
"shortname" => $this->context->get_context_name(false, true), "shortname" => $this->context->get_context_name(false, true),
"path" => array_map(function($c) { return \context::instance_by_id($c)->get_context_name(false, false);}, $ctxPath), "path" => array_map(function($c) {
return \context::instance_by_id($c)->get_context_name(false, false);
}, $ctxpath),
"shortpath" => array_map(function($c) { "shortpath" => array_map(function($c) {
return \context::instance_by_id($c)->get_context_name(false, true); return \context::instance_by_id($c)->get_context_name(false, true);
}, $ctxPath), }, $ctxpath),
]; ];
} }

View File

@ -37,7 +37,8 @@ class corecompletioninfo {
private $course; private $course;
private $completion; private $completion;
private $modinfo; private $modinfo;
private static $COMPLETIONHANDLES = null; private static $completionhandles = null;
private static $completiontypes = null;
public function id() { public function id() {
return $this->course->id; return $this->course->id;
@ -49,28 +50,33 @@ class corecompletioninfo {
$this->modinfo = get_fast_modinfo($this->course); $this->modinfo = get_fast_modinfo($this->course);
} }
static public function completiontypes() { public static function completiontypes() {
global $COMPLETIONCRITERIA_TYPES; global $COMPLETION_CRITERIA_TYPES;
// Just return the keys of the global array COMPLETION_CRITERIA_TYPES, so we don't have to manually. /* Just return the keys of the global array COMPLETION_CRITERIA_TYPES,
// Add any completion types.... so we don't have to manually add any completion types if moodle decides to add a few.
return \array_keys($COMPLETIONCRITERIA_TYPES); Unfortunately, the global variable breaks the moodle coding standard...
*/
if (!isset(self::$completiontypes)) {
self::$completiontypes = \array_keys($COMPLETION_CRITERIA_TYPES);
}
return self::$completiontypes;
} }
/** /**
* Translate a numeric completion constant to a text string * Translate a numeric completion constant to a text string
* @param $completion The completion code as defined in completionlib.php to translate to a text handle * @param $completion The completion code as defined in completionlib.php to translate to a text handle
*/ */
static public function completion_handle($completion) { public static function completion_handle($completion) {
if (empty(self::$COMPLETIONHANDLES)) { if (empty(self::$completionhandles)) {
// Cache the translation table, to avoid overhead. // Cache the translation table, to avoid overhead.
self::$COMPLETIONHANDLES = [ self::$completionhandles = [
COMPLETION_INCOMPLETE => "incomplete", COMPLETION_INCOMPLETE => "incomplete",
COMPLETION_COMPLETE => "complete", COMPLETION_COMPLETE => "complete",
COMPLETION_COMPLETE_PASS => "complete-pass", COMPLETION_COMPLETE_PASS => "complete-pass",
COMPLETION_COMPLETE_FAIL => "complete-fail", COMPLETION_COMPLETE_FAIL => "complete-fail",
COMPLETION_COMPLETE_FAIL_HIDDEN => "complete-fail"]; // The front end won't differentiate between hidden or not. COMPLETION_COMPLETE_FAIL_HIDDEN => "complete-fail"]; // The front end won't differentiate between hidden or not.
} }
return self::$COMPLETIONHANDLES[$completion] ?? "undefined"; return self::$completionhandles[$completion] ?? "undefined";
} }
public static function completion_item_editor_structure($value = VALUE_REQUIRED) { public static function completion_item_editor_structure($value = VALUE_REQUIRED) {
@ -156,11 +162,11 @@ class corecompletioninfo {
} }
private static function aggregation_handle($method) { private static function aggregation_handle($method) {
return ($method ==COMPLETION_AGGREGATION_ALL) ? "all" : "any"; return ($method == COMPLETION_AGGREGATION_ALL) ? "all" : "any";
} }
public function editor_model() { public function editor_model() {
global $DB, $CFG, $COMPLETIONCRITERIA_TYPES; global $DB, $CFG;
$conditions = []; $conditions = [];
$aggregation = "all"; // Default. $aggregation = "all"; // Default.
@ -179,7 +185,7 @@ class corecompletioninfo {
if (count($criterias) > 0 ) { if (count($criterias) > 0 ) {
// Only take it into account if the criteria count is > 0. // Only take it into account if the criteria count is > 0.
$cinfo = [ $cinfo = [
"type" => $COMPLETIONCRITERIA_TYPES[$type], "type" => self::completiontypes()[$type],
"aggregation" => self::aggregation_handle($this->completion->get_aggregation_method($type)), "aggregation" => self::aggregation_handle($this->completion->get_aggregation_method($type)),
"title" => reset($criterias)->get_type_title(), "title" => reset($criterias)->get_type_title(),
"items" => [], "items" => [],
@ -254,7 +260,7 @@ class corecompletioninfo {
$details = [ $details = [
"type" => get_string('periodpostenrolment', 'completion'), "type" => get_string('periodpostenrolment', 'completion'),
"criteria" => get_string('remainingenroledfortime', 'completion'), "criteria" => get_string('remainingenroledfortime', 'completion'),
"requirement" => get_string('xdays', 'completion', ceil($criteria->enrolperiod / (60*60*24))), "requirement" => get_string('xdays', 'completion', ceil($criteria->enrolperiod / (60 * 60 * 24))),
"status" => "", "status" => "",
]; ];
} else if ($type == COMPLETION_CRITERIA_TYPE_GRADE) { } else if ($type == COMPLETION_CRITERIA_TYPE_GRADE) {
@ -333,7 +339,7 @@ class corecompletioninfo {
} }
public function user_model($userid) { public function user_model($userid) {
global $DB, $COMPLETIONCRITERIA_TYPES; global $DB;
$progress = $this->get_advanced_progress_percentage($userid); $progress = $this->get_advanced_progress_percentage($userid);
$info = [ $info = [
@ -357,7 +363,7 @@ class corecompletioninfo {
$typeaggregation = $this->completion->get_aggregation_method($type); $typeaggregation = $this->completion->get_aggregation_method($type);
$completed = $this->aggregate_completions($typeaggregation, $completions); $completed = $this->aggregate_completions($typeaggregation, $completions);
$cinfo = [ $cinfo = [
"type" => $COMPLETIONCRITERIA_TYPES[$type], "type" => self::completiontypes()[$type],
"aggregation" => self::aggregation_handle($typeaggregation), "aggregation" => self::aggregation_handle($typeaggregation),
"completed" => $completed, "completed" => $completed,
"status" => $completed ? "complete" : "incomplete", "status" => $completed ? "complete" : "incomplete",
@ -428,7 +434,7 @@ class corecompletioninfo {
// Count and progress are either 1 or 0, since any of the items. // Count and progress are either 1 or 0, since any of the items.
// Complete's the type. // Complete's the type.
$cinfo["count"] = (count($cinfo["items"]) > 0) ? 1 : 0; $cinfo["count"] = (count($cinfo["items"]) > 0) ? 1 : 0;
$cinfo["progress"] = ($progress>0) ? 1 : 0; $cinfo["progress"] = ($progress > 0) ? 1 : 0;
} }
$info['conditions'][] = $cinfo; $info['conditions'][] = $cinfo;
@ -650,15 +656,14 @@ class corecompletioninfo {
// If ANY completion for the types, count only the criteria type with the highest completion percentage -. // If ANY completion for the types, count only the criteria type with the highest completion percentage -.
// Overwrite data if current type is more complete. // Overwrite data if current type is more complete.
if ($aggregation == COMPLETION_AGGREGATION_ANY) { if ($aggregation == COMPLETION_AGGREGATION_ANY) {
$pct = $cmpl/$ct; $pct = $cmpl / $ct;
if ($pct > $completionpercentage) { if ($pct > $completionpercentage) {
$count = $ct; $count = $ct;
$completed = $cmpl; $completed = $cmpl;
$completionpercentage = $pct; $completionpercentage = $pct;
} }
} } else {
// If ALL completion for the types, add the count for this type to that of the others. // If ALL completion for the types, add the count for this type to that of the others.
else {
$count += $ct; $count += $ct;
$completed += $cmpl; $completed += $cmpl;
// Don't really care about recalculating completion percentage every round in this case. // Don't really care about recalculating completion percentage every round in this case.

View File

@ -90,16 +90,16 @@ class bistate_aggregator extends \local_treestudyplan\aggregator {
]); ]);
} }
public function needSelectGradables() { public function select_gradables() {
return true; return true;
} }
public function isDeprecated() { public function deprecated() {
return self::DEPRECATED; return self::DEPRECATED;
} }
public function useRequiredGrades() { public function use_required_grades() {
return true; return true;
} }
public function useItemConditions() { public function use_item_conditions() {
return false; return false;
} }

View File

@ -64,16 +64,16 @@ class core_aggregator extends \local_treestudyplan\aggregator {
]); ]);
} }
public function needSelectGradables() { public function select_gradables() {
return false; return false;
} }
public function isDeprecated() { public function deprecated() {
return self::DEPRECATED; return self::DEPRECATED;
} }
public function useRequiredGrades() { public function use_required_grades() {
return true; return true;
} }
public function useItemConditions() { public function use_item_conditions() {
return false; return false;
} }
public function usecorecompletioninfo() { public function usecorecompletioninfo() {

View File

@ -31,16 +31,16 @@ class tristate_aggregator extends \local_treestudyplan\aggregator {
public const DEPRECATED = true; public const DEPRECATED = true;
private const DEFAULT_CONDITION = "50"; private const DEFAULT_CONDITION = "50";
public function needSelectGradables() { public function select_gradables() {
return true; return true;
} }
public function isDeprecated() { public function deprecated() {
return self::DEPRECATED; return self::DEPRECATED;
} }
public function useRequiredGrades() { public function use_required_grades() {
return false; return false;
} }
public function useItemConditions() { public function use_item_conditions() {
return true; return true;
} }

View File

@ -54,7 +54,7 @@ class studyplan {
$this->id = $id; $this->id = $id;
$this->r = $DB->get_record(self::TABLE, ['id' => $id]); $this->r = $DB->get_record(self::TABLE, ['id' => $id]);
$this->aggregator = aggregator::createOrDefault($this->r->aggregation, $this->r->aggregation_config); $this->aggregator = aggregator::createordefault($this->r->aggregation, $this->r->aggregation_config);
} }
public function id() { public function id() {
@ -250,7 +250,7 @@ class studyplan {
$this->context = null; $this->context = null;
$this->context(); $this->context();
// Reload aggregator. // Reload aggregator.
$this->aggregator = aggregator::createOrDefault($this->r->aggregation, $this->r->aggregation_config); $this->aggregator = aggregator::createordefault($this->r->aggregation, $this->r->aggregation_config);
// Start temporary skräpp code. // Start temporary skräpp code.
// TODO: Until proper page editing is implemented, copy data from studyplan to it's first page. // TODO: Until proper page editing is implemented, copy data from studyplan to it's first page.
@ -359,7 +359,7 @@ class studyplan {
} }
static public function exist_for_user($userid) { public static function exist_for_user($userid) {
global $DB; global $DB;
$count = 0; $count = 0;
$sql = "SELECT s.* FROM {local_treestudyplan} s $sql = "SELECT s.* FROM {local_treestudyplan} s

View File

@ -20,7 +20,6 @@
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
require_once("../../config.php"); require_once("../../config.php");
require_once($CFG->libdir.'/weblib.php'); require_once($CFG->libdir.'/weblib.php');

View File

@ -39,7 +39,6 @@ $string['treestudyplan:viewuserreports'] = "View study plan of others";
$string['treestudyplan:forcescales'] = 'Advanced: Allow studyplan manager to force assignment scales to setting (manual modes only)'; $string['treestudyplan:forcescales'] = 'Advanced: Allow studyplan manager to force assignment scales to setting (manual modes only)';
$string['treestudyplan:selectowngradables'] = 'Teachers can select gradables in their own courses in study plan view mode (manual modes only)'; $string['treestudyplan:selectowngradables'] = 'Teachers can select gradables in their own courses in study plan view mode (manual modes only)';
$string['report'] = 'Progress report'; $string['report'] = 'Progress report';
$string['report_invited'] = 'Progress report for {$a}'; $string['report_invited'] = 'Progress report for {$a}';
$string['report_index'] = 'View student progress reports'; $string['report_index'] = 'View student progress reports';
@ -242,7 +241,6 @@ $string['bistate_aggregator_desc'] = 'Goals are completed or not (e.g. not start
$string['core_aggregator_title'] = 'Moodle course completion'; $string['core_aggregator_title'] = 'Moodle course completion';
$string['core_aggregator_desc'] = 'Use Moodle core completion'; $string['core_aggregator_desc'] = 'Use Moodle core completion';
$string['setting_bistate_heading'] = 'Defaults for Completed + Required goalsn'; $string['setting_bistate_heading'] = 'Defaults for Completed + Required goalsn';
$string['settingdesc_bistate_heading'] = 'Set the defaults for this aggregation method'; $string['settingdesc_bistate_heading'] = 'Set the defaults for this aggregation method';

View File

@ -26,7 +26,6 @@
use local_treestudyplan\local\helpers\webservicehelper; use local_treestudyplan\local\helpers\webservicehelper;
use \local_treestudyplan\studyplan; use \local_treestudyplan\studyplan;
function local_treestudyplan_unit_get_editor_options($context) { function local_treestudyplan_unit_get_editor_options($context) {
global $CFG; global $CFG;
return ['subdirs' => 1, return ['subdirs' => 1,