/** * get the count of completeds depending on the given groupid. * * @global object * @global object * @param object $evaluation * @param int $groupid * @param int $classid * @return mixed count of completeds or false */ function evaluation_get_completeds_group_count($evaluation, $groupid = false, $classid = false) { global $CFG, $DB; if ($classid > 0 AND ! $groupid <= 0) { $sql = "SELECT id, COUNT(item) AS ci FROM {evaluation_value} WHERE class_id = ? GROUP BY item ORDER BY ci DESC"; if ($foundrecs = $DB->get_records_sql($sql, array($classid))) { $foundrecs = array_values($foundrecs); return $foundrecs[0]->ci; } return false; } if ($values = evaluation_get_completeds_group($evaluation, $groupid)) { return count($values); } else { return false; } }
if (empty($items)) { $items = array(); } foreach ($items as $item) { //get the class of item-typ $itemobj = evaluation_get_item_class($item->typ); $row_offset1 = $itemobj->excelprint_item($worksheet1, $row_offset1, $xls_formats, $item, $mygroupid, $classfilter); } //////////////////////////////////////////////////////////////////////// //print the detailed sheet //////////////////////////////////////////////////////////////////////// //get the completeds $completeds = evaluation_get_completeds_group($evaluation, $mygroupid, $classfilter); //important: for each completed you have to print each item, even if it is not filled out!!! //therefor for each completed we have to iterate over all items of the evaluation //this is done by evaluation_excelprint_detailed_items $row_offset2 = 0; //first we print the table-header $row_offset2 = evaluation_excelprint_detailed_head($worksheet2, $xls_formats, $items, $row_offset2); if (is_array($completeds)) { foreach ($completeds as $completed) { $row_offset2 = evaluation_excelprint_detailed_items($worksheet2, $xls_formats, $completed, $items, $row_offset2); } }