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