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 } 27 28 public function getColref() { 29 throw new StructException('Accessing the colref of a RevisionColumn makes no sense'); 30 } 31 32 /** 33 * @param bool $enforceSingleColumn ignored 34 * @return string 35 */ 36 public function getColName($enforceSingleColumn = true) { 37 return 'rev'; 38 } 39 40 /** 41 * @param bool $enforceSingleColumn ignored 42 * @return string 43 */ 44 public function getFullColName($enforceSingleColumn = true) { 45 $col = $this->getColName($enforceSingleColumn); 46 if($this->table) $col = 'data_'.$this->table.'.'.$col; 47 return $col; 48 } 49 50 /** 51 * @return string always '%lastupdate%' 52 */ 53 public function getLabel() { 54 return '%lastupdate%'; 55 } 56 57 /** 58 * @return string always '%lastupdate%' 59 */ 60 public function getFullQualifiedLabel() { 61 // There is only one pageid for each row because we JOIN on it 62 // so we do not prefix it with the table 63 return $this->getLabel(); 64 } 65 66 /** 67 * @return string preconfigured label 68 */ 69 public function getTranslatedLabel() { 70 /** @var \helper_plugin_struct_config $helper */ 71 $helper = plugin_load('helper', 'struct_config'); 72 return $helper->getLang('revisionlabel'); 73 } 74 75} 76