classname: htmlobject_tablebuilder


extends: htmlobject_table

 Tablebuilder

@package htmlobjects
@author Alexander Kuballa [akuballa@users.sourceforge.net]
@copyright Copyright (c) 2008 - 2012, Alexander Kuballa
@license BSD License (see LICENSE.TXT)
@version 1.1

filename: htmlobject.tablebuilder.class.php

Attributes

top
attribute: actions
access: public
default:
array()

Actions row of table

@access public
@var array

$actions = array();
$actions[] = 'delete';
$actions[] = 'sort';

$table = new htmlobject_tablebuilder();
$table->actions = $actions;
top
attribute: actions_name
access: public
default:
empty

Name for submit actions

@access public
@var string
top
attribute: autosort
access: public
default:
false

Use array_sort

if true, body will be
sorted by tablebuilder

@access public
@var bol
top
attribute: body
access: public
default:
array()

Table body

@access public
@var array

$body = array();
$body[] = array('id' => 'value1', 'date' => 'value2', ...)
$body[] = array('id' => 'value1', 'date' => 'value2', ...)

$table = new htmlobject_tablebuilder();
$table->body = $body;
top
attribute: css_prefix
access: public
default:
htmlobject_

Global prefix for css classes

@access public
@var string
top
attribute: form_action
access: public
default:
empty

Url to process request
no html form if empty

@access public
@var string
top
attribute: form_method
access: public
default:
POST

Form method

@access public
@var enum [GET|POST]
top
attribute: handler_tr
access: public
default:
array(
	'onclick'     => 'tr_click',
	'onmouseover' => 'tr_hover',
	'onmouseout'  => 'tr_hover'
)

Add handler and callback to trs

element and id of identifier will
be added to event callback function

@access array
@var string

$table->handler_tr = array('onclick' => 'tr_click');

<tr onclick="tr_click(this, 'id')">
top
attribute: head
access: public
default:
array()

Head row of table (th)

@access public
@var array

$head = array();
$head['id']['title']      = 'Id';
$head['date']['sortable'] = false;
$head['date']['hidden']   = true;
$head['date2']['title']   = 'Date';
$head['date2']['map']     = date;

$table = new htmlobject_tablebuilder();
$table->head = $head;
top
attribute: hide_empty
access: public
default:
false

Hide table when body is empty

@access public
@var bool
top
attribute: identifier
access: public
default:
empty

Field to add value to checkbox

@access public
@var string
top
attribute: identifier_checked
access: public
default:
array()

Array of identifiers to be checked

@access public
@var array
top
attribute: identifier_disabled
access: public
default:
array()

Array of identifiers to be disabled

@access public
@var array
top
attribute: identifier_name
access: public
default:
empty

Name of identifier input

@access public
@var string
top
attribute: identifier_type
access: public
default:
checkbox

Type of identifier input

@access public
@var enum [checkbox|radio]
top
attribute: limit
access: public
default:
20

Initial limit

@access private
@var int
top
attribute: limit_select
access: public
default:
array()

Select with limit values
 
@access public
@var array

$limit_select = array(
array("value" => 0,  "text" => 'none'),
array("value" => 10, "text" => 10),
array("value" => 20, "text" => 20),
array("value" => 30, "text" => 30),
);

$table = new htmlobject_tablebuilder();
$table->limit_select = $limit_select;
top
attribute: max
access: public
default:
0

Maximum

@access public
@var int
top
attribute: offset
access: public
default:
0

Offset
 
@access public
@var int
top
attribute: order
access: public
default:
ASC

Sortorder

@access public
@var enum [ASC|DESC]
top
attribute: pageturn_bottom
access: public
default:
9

Pageturn Bottom 

@access public
@var int
top
attribute: sort
access: public
default:
empty

Field to be sorted

@access public
@var string
top
attribute: sort_form
access: public
default:
true

Enable sortform

@access public
@var bool
top
attribute: sort_link
access: public
default:
true

Enable sortlink in headrow

@access public
@var bool


Methods

top
function: __construct
params:
$html
$id
$params = null

Constructor

@access public
@param htmlobject $htmlobject
@param string $id id for posted vars
@param array|htmlobject_response $params array(key => value, ...);
top
function: init

Init basic values __body and __cols

@access public
top
function: get_object

Get table as object

@access public
@return object
top
function: get_string

Get table as string

@access public
@return string
top
function: add_headrow
params:
$str = ''

Adds a row to top of table

@access public
@param string $str
top
function: add_bottomrow
params:
$str = ''

Adds a row to bottom of table

@access public
@param string $str
top
function: get_js

Get JS for tr hover and click function

@access public
@return string
top
function: get_params

Get tablebuilder params

@access public
@return array
top
function: __get_head

Get table head

@access protected
@return object|string htmlobject_tr or empty string
top
function: __get_body

Get a row of table body

@access protected
@return object|array htmlobject_tr or empty array
top
function: __get_actions

Get table actions row

@access protected
@return object|string htmlobject_tr or empty string
top
function: __get_sort

Get sort functions form

@access protected
@return object|string
top
function: __get_params

Get params inputs

@access protected
@return htmlobject_div
top
function: __get_lang
params:
$param

Get single value from $this->html->lang['table']

@access protected
@param string $param
@return string
top
function: __get_pageturn

Get page turn functions

@access protected
@return object
top
function: __get_select

Get identifier multi select function

@access protected
@return string
top
function: __get_indentifier
params:
$key
$ident

Add identifier td to body row

@access public
@param int $key
@param string $ident
@return object|string
top
function: __get_js_tr
params:
$ident

Get JS for tr

@access public
@param string $ident
@return string
top
function: __sort

Sort array [body] by key [sort]

@access protected
top
function: __request
params:
$sort = ''
$order = ''
$limit = ''
$offset = ''

Build params from request

@access protected
@param string $sort
@param enum $order [ASC|DESC]
@param string $limit
@param string $offset