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