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 /** 15 * @var bool skip full table when no results found 16 */ 17 protected $simplenone = false; 18 19 /** 20 * Adds additional info to document and renderer in XHTML mode 21 * 22 * We add the schema name as data attribute 23 * 24 * @see finishScope() 25 */ 26 protected function startScope() 27 { 28 // unique identifier for this aggregation 29 $this->renderer->info['struct_table_hash'] = md5(var_export($this->data, true)); 30 31 if ($this->mode != 'xhtml') return; 32 33 $table = $this->columns[0]->getTable(); 34 35 $config = $this->searchConfig->getConf(); 36 if (isset($config['filter'])) unset($config['filter']); 37 $config = hsc(json_encode($config)); 38 39 // wrapping div 40 $this->renderer->doc .= "<div class=\"structaggregation structaggregationeditor\" 41 data-schema=\"$table\" data-searchconf=\"$config\">"; 42 43 // unique identifier for this aggregation 44 $this->renderer->info['struct_table_hash'] = md5(var_export($this->data, true)); 45 } 46 47 /** 48 * We do not output a row for empty tables 49 */ 50 protected function renderEmptyResult() 51 { 52 } 53 54 /** 55 * Renders the first result row and returns it 56 * 57 * Only used for rendering new rows via JS (where the first row is the only one) 58 * 59 * @return string 60 */ 61 public function getFirstRow() 62 { 63 // XHTML renderer doesn't like calling ->tablerow_open() without 64 // ->table_open() first, since it leaves some internal variables unset. 65 // Therefore, call ->table_open() and throw away the generated HTML. 66 $this->renderer->table_open(); 67 $this->renderer->doc = ''; 68 69 $this->renderResultRow(0, $this->result[0]); 70 return $this->renderer->doc; 71 } 72} 73