diff --git a/build.php b/build.php index b71011c..8a91c44 100644 --- a/build.php +++ b/build.php @@ -74,4 +74,3 @@ $cmd = "zip -r '{$zipname}' '{$plugindirname}' {$exclude}"; system($cmd); chdir($cwd); - diff --git a/build.sh b/build.sh index 9f52a0a..82da397 100755 --- a/build.sh +++ b/build.sh @@ -27,4 +27,4 @@ if [[ "$VUEMODE" == "dev" ]]; then fi # return to the working directory -cd $WD \ No newline at end of file +cd $WD diff --git a/cfg_grades.php b/cfg_grades.php index c9876e1..b9eef5e 100644 --- a/cfg_grades.php +++ b/cfg_grades.php @@ -138,7 +138,6 @@ if ($_POST["action"] == "update") { } - // Process all available scales and load the current configuration for it. $data = []; foreach ($scales as $scale) { @@ -158,8 +157,12 @@ foreach ($scales as $scale) { $attrsp["selected"] = "selected"; } - $optionscompleted = html_writer::tag("option", get_string('select_scaleitem', 'local_treestudyplan'), $attrsc); - $optionsprogress = html_writer::tag("option", get_string('select_scaleitem', 'local_treestudyplan'), $attrsp); + $optionscompleted = html_writer::tag("option", + get_string('select_scaleitem', 'local_treestudyplan'), + $attrsc); + $optionsprogress = html_writer::tag("option", + get_string('select_scaleitem', 'local_treestudyplan'), + $attrsp); $key = 1; // Start counting by one, as used in sum aggregations. foreach ($scale->scale_items as $value) { @@ -182,7 +185,9 @@ foreach ($scales as $scale) { $row = []; $row[] = $scale->name; - $row[] = html_writer::tag("select", $optionscompleted, ['name' => "s_{$scale->id}_min_completed", 'autocomplete' => 'off']); + $row[] = html_writer::tag("select", + $optionscompleted, + ['name' => "s_{$scale->id}_min_completed", 'autocomplete' => 'off']); $data[] = $row; } @@ -213,7 +218,9 @@ foreach ($gradecfgs as $g) { 'type' => 'text', "class" => "float", 'autocomplete' => 'off']); - $row[] = html_writer::tag("input", null, ['name' => "g_{$g->grade_points}_delete", 'type' => 'checkbox', ]); + $row[] = html_writer::tag("input", + null, + ['name' => "g_{$g->grade_points}_delete", 'type' => 'checkbox', ]); $data[] = $row; } @@ -247,7 +254,9 @@ $table->head[] = get_string('delete', ); print $OUTPUT->heading(get_string('cfg_grades_grades', 'local_treestudyplan')); print html_writer::tag('div', html_writer::table($table), ['class' => 'flexible-wrap']); -print html_writer::tag("input", null, ['value' => get_string("save"), 'type' => 'submit', "class" => "btn btn-primary"]); +print html_writer::tag("input", + null, + ['value' => get_string("save"), 'type' => 'submit', "class" => "btn btn-primary"]); print html_writer::end_tag("form"); print $OUTPUT->footer(); diff --git a/classes/aggregator.php b/classes/aggregator.php index b54725e..94d39b7 100644 --- a/classes/aggregator.php +++ b/classes/aggregator.php @@ -72,17 +72,17 @@ abstract class aggregator { protected function initialize($configstr) { } - public abstract function needSelectGradables(); - public abstract function isDeprecated(); - public abstract function aggregate_course(courseinfo $courseinfo, studyitem $studyitem, $userid); - public abstract function aggregate_junction(array $completion, studyitem $studyitem, $userid); + abstract public function needSelectGradables(); + abstract public function isDeprecated(); + abstract public function aggregate_course(courseinfo $courseinfo, studyitem $studyitem, $userid); + abstract public function aggregate_junction(array $completion, studyitem $studyitem, $userid); - public abstract 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. - public abstract function useRequiredGrades(); + abstract public function useRequiredGrades(); // Aggregation method makes use of . - public abstract function useItemConditions(); + abstract public function useItemConditions(); // Whether the aggregation method uses core_completion, or treestudyplan custom completion. public function usecorecompletioninfo() { diff --git a/classes/associationservice.php b/classes/associationservice.php index 7b95522..b185014 100644 --- a/classes/associationservice.php +++ b/classes/associationservice.php @@ -86,8 +86,12 @@ class associationservice extends \external_api { "context" => [ "name" => $ctx->get_context_name(false, false), "shortname" => $ctx->get_context_name(false, true), - "path" => array_map(function($c) { return \context::instance_by_id($c)->get_context_name(false, false);}, $ctxPath), - "shortpath" => array_map(function($c) { return \context::instance_by_id($c)->get_context_name(false, true);}, $ctxPath), + "path" => array_map(function($c) { + return \context::instance_by_id($c)->get_context_name(false, false); + }, $ctxPath), + "shortpath" => array_map(function($c) { + return \context::instance_by_id($c)->get_context_name(false, true); + }, $ctxPath), ] ]; @@ -157,7 +161,7 @@ class associationservice extends \external_api { public static function find_user($like, $excludeid=null, $contextid=1) { global $CFG, $DB; - // Only allow this if the user has the right to edit in this context (using system rights would make things more confusing). + // Only allow this if the user has the right to edit in this context. $context = webservicehelper::find_context($contextid); webservicehelper::require_capabilities(self::CAP_EDIT, $context); @@ -467,5 +471,4 @@ class associationservice extends \external_api { } - -} \ No newline at end of file +} diff --git a/classes/badgeinfo.php b/classes/badgeinfo.php index d3ed12c..3bbcd16 100644 --- a/classes/badgeinfo.php +++ b/classes/badgeinfo.php @@ -68,16 +68,23 @@ class badgeinfo { "name" => new \external_value(PARAM_TEXT, 'badge name'), "status" => new \external_value(PARAM_TEXT, 'badge status'), "locked" => new \external_value(PARAM_TEXT, 'badge lock status'), - "criteria" => new \external_multiple_structure(new \external_value(PARAM_RAW, 'criteria text'), 'badge criteria', VALUE_OPTIONAL), + "criteria" => new \external_multiple_structure( + new \external_value(PARAM_RAW, 'criteria text'), 'badge criteria', VALUE_OPTIONAL), "description" => new \external_value(PARAM_TEXT, 'badge description'), "imageurl" => new \external_value(PARAM_TEXT, 'url of badge image'), - "studentcount" => new \external_value(PARAM_INT, 'number of studyplan students that can get this badge', VALUE_OPTIONAL), - "issuedcount" => new \external_value(PARAM_INT, 'number of studyplan students that have got this badge', VALUE_OPTIONAL), + "studentcount" => new \external_value(PARAM_INT, + 'number of studyplan students that can get this badge', VALUE_OPTIONAL), + "issuedcount" => new \external_value(PARAM_INT, + 'number of studyplan students that have got this badge', VALUE_OPTIONAL), ], "Badge info", $value); } public function editor_model(array $studentlist=null) { - $context = ($this->badge->type == BADGE_TYPE_SITE) ? \context_system::instance() : \context_course::instance($this->badge->courseid); + if ($this->badge->type == BADGE_TYPE_SITE) { + $context = \context_system::instance(); + } else { + $context = \context_course::instance($this->badge->courseid); + } // If the user is viewing another user's badge and doesn't have the right capability return only part of the data. $criteria = []; @@ -92,7 +99,8 @@ class badgeinfo { 'locked' => self::LOCKEDINFO[$this->badge->status], 'criteria' => $criteria, 'description' => $this->badge->description, - 'imageurl' => \moodle_url::make_pluginfile_url($context->id, 'badges', 'badgeimage', $this->badge->id, '/', 'f1')->out(false), + 'imageurl' => \moodle_url::make_pluginfile_url($context->id, + 'badges', 'badgeimage', $this->badge->id, '/', 'f1')->out(false), ]; // Add badge issue stats if a studentlist is attached to the request. @@ -109,7 +117,9 @@ class badgeinfo { "id" => new \external_value(PARAM_INT, 'id of badge'), "infolink" => new \external_value(PARAM_TEXT, 'badge issue information link', VALUE_OPTIONAL), "name" => new \external_value(PARAM_TEXT, 'badge name'), - "criteria" => new \external_multiple_structure(new \external_value(PARAM_RAW, 'criteria text'), 'badge criteria', VALUE_OPTIONAL), + "criteria" => new \external_multiple_structure( + new \external_value(PARAM_RAW, 'criteria text'), + 'badge criteria', VALUE_OPTIONAL), "description" => new \external_value(PARAM_TEXT, 'badge description'), "imageurl" => new \external_value(PARAM_TEXT, 'url of badge image'), "issued" => new \external_value(PARAM_BOOL, 'badge is issued'), @@ -122,8 +132,12 @@ class badgeinfo { public function user_model($userid) { global $DB; + if ($this->badge->type == BADGE_TYPE_SITE) { + $context = \context_system::instance(); + } else { + $context = \context_course::instance($this->badge->courseid); + } - $context = ($this->badge->type == BADGE_TYPE_SITE) ? \context_system::instance() : \context_course::instance($this->badge->courseid); $issued = $this->badge->is_issued($userid); // If the user is viewing another user's badge and doesn't have the right capability return only part of the data. @@ -135,7 +149,11 @@ class badgeinfo { 'id' => $this->badge->id, 'name' => $this->badge->name, 'description' => $this->badge->description, - 'imageurl' => \moodle_url::make_pluginfile_url($context->id, 'badges', 'badgeimage', $this->badge->id, '/', 'f1')->out(false), + 'imageurl' => \moodle_url::make_pluginfile_url($context->id, + 'badges', + 'badgeimage', + $this->badge->id, '/', 'f1' + )->out(false), 'criteria' => $criteria, 'issued' => $issued, 'infolink' => (new \moodle_url('/badges/overview.php', ['id' => $this->badge->id]))->out(false), @@ -165,4 +183,4 @@ class badgeinfo { return $issuecount; } -} \ No newline at end of file +} diff --git a/classes/cascadecohortsync.php b/classes/cascadecohortsync.php index e5c180c..cea7782 100644 --- a/classes/cascadecohortsync.php +++ b/classes/cascadecohortsync.php @@ -71,10 +71,10 @@ class cascadecohortsync { /* Explainer: This script uses {enrol}.customtext4 to store a json array of all studyplans that need this cohort sync to exist. Since the cohort-sync enrolment method uses only customint1 and customint2, this is a safe place to store the data. - (Should the cohortsync script at any future time be modified to use customtext fields, it is still extremely unlikely that - customtext4 will be used.) - Because of the overhead involved in keeping an extra table up to date and clean it up if cohort syncs are removed outside of this script, - it was determined to be the simplest and cleanest solution. + (Should the cohortsync script at any future time be modified to use customtext fields, it is still extremely unlikely + that customtext4 will be used.) + Because of the overhead involved in keeping an extra table up to date and clean it up if cohort syncs are + removed outside of this script, it was determined to be the simplest and cleanest solution. */ $enrol = \enrol_get_plugin(self::METHOD); @@ -83,7 +83,6 @@ class cascadecohortsync { // And find the cohorts that are linked to this studyplan. $cohortids = $this->studyplan->get_linked_cohort_ids(); - // Next, for each course that is linked:. foreach ($courseids as $courseid) { $course = \get_course($courseid); //\mtrace("Processing Course {$courseid} {$course->shortname}");. @@ -108,7 +107,7 @@ class cascadecohortsync { // Create group: . // 1: check if a link exists. - // If not, make it (maybe use some of the custom text to list the studyplans involved). + // If not, make it (maybe use some of the custom text to list the studyplans involved). if ($instance = $DB->get_record('enrol', $instanceparams)) { //\mtrace("Instance exists");. // It already exists. @@ -164,17 +163,19 @@ class cascadecohortsync { } else { // Instance not added for some reason, so report an error somewhere. // (or not). - //\mtrace("Error - instance not added for some reason");. } } } - // 2: Check if there are cohort links for this studyplan in this course that should be removed. - // A: Check if there are cohort links that are no longer related to this studyplan. - // B: Check if these links are valid through another studyplan... - // If no one uses the link anymore, deactivate it... - // INFO: This does not remove the sync from courses that are unlinked from a studplan. But maybe we do not want that anyway. - // since it is generally a good idea to keep student access to courses available . + /* 2: Check if there are cohort links for this studyplan in this course that should be removed. + A: Check if there are cohort links that are no longer related to this studyplan. + B: Check if these links are valid through another studyplan... + If no one uses the link anymore, deactivate it... + + This does not remove the sync from courses that are unlinked from a studplan. + But maybe we do not want that anyway, since it is generally a good idea to keep student + access to courses available . + */ if (get_config("local_treestudyplan", "csync_autoremove")) { // Only try the autoremove if the option is enabled. @@ -221,4 +222,4 @@ class cascadecohortsync { } //\mtrace("Cascading complete");. } -} \ No newline at end of file +} diff --git a/classes/cascadeusersync.php b/classes/cascadeusersync.php index bda39b2..f663da4 100644 --- a/classes/cascadeusersync.php +++ b/classes/cascadeusersync.php @@ -39,10 +39,10 @@ class cascadeusersync { /* Explainer: This script uses {enrol}.customtext4 to store a json array of all studyplans that need this cohort sync to exist. Since the cohort-sync enrolment method uses only customint1 and customint2, this is a safe place to store the data. - (Should the cohortsync script at any future time be modified to use customtext fields, it is still extremely unlikely that - customtext4 will be used.) - Because of the overhead involved in keeping an extra table up to date and clean it up if cohort syncs are removed outside of this script, - it was determined to be the simplest and cleanest solution. + (Should the cohortsync script at any future time be modified to use customtext fields, it is still extremely + unlikely that customtext4 will be used.) + Because of the overhead involved in keeping an extra table up to date and clean it up if cohort syncs are removed + outside of this script, it was determined to be the simplest and cleanest solution. */ $enrol = \enrol_get_plugin(self::METHOD); @@ -80,4 +80,4 @@ class cascadeusersync { } } -} \ No newline at end of file +} diff --git a/classes/completion.php b/classes/completion.php index d11d825..89cdb8b 100644 --- a/classes/completion.php +++ b/classes/completion.php @@ -51,7 +51,9 @@ class completion { } public static function structure($value=VALUE_REQUIRED) { - return new \external_value(PARAM_TEXT, 'completion state (failed|incomplete|pending|progress|completed|good|excellent)', $value); + return new \external_value( PARAM_TEXT, + 'completion state (failed|incomplete|pending|progress|completed|good|excellent)', + $value); } public static function count_states(array $states) { @@ -71,4 +73,4 @@ class completion { return $statecount; } -} \ No newline at end of file +} diff --git a/classes/completionscanner.php b/classes/completionscanner.php index 55b1a7b..fd51db7 100644 --- a/classes/completionscanner.php +++ b/classes/completionscanner.php @@ -67,10 +67,15 @@ class completionscanner { if ($crit->criteriatype == COMPLETION_CRITERIA_TYPE_ACTIVITY) { // First find the course module. $this->cm = $this->modinfo->get_cm($crit->moduleinstance); - $gi = grade_item::fetch(['itemtype' => 'mod', 'itemmodule' => $this->cm->modname, 'iteminstance' => $this->cm->instance, 'courseid' => $this->courseid]); + $gi = grade_item::fetch( ['itemtype' => 'mod', + 'itemmodule' => $this->cm->modname, + 'iteminstance' => $this->cm->instance, + 'courseid' => $this->courseid]); if ($gi !== false) { - // Grade none items should not be relevant. - // Note that the grade status is probably only relevant if the item has not yet received a completion, but has been submitted. + /* Grade none items should not be relevant. + Note that the grade status is probably only relevant if the item + has not yet received a completion, but has been submitted. + */ if (($gi->gradetype == GRADE_TYPE_VALUE || $gi->gradetype == GRADE_TYPE_SCALE)) { // If it's a relevant grade type, initialize a scanner if possible. $this->gi = $gi; @@ -139,7 +144,6 @@ class completionscanner { } } - return [ 'ungraded' => $ungraded, 'completed' => $completed, @@ -149,4 +153,4 @@ class completionscanner { ]; } -} \ No newline at end of file +} diff --git a/classes/contextinfo.php b/classes/contextinfo.php index 83df456..dafd00c 100644 --- a/classes/contextinfo.php +++ b/classes/contextinfo.php @@ -47,7 +47,9 @@ class contextinfo { "name" => $this->context->get_context_name(false, false), "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), - "shortpath" => array_map(function($c) { return \context::instance_by_id($c)->get_context_name(false, true);}, $ctxPath), + "shortpath" => array_map(function($c) { + return \context::instance_by_id($c)->get_context_name(false, true); + }, $ctxPath), ]; } @@ -62,6 +64,4 @@ class contextinfo { return \context::instance_by_id($contextid); } - - -} \ No newline at end of file +} diff --git a/classes/corecompletioninfo.php b/classes/corecompletioninfo.php index 2484a2d..98e9869 100644 --- a/classes/corecompletioninfo.php +++ b/classes/corecompletioninfo.php @@ -116,8 +116,10 @@ class corecompletioninfo { ]), "link" => new \external_value(PARAM_TEXT, 'optional link to more details', VALUE_OPTIONAL), "completed" => new \external_value(PARAM_BOOL, 'simple completed or not'), - "status" => new \external_value(PARAM_TEXT, 'extended completion status ["incomplete", "progress", "complete", "complete-pass", "complete-fail"]'), - "pending" => new \external_value(PARAM_BOOL, 'optional pending state, for submitted but not yet reviewed activities', VALUE_OPTIONAL), + "status" => new \external_value(PARAM_TEXT, + 'extended completion status ["incomplete", "progress", "complete", "complete-pass", "complete-fail"]'), + "pending" => new \external_value(PARAM_BOOL, + 'optional pending state, for submitted but not yet reviewed activities', VALUE_OPTIONAL), "grade" => new \external_value(PARAM_TEXT, 'optional grade result for this subitem', VALUE_OPTIONAL), "feedback" => new \external_value(PARAM_RAW, 'optional feedback for this subitem ', VALUE_OPTIONAL), ], 'completion type', $value); @@ -131,7 +133,8 @@ class corecompletioninfo { "type" => new \external_value(PARAM_TEXT, 'completion type name'), "aggregation" => new \external_value(PARAM_TEXT, 'completion aggregation for this type ["all", "any"]'), "completed" => new \external_value(PARAM_BOOL, 'current completion value for this type'), - "status" => new \external_value(PARAM_TEXT, 'extended completion status ["incomplete", "progress", "complete", "complete-pass", "complete-fail"]'), + "status" => new \external_value(PARAM_TEXT, + 'extended completion status ["incomplete", "progress", "complete", "complete-pass", "complete-fail"]'), "progress" => new \external_value(PARAM_INT, 'completed sub-conditions'), "count" => new \external_value(PARAM_INT, 'total number of sub-conditions'), ], 'completion type', $value); @@ -171,8 +174,8 @@ class corecompletioninfo { // Loop through all condition types to see if they are applicable. foreach (self::completiontypes() as $type) { $criterias = $this->completion->get_criteria($type); // Returns array of relevant criteria items. - if (count($criterias) > 0 ) // Only take it into account if the criteria count is > 0. - { + if (count($criterias) > 0 ) { + // Only take it into account if the criteria count is > 0. $cinfo = [ "type" => $COMPLETIONCRITERIA_TYPES[$type], "aggregation" => self::aggregation_handle($this->completion->get_aggregation_method($type)), @@ -209,10 +212,13 @@ class corecompletioninfo { ]; } else if ($type == COMPLETION_CRITERIA_TYPE_ACTIVITY) { $cm = $this->modinfo->get_cm($criteria->moduleinstance); + /* Criteria and requirements will be built in a moment by code copied + from completion_criteria_activity.php. + */ $details = [ "type" => $criteria->get_title(), - "criteria" => "", // Will be built in a moment by code copied from completion_criteria_activity.php. - "requirement" => "", // Will be built momentarily by code copied from completion_criteria_activity.php. + "criteria" => "", + "requirement" => "", "status" => "", ]; if ($cm->has_view()) { @@ -254,7 +260,8 @@ class corecompletioninfo { "type" => get_string('coursegrade', 'completion'), "criteria" => get_string('graderequired', 'completion'), // TODO: convert to selected representation (letter, percentage, etc). - "requirement" => get_string('graderequired', 'completion').": ".format_float($criteria->gradepass, 1), + "requirement" => get_string('graderequired', 'completion') + .": ".format_float($criteria->gradepass, 1), "status" => "", ]; } else if ($type == COMPLETION_CRITERIA_TYPE_ROLE) { @@ -272,7 +279,8 @@ class corecompletioninfo { $fullname = format_string($prereq->fullname, true, array('context' => $coursecontext)); $details = [ "type" => $criteria->get_title(), - "criteria" => ''.s($fullname).'', + "criteria" => ''.s($fullname).'', "requirement" => get_string('coursecompleted', 'completion'), "status" => "", ]; @@ -303,7 +311,6 @@ class corecompletioninfo { } } - return $info; } @@ -369,7 +376,8 @@ class corecompletioninfo { "title" => $criteria->get_title_detailed(), "details" => $criteria->get_details($completion), "completed" => $completion->is_complete(), // Make sure to override for activi. - "status" => self::completion_handle($completion->is_complete() ? COMPLETION_COMPLETE : COMPLETION_INCOMPLETE), + "status" => self::completion_handle( + $completion->is_complete() ? COMPLETION_COMPLETE : COMPLETION_INCOMPLETE), ]; if ($type == COMPLETION_CRITERIA_TYPE_ACTIVITY) { @@ -397,7 +405,8 @@ class corecompletioninfo { // Make sure we provide the current course grade. $iinfo['grade'] = floatval($iinfo['details']['status']); if ($iinfo["grade"] > 0) { - $iinfo["grade"] = format_float($iinfo["grade"], 1). "/".format_float(floatval($iinfo['details']['requirement'])); + $iinfo["grade"] = format_float($iinfo["grade"], 1). "/". + format_float(floatval($iinfo['details']['requirement'])); $iinfo["status"] = $completion->is_complete() ? "complete-pass" : "complete-fail"; if ($cinfo["status"] == "incomplete") { $cinfo["status"] = "progress"; @@ -507,7 +516,6 @@ class corecompletioninfo { return null; // Course cannot be graded (Shouldn't be happening, but still....). } - /** * Returns the percentage completed by a certain user, returns null if no completion data is available. * @@ -543,7 +551,8 @@ class corecompletioninfo { // Retrieve data for this object. $data = $this->completion->get_data($cm, false, $userid); // Count complete, but failed as incomplete too... - if (($data->completionstate == COMPLETION_INCOMPLETE) || ($data->completionstate == COMPLETION_COMPLETE_FAIL)) { + if (($data->completionstate == COMPLETION_INCOMPLETE) + || ($data->completionstate == COMPLETION_COMPLETE_FAIL)) { $completed += 0; } else { $completed += 1; @@ -662,5 +671,4 @@ class corecompletioninfo { return $result; } - } diff --git a/classes/courseinfo.php b/classes/courseinfo.php index ca80a30..c24b30e 100644 --- a/classes/courseinfo.php +++ b/classes/courseinfo.php @@ -118,8 +118,7 @@ class courseinfo { if ($now > $course->startdate) { if ($course->enddate > 0 && $now > $course->enddate) { return "past"; - } - else { + } else { return "present"; } } else { @@ -187,7 +186,8 @@ class courseinfo { "displayname" => new \external_value(PARAM_TEXT, 'linked course displayname'), "context" => contextinfo::structure(VALUE_OPTIONAL), "ctxid" => new \external_value(PARAM_INT, 'course context id name'), - "grades" => new \external_multiple_structure(gradeinfo::editor_structure(), 'grade list (legacy list)', VALUE_OPTIONAL), + "grades" => new \external_multiple_structure(gradeinfo::editor_structure(), + 'grade list (legacy list)', VALUE_OPTIONAL), "completion" => corecompletioninfo::editor_structure(VALUE_OPTIONAL), "timing" => new \external_value(PARAM_TEXT, '(past|present|future)'), "startdate" => new \external_value(PARAM_TEXT, 'Course start date'), @@ -281,7 +281,6 @@ class courseinfo { $info['completion'] = $cc->user_model($userid); } - return $info; } diff --git a/classes/courseservice.php b/classes/courseservice.php index 33b23c0..f64122d 100644 --- a/classes/courseservice.php +++ b/classes/courseservice.php @@ -319,7 +319,9 @@ class courseservice extends \external_api { // Validate course is linked to studyplan. $courseid = $gi->courseid; if (!$o->course_linked($courseid)) { - throw new \webservice_access_exception("Course {$courseid} linked to grade item {$gradeitemid} is not linked to studyplan {$o->id()}"); + throw new \webservice_access_exception( + "Course {$courseid} linked to grade item {$gradeitemid} is not linked to studyplan {$o->id()}" + ); } $scanner = new gradingscanner($gi); @@ -346,7 +348,8 @@ class courseservice extends \external_api { $crit = \completion_criteria::fetch(["id" => $criteriaid]); if (!$o->course_linked($courseid)) { - throw new \webservice_access_exception("Course {$courseid} linked to criteria {$criteriaid} is not linked to studyplan {$o->id()}"); + throw new \webservice_access_exception( + "Course {$courseid} linked to criteria {$criteriaid} is not linked to studyplan {$o->id()}"); } $scanner = new completionscanner($crit, \get_course($courseid)); return $scanner->model(); @@ -355,7 +358,8 @@ class courseservice extends \external_api { public static function scan_badge_progress_parameters() { return new \external_function_parameters( [ "badgeid" => new \external_value(PARAM_INT, 'Badge to scan progress for', VALUE_DEFAULT), - "studyplanid" => new \external_value(PARAM_INT, 'Study plan id to limit progress search to (to determine which students to scan)', VALUE_DEFAULT), + "studyplanid" => new \external_value(PARAM_INT, + 'Study plan id to limit progress search to (to determine which students to scan)', VALUE_DEFAULT), ]); } @@ -390,7 +394,5 @@ class courseservice extends \external_api { "total" => count($studentids), "issued" => $badgeinfo->count_issued($studentids), ]; - } - -} \ No newline at end of file +} diff --git a/classes/gradeinfo.php b/classes/gradeinfo.php index fc374d7..008b97e 100644 --- a/classes/gradeinfo.php +++ b/classes/gradeinfo.php @@ -159,7 +159,8 @@ class gradeinfo { global $DB; if ($this->studyitem) { // Check if selected for this studyitem. - $r = $DB->get_record('local_treestudyplan_gradeinc', ['studyitem_id' => $this->studyitem->id(), 'grade_item_id' => $this->gradeitem->id]); + $r = $DB->get_record('local_treestudyplan_gradeinc', + ['studyitem_id' => $this->studyitem->id(), 'grade_item_id' => $this->gradeitem->id]); if ($r && $r->include) { return(true); } @@ -171,7 +172,8 @@ class gradeinfo { global $DB; if ($this->studyitem) { // Check if selected for this studyitem. - $r = $DB->get_record('local_treestudyplan_gradeinc', ['studyitem_id' => $this->studyitem->id(), 'grade_item_id' => $this->gradeitem->id]); + $r = $DB->get_record('local_treestudyplan_gradeinc', + ['studyitem_id' => $this->studyitem->id(), 'grade_item_id' => $this->gradeitem->id]); if ($r && $r->include && $r->required) { return(true); } @@ -209,7 +211,9 @@ class gradeinfo { "required" => $this->is_required(), ]; // Unfortunately, lazy loading of the completion data is off, since we need the data to show study item completion... - if ($studyitem !== null && $this->is_selected() && has_capability('local/treestudyplan:viewuserreports', $studyitem->studyline()->studyplan()->context()) + if ($studyitem !== null + && $this->is_selected() + && has_capability('local/treestudyplan:viewuserreports', $studyitem->studyline()->studyplan()->context()) && $this->gradingscanner->is_available()) { $model['grading'] = $this->gradingscanner->model(); } @@ -319,7 +323,10 @@ class gradeinfo { } foreach ($activities as $act) { if ($act->visible) { - $gradeitems= grade_item::fetch_all(['itemtype' => 'mod', 'itemmodule' => $act->mod, 'iteminstance' => $act->id, 'courseid' => $course->id]); + $gradeitems= grade_item::fetch_all(['itemtype' => 'mod', + 'itemmodule' => $act->mod, + 'iteminstance' => $act->id, + 'courseid' => $course->id]); if (!empty($gradeitems)) { foreach ($gradeitems as $gi) { if (($gi->gradetype == GRADE_TYPE_VALUE || $gi->gradetype == GRADE_TYPE_SCALE)) { @@ -396,5 +403,4 @@ class gradeinfo { return success::success(); } - } diff --git a/classes/gradingscanner.php b/classes/gradingscanner.php index fdf0d53..2584d29 100644 --- a/classes/gradingscanner.php +++ b/classes/gradingscanner.php @@ -171,5 +171,4 @@ class gradingscanner { } } } - -} \ No newline at end of file +} diff --git a/classes/local/aggregators/bistate_aggregator.php b/classes/local/aggregators/bistate_aggregator.php index 435670a..0e54f7b 100644 --- a/classes/local/aggregators/bistate_aggregator.php +++ b/classes/local/aggregators/bistate_aggregator.php @@ -36,7 +36,7 @@ class bistate_aggregator extends \local_treestudyplan\aggregator { private $threshgood = 0.8; // Minimum fraction that must be completed to aggregate as good. private $threshcompleted = 0.66; // Minimum fraction that must be completed to aggregate as completed. private $usefailed = True; // Support failed completion yes/no. - private $threshprogress = 0.33; // Minimum fraction that must be failed to aggregate as failed instead of progress. + private $threshprogress = 0.33; // Minimum fraction that must be failed to aggregate as failed instead of progress. private $acceptpending_as_submitted = False; // Also count ungraded but submitted . public function __construct($configstr) { @@ -192,9 +192,12 @@ class bistate_aggregator extends \local_treestudyplan\aggregator { if ( $total == $statecount[completion::EXCELLENT]) { return completion::EXCELLENT; - } else if ( $total == $statecount[completion::EXCELLENT] + $statecount[completion::GOOD]) { + } else if ( $total == ( $statecount[completion::EXCELLENT] + + $statecount[completion::GOOD]) ) { return completion::GOOD; - } else if ( $total == $statecount[completion::EXCELLENT] + $statecount[completion::GOOD] + $statecount[completion::COMPLETED]) { + } else if ( $total == ( $statecount[completion::EXCELLENT] + + $statecount[completion::GOOD] + + $statecount[completion::COMPLETED]) ) { return completion::COMPLETED; } else if ( $statecount[completion::FAILED]) { return completion::FAILED; @@ -284,5 +287,4 @@ class bistate_aggregator extends \local_treestudyplan\aggregator { } } } - -} \ No newline at end of file +} diff --git a/classes/local/aggregators/core_aggregator.php b/classes/local/aggregators/core_aggregator.php index aa6bd48..c9e86ac 100644 --- a/classes/local/aggregators/core_aggregator.php +++ b/classes/local/aggregators/core_aggregator.php @@ -144,9 +144,12 @@ class core_aggregator extends \local_treestudyplan\aggregator { if ( $total == $statecount[completion::EXCELLENT]) { return completion::EXCELLENT; - } else if ( $total == $statecount[completion::EXCELLENT] + $statecount[completion::GOOD]) { + } else if ( $total == ( $statecount[completion::EXCELLENT] + + $statecount[completion::GOOD]) ) { return completion::GOOD; - } else if ( $total == $statecount[completion::EXCELLENT] + $statecount[completion::GOOD] + $statecount[completion::COMPLETED]) { + } else if ( $total == ( $statecount[completion::EXCELLENT] + + $statecount[completion::GOOD] + + $statecount[completion::COMPLETED]) ) { return completion::COMPLETED; } else if ( $statecount[completion::FAILED]) { return completion::FAILED; @@ -238,4 +241,4 @@ class core_aggregator extends \local_treestudyplan\aggregator { } } -} \ No newline at end of file +} diff --git a/classes/local/aggregators/tristate_aggregator.php b/classes/local/aggregators/tristate_aggregator.php index f2018d6..133709a 100644 --- a/classes/local/aggregators/tristate_aggregator.php +++ b/classes/local/aggregators/tristate_aggregator.php @@ -66,8 +66,10 @@ class tristate_aggregator extends \local_treestudyplan\aggregator { } else if ($ccompleted >= $required) { return completion::COMPLETED; } else { - // Return PROGRESS if one or more completions are COMPLETED or EXCELLENT, but the aggregation margin is not met. - // State PROGRESS will not carry on if aggregations are chained. + /* Return PROGRESS if one or more completions are COMPLETED or EXCELLENT, + but the aggregation margin is not met. + State PROGRESS will not carry on if aggregations are chained. + */ if ($cprogress > 0) { return completion::PROGRESS; } else if ($cpending > 0) { @@ -157,5 +159,4 @@ class tristate_aggregator extends \local_treestudyplan\aggregator { } } - -} \ No newline at end of file +} diff --git a/classes/local/gradegenerator.php b/classes/local/gradegenerator.php index 9132f1a..c8586eb 100644 --- a/classes/local/gradegenerator.php +++ b/classes/local/gradegenerator.php @@ -157,7 +157,9 @@ class gradegenerator { $results[] = $r; if (!$gaveup && $i >= 3) { - // There is a slight chance the students with low endurance for this course will stop with this course's work entirely. + /* There is a slight chance the students with low endurance + for this course will stop with this course's work entirely. + */ $gaveup = (rand(0, $end) < 15); } } @@ -234,13 +236,25 @@ class gradegenerator { if (!$gr->done) { // INCOMPLETe or FAILED. $grade = rand(0, round($range * 0.35) - 1); - $r = (object)["gi" => $g, "grade" => $gi->grademin+$grade, "fb" =>($grade > 0) ? $gr->fb : "" ]; + $r = (object)[ + "gi" => $g, + "grade" => $gi->grademin+$grade, + "fb" =>($grade > 0) ? $gr->fb : "" + ]; } else if (!$gr->result) { //PROGRESS. - $r = (object)["gi" => $g, "grade" => $gi->grademin+rand(round($range * 0.35), round($range * 0.55) - 1 ), "fb" => $gr->fb ]; + $r = (object)[ + "gi" => $g, + "grade" => $gi->grademin+rand(round($range * 0.35), round($range * 0.55) - 1 ), + "fb" => $gr->fb + ]; } else { // COMPLETED. - $r = (object)["gi" => $g, "grade" => $gi->grademin+rand(round($range * 0.55) , $range ), "fb" => $gr->fb ]; + $r = (object)[ + "gi" => $g, + "grade" => $gi->grademin+rand(round($range * 0.55) , $range ), + "fb" => $gr->fb + ]; } $r->gradetext = $r->grade; diff --git a/classes/local/helpers/webservicehelper.php b/classes/local/helpers/webservicehelper.php index b8bc63a..ff8de3b 100644 --- a/classes/local/helpers/webservicehelper.php +++ b/classes/local/helpers/webservicehelper.php @@ -31,7 +31,7 @@ class webservicehelper { /** * Test for capability in the given context for the current user and throw a \webservice_access_exception if not * Note: The context is not validate - * @param array|string $capability One or more capabilities to be tested OR wise (if one capability is given, the function passes) + * @param array|string $capability One or more capabilities to be tested OR wise * @param \context $context The context in which to check for the capability. * @throws \webservice_access_exception If none of the capabilities provided are given to the current user * @return boolean @@ -57,7 +57,7 @@ class webservicehelper { /** * Test if the current user has a certain capability in any of the categories they have access to * @param string $capability The capability to scan for in the categories - * @param \core_course_category $parent The parent category to use as a scanning base. Used in recursing Leave empty if calling this function + * @param \core_course_category $parent The parent category to use as a scanning base. Used internally. * @return boolean */ public static function has_capability_in_any_category($capability, \core_course_category $parent=null) { @@ -95,7 +95,7 @@ class webservicehelper { /** * Test for capability in the given context for the current user and throw a \webservice_access_exception if not - * @param array|string $capability One or more capabilities to be tested OR wise (if one capability is given, the function passes) + * @param array|string $capability One or more capabilities to be tested OR wise * @param \context $context The context in which to check for the capability. Leave empty to use the system context. * @param bool $validate Validate the context before checking capabilities * @throws \webservice_access_exception If none of the capabilities provided are given to the current user @@ -105,7 +105,9 @@ class webservicehelper { \external_api::validate_context($context); } if (! static::has_capabilities($capability, $context)) { - throw new \webservice_access_exception("The capability {$capability} is required on this context ({$context->get_context_name()})"); + throw new \webservice_access_exception( + "The capability {$capability} is required on this context ({$context->get_context_name()})" + ); } } @@ -123,7 +125,8 @@ class webservicehelper { try { $context = \context::instance_by_id($contextid); } catch (\dml_missing_record_exception $x) { - throw new \InvalidArgumentException("Context {$contextid} not available"); // Just throw it up again. catch is included here to make sure we know it throws this exception. + // Just throw it up again. catch is included here to make sure we know it throws this exception. + throw new \InvalidArgumentException("Context {$contextid} not available"); } // Validate the found context. \external_api::validate_context($context); @@ -147,4 +150,4 @@ class webservicehelper { return static::$systemcontext; } -} \ No newline at end of file +} diff --git a/classes/local/ungradedscanners/assign_scanner.php b/classes/local/ungradedscanners/assign_scanner.php index 53c3f5a..dfb8c9a 100644 --- a/classes/local/ungradedscanners/assign_scanner.php +++ b/classes/local/ungradedscanners/assign_scanner.php @@ -26,8 +26,7 @@ class assign_scanner extends scanner_base { protected function get_ungraded_submissions() { global $DB; - //SELECT asgn_sub.id as submissionid, a.id as instanceid, asgn_sub.userid as userid, asgn_sub.timemodified as timesubmitted, asgn_sub.attemptnumber , a.maxattempts. - $sql = "SELECT DISTINCT asgn_sub.userid + $sql = "SELECT DISTINCT asgn_sub.userid FROM {assign_submission} asgn_sub JOIN {assign} a ON a.id = asgn_sub.assignment LEFT JOIN {assign_grades} ag ON ag.assignment = asgn_sub.assignment AND ag.userid = asgn_sub.userid AND diff --git a/classes/local/ungradedscanners/quiz_scanner.php b/classes/local/ungradedscanners/quiz_scanner.php index 9f68471..d54997b 100644 --- a/classes/local/ungradedscanners/quiz_scanner.php +++ b/classes/local/ungradedscanners/quiz_scanner.php @@ -31,17 +31,20 @@ class quiz_scanner extends scanner_base { global $DB; // First find all question attempts that need grading. - $sql = "SELECT qza.id as submissionid, qza.userid as userid, qas.questionattemptid as attempt_id, qas.sequencenumber as sequencenumber - FROM {question_attempt_steps} qas - JOIN {question_attempts} qna ON qas.questionattemptid = qna.id - JOIN {quiz_attempts} qza ON qna.questionusageid = qza.uniqueid - WHERE qas.state = 'needsgrading' AND qza.quiz = {$this->gi->iteminstance}"; + $sql = "SELECT qza.id as submissionid, qza.userid as userid," + . "qas.questionattemptid as attempt_id, qas.sequencenumber as sequencenumber " + . "FROM {question_attempt_steps} qas " + . "JOIN {question_attempts} qna ON qas.questionattemptid = qna.id " + . "JOIN {quiz_attempts} qza ON qna.questionusageid = qza.uniqueid " + . "WHERE qas.state = 'needsgrading' AND qza.quiz = {$this->gi->iteminstance}"; $rs = $DB->get_recordset_sql($sql); $submissions = []; foreach ($rs as $r) { // Now, check if . - $maxstatesql = "SELECT MAX(qas.sequencenumber) FROM {question_attempt_steps} qas WHERE qas.questionattemptid = {$r->attempt_id}"; + $maxstatesql = "SELECT MAX(qas.sequencenumber) " + . "FROM {question_attempt_steps} qas " + . "WHERE qas.questionattemptid = {$r->attempt_id}"; $max = $DB->get_field_sql($maxstatesql); if ($r->sequencenumber == $max) { $submissions[$r->userid] = true; // Set array index based on user id, to avoid checking if value is in array. diff --git a/classes/local/ungradedscanners/scanner_base.php b/classes/local/ungradedscanners/scanner_base.php index fff8aff..15b39ed 100644 --- a/classes/local/ungradedscanners/scanner_base.php +++ b/classes/local/ungradedscanners/scanner_base.php @@ -30,10 +30,10 @@ abstract class scanner_base { $this->gi = $gi; } - public abstract function count_ungraded($courseuserids=[]); + abstract public function count_ungraded($courseuserids=[]); - public abstract function count_graded($courseuserids=[]); + abstract public function count_graded($courseuserids=[]); - public abstract function has_ungraded_submission($userid); + abstract public function has_ungraded_submission($userid); } \ No newline at end of file diff --git a/classes/period.php b/classes/period.php index 6ba59d0..26633a4 100644 --- a/classes/period.php +++ b/classes/period.php @@ -71,7 +71,8 @@ class period { try { // Check if we have a previous period to glance the end date of as a reference. - $startdate = $DB->get_field(self::TABLE, "enddate", ["page_id" => $page->id(), "period" => $periodnr-1], MUST_EXIST); + $startdate = $DB->get_field(self::TABLE, "enddate", + ["page_id" => $page->id(), "period" => $periodnr-1], MUST_EXIST); $pstart = strtotime($startdate)+(24*60*60); // Add one day. } catch (\dml_missing_record_exception $x2) { // If not, do a fair guess. @@ -79,7 +80,8 @@ class period { } try { // Check if we have a next period to glance the start date of as a reference. - $enddate = $DB->get_field(self::TABLE, "startdate", ["page_id" => $page->id(), "period" => $periodnr+1], MUST_EXIST); + $enddate = $DB->get_field(self::TABLE, "startdate", + ["page_id" => $page->id(), "period" => $periodnr+1], MUST_EXIST); $pstart = strtotime($enddate)-(24*60*60); // Subtract one day. } catch (\dml_missing_record_exception $x2) { // If not, do a fair guess. @@ -243,5 +245,4 @@ class period { } return $model; } - -} \ No newline at end of file +} diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index 25b8697..255f420 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -161,7 +161,6 @@ class provider implements \core_privacy\local\metadata\provider, } - /** * Delete all data for all users in the specified context. * Used when a context is past it's data retention period @@ -193,8 +192,10 @@ class provider implements \core_privacy\local\metadata\provider, foreach ($contextlist->get_contexts() as $context) { if ($context->contextlevel == CONTEXT_SYSTEM) { - $sql = "SELECT s.id FROM {local_treestudyplan} INNER JOIN {local_treestudyplan_user} a ON a.studyplan_id = s.id - WHERE ( a.user_id = :userid AND ( s.context_id IS NULL OR s.context_id == 0 OR s.context_id = :contextid))"; + $sql = "SELECT s.id FROM {local_treestudyplan} " + . "INNER JOIN {local_treestudyplan_user} a ON a.studyplan_id = s.id " + . "WHERE ( a.user_id = :userid " + . "AND ( s.context_id IS NULL OR s.context_id == 0 OR s.context_id = :contextid))"; $planids = $DB->get_fieldset_sql($sql, ["contextid" => $context->id, "userid" => $user->id]); foreach ($planids as $planid) { @@ -289,4 +290,4 @@ class provider implements \core_privacy\local\metadata\provider, } } -} \ No newline at end of file +} diff --git a/classes/reportinvite_form.php b/classes/reportinvite_form.php index 0e2b803..b9bdfb1 100644 --- a/classes/reportinvite_form.php +++ b/classes/reportinvite_form.php @@ -39,18 +39,18 @@ class reportinvite_form extends moodleform { $mform->addElement('hidden', 'update', 0); $mform->setType('update', PARAM_INT); - $mform->addElement('text', 'name', get_string('invite_name', 'local_treestudyplan'), array('size' => 50)); // Add elements to your form. + $mform->addElement('text', 'name', get_string('invite_name', 'local_treestudyplan'), array('size' => 50)); $mform->setType('name', PARAM_NOTAGS); //Set type of element. $mform->setDefault('name', ''); //Default value. $mform->addRule('name', get_string('required'), 'required', null, 'client'); - $mform->addElement('text', 'email', get_string('invite_email', 'local_treestudyplan'), array('size' => 20)); // Add elements to your form. + $mform->addElement('text', 'email', get_string('invite_email', 'local_treestudyplan'), array('size' => 20)); $mform->setType('email', PARAM_NOTAGS); //Set type of element. $mform->setDefault('email', ''); //Default value. $mform->addRule('email', get_string('required'), 'required', null, 'client'); $mform->addRule('email', get_string('email'), 'email', null, 'client'); - $mform->addElement('static', get_string('invite_email', 'local_treestudyplan') ); // Add elements to your form. + $mform->addElement('static', get_string('invite_email', 'local_treestudyplan') ); $this->add_action_buttons(); } @@ -92,7 +92,9 @@ class reportinvite_form extends moodleform { } // Double check that the key is unique before inserting. - } while($DB->record_exists_select("local_treestudyplan_invit", $DB->sql_compare_text("invitekey"). " = " . $DB->sql_compare_text(":invitekey"), ['invitekey' => $randomkey])); + } while($DB->record_exists_select("local_treestudyplan_invit", + $DB->sql_compare_text("invitekey"). " = " . $DB->sql_compare_text(":invitekey"), + ['invitekey' => $randomkey])); $data->invitekey = $randomkey; @@ -100,5 +102,4 @@ class reportinvite_form extends moodleform { } return $data; } - -} \ No newline at end of file +} diff --git a/classes/studentstudyplanservice.php b/classes/studentstudyplanservice.php index 4028476..66644e0 100644 --- a/classes/studentstudyplanservice.php +++ b/classes/studentstudyplanservice.php @@ -143,7 +143,11 @@ class studentstudyplanservice extends \external_api { public static function get_invited_studyplan($invitekey) { global $CFG, $DB; - $invite = $DB->get_record_select("local_treestudyplan_invit", $DB->sql_compare_text("invitekey"). " = " . $DB->sql_compare_text(":invitekey"), ['invitekey' => $invitekey]); + $invite = $DB->get_record_select( + "local_treestudyplan_invit", + $DB->sql_compare_text("invitekey"). " = " . $DB->sql_compare_text(":invitekey"), + ['invitekey' => $invitekey] + ); if (empty($invite)) { return []; @@ -274,4 +278,4 @@ class studentstudyplanservice extends \external_api { return $map; } } -} \ No newline at end of file +} diff --git a/classes/studyitem.php b/classes/studyitem.php index 18765a9..093aef8 100644 --- a/classes/studyitem.php +++ b/classes/studyitem.php @@ -206,7 +206,8 @@ class studyitem { public static function add($fields, $import=false) { global $DB; - $addable = ['line_id', 'type', 'layer', 'conditions', 'slot', 'competency_id', 'course_id', 'badge_id', 'continuation_id', 'span']; + $addable = ['line_id', 'type', 'layer', 'conditions', 'slot', + 'competency_id', 'course_id', 'badge_id', 'continuation_id', 'span']; $info = [ 'layer' => 0, ]; foreach ($addable as $f) { if (array_key_exists($f, $fields)) { @@ -443,7 +444,9 @@ class studyitem { if ($badge->is_issued($userid)) { if ($badge->can_expire()) { // Get the issued badges and check if any of them have not expired yet. - $badgesissued = $DB->get_records("badge_issued", ["badge_id" => $this->r->badge_id, "user_id" => $userid]); + $badgesissued = $DB->get_records("badge_issued", + ["badge_id" => $this->r->badge_id, + "user_id" => $userid]); $notexpired = false; $now = time(); foreach ($badgesissued as $bi) { @@ -519,4 +522,4 @@ class studyitem { return $item; } -} \ No newline at end of file +} diff --git a/classes/studyitemconnection.php b/classes/studyitemconnection.php index 604e577..fe04029 100644 --- a/classes/studyitemconnection.php +++ b/classes/studyitemconnection.php @@ -122,4 +122,4 @@ class studyitemconnection { $DB->delete_records(self::TABLE, ['to_id' => $id]); } -} \ No newline at end of file +} diff --git a/classes/studyline.php b/classes/studyline.php index dbb441a..ab065eb 100644 --- a/classes/studyline.php +++ b/classes/studyline.php @@ -97,8 +97,10 @@ class studyline { "sequence" => new \external_value(PARAM_INT, 'order of studyline'), "slots" => new \external_multiple_structure( new \external_single_structure([ - self::SLOTSET_COMPETENCY => new \external_multiple_structure(studyitem::editor_structure(), 'competency items', VALUE_OPTIONAL), - self::SLOTSET_FILTER => new \external_multiple_structure(studyitem::editor_structure(), 'filter items'), + self::SLOTSET_COMPETENCY => new \external_multiple_structure( + studyitem::editor_structure(), 'competency items', VALUE_OPTIONAL), + self::SLOTSET_FILTER => new \external_multiple_structure( + studyitem::editor_structure(), 'filter items'), ]) ) ]); @@ -259,8 +261,10 @@ class studyline { "sequence" => new \external_value(PARAM_INT, 'order of studyline'), "slots" => new \external_multiple_structure( new \external_single_structure([ - self::SLOTSET_COMPETENCY => new \external_multiple_structure(studyitem::user_structure(), 'competency items', VALUE_OPTIONAL), - self::SLOTSET_FILTER => new \external_multiple_structure(studyitem::user_structure(), 'filter items'), + self::SLOTSET_COMPETENCY => new \external_multiple_structure( + studyitem::user_structure(), 'competency items', VALUE_OPTIONAL), + self::SLOTSET_FILTER => new \external_multiple_structure( + studyitem::user_structure(), 'filter items'), ]) ) ], 'Studyline with user info', $value); @@ -381,4 +385,4 @@ class studyline { } } } -} \ No newline at end of file +} diff --git a/classes/studyplan.php b/classes/studyplan.php index 1b79873..fae6a50 100644 --- a/classes/studyplan.php +++ b/classes/studyplan.php @@ -86,7 +86,9 @@ class studyplan { try { $this->context = contextinfo::by_id($this->r->context_id)->context; } catch (\dml_missing_record_exception $x) { - throw new \InvalidArgumentException("Context {$this->r->context_id} not available"); // Just throw it up again. catch is included here to make sure we know it throws this exception. + // Just throw it up again. catch is included here to make sure we know it throws this exception. + throw new \InvalidArgumentException( + "Context {$this->r->context_id} not available"); } } return $this->context; @@ -593,7 +595,8 @@ class studyplan { public function mark_csync_changed() { global $DB; $DB->update_record(self::TABLE, ['id' => $this->id, "csync_flag" => 1]); - $this->r->csync_flag = 1; //manually set it in the cache, if something unexpected happened, an exception has already been thrown anyway. + // Manually set it in the cache, if something unexpected happened, an exception has already been thrown anyway. + $this->r->csync_flag = 1; } /** @@ -602,7 +605,8 @@ class studyplan { public function clear_csync_changed() { global $DB; $DB->update_record(self::TABLE, ['id' => $this->id, "csync_flag" => 0]); - $this->r->csync_flag = 0; //manually set it in the cache, if something unexpected happened, an exception has already been thrown anyway. + // Manually set it in the cache, if something unexpected happened, an exception has already been thrown anyway. + $this->r->csync_flag = 0; } public function has_csync_changed() { @@ -683,7 +687,4 @@ class studyplan { return ($count > 0) ? true : false; } - - - -} \ No newline at end of file +} diff --git a/classes/studyplanpage.php b/classes/studyplanpage.php index 9118013..238d726 100644 --- a/classes/studyplanpage.php +++ b/classes/studyplanpage.php @@ -509,4 +509,4 @@ class studyplanpage { return true; } -} \ No newline at end of file +} diff --git a/classes/studyplanservice.php b/classes/studyplanservice.php index a7cbfe0..88561f7 100644 --- a/classes/studyplanservice.php +++ b/classes/studyplanservice.php @@ -28,7 +28,6 @@ require_once($CFG->libdir.'/badgeslib.php'); require_once($CFG->libdir.'/gradelib.php'); require_once($CFG->dirroot.'/course/modlib.php'); - class studyplanservice extends \external_api { const CAP_EDIT = "local/treestudyplan:editstudyplan"; @@ -141,7 +140,8 @@ class studyplanservice extends \external_api { return studyplan::simple_structure(); } - public static function add_studyplan($name, $shortname, $idnumber, $description, $periods, $startdate, $enddate, $aggregation="bistate", $aggregationconfig='', $contextid=0) { + public static function add_studyplan($name, $shortname, $idnumber, $description, $periods, + $startdate, $enddate, $aggregation="bistate", $aggregationconfig='', $contextid=0) { // Check if we have the proper rights for the requested context. $context = webservicehelper::find_context($contextid); webservicehelper::require_capabilities(self::CAP_EDIT, $context); @@ -187,10 +187,12 @@ class studyplanservice extends \external_api { return studyplan::simple_structure(); } - public static function edit_studyplan($id, $name, $shortname, $idnumber, $description, $periods, $startdate, $enddate, $aggregation="bistate", $aggregationconfig='', $contextid=0) { + public static function edit_studyplan($id, $name, $shortname, $idnumber, $description, $periods, $startdate, + $enddate, $aggregation="bistate", $aggregationconfig='', $contextid=0) { // Validate access in the intended context. $context = webservicehelper::find_context($contextid); - webservicehelper::require_capabilities(self::CAP_EDIT, $context, false); // Do not validate the context in this case, just check the permissions. + // Do not validate the context in this case, just check the permissions. + webservicehelper::require_capabilities(self::CAP_EDIT, $context, false); $o = studyplan::findById($id); webservicehelper::require_capabilities(self::CAP_EDIT, $o->context()); @@ -301,7 +303,6 @@ class studyplanservice extends \external_api { return $o->editor_model(); } - /************************ * * * delete_studyline * @@ -588,9 +589,9 @@ class studyplanservice extends \external_api { $badges = badges_get_badges(BADGE_TYPE_SITE, "timemodified"); foreach ($badges as $badge) { // TODO: Add config option to list only active badges. -// if ($badge->is_active()) {. +// if ($badge->is_active()) {. $result[] = (new badgeinfo($badge))->editor_model(); -// }. +// }. // TODO: Include course badges somehow... Just site badges is not enough. @@ -697,7 +698,8 @@ class studyplanservice extends \external_api { $scalemax = count($scale->scale_items); // Find studyline id's. - $studylineids = $DB->get_fieldset_select(studyline::TABLE, "id", "studyplan_id = :plan_id", ['plan_id' => $studyplanid]); + $studylineids = $DB->get_fieldset_select(studyline::TABLE, "id", + "studyplan_id = :plan_id", ['plan_id' => $studyplanid]); foreach ($studylineids as $studylineid) { // Find id's of studyitems of type course. $records = $DB->get_records(studyitem::TABLE, ['line_id' => $studylineid]); @@ -723,13 +725,13 @@ class studyplanservice extends \external_api { $gi->grademax = $scalemax; $gi->gradepass = $scalepass; - // Update grade_item. - $result = $gi->update("local/treestudyplan"); // Update, signalling with our signature and bulkupdate. + // Update, signalling with our signature and bulkupdate. + $result = $gi->update("local/treestudyplan"); $debug = ""; if ($result) { $updated = "converted"; - } else { + } else { $updated = "error"; } @@ -837,7 +839,8 @@ class studyplanservice extends \external_api { foreach ($records as $itemr) { $studyitem = new studyitem($itemr->id); if ($studyitem->isValid() && $studyitem->type() == studyitem::COURSE) { - $record = $DB->get_record("course_format_options", ["courseid" => $studyitem->courseid(), "name" => "automaticenddate"]); + $record = $DB->get_record("course_format_options", + ["courseid" => $studyitem->courseid(), "name" => "automaticenddate"]); if ($record && $record->value) { $record->value = false; $DB->update_record("course_format_options", $record); @@ -1194,4 +1197,4 @@ class studyplanservice extends \external_api { } -} \ No newline at end of file +} diff --git a/classes/success.php b/classes/success.php index c86f022..1da31aa 100644 --- a/classes/success.php +++ b/classes/success.php @@ -58,5 +58,4 @@ class success { return $this->msg; } - -} \ No newline at end of file +} diff --git a/classes/task/autocohortsync.php b/classes/task/autocohortsync.php index 6b48630..6fb9406 100644 --- a/classes/task/autocohortsync.php +++ b/classes/task/autocohortsync.php @@ -65,4 +65,4 @@ class autocohortsync extends \core\task\scheduled_task { \mtrace("Automatic csync cascading disabled"); } } -} \ No newline at end of file +} diff --git a/classes/task/refreshteacherlist.php b/classes/task/refreshteacherlist.php index b67e1c9..bff524b 100644 --- a/classes/task/refreshteacherlist.php +++ b/classes/task/refreshteacherlist.php @@ -51,4 +51,4 @@ class refreshteacherlist extends \core\task\scheduled_task { } } -} \ No newline at end of file +} diff --git a/classes/teachingfinder.php b/classes/teachingfinder.php index d1ee3b1..bd3db01 100644 --- a/classes/teachingfinder.php +++ b/classes/teachingfinder.php @@ -107,4 +107,4 @@ class teachingfinder { return (int)($r->update_time); } -} \ No newline at end of file +} diff --git a/cli/randomize_grades.php b/cli/randomize_grades.php index 5cda74c..c6e7188 100644 --- a/cli/randomize_grades.php +++ b/cli/randomize_grades.php @@ -132,14 +132,18 @@ foreach ($plans as $plan) { cli_write (" - {$name} = {$grade}"); // Check if the item is alreaady graded for this user. - $existing = $count = $DB->count_records_select('grade_grades', 'itemid = :gradeitemid AND finalgrade IS NOT NULL and userid = :userid', + $existing = $count = $DB->count_records_select( + 'grade_grades', + 'itemid = :gradeitemid AND finalgrade IS NOT NULL and userid = :userid', ['gradeitemid' => $gi->id, 'userid' => $u->id]); if (!$existing) { if ($gg->grade > 0) { if ($gi->itemmodule == "assign") { // If it is an assignment, submit though that interface . - list($c, $cminfo) = get_course_and_cm_from_instance($gi->iteminstance, $gi->itemmodule); + list($c, $cminfo) = get_course_and_cm_from_instance( + $gi->iteminstance, + $gi->itemmodule); $cmctx = \context_module::instance($cminfo->id); $a = new \assign($cmctx, $cminfo, $c); @@ -181,4 +185,3 @@ foreach ($plans as $plan) { } $generator->toFile($options["file"]); - diff --git a/db/services.php b/db/services.php index a8be91a..59aa7ce 100644 --- a/db/services.php +++ b/db/services.php @@ -59,167 +59,167 @@ $functions = [ 'local_treestudyplan_list_studyplans' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'list_studyplans', //external function name. - 'description' => 'List available studyplans', //human readable description of the web service function. + 'description' => 'List available studyplans', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan, local/treestudyplan:viewuserreports', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan, local/treestudyplan:viewuserreports', 'loginrequired' => true, ], 'local_treestudyplan_get_studyplan_map' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'get_studyplan_map', //external function name. - 'description' => 'Retrieve studyplan map', //human readable description of the web service function. + 'description' => 'Retrieve studyplan map', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan, local/treestudyplan:viewuserreports', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan, local/treestudyplan:viewuserreports', 'loginrequired' => true, ], 'local_treestudyplan_get_studyline_map' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'get_studyline_map', //external function name. - 'description' => 'Retrieve studyline map', //human readable description of the web service function. + 'description' => 'Retrieve studyline map', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_add_studyplan' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'add_studyplan', //external function name. - 'description' => 'Add studyplan', //human readable description of the web service function. + 'description' => 'Add studyplan', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_add_studyline' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'add_studyline', //external function name. - 'description' => 'Add studyline', //human readable description of the web service function. + 'description' => 'Add studyline', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_edit_studyplan' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'edit_studyplan', //external function name. - 'description' => 'Edit studyplan', //human readable description of the web service function. + 'description' => 'Edit studyplan', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_edit_studyline' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'edit_studyline', //external function name. - 'description' => 'Edit studyline', //human readable description of the web service function. + 'description' => 'Edit studyline', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_delete_studyplan' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'delete_studyplan', //external function name. - 'description' => 'Delete studyplan', //human readable description of the web service function. + 'description' => 'Delete studyplan', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_delete_studyline' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'delete_studyline', //external function name. - 'description' => 'Delete studyline', //human readable description of the web service function. + 'description' => 'Delete studyline', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_reorder_studylines' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'reorder_studylines', //external function name. - 'description' => 'Reorder studylines', //human readable description of the web service function. + 'description' => 'Reorder studylines', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_get_studyitem' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'get_studyitem', //external function name. - 'description' => 'Retrieve study item', //human readable description of the web service function. + 'description' => 'Retrieve study item', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_add_studyitem' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'add_studyitem', //external function name. - 'description' => 'Add study item', //human readable description of the web service function. + 'description' => 'Add study item', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_edit_studyitem' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'edit_studyitem', //external function name. - 'description' => 'Edit study item', //human readable description of the web service function. + 'description' => 'Edit study item', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_reorder_studyitems' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'reorder_studyitems', //external function name. - 'description' => 'Reorder study items', //human readable description of the web service function. + 'description' => 'Reorder study items', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_delete_studyitem' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'delete_studyitem', //external function name. - 'description' => 'Delete study item', //human readable description of the web service function. + 'description' => 'Delete study item', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_connect_studyitems' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'connect_studyitems', //external function name. - 'description' => 'Connect study items', //human readable description of the web service function. + 'description' => 'Connect study items', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_disconnect_studyitems' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'disconnect_studyitems', //external function name. - 'description' => 'Disconnect study items', //human readable description of the web service function. + 'description' => 'Disconnect study items', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], /*************************** @@ -229,10 +229,10 @@ $functions = [ 'local_treestudyplan_list_badges' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'list_badges', //external function name. - 'description' => 'List availabel site badges', //human readable description of the web service function. + 'description' => 'List availabel site badges', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], /*************************** @@ -241,278 +241,278 @@ $functions = [ 'local_treestudyplan_list_cohort' => [ //web service function name. 'classname' => '\local_treestudyplan\associationservice', //class containing the external function. 'methodname' => 'list_cohort', //external function name. - 'description' => 'List available cohorts', //human readable description of the web service function. + 'description' => 'List available cohorts', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_find_user' => [ //web service function name. 'classname' => '\local_treestudyplan\associationservice', //class containing the external function. 'methodname' => 'find_user', //external function name. - 'description' => 'Find user', //human readable description of the web service function. + 'description' => 'Find user', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_connect_cohort' => [ //web service function name. 'classname' => '\local_treestudyplan\associationservice', //class containing the external function. 'methodname' => 'connect_cohort', //external function name. - 'description' => 'Connect cohort to studyplan', //human readable description of the web service function. + 'description' => 'Connect cohort to studyplan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_disconnect_cohort' => [ //web service function name. 'classname' => '\local_treestudyplan\associationservice', //class containing the external function. 'methodname' => 'disconnect_cohort', //external function name. - 'description' => 'Disconnect cohort from study plan', //human readable description of the web service function. + 'description' => 'Disconnect cohort from study plan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_connect_user' => [ //web service function name. 'classname' => '\local_treestudyplan\associationservice', //class containing the external function. 'methodname' => 'connect_user', //external function name. - 'description' => 'Connect user to study plan', //human readable description of the web service function. + 'description' => 'Connect user to study plan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_disconnect_user' => [ //web service function name. 'classname' => '\local_treestudyplan\associationservice', //class containing the external function. 'methodname' => 'disconnect_user', //external function name. - 'description' => 'Disconnect user from studyplan', //human readable description of the web service function. + 'description' => 'Disconnect user from studyplan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_associated_users' => [ //web service function name. 'classname' => '\local_treestudyplan\associationservice', //class containing the external function. 'methodname' => 'associated_users', //external function name. - 'description' => 'List users associated with a studyplan', //human readable description of the web service function. + 'description' => 'List users associated with a studyplan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_associated_cohorts' => [ //web service function name. 'classname' => '\local_treestudyplan\associationservice', //class containing the external function. 'methodname' => 'associated_cohorts', //external function name. - 'description' => 'List cohorts associated with a studyplan', //human readable description of the web service function. + 'description' => 'List cohorts associated with a studyplan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_list_user_studyplans' => [ //web service function name. 'classname' => '\local_treestudyplan\studentstudyplanservice', //class containing the external function. 'methodname' => 'list_user_studyplans', //external function name. - 'description' => 'List user studyplans', //human readable description of the web service function. + 'description' => 'List user studyplans', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:viewuserreports', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:viewuserreports', 'loginrequired' => true, ], 'local_treestudyplan_get_user_studyplans' => [ //web service function name. 'classname' => '\local_treestudyplan\studentstudyplanservice', //class containing the external function. 'methodname' => 'get_user_studyplans', //external function name. - 'description' => 'Retrieve user studyplan', //human readable description of the web service function. + 'description' => 'Retrieve user studyplan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:viewuserreports', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:viewuserreports', 'loginrequired' => true, ], 'local_treestudyplan_get_user_studyplan' => [ //web service function name. 'classname' => '\local_treestudyplan\studentstudyplanservice', //class containing the external function. 'methodname' => 'get_user_studyplan', //external function name. - 'description' => 'Retrieve user studyplan', //human readable description of the web service function. + 'description' => 'Retrieve user studyplan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:viewuserreports', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:viewuserreports', 'loginrequired' => true, ], 'local_treestudyplan_get_invited_studyplan' => [ //web service function name. 'classname' => '\local_treestudyplan\studentstudyplanservice', //class containing the external function. 'methodname' => 'get_invited_studyplan', //external function name. - 'description' => 'Retrieve user studyplan based on invite', //human readable description of the web service function. + 'description' => 'Retrieve user studyplan based on invite', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => '', // Advises the admin which capabilities are required. + 'capabilities' => '', 'loginrequired' => false, ], 'local_treestudyplan_list_own_studyplans' => [ //web service function name. 'classname' => '\local_treestudyplan\studentstudyplanservice', //class containing the external function. 'methodname' => 'list_own_studyplans', //external function name. - 'description' => 'List own studyplans', //human readable description of the web service function. + 'description' => 'List own studyplans', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => '', // Advises the admin which capabilities are required. + 'capabilities' => '', 'loginrequired' => true, ], 'local_treestudyplan_get_own_studyplan' => [ //web service function name. 'classname' => '\local_treestudyplan\studentstudyplanservice', //class containing the external function. 'methodname' => 'get_own_studyplan', //external function name. - 'description' => 'Retrieve own studyplan', //human readable description of the web service function. + 'description' => 'Retrieve own studyplan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => '', // Advises the admin which capabilities are required. + 'capabilities' => '', 'loginrequired' => true, ], 'local_treestudyplan_map_categories' => [ //web service function name. 'classname' => '\local_treestudyplan\courseservice', //class containing the external function. 'methodname' => 'map_categories', //external function name. - 'description' => 'List available root categories', //human readable description of the web service function. + 'description' => 'List available root categories', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_get_category' => [ //web service function name. 'classname' => '\local_treestudyplan\courseservice', //class containing the external function. 'methodname' => 'get_category', //external function name. - 'description' => 'Get details for specified category', //human readable description of the web service function. + 'description' => 'Get details for specified category', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_include_grade' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'include_grade', //external function name. - 'description' => 'Include gradable in result', //human readable description of the web service function. + 'description' => 'Include gradable in result', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan, local/treestudyplan:selectowngradables', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan, local/treestudyplan:selectowngradables', 'loginrequired' => true, ], 'local_treestudyplan_all_associated' => [ //web service function name. 'classname' => '\local_treestudyplan\associationservice', //class containing the external function. 'methodname' => 'all_associated', //external function name. - 'description' => 'List associated users', //human readable description of the web service function. + 'description' => 'List associated users', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:viewuserreports', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:viewuserreports', 'loginrequired' => true, ], 'local_treestudyplan_list_aggregators' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'list_aggregators', //external function name. - 'description' => 'List available aggregators', //human readable description of the web service function. + 'description' => 'List available aggregators', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_disable_autoenddate' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'disable_autoenddate', //external function name. - 'description' => 'Disable automatic end dates on courses in the study plan', //human readable description of the web service function. + 'description' => 'Disable automatic end dates on courses in the study plan', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:forcescales', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:forcescales', 'loginrequired' => true, ], 'local_treestudyplan_force_studyplan_scale' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'force_studyplan_scale', //external function name. - 'description' => 'Change all associated gradables to the chosen scale if possible', //human readable description of the web service function. + 'description' => 'Change all associated gradables to the chosen scale if possible', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:forcescales', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:forcescales', 'loginrequired' => true, ], 'local_treestudyplan_list_scales' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'list_scales', //external function name. - 'description' => 'List system scales', //human readable description of the web service function. + 'description' => 'List system scales', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:forcescales', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:forcescales', 'loginrequired' => true, ], 'local_treestudyplan_duplicate_plan' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'duplicate_plan', //external function name. - 'description' => 'Copy studyplan', //human readable description of the web service function. + 'description' => 'Copy studyplan', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_export_plan' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'export_plan', //external function name. - 'description' => 'Export study plan', //human readable description of the web service function. + 'description' => 'Export study plan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_export_studylines' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'export_studylines', //external function name. - 'description' => 'Export study plan', //human readable description of the web service function. + 'description' => 'Export study plan', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_import_plan' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'import_plan', //external function name. - 'description' => 'Import study plan', //human readable description of the web service function. + 'description' => 'Import study plan', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_import_studylines' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'import_studylines', //external function name. - 'description' => 'Import study plan', //human readable description of the web service function. + 'description' => 'Import study plan', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_edit_period' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'edit_period', //external function name. - 'description' => 'Edit period name and timing', //human readable description of the web service function. + 'description' => 'Edit period name and timing', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_submit_cm_editform' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'submit_cm_editform', //external function name. - 'description' => 'Submit course module edit form', //human readable description of the web service function. + 'description' => 'Submit course module edit form', 'type' => 'write', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'loginrequired' => true, ], 'local_treestudyplan_get_teaching_studyplans' => [ //web service function name. 'classname' => '\local_treestudyplan\studentstudyplanservice', //class containing the external function. 'methodname' => 'get_teaching_studyplans', //external function name. - 'description' => 'Get the studyplans I currently teach in', //human readable description of the web service function. + 'description' => 'Get the studyplans I currently teach in', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, - 'capabilities' => 'local/treestudyplan:viewuserreports', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:viewuserreports', 'loginrequired' => true, ], 'local_treestudyplan_list_accessible_categories' => [ //web service function name. 'classname' => '\local_treestudyplan\courseservice', //class containing the external function. 'methodname' => 'list_accessible_categories', //external function name. - 'description' => 'Get categories accessible to the current user', //human readable description of the web service function. + 'description' => 'Get categories accessible to the current user', 'type' => 'read', //database rights of the web service function (read, write). 'ajax' => true, 'loginrequired' => true, @@ -520,63 +520,63 @@ $functions = [ 'local_treestudyplan_list_used_categories' => [ //web service function name. 'classname' => '\local_treestudyplan\courseservice', //class containing the external function. 'methodname' => 'list_used_categories', //external function name. - 'description' => 'Get categories hosting a studyplan', //human readable description of the web service function. + 'description' => 'Get categories hosting a studyplan', 'type' => 'read', //database rights of the web service function (read, write). - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'ajax' => true, 'loginrequired' => true, ], 'local_treestudyplan_scan_badge_progress' => [ //web service function name. 'classname' => '\local_treestudyplan\courseservice', //class containing the external function. 'methodname' => 'scan_badge_progress', //external function name. - 'description' => 'Scan progress of students in attaining badge', //human readable description of the web service function. + 'description' => 'Scan progress of students in attaining badge', 'type' => 'read', //database rights of the web service function (read, write). - 'capabilities' => 'local/treestudyplan:viewuserreports', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:viewuserreports', 'ajax' => true, 'loginrequired' => true, ], 'local_treestudyplan_scan_completion_progress' => [ //web service function name. 'classname' => '\local_treestudyplan\courseservice', //class containing the external function. 'methodname' => 'scan_completion_progress', //external function name. - 'description' => 'Scan progress of students in attaining completions', //human readable description of the web service function. + 'description' => 'Scan progress of students in attaining completions', 'type' => 'read', //database rights of the web service function (read, write). - 'capabilities' => 'local/treestudyplan:viewuserreports', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:viewuserreports', 'ajax' => true, 'loginrequired' => true, ], 'local_treestudyplan_scan_grade_progress' => [ //web service function name. 'classname' => '\local_treestudyplan\courseservice', //class containing the external function. 'methodname' => 'scan_grade_progress', //external function name. - 'description' => 'Scan progress of students in attaining grades', //human readable description of the web service function. + 'description' => 'Scan progress of students in attaining grades', 'type' => 'read', //database rights of the web service function (read, write). - 'capabilities' => 'local/treestudyplan:viewuserreports', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:viewuserreports', 'ajax' => true, 'loginrequired' => true, ], 'local_treestudyplan_cascade_cohortsync' => [ //web service function name. 'classname' => '\local_treestudyplan\associationservice', //class containing the external function. 'methodname' => 'cascade_cohortsync', //external function name. - 'description' => 'Sync cohortsync to studyplan association', //human readable description of the web service function. + 'description' => 'Sync cohortsync to studyplan association', 'type' => 'read', //database rights of the web service function (read, write). - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'ajax' => true, 'loginrequired' => true, ], 'local_treestudyplan_course_period_timing' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'course_period_timing', //external function name. - 'description' => 'Chenge course start and end times to match period', //human readable description of the web service function. + 'description' => 'Chenge course start and end times to match period', 'type' => 'read', //database rights of the web service function (read, write). - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'ajax' => true, 'loginrequired' => true, ], 'local_treestudyplan_set_studyitem_span' => [ //web service function name. 'classname' => '\local_treestudyplan\studyplanservice', //class containing the external function. 'methodname' => 'set_studyitem_span', //external function name. - 'description' => 'Change the span of a course item', //human readable description of the web service function. + 'description' => 'Change the span of a course item', 'type' => 'read', //database rights of the web service function (read, write). - 'capabilities' => 'local/treestudyplan:editstudyplan', // Advises the admin which capabilities are required. + 'capabilities' => 'local/treestudyplan:editstudyplan', 'ajax' => true, 'loginrequired' => true, ], diff --git a/db/tasks.php b/db/tasks.php index 5e6a842..cd6f1dd 100644 --- a/db/tasks.php +++ b/db/tasks.php @@ -40,4 +40,4 @@ $tasks = [ 'dayofweek' => '*', ], -]; \ No newline at end of file +]; diff --git a/db/upgrade.php b/db/upgrade.php index a1098b0..772d110 100644 --- a/db/upgrade.php +++ b/db/upgrade.php @@ -488,4 +488,4 @@ function xmldb_local_treestudyplan_upgrade($oldversion) { } return true; -} \ No newline at end of file +} diff --git a/doc.php b/doc.php index e811db2..05e6a70 100644 --- a/doc.php +++ b/doc.php @@ -50,4 +50,4 @@ if ( in_array($mime, $texttypes)) { } else { header("Content-type: {$mime}"); print file_get_contents($file); -} \ No newline at end of file +} diff --git a/edit-invite.php b/edit-invite.php index cfc8874..afb38e2 100644 --- a/edit-invite.php +++ b/edit-invite.php @@ -108,8 +108,7 @@ if ($mform->is_cancelled()) { redirect("$CFG->wwwroot/local/treestudyplan/invitations.php"); - } - else if (!empty($data->add)) { + } else if (!empty($data->add)) { $id = $DB->insert_record("local_treestudyplan_invit", $data, true); @@ -117,14 +116,11 @@ if ($mform->is_cancelled()) { local_treestudyplan_send_invite($id); redirect("$CFG->wwwroot/local/treestudyplan/invitations.php?sent={$id}"); - } - else if (!empty($data->resend)) { + } else if (!empty($data->resend)) { - } - else if (!empty($data->delete)) { + } else if (!empty($data->delete)) { - } - else + } else { print_error("invaliddata"); } @@ -139,5 +135,4 @@ if ($mform->is_cancelled()) { $mform->display(); } - -print $OUTPUT->footer(); \ No newline at end of file +print $OUTPUT->footer(); diff --git a/edit-plan.php b/edit-plan.php index 4fb8aed..77eebbe 100644 --- a/edit-plan.php +++ b/edit-plan.php @@ -41,8 +41,7 @@ if ($categoryid > 0) { $studyplancontext = context::instance_by_id($contextid); if (in_array($studyplancontext->contextlevel, [CONTEXT_SYSTEM, CONTEXT_COURSECAT])) { $categoryid = $studyplancontext->instanceid; - } - else + } else { $studyplancontext = $systemcontext; } @@ -89,7 +88,6 @@ function t($str, $param=null, $plugin='local_treestudyplan') { print $OUTPUT->header(); - ?>
@@ -102,15 +100,22 @@ print $OUTPUT->header(); / {{ p }} ({{ ctx.studyplancount }}) + > / {{ p }} ({{ ctx.studyplancount }}) +

- +   - {{ studyplan.name }} + {{ studyplan.name }}   header(); variant="primary" :contextid='contextid' > - +
@@ -210,4 +217,4 @@ print $OUTPUT->header();
footer(); \ No newline at end of file +print $OUTPUT->footer(); diff --git a/invitations.php b/invitations.php index 77c9cec..1635b7a 100644 --- a/invitations.php +++ b/invitations.php @@ -85,19 +85,23 @@ if (count($invites) > 0) { print "".userdate($invite->idate, "%x").""; print ""; - print ""; + print ""; print "name)."'"; print " data-confirmbtn='".get_string('send', 'local_treestudyplan')."'"; - print " href='#' data-actionhref='edit-invite.php?resend={$invite->id}' title='".get_string('invite_tooltip_resend', 'local_treestudyplan')."'"; + print " href='#' data-actionhref='edit-invite.php?resend={$invite->id}' title='" + .get_string('invite_tooltip_resend', 'local_treestudyplan')."'"; print " >"; - print ""; + print ""; print "name)."'"; print " data-confirmbtn='".get_string('delete')."'"; - print " href='#' data-actionhref='edit-invite.php?delete={$invite->id}' title='".get_string('invite_tooltip_delete', 'local_treestudyplan')."'"; + print " href='#' data-actionhref='edit-invite.php?delete={$invite->id}' title='" + .get_string('invite_tooltip_delete', 'local_treestudyplan')."'"; print " >"; print ""; @@ -107,8 +111,7 @@ if (count($invites) > 0) { } print ""; -print " ".get_string('invite_button_new', 'local_treestudyplan').""; +print ""; +print " ".get_string('invite_button_new', 'local_treestudyplan').""; - - -print $OUTPUT->footer(); \ No newline at end of file +print $OUTPUT->footer(); diff --git a/invited.php b/invited.php index 499074d..98905e5 100644 --- a/invited.php +++ b/invited.php @@ -35,7 +35,9 @@ $PAGE->set_context($systemcontext); $invitekey = optional_param('key', '', PARAM_ALPHANUM); // Module name. $PAGE->set_url("/local/treestudyplan/invited.php", array('key' => $invitekey)); -$invite = $DB->get_record_select("local_treestudyplan_invit", $DB->sql_compare_text("invitekey"). " = " . $DB->sql_compare_text(":invitekey"), ['invitekey' => $invitekey]); +$invite = $DB->get_record_select("local_treestudyplan_invit", + $DB->sql_compare_text("invitekey"). " = " . $DB->sql_compare_text(":invitekey"), + ['invitekey' => $invitekey]); if (empty($invite)) { $PAGE->set_title(get_string('invalid_invitekey_title', 'local_treestudyplan')); @@ -78,4 +80,4 @@ if (empty($invite)) { footer(); -} \ No newline at end of file +} diff --git a/lang/en/local_treestudyplan.php b/lang/en/local_treestudyplan.php index 1703a1c..77a461f 100644 --- a/lang/en/local_treestudyplan.php +++ b/lang/en/local_treestudyplan.php @@ -39,6 +39,7 @@ $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:selectowngradables'] = 'Teachers can select gradables in their own courses in study plan view mode (manual modes only)'; + $string['report'] = 'Progress report'; $string['report_invited'] = 'Progress report for {$a}'; $string['report_index'] = 'View student progress reports'; @@ -65,13 +66,13 @@ $string['invite_date'] = "Date"; $string['invite_resent_msg'] = 'The invitation for {$a->name}<{$a->email}> has been sent'; $string['invite_mail_subject'] = 'Shared grade card of {$a->sender}'; $string['invite_mail_text'] = ' -

Dear {$a->invitee},

+

Dear {$a->invitee},

I\'d like to invite you to view my study plan and progess.

The link below gives you access at any time to view the most recent results. Feel free to bookmark this link in your browser.

Click the link below to view the study plan:
{$a->link}

-

Kind regards,
+

Kind regards,
{$a->sender}

'; @@ -241,6 +242,7 @@ $string['bistate_aggregator_desc'] = 'Goals are completed or not (e.g. not start $string['core_aggregator_title'] = 'Moodle course completion'; $string['core_aggregator_desc'] = 'Use Moodle core completion'; + $string['setting_bistate_heading'] = 'Defaults for Completed + Required goalsn'; $string['settingdesc_bistate_heading'] = 'Set the defaults for this aggregation method'; @@ -328,4 +330,4 @@ $string["course_timing_ok"] = 'Course timing matches period timing'; $string["course_timing_off"] = 'Course timing does not match period timing. Click here to correct.'; $string["course_period_span"] = 'Spans'; $string["course_period_span_desc"] = 'If the space directly after this course is free, the course can be expanded to span multiple periods.'; -$string["view_completion_report"] = 'View detailed course completion report'; \ No newline at end of file +$string["view_completion_report"] = 'View detailed course completion report'; diff --git a/lang/nl/local_treestudyplan.php b/lang/nl/local_treestudyplan.php index b1150c7..df506e5 100644 --- a/lang/nl/local_treestudyplan.php +++ b/lang/nl/local_treestudyplan.php @@ -332,4 +332,4 @@ $string["course_timing_ok"] = 'Cursustiming en periodetiming komen overeen'; $string["course_timing_off"] = 'Cursustiming en periodetiming komen niet overeen. Klik hier om bij te werken.'; $string["course_period_span"] = 'Duurt'; $string["course_period_span_desc"] = 'Als de ruimte na deze cursus leeg is, kan de cursus worden uitgespreid over meerdere perioden.'; -$string["view_completion_report"] = 'Bekijk gedetailleerd voltooingsoverzicht'; \ No newline at end of file +$string["view_completion_report"] = 'Bekijk gedetailleerd voltooingsoverzicht'; diff --git a/lib.php b/lib.php index 6536f00..7d9b0ad 100644 --- a/lib.php +++ b/lib.php @@ -28,7 +28,12 @@ defined('MOODLE_INTERNAL') || die(); function local_treestudyplan_unit_get_editor_options($context) { global $CFG; - return array('subdirs' => 1, 'maxbytes' => $CFG->maxbytes, 'maxfiles' =>-1, 'changeformat' => 1, 'context' => $context, 'noclean' => 1, 'trusttext' => 0); + return ['subdirs' => 1, + 'maxbytes' => $CFG->maxbytes, + 'maxfiles' =>-1, 'changeformat' => 1, + 'context' => $context, + 'noclean' => 1, + 'trusttext' => 0]; } function local_treestudyplan_extend_navigation(global_navigation $navigation) { @@ -36,24 +41,25 @@ function local_treestudyplan_extend_navigation(global_navigation $navigation) { $systemcontext = context_system::instance(); - // Moodle 4.0-4.2 do not yet support customizing the primary navigation bar (it is a planned feature though). - // For now, go to theme settings and add the following into "Custom menu items". - // [your name for my studyplan]|/local/treestudyplan/myreport.php. - // [your name for studyplan viewing]|/local/treestudyplan/view-plan.php. - // [your name for studyplan managing]|/local/treestudyplan/edit-plan.php. - // For example:. - // Mijn studieplan|/local/treestudyplan/myreport.php. - // Studieplannen|/local/treestudyplan/view-plan.php. - // Studieplannen beheren|/local/treestudyplan/edit-plan.php. + /* Moodle 4.0-4.2 do not yet support customizing the primary navigation bar (it is a planned feature though). + For now, go to theme settings and add the following into "Custom menu items". + [your name for my studyplan]|/local/treestudyplan/myreport.php. + [your name for studyplan viewing]|/local/treestudyplan/view-plan.php. + [your name for studyplan managing]|/local/treestudyplan/edit-plan.php. + For example:. + Mijn studieplan|/local/treestudyplan/myreport.php. + Studieplannen|/local/treestudyplan/view-plan.php. + Studieplannen beheren|/local/treestudyplan/edit-plan.php. - // Using some javascript magic we'll hide the links that are not accessible. - // (Since the Output API does not easily support inline style tags, adding one through Javascript is easier,. - // and not much more complex than loading a separate stylesheet for each link we want to hide). - // We will add all the hrefs that should be hidden to this variable below. + Using some javascript magic we'll hide the links that are not accessible. + (Since the Output API does not easily support inline style tags, adding one through Javascript is easier,. + and not much more complex than loading a separate stylesheet for each link we want to hide). + We will add all the hrefs that should be hidden to this variable below. + */ $hideprimary_hrefs = []; - if ($USER->id > 1) // Don't show if user is not logged in (id == 0) or is guest user (id == 1). - { + if ($USER->id > 1) { + // Don't show if user is not logged in (id == 0) or is guest user (id == 1). $userstudyplans = studyplan::find_for_user($USER->id); if (!empty($userstudyplans)) { @@ -83,8 +89,7 @@ function local_treestudyplan_extend_navigation(global_navigation $navigation) { $node->add_node($invitenode); $navigation->add_node($node, 'mycourses'); - } - else { + } else { $hideprimary_hrefs[] = "/local/treestudyplan/myreport.php"; } if ( has_capability('local/treestudyplan:viewuserreports', context_system::instance()) @@ -100,8 +105,7 @@ function local_treestudyplan_extend_navigation(global_navigation $navigation) { $node->showinflatnavigation = true; $node->showinsecondarynavigation=true; $navigation->add_node($node, 'mycourses'); - } - else { + } else { $hideprimary_hrefs[] = "/local/treestudyplan/view-plan.php"; } if ( has_capability('local/treestudyplan:editstudyplan', context_system::instance()) @@ -118,12 +122,10 @@ function local_treestudyplan_extend_navigation(global_navigation $navigation) { $node->showinflatnavigation = true; $node->showinsecondarynavigation=true; $navigation->add_node($node, 'mycourses'); - } - else { + } else { $hideprimary_hrefs[] = "/local/treestudyplan/edit-plan.php"; } - } - else { + } else { $hideprimary_hrefs[] = "/local/treestudyplan/myreport.php"; $hideprimary_hrefs[] = "/local/treestudyplan/edit-plan.php"; $hideprimary_hrefs[] = "/local/treestudyplan/view-plan.php"; @@ -143,7 +145,6 @@ function local_treestudyplan_extend_navigation(global_navigation $navigation) { // Now using some javascript magic, we'll hide the links that are not accessible. $PAGE->requires->js_call_amd('local_treestudyplan/primary-nav-tools', 'hide_primary', [$hideprimary_hrefs]); - } function local_treestudyplan_extend_navigation_category_settings($navigation, context_coursecat $coursecategorycontext) { @@ -321,4 +322,4 @@ function local_treestudyplan_output_fragment_mod_edit_form($args) { return $mform->render(); -} \ No newline at end of file +} diff --git a/myreport-embed.php b/myreport-embed.php index 0442e10..6cd2446 100644 --- a/myreport-embed.php +++ b/myreport-embed.php @@ -64,4 +64,4 @@ print $OUTPUT->header(); footer(); \ No newline at end of file +print $OUTPUT->footer(); diff --git a/myreport.php b/myreport.php index cd42e30..3cae6b2 100644 --- a/myreport.php +++ b/myreport.php @@ -59,7 +59,8 @@ print $OUTPUT->header(); print '
'; if (!$teachermode) { - print ''.t('manage_invites').''; + print ''; + print ''.t('manage_invites').''; } print "
"; @@ -74,4 +75,4 @@ print " "; print ""; -print $OUTPUT->footer(); \ No newline at end of file +print $OUTPUT->footer(); diff --git a/view-plan.php b/view-plan.php index 6cac0ee..d9d3be0 100644 --- a/view-plan.php +++ b/view-plan.php @@ -41,8 +41,7 @@ if ($categoryid > 0) { $studyplancontext = context::instance_by_id($contextid); if (in_array($studyplancontext->contextlevel, [CONTEXT_SYSTEM, CONTEXT_COURSECAT])) { $categoryid = $studyplancontext->instanceid; - } - else + } else { $studyplancontext = $systemcontext; } @@ -98,22 +97,32 @@ print $OUTPUT->header(); / {{ p }} ({{ ctx.studyplancount }}) + > / {{ p }} + ({{ ctx.studyplancount }})

- +   - {{ studyplan.name }} + {{ studyplan.name }}   - +
-

{{selectedstudent.firstname}} {{selectedstudent.lastname}} - {{displayedstudyplan.name}}

+

{{selectedstudent.firstname}} {{selectedstudent.lastname}} - {{displayedstudyplan.name}}

- {{displayedstudyplan.name}}

- +
Loading...
@@ -158,4 +167,4 @@ print $OUTPUT->header();
footer(); \ No newline at end of file +print $OUTPUT->footer();