diff --git a/classes/gradeinfo.php b/classes/gradeinfo.php index d2bb2b9..46c5b31 100644 --- a/classes/gradeinfo.php +++ b/classes/gradeinfo.php @@ -339,7 +339,11 @@ class gradeinfo { global $DB; $grade = $this->gradeitem->get_final($userid); // Format grade for proper display - $finalgrade = \grade_format_gradevalue($grade->finalgrade,$this->gradeitem,true,null,1); + if(is_object($grade)) { + $finalgrade = \grade_format_gradevalue($grade->finalgrade,$this->gradeitem,true,null,1); + } else { + $finalgrade = \grade_format_gradevalue(0,$this->gradeitem,true,null,1); + } // Retrieve the aggregator and determine completion. if (!isset($this->studyitem)) { diff --git a/classes/local/aggregators/bistate_aggregator.php b/classes/local/aggregators/bistate_aggregator.php index 3102da1..e0c2518 100644 --- a/classes/local/aggregators/bistate_aggregator.php +++ b/classes/local/aggregators/bistate_aggregator.php @@ -360,7 +360,7 @@ class bistate_aggregator extends \local_treestudyplan\aggregator { if ($finalgrade >= $gradecfg->min_completed) { // Return completed if completed. return completion::COMPLETED; - } else if ($this->use_failed && $coursefinished) { + } else if ($this->cfg()->use_failed && $coursefinished) { // Return failed if failed is enabled and the grade is less than the minimum grade for progress. return completion::FAILED; } else { @@ -371,7 +371,7 @@ class bistate_aggregator extends \local_treestudyplan\aggregator { // If no gradeconfig and gradepass is set, use that one to determine config. if ($finalgrade >= $gradeitem->gradepass) { return completion::COMPLETED; - } else if ($this->use_failed && $coursefinished) { + } else if ($this->cfg()->use_failed && $coursefinished) { // Return failed if failed is enabled and the grade is 1, while there are at leas 3 states. return completion::FAILED; } else { diff --git a/classes/studyline.php b/classes/studyline.php index f2ac8a1..41b1ff6 100644 --- a/classes/studyline.php +++ b/classes/studyline.php @@ -275,7 +275,7 @@ class studyline { */ public function enrol_roles_model() : array { $list = []; - foreach($this->enrol_roles as $role) { + foreach($this->enrol_roles() as $role) { $name = role_get_name($role,$this->context()); // Get localized role name. $list[] = [ "id" => $role->id, diff --git a/classes/studyplan.php b/classes/studyplan.php index d004b61..24101e7 100644 --- a/classes/studyplan.php +++ b/classes/studyplan.php @@ -47,7 +47,7 @@ class studyplan { /** * Cache retrieved pages for the studyplan in this session * @var array */ - private static $pagecache = []; + private $pagecache = []; /** * Holds database record diff --git a/classes/studyplanpage.php b/classes/studyplanpage.php index 4c12a3d..f76eb74 100644 --- a/classes/studyplanpage.php +++ b/classes/studyplanpage.php @@ -166,8 +166,8 @@ class studyplanpage { public function timing() { $now = new \DateTime(); - if ($now > $this->startdate) { - if ($this->enddate > 0 && $now > $this->enddate) { + if ($now > $this->startdate()) { + if ($now > $this->enddate()) { return "past"; } else { return "present"; diff --git a/lang/en/local_treestudyplan.php b/lang/en/local_treestudyplan.php index 1a8af1c..b114710 100644 --- a/lang/en/local_treestudyplan.php +++ b/lang/en/local_treestudyplan.php @@ -305,7 +305,7 @@ $string["nogrades"] = 'No grades'; $string["unknown"] = 'Grading status unknown'; $string["when"] = "when"; -$string["selectstudent_btn"] = "View student plans"; +$string["selectstudent_btn"] = "Select view"; $string["selectstudent"] = "Choose student"; $string["selectstudent_details"] = "Pick a student from the list below to see their progress in this study plan"; $string["showoverview"] = "Teacher view"; diff --git a/lang/nl/local_treestudyplan.php b/lang/nl/local_treestudyplan.php index ebb7b11..1d8f6bd 100644 --- a/lang/nl/local_treestudyplan.php +++ b/lang/nl/local_treestudyplan.php @@ -306,7 +306,7 @@ $string["nogrades"] = 'Geen items'; $string["unknown"] = 'Beoordelingen onbekend'; $string["when"] = "zodra"; -$string["selectstudent_btn"] = "Bekijk studentenvoortgang"; +$string["selectstudent_btn"] = "Selecteer overzicht"; $string["selectstudent"] = "Kies een student"; $string["selectstudent_details"] = "Kies een student uit de lijst om zijn/haar voortgang in dit studieplan te bekijken"; $string["showoverview"] = "Docentenweergave"; diff --git a/myreport.php b/myreport.php index 764e5e9..bc50016 100644 --- a/myreport.php +++ b/myreport.php @@ -24,7 +24,6 @@ require_once("../../config.php"); require_once($CFG->libdir.'/weblib.php'); -use local_treestudyplan; use local_treestudyplan\studyplan; use local_treestudyplan\teachingfinder; diff --git a/version.php b/version.php index 8009922..e84b189 100644 --- a/version.php +++ b/version.php @@ -22,7 +22,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494). -$plugin->version = 2024052400; // YYYYMMDDHH (year, month, day, iteration). +$plugin->version = 2024053103; // YYYYMMDDHH (year, month, day, iteration). $plugin->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11). $plugin->release = "1.3.0";