ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\Export\PrintProcessGUI Class Reference
+ Collaboration diagram for ILIAS\Export\PrintProcessGUI:

Public Member Functions

 __construct (PrintViewProvider $provider, \ILIAS\HTTP\Services $http, UIServices $ui, \ilLanguage $lng, ?string $body_class=null)
 PrintViewGUI constructor. More...
 
 setOffline (bool $offline)
 Set output mode. More...
 
 addTemplateInjector (callable $f)
 
 getModalElements (string $selection_action)
 
 sendForm ()
 
 renderPrintView (int $content_style_id=0)
 
 sendPrintView (int $content_style_id=0)
 

Protected Member Functions

 send (string $output)
 Send. More...
 

Protected Attributes

ILIAS GlobalScreen Services $gs
 
ilGlobalTemplateInterface $main_tpl
 
array $injectors = []
 
string $body_class = null
 
HTTP Services $http
 
UIServices $ui
 
ilLanguage $lng
 
PrintViewProvider $provider
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 30 of file class.PrintProcessGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Export\PrintProcessGUI::__construct ( PrintViewProvider  $provider,
\ILIAS\HTTP\Services  $http,
UIServices  $ui,
\ilLanguage  $lng,
?string  $body_class = null 
)

PrintViewGUI constructor.

Parameters
PrintViewProvider$provider
\ILIAS\HTTP\Services$http
UIServices$ui
\ilLanguage$lng
string | null$body_class

Definition at line 53 of file class.PrintProcessGUI.php.

59 {
60 global $DIC;
61
62 $this->provider = $provider;
63 $this->ui = $ui;
64 $this->lng = $lng;
65 $this->http = $http;
66 $this->body_class = $body_class ?? "ilPrtfPdfBody"; // todo: move this class
67 $this->lng->loadLanguageModule("exp");
68 $this->gs = $DIC->globalScreen();
69 }
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References ILIAS\Export\PrintProcessGUI\$body_class, $DIC, ILIAS\Export\PrintProcessGUI\$http, ILIAS\Export\PrintProcessGUI\$lng, ILIAS\Export\PrintProcessGUI\$provider, ILIAS\Export\PrintProcessGUI\$ui, ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

Member Function Documentation

◆ addTemplateInjector()

ILIAS\Export\PrintProcessGUI::addTemplateInjector ( callable  $f)

Definition at line 81 of file class.PrintProcessGUI.php.

81 : void
82 {
83 $this->injectors[] = $f;
84 }

References Vendor\Package\$f.

◆ getModalElements()

ILIAS\Export\PrintProcessGUI::getModalElements ( string  $selection_action)

Definition at line 86 of file class.PrintProcessGUI.php.

88 : \stdClass {
89 $ui = $this->ui;
91
92 $ui->mainTemplate()->addJavaScript("assets/js/Form.js");
93 $modal = $ui->factory()->modal()->roundtrip(
94 $this->lng->txt("exp_print_pdf"),
95 $ui->factory()->legacy()->content('some modal')
96 )->withAsyncRenderUrl($selection_action);
97 $print_button = $ui->factory()->button()->standard(
98 $this->lng->txt("exp_print_pdf"),
99 $modal->getShowSignal()
100 );
101 $elements = new \stdClass();
102 $elements->button = $print_button;
103 $elements->modal = $modal;
104
105 return $elements;
106 }
mainTemplate()
Get the ILIAS main template.
Definition: UIServices.php:54
factory()
Get the factory that crafts UI components.
Definition: UIServices.php:36

◆ renderPrintView()

ILIAS\Export\PrintProcessGUI::renderPrintView ( int  $content_style_id = 0)

Definition at line 131 of file class.PrintProcessGUI.php.

131 : string
132 {
133 \iljQueryUtil::initjQuery(); // e.g. on survey print screens necessary
134 $pages = $this->provider->getPages();
135 $tpl = new \ilGlobalTemplate(
136 "tpl.print_view.html",
137 true,
138 true,
139 "components/ILIAS/Export/Print"
140 );
141
142 // get all current resources from globalscreen and add them to our template
143 foreach ($this->gs->layout()->meta()->getJs()->getItemsInOrderOfDelivery() as $js) {
144 $path = explode("?", $js->getContent());
145 $file = $path[0];
146 $tpl->addJavaScript($file, $js->addVersionNumber());
147 }
148 foreach ($this->gs->layout()->meta()->getOnLoadCode()->getItemsInOrderOfDelivery() as $code) {
149 $tpl->addOnLoadCode($code->getContent());
150 }
151
152 //\iljQueryUtil::initjQuery($tpl);
153
154 foreach ($this->provider->getTemplateInjectors() as $f) {
155 $f($tpl);
156 }
157
158 $tpl->setBodyClass($this->body_class);
159 $tpl->addCss(\ilUtil::getStyleSheetLocation("filesystem"));
160 $tpl->addCss(
162 $content_style_id,
163 false
164 )
165 );
168
169 $pb = ($this->provider->autoPageBreak())
170 ? '<div style="page-break-after:always;"></div>'
171 : "";
172
173 $content = implode(
174 $pb,
175 $pages
176 );
177
178 $content = '<div class="ilInvisibleBorder">' . $content . '</div>';
179 $tpl->addOnLoadCode("il.Util.print();");
180
181 $tpl->setVariable("CONTENT", $content);
182 return $tpl->printToString();
183 }
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static getStyleSheetLocation(string $mode="output", string $a_css_name="")
get full style sheet file name (path inclusive) of current user
static initjQuery(?ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
$path
Definition: ltiservices.php:30

References Vendor\Package\$f, $path, ilObjStyleSheet\getContentPrintStyle(), ilObjStyleSheet\getContentStylePath(), ilUtil\getStyleSheetLocation(), ilObjStyleSheet\getSyntaxStylePath(), and iljQueryUtil\initjQuery().

+ Here is the call graph for this function:

◆ send()

ILIAS\Export\PrintProcessGUI::send ( string  $output)
protected

Send.

Parameters
string$output
Exceptions
HTTP

Response\Sender\ResponseSendingException

Definition at line 198 of file class.PrintProcessGUI.php.

199 {
200 $this->http->saveResponse($this->http->response()->withBody(
201 Streams::ofString($output)
202 ));
203 $this->http->sendResponse();
204 $this->http->close();
205 }
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:41

References ILIAS\FileDelivery\http(), and ILIAS\Filesystem\Stream\Streams\ofString().

+ Here is the call graph for this function:

◆ sendForm()

ILIAS\Export\PrintProcessGUI::sendForm ( )
Parameters
\ilPropertyFormGUI$form
Exceptions
HTTP

Response\Sender\ResponseSendingException

Definition at line 112 of file class.PrintProcessGUI.php.

112 : void
113 {
114 $form = $this->provider->getSelectionForm();
115 $mb = $this->ui->factory()->messageBox()->info($this->lng->txt("exp_print_pdf_info"));
116 $tpl = new \ilTemplate("tpl.print_view_selection.html", true, true, "components/ILIAS/Export/Print");
117 $form->setTarget("print_view");
118 $tpl->setVariable("FORM", $form->getHTML());
119 $tpl->setVariable("ON_SUBMIT_CODE", $this->provider->getOnSubmitCode());
120 $modal = $this->ui->factory()->modal()->roundtrip(
121 $this->lng->txt("exp_print_pdf"),
122 $this->ui->factory()->legacy()->content(
123 $this->ui->renderer()->render($mb) .
124 $tpl->get()
125 )
126 );
127
128 $this->send($this->ui->renderer()->render($modal));
129 }

References ILIAS\Repository\lng(), send(), and ILIAS\Repository\ui().

+ Here is the call graph for this function:

◆ sendPrintView()

ILIAS\Export\PrintProcessGUI::sendPrintView ( int  $content_style_id = 0)
Exceptions
HTTP

Response\Sender\ResponseSendingException

Definition at line 188 of file class.PrintProcessGUI.php.

188 : void
189 {
190 $this->send($this->renderPrintView($content_style_id));
191 }
renderPrintView(int $content_style_id=0)

References send().

+ Here is the call graph for this function:

◆ setOffline()

ILIAS\Export\PrintProcessGUI::setOffline ( bool  $offline)

Set output mode.

Parameters
string$a_valself::PRINT|self::OFFLINE

Definition at line 75 of file class.PrintProcessGUI.php.

76 {
77 $this->provider->setOffline($offline);
78 }

Field Documentation

◆ $body_class

string ILIAS\Export\PrintProcessGUI::$body_class = null
protected

Definition at line 38 of file class.PrintProcessGUI.php.

Referenced by ILIAS\Export\PrintProcessGUI\__construct().

◆ $gs

ILIAS GlobalScreen Services ILIAS\Export\PrintProcessGUI::$gs
protected

Definition at line 32 of file class.PrintProcessGUI.php.

◆ $http

HTTP Services ILIAS\Export\PrintProcessGUI::$http
protected

Definition at line 40 of file class.PrintProcessGUI.php.

Referenced by ILIAS\Export\PrintProcessGUI\__construct().

◆ $injectors

array ILIAS\Export\PrintProcessGUI::$injectors = []
protected

Definition at line 37 of file class.PrintProcessGUI.php.

◆ $lng

ilLanguage ILIAS\Export\PrintProcessGUI::$lng
protected

Definition at line 42 of file class.PrintProcessGUI.php.

Referenced by ILIAS\Export\PrintProcessGUI\__construct().

◆ $main_tpl

ilGlobalTemplateInterface ILIAS\Export\PrintProcessGUI::$main_tpl
protected

Definition at line 33 of file class.PrintProcessGUI.php.

◆ $provider

PrintViewProvider ILIAS\Export\PrintProcessGUI::$provider
protected

Definition at line 43 of file class.PrintProcessGUI.php.

Referenced by ILIAS\Export\PrintProcessGUI\__construct().

◆ $ui

UIServices ILIAS\Export\PrintProcessGUI::$ui
protected

Definition at line 41 of file class.PrintProcessGUI.php.

Referenced by ILIAS\Export\PrintProcessGUI\__construct().


The documentation for this class was generated from the following file: