CorePlugins

# Class: ColumnAdder Source Location: /coreplugins/tables/common/TableRulesRegistry.php
### Class Overview
    BaseRule
       |
       --GroupRule
          |
          --TableRule
             |
             --TableFilter
                |
                --ColumnAdder
Rule to add one or more columns and compute content of cells one by one #### Author(s): | ### Variables $columnPosition $currentTableId $inputColumnIds $newColumnIds $useAllFields | ### Methods __construct addNewColumns addWeight applyRule
### Child classes: ColumnAdderBatch Rule to add one or more columns and compute content of all cells | ### Inherited Constants #### Class: TableRule TableRule::WEIGHT_TABLE_GLOBAL TableRule::WEIGHT_TABLE_PARTIAL TableRule::WEIGHT_TABLE_SINGLE #### Class: GroupRule GroupRule::WEIGHT_GROUP_GLOBAL GroupRule::WEIGHT_GROUP_PARTIAL GroupRule::WEIGHT_GROUP_SINGLE #### Class: BaseRule BaseRule::WEIGHT_NO_MATCH | ### Inherited Variables #### Class: TableFilter TableFilter::$callback #### Class: TableRule TableRule::$tableId #### Class: GroupRule GroupRule::$groupId #### Class: BaseRule BaseRule::$log | ### Inherited Methods #### Class: TableFilter TableFilter::__construct() Constructor TableFilter::applyRule() Execute a rule on a table #### Class: TableRule TableRule::applyRule() Executes a rule on a table TableRule::applyRules() Applies a set of rules on a table TableRule::checkRule() Checks a rule TableRule::getIndexes() Returns a map of index id's to their offset in the columnIds array. TableRule::getWeight() Computes weight #### Class: GroupRule GroupRule::addWeight() Stores computed weights GroupRule::applyRule() Executes a rule on a group GroupRule::applyRules() Applies a set of rules on a group GroupRule::checkRule() Checks a rule GroupRule::getWeight() Computes weight #### Class: BaseRule BaseRule::__construct() Constructor
### Class Details [line 917] Rule to add one or more columns and compute content of cells one by one Callback method should have the following signature:
     static function myCallbackMethod('table_id',
                                      array ('column_1' => 'value_1',
                                             'column_2' => 'value_2'))
       return array ('new_column_1' => 'cell_value_1',
                     'new_column_2' => 'cell_value_2')
#### Tags:
see: | CellFilter
[ Top ] ### Class Variables #### $columnPosition = [line 922] #### Tags:
access: | public
Type: | ColumnPosition
[ Top ] #### $currentTableId = [line 938] Current processed table Id. #### Tags:
access: | protected
Type: | string
[ Top ] #### $inputColumnIds = [line 932] #### Tags:
access: | public
Type: | array
[ Top ] #### $newColumnIds = [line 927] #### Tags:
access: | public
Type: | array
[ Top ] #### $useAllFields = [line 943] #### Tags:
access: | protected
Type: | bool
[ Top ] ### Class Methods ### constructor __construct [line 954]
`ColumnAdder __construct( string $groupId, string $tableId, ColumnPosition $columnPosition, array $newColumnIds, array $inputColumnIds, array $callback)`
Constructor #### Tags:
access: | public
Overrides TableFilter::__construct() (Constructor) #### Parameters:
string | $groupId |
string | $tableId |
ColumnPosition | $columnPosition |
array | $newColumnIds |
array | $inputColumnIds |
array | $callback |
[ Top ] ### method addNewColumns [line 969]
`void addNewColumns( Table $table, array $columnIds)`
Adds new columns into table definition of columns #### Tags:
access: | protected
#### Parameters:
Table | $table |
array | $columnIds |
[ Top ] ### method addWeight [line 1074]
`void addWeight( int $weight, array &$weights)`
Stores computed weights Weights are stored in an array which has the structure described in TableRule::addWeight(). When a rule with a greater weight is found, column Id is removed from old rule and added to current rule. With standard rules, only one rule is executed for each type of rule. ColumnAdder rule can be executed several times, but only once with the same column Id. #### Tags:
access: | protected
Overrides GroupRule::addWeight() (Stores computed weights) #### Parameters:
int | $weight |
array | &$weights |
[ Top ] ### method applyRule [line 1022]
`void applyRule( Table $table, array $params)`
Execute a rule on table #### Tags:
access: | public
Overridden in child classes as: ColumnAdderBatch::applyRule() Execute a rule on table Overrides TableFilter::applyRule() (Execute a rule on a table) #### Parameters:
Table | $table |
array | $params |
[ Top ] Documentation generated on Fri, 21 Sep 2007 13:31:08 +0200 by phpDocumentor 1.3.0RC3