TIP_View

Introduction

View abstraction

Source file
/Type/view.php
Extends
TIP_Type
abstract
yes

The TIP_View is a rows data model.

Properties

data : TIP_Data

A reference to the TIP_Data object the view will apply

access
protected

filter : string

The filter conditions

access
protected

The filter is defined in the TIP_View() constructor. The exact format of this string is data engine dependent: see the documentation of the data engine used by the data object for further informations.

fields : array

The fields to get

access
protected

A subset of fields to get with this view. Leave it undefined to get all the fields.

rows : array|null

The list of rows

access
protected

This list should be filled in the construction process. It is null if not yet filled or false on errors.

The format of the row depends on the type of the view. In TIP_View, the format is the one used also in TIP_Data. Furthermore, some common fields are added to every row (also for the special views):

summary : array

A list of summary values

access
protected

Here must be present the values of summary operations done on the 'rows' property, such as totals and counts.

The following values are always present in 'summary':

on_row : callback

Row callback

access
protected

Called for every row added to the 'rows' property. The only argument passed to the callback is a reference to the added row. Useful to add calculated fields to every row.

The custom callback must return true to include the processed row in the 'rows' property.

on_view : callback

View callback

access
protected

Called at the end of the population of the 'rows' property. A reference to the current view is passed as argument to the callback. Useful to add summary values or perform general operations on the whole data view.

The custom callback must return true to validate the view or false to invalidate it.

Methods

__construct ($options)

Constructor

$options
array
Properties values
lines
128 - 132
access
protected

Initializes a TIP_View instance.

postConstructor ()

lines
134 - 157
access
protected

isValid () : bool

Check for a valid view

lines
170 - 173
access
public

Checks if this view instance contains valid data, that is if the query was performed succesfully.

nRows () : int

The number of rows in this view

lines
179 - 182
access
public

getField ($field) : mixed|null

Get a field value from the current row

$field
mixed
The field id
lines
190 - 194
access
public

getSummary ($field) : mixed|null

Get a summary field value

$field
mixed
The summary field id
lines
202 - 205
access
public

setSummary ($field, $value)

Set a summary field value

$field
mixed
The summary field id
$value
mixed
The new summary field value
lines
213 - 216
access
public

fillRows ()

lines
221 - 221
abstract
yes
access
protected

rewind () : bool

Set the internal cursor to the first row

lines
231 - 234
access
public

current () : array|null

Get the current row

lines
241 - 245
access
public

key () : mixed|null

Get the id of the current row

lines
252 - 255
access
public

next () : bool

Set the cursor to the next row

lines
262 - 265
access
public

valid () : bool

Check if the current row is valid

lines
272 - 275
access
public
TIP_View was last modified by TiP on Mon 25 May 2009 06:22:25 PM CEST
Hosted by BerliOS Developer Logo