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 TQuickGrid.php

Documentation is available at TQuickGrid.php

  1. <?php
  2. namespace Adianti\Widget\Wrapper;
  3.  
  4. use Adianti\Control\TAction;
  5. use Adianti\Widget\Datagrid\TDataGrid;
  6. use Adianti\Widget\Datagrid\TDataGridColumn;
  7. use Adianti\Widget\Datagrid\TDataGridAction;
  8.  
  9. /**
  10.  * Create quick datagrids through its simple interface
  11.  *
  12.  * @version    7.4
  13.  * @package    widget
  14.  * @subpackage wrapper
  15.  * @author     Pablo Dall'Oglio
  16.  * @copyright  Copyright (c) 2006 Adianti Solutions Ltd. (http://www.adianti.com.br)
  17.  * @license    http://www.adianti.com.br/framework-license
  18.  */
  19. class TQuickGrid extends TDataGrid
  20. {
  21.     /**
  22.      * Add a column
  23.      * @param $label  Field Label
  24.      * @param $object Field Object
  25.      * @param $size   Field Size
  26.      */
  27.     public function addQuickColumn($label$name$align 'left'$size 200TAction $action NULL$param NULL)
  28.     {
  29.         // creates a new column
  30.         $object new TDataGridColumn($name$label$align$size);
  31.         
  32.         if ($action instanceof TAction)
  33.         {
  34.             // create ordering
  35.             $action->setParameter($param[0]$param[1]);
  36.             $object->setAction($action);
  37.         }
  38.         // add the column to the datagrid
  39.         parent::addColumn($object);
  40.         return $object;
  41.     }
  42.     
  43.     /**
  44.      * Add action to the datagrid
  45.      * @param $label  Action Label
  46.      * @param $action TAction Object
  47.      * @param $icon   Action Icon
  48.      */
  49.     public function addQuickAction($labelTDataGridAction $action$field$icon NULL)
  50.     {
  51.         $action->setLabel($label);
  52.         if ($icon)
  53.         {
  54.             $action->setImage($icon);
  55.         }
  56.         
  57.         if (is_array($field))
  58.         {
  59.             $action->setFields($field);
  60.         }
  61.         else
  62.         {
  63.             $action->setField($field);
  64.         }
  65.         
  66.         // add the datagrid action
  67.         parent::addAction($action);
  68.         
  69.         return $action;
  70.     }
  71. }