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