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);
62 $this->ctrl =
$DIC->ctrl();
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"),
88 $this->f->listing()->descriptive(
90 "Background" => $this->entry->getBackground(),
91 "Context" => $this->f->listing()->ordered($this->entry->getContext()),
92 "Feature Wiki References" => $this->f->listing()->ordered($feature_wiki_links)
98 if (
sizeof($this->entry->getDescription()->getProperty(
"rivals"))) {
99 $sub_panels[] = $this->f->panel()->sub(
101 $this->f->listing()->descriptive(
102 $this->entry->getDescription()->getProperty(
"rivals")
107 if ($this->entry->getRules()->hasRules()) {
108 $rule_listings = array();
109 foreach ($this->entry->getRulesAsArray() as $categoery => $category_rules) {
110 $rule_listings[ucfirst($categoery)] = $this->f->listing()->ordered($category_rules);
114 $sub_panels[] = $this->f->panel()->sub(
116 $this->f->listing()->descriptive($rule_listings)
121 if ($this->entry->getExamples()) {
123 foreach ($this->entry->getExamples() as
$name =>
$path) {
125 $title =
"Example " . $nr .
": " . ucfirst(str_replace(
"_",
" ",
$name));
127 $example =
"<div class='well'>" .
$name() .
"</div>";
128 $content_part_1 = $this->f->legacy($example);
129 $code = str_replace(
"<?php\n",
"", file_get_contents(
$path));
131 $content_part_2 = $this->f->legacy(
$geshi->parse_code());
132 $content = array($content_part_1,$content_part_2);
133 $sub_panels[] = $this->f->panel()->sub(
$title, $content);
137 $sub_panels[] = $this->f->panel()->sub(
139 $this->f->listing()->descriptive(
141 "Parents" => $this->f->listing()->ordered(
142 $this->entries->getParentsOfEntryTitles($this->entry->getId())
144 "Descendants" => $this->f->listing()->unordered(
145 $this->entries->getDescendantsOfEntryTitles($this->entry->getId())
151 $report = $this->f->panel()->report($this->entry->getTitle(), $sub_panels);
153 return $this->r->render($report);
160 public function getEntry()
168 public function setEntry(
Entry\ComponentEntry $entry)
170 $this->entry = $entry;
176 public function getEntries()
178 return $this->entries;
184 public function setEntries(
Entry\ComponentEntries $entries)
186 $this->entries = $entries;
192 public function getParent()
194 return $this->parent;
200 public function setParent($parent)
202 $this->parent = $parent;
if(strncmp( $real_path, SOURCE_ROOT, $base_path_len)) if(!file_exists($path)) $geshi
An exception for terminatinating execution or to throw for unit testing.