Moodle  2.2.1
http://www.collinsharper.com
moodle_list Class Reference
Inheritance diagram for moodle_list:

Public Member Functions

 __construct ($type='ul', $attributes='', $editable=false, $pageurl=null, $page=0, $pageparamname= 'page', $itemsperpage=20)
 to_html ($indent=0, $extraargs=array())
 find_item ($id, $suppresserror=false)
 add_item ($item)
 set_parent ($parent)
 list_from_records ($paged=false, $offset=0)
 get_records ()
 display_page_numbers ()
 get_items_peers ($itemid)
 get_child_ids ()
 move_item_up_down ($direction, $id)
 reorder_peers ($peers)
 move_item_left ($id)
 move_item_right ($id)
 process_actions ($left, $right, $moveup, $movedown)
 item_is_first_on_page ($itemid)
 item_is_last_on_page ($itemid)

Data Fields

 $attributes
 $listitemclassname = 'list_item'
 $items = array()
 $type
 $parentitem = null
 $table
 $fieldnamesparent = 'parent'
 $records = array()
 $editable
 $childparent
 $page = 0
 $firstitem = 1
 $lastitem = 999999
 $pagecount
 $paged = false
 $offset = 0
 $pageurl
 $pageparamname

Detailed Description

Definition at line 47 of file listlib.php.


Constructor & Destructor Documentation

__construct ( type = 'ul',
attributes = '',
editable = false,
pageurl = null,
page = 0,
pageparamname = 'page',
itemsperpage = 20 
)

Constructor.

Parameters:
string$type
string$attributes
boolean$editable
moodle_url$pageurlurl for this page
integer$pageif 0 no pagination. (These three params only used in top level list.)
string$pageparamnamename of url param that is used for passing page no
integer$itemsperpageno of top level items.

Definition at line 93 of file listlib.php.


Member Function Documentation

add_item ( item)

Definition at line 179 of file listlib.php.

display list of page numbers for navigation

Definition at line 255 of file listlib.php.

find_item ( id,
suppresserror = false 
)

Recurse down the tree and find an item by it's id.

Parameters:
integer$id
boolean$suppresserrorerror if not item found?
Returns:
list_item *copy* or null if item is not found

Definition at line 157 of file listlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

Returns an array of ids of child items.

Returns:
array peer ids

Definition at line 292 of file listlib.php.

get_items_peers ( itemid)

Returns an array of ids of peers of an item.

Parameters:
intitemid - if given, restrict records to those with this parent id.
Returns:
array peer ids

Definition at line 281 of file listlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

get_records ( ) [abstract]

Should be overriden to return an array of records of list items.

Reimplemented in question_category_list.

Here is the caller graph for this function:

item_is_first_on_page ( itemid)
Parameters:
integer$itemidan item id.
Returns:
boolean Is the item with the given id the first top-level item on the current page?

Definition at line 444 of file listlib.php.

Here is the caller graph for this function:

item_is_last_on_page ( itemid)
Parameters:
integer$itemidan item id.
Returns:
boolean Is the item with the given id the last top-level item on the current page?

Definition at line 454 of file listlib.php.

Here is the caller graph for this function:

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$offsethow many list toplevel items are there in lists before this one
Returns:
array(boolean, integer) whether there is more than one page, $offset + how many toplevel items where there in this list.

Definition at line 198 of file listlib.php.

Here is the call graph for this function:

move_item_left ( id)
Parameters:
integer$idan item index.
Returns:
object the item that used to be the parent of the item moved.

Definition at line 344 of file listlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

move_item_right ( id)

Make item with id $id the child of the peer that is just above it in the sort order.

Parameters:
integer$id

Definition at line 370 of file listlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

move_item_up_down ( direction,
id 
)

Move a record up or down

Parameters:
string$directionup / down
integer$id

Definition at line 306 of file listlib.php.

Here is the call graph for this function:

Here is the caller graph for this function:

process_actions ( left,
right,
moveup,
movedown 
)

process any actions.

Parameters:
integer$leftid of item to move left
integer$rightid of item to move right
integer$moveupid of item to move up
integer$movedownid of item to move down
Returns:
unknown

Definition at line 399 of file listlib.php.

Here is the call graph for this function:

reorder_peers ( peers)

Definition at line 333 of file listlib.php.

Here is the caller graph for this function:

set_parent ( parent)

Definition at line 183 of file listlib.php.

to_html ( indent = 0,
extraargs = array() 
)

Returns html string.

Parameters:
integer$indentdepth of indentation.

Definition at line 115 of file listlib.php.


Field Documentation

Definition at line 48 of file listlib.php.

$childparent

Definition at line 68 of file listlib.php.

$editable

Definition at line 65 of file listlib.php.

$fieldnamesparent = 'parent'

Definition at line 60 of file listlib.php.

$firstitem = 1

Definition at line 73 of file listlib.php.

$items = array()

Definition at line 52 of file listlib.php.

$lastitem = 999999

Definition at line 74 of file listlib.php.

$listitemclassname = 'list_item'

Reimplemented in question_category_list.

Definition at line 49 of file listlib.php.

$offset = 0

Definition at line 77 of file listlib.php.

$page = 0

Definition at line 72 of file listlib.php.

$pagecount

Definition at line 75 of file listlib.php.

$paged = false

Definition at line 76 of file listlib.php.

$pageparamname

Definition at line 80 of file listlib.php.

$pageurl

Definition at line 79 of file listlib.php.

$parentitem = null

Definition at line 58 of file listlib.php.

$records = array()

Definition at line 63 of file listlib.php.

Reimplemented in question_category_list.

Definition at line 59 of file listlib.php.

$type

Definition at line 55 of file listlib.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations