/** * Static recursive helper - add colspan information into categories * * @param array &$element The seed of the recursion * * @return int */ public function inject_colspans(&$element) { if (empty($element['children'])) { return 1; } $count = 0; foreach ($element['children'] as $key => $child) { $count += grade_tree::inject_colspans($element['children'][$key]); } $element['colspan'] = $count; return $count; }
/** * Static recursive helper - add colspan information into categories * * @param array &$element The seed of the recursion * * @return int */ public function inject_colspans(&$element) { if (empty($element['children'])) { return 1; } $count = 0; foreach ($element['children'] as $key => $child) { if (!self::can_output_item($child)) { continue; } $count += grade_tree::inject_colspans($element['children'][$key]); } $element['colspan'] = $count; return $count; }