1<?php 2 3namespace dokuwiki\plugin\struct\meta; 4 5use dokuwiki\plugin\struct\types\AbstractBaseType; 6use dokuwiki\plugin\struct\types\AutoSummary; 7 8/** 9 * Class SummaryColumn 10 * 11 * Just like a column, but does not reference one of the col* data columns but the pid column. 12 * 13 * @package dokuwiki\plugin\struct\meta 14 */ 15class SummaryColumn extends Column { 16 17 /** 18 * PageColumn constructor. 19 * 20 * @param int $sort 21 * @param PageMeta $type 22 * @param string $table 23 */ 24 public function __construct($sort, AutoSummary $type, $table='') { 25 if($type->isMulti()) throw new StructException('SummaryColumns can not be multi value types!'); 26 parent::__construct($sort, $type, 0, true, $table); 27 $this->getType()->setContext($this); 28 } 29 30 public function getColref() { 31 throw new StructException('Accessing the colref of a SummaryColumn makes no sense'); 32 } 33 34 /** 35 * @param bool $enforceSingleColumn ignored 36 * @return string 37 */ 38 public function getColName($enforceSingleColumn = true) { 39 return 'lastsummary'; 40 } 41 42 /** 43 * @param bool $enforceSingleColumn ignored 44 * @return string 45 */ 46 public function getFullColName($enforceSingleColumn = true) { 47 $col = 'titles.'.$this->getColName($enforceSingleColumn); 48 return $col; 49 } 50 51 /** 52 * @return string always '%lastsummary%' 53 */ 54 public function getLabel() { 55 return '%lastsummary%'; 56 } 57 58 /** 59 * @return string always '%lastsummary%' 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('summarylabel'); 74 } 75 76} 77