Enabled coach progress bar

This commit is contained in:
PMKuipers 2024-05-18 16:46:27 +02:00
parent 9a1b32855f
commit bcb288bac8
3 changed files with 18 additions and 7 deletions

View File

@ -567,7 +567,7 @@ class studentstudyplanservice extends \external_api {
foreach ($records as $r) { foreach ($records as $r) {
$studyplan = studyplan::find_by_id($r->studyplan_id); $studyplan = studyplan::find_by_id($r->studyplan_id);
if (has_capability(self::CAP_COACH,$studyplan->context(),$USER)) { if (has_capability(self::CAP_COACH,$studyplan->context(),$USER)) {
$list[] = $studyplan->simple_model($userid); $list[] = $studyplan->simple_model($userid,true);
} }
} }
return $list; return $list;

View File

@ -277,7 +277,7 @@ class studyplan {
* Webservice model for basic info * Webservice model for basic info
* @return array Webservice data model * @return array Webservice data model
*/ */
public function simple_model($userid=null) { public function simple_model($userid=null,$coachingoverview=false) {
global $USER; global $USER;
$pages = []; $pages = [];
foreach ($this->pages() as $p) { foreach ($this->pages() as $p) {
@ -300,9 +300,20 @@ class studyplan {
'suspended' => boolval($this->r->suspended), 'suspended' => boolval($this->r->suspended),
]; ];
if(isset($userid)) { if(isset($userid)) {
$model["userid"] = $userid; if(!$coachingoverview) {
$model["progress"] = $this->scanuserprogress($userid); $model["userid"] = $userid;
$model['amteaching'] = teachingfinder::is_teaching_studyplan($this,$userid); $model["progress"] = $this->scanuserprogress($userid);
$model['amteaching'] = teachingfinder::is_teaching_studyplan($this,$userid);
} else {
$users = $this->find_linked_userids();
$sum = 0;
foreach ( $users as $uid ) {
$sum += $this->scanuserprogress($uid);
}
$model["progress"] = $sum / count($users);
}
} }
return $model; return $model;
} }

View File

@ -311,7 +311,7 @@ $string["selectstudent_details"] = "Kies een student uit de lijst om zijn/haar v
$string["showoverview"] = "Docentenweergave"; $string["showoverview"] = "Docentenweergave";
$string["coacheditmode"] = "Bewerk inhoud"; $string["coacheditmode"] = "Bewerk inhoud";
$string["open"] = "Openen"; $string["open"] = "Openen";
$string["noenddate"] = "∞"; $string["noenddate"] = "";
$string["back"] = "Terug"; $string["back"] = "Terug";
$string["send"] = "Verzenden"; $string["send"] = "Verzenden";
@ -329,7 +329,7 @@ $string["bistate_aggregator_desc"] = 'Doelen zijn behaald of niet (o.a. niet ges
$string["core_aggregator_title"] = 'Moodle cursusvoltooiing'; $string["core_aggregator_title"] = 'Moodle cursusvoltooiing';
$string["core_aggregator_desc"] = 'Gebruik de ingesteld cursusvoltooiing'; $string["core_aggregator_desc"] = 'Gebruik de ingesteld cursusvoltooiing';
$string["competency_aggregator_title"] = 'Curuscompetenties'; $string["competency_aggregator_title"] = 'Cursuscompetenties';
$string["competency_aggregator_desc"] = 'Gebruik de bij de cursus ingestelde competenties'; $string["competency_aggregator_desc"] = 'Gebruik de bij de cursus ingestelde competenties';