ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilPCSectionEditorGUI.php
Go to the documentation of this file.
1<?php
2
20
25{
26 protected \ilLanguage $lng;
27 protected \ilCtrl $ctrl;
28
29 public function __construct()
30 {
31 global $DIC;
32
33 $this->lng = $DIC->language();
34 $this->ctrl = $DIC->ctrl();
35 }
36
37 public function getEditorElements(
38 UIWrapper $ui_wrapper,
39 string $page_type,
40 ilPageObjectGUI $page_gui,
41 int $style_id
42 ): array {
43 $form = $this->getCreationForm($page_gui, $ui_wrapper, $style_id);
44 return [
45 "creation_form" => $form,
46 "icon" => $ui_wrapper->getRenderedIcon("pesc")
47 ];
48 }
49
50 protected function getCreationForm(
51 ilPageObjectGUI $page_gui,
52 UIWrapper $ui_wrapper,
53 int $style_id
54 ): string {
55 $ctrl = $this->ctrl;
57
58 $sec_gui = new ilPCSectionGUI($page_gui->getPageObject(), null, "", "");
59 $sec_gui->setStyleId($style_id);
60 $sec_gui->setPageConfig($page_gui->getPageConfig());
61
62 $html = $ctrl->getHTML(
63 $sec_gui,
64 [
65 "form" => true,
66 "ui_wrapper" => $ui_wrapper,
67 "insert" => true,
68 "buttons" => [["Page", "component.save", $lng->txt("insert")],
69 ["Page", "component.cancel", $lng->txt("cancel")]]
70 ]
71 );
72
73 return $html;
74 }
75
76 public function getEditComponentForm(
77 UIWrapper $ui_wrapper,
78 string $page_type,
79 \ilPageObjectGUI $page_gui,
80 int $style_id,
81 string $pcid
82 ): string {
83 $ctrl = $this->ctrl;
85
86 $page = $page_gui->getPageObject();
87 $page->addHierIDs();
88 $hier_id = $page->getHierIdForPcId($pcid);
89 $sec = $page->getContentObjectForPcId($pcid);
90
91
92 $sec_gui = new ilPCSectionGUI($page_gui->getPageObject(), $sec, $hier_id, $pcid);
93 $sec_gui->setStyleId($style_id);
94 $sec_gui->setPageConfig($page_gui->getPageConfig());
95
96 $html = $ctrl->getHTML(
97 $sec_gui,
98 [
99 "form" => true,
100 "ui_wrapper" => $ui_wrapper,
101 "buttons" => [["Page", "component.update", $lng->txt("save")],
102 ["Page", "component.cancel", $lng->txt("cancel")]]
103 ]
104 );
105
106 return $html;
107 }
108}
getCreationForm(ilPageObjectGUI $page_gui, UIWrapper $ui_wrapper, int $style_id)
getEditComponentForm(UIWrapper $ui_wrapper, string $page_type, \ilPageObjectGUI $page_gui, int $style_id, string $pcid)
Get rendered editor elements.
getEditorElements(UIWrapper $ui_wrapper, string $page_type, ilPageObjectGUI $page_gui, int $style_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Class ilPageObjectGUI.
global $lng
Definition: privfeed.php:31
global $DIC
Definition: shib_login.php:26