19declare(strict_types=1);
28class ilKSDocumentationEntryGUI
36 ILIAS\UI\Factory $factory,
39 ?
string $current_opened_node_id
42 $this->
ctrl = $ilCtrl;
44 if ($current_opened_node_id) {
45 $this->
ctrl->setParameterByClass(
'ilsystemstyledocumentationgui',
'node_id', $current_opened_node_id);
46 $this->entry = $entries->getEntryById($current_opened_node_id);
48 $this->entry = $entries->getRootEntry();
50 $this->entries = $entries;
53 public function createUIComponentOfEntry():
Report
57 $feature_wiki_links = [];
58 foreach ($this->entry->getFeatureWikiReferences() as $href) {
59 $feature_wiki_links[] = $href;
62 $sub_panels[] = $this->f->panel()->sub(
65 $this->f->listing()->descriptive(
67 'Purpose' => $this->entry->getDescription()->getProperty(
'purpose'),
68 'Composition' => $this->entry->getDescription()->getProperty(
'composition'),
69 'Effect' => $this->entry->getDescription()->getProperty(
'effect'),
73 $this->f->listing()->descriptive(
75 'Background' => $this->entry->getBackground(),
76 'Context' => $this->f->listing()->ordered($this->entry->getContext()),
77 'Feature Wiki References' => $this->f->listing()->ordered($feature_wiki_links)
83 if (
sizeof($this->entry->getDescription()->getProperty(
'rivals'))) {
84 $sub_panels[] = $this->f->panel()->sub(
86 $this->f->listing()->descriptive(
87 $this->entry->getDescription()->getProperty(
'rivals')
92 if ($this->entry->getRules() && $this->entry->getRules()->hasRules()) {
94 foreach ($this->entry->getRulesAsArray() as $categoery => $category_rules) {
95 $rule_listings[ucfirst($categoery)] = $this->f->listing()->ordered($category_rules);
98 $sub_panels[] = $this->f->panel()->sub(
100 $this->f->listing()->descriptive($rule_listings)
104 $examples = $this->entry->getExamples();
105 if (count($examples) > 0) {
107 foreach ($this->entry->getExamples() as $name =>
$path) {
108 $path = ILIAS_ABSOLUTE_PATH .
"/$path";
110 $title =
'Example ' . $nr .
': ' . ucfirst(str_replace(
'_',
' ', $name));
112 $examples_function_name = $this->entry->getExamplesNamespace() .
'\\' . $name;
114 $example =
"<div class='well'>" . $examples_function_name() .
'</div>';
115 }
catch (\
ILIAS\UI\NotImplementedException
$e) {
116 $example =
"<div class='well'>This component is not yet fully implemented.</div>";
118 $content_part_1 = $this->f->legacy()->content($example);
119 $code = str_replace(
'<?php\n',
'', file_get_contents(
$path));
120 $code_html =
"<div class='code-container'><pre><code>" . htmlspecialchars($code) .
'</code></pre></div>';
121 $content_part_2 = $this->f->legacy()->content($code_html);
122 $content = [$content_part_1, $content_part_2];
123 $sub_panels[] = $this->f->panel()->sub($title, $content);
126 $sub_panels[] = $this->f->panel()->sub(
'Relations', [
127 $this->f->listing()->descriptive(
129 'Parents' => $this->f->listing()->ordered(
130 $this->entries->getParentsOfEntryTitles($this->entry->getId())
132 'Descendants' => $this->f->listing()->unordered(
133 $this->entries->getDescendantsOfEntryTitles($this->entry->getId())
139 return $this->f->panel()
140 ->report($this->entry->getTitle(), $sub_panels);
Builds a Color from either hex- or rgb values.
Container storing a list of UI Component Entries, can act as Iterator, countable and is serializable.
Stores Information of UI Components parsed from YAML, examples and less files.
Class ilCtrl provides processing control methods.
This describes how a Report could be modified during construction of UI.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.