Clues to reading this code:
More...
|
| | __construct ($type='ul', $attributes='', $editable=false, $pageurl=null, $page=0, $pageparamname='page', $itemsperpage=20) |
| | Constructor.
|
| |
| | add_item ($item) |
| | Add list item.
|
| |
| | display_page_numbers () |
| | display list of page numbers for navigation
|
| |
| | find_item ($id, $suppresserror=false) |
| | Recurse down the tree and find an item by it's id.
|
| |
| | get_child_ids () |
| | Returns an array of ids of child items.
|
| |
| | get_items_peers ($itemid) |
| | Returns an array of ids of peers of an item.
|
| |
| | get_records () |
| | Should be overriden to return an array of records of list items.
|
| |
| | get_top_level_parent_id ($item) |
| | Returns the value to be used as the parent for the $item when it goes to the top level.
|
| |
| | item_is_first_on_page ($itemid) |
| |
| | item_is_last_on_page ($itemid) |
| |
| | list_from_records ($paged=false, $offset=0) |
| | Produces a hierarchical tree of list items from a flat array of records.
|
| |
| | move_item_left ($id) |
| | Moves the item one step up in the tree.
|
| |
| | move_item_right ($id) |
| | Make item with id $id the child of the peer that is just above it in the sort order.
|
| |
| | move_item_up_down ($direction, $id) |
| | Move a record up or down.
|
| |
| | process_actions ($left, $right, $moveup, $movedown) |
| | process any actions.
|
| |
| | reorder_peers ($peers) |
| | Reorder peers.
|
| |
| | set_parent ($parent) |
| | Set parent item.
|
| |
| | to_html ($indent=0, $extraargs=array()) |
| | Returns html string.
|
| |
|
|
| $attributes |
| |
|
array | $childparent |
| | keys are child ids, values are parents.
|
| |
|
| $editable |
| |
|
| $fieldnamesparent = 'parent' |
| |
|
| $firstitem = 1 |
| |
|
array | $items = array() |
| | of $listitemclassname objects.
|
| |
|
| $lastitem = 999999 |
| |
|
| $listitemclassname = 'list_item' |
| |
|
| $offset = 0 |
| |
|
| $page = 0 |
| |
|
| $pagecount |
| |
|
| $paged = false |
| |
|
| $pageparamname |
| |
|
| $pageurl |
| |
|
list_item | $parentitem = null |
| | or derived class.
|
| |
|
array | $records = array() |
| | Records from db, only used in top level list.
|
| |
|
| $table |
| |
|
string | $type |
| | 'ol' or 'ul'.
|
| |
Clues to reading this code:
The functions that move things around the tree structure just update the database - they don't update the in-memory structure, instead they trigger a page reload so everything is rebuilt from scratch.
- Copyright
- Jamie Pratt
- License
- http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- Deprecated
- Since Moodle 4.5 MDL-72397. This is no longer used in core code.
- Todo
- Final removal in Moodle 6.0 MDL-80804.
◆ __construct()
| moodle_list::__construct |
( |
| $type = 'ul', |
|
|
| $attributes = '', |
|
|
| $editable = false, |
|
|
| $pageurl = null, |
|
|
| $page = 0, |
|
|
| $pageparamname = 'page', |
|
|
| $itemsperpage = 20 ) |
Constructor.
- Parameters
-
| string | $type | |
| string | $attributes | |
| boolean | $editable | |
| moodle_url | $pageurl | url for this page |
| integer | $page | if 0 no pagination. (These three params only used in top level list.) |
| string | $pageparamname | name of url param that is used for passing page no |
| integer | $itemsperpage | no of top level items. |
- Deprecated
- Since Moodle 4.5 MDL-72397. This is no longer used in core code.
- Todo
- Final removal in Moodle 6.0 MDL-80804.
◆ add_item()
| moodle_list::add_item |
( |
| $item | ) |
|
◆ display_page_numbers()
| moodle_list::display_page_numbers |
( |
| ) |
|
◆ find_item()
| moodle_list::find_item |
( |
| $id, |
|
|
| $suppresserror = false ) |
Recurse down the tree and find an item by it's id.
- Parameters
-
| integer | $id | |
| boolean | $suppresserror | error if not item found? |
- Return values
-
- Deprecated
- Since Moodle 4.5 MDL-72397. This is no longer used in core code.
- Todo
- Final removal in Moodle 6.0 MDL-80804.
◆ get_child_ids()
| moodle_list::get_child_ids |
( |
| ) |
|
◆ get_items_peers()
| moodle_list::get_items_peers |
( |
| $itemid | ) |
|
Returns an array of ids of peers of an item.
- Parameters
-
| int | itemid - if given, restrict records to those with this parent id. |
- Return values
-
- Deprecated
- Since Moodle 4.5 MDL-72397. This is no longer used in core code.
- Todo
- Final removal in Moodle 6.0 MDL-80804.
◆ get_records()
| moodle_list::get_records |
( |
| ) |
|
|
abstract |
◆ get_top_level_parent_id()
| moodle_list::get_top_level_parent_id |
( |
| $item | ) |
|
◆ item_is_first_on_page()
| moodle_list::item_is_first_on_page |
( |
| $itemid | ) |
|
- Parameters
-
| integer | $itemid | an item id. |
- Return values
-
| boolean | Is the item with the given id the first top-level item on the current page? |
- Deprecated
- Since Moodle 4.5 MDL-72397. This is no longer used in core code.
- Todo
- Final removal in Moodle 6.0 MDL-80804.
◆ item_is_last_on_page()
| moodle_list::item_is_last_on_page |
( |
| $itemid | ) |
|
- Parameters
-
| integer | $itemid | an item id. |
- Return values
-
| boolean | Is the item with the given id the last top-level item on the current page? |
- Deprecated
- Since Moodle 4.5 MDL-72397. This is no longer used in core code.
- Todo
- Final removal in Moodle 6.0 MDL-80804.
◆ list_from_records()
| moodle_list::list_from_records |
( |
| $paged = false, |
|
|
| $offset = 0 ) |
Produces a hierarchical tree of list items from a flat array of records.
'parent' field is expected to point to a parent record. records are already sorted. If the parent field doesn't point to another record in the array then this is a top level list
- Parameters
-
| integer | $offset | how many list toplevel items are there in lists before this one |
- Return values
-
| array(boolean,integer) | whether there is more than one page, $offset + how many toplevel items where there in this list. |
- Deprecated
- Since Moodle 4.5 MDL-72397. This is no longer used in core code.
- Todo
- Final removal in Moodle 6.0 MDL-80804.
◆ move_item_left()
| moodle_list::move_item_left |
( |
| $id | ) |
|
◆ move_item_right()
| moodle_list::move_item_right |
( |
| $id | ) |
|
◆ move_item_up_down()
| moodle_list::move_item_up_down |
( |
| $direction, |
|
|
| $id ) |
◆ process_actions()
| moodle_list::process_actions |
( |
| $left, |
|
|
| $right, |
|
|
| $moveup, |
|
|
| $movedown ) |
◆ reorder_peers()
| moodle_list::reorder_peers |
( |
| $peers | ) |
|
◆ set_parent()
| moodle_list::set_parent |
( |
| $parent | ) |
|
◆ to_html()
| moodle_list::to_html |
( |
| $indent = 0, |
|
|
| $extraargs = array() ) |
The documentation for this class was generated from the following file: