ILIAS  release_8 Revision v8.23
ILIAS\Portfolio\PortfolioPrintViewProviderGUI Class Reference
+ Inheritance diagram for ILIAS\Portfolio\PortfolioPrintViewProviderGUI:
+ Collaboration diagram for ILIAS\Portfolio\PortfolioPrintViewProviderGUI:

Public Member Functions

 __construct (\ilLanguage $lng, \ilCtrl $ctrl, \ilObjPortfolio $portfolio, bool $include_signature=false, array $selected_pages=null, bool $include_declaration=false)
 
 withDeclarationOfAuthorship (\ilPortfolioDeclarationOfAuthorship $decl, \ilObjUser $user)
 
 getSelectionForm ()
 form which is featured in the modal form target is modified to open in new window (not yet possible with ks forms) the print/pdf message is added automatically More...
 
 getTemplateInjectors ()
 
 getPages ()
 
- Public Member Functions inherited from ILIAS\Export\AbstractPrintViewProvider
 setOffline (bool $offline)
 Set output mode. More...
 
 getOnSubmitCode ()
 
 autoPageBreak ()
 
 getSelectionForm ()
 
 getPages ()
 
 getTemplateInjectors ()
 

Protected Attributes

StandardGUIRequest $port_request
 
ilLanguage $lng
 
ilObjPortfolio $portfolio
 
array $selected_pages = null
 
bool $include_signature
 
ilPortfolioDeclarationOfAuthorship $declaration_of_authorship = null
 
ilObjUser $user
 
ilCtrl $ctrl
 
- Protected Attributes inherited from ILIAS\Export\AbstractPrintViewProvider
 $offline = false
 

Additional Inherited Members

- Data Fields inherited from ILIAS\Export\AbstractPrintViewProvider
const PRINT = "print"
 
const OFFLINE = "offline"
 
- Protected Member Functions inherited from ILIAS\Export\AbstractPrintViewProvider
 getOutputMode ()
 Get output mode. More...
 

Detailed Description

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

Definition at line 28 of file class.PortfolioPrintViewProviderGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\Portfolio\PortfolioPrintViewProviderGUI::__construct ( \ilLanguage  $lng,
\ilCtrl  $ctrl,
\ilObjPortfolio  $portfolio,
bool  $include_signature = false,
array  $selected_pages = null,
bool  $include_declaration = false 
)

Definition at line 39 of file class.PortfolioPrintViewProviderGUI.php.

References ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$ctrl, $DIC, ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$include_signature, ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$lng, ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$portfolio, ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$selected_pages, ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

46  {
47  global $DIC;
48 
49  $this->lng = $lng;
50  $this->ctrl = $ctrl;
51  $this->portfolio = $portfolio;
52  $this->selected_pages = $selected_pages;
53  $this->include_signature = $include_signature;
54  $this->include_declaration = $include_declaration;
55  $this->port_request = $DIC->portfolio()
56  ->internal()
57  ->gui()
58  ->standardRequest();
59  }
global $DIC
Definition: feed.php:28
+ Here is the call graph for this function:

Member Function Documentation

◆ getPages()

ILIAS\Portfolio\PortfolioPrintViewProviderGUI::getPages ( )
Returns
string[]

Implements ILIAS\Export\PrintViewProvider.

Definition at line 172 of file class.PortfolioPrintViewProviderGUI.php.

References ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$lng, ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$portfolio, ilLink\_getStaticLink(), ilObjUser\_lookupName(), ilObject\_lookupTitle(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilPortfolioPage\getAllPortfolioPages(), ilBlogPosting\getAllPostings(), ilUtil\getImagePath(), ILIAS\Export\AbstractPrintViewProvider\getOutputMode(), IL_CAL_DATE, ilDatePresentation\setUseRelativeDates(), and ilPortfolioPage\TYPE_BLOG.

172  : array
173  {
174  $lng = $this->lng;
176 
178  $portfolio->getId()
179  );
180 
181  $print_pages = [];
182 
183  // cover page
184  $cover_tpl = new \ilTemplate(
185  "tpl.prtf_cover.html",
186  true,
187  true,
188  "Modules/Portfolio"
189  );
190  foreach ($pages as $page) {
191  if ($page["type"] != \ilPortfolioPage::TYPE_BLOG) {
192  if (is_array($this->selected_pages) &&
193  !in_array($page["id"], $this->selected_pages)) {
194  continue;
195  }
196  $cover_tpl->setCurrentBlock("content_item");
197  $cover_tpl->setVariable("ITEM_TITLE", $page["title"]);
198  } else {
199  $cover_tpl->setCurrentBlock("content_item");
200  $cover_tpl->setVariable("ITEM_TITLE", $lng->txt("obj_blog") . ": " . \ilObject::_lookupTitle($page["title"]));
201  }
202  $cover_tpl->parseCurrentBlock();
203  }
204 
205  if ($this->include_signature) {
206  $cover_tpl->setCurrentBlock("signature");
207  $cover_tpl->setVariable("TXT_SIGNATURE", $lng->txt("prtf_signature_date"));
208  $cover_tpl->parseCurrentBlock();
209  }
210 
211  if (!is_null($this->declaration_of_authorship) && $this->include_declaration) {
212  $cover_tpl->setCurrentBlock("decl_author");
213  $cover_tpl->setVariable(
214  "TXT_DECL_AUTHOR",
215  nl2br($this->declaration_of_authorship->getForUser($this->user))
216  );
217  $cover_tpl->parseCurrentBlock();
218  }
219 
220  $cover_tpl->setVariable("PORTFOLIO_TITLE", $this->portfolio->getTitle());
221  $cover_tpl->setVariable("PORTFOLIO_ICON", \ilUtil::getImagePath("icon_prtf.svg"));
222 
223  $cover_tpl->setVariable("TXT_AUTHOR", $lng->txt("prtf_author"));
224  $cover_tpl->setVariable("TXT_LINK", $lng->txt("prtf_link"));
225  $cover_tpl->setVariable("TXT_DATE", $lng->txt("prtf_date_of_print"));
226 
227  $author = \ilObjUser::_lookupName($this->portfolio->getOwner());
228  $author_str = $author["firstname"] . " " . $author["lastname"];
229  $cover_tpl->setVariable("AUTHOR", $author_str);
230 
231  $href = \ilLink::_getStaticLink($this->portfolio->getId(), "prtf");
232  $cover_tpl->setVariable("LINK", $href);
233 
235  $date_str = \ilDatePresentation::formatDate(new \ilDate(date("Y-m-d"), IL_CAL_DATE));
236  $cover_tpl->setVariable("DATE", $date_str);
237 
238  $print_pages[] = $cover_tpl->get();
239 
240  $page_head_tpl = new \ilTemplate("tpl.prtf_page_head.html", true, true, "Modules/Portfolio");
241  $page_head_tpl->setVariable("AUTHOR", $author_str);
242  $page_head_tpl->setVariable("DATE", $date_str);
243  $page_head_str = $page_head_tpl->get();
244 
245  foreach ($pages as $page) {
246  if ($page["type"] != \ilPortfolioPage::TYPE_BLOG) {
247  if (is_array($this->selected_pages) &&
248  !in_array($page["id"], $this->selected_pages)) {
249  continue;
250  }
251 
252  $page_gui = new \ilPortfolioPageGUI($this->portfolio->getId(), $page["id"]);
253  $page_gui->setOutputMode($this->getOutputMode());
254  $page_gui->setPresentationTitle($page["title"]);
255  $html = $this->ctrl->getHTML($page_gui);
256  $print_pages[] = $page_head_str . $html;
257  } else {
258  $pages2 = \ilBlogPosting::getAllPostings($page["title"]);
259  foreach ($pages2 as $p2) {
260  if ($this->port_request->getPrintSelectedType() === "selection" &&
261  (!in_array("b" . $p2["id"], $this->port_request->getObjIds()))) {
262  continue;
263  }
264  $page_gui = new \ilBlogPostingGUI(0, null, $p2["id"]);
265  $page_gui->setFileDownloadLink("#");
266  $page_gui->setFullscreenLink("#");
267  $page_gui->setSourcecodeDownloadScript("#");
268  $page_gui->setOutputMode($this->getOutputMode());
269  $print_pages[] = $page_head_str . $page_gui->showPage(\ilObject::_lookupTitle($page["title"]) . ": " . $page_gui->getBlogPosting()->getTitle());
270  }
271  }
272  }
273 
274  return $print_pages;
275  }
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static _lookupName(int $a_user_id)
lookup user name
static _lookupTitle(int $obj_id)
const IL_CAL_DATE
static setUseRelativeDates(bool $a_status)
set use relative dates
+ Here is the call graph for this function:

◆ getSelectionForm()

ILIAS\Portfolio\PortfolioPrintViewProviderGUI::getSelectionForm ( )

form which is featured in the modal form target is modified to open in new window (not yet possible with ks forms) the print/pdf message is added automatically

Returns
ilPropertyFormGUI|null

Implements ILIAS\Export\PrintViewProvider.

Definition at line 71 of file class.PortfolioPrintViewProviderGUI.php.

References ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$ctrl, ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$lng, ilObject\_lookupTitle(), ilPortfolioPage\getAllPortfolioPages(), ilBlogPosting\getAllPostings(), ilUtil\getImagePath(), ILIAS\Repository\lng(), and ilPortfolioPage\TYPE_BLOG.

72  {
73  $lng = $this->lng;
74  $ilCtrl = $this->ctrl;
75 
76  $pages = \ilPortfolioPage::getAllPortfolioPages($this->portfolio->getId());
77 
78 
79  $form = new \ilPropertyFormGUI();
80 
81  // declaration of authorship
82  if ($this->declaration_of_authorship &&
83  $this->declaration_of_authorship->getForUser($this->user) !== "") {
84  $cb = new \ilCheckboxInputGUI($this->lng->txt("prtf_decl_authorship"), "decl_author");
85  $cb->setInfo($this->declaration_of_authorship->getForUser($this->user));
86  $form->addItem($cb);
87  }
88 
89  // signature
90  $cb = new \ilCheckboxInputGUI($this->lng->txt("prtf_signature"), "signature");
91  $cb->setInfo($this->lng->txt("prtf_signature_info"));
92  $form->addItem($cb);
93 
94 
95  // selection type
96  $radg = new \ilRadioGroupInputGUI($lng->txt("prtf_print_selection"), "sel_type");
97  $radg->setValue("all_pages");
98  $op2 = new \ilRadioOption($lng->txt("prtf_all_pages"), "all_pages");
99  $radg->addOption($op2);
100  $op3 = new \ilRadioOption($lng->txt("prtf_selected_pages"), "selection");
101  $radg->addOption($op3);
102 
103  $nl = new \ilNestedListInputGUI("", "obj_id");
104  $op3->addSubItem($nl);
105 
106  foreach ($pages as $p) {
107  if ($p["type"] != \ilPortfolioPage::TYPE_BLOG) {
108  $nl->addListNode(
109  $p["id"],
110  $p["title"],
111  0,
112  false,
113  false,
114  \ilUtil::getImagePath("icon_pg.svg"),
115  $lng->txt("page")
116  );
117  } else {
118  $nl->addListNode(
119  $p["id"],
120  $lng->txt("obj_blog") . ": " . \ilObject::_lookupTitle($p["title"]),
121  0,
122  false,
123  false,
124  \ilUtil::getImagePath("icon_blog.svg"),
125  $lng->txt("obj_blog")
126  );
127  $pages2 = \ilBlogPosting::getAllPostings($p["title"]);
128  foreach ($pages2 as $p2) {
129  $nl->addListNode(
130  "b" . $p2["id"],
131  $p2["title"],
132  $p["id"],
133  false,
134  false,
135  \ilUtil::getImagePath("icon_pg.svg"),
136  $lng->txt("page")
137  );
138  }
139  }
140  }
141 
142  $form->addItem($radg);
143 
144  $form->addCommandButton("showPrintView", $lng->txt("exp_show_print_view"));
145 
146  $form->setTitle($lng->txt("prtf_print_options"));
147  $form->setFormAction(
148  $ilCtrl->getFormActionByClass(
149  "ilObjPortfolioGUI",
150  "showPrintView"
151  )
152  );
153 
154  return $form;
155  }
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static getAllPostings(int $a_blog_id, int $a_limit=1000, int $a_offset=0)
Get all postings of blog.
static getImagePath(string $img, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
static _lookupTitle(int $obj_id)
+ Here is the call graph for this function:

◆ getTemplateInjectors()

ILIAS\Portfolio\PortfolioPrintViewProviderGUI::getTemplateInjectors ( )
Returns
callable[] each callable gets the $tpl passed to inject css/js/...

Implements ILIAS\Export\PrintViewProvider.

Definition at line 157 of file class.PortfolioPrintViewProviderGUI.php.

References $tpl, and ilPageObjectGUI\OFFLINE.

157  : array
158  {
159  $resource_collector = new COPage\ResourcesCollector(
161  new \ilPortfolioPage()
162  );
163  $resource_injector = new COPage\ResourcesInjector($resource_collector);
164 
165  return [
166  function ($tpl) use ($resource_injector) {
167  $resource_injector->inject($tpl);
168  }
169  ];
170  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if($DIC->http() ->request() ->getMethod()=="GET" &&isset($DIC->http() ->request() ->getQueryParams()['tex'])) $tpl
Definition: latex.php:41

◆ withDeclarationOfAuthorship()

ILIAS\Portfolio\PortfolioPrintViewProviderGUI::withDeclarationOfAuthorship ( \ilPortfolioDeclarationOfAuthorship  $decl,
\ilObjUser  $user 
)

Definition at line 61 of file class.PortfolioPrintViewProviderGUI.php.

References $c, and ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$user.

64  : self {
65  $c = clone $this;
66  $c->declaration_of_authorship = $decl;
67  $c->user = $user;
68  return $c;
69  }
$c
Definition: cli.php:38

Field Documentation

◆ $ctrl

ilCtrl ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$ctrl
protected

◆ $declaration_of_authorship

ilPortfolioDeclarationOfAuthorship ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$declaration_of_authorship = null
protected

Definition at line 35 of file class.PortfolioPrintViewProviderGUI.php.

◆ $include_signature

bool ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$include_signature
protected

◆ $lng

◆ $port_request

StandardGUIRequest ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$port_request
protected

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

◆ $portfolio

ilObjPortfolio ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$portfolio
protected

◆ $selected_pages

array ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$selected_pages = null
protected

◆ $user

ilObjUser ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$user
protected

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