ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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  {
38  $ilUser = $this->user;
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  return parent::showPage();
60  }
61  }
62 
63  protected function renderPageElement(
64  string $a_type,
65  string $a_html
66  ): string {
67  return parent::renderPageElement($a_type, $this->addPlaceholderInfo($a_html));
68  }
69 
70  protected function addPlaceholderInfo(string $a_html): string
71  {
72  return '<fieldset style="border: 1px dashed red; padding: 3px; margin: 5px;">' .
73  '<legend style="color: red; font-style: italic;" class="small">' .
74  $this->lng->txt("prtf_template_editor_placeholder_info") .
75  '</legend>' .
76  trim($a_html) .
77  '</fieldset>';
78  }
79 
80  protected function renderBlogTemplate(): string
81  {
82  return $this->renderTeaser("blog_template", $this->lng->txt("obj_blog"));
83  }
84 
85  public function getViewPageLink(): string
86  {
87  global $DIC;
88 
89  $ctrl = $DIC->ctrl();
90 
91  $ctrl->setParameterByClass("ilobjportfoliotemplategui", "user_page", $this->requested_ppage);
92  return $ctrl->getLinkTargetByClass("ilobjportfoliotemplategui", "preview");
93  }
94 
95  protected function getCourseSortAction(ilCtrl $ctrl): string
96  {
97  return $ctrl->getFormActionByClass("ilobjportfoliotemplategui", "preview");
98  }
99 
100  public function finishEditing(): void
101  {
102  $this->ctrl->redirectByClass("ilObjPortfolioTemplateGUI", "view");
103  }
104 }
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)
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...