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");
14class ilKSDocumentationEntryGUI
19 protected $entry =
null;
24 protected $entries =
null;
56 $this->f =
$DIC->ui()->factory();
57 $this->r =
$DIC->ui()->renderer();
59 $this->setEntry($entry);
60 $this->setEntries($entries);
61 $this->setParent($parent);
68 public function renderEntry()
70 $sub_panels = array();
72 $feature_wiki_links = array();
73 foreach ($this->entry->getFeatureWikiReferences()as $href) {
74 $feature_wiki_links[] = $href;
77 $sub_panels[] = $this->f->panel()->sub(
80 $this->f->listing()->descriptive(
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")
90 $this->f->listing()->descriptive(
92 "Background" => $this->entry->getBackground(),
93 "Feature Wiki References" => $this->f->listing()->ordered($feature_wiki_links)
99 $rule_listings = array();
100 foreach ($this->entry->getRulesAsArray() as $categoery => $category_rules) {
101 $rule_listings[ucfirst($categoery)] = $this->f->listing()->ordered($category_rules);
104 $sub_panels[] = $this->f->panel()->sub(
106 $this->f->listing()->descriptive($rule_listings)
109 if ($this->entry->getExamples()) {
111 foreach ($this->entry->getExamples() as
$name =>
$path) {
113 $title =
"Example " . $nr .
": " . ucfirst(str_replace(
"_",
" ",
$name));
115 $example =
"<div class='well'>" .
$name() .
"</div>";
116 $content_part_1 = $this->f->legacy($example);
117 $code = str_replace(
"<?php\n",
"", file_get_contents(
$path));
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);
125 $sub_panels[] = $this->f->panel()->sub(
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 $report = $this->f->panel()->report($this->entry->getTitle(), $sub_panels);
141 return $this->r->render($report);
148 public function getEntry()
156 public function setEntry(
Entry\ComponentEntry $entry)
158 $this->entry = $entry;
164 public function getEntries()
166 return $this->entries;
172 public function setEntries(
Entry\ComponentEntries $entries)
174 $this->entries = $entries;
180 public function getParent()
182 return $this->parent;
188 public function setParent($parent)
190 $this->parent = $parent;
An exception for terminatinating execution or to throw for unit testing.