ILIAS  trunk Revision v11.0_alpha-1843-g9e1fad99175
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilKSDocumentationEntryGUI Class Reference

Renders the Overview of one Example in the Administration. More...

+ Collaboration diagram for ilKSDocumentationEntryGUI:

Public Member Functions

 __construct (ILIAS\UI\Factory $factory, ilCtrl $ilCtrl, Entries $entries, ?string $current_opened_node_id)
 
 createUIComponentOfEntry ()
 

Protected Attributes

Entry ComponentEntry $entry
 
Entry ComponentEntries $entries
 
ilCtrl $ctrl
 
ILIAS UI Factory $f
 

Detailed Description

Renders the Overview of one Example in the Administration.

Definition at line 28 of file class.ilKSDocumentationEntryGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilKSDocumentationEntryGUI::__construct ( ILIAS\UI\Factory  $factory,
ilCtrl  $ilCtrl,
Entries  $entries,
?string  $current_opened_node_id 
)

Definition at line 35 of file class.ilKSDocumentationEntryGUI.php.

References $entries, and ILIAS\Repository\ctrl().

40  {
41  $this->f = $factory;
42  $this->ctrl = $ilCtrl;
43 
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);
47  } else {
48  $this->entry = $entries->getRootEntry();
49  }
50  $this->entries = $entries;
51  }
+ Here is the call graph for this function:

Member Function Documentation

◆ createUIComponentOfEntry()

ilKSDocumentationEntryGUI::createUIComponentOfEntry ( )

Definition at line 53 of file class.ilKSDocumentationEntryGUI.php.

References Vendor\Package\$e, and $path.

53  : Report
54  {
55  $sub_panels = [];
56 
57  $feature_wiki_links = [];
58  foreach ($this->entry->getFeatureWikiReferences() as $href) {
59  $feature_wiki_links[] = $href;
60  }
61 
62  $sub_panels[] = $this->f->panel()->sub(
63  'Description',
64  [
65  $this->f->listing()->descriptive(
66  [
67  'Purpose' => $this->entry->getDescription()->getProperty('purpose'),
68  'Composition' => $this->entry->getDescription()->getProperty('composition'),
69  'Effect' => $this->entry->getDescription()->getProperty('effect'),
70 
71  ]
72  ),
73  $this->f->listing()->descriptive(
74  [
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)
78  ]
79  )
80  ]
81  );
82 
83  if (sizeof($this->entry->getDescription()->getProperty('rivals'))) {
84  $sub_panels[] = $this->f->panel()->sub(
85  'Rivals',
86  $this->f->listing()->descriptive(
87  $this->entry->getDescription()->getProperty('rivals')
88  )
89  );
90  }
91 
92  if ($this->entry->getRules() && $this->entry->getRules()->hasRules()) {
93  $rule_listings = [];
94  foreach ($this->entry->getRulesAsArray() as $categoery => $category_rules) {
95  $rule_listings[ucfirst($categoery)] = $this->f->listing()->ordered($category_rules);
96  }
97 
98  $sub_panels[] = $this->f->panel()->sub(
99  'Rules',
100  $this->f->listing()->descriptive($rule_listings)
101  );
102  }
103 
104  $examples = $this->entry->getExamples();
105  if (count($examples) > 0) {
106  $nr = 1;
107  foreach ($this->entry->getExamples() as $name => $path) {
108  $path = ILIAS_ABSOLUTE_PATH . "/$path";
109  include_once($path);
110  $title = 'Example ' . $nr . ': ' . ucfirst(str_replace('_', ' ', $name));
111  $nr++;
112  $examples_function_name = $this->entry->getExamplesNamespace() . '\\' . $name;
113  try {
114  $example = "<div class='well'>" . $examples_function_name() . '</div>'; //Executes function loaded in file indicated by 'path'
115  } catch (\ILIAS\UI\NotImplementedException $e) {
116  $example = "<div class='well'>This component is not yet fully implemented.</div>";
117  }
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);
124  }
125  }
126  $sub_panels[] = $this->f->panel()->sub('Relations', [
127  $this->f->listing()->descriptive(
128  [
129  'Parents' => $this->f->listing()->ordered(
130  $this->entries->getParentsOfEntryTitles($this->entry->getId())
131  ),
132  'Descendants' => $this->f->listing()->unordered(
133  $this->entries->getDescendantsOfEntryTitles($this->entry->getId())
134  )
135  ]
136  )
137  ]);
138 
139  return $this->f->panel()
140  ->report($this->entry->getTitle(), $sub_panels);
141  }
Interface Observer Contains several chained tasks and infos about them.
$path
Definition: ltiservices.php:29
This describes how a Report could be modified during construction of UI.
Definition: Report.php:28

Field Documentation

◆ $ctrl

ilCtrl ilKSDocumentationEntryGUI::$ctrl
protected

Definition at line 32 of file class.ilKSDocumentationEntryGUI.php.

◆ $entries

Entry ComponentEntries ilKSDocumentationEntryGUI::$entries
protected

Definition at line 31 of file class.ilKSDocumentationEntryGUI.php.

Referenced by __construct().

◆ $entry

Entry ComponentEntry ilKSDocumentationEntryGUI::$entry
protected

Definition at line 30 of file class.ilKSDocumentationEntryGUI.php.

◆ $f

ILIAS UI Factory ilKSDocumentationEntryGUI::$f
protected

Definition at line 33 of file class.ilKSDocumentationEntryGUI.php.


The documentation for this class was generated from the following file: