/** * Render schema data * * Currently completely renderer agnostic * * @todo we currently have no schema headlines * * @param string $mode Renderer mode * @param Doku_Renderer $R The renderer * @param array $data The data from the handler() function * @return bool If rendering was successful. */ public function render($mode, Doku_Renderer $R, $data) { global $ID; global $INFO; global $REV; if ($ID != $INFO['id']) { return true; } if (!$INFO['exists']) { return true; } if ($this->hasBeenRendered) { return true; } // do not render the output twice on the same page, e.g. when another page has been included $this->hasBeenRendered = true; $assignments = new Assignments(); $tables = $assignments->getPageAssignments($ID); if (!$tables) { return true; } if ($mode == 'xhtml') { $R->doc .= '<div id="plugin__struct_output">'; } foreach ($tables as $table) { $schemadata = AccessTable::byTableName($table, $ID, $REV); $schemadata->optionSkipEmpty(true); $data = $schemadata->getData(); if (!count($data)) { continue; } $R->table_open(); $R->tablethead_open(); $R->tablerow_open(); $R->tableheader_open(2); $R->cdata($table); $R->tableheader_close(); $R->tablerow_close(); $R->tablethead_open(); $R->tabletbody_open(); foreach ($data as $field) { $R->tablerow_open(); $R->tableheader_open(); $R->cdata($field->getColumn()->getTranslatedLabel()); $R->tableheader_close(); $R->tablecell_open(); $field->render($R, $mode); $R->tablecell_close(); $R->tablerow_close(); } $R->tabletbody_close(); $R->table_close(); } if ($mode == 'xhtml') { $R->doc .= '</div>'; } return true; }