ILIAS  trunk Revision v11.0_alpha-1838-g59fc79e306b
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
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

bool $include_declaration = false
 
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 40 of file class.PortfolioPrintViewProviderGUI.php.

References ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$ctrl, $DIC, ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$include_declaration, 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().

47  {
48  global $DIC;
49 
50  $this->lng = $lng;
51  $this->ctrl = $ctrl;
52  $this->portfolio = $portfolio;
53  $this->selected_pages = $selected_pages;
54  $this->include_signature = $include_signature;
55  $this->include_declaration = $include_declaration;
56  $this->port_request = $DIC->portfolio()
57  ->internal()
58  ->gui()
59  ->standardRequest();
60  }
global $DIC
Definition: shib_login.php:22
+ 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 151 of file class.PortfolioPrintViewProviderGUI.php.

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

151  : array
152  {
153  $lng = $this->lng;
155 
157  $portfolio->getId()
158  );
159 
160  $print_pages = [];
161 
162  // cover page
163  $cover_tpl = new \ilTemplate(
164  "tpl.prtf_cover.html",
165  true,
166  true,
167  "components/ILIAS/Portfolio"
168  );
169  foreach ($pages as $page) {
170  if (is_array($this->selected_pages) &&
171  !in_array($page["id"], $this->selected_pages)) {
172  continue;
173  }
174  $cover_tpl->setCurrentBlock("content_item");
175  $cover_tpl->setVariable("ITEM_TITLE", $page["title"]);
176  $cover_tpl->parseCurrentBlock();
177  }
178 
179  if ($this->include_signature) {
180  $cover_tpl->setCurrentBlock("signature");
181  $cover_tpl->setVariable("TXT_SIGNATURE", $lng->txt("prtf_signature_date"));
182  $cover_tpl->parseCurrentBlock();
183  }
184 
185  if (!is_null($this->declaration_of_authorship) && $this->include_declaration) {
186  $cover_tpl->setCurrentBlock("decl_author");
187  $cover_tpl->setVariable(
188  "TXT_DECL_AUTHOR",
189  nl2br($this->declaration_of_authorship->getForUser($this->user))
190  );
191  $cover_tpl->parseCurrentBlock();
192  }
193 
194  $cover_tpl->setVariable("PORTFOLIO_TITLE", $this->portfolio->getTitle());
195  $cover_tpl->setVariable("PORTFOLIO_ICON", \ilUtil::getImagePath("standard/icon_prtf.svg"));
196 
197  $cover_tpl->setVariable("TXT_AUTHOR", $lng->txt("prtf_author"));
198  $cover_tpl->setVariable("TXT_LINK", $lng->txt("prtf_link"));
199  $cover_tpl->setVariable("TXT_DATE", $lng->txt("prtf_date_of_print"));
200  $cover_tpl->setVariable("TXT_TABLE_OF_CONTENTS", $lng->txt("prtf_table_of_contents"));
201 
202  $author = \ilObjUser::_lookupName($this->portfolio->getOwner());
203  $author_str = $author["firstname"] . " " . $author["lastname"];
204  $cover_tpl->setVariable("AUTHOR", $author_str);
205 
206  $href = \ilLink::_getStaticLink($this->portfolio->getId(), "prtf");
207  $cover_tpl->setVariable("LINK", $href);
208 
210  $date_str = \ilDatePresentation::formatDate(new \ilDate(date("Y-m-d"), IL_CAL_DATE));
211  $cover_tpl->setVariable("DATE", $date_str);
212 
213  $print_pages[] = $cover_tpl->get();
214 
215  $page_head_tpl = new \ilTemplate("tpl.prtf_page_head.html", true, true, "components/ILIAS/Portfolio");
216  $page_head_tpl->setVariable("AUTHOR", $author_str);
217  $page_head_tpl->setVariable("DATE", $date_str);
218  $page_head_str = $page_head_tpl->get();
219 
220  foreach ($pages as $page) {
221  if (is_array($this->selected_pages) &&
222  !in_array($page["id"], $this->selected_pages)) {
223  continue;
224  }
225  $page_gui = new \ilPortfolioPageGUI($this->portfolio->getId(), $page["id"]);
226  $page_gui->setOutputMode($this->getOutputMode());
227  $page_gui->setPresentationTitle($page["title"]);
228  $html = $this->ctrl->getHTML($page_gui);
229  $print_pages[] = $page_head_str . $html;
230  }
231 
232  return $print_pages;
233  }
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
static array static setUseRelativeDates(bool $a_status)
set use relative dates
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 _lookupName(int $a_user_id)
lookup user name
static getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
const IL_CAL_DATE
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)
+ 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 72 of file class.PortfolioPrintViewProviderGUI.php.

References ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$ctrl, ILIAS\Portfolio\PortfolioPrintViewProviderGUI\$lng, ilPortfolioPage\getAllPortfolioPages(), ilUtil\getImagePath(), and ILIAS\Repository\lng().

73  {
74  $lng = $this->lng;
75  $ilCtrl = $this->ctrl;
76 
77  $pages = \ilPortfolioPage::getAllPortfolioPages($this->portfolio->getId());
78 
79 
80  $form = new \ilPropertyFormGUI();
81 
82  // declaration of authorship
83  if ($this->declaration_of_authorship &&
84  $this->declaration_of_authorship->getForUser($this->user) !== "") {
85  $cb = new \ilCheckboxInputGUI($this->lng->txt("prtf_decl_authorship"), "decl_author");
86  $cb->setInfo($this->declaration_of_authorship->getForUser($this->user));
87  $form->addItem($cb);
88  }
89 
90  // signature
91  $cb = new \ilCheckboxInputGUI($this->lng->txt("prtf_signature"), "signature");
92  $cb->setInfo($this->lng->txt("prtf_signature_info"));
93  $form->addItem($cb);
94 
95 
96  // selection type
97  $radg = new \ilRadioGroupInputGUI($lng->txt("prtf_print_selection"), "sel_type");
98  $radg->setValue("all_pages");
99  $op2 = new \ilRadioOption($lng->txt("prtf_all_pages"), "all_pages");
100  $radg->addOption($op2);
101  $op3 = new \ilRadioOption($lng->txt("prtf_selected_pages"), "selection");
102  $radg->addOption($op3);
103 
104  $nl = new \ilNestedListInputGUI("", "obj_id");
105  $op3->addSubItem($nl);
106 
107  foreach ($pages as $p) {
108  $nl->addListNode(
109  $p["id"],
110  $p["title"],
111  0,
112  false,
113  false,
114  \ilUtil::getImagePath("standard/icon_pg.svg"),
115  $lng->txt("page")
116  );
117  }
118 
119  $form->addItem($radg);
120 
121  $form->addCommandButton("showPrintView", $lng->txt("exp_show_print_view"));
122 
123  $form->setTitle($lng->txt("prtf_print_options"));
124  $form->setFormAction(
125  $ilCtrl->getFormActionByClass(
126  "ilObjPortfolioGUI",
127  "showPrintView"
128  )
129  );
130 
131  return $form;
132  }
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 getImagePath(string $image_name, string $module_path="", string $mode="output", bool $offline=false)
get image path (for images located in a template directory)
+ 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 134 of file class.PortfolioPrintViewProviderGUI.php.

References ilPageObjectGUI\OFFLINE.

134  : array
135  {
136  $page = new \ilPortfolioPage();
137  $page->setEmptyPageXml();
138  $resource_collector = new COPage\ResourcesCollector(
140  $page
141  );
142  $resource_injector = new COPage\ResourcesInjector($resource_collector);
143 
144  return [
145  function ($tpl) use ($resource_injector) {
146  $resource_injector->inject($tpl);
147  }
148  ];
149  }

◆ withDeclarationOfAuthorship()

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

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

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

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

Field Documentation

◆ $ctrl

ilCtrl ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$ctrl
protected

◆ $declaration_of_authorship

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

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

◆ $include_declaration

bool ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$include_declaration = false
protected

◆ $include_signature

bool ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$include_signature
protected

◆ $lng

◆ $port_request

StandardGUIRequest ILIAS\Portfolio\PortfolioPrintViewProviderGUI::$port_request
protected

Definition at line 31 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: