Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
grade_edit_tree Class Reference

Public Member Functions

 __construct ($gtree, $moving=false, $gpr)
 Constructor.
 
 build_html_tree ($element, $totals, $parents, $level, &$row_count)
 Recursive function for building the table holding the grade categories and items, with CSS indentation and styles. More...
 
 element_deletable ($element)
 Given an element of the grade tree, returns whether it is deletable or not (only manual grade items are deletable) More...
 
 element_duplicatable ($element)
 Given an element of the grade tree, returns whether it is duplicatable or not (only manual grade items are duplicatable) More...
 
 get_deepest_level ($element, $level=0, $deepest_level=1)
 Recurses through the entire grade tree to find and return the maximum depth of the tree. More...
 
 move_elements ($eids, $returnurl)
 Given the grade tree and an array of element ids (e.g. More...
 

Static Public Member Functions

static format_number ($number)
 
static get_weight_input ($item)
 Given a grade_item object, returns a labelled input if an aggregation coefficient (weight or extra credit) applies to it. More...
 

Public Attributes

 $categories = array()
 
 $columns = array()
 
 $deepest_level
 
grade_plugin_return $gpr
 
grade_tree $gtree
 $gtree More...
 
string $moving
 $moving The eid of the category or item being moved
 
 $table
 
 $uses_weight = false
 

Member Function Documentation

◆ build_html_tree()

grade_edit_tree::build_html_tree (   $element,
  $totals,
  $parents,
  $level,
$row_count 
)

Recursive function for building the table holding the grade categories and items, with CSS indentation and styles.

Parameters
array$elementThe current tree element being rendered
boolean$totalsWhether or not to print category grade items (category totals)
array$parentsAn array of parent categories for the current element (used for indentation and row classes)
Return values
stringHTML

◆ element_deletable()

grade_edit_tree::element_deletable (   $element)

Given an element of the grade tree, returns whether it is deletable or not (only manual grade items are deletable)

Parameters
array$element
Return values
bool

◆ element_duplicatable()

grade_edit_tree::element_duplicatable (   $element)

Given an element of the grade tree, returns whether it is duplicatable or not (only manual grade items are duplicatable)

Parameters
array$element
Return values
bool

◆ get_deepest_level()

grade_edit_tree::get_deepest_level (   $element,
  $level = 0,
  $deepest_level = 1 
)

Recurses through the entire grade tree to find and return the maximum depth of the tree.

This should be run only once from the root element (course category), and is used for the indentation of the Name column's cells (colspan)

Parameters
array$elementAn array of values representing a grade tree's element (all grade items in this case)
int$levelThe level of the current recursion
int$deepest_levelA value passed to each subsequent level of recursion and incremented if $level > $deepest_level
Return values
intDeepest level

◆ get_weight_input()

static grade_edit_tree::get_weight_input (   $item)
static

Given a grade_item object, returns a labelled input if an aggregation coefficient (weight or extra credit) applies to it.

Parameters
grade_item$item
Return values
stringHTML

◆ move_elements()

grade_edit_tree::move_elements (   $eids,
  $returnurl 
)

Given the grade tree and an array of element ids (e.g.

c15, i42), and expecting the 'moveafter' URL param, moves the selected items to the requested location. Then redirects the user to the given $returnurl

Parameters
object$gtreeThe grade tree (a recursive representation of the grade categories and grade items)
array$eids
string$returnurl

Member Data Documentation

◆ $gpr

grade_plugin_return grade_edit_tree::$gpr
See also
grade/lib.php

◆ $gtree

grade_tree grade_edit_tree::$gtree

$gtree

See also
grade/lib.php

The documentation for this class was generated from the following file: