Moodle APIs  3.8
Moodle 3.8.6 (Build: 20201109)
Public Member Functions | Public Attributes | List of all members
html_table Class Reference
Inheritance diagram for html_table:
core_tag_areas_table core_tag_collections_table course_enrolment_table course_enrolment_other_users_table course_enrolment_users_table

Public Member Functions

 __construct ()
 Constructor.
 

Public Attributes

array $align
 An array of column alignments. More...
 
array $attributes = array()
 Attributes of HTML attributes for the. More...
 
string $caption
 Caption for the table, typically a title. More...
 
bool $captionhide = false
 Whether to hide the table's caption from sighted users. More...
 
int $cellpadding = null
 
int $cellspacing = null
 Spacing between cells, in pixels. More...
 
array $colclasses
 An array of classes to add to every cell in a particular column, space-separated string. More...
 
array $data = []
 Array of arrays or html_table_row objects containing the data. More...
 
array $head
 An array of headings. More...
 
array $headspan
 An array that can be used to make a heading span multiple columns. More...
 
string $id = null
 Value to use for the id attribute of the table.
 
array $rowclasses
 Array of classes to add to particular rows, space-separated string. More...
 
array $size
 The value is used as CSS 'size' property. More...
 
string $summary
 Description of the contents for screen readers. More...
 
string $tablealign = null
 
string $width = null
 
array $wrap
 An array of wrapping information. More...
 

Member Data Documentation

◆ $align

array html_table::$align

An array of column alignments.

The value is used as CSS 'text-align' property. Therefore, possible values are 'left', 'right', 'center' and 'justify'. Specify 'right' or 'left' from the perspective of a left-to-right (LTR) language. For RTL, the values are flipped automatically.

Examples of usage: $t->align = array(null, 'right'); or $t->align[1] = 'right';

◆ $attributes

array html_table::$attributes = array()

Attributes of HTML attributes for the.

◆ $caption

string html_table::$caption

Caption for the table, typically a title.

Example of usage: $t->caption = "TV Guide";

◆ $captionhide

bool html_table::$captionhide = false

Whether to hide the table's caption from sighted users.

Example of usage: $t->caption = "TV Guide"; $t->captionhide = true;

◆ $cellpadding

int html_table::$cellpadding = null
Deprecated:
since Moodle 2.0. Styling should be in the CSS. Padding on each cell, in pixels

◆ $cellspacing

int html_table::$cellspacing = null

Spacing between cells, in pixels.

Deprecated:
since Moodle 2.0. Styling should be in the CSS.

◆ $colclasses

array html_table::$colclasses

An array of classes to add to every cell in a particular column, space-separated string.

Class 'cell' is added automatically by the renderer. Classes 'c0' or 'c1' are added automatically for every odd or even column, respectively. Class 'lastcol' is added automatically for all last cells in a row.

Example of usage: $t->colclasses = array(null, 'grade');

◆ $data

array html_table::$data = []

Array of arrays or html_table_row objects containing the data.

Alternatively, if you have $head specified, the string 'hr' (for horizontal ruler) can be used instead of an array of cells data resulting in a divider rendered.

Example of usage with array of arrays: $row1 = array('Harry Potter', '76 '); $row2 = array('Hermione Granger', '100 '); $t->data = array($row1, $row2);

Example with array of html_table_row objects: (used for more fine-grained control) $cell1 = new html_table_cell(); $cell1->text = 'Harry Potter'; $cell1->colspan = 2; $row1 = new html_table_row(); $row1->cells[] = $cell1; $cell2 = new html_table_cell(); $cell2->text = 'Hermione Granger'; $cell3 = new html_table_cell(); $cell3->text = '100 '; $row2 = new html_table_row(); $row2->cells = array($cell2, $cell3); $t->data = array($row1, $row2);

◆ $head

array html_table::$head

An array of headings.

The n-th array item is used as a heading of the n-th column. For more control over the rendering of the headers, an array of html_table_cell objects can be passed instead of an array of strings.

Example of usage: $t->head = array('Student', 'Grade');

◆ $headspan

array html_table::$headspan

An array that can be used to make a heading span multiple columns.

In this example, } is supposed to have three columns. For the first two columns, * the same heading is used. Therefore, html_table::$head should consist of two items.

Example of usage: $t->headspan = array(2,1);

◆ $rowclasses

array html_table::$rowclasses

Array of classes to add to particular rows, space-separated string.

Class 'lastrow' is added automatically for the last row in the table.

Example of usage: $t->rowclasses[9] = 'tenth'

◆ $size

array html_table::$size

The value is used as CSS 'size' property.

Examples of usage: $t->size = array('50', '50'); or $t->size[1] = '120px';

◆ $summary

string html_table::$summary

Description of the contents for screen readers.

The "summary" attribute on the "table" element is not supported in HTML5. Consider describing the structure of the table in a "caption" element or in a "figure" element containing the table; or, simplify the structure of the table so that no description is needed.

◆ $tablealign

string html_table::$tablealign = null
Deprecated:
since Moodle 2.0. Styling should be in the CSS. Alignment for the whole table. Can be 'right', 'left' or 'center' (default).

◆ $width

string html_table::$width = null
Deprecated:
since Moodle 2.0. Styling should be in the CSS. Width of the table, percentage of the page preferred.

◆ $wrap

array html_table::$wrap

An array of wrapping information.

The only possible value is 'nowrap' that sets the CSS property 'white-space' to the value 'nowrap' in the given column.

Example of usage: $t->wrap = array(null, 'nowrap');


The documentation for this class was generated from the following file: