Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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

(no description)

File Size: 1092 lines (43 kb)
Included or required:0 times
Referenced: 3 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.

return: string HTML
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)

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.

return: string HTML
param: grade_item $item

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)

return: bool
param: array $element

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)

return: bool
param: array $element

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)

return: int Deepest level
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

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

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

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.

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