1<?php 2 3namespace dokuwiki\plugin\struct\meta; 4 5/** 6 * Class AggregationEditorTable 7 * 8 * An AggregationTable for editing global and serial tables 9 * 10 * @package dokuwiki\plugin\struct\meta 11 */ 12class AggregationEditorTable extends AggregationTable 13{ 14 /** @inheritdoc */ 15 public function render($showNotFound = false) 16 { 17 parent::render(); // never show not found 18 } 19 20 21 /** 22 * Adds additional info to document and renderer in XHTML mode 23 * 24 * We add the schema name as data attribute 25 * 26 * @see finishScope() 27 */ 28 public function startScope() 29 { 30 parent::startScope(); 31 32 if ($this->mode != 'xhtml') return; 33 34 $table = $this->columns[0]->getTable(); 35 36 $config = $this->searchConfig->getConf(); 37 if (isset($config['filter'])) unset($config['filter']); 38 $config = hsc(json_encode($config, JSON_THROW_ON_ERROR)); 39 40 // wrapping div 41 $classes = $this->getScopeClasses(); 42 $classes[] = 'structaggregationeditor'; 43 $classes = implode(' ', $classes); 44 $this->renderer->doc .= "<div id=\"$hash\" 45 class=\"$classes\" 46 data-schema=\"$table\" data-searchconf=\"$config\">"; 47 } 48 49 /** 50 * We do not output a row for empty tables 51 */ 52 protected function renderEmptyResult() 53 { 54 } 55 56 /** 57 * Renders the first result row and returns it 58 * 59 * Only used for rendering new rows via JS (where the first row is the only one) 60 * 61 * @return string 62 */ 63 public function getFirstRow() 64 { 65 // XHTML renderer doesn't like calling ->tablerow_open() without 66 // ->table_open() first, since it leaves some internal variables unset. 67 // Therefore, call ->table_open() and throw away the generated HTML. 68 $this->renderer->table_open(); 69 $this->renderer->doc = ''; 70 71 $this->renderResultRow(0, $this->result[0]); 72 return $this->renderer->doc; 73 } 74} 75