if (!empty($mispunctualityavailable)) { $punctpercent = 0; $punctpercent = $misclass->getPunctuality(); //we only want to try to find the percentage if we can get the total possible // punctuality else set it to 0; $data['u_punctuality'] = !empty($punctpercent) ? $punctpercent : 0; } } foreach ($reports as $r) { //get the number of this report that have been created $createdentries = $dbc->count_report_entries($r->id, $student->id); $reporttext = "{$createdentries} " . $r->name; //check if the report has a state field if ($dbc->has_plugin_field($r->id, 'ilp_element_plugin_state')) { //count the number of entries with a pass state $achievedentries = $dbc->count_report_entries_with_state($r->id, $student->id, ILP_STATE_PASS); //we need to count the number of entries that have a notcounted status $notcountedentries = $dbc->count_report_entries_with_state($r->id, $student->id, ILP_STATE_NOTCOUNTED); $createdentries = $createdentries - $notcountedentries; $reporttext = $achievedentries . "/" . $createdentries . " " . get_string('achieved', 'block_ilp'); } if ($dbc->has_plugin_field($r->id, 'ilp_element_plugin_date_deadline')) { $inprogressentries = $dbc->count_report_entries_with_state($r->id, $student->id, ILP_STATE_UNSET, false); $inprogentries = array(); if (!empty($inprogressentries)) { foreach ($inprogressent as $e) { $inprogentries[] = $e->id; } } //get the number of entries that are overdue $overdueentries = $dbc->count_overdue_report($r->id, $student->id, $inprogentries, time());