ILIAS  release_8 Revision v8.25-1-g13de6a5eca6
class.WikiPrintViewProviderGUI.php
Go to the documentation of this file.
1<?php
2
19namespace ILIAS\Wiki;
20
21use ILIAS\COPage;
22use ILIAS\Export;
24
30{
34 protected $lng;
35
39 protected $selected_pages = null;
40
44 protected $wiki;
45
49 protected $ctrl;
50
58 public function __construct(
61 int $wiki_ref_id,
62 ?array $selected_pages
63 ) {
64 $this->lng = $lng;
65 $this->ctrl = $ctrl;
66 $this->wiki = new \ilObjWiki($wiki_ref_id);
67 $this->selected_pages = (!is_null($selected_pages))
69 : array_map(
70 static function ($p) {
71 return $p["id"];
72 },
73 \ilWikiPage::getAllWikiPages($this->wiki->getId())
74 );
75 }
76
77 public function getTemplateInjectors(): array
78 {
79 $resource_collector = new COPage\ResourcesCollector(
81 new \ilWikiPage()
82 );
83 $resource_injector = new COPage\ResourcesInjector($resource_collector);
84
85 return [
86 function ($tpl) use ($resource_injector) {
87 $resource_injector->inject($tpl);
88 }
89 ];
90 }
91
92 public function getPages(): array
93 {
94 $print_pages = [];
95 foreach ($this->selected_pages as $p_id) {
96 $page_gui = new \ilWikiPageGUI($p_id);
97 $page_gui->setWiki($this->wiki);
98 $page_gui->setOutputMode($this->getOutputMode());
99 $print_pages[] = $page_gui->showPage();
100 }
101
102 return $print_pages;
103 }
104
106 {
108 $ilCtrl = $this->ctrl;
109
111 \ilObject::_lookupObjId($this->wiki->getRefId())
112 );
113
114 $form = new \ilPropertyFormGUI();
115
116 //var_dump($pages);
117 // selection type
118 $radg = new \ilRadioGroupInputGUI($lng->txt("cont_selection"), "sel_type");
119 $radg->setValue("page");
120 $op1 = new \ilRadioOption($lng->txt("cont_current_page"), "page");
121 $radg->addOption($op1);
122 $op2 = new \ilRadioOption($lng->txt("wiki_whole_wiki")
123 . " (" . $lng->txt("wiki_pages") . ": " . count($pages) . ")", "wiki");
124 $radg->addOption($op2);
125 $op3 = new \ilRadioOption($lng->txt("wiki_selected_pages"), "selection");
126 $radg->addOption($op3);
127
128 $nl = new \ilNestedListInputGUI("", "obj_id");
129 $op3->addSubItem($nl);
130
131 foreach ($pages as $p) {
132 $nl->addListNode(
133 $p["id"],
134 $p["title"],
135 0,
136 false,
137 false,
138 \ilUtil::getImagePath("icon_pg.svg"),
139 $lng->txt("wiki_page")
140 );
141 }
142
143 $form->addItem($radg);
144
145 $form->addCommandButton("printViewOrder", $lng->txt("wiki_show_print_view"));
146
147 $form->setTitle($lng->txt("cont_print_selection"));
148 $form->setFormAction(
149 $ilCtrl->getFormActionByClass(
150 "ilWikiPageGUI",
151 "printViewOrder"
152 )
153 );
154
155 return $form;
156 }
157}
Collects all js/css/onload resources necessary for page rendering.
Injects resources into a template.
__construct(\ilLanguage $lng, \ilCtrl $ctrl, int $wiki_ref_id, ?array $selected_pages)
PrintView constructor.
Class ilCtrl provides processing control methods.
language handling
static _lookupObjId(int $ref_id)
This class represents a property form user interface.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAllWikiPages(int $a_wiki_id)
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: PageLinker.php:19
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...