1cadfc3ccSAndreas Gohr<?php 2cadfc3ccSAndreas Gohr 3cadfc3ccSAndreas Gohrnamespace dokuwiki\plugin\struct\meta; 4cadfc3ccSAndreas Gohr 5cb120ce2SMichael Grosseuse dokuwiki\plugin\struct\types\DateTime; 6cadfc3ccSAndreas Gohr 7cadfc3ccSAndreas Gohr/** 8cadfc3ccSAndreas Gohr * Class RevisionColumn 9cadfc3ccSAndreas Gohr * 10cadfc3ccSAndreas Gohr * Just like a column, but does not reference one of the col* data columns but the rev column. 11cadfc3ccSAndreas Gohr * 12cadfc3ccSAndreas Gohr * @package dokuwiki\plugin\struct\meta 13cadfc3ccSAndreas Gohr */ 14*d6d97f60SAnna Dabrowskaclass RevisionColumn extends Column 15*d6d97f60SAnna Dabrowska{ 16cadfc3ccSAndreas Gohr /** 17cadfc3ccSAndreas Gohr * PageColumn constructor. 18cadfc3ccSAndreas Gohr * 19cadfc3ccSAndreas Gohr * @param int $sort 20cb120ce2SMichael Grosse * @param DateTime $type 21cadfc3ccSAndreas Gohr * @param string $table 22cadfc3ccSAndreas Gohr */ 23*d6d97f60SAnna Dabrowska public function __construct($sort, DateTime $type, $table = '') 24*d6d97f60SAnna Dabrowska { 25cadfc3ccSAndreas Gohr if ($type->isMulti()) throw new StructException('RevisionColumns can not be multi value types!'); 26cadfc3ccSAndreas Gohr parent::__construct($sort, $type, 0, true, $table); 27e9259fa1SMichael Grosse $this->getType()->setContext($this); 28cadfc3ccSAndreas Gohr } 29cadfc3ccSAndreas Gohr 30*d6d97f60SAnna Dabrowska public function getColref() 31*d6d97f60SAnna Dabrowska { 32cadfc3ccSAndreas Gohr throw new StructException('Accessing the colref of a RevisionColumn makes no sense'); 33cadfc3ccSAndreas Gohr } 34cadfc3ccSAndreas Gohr 35cadfc3ccSAndreas Gohr /** 365a11127fSAndreas Gohr * @param bool $enforceSingleColumn ignored 37cadfc3ccSAndreas Gohr * @return string 38cadfc3ccSAndreas Gohr */ 39*d6d97f60SAnna Dabrowska public function getColName($enforceSingleColumn = true) 40*d6d97f60SAnna Dabrowska { 41cadfc3ccSAndreas Gohr return 'rev'; 42cadfc3ccSAndreas Gohr } 43cadfc3ccSAndreas Gohr 44cadfc3ccSAndreas Gohr /** 455a11127fSAndreas Gohr * @param bool $enforceSingleColumn ignored 46cadfc3ccSAndreas Gohr * @return string 47cadfc3ccSAndreas Gohr */ 48*d6d97f60SAnna Dabrowska public function getFullColName($enforceSingleColumn = true) 49*d6d97f60SAnna Dabrowska { 505a11127fSAndreas Gohr $col = $this->getColName($enforceSingleColumn); 51cadfc3ccSAndreas Gohr if ($this->table) $col = 'data_' . $this->table . '.' . $col; 52cadfc3ccSAndreas Gohr return $col; 53cadfc3ccSAndreas Gohr } 54cadfc3ccSAndreas Gohr 55cadfc3ccSAndreas Gohr /** 56cadfc3ccSAndreas Gohr * @return string always '%lastupdate%' 57cadfc3ccSAndreas Gohr */ 58*d6d97f60SAnna Dabrowska public function getLabel() 59*d6d97f60SAnna Dabrowska { 60cadfc3ccSAndreas Gohr return '%lastupdate%'; 61cadfc3ccSAndreas Gohr } 62cadfc3ccSAndreas Gohr 63cadfc3ccSAndreas Gohr /** 64cadfc3ccSAndreas Gohr * @return string always '%lastupdate%' 65cadfc3ccSAndreas Gohr */ 66*d6d97f60SAnna Dabrowska public function getFullQualifiedLabel() 67*d6d97f60SAnna Dabrowska { 68cadfc3ccSAndreas Gohr // There is only one pageid for each row because we JOIN on it 69cadfc3ccSAndreas Gohr // so we do not prefix it with the table 70cadfc3ccSAndreas Gohr return $this->getLabel(); 71cadfc3ccSAndreas Gohr } 72cadfc3ccSAndreas Gohr 73cadfc3ccSAndreas Gohr /** 74cadfc3ccSAndreas Gohr * @return string preconfigured label 75cadfc3ccSAndreas Gohr */ 76*d6d97f60SAnna Dabrowska public function getTranslatedLabel() 77*d6d97f60SAnna Dabrowska { 78cadfc3ccSAndreas Gohr /** @var \helper_plugin_struct_config $helper */ 79cadfc3ccSAndreas Gohr $helper = plugin_load('helper', 'struct_config'); 80cadfc3ccSAndreas Gohr return $helper->getLang('revisionlabel'); 81cadfc3ccSAndreas Gohr } 82cadfc3ccSAndreas Gohr} 83