Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 310 and 401] [Versions 311 and 401] [Versions 39 and 401] [Versions 400 and 401] [Versions 401 and 402] [Versions 401 and 403]

(no description)

File Size: 1092 lines (43 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 7 classes

grade_edit_tree:: (9 methods):
  __construct()
  build_html_tree()
  get_weight_input()
  format_number()
  element_deletable()
  element_duplicatable()
  move_elements()
  get_deepest_level()
  update_gradecategory()

grade_edit_tree_column:: (4 methods):
  factory()
  get_category_cell()
  get_item_cell()
  __construct()

grade_edit_tree_column_name:: (4 methods):
  __construct()
  get_header_cell()
  get_category_cell()
  get_item_cell()

grade_edit_tree_column_weight:: (3 methods):
  get_header_cell()
  get_category_cell()
  get_item_cell()

grade_edit_tree_column_range:: (3 methods):
  get_header_cell()
  get_category_cell()
  get_item_cell()

grade_edit_tree_column_actions:: (4 methods):
  __construct()
  get_header_cell()
  get_category_cell()
  get_item_cell()

grade_edit_tree_column_select:: (4 methods):
  get_header_cell()
  get_category_cell()
  get_item_cell()
  get_checkbox_togglegroup()


Class: grade_edit_tree  - X-Ref

A library of classes used by the grade edit pages

__construct($gtree, $moving, $gpr)   X-Ref
Constructor


build_html_tree($element, $totals, $parents, $level, &$row_count)   X-Ref
Recursive function for building the table holding the grade categories and items,
with CSS indentation and styles.

param: array   $element The current tree element being rendered
param: boolean $totals Whether or not to print category grade items (category totals)
param: array   $parents An array of parent categories for the current element (used for indentation and row classes)
return: string HTML

get_weight_input($item)   X-Ref
Given a grade_item object, returns a labelled input if an aggregation coefficient (weight or extra credit) applies to it.

param: grade_item $item
return: string HTML

format_number($number)   X-Ref
No description

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

param: array $element
return: bool

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

param: array $element
return: bool

move_elements($eids, $returnurl)   X-Ref
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

param: object $gtree The grade tree (a recursive representation of the grade categories and grade items)
param: array $eids
param: string $returnurl

get_deepest_level($element, $level=0, $deepest_level=1)   X-Ref
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)

param: array $element An array of values representing a grade tree's element (all grade items in this case)
param: int $level The level of the current recursion
param: int $deepest_level A value passed to each subsequent level of recursion and incremented if $level > $deepest_level
return: int Deepest level

update_gradecategory(grade_category $gradecategory, stdClass $data)   X-Ref
Updates the provided gradecategory item with the provided data.

param: grade_category $gradecategory The category to update.
param: stdClass $data the data to update the category with.
return: void

Class: grade_edit_tree_column  - X-Ref

Class grade_edit_tree_column

factory($name, $params=array()   X-Ref
html_table_cell object used as a template for item cells in all categories.
It must be cloned before being used.


get_category_cell($category, $levelclass, $params)   X-Ref
No description

get_item_cell($item, $params)   X-Ref
No description

__construct()   X-Ref
No description

Class: grade_edit_tree_column_name  - X-Ref

Class grade_edit_tree_column_name

__construct($params)   X-Ref
No description

get_header_cell()   X-Ref
No description

get_category_cell($category, $levelclass, $params)   X-Ref
No description

get_item_cell($item, $params)   X-Ref
No description

Class: grade_edit_tree_column_weight  - X-Ref

Class grade_edit_tree_column_weight

get_header_cell()   X-Ref
No description

get_category_cell($category, $levelclass, $params)   X-Ref
No description

get_item_cell($item, $params)   X-Ref
No description

Class: grade_edit_tree_column_range  - X-Ref

Class grade_edit_tree_column_range

get_header_cell()   X-Ref
No description

get_category_cell($category, $levelclass, $params)   X-Ref
No description

get_item_cell($item, $params)   X-Ref
No description

Class: grade_edit_tree_column_actions  - X-Ref

Class grade_edit_tree_column_actions

__construct($params)   X-Ref
No description

get_header_cell()   X-Ref
No description

get_category_cell($category, $levelclass, $params)   X-Ref
No description

get_item_cell($item, $params)   X-Ref
No description

Class: grade_edit_tree_column_select  - X-Ref

Class grade_edit_tree_column_select

get_header_cell()   X-Ref
No description

get_category_cell($category, $levelclass, $params)   X-Ref
No description

get_item_cell($item, $params)   X-Ref
No description

get_checkbox_togglegroup(grade_category $category)   X-Ref
Generates a toggle group name for a bulk-action checkbox based on the given grade category.

param: grade_category $category The grade category.
return: string