ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilPortfolioTemplatePageGUI.php
Go to the documentation of this file.
1 <?php
2 
28 {
29  protected bool $may_write = false;
30 
31  public function getParentType(): string
32  {
33  return "prtt";
34  }
35 
36  protected function getPageContentUserId(int $a_user_id): int
37  {
39 
40  // user
41  if (!$this->may_write) {
42  return $ilUser->getId();
43  }
44  // author
45  return $a_user_id;
46  }
47 
48  public function showPage(): string
49  {
50  if (!$this->getPageObject()) {
51  return "";
52  }
53 
54  switch ($this->getPageObject()->getType()) {
56  return $this->renderPageElement("BlogTemplate", $this->renderBlogTemplate());
57 
58  default:
59 
60  // needed for placeholders
61  $this->tpl->addCss(ilObjStyleSheet::getPlaceHolderStylePath());
62 
63  return parent::showPage();
64  }
65  }
66 
67  protected function renderPageElement(
68  string $a_type,
69  string $a_html
70  ): string {
71  return parent::renderPageElement($a_type, $this->addPlaceholderInfo($a_html));
72  }
73 
74  protected function addPlaceholderInfo(string $a_html): string
75  {
76  return '<fieldset style="border: 1px dashed red; padding: 3px; margin: 5px;">' .
77  '<legend style="color: red; font-style: italic;" class="small">' .
78  $this->lng->txt("prtf_template_editor_placeholder_info") .
79  '</legend>' .
80  trim($a_html) .
81  '</fieldset>';
82  }
83 
84  protected function renderBlogTemplate(): string
85  {
86  return $this->renderTeaser("blog_template", $this->lng->txt("obj_blog"));
87  }
88 
89  public function getViewPageLink(): string
90  {
91  global $DIC;
92 
93  $ctrl = $DIC->ctrl();
94 
95  $ctrl->setParameterByClass("ilobjportfoliotemplategui", "user_page", $this->requested_ppage);
96  return $ctrl->getLinkTargetByClass("ilobjportfoliotemplategui", "preview");
97  }
98 
99  protected function getCourseSortAction(ilCtrl $ctrl): string
100  {
101  return $ctrl->getFormActionByClass("ilobjportfoliotemplategui", "preview");
102  }
103 
104  public function finishEditing(): void
105  {
106  $this->ctrl->redirectByClass("ilObjPortfolioTemplateGUI", "view");
107  }
108 }
getLinkTargetByClass( $a_class, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
setParameterByClass(string $a_class, string $a_parameter, $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
global $DIC
Definition: feed.php:28
renderPageElement(string $a_type, string $a_html)
getFormActionByClass( $a_class, string $a_fallback_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
$ilUser
Definition: imgupload.php:34
renderTeaser(string $a_type, string $a_title, string $a_options="")
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...