Axiom (v1.2.0)

A lightweight PHP framework
H:/Workspace/php-axiom/www/php-axiom/libraries/axiom/axTableRowHelper.class.php
Go to the documentation of this file.
00001 <?php
00016 class axTableRowHelper extends axBaseHelper {
00017     
00024     public function __construct ($values = null, $cells_type = "data") {
00025         parent::__construct('tr');
00026         
00027         if (!empty($values))
00028             $this->addCells($values, $cells_type);
00029     }
00030     
00038     public function addCells ($values, $cells_type = "data") {
00039         if (is_scalar($values))
00040             $values = array($values);
00041         elseif (is_object($values) && $values instanceof axModel)
00042             $values = $values->getData();
00043         elseif (!is_array($values) && !$values instanceof Traversable)
00044             throw new InvalidArgumentException("First parameter is expected to be scalar, array or axModel, ".get_class($values)." given", 2049);
00045         
00046         foreach ($values as $value)
00047             $this->addCell($value, $cells_type);
00048             
00049         return $this;
00050     }
00051     
00059     public function addCell ($value, $cells_type = "data") {
00060         $this->appendChild(axTableDataHelper::export($value, $cells_type));
00061         return $this;
00062     }
00063     
00071     public static function export ($values = null, $cells_type = "data") {
00072         return new self ($values, $cells_type);
00073     }
00074 }
 All Data Structures Files Functions Variables