ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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.

References $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().

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  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
+ 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.

References Vendor\Package\$f.

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

◆ getModalElements()

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

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

References ILIAS\Export\PrintProcessGUI\$lng, ILIAS\Export\PrintProcessGUI\$ui, ILIAS\DI\UIServices\factory(), ILIAS\Repository\lng(), and ILIAS\DI\UIServices\mainTemplate().

88  : \stdClass {
89  $ui = $this->ui;
90  $lng = $this->lng;
91 
92  $ui->mainTemplate()->addJavaScript("./Services/Form/js/Form.js");
93  $modal = $ui->factory()->modal()->roundtrip(
94  $this->lng->txt("exp_print_pdf"),
95  $ui->factory()->legacy('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  }
factory()
Get the factory that crafts UI components.
Definition: UIServices.php:35
mainTemplate()
Get the ILIAS main template.
Definition: UIServices.php:53
+ Here is the call graph for this function:

◆ renderPrintView()

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

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

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

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

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  "Services/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 getStyleSheetLocation(string $mode="output", string $a_css_name="", string $a_css_location="")
get full style sheet file name (path inclusive) of current user
$path
Definition: ltiservices.php:32
static getContentStylePath(int $a_style_id, bool $add_random=true, bool $add_token=true)
get content style path static (to avoid full reading)
static initjQuery(ilGlobalTemplateInterface $a_tpl=null)
inits and adds the jQuery JS-File to the global or a passed template
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ send()

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

Send.

Parameters
string$output
Exceptions
HTTP

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

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

Referenced by ILIAS\Export\PrintProcessGUI\sendForm(), and ILIAS\Export\PrintProcessGUI\sendPrintView().

199  {
200  $this->http->saveResponse($this->http->response()->withBody(
201  Streams::ofString($output)
202  ));
203  $this->http->sendResponse();
204  $this->http->close();
205  }
static http()
Fetches the global http state from ILIAS.
static ofString(string $string)
Creates a new stream with an initial value.
Definition: Streams.php:43
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendForm()

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

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

References $tpl, ILIAS\Repository\lng(), ILIAS\Export\PrintProcessGUI\send(), and ILIAS\Repository\ui().

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, "Services/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(
123  $this->ui->renderer()->render($mb) .
124  $tpl->get()
125  )
126  );
127 
128  $this->send($this->ui->renderer()->render($modal));
129  }
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41
+ Here is the call graph for this function:

◆ sendPrintView()

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

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

References ILIAS\Export\PrintProcessGUI\renderPrintView(), and ILIAS\Export\PrintProcessGUI\send().

188  : void
189  {
190  $this->send($this->renderPrintView($content_style_id));
191  }
renderPrintView(int $content_style_id=0)
+ 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.

◆ $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

◆ $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

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