Admidio API
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Packages

  • com
    • tecnick
      • tcpdf
  • None
  • PHPMailer
    • easypeasyics
  • PHPWavUtils
  • Securimage
    • classes

Classes

  • AutoLogin
  • Component
  • ComponentUpdate
  • ConditionParser
  • Database
  • DateTimeExtended
  • Email
  • Folder
  • FormValidation
  • FunctionClass
  • Htaccess
  • HtmlDiv
  • HtmlElement
  • HtmlForm
  • HtmlFormBasic
  • HtmlFormInstallation
  • HtmlList
  • HtmlNavbar
  • HtmlPage
  • HtmlTable
  • HtmlTableBasic
  • Image
  • Inventory
  • InventoryFields
  • Language
  • LanguageData
  • ListConfiguration
  • Menu
  • Message
  • ModuleAnnouncements
  • ModuleDates
  • ModuleLists
  • ModuleMenu
  • ModuleMessages
  • Modules
  • ModuleWeblinks
  • MyFiles
  • Navigation
  • ntlm_sasl_client_class
  • Organization
  • Participants
  • PasswordHash
  • PasswordHashing
  • ProfileFields
  • RoleDependency
  • RolesRights
  • RSSfeed
  • Session
  • SystemMail
  • TableAccess
  • TableAnnouncement
  • TableCategory
  • TableDate
  • TableFile
  • TableFolder
  • TableGuestbook
  • TableGuestbookComment
  • TableInventory
  • TableInventoryField
  • TableLists
  • TableMembers
  • TableMessage
  • TablePhotos
  • TableRoles
  • TableRooms
  • TableText
  • TableUserField
  • TableUsers
  • TableWeblink
  • UploadHandlerDownload
  • UploadHandlerPhoto
  • User
  • UserRegistration

Exceptions

  • AdmException
  • WavFileException
  • WavFormatException

Functions

  • admFuncAutoload
  • admFuncGeneratePagination
  • admFuncGetBytesFromSize
  • admFuncGetDirectoryEntries
  • admFuncMaxUploadSize
  • admFuncProcessableImageSize
  • admFuncShowCreateChangeInfoById
  • admFuncShowCreateChangeInfoByName
  • admFuncVariableIsValid
  • admReadTemplateFile
  • admStrIsValidFileName
  • admStrStripTagsSpecial
  • admStrToLower
  • admStrToUpper
  • bzip2Version
  • checkDatabaseVersion
  • checkPhpVersion
  • EmailAttachment
  • FileSizeNiceDisplay
  • FormattedTimeRemaining
  • FunctionIsDisabled
  • getFormerRolesFromDatabase
  • getFutureRolesFromDatabase
  • getmicrotime
  • getRoleMemberships
  • getRolesFromDatabase
  • gzipVersion
  • hasRole
  • hl_attrval
  • hl_bal
  • hl_cmtcd
  • hl_ent
  • hl_prot
  • hl_regex
  • hl_spec
  • hl_tag
  • hl_tag2
  • hl_tidy
  • hl_version
  • htmLawed
  • HTMLFilter
  • isGroupLeader
  • isMember
  • kses
  • kses_hook
  • MySQLdumpVersion
  • OutputInformation
  • SafeExec
  • showNotice
  • strAddSlashesDeep
  • strNextLetter
  • strStripSlashesDeep
  • strStripTags
  • strValidCharacters
  • tln_body2div
  • tln_casenormalize
  • tln_deent
  • tln_defang
  • tln_findnxreg
  • tln_findnxstr
  • tln_fixatts
  • tln_fixstyle
  • tln_fixurl
  • tln_getnxtag
  • tln_sanitize
  • tln_skipspace
  • tln_tagprint
  • tln_unspace
  • version_compare_replacement
  • version_compare_replacement_sub

Class HtmlTable

HtmlElement
Extended by HtmlTableBasic
Extended by HtmlTable
Copyright: 2004-2016 The Admidio Team
License: GNU General Public License v2.0 only **********************************************************************************************
Brief:

Creates an Admidio specific table with special methods

This class inherits the common HtmlTableBasic class and extends their elements with custom Admidio table methods. The class should be used to create the html part of all Admidio tables. It has simple methods to add complete rows with their column values to the table. It's also possible to add the jQuery plugin Datatables to each table. Therefore you only need to set a flag when creating the object.


Class: HtmlTable
Code:

// create a simple table with one input field and a button $table = new HtmlTable('simple-table'); $table->addRowHeadingByArray(array('Firstname', 'Lastname', 'Address', 'Phone', 'E-Mail')); $table->addRowByArray(array('Hans', 'Mustermann', 'Sonnenallee 22', '+49 342 59433', 'h.mustermann@example.org')); $table->addRowByArray(array('Anne', 'Musterfrau', 'Seestraße 6', '+34 7433 7433', 'a.musterfrau@example.org')); $table->show(); @endcode


Code:

// create a table with jQuery datatables and align columns to center or right $table = new HtmlTable('simple-table', null, true, true); $table->setColumnAlignByArray(array('left', 'left', 'center', 'right')); $table->addRowHeadingByArray(array('Firstname', 'Lastname', 'Birthday', 'Membership fee')); $table->addRowByArray(array('Hans', 'Mustermann', 'Sonnenallee 22', '14.07.1995', '38,50')); $table->show(); @endcode


Par: Examples
Located at htmltable.php

Methods summary

public
# __construct( string $id, HtmlPage $htmlPage = null, boolean $hoverRows = true, boolean $datatables = false, string $class = null )

Constructor creates the table element

Constructor creates the table element

Parameters

$id
Id of the table
$htmlPage

(optional) A HtmlPage object that will be used to add javascript code or files to the html output page.

$hoverRows
(optional) If set to @b true then the active selected row will be marked with special css code
$datatables

(optional) If set to @b true then the jQuery plugin Datatables will be used to create the table. Then column sort, search within the table and other features are possible.

$class

(optional) An additional css classname. The class @b table is set as default and need not set with this parameter.

Overrides

HtmlTableBasic::__construct
private
# addRowTypeByArray( string $type, array $arrColumnValues, string $id = null, array $arrAttributes = null, integer $colspan = 1, integer $colspanOffset = 1 )

Adds a complete row with all columns to the table. Each column element will be a value of the array parameter.

Adds a complete row with all columns to the table. Each column element will be a value of the array parameter.

Parameters

$type
'th' for header row or 'td' for body row
$arrColumnValues

Array with the values for each column. If you use datatables than you could set an array for each value with the following entries: array('value' => $yourValue, 'order' => $sortingValue, 'search' => $searchingValue) With this you can specify special values for sorting and searching.

$id
(optional) Set an unique id for the column.
$arrAttributes
(optional) Further attributes as array with key/value pairs
$colspan
(optional) Number of columns that should be join together.
$colspanOffset

(optional) Number of column where the colspan should start. The first column of a table will be 1.

public
# addRowHeadingByArray( array $arrColumnValues, string $id = null, array $arrAttributes = null, integer $colspan = 1, integer $colspanOffset = 1 )

Adds a complete row with all columns to the table. This will be the column heading row. Each value of the array represents the heading text for each column.

Adds a complete row with all columns to the table. This will be the column heading row. Each value of the array represents the heading text for each column.

Parameters

$arrColumnValues
Array with the values for each column.
$id
(optional) Set an unique id for the column.
$arrAttributes
(optional) Further attributes as array with key/value pairs
$colspan
(optional) Number of columns that should be join together.
$colspanOffset
(optional) Number of the column where the colspan should start. The first column of a table will be 1.
public
# addRowByArray( array $arrColumnValues, string $id = null, array $arrAttributes = null, integer $colspan = 1, integer $colspanOffset = 1 )

Adds a complete row with all columns to the table. Each column element will be a value of the array parameter.

Adds a complete row with all columns to the table. Each column element will be a value of the array parameter.

Parameters

$arrColumnValues

Array with the values for each column. If you use datatables than you could set an array for each value with the following entries: array('value' => $yourValue, 'order' => $sortingValue, 'search' => $searchingValue) With this you can specify special values for sorting and searching.

$id
(optional) Set an unique id for the column.
$arrAttributes
(optional) Further attributes as array with key/value pairs
$colspan
(optional) Number of columns that should be join together.
$colspanOffset

(optional) Number of the column where the colspan should start. The first column of a table will be 1.

public
# disableDatatablesColumnsSort( integer|int[] $columnsSort )

Disable the sort function for some columns. This is useful if a sorting of the column doesn't make sense because it only show function icons or something equal.

Disable the sort function for some columns. This is useful if a sorting of the column doesn't make sense because it only show function icons or something equal.

Parameters

$columnsSort

An array which contain the columns where the sort should be disabled. The columns of the table starts with 1 (not 0).

public integer
# getDatatablesGroupColumn( )

Return the number of the column which should be grouped when using the jQuery plugin DataTables.

Return the number of the column which should be grouped when using the jQuery plugin DataTables.

Returns

integer
Return the number of the column.
private
# prepareAndAddColumn( string $type, integer $key, string|string[] $value, integer $colspan = 1, integer $colspanOffset = 1 )

Adds a column to the table.

Adds a column to the table.

Parameters

$type
'th' for header row or 'td' for body row.
$key
Column number (starts with 0).
$value
Column value or array with column value and attributes.
$colspan
(optional) Number of columns that should be join together.
$colspanOffset

(optional) Number of the column where the colspan should start. The first column of a table will be 1.

public
# setColumnAlignByArray( array $columnsAlign )

Set the align for each column of the current table. This method must be called before a row is added to the table. Each entry of the array represents a column.

Set the align for each column of the current table. This method must be called before a row is added to the table. Each entry of the array represents a column.

Parameters

$columnsAlign

An array which contains the align for each column of the table. E.g. array('center', 'left', 'left', 'right') for a table with 4 columns.

public
# setDatatablesAlternativOrderColumns( integer $selectedColumn, integer|int[] $arrayOrderColumns )

This method will set for a selected column other columns that should be used to order the datatables. For example if you will click the name column than you could set the columns lastname and firstname as alternative order columns and the table will be ordered by lastname and firstname.

This method will set for a selected column other columns that should be used to order the datatables. For example if you will click the name column than you could set the columns lastname and firstname as alternative order columns and the table will be ordered by lastname and firstname.

Parameters

$selectedColumn
This is the column the user clicked to be sorted. (started with 1)
$arrayOrderColumns

This are the columns the table will internal be sorted. If you have more than 1 column this must be an array. The columns of the table starts with 1 (not 0).

public
# setDatatablesColumnsHide( integer|int[] $columnsHide )

Hide some columns for the user. This is useful if you want to use the column for ordering but won't show the content if this column.

Hide some columns for the user. This is useful if you want to use the column for ordering but won't show the content if this column.

Parameters

$columnsHide

An array which contain the columns that should be hidden. The columns of the table starts with 1 (not 0).

public
# setDatatablesGroupColumn( integer $columnNumber )

Specify a column that should be used to group data. Everytime the value of this column changed then a new subheader row will be created with the name of the new value.

Specify a column that should be used to group data. Everytime the value of this column changed then a new subheader row will be created with the name of the new value.

Parameters

$columnNumber

Number of the column that should be grouped. The first column starts with 1. The columns were set with the method @b addRowByArray.

public
# setDatatablesOrderColumns( array $arrayOrderColumns )

Set the order of the columns which should be used to sort the rows.

Set the order of the columns which should be used to sort the rows.

Parameters

$arrayOrderColumns

An array which could contain the columns that should be ascending ordered or contain arrays where each array contain the column and the sorting 'asc' or 'desc'. The columns of the table starts with 1 (not 0). Optional this could also only be a numeric value than the datatable will be ordered by the number of this column ascending.

Code

$table = new HtmlTable('simple-table');

// sort all rows after first and third column ascending $table->setDatatablesOrderColumns(array(1, 3)); // sort all rows after first column descending and third column ascending $table->setDatatablesOrderColumns(array(array(1, 'desc'), array(3, 'asc'))); @endcode


Par

Examples
public
# setDatatablesRowsPerPage( integer $numberRows )

Set the number of rows that should be displayed on one page if the jQuery plugin DataTables is used.

Set the number of rows that should be displayed on one page if the jQuery plugin DataTables is used.

Parameters

$numberRows
Number of rows that should be displayed on one page.
public
# setMessageIfNoRowsFound( string $messageId, string $messageType = 'default' )

Set a text id of the translation files that should be shown if table has no rows.

Set a text id of the translation files that should be shown if table has no rows.

Parameters

$messageId
Text id of the translation file.
$messageType

(optional) As @b default the text will be shown. If @b warning or @b error is set then a box in yellow or red with the message will be shown.

public
# setServerSideProcessing( string $file )

With server-side processing enabled, all paging, searching, ordering actions that DataTables performs are handed off to a server where an SQL engine (or similar) can perform these actions on the large data set. As such, each draw of the table will result in a new Ajax request being made to get the required data.

With server-side processing enabled, all paging, searching, ordering actions that DataTables performs are handed off to a server where an SQL engine (or similar) can perform these actions on the large data set. As such, each draw of the table will result in a new Ajax request being made to get the required data.

Parameters

$file

The url with the filename that should be called by Datatables to get the data. The called script must return a json string.

public string
# show( )

This method send the whole html code of the table to the browser. If the jQuery plugin DataTables is activated then the javascript for that plugin will be added. Call this method if you have finished your form layout. If table has no rows then a message will be shown.

This method send the whole html code of the table to the browser. If the jQuery plugin DataTables is activated then the javascript for that plugin will be added. Call this method if you have finished your form layout. If table has no rows then a message will be shown.

Returns

string
If $directOutput is set to @b false this method will return the html code of the table.

Methods inherited from HtmlTableBasic

addColumn(), addRow(), addTableBody(), addTableFooter(), addTableHeader(), getHtmlTable(), setColumnWidth(), setColumnsWidth(), setRowClasses()

Methods inherited from HtmlElement

addAttribute(), addData(), addElement(), addHtml(), addParentElement(), closeParentElement(), getHtmlElement(), setAttributesFromArray()

Properties summary

protected $id
#
protected $rowsPerPage
#
protected $columnsAlign
#
protected $columnsOrder
#
protected $groupedColumn
#
protected $datatables
#
protected $datatablesInitParameters
#
protected $datatablesColumnDefs
#
protected $messageNoRowsFound
#
protected $htmlPage
#
protected $serverSideProcessing
#
protected $serverSideFile
#

Properties inherited from HtmlTableBasic

$border, $columnCount, $columnsWidth, $rowClasses, $rowCount, $tbody, $tfoot, $thead

Properties inherited from HtmlElement

$arrParentElements, $currentElement, $currentElementAttributes, $currentElementDataWritten, $htmlString, $mainElement, $mainElementAttributes, $mainElementWritten, $nesting, $parentFlag

Admidio API API documentation generated by ApiGen