ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilPCSectionEditorGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2020 ILIAS open source, Extended GPL, see docs/LICENSE */
4
5
11{
15 protected $lng;
16
20 protected $ctrl;
21
22 public function __construct()
23 {
24 global $DIC;
25
26 $this->lng = $DIC->language();
27 $this->ctrl = $DIC->ctrl();
28 }
29
33 public function getEditorElements(\ILIAS\COPage\Editor\Server\UIWrapper $ui_wrapper, string $page_type, ilPageObjectGUI $page_gui, int $style_id) : array
34 {
35 $form = $this->getCreationForm($page_gui, $ui_wrapper, $style_id);
36 return [
37 "creation_form" => $form,
38 "icon" => $ui_wrapper->getRenderedIcon("pesc")
39 ];
40 }
41
47 protected function getCreationForm(ilPageObjectGUI $page_gui, $ui_wrapper, $style_id)
48 {
51
52 $sec_gui = new ilPCSectionGUI($page_gui->getPageObject(), null, "", "");
53 $sec_gui->setStyleId($style_id);
54 $sec_gui->setPageConfig($page_gui->getPageConfig());
55
56 $html = $ctrl->getHTML(
57 $sec_gui,
58 [
59 "form" => true,
60 "ui_wrapper" => $ui_wrapper,
61 "buttons" => [["Page", "component.save", $lng->txt("insert")],
62 ["Page", "component.cancel", $lng->txt("cancel")]]
63 ]
64 );
65
66 return $html;
67 }
68
75 public function getEditComponentForm(\ILIAS\COPage\Editor\Server\UIWrapper $ui_wrapper, string $page_type, \ilPageObjectGUI $page_gui, int $style_id, $pcid) : string
76 {
79
80 $page = $page_gui->getPageObject();
81 $page->addHierIDs();
82 $hier_id = $page->getHierIdForPcId($pcid);
83 $sec = $page->getContentObjectForPcId($pcid);
84
85
86 $sec_gui = new ilPCSectionGUI($page_gui->getPageObject(), $sec, $hier_id, $pcid);
87 $sec_gui->setStyleId($style_id);
88 $sec_gui->setPageConfig($page_gui->getPageConfig());
89
90 $html = $ctrl->getHTML(
91 $sec_gui,
92 [
93 "form" => true,
94 "ui_wrapper" => $ui_wrapper,
95 "buttons" => [["Page", "component.update", $lng->txt("save")],
96 ["Page", "component.cancel", $lng->txt("cancel")]]
97 ]
98 );
99
100 return $html;
101 }
102}
An exception for terminatinating execution or to throw for unit testing.
getEditComponentForm(\ILIAS\COPage\Editor\Server\UIWrapper $ui_wrapper, string $page_type, \ilPageObjectGUI $page_gui, int $style_id, $pcid)
@inheritDoc
getCreationForm(ilPageObjectGUI $page_gui, $ui_wrapper, $style_id)
Get creation form.
getEditorElements(\ILIAS\COPage\Editor\Server\UIWrapper $ui_wrapper, string $page_type, ilPageObjectGUI $page_gui, int $style_id)
@inheritDoc
Class ilPCSectionGUI.
Class ilPageObjectGUI.
getPageObject()
Get Page Object.
getPageConfig()
Get page config object.
global $DIC
Definition: goto.php:24
Class ChatMainBarProvider \MainMenu\Provider.