User Tools

Site Tools


Sidebar

vortex:apidoc:table

Table

Table

Filename : /classes/table/table.php
Extends : TableStub

Description

Base class for all Tables

Fields

$initialized

Definition : public static $initialized = false
Description
True if this record has been properly initialized, should only be false during session setup

$newpost

Definition : public $newpost
Description
True if this record is created in this session as opposed to being loaded from the database

$ready

Definition : public $ready = false
Description
True if this record is ready for use

DOM_WITH_FIELDS

Definition : const DOM_WITH_FIELDS = 0x01
Description
TODO: Add description here

DOM_WITH_SUMMARY

Definition : const DOM_WITH_SUMMARY = 0x02
Description
TODO: Add description here

Methods

__construct( $idtable )

Definition : public function __construct( $idtable=0 )

Returns :

Description
Constructor, loads the given idtable from the database or creates a new table if $idtable is 0

Parameters

$idtable

Type : int
Default value : 0

Description
ID of the table to load from database

__destruct()

Definition : public function __destruct()

Returns :

Description
Destructor, stores persistant data for this table in the session

Parameters

_initDB()

Definition : public static function _initDB()

Returns :

Description
Checks whether the database entry for this table needs to be initialized, and does so if needed

Parameters

addField( &$field )

Definition : public function addField( &$field )

Returns :

Description
Adds a Field to this Table

Parameters

$field

Type : Field
Default value :

Description
The field to add to the table

addKey( &$field )

Definition : public function addKey( &$field )

Returns :

Description
Sets the given field as a key or index in the database

Parameters

$field

Type : Field
Default value :

Description
The field to set as a key or index

afterLoad( &$cancel, &$record )

Definition : public function afterLoad( &$cancel, &$record)

Returns :

Description
Method run after the class is loaded as per Vortex standard, currently empty

Parameters

$cancel

Type : boolean
Default value :

Description
If set to true before method returns it will cancel the loading of this instance

$record

Type : Table
Default value :

Description
Instance of the table being loaded

afterSave( &$cancel, &$record )

Definition : public function afterSvae( &$cancel, &$record)

Returns :

Description
Method run after the class is saved to the database as per Vortex standard, currently storing Table changes to database and reloading Vortex table list

Parameters

$cancel

Type : boolean
Default value :

Description
No function in afterSave method

$record

Type : Table
Default value :

Description
Record being saved

allowed( $operation )

Definition : public function allowed( $operation )

Returns : boolean - true on operation permitted, otherwise false

Description
THIS METHOD IS DEPRECATED AND HAS NO FUNCTION

Parameters

beforeLoad( &$cancel, &$record )

Definition : public function beforeLoad( &$cancel, &$record)

Returns :

Description
Method run before the class is loaded from database as per Vortex standar, currently empty

Parameters

$cancel

Type : boolean
Default value :

Description
If set to true before method returns it will cancel the loading of this instance

$record

Type : Table
Default value :

Description
The Table being loaded

beforeSave( &$cancel, &$record )

Definition : public function beforeSave( &$cancel, &$record)

Returns :

Description
Method run before saving this class to the database as per Vortex standard. Currently checks for modify permission and does sanity checks on the modifications.

Parameters

$cancel

Type : boolean
Default value :

Description
If set to true before method returns it will cancel the saving of this instance

$record

Type : Table
Default value :

Description
The record being saved

display( &$display, $searchmode )

Definition : public function display( &$display, $searchmode = false)

Returns :

Description
Display this table in a ShowList

Parameters

$display

Type : Display
Default value :

Description
Display to show this Table on

$searchmode

Type : boolean
Default value : false

Description
Whether this Table is shows as part of a searchlist

generatePermissions()

Definition : public function generatePermissions()

Returns :

Description
Generates the permission strings for this Table from the graphical permission tab in the Table details view

Parameters

getActiveFilter( $filter )

Definition : public function &getActiveFilter( $filter = null )

Returns : Filter

Description
Gets the given filter for this table if found, or the Tables default filter

Parameters

$filter

Type : int
Default value : null

Description
The index of the filter to get, or null to get the default filter

getActiveView( $view )

Definition : public function &getActiveView( $view = null )

Returns : View

Description
Get the given view from this table if found, or the Tables default view

Parameters

$view

Type : int
Default value : null

Description
The index of the view to get, or null to get the default view

getDataDOM( $xmlDocument, $cfg )

Definition : public function getDataDOM( &$xmlDocument, $cfg )

Returns : DOMElement

Description
Returns a DOMElement describing this Table

Parameters

$cfg

Type : String[]
Default value :

Description
A configuration String as described in getDataIdentifier below

&$xmlDocument

Type : DOMDocument
Default value :

Description
The DOMDocument to make the returned DOMElement a child of

getDataIdentifier( $cfg, $count )

Definition : public function getDataIdentifier( &$cfg, &$count )

Returns : RESOURCE IDENTIFIER

Description
Gets a resource identifier for the database query described by the cfg parameter. This method is intended for internal use only.

Parameters

&$cfg

Type : String[]
Default value :

Description
Configuration containing any of the keys (offset, rows, output, searchstring, storesearchstring, orderdirection, orderby, relation_id, relation_uuid, relation_field, relation_name, skipfilter)

&$count

Type : int
Default value :

Description
Will contain the number of returned rows matching the $cfg parameter

getDefaultFilter()

Definition : public function &getDefaultFilter()

Returns : Filter

Description
Returns the default filter of this Table

Parameters

getDefaultView()

Definition : public function &getDefaultView()

Returns : View

Description
Returns the default view of this Table

Parameters

getDOM( $xmlDocument, $flags )

Definition : public function getDOM( &$xmlDocument, $flags = 0)

Returns : DOMElement

Description
Get a DOMElement representing this Table. Should be DEPRECATED and not used, TODO: Confirm DEPRECATION

Parameters

$flags

Type : int
Default value : 0

Description
Not used

&$xmlDocument

Type : DOMDOcument
Default value :

Description
The DOMDocument to make the returned DOMElement a child of

getField($name)

Definition : public function &getField( name )

Returns : Field

Description
Finds the Field in this Table with a matching name to the $name parameter and returns it, or null if not found

Parameters

$name

Type : String
Default value :

Description
Name of the field to return

getFieldNames( $prefix, $skipCategoryFields )

Definition : public function getFieldNames( $prefix = string">"", $skipCategoryFields = true )

Returns : String[]

Description
Returns the names of the Fields in this Table prefixed with the $prefix String

Parameters

$prefix

Type : String
Default value : string">""

Description
The prefix to prepend to the field name

$skipCategoryFields

Type : boolean
Default value : true

Description
If true no CategoryField names will be returned

getFields()

Definition : public function &getFields()

Returns : Field[]

Description
Returns the array of fields in this Table

Parameters

getFilter( $idfilter )

Definition : public function getFilter( $idfilter )

Returns : Filter

Description
Returns the filter matching the $idfilter parameter, or the active Filter for this Table

Parameters

$idfilter

Type : String
Default value :

Description
Id or name of the Filter to return

getFilterArray()

Definition : public function getFilterArray()

Returns : Filter[]

Description
Returns an array representation of all the Filters in this Table

Parameters

getFiltersDOM( $xmlDocument )

Definition : public function getFiltersDOM( &$xmlDocument )

Returns : DOMElement

Description
Returns an XML representation of all the Filters in this Table

Parameters

$xmlDocument

Type : DOMDocument
Default value :

Description
The DOMDocument to make the returned DOMElement part of

getIdFieldName()

Definition : public function getIdFieldName()

Returns : String

Description
Return the name of the id-field for this table

Parameters

getLastChangedRecord()

Definition : public function getLastChangedRecord()

Returns : TableRecord

Description
Returns the record in this Table that was last changed and is readable by the currently logged in user

Parameters

getMax( $fieldname )

Definition : public function getMax( $fieldname )

Returns : String

Description
Returns the maximum value as defined in the max() SQL function stored in this table for the given field

Parameters

$fieldname

Type : String
Default value :

Description
The name of the field for which to get the maximum value

getMin( $fieldname )

Definition : public function getMin( $fieldname )

Returns : String

Description
Returns the mininum value as defined by the min() SQL function stored in this table for the given field

Parameters

$fieldname

Type : String
Default value :

Description
The name of the field for which to get the minimum value

getPermission( $type )

Definition : public function getPermission( $type = null )

Returns : boolean

Description
Return whether the currently logged in user is permitted to do the requested type of operation on this Table. Admin is always permitted.

Parameters

$type

Type : int
Default value : null

Description
One of the constants RuleSet::READ, RuleSet::WRITE, RuleSet::CREATE, RuleSet::DELETE

getRecordsCount( $filterToUse, $searchString )

Definition : public function getRecordsCount( $filterToUse = null, $searchString = string">"" )

Returns : int

Description
Returns the number of records matching the given criteria in this Table

Parameters

$filterToUse

Type : Filter
Default value : null

Description
A filter to apply to the search, or null for no filter

$searchString

Type : String
Default value : string">""

Description
A searchstring to apply to the search

getRecordsIdentifier( ... )

Definition : public function getRecordsIdentifier( $filterToUse = null, $viewToUse = null, $searchString = string">"", $offset = 0, $limit = 999999, &$count, $orderby = null, $orderdirection = null )

Returns : RESOURCE IDENTIFIER

Description
Get a resource for the query defined by the given parameters

Parameters

$filterToUse

Type : Filter or Array
Default value : null

Description
A Filter to apply to the search or an array containing any of the keys (filterToUse, viewToUse, searchString, offset, limit, orderby). If an array is given it will be parsed and the respective elements will be used instead of the parameters for the getRecordsIdentifier method

$limit

Type : int
Default value : 999999

Description
Number of records to fetch

$offset

Type : int
Default value : 0

Description
Offset from the first item returned

$orderby

Type : String
Default value : null

Description
The name of the field to order the result by

$orderdirection

Type : String
Default value : null

Description
ASC or DESC direction to apply to the orderby parameter

$searchString

Type : String
Default value : string">""

Description
A searchstring to apply to the search

$viewToUse

Type : View
Default value : null

Description
A View to apply to the search

&$count

Type : int
Default value :

Description
Will contain the number of fetched rows if supplied

getRecordsNext( $res, $getRecord )

Definition : public function getRescordsNext( &$res, $getRecord = false )

Returns : TableRecord

Description
Get the next tablerecord in the given resource

Parameters

$getRecord

Type : boolean
Default value : false

Description
If set to true will return the raw record array from the database query, if false will return TableRecord for the record

&$res

Type : RESOURCE IDENTIFIER
Default value :

Description
Resource returned from getRecordsIdentifier to use to fetch records

getRecordsNum( $res )

Definition : public function getRecordsNum( &$res )

Returns : int

Description
Get the number of records matched in the search

Parameters

&$res

Type : RESOURCE IDENTIFIER
Default value :

Description
Resource returned from getRecordsIdentifier

getRecordsRelease( $res )

Definition : public function getRecorsRelease( &$res )

Returns :

Description
Release the result identifier for this search. This method is called automatically once the last record is fetched from the getRecordsNext method

Parameters

&$res

Type : RESOURCE IDENTIFIER
Default value :

Description
The resource to release

getStandardScripts()

Definition : public function getStandardScripts()

Returns : String

Description
Gets an XML String representation of the scripts available as standard for Tables inheriting this class

Parameters

getTableRecords( ... )

Definition : public function &getTableRecords( $filterToUse = null, $viewToUse = null, $searchString = string">"", $offset = 0, $limit = 20, &$count, $orderby = null)

Returns : TableRecord[]

Description
Fetch TableRecords matching the given criteria from this Table

Parameters

$filterToUse

Type : Filter or Array
Default value : null

Description
A Filter to apply to the search or an array containing any of the keys (filterToUse, viewToUse, searchString, offset, limit, orderby). If an array is given it will be parsed and the respective elements will be used instead of the parameters for the getTableRecords method

$limit

Type : int
Default value : 20

Description
Number of records to return. Warning, storing an array of TableRecords is pretty memory intense so try to keep the limit low or use the getRecordsIdentifier method instead.

$offset

Type : int
Default value : 0

Description
Offset from the first record in the table to the first record returned

$orderby

Type : String
Default value : null

Description
The name of the field or fields to order the search by

$searchString

Type : String
Default value : string">""

Description
Searchstring to apply to the search

$viewToUse

Type : View
Default value : null

Description
View to use for this search

&$count

Type : int
Default value :

Description
Will contain the number of returned records if supplied

getView( $idview )

Definition : public function getView( $idview )

Returns : View

Description
Return the View mathing the given $idview parameter, or the active View for this table if no View matches

Parameters

$idview

Type : String
Default value :

Description
Id or name of view to fetch

getViewArray()

Definition : public function getViewArray()

Returns : View[]

Description
Return all views for this table as an array

Parameters

getViewsDOM( $xmlDocument )

Definition : public function getViewsDOM( &$xmlDocument )

Returns : Returns a DOMElement representing all views for this Table

Description

Parameters

&$xmlDocument

Type : DOMDocument
Default value :

Description
The document to make the returned DOMElement a child of

getWarning( $level, $type )

Definition : public function getWarning( $level = null, $type = null )

Returns : Warning

Description
Returns the warnings for this Table matching the $level and $type criteria or false if no such warnings exists.

Parameters

$level

Type : int
Default value : null

Description
Level of warning to search for, null = return all levels

$type

Type : int
Default value : null

Description
Type of warning to search for, null = return all types

save( $dosave, $forcenew )

Definition : public function save( $dosave = true, $forcenew = false )

Returns :

Description
Saves ths Table to the database

Parameters

$dosave

Type : boolean
Default value : true

Description
DEPRECATED

$forcenew

Type : boolean
Default value : false

Description
If true will force writing of a new Table to database

setActiveFilter( $idfilter )

Definition : public function setActiveFilter( $idfilter )

Returns :

Description
Set the given filter as the currently active filter for this Table

Parameters

$idfilter

Type : int
Default value :

Description
The id of the filter to set as the active filter

setActiveView( $idview )

Definition : public function setActiveView( $idview )

Returns :

Description
Set the given view as the currently active view for this Table

Parameters

$idview

Type : int
Default value :

Description
The id of the view to set as the active view

setFilter( $filter )

Definition : public function setFilter( $filter )

Returns :

Description
Add the given Filter to the list of filters for this Table

Parameters

$filter

Type : Filter
Default value :

Description
The Filter to add to the Table

vortex/apidoc/table.txt · Last modified: 2019/06/28 07:10 by hubbe