Structures_DataGrid
[ class tree: Structures_DataGrid ] [ index: Structures_DataGrid ] [ all elements ]

Class: Structures_DataGrid_Column

Source Location: /Structures_DataGrid-0.9.3/Structures/DataGrid/Column.php

Class Overview


Structures_DataGrid_Column Class


Author(s):

Version:

  • $Revision$

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 59]
Structures_DataGrid_Column Class

This class represents a single column for the DataGrid.



[ Top ]


Class Variables

$attribs =

[line 97]

The attributes to use for the cell. Optional

Type:   array


[ Top ]

$autoFillValue =

[line 103]

The value to be used if a cell is empty

Type:   string


[ Top ]

$columnName =

[line 71]

The name (label) of the column

Type:   string


[ Top ]

$fieldName =

[line 77]

The name of the field to map to

Type:   string


[ Top ]

$id =

[line 65]

The unique id of the column

Type:   string


[ Top ]

$orderBy =

[line 83]

The field name to order by. Optional

Type:   string


[ Top ]



Method Detail

Structures_DataGrid_Column (Constructor)   [line 141]

Structures_DataGrid_Column Structures_DataGrid_Column( string $label, [string $field = null], [string $orderBy = null], [array $attributes = array()], [string $autoFillValue = null], [mixed $formatter = null], [array $formatterArgs = array()])

Constructor

Creates default table style settings


Parameters:

string   $label   —  The label of the column to be printed
string   $field   —  The name of the field for the column to be mapped to
string   $orderBy   —  The field or expression to order the data by
array   $attributes   —  The attributes for the XML or HTML TD tag; form: array(name => value, ...)
string   $autoFillValue   —  The value to use for the autoFill
mixed   $formatter   —  Formatter callback. See setFormatter()
array   $formatterArgs   —  Associative array of arguments passed as second argument to the formatter callback

[ Top ]

format   [line 382]

void format( $type, mixed $type,...)

Choose a format preset

EXPERIMENTAL: the behaviour of this method may change in future releases.

This method allows to associate an "automatic" predefined formatter to the column, for common needs as formatting dates, numbers, ...

The currently supported predefined formatters are :

  • dateFromTimestamp: format a UNIX timestamp according to the date()-like format string passed as second argument
  • dateFromMysql : format a MySQL DATE, DATETIME, or TIMESTAMP MySQL according to the date() like format string passed as second argument
  • number: format a number, according to the same optional 2nd, 3rd and 4th arguments that the number_format() PHP function accepts.
  • printf: format using the printf expression passed as 2nd argument.
  • printfURL: url-encode and format using the printf expression passed as 2nd argument

  • Access: public
  • Example: example not found

Parameters:

mixed   $type,...   —  Predefined formatter name, followed by formatter-specific parameters
   $type   — 

[ Top ]

formatter   [line 495]

void formatter( $record, $row, $col)

Formatter

This method is not meant to be called by user-space code.

Calls a predefined function to develop custom output for the column. The defined function can accept parameters so that each cell in the column can be unique based on the record. The function will also automatically receive the record array as a parameter. All parameters passed into the function will be in one array.

  • Access: public

Parameters:

   $record   — 
   $row   — 
   $col   — 

[ Top ]

getAttributes   [line 266]

array getAttributes( )

Get the column XML/HTML attributes

Return the attributes applied to all cells in this column. This only makes sense for HTML or XML rendering

  • Return: Attributes; form: array(name => value, ...)
  • Access: public

[ Top ]

getAutoFillValue   [line 293]

string getAutoFillValue( )

Get auto fill value

Returns the value to be printed if a cell in the column is null.

  • Access: public

[ Top ]

getDefaultDirection   [line 241]

string getDefaultDirection( $str)

Return the default direction to order this column by
  • Return: "ASC" or "DESC"
  • Access: public

Parameters:

   $str   — 

[ Top ]

getField   [line 194]

string getField( )

Get name of the field for the column to be mapped to

Returns the name of the field for the column to be mapped to

  • Access: public

[ Top ]

getLabel   [line 168]

string getLabel( )

Get column label

The label is the text rendered into the column header.

  • Access: public

[ Top ]

getOrderBy   [line 219]

string getOrderBy( )

Get the field name to order the data by
  • Return: field name
  • Access: public

[ Top ]

setAttributes   [line 280]

void setAttributes( array $attributes)

Set the column XML/HTML attributes

Set the attributes to be applied to all cells in this column. This only makes sense for HTML or XML rendering

  • Access: public

Parameters:

array   $attributes   —  form: array(name => value, ...)

[ Top ]

setAutoFillValue   [line 306]

void setAutoFillValue( string $str)

Set auto fill value

Defines a value to be printed if a cell in the column is null.

  • Access: public

Parameters:

string   $str   —  The value to use for the autoFill

[ Top ]

setDefaultDirection   [line 252]

void setDefaultDirection( string $str)

Set the default direction to order this column by
  • Access: public

Parameters:

string   $str   —  "ASC" or "DESC"

[ Top ]

setField   [line 208]

void setField( string $str)

Set name of the field for the column to be mapped to

Defines the name of the field for the column to be mapped to

  • Access: public

Parameters:

string   $str   —  The name of the field for the column to be mapped to

[ Top ]

setFormatter   [line 340]

mixed setFormatter( mixed $formatter, [array $arguments = array()])

Set Formatter Callback

Define a formatting callback function with optional arguments for this column.

The callback function receives the following array as its first argument:

  1.  array(
  2.    'record' => associative array of all fields values for this record,
  3.    'fieldName' => the field name of this column,
  4.    'columnName' => the label (headerof this column,
  5.    'orderBy' => the field name to sort this column by,
  6.    'attribs' => this column's attributes,
  7.    'currRow' => zero-based row index,
  8.    'currCol' => zero-based column index,
  9.  );

If you pass the optional $arguments parameter to setFormatter(), the callback function will receive it as its second argument.


Parameters:

mixed   $formatter   —  Callback PHP pseudo-type (Array or String)
array   $arguments   —  Associative array of parameters passed to as second argument to the callback function

[ Top ]

setLabel   [line 181]

void setLabel( string $str)

Set column label

The label is the text rendered into the column header.

  • Access: public

Parameters:

string   $str   —  Column label

[ Top ]

setOrderBy   [line 230]

void setOrderBy( string $str)

Set the field name to order the data by
  • Access: public

Parameters:

string   $str   —  field name

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:47:20 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.