[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/form/ -> listing.php (summary)

Listing form element. Contains HTML class for a listing form element.

Copyright: 2012 Jerome Mouneyrac
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 159 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

MoodleQuickForm_listing:: (3 methods):
  __construct()
  MoodleQuickForm_listing()
  toHtml()


Class: MoodleQuickForm_listing  - X-Ref

The listing element is a simple customizable "select" without the input type=select.
One main div contains the "large" html of an item.
A show/hide div shows a hidden div containing the list of all items.
This list is composed by the "small" html of each item.

How to use it:
The options parameter is an array containing:
- items => array of object: the key is the value of the form input
$item->rowhtml => small html
$item->mainhtml => large html
- showall/hideall => string for the Show/Hide button

WARNINGS: The form lets you display HTML. So it is subject to CROSS-SCRIPTING if you send it uncleaned HTML.
Don't forget to escape your HTML as soon as one string comes from an input/external source.

How to customize it:
You can change the css in core.css. For example if you remove float:left; from .formlistingrow,
then the item list is not display as tabs but as rows.

__construct($elementName=null, $elementLabel=null, $attributes=null, $options=array()   X-Ref
Constructor.

param: string $elementName (optional) name of the listing.
param: string $elementLabel (optional) listing label.
param: array $attributes (optional) Either a typical HTML attribute string or an associative array.
param: array $options set of options to initalize listing.

MoodleQuickForm_listing($elementName=null, $elementLabel=null, $attributes=null, $options=array()   X-Ref
Old syntax of class constructor. Deprecated in PHP7.


toHtml()   X-Ref
Returns HTML for listing form element.

return: string the HTML.



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1