Path

ez components / documentation / api reference / 1.0.1 / consoletools


eZ Components 1.0.1

ConsoleTools: ezcConsoleTableRow

[ Tutorial ] [ Class tree ] [ Element index ] [ ChangeLog ] [ Credits ]

Class: ezcConsoleTableRow

Structure representing a table row in ezcConsoleTable. [source]

Implemented Interfaces

  • Countable (internal interface)
  • Iterator (internal interface)
  • ArrayAccess (internal interface)

This class represents a row in a table object. You can access the properties of the row directly, but also access the cells of the row directly, as if the object was an array (index 0..).
 1.  // Create new table row
 2.   $row new ezcConsoleTableRow();
 3.  
 4.  // Set default format of the row's cells
 5.   $row->format 'headline';
 6.  
 7.  // On the fly create the cell no 0
 8.   $row[0]->content 'Name';
 9.  // On the fly create the cell no 1
10.   $row[1]->content 'Cellphone';
11.  
12.  // Change a setting on cell 0
13.   $row[0]->align ezcConsoleTable::ALIGN_CENTER;
14.  
15.  // Iterate through the row's cells.
16.   foreach $row as $cell )
17.  {
18.      var_dump$cell );
19.  }
20.  
21.  // Set the default align property for all cells in the row
22.   $row->align ezcConsoleTable::ALIGN_CENTER;
This class stores the rows for the ezcConsoleTable class.

Member Variables

protected mixed $align = ezcConsoleTable::ALIGN_DEFAULT
Alignment applied to cells marked with ezcConsoleTable::ALIGN_DEFAULT.
protected string $borderFormat = 'default'
Set the format applied to the borders of this row.
protected array(ezcConsoleTableCell) $cells = array()
The cells of the row.
protected string $format = 'default'
Format applied to cell contents of cells marked with format "default" in this row.

Method Summary

public ezcConsoleTableRow __construct( )
Create a new ezcConsoleProgressbarRow.
public int count( )
Returns the number of cells in the row.
public ezcConsoleTableCell current( )
Returns the currently selected cell.
public int key( )
Returns the key of the currently selected cell.
public mixed next( )
Returns the next cell and selects it or false on the last cell.
public bool offsetExists( $offset )
Returns if the given offset exists.
public ezcConsoleTableCell offsetGet( $offset )
Returns the element with the given offset.
public void offsetSet( $offset, $value )
Set the element with the given offset.
public void offsetUnset( $offset )
Unset the element with the given offset.
public ezcConsoleTableCell rewind( )
Selects the very first cell and returns it.
public ezcConsoleTableCell valid( )
Returns if the current cell is valid.
public mixed __get( $key )
Property read access.
public bool __isset( $key )
Property isset access.
public void __set( $key, $val )
Property write access.

Methods

__construct

ezcConsoleTableRow __construct( )
Create a new ezcConsoleProgressbarRow.
Creates a new ezcConsoleProgressbarRow.
This method takes any number of ezcConsoleTableCell objects as parameter, which will be added as table cells to the row in their specified order.

Throws

ClassDescription
ezcBaseValueException If a paremeter is not of type ezcConsoleTableCell.

count

int count( )
Returns the number of cells in the row.
This method is part of the Countable interface to allow the usage of PHP's count() function to check how many cells this row has.

current

ezcConsoleTableCell current( )
Returns the currently selected cell.
This method is part of the Iterator interface to allow acces to the cells of this row by iterating over it like an array (e.g. using foreach).

key

int key( )
Returns the key of the currently selected cell.
This method is part of the Iterator interface to allow acces to the cells of this row by iterating over it like an array (e.g. using foreach).

next

mixed next( )
Returns the next cell and selects it or false on the last cell.
This method is part of the Iterator interface to allow acces to the cells of this row by iterating over it like an array (e.g. using foreach).

offsetExists

bool offsetExists( int $offset )
Returns if the given offset exists.
This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array.

Parameters

Name Type Description
$offset int The offset to check.

Throws

ClassDescription
ezcBaseValueException If a non numeric cell ID is requested.

offsetGet

ezcConsoleTableCell offsetGet( int $offset )
Returns the element with the given offset.
This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array. In case of the ezcConsoleTableRow class this method always returns a valid cell object since it creates them on the fly, if a given item does not exist.

Parameters

Name Type Description
$offset int The offset to check.

Throws

ClassDescription
ezcBaseValueException If a non numeric cell ID is requested.

offsetSet

void offsetSet( int $offset, mixed $value )
Set the element with the given offset.
This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array.

Parameters

Name Type Description
$offset int The offset to assign an item to.

Throws

ClassDescription
ezcBaseValueException If a non numeric cell ID is requested.
ezcBaseValueException If the provided value is not of type {@ling ezcConsoleTableCell}.

offsetUnset

void offsetUnset( int $offset )
Unset the element with the given offset.
This method is part of the ArrayAccess interface to allow access to the data of this object as if it was an array.

Parameters

Name Type Description
$offset int The offset to unset the value for.

Throws

ClassDescription
ezcBaseValueException If a non numeric cell ID is requested.

rewind

Selects the very first cell and returns it.
This method is part of the Iterator interface to allow acces to the cells of this row by iterating over it like an array (e.g. using foreach).

valid

Returns if the current cell is valid.
This method is part of the Iterator interface to allow acces to the cells of this row by iterating over it like an array (e.g. using foreach).

__get

mixed __get( string $key )
Property read access.

Parameters

Name Type Description
$key string Name of the property.

Throws

ClassDescription
ezcBasePropertyNotFoundException If the the desired property is not found.

__isset

bool __isset( string $key )
Property isset access.

Parameters

Name Type Description
$key string Name of the property.

__set

void __set( string $key, mixed $val )
Property write access.

Parameters

Name Type Description
$key string Name of the property.
$val mixed The value for the property.

Throws

ClassDescription
ezcBaseValueException If a the value submitted for the align is not in the range of ezcConsoleTable::ALIGN_LEFT, ezcConsoleTable::ALIGN_CENTER, ezcConsoleTable::ALIGN_RIGHT, ezcConsoleTable::ALIGN_DEFAULT

Last updated: Fri, 02 Nov 2007