Copied!

Create a table that is sortedable

CloneableInstantiable
Constants
public PHPFUI\Base::DEBUG_SOURCE = 1
Methods
public PHPFUI\HTML5Element::__clone()
public __construct()
public PHPFUI\Base::__toString() : string
public PHPFUI\Base::add(?mixed $item) : static
 

Base add function. Adds to the end of the current objects

  • param mixed $item should be convertable to string
public PHPFUI\Table::addArrowNavigation(PHPFUI\Interfaces\Page $page) : static
 

Allow arrow keys to move up and down rows with edit controls in them.

public PHPFUI\Base::addAsFirst(?mixed $item) : static
 

Base addAsFirst function. Adds to the front of the current object

  • param mixed $item should be convertable to string
public PHPFUI\HTML5Element::addAttribute(string $attribute, string $value = '') : static
 

Add an attribute the the object

  • param string $value of the attribute, blank for just a plain attribute
public PHPFUI\HTML5Element::addClass(string $class) : static
 

Add a class to an object

  • param string $class name(s) to add
public PHPFUI\Table::addColumnAttribute(string $column, array $attributePairs) : static
 

Add an attribute to a column

  • param string $column name to add
  • param array<string,string> $attributePairs to add. Example: ['style' => 'text-align:center;']
public PHPFUI\Table::addFooter(string $field, string $footer) : static
 

Add one footer field

  • param string $field column name
  • param string $footer name displayed to user
public PHPFUI\Table::addFooterAttribute(string $key, array $values) : static
 

Add a footer row attribute

  • param string[] $values
public PHPFUI\Table::addHeader(string $field, string $header) : static
 

Add one header field

  • param string $field column name
  • param string $header name displayed to user
public PHPFUI\Table::addNextRowAttribute(string $attribute, string $value) : static
 

You can add any attribute to the next row (tr) that you want. This only applies to the next row to be output and is reset for the next row.

public PHPFUI\HTML5Element::addPHPClassName() : static
 

Adds the base PHP class name as a class to this object

public PHPFUI\Table::addRow(array $row, array $colspans = []) : static
 

Add a row. You can also pass column spans which are possitional and do not need keys corresponding index to the row.

  • param array<string|int,mixed> $row array indexes must correspond to headers if used.
  • param array<int,string|int> $colspans are optional, but positional and need not correspond to the $row indexes
public PHPFUI\Table::count() : int
 

Number of rows in the table.

public PHPFUI\HTML5Element::deleteAttribute(string $attribute) : static
 

Deletes the passed attribute

public PHPFUI\HTML5Element::deleteAttributes() : static
 

Deletes all attributes

public PHPFUI\HTML5Element::deleteClass(string $classToDelete) : static
 

Delete a class from the object

public PHPFUI\Table::deleteHeader(string $field) : static
 

Delete header field. Deletes the column. Can be called at anytime after a header is set but before output.

  • param string $field column name
public PHPFUI\HTML5Element::disabled() : static
 

Disabled the element

public PHPFUI\Table::displayHeaders(bool $display = true) : static
 

Turn off headers by passing false

public PHPFUI\Base::done(bool $done = true) : static
 

Form is done rendering

public PHPFUI\HTML5Element::getAttribute(string $attribute) : ?string
 

Get an attribute

  • return ?string does not exist if null
public PHPFUI\HTML5Element::getAttributes() : string
 

Returns the attribute strings. Attributes with values are returned as name/value pairs, attributes without values are returned as just the attribute name.

public getBaseUrl() : string
 

Returns the base url of the current page, with no query parameters

public PHPFUI\HTML5Element::getClass() : string
 

Returns the class attribute ready for insertion into an element.

public PHPFUI\HTML5Element::getClasses() : array
 

Returns all classes for the object

  • return string[]
public static PHPFUI\Base::getDebug(int $flags = 0) : int
 

Gets the current debug setting

public getDownUrl(string $column) : string
 
  • return string a link that will sort the column in descending order
public PHPFUI\HTML5Element::getElement() : string
 

Return the type of the element

public PHPFUI\HTML5Element::getId() : string
 

Return the id of the object. Elements will not have an id unless this method is called. The id is returned as a string starting with id followed by a unique number to the page. Id numbers are deterministic and start start with 1. Once assigned an id, an element will always have the same id. It will get a new id if cloned.

public PHPFUI\HTML5Element::getIdAttribute() : string
 

Return the id attribute of the object as a name/value pair. If no id has been requested, and empty string is returned.

public getParsedParameters() : array
 

Get parameters parsed off the url

  • return array<string,string>
public PHPFUI\Table::getRecordId() : string
 

Return the index key used to give each row a unique id.

public PHPFUI\Base::getResponse() : string
 

Get the current response

public PHPFUI\Table::getRows() : array
 

Return the raw rows in the table

  • return array
public getSortedColumn() : string
public getSortedOrder() : string
public PHPFUI\HTML5Element::getToolTip(string $label) : PHPFUI\ToolTip|string
 

Get the tool tip as a string

  • return \ToolTip|string return type depends on if the tip was set as a string or ToolTip object.
public getUpUrl(string $column) : string
 
  • return string a link that will sort the column in ascending order
public PHPFUI\HTML5Element::hasClass(string $class) : bool
 

Return true if the class is present on the object

public PHPFUI\HTML5Element::hasId() : bool
 

Does this object have an id set already?

public PHPFUI\HTML5Element::hasToolTip() : bool
 
  • return bool if there is a tool tip associated with this element
public PHPFUI\Base::isDone() : bool
 

Returns true if the page needs no more processing

public PHPFUI\HTML5Element::newId() : static
 

Assign a new id to this element.

public PHPFUI\Table::outputBodyRows() : string
 

outputBodyRows returns the contents of the table body for partical table output

public PHPFUI\Table::outputFooter() : string
 

outputFooter returns the table footer for partical table output

public PHPFUI\Table::outputHeader() : string
 

outputHeader returns the table header for partical table output

public PHPFUI\Base::prepend(?mixed $item) : static
 

Add an object in front of existing object

public PHPFUI\Table::setAlwaysOutput(bool $alwaysOutput = true) : static
 

By default, tables will not output if they have no rows

public PHPFUI\HTML5Element::setAttribute(string $attribute, string $value = '') : static
 

Set the attribute overwriting the prior value

  • param string $value of the attribute, blank for just a plain attribute
public PHPFUI\Table::setCaption(string $caption) : static
 

Set the table caption

public PHPFUI\HTML5Element::setConfirm( $text) : static
 

A simple way to set a confirm on click

  • param string $text confirm text
public static PHPFUI\Base::setDebug(int $level = 0) : void
 

Set the debug level, 1 or higher is on

public PHPFUI\HTML5Element::setElement( $element) : static
 

You can set the element type if you need to morph it for some reason

  • param string $element
public PHPFUI\Table::setFooters(array $footers) : static
 

Set the footers for the table. Array indexes should correspond to the row indexs.

  • param array<string,string> $footers
public PHPFUI\Table::setHeaders(array $headers) : static
 

Set the headers

  • param string[] $headers where index corresponds to the indexes used for the rows to be added
public PHPFUI\HTML5Element::setId( $id) : static
 

Set the base id of the object

  • param string $id to set. Will be returned as set. It is up to the caller to prevent duplicate ids.
public setParameters(string $column = 'c', string $sort = 's') : static
 

Set the column and sort direction parameter names.

public PHPFUI\Base::setRawResponse(string $response, bool $asJSON = true) : static
 

Sets the page response directly and exits the program

  • return never|static
public PHPFUI\Table::setRecordId(string $key) : static
 

Specify the row index key that will be used to form a unique Id for the row.

$key should be the index into the row array that uniquely identifies the row in the table.

public PHPFUI\Base::setResponse(string $response, string $color = 'lime') : static
 

Set a response in the standard format ('reponse' and 'color' array) exit will be called after returning the encoded response

  • param string $response to return
  • param string $color used for the save button
  • return never|static
public PHPFUI\Table::setRows(array $rows) : static
 

Set all the rows for a table

  • param string[][] $rows
public setSortableColumns(array $columns) : static
 

Set the valid sortable columns

  • param string[] $columns
public setSortedColumnOrder(string $column, string $order) : static
 

Set the current sorted column and sorted order.

public PHPFUI\Table::setStrict(bool $strict = true) : static
 

Display "Missing X" for each field in a row that does not have a index corresponding to a header. Useful for debugging.

public PHPFUI\HTML5Element::setToolTip(PHPFUI\ToolTip|string $tip) : static
 

Set the tool tip. Can either be a ToolTip or a string. If it is a string, it will be converted to a ToolTip

public PHPFUI\Table::setWidths(array $widths) : static
 

Set widths for each column

  • param string[] $widths array containing the column widths. The width should contain % (preferred) or px (discouraged). The array is positional and does not need the keys to correspond to the column names.
public PHPFUI\HTML5Element::toggleAnimate(PHPFUI\HTML5Element $element, string $animation) : static
 

Will toggle the provided element on click with the provided animation.

public PHPFUI\HTML5Element::toggleClass(PHPFUI\HTML5Element $element, string $class) : static
 

Will toggle the class on the provided element on click.

public PHPFUI\HTML5Element::transferAttributes(PHPFUI\HTML5Element $from) : static
 

Moves attributes into this object from the passed object

public PHPFUI\HTML5Element::transferClasses(PHPFUI\HTML5Element $from) : static
 

Moves classes into this object from the passed object

public PHPFUI\Base::walk(string $method, ?mixed $argument = NULL) : static
 

Recursively walks all objects and calls the passed method on each object where it exists

  • param string $method to call on the object in the collection
  • param mixed $argument to pass to the method
Properties
protected bool PHPFUI\Table::$alwaysOutput = false
protected string PHPFUI\Table::$caption = ''
protected array PHPFUI\Table::$colspans = []
 
  • var array<string,string[]>
protected array PHPFUI\Table::$columnAttributes = []
 
  • var array<string,array<string,string>>
protected bool PHPFUI\Table::$displayHeaders = true
protected array PHPFUI\Table::$footerAttributes = []
 
  • var array<string,string[]>
protected array PHPFUI\Table::$footers = []
 
  • var array<string,string>
protected array PHPFUI\Table::$headers = []
 
  • var array<string,string>
protected array PHPFUI\Table::$nextRowAttributes = []
 
  • var array<string,string[]>
protected ?PHPFUI\Interfaces\Page PHPFUI\Table::$page = NULL
protected string PHPFUI\Table::$recordId = ''
protected array PHPFUI\Table::$rowAttributes = []
 
  • var array<string,string[]>[]
protected array PHPFUI\Table::$rows = []
 
  • var string[][]
protected string PHPFUI\Table::$sortableBodyClass = ''
protected string PHPFUI\Table::$sortableTrClass = ''
protected bool PHPFUI\Table::$strict = false
protected array PHPFUI\Table::$widths = []
 
  • var string[]
Methods
protected PHPFUI\Table::getBody() : string
protected PHPFUI\Table::getEnd() : string
protected PHPFUI\Base::getItems() : array
 
  • return array
protected getSortHeader(string $column, string $title) : string
 

Get the correct header with sort indicator based on the column and title passed.

protected PHPFUI\Table::getStart() : string
protected PHPFUI\Table::outputRow(string $td, array $row, string $type = '', array $rowAttributes = [], array $attribute = [], string $attributeName = 'colspan') : string
 
  • param array<string,string|object> $row
  • param array<string,string[]> $rowAttributes
  • param string[] $attribute
protected PHPFUI\HTML5Element::upCastCopy(PHPFUI\HTML5Element $to, PHPFUI\HTML5Element $from) : object
 

Clones the first object and fills it with properties from the second object

Properties
private string $columnParameter = 'c'
private array $parameters = []
 
  • var array<string,string>
private array $sortableColumns = []
 
  • var array<string,int>
private string $sortedColumn = ''
private string $sortedOrder = ''
private string $sortParameter = 's'
private string $url
Methods
public static PHPFUI\Base::getDebug(int $flags = 0) : int
 

Gets the current debug setting

public static PHPFUI\Base::setDebug(int $level = 0) : void
 

Set the debug level, 1 or higher is on

© 2024 Bruce Wells
Search Namespaces \ Classes
Configuration