ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 $page = new \ilWikiPage();
80 $page->setEmptyPageXml();
81 $resource_collector = new COPage\ResourcesCollector(
83 $page
84 );
85 $resource_injector = new COPage\ResourcesInjector($resource_collector);
86
87 return [
88 function ($tpl) use ($resource_injector) {
89 $resource_injector->inject($tpl);
90 }
91 ];
92 }
93
94 public function getPages(): array
95 {
96 $print_pages = [];
97 foreach ($this->selected_pages as $p_id) {
98 $page_gui = new \ilWikiPageGUI(
99 $p_id,
100 0,
101 $this->wiki->getRefId()
102 );
103 $page_gui->setWiki($this->wiki);
104 $page_gui->setOutputMode($this->getOutputMode());
105 $print_pages[] = $page_gui->showPage();
106 }
107
108 return $print_pages;
109 }
110
112 {
114 $ilCtrl = $this->ctrl;
115
117 \ilObject::_lookupObjId($this->wiki->getRefId())
118 );
119
120 $form = new \ilPropertyFormGUI();
121
122 //var_dump($pages);
123 // selection type
124 $radg = new \ilRadioGroupInputGUI($lng->txt("cont_selection"), "sel_type");
125 $radg->setValue("page");
126 $op1 = new \ilRadioOption($lng->txt("cont_current_page"), "page");
127 $radg->addOption($op1);
128 $op2 = new \ilRadioOption($lng->txt("wiki_whole_wiki")
129 . " (" . $lng->txt("wiki_pages") . ": " . count($pages) . ")", "wiki");
130 $radg->addOption($op2);
131 $op3 = new \ilRadioOption($lng->txt("wiki_selected_pages"), "selection");
132 $radg->addOption($op3);
133
134 $nl = new \ilNestedListInputGUI("", "obj_id");
135 $op3->addSubItem($nl);
136
137 foreach ($pages as $p) {
138 $nl->addListNode(
139 $p["id"],
140 $p["title"],
141 0,
142 false,
143 false,
144 \ilUtil::getImagePath("standard/icon_pg.svg"),
145 $lng->txt("wiki_page")
146 );
147 }
148
149 $form->addItem($radg);
150
151 $form->addCommandButton("printViewOrder", $lng->txt("wiki_show_print_view"));
152
153 $form->setTitle($lng->txt("cont_print_selection"));
154 $form->setFormAction(
155 $ilCtrl->getFormActionByClass(
156 "ilWikiPageGUI",
157 "printViewOrder"
158 )
159 );
160
161 return $form;
162 }
163}
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 $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static getAllWikiPages(int $a_wiki_id, string $lang="-")
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...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...