Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
grade_edit_tree Class Reference

Public Member Functions

 __construct ($gtree, $moving, $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.
 
 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.
 
 move_elements ($eids, $returnurl)
 Given the grade tree and an array of element ids (e.g.
 

Static Public Member Functions

static element_deletable ($element)
 Given an element of the grade tree, returns whether it is deletable or not (only manual grade items are deletable)
 
static element_duplicatable ($element)
 Given an element of the grade tree, returns whether it is duplicatable or not (only manual grade items are duplicatable)
 
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.
 
static update_gradecategory (grade_category $gradecategory, stdClass $data)
 Updates the provided gradecategory item with the provided data.
 

Public Attributes

 $categories = array()
 
 $columns = array()
 
 $deepest_level
 
grade_plugin_return $gpr
 
grade_tree $gtree
 $gtree
 
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()

static grade_edit_tree::element_deletable ( $element)
static

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()

static grade_edit_tree::element_duplicatable ( $element)
static

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

◆ update_gradecategory()

static grade_edit_tree::update_gradecategory ( grade_category $gradecategory,
stdClass $data )
static

Updates the provided gradecategory item with the provided data.

Parameters
grade_category$gradecategoryThe category to update.
stdClass$datathe data to update the category with.
Return values
void

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: