sort = (int) $sort; $this->type = $type; $this->colref = (int) $colref; $this->enabled = (bool) $enabled; $this->table = $table; } /** * @return int */ public function getSort() { return $this->sort; } /** * @return int */ public function getTid() { return $this->type->getTid(); } /** * @return string */ public function getLabel() { return $this->type->getLabel(); } /** * @return string the label prepended with the table name */ public function getFullQualifiedLabel() { if(!$this->table) throw new StructException('No table set for this column'); return $this->table .'.'. $this->getLabel(); } /** * @return string */ public function getTranslatedLabel() { return $this->type->getTranslatedLabel(); } /** * @return string */ public function getTranslatedHint() { return $this->type->getTranslatedHint(); } /** * @return AbstractBaseType */ public function getType() { return $this->type; } /** * @return int */ public function getColref() { return $this->colref; } /** * Returns the full column name. When table is set, prefixed by the table name * * @return string */ public function getColName() { if($this->isMulti()) throw new StructException('Calling getColName on a multi value column makes no sense.'); $col = 'col'.$this->colref; if($this->table) $col = 'data_'.$this->table.'.'.$col; return $col; } /** * @return boolean */ public function isEnabled() { return $this->enabled; } /** * @return string */ public function getTable() { return $this->table; } /** * @return bool */ public function isMulti() { return $this->type->isMulti(); } /** * Returns a list of all available types * * @return array */ static public function allTypes() { $types = array(); $files = glob(DOKU_PLUGIN . 'struct/types/*.php'); foreach($files as $file) { $file = basename($file, '.php'); if(substr($file, 0, 8) == 'Abstract') continue; $types[] = $file; } sort($types); return $types; } }