1*1c502704SAndreas Gohr<?php 2*1c502704SAndreas Gohr 3*1c502704SAndreas Gohrnamespace plugin\struct\meta; 4*1c502704SAndreas Gohr 5*1c502704SAndreas Gohruse plugin\struct\types\AbstractBaseType; 6*1c502704SAndreas Gohr 7*1c502704SAndreas Gohr/** 8*1c502704SAndreas Gohr * Class Column 9*1c502704SAndreas Gohr * 10*1c502704SAndreas Gohr * This represents a single column within a schema and contains the configured BaseType as well as the 11*1c502704SAndreas Gohr * column reference to the data table 12*1c502704SAndreas Gohr * 13*1c502704SAndreas Gohr * @package plugin\struct\meta 14*1c502704SAndreas Gohr */ 15*1c502704SAndreas Gohrclass Column { 16*1c502704SAndreas Gohr 17*1c502704SAndreas Gohr /** @var int fields are sorted by this value */ 18*1c502704SAndreas Gohr protected $sort; 19*1c502704SAndreas Gohr /** @var AbstractBaseType the type of this column */ 20*1c502704SAndreas Gohr protected $type; 21*1c502704SAndreas Gohr /** @var int the ID of the currently used type */ 22*1c502704SAndreas Gohr protected $tid; 23*1c502704SAndreas Gohr /** @var int the column in the datatable. columns count from 1 */ 24*1c502704SAndreas Gohr protected $colref; 25*1c502704SAndreas Gohr /** @var bool is this column still enabled? */ 26*1c502704SAndreas Gohr protected $enabled=true; 27*1c502704SAndreas Gohr 28*1c502704SAndreas Gohr /** 29*1c502704SAndreas Gohr * Column constructor. 30*1c502704SAndreas Gohr * @param int $sort 31*1c502704SAndreas Gohr * @param AbstractBaseType $type 32*1c502704SAndreas Gohr * @param int $tid 33*1c502704SAndreas Gohr * @param int $colref 34*1c502704SAndreas Gohr * @param bool $enabled 35*1c502704SAndreas Gohr */ 36*1c502704SAndreas Gohr public function __construct($sort, AbstractBaseType $type, $tid = 0, $colref=0, $enabled=true) { 37*1c502704SAndreas Gohr $this->sort = (int) $sort; 38*1c502704SAndreas Gohr $this->type = $type; 39*1c502704SAndreas Gohr $this->tid = (int) $tid; 40*1c502704SAndreas Gohr $this->colref = (int) $colref; 41*1c502704SAndreas Gohr $this->enabled = (bool) $enabled; 42*1c502704SAndreas Gohr } 43*1c502704SAndreas Gohr 44*1c502704SAndreas Gohr /** 45*1c502704SAndreas Gohr * @return int 46*1c502704SAndreas Gohr */ 47*1c502704SAndreas Gohr public function getSort() { 48*1c502704SAndreas Gohr return $this->sort; 49*1c502704SAndreas Gohr } 50*1c502704SAndreas Gohr 51*1c502704SAndreas Gohr /** 52*1c502704SAndreas Gohr * @return int 53*1c502704SAndreas Gohr */ 54*1c502704SAndreas Gohr public function getTid() { 55*1c502704SAndreas Gohr return $this->tid; 56*1c502704SAndreas Gohr } 57*1c502704SAndreas Gohr 58*1c502704SAndreas Gohr /** 59*1c502704SAndreas Gohr * @return AbstractBaseType 60*1c502704SAndreas Gohr */ 61*1c502704SAndreas Gohr public function getType() { 62*1c502704SAndreas Gohr return $this->type; 63*1c502704SAndreas Gohr } 64*1c502704SAndreas Gohr 65*1c502704SAndreas Gohr /** 66*1c502704SAndreas Gohr * @return int 67*1c502704SAndreas Gohr */ 68*1c502704SAndreas Gohr public function getColref() { 69*1c502704SAndreas Gohr return $this->colref; 70*1c502704SAndreas Gohr } 71*1c502704SAndreas Gohr 72*1c502704SAndreas Gohr /** 73*1c502704SAndreas Gohr * @return boolean 74*1c502704SAndreas Gohr */ 75*1c502704SAndreas Gohr public function isEnabled() { 76*1c502704SAndreas Gohr return $this->enabled; 77*1c502704SAndreas Gohr } 78*1c502704SAndreas Gohr 79*1c502704SAndreas Gohr 80*1c502704SAndreas Gohr 81*1c502704SAndreas Gohr} 82