ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\COPage\PC\Section\SectionCommandActionHandler Class Reference
+ Inheritance diagram for ILIAS\COPage\PC\Section\SectionCommandActionHandler:
+ Collaboration diagram for ILIAS\COPage\PC\Section\SectionCommandActionHandler:

Public Member Functions

 __construct (\ilPageObjectGUI $page_gui)
 
 handle (array $query, array $body)
 

Protected Member Functions

 insertCommand (array $body)
 
 updateCommand (array $body)
 

Protected Attributes

ilCtrlInterface $ctrl
 
ILIAS DI UIServices $ui
 
ilLanguage $lng
 
ilPageObjectGUI $page_gui
 
ilObjUser $user
 
Server UIWrapper $ui_wrapper
 

Detailed Description

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 29 of file class.SectionCommandActionHandler.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\COPage\PC\Section\SectionCommandActionHandler::__construct ( \ilPageObjectGUI  $page_gui)

Definition at line 38 of file class.SectionCommandActionHandler.php.

39 {
40 global $DIC;
41
42 $this->ui = $DIC->ui();
43 $this->lng = $DIC->language();
44 $this->ctrl = $DIC->ctrl();
45 $this->page_gui = $page_gui;
46 $this->user = $DIC->user();
47 $this->ctrl = $DIC->ctrl();
48
49 $this->ui_wrapper = new Server\UIWrapper($this->ui, $this->lng);
50 }
global $DIC
Definition: shib_login.php:26

References $DIC, ILIAS\COPage\PC\Section\SectionCommandActionHandler\$page_gui, ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ILIAS\Repository\ui(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Member Function Documentation

◆ handle()

ILIAS\COPage\PC\Section\SectionCommandActionHandler::handle ( array  $query,
array  $body 
)

Definition at line 52 of file class.SectionCommandActionHandler.php.

52 : Server\Response
53 {
54 switch ($body["action"]) {
55 case "insert":
56 return $this->insertCommand($body);
57
58 case "update":
59 return $this->updateCommand($body);
60
61 default:
62 throw new Exception("Unknown action " . $body["action"]);
63 }
64 }

References ILIAS\COPage\PC\Section\SectionCommandActionHandler\insertCommand(), and ILIAS\COPage\PC\Section\SectionCommandActionHandler\updateCommand().

+ Here is the call graph for this function:

◆ insertCommand()

ILIAS\COPage\PC\Section\SectionCommandActionHandler::insertCommand ( array  $body)
protected

Definition at line 66 of file class.SectionCommandActionHandler.php.

66 : Server\Response
67 {
68 $page = $this->page_gui->getPageObject();
69
70 $hier_id = "pg";
71 $pc_id = "";
72 if (!in_array($body["after_pcid"], ["", "pg"])) {
73 $hier_ids = $page->getHierIdsForPCIds([$body["after_pcid"]]);
74 $hier_id = $hier_ids[$body["after_pcid"]];
75 $pc_id = $body["after_pcid"];
76 }
77
78 // if ($form->checkInput()) {
79 $sec = new \ilPCSection($page);
80 $sec->create($page, $hier_id, $pc_id);
81 $sec_gui = new \ilPCSectionGUI($page, $sec, "", "");
82 $sec_gui->setStyleId($this->page_gui->getStyleId());
83 $sec_gui->getCharacteristicsOfCurrentStyle(["section"]);
84 $sec_gui->setPageConfig($page->getPageConfig());
85
86 $form = $sec_gui->initForm(true);
87
88 // note: we have everyting in _POST here, form works the usual way
89 $updated = true;
90 if ($sec_gui->checkInput($form)) {
91 $sec_gui->setValuesFromForm($form);
92 $updated = $page->update();
93 } else {
94 $rendered_form = $this->ctrl->getHTML(
95 $sec_gui,
96 [
97 "form" => true,
98 "validation" => true,
99 "insert" => true,
100 "ui_wrapper" => $this->ui_wrapper,
101 "buttons" => [["Page", "component.save", $this->lng->txt("insert")],
102 ["Page", "component.cancel", $this->lng->txt("cancel")]]
103 ]
104 );
105 return $this->ui_wrapper->sendFormError($rendered_form);
106 }
107
108 return $this->ui_wrapper->sendPage($this->page_gui, $updated);
109 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by ILIAS\COPage\PC\Section\SectionCommandActionHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateCommand()

ILIAS\COPage\PC\Section\SectionCommandActionHandler::updateCommand ( array  $body)
protected

Definition at line 111 of file class.SectionCommandActionHandler.php.

111 : Server\Response
112 {
113 $page = $this->page_gui->getPageObject();
114 $page->addHierIDs();
115 $hier_id = $page->getHierIdForPcId($body["pcid"]);
116 $sec = $page->getContentObjectForPcId($body["pcid"]);
117 $sec_gui = new \ilPCSectionGUI($page, $sec, $hier_id, $body["pcid"]);
118 $sec_gui->setStyleId($this->page_gui->getStyleId());
119 $sec_gui->getCharacteristicsOfCurrentStyle(["section"]);
120 $sec_gui->setPageConfig($page->getPageConfig());
121
122 $form = $sec_gui->initForm(false);
123
124 // note: we have everyting in _POST here, form works the usual way
125 $updated = true;
126 if ($sec_gui->checkInput($form)) {
127 $sec_gui->setValuesFromForm($form);
128 $updated = $page->update();
129 } else {
130 $rendered_form = $this->ctrl->getHTML(
131 $sec_gui,
132 [
133 "form" => true,
134 "validation" => true,
135 "ui_wrapper" => $this->ui_wrapper,
136 "buttons" => [["Page", "component.update", $this->lng->txt("save")],
137 ["Page", "component.cancel", $this->lng->txt("cancel")]]
138 ]
139 );
140 return $this->ui_wrapper->sendFormError($rendered_form);
141 }
142
143 return $this->ui_wrapper->sendPage($this->page_gui, $updated);
144 }

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

Referenced by ILIAS\COPage\PC\Section\SectionCommandActionHandler\handle().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrlInterface ILIAS\COPage\PC\Section\SectionCommandActionHandler::$ctrl
protected

Definition at line 31 of file class.SectionCommandActionHandler.php.

◆ $lng

ilLanguage ILIAS\COPage\PC\Section\SectionCommandActionHandler::$lng
protected

Definition at line 33 of file class.SectionCommandActionHandler.php.

◆ $page_gui

ilPageObjectGUI ILIAS\COPage\PC\Section\SectionCommandActionHandler::$page_gui
protected

◆ $ui

ILIAS DI UIServices ILIAS\COPage\PC\Section\SectionCommandActionHandler::$ui
protected

Definition at line 32 of file class.SectionCommandActionHandler.php.

◆ $ui_wrapper

Server UIWrapper ILIAS\COPage\PC\Section\SectionCommandActionHandler::$ui_wrapper
protected

Definition at line 36 of file class.SectionCommandActionHandler.php.

◆ $user

ilObjUser ILIAS\COPage\PC\Section\SectionCommandActionHandler::$user
protected

Definition at line 35 of file class.SectionCommandActionHandler.php.


The documentation for this class was generated from the following file: