Fixed some minor warnings

This commit is contained in:
PMKuipers 2024-05-31 20:41:18 +02:00
parent 4fd1e3a547
commit ee0a9c3d3a
9 changed files with 14 additions and 11 deletions

View File

@ -339,7 +339,11 @@ class gradeinfo {
global $DB; global $DB;
$grade = $this->gradeitem->get_final($userid); $grade = $this->gradeitem->get_final($userid);
// Format grade for proper display // 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. // Retrieve the aggregator and determine completion.
if (!isset($this->studyitem)) { if (!isset($this->studyitem)) {

View File

@ -360,7 +360,7 @@ class bistate_aggregator extends \local_treestudyplan\aggregator {
if ($finalgrade >= $gradecfg->min_completed) { if ($finalgrade >= $gradecfg->min_completed) {
// Return completed if completed. // Return completed if completed.
return completion::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 failed if failed is enabled and the grade is less than the minimum grade for progress.
return completion::FAILED; return completion::FAILED;
} else { } 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 no gradeconfig and gradepass is set, use that one to determine config.
if ($finalgrade >= $gradeitem->gradepass) { if ($finalgrade >= $gradeitem->gradepass) {
return completion::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 1, while there are at leas 3 states. // Return failed if failed is enabled and the grade is 1, while there are at leas 3 states.
return completion::FAILED; return completion::FAILED;
} else { } else {

View File

@ -275,7 +275,7 @@ class studyline {
*/ */
public function enrol_roles_model() : array { public function enrol_roles_model() : array {
$list = []; $list = [];
foreach($this->enrol_roles as $role) { foreach($this->enrol_roles() as $role) {
$name = role_get_name($role,$this->context()); // Get localized role name. $name = role_get_name($role,$this->context()); // Get localized role name.
$list[] = [ $list[] = [
"id" => $role->id, "id" => $role->id,

View File

@ -47,7 +47,7 @@ class studyplan {
/** /**
* Cache retrieved pages for the studyplan in this session * Cache retrieved pages for the studyplan in this session
* @var array */ * @var array */
private static $pagecache = []; private $pagecache = [];
/** /**
* Holds database record * Holds database record

View File

@ -166,8 +166,8 @@ class studyplanpage {
public function timing() { public function timing() {
$now = new \DateTime(); $now = new \DateTime();
if ($now > $this->startdate) { if ($now > $this->startdate()) {
if ($this->enddate > 0 && $now > $this->enddate) { if ($now > $this->enddate()) {
return "past"; return "past";
} else { } else {
return "present"; return "present";

View File

@ -305,7 +305,7 @@ $string["nogrades"] = 'No grades';
$string["unknown"] = 'Grading status unknown'; $string["unknown"] = 'Grading status unknown';
$string["when"] = "when"; $string["when"] = "when";
$string["selectstudent_btn"] = "View student plans"; $string["selectstudent_btn"] = "Select view";
$string["selectstudent"] = "Choose student"; $string["selectstudent"] = "Choose student";
$string["selectstudent_details"] = "Pick a student from the list below to see their progress in this study plan"; $string["selectstudent_details"] = "Pick a student from the list below to see their progress in this study plan";
$string["showoverview"] = "Teacher view"; $string["showoverview"] = "Teacher view";

View File

@ -306,7 +306,7 @@ $string["nogrades"] = 'Geen items';
$string["unknown"] = 'Beoordelingen onbekend'; $string["unknown"] = 'Beoordelingen onbekend';
$string["when"] = "zodra"; $string["when"] = "zodra";
$string["selectstudent_btn"] = "Bekijk studentenvoortgang"; $string["selectstudent_btn"] = "Selecteer overzicht";
$string["selectstudent"] = "Kies een student"; $string["selectstudent"] = "Kies een student";
$string["selectstudent_details"] = "Kies een student uit de lijst om zijn/haar voortgang in dit studieplan te bekijken"; $string["selectstudent_details"] = "Kies een student uit de lijst om zijn/haar voortgang in dit studieplan te bekijken";
$string["showoverview"] = "Docentenweergave"; $string["showoverview"] = "Docentenweergave";

View File

@ -24,7 +24,6 @@ require_once("../../config.php");
require_once($CFG->libdir.'/weblib.php'); require_once($CFG->libdir.'/weblib.php');
use local_treestudyplan;
use local_treestudyplan\studyplan; use local_treestudyplan\studyplan;
use local_treestudyplan\teachingfinder; use local_treestudyplan\teachingfinder;

View File

@ -22,7 +22,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->component = 'local_treestudyplan'; // Recommended since 2.0.2 (MDL-26035). Required since 3.0 (MDL-48494). $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->requires = 2021051700; // YYYYMMDDHH (This is the release version for Moodle 3.11).
$plugin->release = "1.3.0"; $plugin->release = "1.3.0";