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 /** 18 * PageColumn constructor. 19 * 20 * @param int $sort 21 * @param DateTime $type 22 * @param string $table 23 */ 24 public function __construct($sort, DateTime $type, $table = '') 25 { 26 if ($type->isMulti()) throw new StructException('RevisionColumns can not be multi value types!'); 27 parent::__construct($sort, $type, 0, true, $table); 28 $this->getType()->setContext($this); 29 } 30 31 public function getColref() 32 { 33 throw new StructException('Accessing the colref of a RevisionColumn makes no sense'); 34 } 35 36 /** 37 * @param bool $enforceSingleColumn ignored 38 * @return string 39 */ 40 public function getColName($enforceSingleColumn = true) 41 { 42 return 'rev'; 43 } 44 45 /** 46 * @param bool $enforceSingleColumn ignored 47 * @return string 48 */ 49 public function getFullColName($enforceSingleColumn = true) 50 { 51 $col = $this->getColName($enforceSingleColumn); 52 if ($this->table) $col = 'data_' . $this->table . '.' . $col; 53 return $col; 54 } 55 56 /** 57 * @return string always '%lastupdate%' 58 */ 59 public function getLabel() 60 { 61 return '%lastupdate%'; 62 } 63 64 /** 65 * @return string always '%lastupdate%' 66 */ 67 public function getFullQualifiedLabel() 68 { 69 // There is only one pageid for each row because we JOIN on it 70 // so we do not prefix it with the table 71 return $this->getLabel(); 72 } 73 74 /** 75 * @return string preconfigured label 76 */ 77 public function getTranslatedLabel() 78 { 79 /** @var \helper_plugin_struct_config $helper */ 80 $helper = plugin_load('helper', 'struct_config'); 81 return $helper->getLang('revisionlabel'); 82 } 83} 84