29 protected \ILIAS\Notes\Service
$notes;
30 protected \ILIAS\Portfolio\InternalGUIService
$gui;
41 protected \ILIAS\DI\UIServices
$ui;
42 protected \ILIAS\HTTP\Services
$http;
48 int $a_id_type = self::REPOSITORY_NODE_ID,
49 int $a_parent_node_id = 0
53 $this->
user = $DIC->user();
54 $this->
locator = $DIC[
"ilLocator"];
55 $this->
toolbar = $DIC->toolbar();
57 $this->tree = $DIC->repositoryTree();
58 $this->
help = $DIC[
"ilHelp"];
59 $this->tpl = $DIC[
"tpl"];
60 $ilUser = $DIC->user();
61 $this->
ui = $DIC->ui();
63 $this->port_request = $DIC->portfolio()
68 $this->
http = $DIC->http();
72 $this->user_id = $ilUser->getId();
74 $this->
lng->loadLanguageModule(
"prtf");
75 $this->
lng->loadLanguageModule(
"user");
76 $this->
lng->loadLanguageModule(
"obj");
78 $this->requested_ppage = $this->port_request->getPortfolioPageId();
79 $this->requested_user_page = $this->port_request->getUserPage();
82 $back = str_replace(
"&",
":::", $this->port_request->getBackUrl());
84 "/[^a-zA-Z0-9_\.\?=:\s]/",
88 $this->requested_back_url = str_replace(
":::",
"&", $back);
90 $this->
ctrl->setParameterByClass(
"ilobjportfoliogui",
"back_url", rawurlencode($this->requested_back_url));
91 $cs = $DIC->contentStyle();
92 $this->content_style_gui = $cs->gui();
94 $this->content_style_domain = $cs->domain()->styleForObjId($this->
object->getId());
96 $this->gui = $DIC->portfolio()->internal()->gui();
97 $this->notes = $DIC->notes();
106 strip_tags($this->
object->getTitle()),
107 $this->
ctrl->getLinkTarget($this,
"view")
111 if ($this->page_id > 0) {
113 $title = $page->getTitle();
120 $this->
ctrl->getLinkTargetByClass($this->getPageGUIClassName(),
"edit")
128 if ($this->requested_ppage > 0) {
130 $this->
ctrl->redirect($this,
"view");
134 $this->page_mode =
"edit";
135 $this->
ctrl->setParameter($this,
"ppage", $this->page_id);
141 $this->page_mode =
"preview";
142 $this->
ctrl->setParameter($this,
"user_page", $this->page_id);
148 if (!$this->page_id) {
149 $this->
ctrl->redirect($this,
"view");
154 $this->tabs_gui->clearTargets();
155 $this->tabs_gui->setBackTarget(
156 $this->
lng->txt(
"back"),
157 $this->
ctrl->getLinkTarget($this,
"view")
161 $page_gui->setStyleId($this->content_style_domain->getEffectiveStyleId());
163 $ret = $this->
ctrl->forwardCommand($page_gui);
164 if ($ret !=
"" && $ret !==
true) {
166 if ($this->page_mode ===
"preview") {
170 $this->preview(
false, $ret, ($a_cmd !==
"previewEmbedded"));
172 $this->preview(
false);
178 if (is_string($ret)) {
179 $this->tpl->setContent($ret);
190 $this->additional = $a_additional;
205 $this->perma_link = array(
"obj_id" => $a_obj_id,
"type" => $a_type);
216 $this->
lng->loadLanguageModule($this->
getType());
219 $this->tabs_gui->addSubTab(
221 $this->
lng->txt($this->getType() .
"_properties"),
222 $this->
ctrl->getLinkTarget($this,
'edit')
225 $this->tabs_gui->addSubTab(
227 $this->
lng->txt(
"obj_sty"),
228 $this->
ctrl->getLinkTargetByClass(
"ilobjectcontentstylesettingsgui",
"")
231 $this->tabs_gui->activateSubTab($a_active);
244 if ($prfa_set->get(
"banner")) {
245 $dimensions =
" (" . $prfa_set->get(
"banner_width") .
"x" .
246 $prfa_set->get(
"banner_height") .
")";
252 $file = $this->
object->getImageFullPath(
true);
259 $section->setTitle($this->
lng->txt(
'obj_features'));
277 $a_values[
"comments"] = $this->
object->hasPublicComments();
278 $a_values[
"ppic"] = $this->
object->hasProfilePicture();
287 $this->
object->setPublicComments($form->
getInput(
"comments"));
288 $this->
object->setProfilePicture($form->
getInput(
"ppic"));
296 if (isset($_FILES[
"banner"]) && $_FILES[
"banner"][
"tmp_name"]) {
297 $this->
object->uploadImage($_FILES[
"banner"]);
298 } elseif ($prfa_set->get(
'banner') && $form->
getItemByPostVar(
"banner")->getDeletionFlag()) {
299 $this->
object->deleteImage();
309 ?
int $a_page_id = null,
310 ?
int $a_portfolio_id = null
327 $this->
ctrl->redirect($this,
"infoScreen");
330 $this->tabs_gui->activateTab(
"pages");
335 $this->
lng->txt(
"prtf_add_page"),
336 $this->
ctrl->getLinkTarget($this,
"addPage")
341 $this->
lng->txt(
"prtf_add_blog"),
342 $this->
ctrl->getLinkTarget($this,
"addBlog")
349 if ($this->
getType() ===
"prtf" && count($pages) > 0) {
350 $ilToolbar->addSeparator();
354 if ($this->
object->isCommentsExportPossible()) {
355 $this->
lng->loadLanguageModule(
"note");
356 $comment_export_helper = new \ILIAS\Notes\Export\ExportHelperGUI();
357 $comment_modal = $comment_export_helper->getCommentIncludeModalDialog(
358 $this->
lng->txt(
"export_html"),
359 $this->
lng->txt(
"note_html_export_include_comments"),
360 $this->
ctrl->getLinkTarget($this,
"export"),
361 $this->
ctrl->getLinkTarget($this,
"exportWithComments")
363 $button = $ui->factory()->button()->standard($this->
lng->txt(
"export_html"),
'')
364 ->withOnClick($comment_modal->getShowSignal());
365 $ilToolbar->addComponent($button);
366 $modal_html = $ui->renderer()->render($comment_modal);
369 $this->
lng->txt(
"export_html"),
370 $this->
ctrl->getLinkTarget($this,
"export")
374 $print_view = $this->getPrintView();
375 $modal_elements = $print_view->getModalElements($this->
ctrl->getLinkTarget(
379 $modal_html .= $ui->renderer()->render($modal_elements->modal);
380 $ilToolbar->addComponent($modal_elements->button);
386 $this->tpl->setContent($table->getHTML() . $modal_html);
391 $obj_ids = $this->port_request->getObjIds();
392 $signature = $this->port_request->getSignature();
393 $declaration = $this->port_request->getIncludeDeclaration();
394 if (count($obj_ids) === 0) {
411 return new \ILIAS\Export\PrintProcessGUI(
426 $this->tabs_gui->clearTargets();
427 $this->tabs_gui->setBackTarget(
428 $this->
lng->txt(
"back"),
429 $this->
ctrl->getLinkTarget($this,
"view")
433 $ilHelp->setScreenId(
"add_page");
437 $this->tpl->setContent($form->getHTML());
446 $form->setFormAction($this->
ctrl->getFormAction($this));
450 $ti->setMaxLength(200);
451 $ti->setRequired(
true);
455 if ($a_mode ===
"create") {
460 $form->addItem($use_template);
463 $use_template->addOption($opt);
465 foreach ($templates as $templ) {
466 $templ->readObject();
468 $opt =
new ilRadioOption($templ->getTitle() . $templ->getPreview(), $templ->getId());
469 $use_template->addOption($opt);
473 $form->
setTitle($this->
lng->txt(
"prtf_add_page") .
": " .
474 $this->
object->getTitle());
475 $form->addCommandButton(
"savePage", $this->
lng->txt(
"save"));
476 $form->addCommandButton(
"view", $this->
lng->txt(
"cancel"));
491 $page->setTitle($form->getInput(
"title"));
494 $layout_id = $form->getInput(
"tmpl");
497 $page->setXMLContent($layout_obj->copyXmlContent(
false));
502 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_page_created"),
true);
503 $this->
ctrl->redirect($this,
"view");
506 $this->tabs_gui->clearTargets();
507 $this->tabs_gui->setBackTarget(
508 $this->
lng->txt(
"back"),
509 $this->
ctrl->getLinkTarget($this,
"view")
512 $form->setValuesByPost();
513 $this->tpl->setContent($form->getHTML());
523 $this->tabs_gui->clearTargets();
524 $this->tabs_gui->setBackTarget(
525 $this->
lng->txt(
"back"),
526 $this->
ctrl->getLinkTarget($this,
"view")
530 $ilHelp->setScreenId(
"add_blog");
533 $this->tpl->setContent($form->getHTML());
538 abstract protected function saveBlog(): void;
549 $title_changes = array();
551 $order = $this->port_request->getOrder();
552 $titles = $this->port_request->getTitles();
553 if (count($order) > 0) {
554 foreach ($order as $k => $v) {
556 if ($titles[$k] ??
"") {
557 $new_title = $titles[$k] ??
"";
558 if ($page->getTitle() != $new_title) {
559 $title_changes[$page->getId()] = array(
"old" => $page->getTitle(),
"new" => $new_title);
560 $page->setTitle($new_title);
569 $this->
object->fixLinksOnTitleChange($title_changes);
571 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"msg_obj_modified"),
true);
572 $this->
ctrl->redirect($this,
"view");
577 $prtf_pages = $this->port_request->getPortfolioPageIds();
579 if (count($prtf_pages) === 0) {
580 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_checkbox"),
true);
581 $this->
ctrl->redirect($this,
"view");
583 $this->tabs_gui->activateTab(
"pages");
586 $cgui->setFormAction($this->
ctrl->getFormAction($this));
587 $cgui->setHeaderText($this->
lng->txt(
"prtf_sure_delete_portfolio_pages"));
588 $cgui->setCancel($this->
lng->txt(
"cancel"),
"view");
589 $cgui->setConfirm($this->
lng->txt(
"delete"),
"deletePortfolioPages");
591 foreach ($prtf_pages as
$id) {
593 if ($page->getPortfolioId() !== $this->
object->getId()) {
597 $title = $page->getTitle();
601 $cgui->addItem(
"prtf_pages[]", $id, $title);
604 $this->tpl->setContent($cgui->getHTML());
614 $page_ids = $this->port_request->getPortfolioPageIds();
615 foreach ($page_ids as
$id) {
619 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_portfolio_page_deleted"),
true);
620 $this->
ctrl->redirect($this,
"view");
626 public function preview(
627 bool $a_return =
false,
629 bool $a_show_notes =
true 633 $portfolio_id = $this->
object->
getId();
634 $user_id = $this->
object->getOwner();
638 $this->tabs_gui->clearTargets();
646 $this->tpl->setLoginTargetPar(
"prtf_" . $this->
object->getId() .
"_" . $current_page);
652 if ($this->requested_back_url !=
"") {
654 } elseif (strtolower($this->port_request->getBaseClass()) !==
"ilpublicuserprofilegui" &&
658 if ($this->
getType() ===
"prtf") {
659 $this->
ctrl->setParameterByClass(
"ilportfoliorepositorygui",
"shr_id", $this->
object->getOwner());
660 $back = $this->
ctrl->getLinkTargetByClass(array(
"ildashboardgui",
"ilportfoliorepositorygui"),
"showOther");
661 $this->
ctrl->setParameterByClass(
"ilportfoliorepositorygui",
"shr_id",
"");
673 $back = $this->
ctrl->getLinkTarget($this,
"view");
674 if ($this->
getType() ===
"prtf") {
675 $back_caption = $this->
lng->txt(
"prtf_back_to_portfolio_owner");
678 $this->
lng->loadLanguageModule(
"prtt");
679 $back_caption = $this->
lng->txt(
"prtt_edit");
685 $current_blog = null;
686 if (count($pages) > 1) {
687 foreach ($pages as $p) {
690 if ($p[
"id"] == $current_page) {
691 $current_blog = (
int) $p[
"title"];
696 $this->
ctrl->setParameter($this,
"user_page", $p[
"id"]);
697 $this->tabs_gui->addTab(
698 "user_page_" . $p[
"id"],
700 $this->
ctrl->getLinkTarget($this,
"preview")
704 $this->tabs_gui->activateTab(
"user_page_" . $current_page);
707 $this->
ctrl->setParameter($this,
"user_page", $current_page);
714 if ($a_show_notes && $this->
object->hasPublicComments() && !$current_blog && $current_page) {
716 $next_class = $this->
ctrl->getNextClass($this);
717 if ($next_class ===
"ilcommentgui") {
718 $notes = $this->
ctrl->forwardCommand($comment_gui);
720 $notes = $comment_gui->getListHTML();
729 $page_gui->setEmbedded(
true);
731 $content = $this->
ctrl->getHTML($page_gui);
734 $content = $a_content;
742 if (count($this->perma_link) === 0) {
743 if ($this->
getType() ===
"prtf") {
744 $this->tpl->setPermanentLink($this->
getType(), $this->
object->getId(),
"_" . $current_page);
746 $this->tpl->setPermanentLink($this->
getType(), $this->
object->getRefId());
749 $this->tpl->setPermanentLink($this->perma_link[
"type"] ??
"", $this->perma_link[
"obj_id"] ?? 0);
754 $user_id = $ilUser->getId();
759 self::renderFullscreenHeader($obj, $this->tpl, $user_id);
762 $this->
ctrl->setParameter($this,
"user_page",
"");
764 $this->
ctrl->setParameter($this,
"user_page", $this->page_id);
767 if (!$current_blog) {
768 $content =
'<div id="ilCOPageContent" class="ilc_page_cont_PageContainer">' .
769 '<div class="ilc_page_Page">' .
779 $this->tpl->setContent($content .
780 '<div class="ilClearFloat">' . $notes .
'</div>');
787 $current_page = (
int) $this->requested_user_page;
790 if ($pages && $current_page) {
792 foreach ($pages as $page) {
793 if ((
int) $page[
"id"] === $current_page) {
799 $current_page = null;
804 if (!$current_page && $pages) {
805 $current_page = $pages;
806 $current_page = array_shift($current_page);
807 $current_page = (
int) $current_page[
"id"];
809 return $current_page;
814 $gui = $this->notes->gui()->getCommentsGUI(
820 $gui->enablePublicNotesDeletion(($this->user_id === $this->
object->getOwner()) &&
821 $this->
settings->get(
"comments_del_tutor",
'1'));
828 $page_class = ($this->
getType() ===
"prtt")
829 ?
"ilPortfolioTemplatePageGUI" 830 :
"ilportfoliopagegui";
834 if ($this->
getType() ===
"prtt") {
835 $button = $this->
ui->factory()->button()->standard(
836 $this->
lng->txt(
"prtt_edit"),
837 $this->
ctrl->getLinkTargetByClass([
"ilobjportfoliotemplategui"],
"view")
840 $button = $this->
ui->factory()->button()->standard(
841 $this->
lng->txt(
"prtf_edit_portfolio"),
842 $this->
ctrl->getLinkTargetByClass([
"ilobjportfoliogui"],
"view")
845 $this->
toolbar->addComponent($button);
849 $this->
ctrl->setParameterByClass($page_class,
"ppage", $page_id);
850 $button = $this->
ui->factory()->button()->standard(
851 $this->
lng->txt(
"edit_page"),
852 $this->
ctrl->getLinkTargetByClass($page_class,
"edit")
855 $this->
toolbar->addComponent($button);
860 $this->tpl->setHeaderActionMenu($this->
ui->renderer()->render($button));
871 bool $a_export =
false 875 $ilUser = $DIC->user();
880 ($a_portfolio->
getType() ===
"prtt")
882 : $a_portfolio->
getId(),
883 $a_portfolio->
getId(),
889 $name = $name[
"lastname"] .
", " . (($t = $name[
"title"]) ? $t .
" " :
"") . $name[
"firstname"];
892 $banner = $banner_width = $banner_height =
false;
894 if ($prfa_set->get(
"banner")) {
896 $banner_width = $prfa_set->get(
"banner_width");
897 $banner_height = $prfa_set->get(
"banner_height");
899 $banner = basename($banner);
908 $ppic = basename($ppic);
915 $a_tpl->setBanner($banner);
929 bool $a_with_comments =
false 931 $port_export = new \ILIAS\Portfolio\Export\PortfolioHtmlExport($this);
932 $port_export->includeComments($a_with_comments);
933 $zip = $port_export->exportHtml();
949 $prtf_pages = $this->port_request->getPortfolioPageIds();
951 if (count($prtf_pages) === 0) {
952 $this->tpl->setOnScreenMessage(
'info', $this->
lng->txt(
"no_checkbox"),
true);
953 $this->
ctrl->redirect($this,
"view");
955 $this->tabs_gui->activateTab(
"pages");
961 foreach ($prtf_pages as $page_id) {
963 $item->setValue($page_id);
964 $a_form->addItem($item);
967 $this->tpl->setContent($a_form->getHTML());
974 if ($form->checkInput()) {
976 if ($form->getInput(
"target") ===
"old") {
977 $portfolio_id = $form->getInput(
"prtf");
982 $portfolio->setTitle($form->getInput(
"title"));
983 $portfolio->create();
984 $portfolio_id = $portfolio->getId();
988 $page_ids = $this->port_request->getPortfolioPageIds();
989 foreach ($page_ids as $page_id) {
992 $target->setXMLContent($source->copyXmlContent(
true));
993 $target->setType($source->getType());
994 $target->setTitle($source->getTitle());
998 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"prtf_pages_copied"),
true);
999 $this->
ctrl->redirect($this,
"view");
1002 $form->setValuesByPost();
1011 $form->setFormAction($this->
ctrl->getFormAction($this));
1012 $form->setTitle($this->
lng->txt(
"prtf_copy_page"));
1016 $form->addCommandButton(
"copyPage", $this->
lng->txt(
"save"));
1017 $form->addCommandButton(
"view", $this->
lng->txt(
"cancel"));
1038 $this->content_style_gui->
addCss(
1040 $this->
object->getRefId(),
1041 $this->
object->getId()
updateCustom(ilPropertyFormGUI $form)
static getAllPortfolioPages(int $a_portfolio_id)
Get pages of portfolio.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getPageInstance(?int $a_page_id=null, ?int $a_portfolio_id=null)
getEditFormCustomValues(array &$a_values)
confirmPortfolioPageDeletion()
ILIAS Portfolio InternalGUIService $gui
New implementation of ilObjectGUI.
view()
Show list of portfolio pages.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
showEditButton(int $page_id)
setPermaLink(int $a_obj_id, string $a_type)
Set custom perma link (used in public profile?)
resetHeaderBlock(bool $a_reset_header_action=true)
Reset all header properties: title, icon, description, alerts, action menu.
static _lookupName(int $a_user_id)
lookup user name
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static renderFullscreenHeader(ilObjPortfolioBase $a_portfolio, ilGlobalTemplateInterface $a_tpl, int $a_user_id, bool $a_export=false)
Render banner, user name.
addPage()
Show portfolio page creation form.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
savePage()
Create new portfolio page.
setVariable(string $variable, $value='')
Sets the given variable to the given value.
static lookupType($a_page_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setTitleIcon(string $a_icon_path, string $a_icon_desc="")
set title icon
export(bool $a_with_comments=false)
handlePageCall(string $a_cmd)
copyPageForm(ilPropertyFormGUI $a_form=null)
Select target portfolio for page(s) copy.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
string $requested_back_url
getPageGUIInstance(int $a_page_id)
static deliverFileLegacy(string $a_file, ?string $a_filename=null, ?string $a_mime=null, ?bool $isInline=false, ?bool $removeAfterDelivery=false, ?bool $a_exit_after=true)
static activeLayouts(int $a_module=0)
Get active layouts.
savePortfolioPagesOrdering()
Save ordering of portfolio pages.
static http()
Fetches the global http state from ILIAS.
checkPermissionBool(string $perm, string $cmd="", string $type="", ?int $node_id=null)
static _lookupTitle(int $obj_id)
ILIAS Notes Service $notes
getType()
Functions that must be overwritten.
setRepositoryMode(bool $a_value)
setScreenIdComponent(string $a_comp)
ILIAS Style Content GUIService $content_style_gui
static _getStaticLink(?int $a_ref_id, string $a_type='', bool $a_fallback_goto=true, string $append="")
static _recordReadEvent(string $a_type, int $a_ref_id, int $obj_id, int $usr_id, bool $isCatchupWriteEvents=true, $a_ext_rc=null, $a_ext_time=null)
initCopyPageFormOptions(ilPropertyFormGUI $a_form)
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getParentId(int $a_node_id)
get parent id of given node
setAdditional(array $a_additional)
Set Additonal Information (used in public profile?)
setTitle(string $a_title, bool $hidden=false)
Sets title in standard template.
addBlog()
Show portfolio blog page creation form.
ILIAS HTTP Services $http
Portfolio view gui base class.
static _getPersonalPicturePath(int $a_usr_id, string $a_size="small", bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(int $a_id=0, int $a_id_type=self::REPOSITORY_NODE_ID, int $a_parent_node_id=0)
setSettingsSubTabs(string $a_active)
StandardGUIRequest $port_request
setDescription(string $a_descr)
Sets description below title in standard template.
addItem(string $a_title, string $a_link, string $a_frame="", int $a_ref_id=0, ?string $type=null)
static signFile(string $path_to_file)
ILIAS Style Content Object ObjectFacade $content_style_domain
static fixOrdering(int $a_portfolio_id)
initEditCustomForm(ilPropertyFormGUI $a_form)
getImageFullPath(bool $a_as_thumb=false)
Get banner image incl.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setContentStyleSheet(ilGlobalTemplateInterface $a_tpl=null)
initPageForm(string $a_mode="create")
Init portfolio page form.
setTitle(string $a_title)
addCss(string $a_css_file, string $media="screen")
Add a css file that should be included in the header.