19 declare(strict_types=1);
31 protected \ILIAS\DI\UIServices
$ui;
32 protected \ilLanguage
$lng;
41 $this->
ui = $DIC->ui();
42 $this->
lng = $DIC->language();
44 $this->
user = $DIC->user();
46 $this->ui_wrapper =
new Server\UIWrapper($this->
ui, $this->
lng);
51 switch ($body[
"action"]) {
56 return $this->updateCommand($body);
59 throw new Exception(
"Unknown action " . $body[
"action"]);
65 $page = $this->page_gui->getPageObject();
69 if (!in_array($body[
"after_pcid"], [
"",
"pg"])) {
70 $hier_ids = $page->getHierIdsForPCIds([$body[
"after_pcid"]]);
71 $hier_id = $hier_ids[$body[
"after_pcid"]];
72 $pc_id = $body[
"after_pcid"];
76 $res = new \ilPCResources($page);
77 $res->create($page, $hier_id, $pc_id);
79 $res_type = $body[
"res_type"];
82 if ($res_type ===
"_other") {
83 $res->setResourceListType(
"_other");
84 } elseif ($res_type ===
"_lobj") {
85 $res->setResourceListType(
"_lobj");
86 } elseif ($res_type !==
"itgr") {
87 if (isset($body[
"type"])) {
88 $res->setResourceListType(
95 $res->setItemGroupRefId(
101 $updated = $page->update();
103 $page->buildDom(
true);
107 return $this->ui_wrapper->sendPage($this->page_gui, $updated);
110 protected function updateCommand(array $body): Server\Response
112 $page = $this->page_gui->getPageObject();
115 $res = $page->getContentObjectForPcId($body[
"pcid"]);
117 $res_type = $body[
"res_type"];
119 if ($res_type ===
"_other") {
120 $res->setResourceListType(
"_other");
121 } elseif ($res_type ===
"_lobj") {
122 $res->setResourceListType(
"_lobj");
123 } elseif ($res_type !==
"itgr") {
124 $res->setResourceListType(
128 $res->setItemGroupRefId(
133 $updated = $page->update();
135 $page->addMissingContainerBlocks($this->page_gui->getItemPresentationManager());
138 return $this->ui_wrapper->sendPage($this->page_gui, $updated);
handle(array $query, array $body)
ilPageObjectGUI $page_gui
__construct(\ilPageObjectGUI $page_gui)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Server UIWrapper $ui_wrapper
insertCommand(array $body)