ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilKSDocumentationEntryGUI.php
Go to the documentation of this file.
1<?php
2include_once("./Services/UIComponent/Panel/classes/class.ilPanelGUI.php");
3include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
4include_once("libs/composer/vendor/geshi/geshi/src/geshi.php");
5
6
8
14class ilKSDocumentationEntryGUI
15{
19 protected $entry = null;
20
24 protected $entries = null;
25
29 protected $ctrl;
30
34 protected $parent;
35
39 protected $f = null;
40
44 protected $r = null;
45
52 public function __construct(ilSystemStyleDocumentationGUI $parent, Entry\ComponentEntry $entry, Entry\ComponentEntries $entries)
53 {
54 global $ilCtrl,$DIC;
55
56 $this->f = $DIC->ui()->factory();
57 $this->r = $DIC->ui()->renderer();
58
59 $this->setEntry($entry);
60 $this->setEntries($entries);
61 $this->setParent($parent);
62 $this->ctrl = $ilCtrl;
63 }
64
68 public function renderEntry()
69 {
70 $sub_panels = array();
71
72 $feature_wiki_links = array();
73 foreach ($this->entry->getFeatureWikiReferences()as $href) {
74 $feature_wiki_links[] = $href;
75 }
76
77 $sub_panels[] = $this->f->panel()->sub(
78 "Description",
79 array(
80 $this->f->listing()->descriptive(
81 array(
82 "Purpose" => $this->entry->getDescription()->getProperty("purpose"),
83 "Composition" => $this->entry->getDescription()->getProperty("composition"),
84 "Effect" => $this->entry->getDescription()->getProperty("effect"),
85 "Rivals" => $this->f->listing()->ordered(
86 $this->entry->getDescription()->getProperty("rivals")
87 )
88 )
89 ),
90 $this->f->listing()->descriptive(
91 array(
92 "Background" => $this->entry->getBackground(),
93 "Feature Wiki References" => $this->f->listing()->ordered($feature_wiki_links)
94 )
95 )
96 )
97 );
98
99 $rule_listings = array();
100 foreach ($this->entry->getRulesAsArray() as $categoery => $category_rules) {
101 $rule_listings[ucfirst($categoery)] = $this->f->listing()->ordered($category_rules);
102 }
103
104 $sub_panels[] = $this->f->panel()->sub(
105 "Rules",
106 $this->f->listing()->descriptive($rule_listings)
107 );
108
109 if ($this->entry->getExamples()) {
110 $nr = 1;
111 foreach ($this->entry->getExamples() as $name => $path) {
112 include_once($path);
113 $title = "Example " . $nr . ": " . ucfirst(str_replace("_", " ", $name));
114 $nr++;
115 $example = "<div class='well'>" . $name() . "</div>"; //Executes function loaded in file indicated by 'path'
116 $content_part_1 = $this->f->legacy($example);
117 $code = str_replace("<?php\n", "", file_get_contents($path));
118 $geshi = new GeSHi($code, "php");
119 $content_part_2 = $this->f->legacy($geshi->parse_code());
120 $content = array($content_part_1,$content_part_2);
121 $sub_panels[] = $this->f->panel()->sub($title, $content);
122 }
123 }
124
125 $sub_panels[] = $this->f->panel()->sub(
126 "Relations",
127 $this->f->listing()->descriptive(
128 array(
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 $report = $this->f->panel()->report($this->entry->getTitle(), $sub_panels);
140
141 return $this->r->render($report);
142 }
143
144
148 public function getEntry()
149 {
150 return $this->entry;
151 }
152
156 public function setEntry(Entry\ComponentEntry $entry)
157 {
158 $this->entry = $entry;
159 }
160
164 public function getEntries()
165 {
166 return $this->entries;
167 }
168
172 public function setEntries(Entry\ComponentEntries $entries)
173 {
174 $this->entries = $entries;
175 }
176
180 public function getParent()
181 {
182 return $this->parent;
183 }
184
188 public function setParent($parent)
189 {
190 $this->parent = $parent;
191 }
192}
An exception for terminatinating execution or to throw for unit testing.
Definition: geshi.php:226
$r
Definition: example_031.php:79
$code
Definition: example_050.php:99
global $ilCtrl
Definition: ilias.php:18
if($format !==null) $name
Definition: metadata.php:146
global $DIC
Definition: saml.php:7