Lançado Adianti Framework 7.6!
Clique aqui para saber mais
menu

Adianti Solutions

API

Adianti, Framework, PHP, MVC, Active record, Front controller, IDE, RAD, Web, multiplataforma, geração de código, desenvolvimento rápido, relatórios, formulários, listagens, datagrids, gráficos, banco de dados, padrões de projeto, design patterns API do Adianti Framework.
API Docs
code
Selecione a classe

Source for file TTableRow.php

Documentation is available at TTableRow.php

  1. <?php
  2. namespace Adianti\Widget\Container;
  3.  
  4. use Adianti\Core\AdiantiCoreTranslator;
  5. use Adianti\Widget\Base\TElement;
  6. use Adianti\Widget\Container\THBox;
  7. use Adianti\Widget\Container\TTableCell;
  8. use Exception;
  9.  
  10. /**
  11.  * TableRow: Represents a row inside a table
  12.  *
  13.  * @version    7.4
  14.  * @package    widget
  15.  * @subpackage container
  16.  * @author     Pablo Dall'Oglio
  17.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  18.  * @license    http://www.adianti.com.br/framework-license
  19.  */
  20. class TTableRow extends TElement
  21. {
  22.     private $section;
  23.     
  24.     /**
  25.      * Class Constructor
  26.      */
  27.     public function __construct($section 'tbody')
  28.     {
  29.         parent::__construct('tr');
  30.         $this->section $section;
  31.     }
  32.     
  33.     /**
  34.      * Add a new cell (TTableCell) to the Table Row
  35.      * @param  $value Cell Content
  36.      * @return TTableCell 
  37.      */
  38.     public function addCell($value)
  39.     {
  40.         if (is_null($value))
  41.         {
  42.             throw new Exception(AdiantiCoreTranslator::translate('Method ^1 does not accept null values'__METHOD__));
  43.         }
  44.         else
  45.         {
  46.             // creates a new Table Cell
  47.             $cell new TTableCell($value$this->section == 'thead' 'th' 'td');
  48.             
  49.             parent::add($cell);
  50.             // returns the cell object
  51.             return $cell;
  52.         }
  53.     }
  54.     
  55.     /**
  56.      * Add a multi-cell content to a table cell
  57.      * @param $cells Each argument is a row cell
  58.      */
  59.     public function addMultiCell()
  60.     {
  61.         $wrapper new THBox;
  62.         
  63.         $args func_get_args();
  64.         if ($args)
  65.         {
  66.             foreach ($args as $arg)
  67.             {
  68.                 $wrapper->add($arg);
  69.             }
  70.         }
  71.         
  72.         return $this->addCell($wrapper);
  73.     }
  74.     
  75.     /**
  76.      * Clear any child elements
  77.      */
  78.     public function clearChildren()
  79.     {
  80.         $this->children = array();
  81.     }
  82. }