|1042 /** | 1043 * This is not a real unit test, but an experimental attempt at building a HTML table | 1044 * based on the sortorders set for each test grade_item. | 1045 */ |- 1046 function test_grade_build_table() { || 1047 // Build an associative array of grade_items || 1048 $tree = array(); || 1049 || 1050 // 1. Fetch all top-level categories for this course, with all children preloaded, sorted by sortorder || 1051 $topcats = grade_category::get_tree($this->courseid); || 1052 $topcathtml = ''; || 1053 || 1054 foreach ($topcats as $topcat) { || 1055 $cathtml = ''; || 1056 $itemcount = 0; || 1057 $itemhtml = ''; || 1058 || 1059 foreach ($topcat['children'] as $catkey => $cat) { || 1060 $catitemcount = 0; || 1061 || 1062 foreach ($cat['children'] as $item) { || 1063 $itemcount++; || 1064 $catitemcount++; || 1065 $itemhtml .= '' . $item['object']->itemname . ''; || 1066 } || 1067 || 1068 $cat['object']->load_grade_item(); || 1069 $cathtml .= '' . $cat['object']->fullname . ''; || 1070 } || 1071 $topcathtml .= '' . $topcat['object']->fullname . ''; || 1072 } || 1073 || 1074 $topcathtml .= ''; || 1075 $cathtml .= ''; || 1076 $itemhtml .= ''; || 1077 || 1078 echo "$topcathtml$cathtml$itemhtml
"; || 1079 || 1080 }