Skip to content

Instantly share code, notes, and snippets.

@renatosousafilho
Created August 14, 2012 11:44
Show Gist options
  • Save renatosousafilho/3348602 to your computer and use it in GitHub Desktop.
Save renatosousafilho/3348602 to your computer and use it in GitHub Desktop.
Alteração para renderizar apenas as categorias maiores na págiona inicial. Arquivo moodle/course/renderer.php
/**
* Renderers a category for use with course_category_tree
*
* @param array $category
* @param int $depth
* @return string
*/
//Aqui o parâmetro $depth passa a receber o valor 0(zero)
protected function course_category_tree_category(stdClass $category, $depth=0) {
$content = '';
$hassubcategories = (isset($category->categories) && count($category->categories)>0);
$hascourses = (isset($category->courses) && count($category->courses)>0);
$classes = array('category');
if ($category->parent != 0) {
$classes[] = 'subcategory';
}
if (empty($category->visible)) {
$classes[] = 'dimmed_category';
}
if ($hassubcategories || $hascourses) {
$classes[] = 'with_children';
/*
* Aqui a condição verifica se a profundidade é maior ou igual a zero
*/
if ($depth >= 0) {
$classes[] = 'collapsed';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment