/**
* This is not a real unit test, but an experimental attempt at building a HTML table
* based on the sortorders set for each test grade_item.
*/
function test_grade_build_table() {
// Build an associative array of grade_items
$tree = array();
// 1. Fetch all top-level categories for this course, with all children preloaded, sorted by sortorder
$topcats = grade_category::get_tree($this->courseid);
$topcathtml = '
';
foreach ($topcats as $topcat) {
$cathtml = '
';
$itemcount = 0;
$itemhtml = '
';
foreach ($topcat['children'] as $catkey => $cat) {
$catitemcount = 0;
foreach ($cat['children'] as $item) {
$itemcount++;
$catitemcount++;
$itemhtml .= '| ' . $item['object']->itemname . ' | ';
}
$cat['object']->load_grade_item();
$cathtml .= '' . $cat['object']->fullname . ' | ';
}
$topcathtml .= '' . $topcat['object']->fullname . ' | ';
}
$topcathtml .= '
';
$cathtml .= '';
$itemhtml .= '';
echo "$topcathtml$cathtml$itemhtml
";
}