$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()); $reporttext .= !empty($overdueentries) ? "<br />" . $overdueentries . " " . get_string('reportsoverdue', 'block_ilp') : ""; } $data[$r->id] = $reporttext; } $lastentry = $dbc->get_lastupdate($student->id); $data['lastupdated'] = !empty($lastentry->timemodified) ? userdate($lastentry->timemodified, get_string('strftimedate', 'langconfig')) : get_string('notapplicable', 'block_ilp'); $flextable->add_data_keyed($data); } } $flextable->print_html();