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();
70 if (!in_array($body[
"after_pcid"], [
"",
"pg"])) {
71 $hier_ids = $page->getHierIdsForPCIds([$body[
"after_pcid"]]);
72 $hier_id = $hier_ids[$body[
"after_pcid"]];
73 $pc_id = $body[
"after_pcid"];
78 $pc_media = new \ilPCMediaObject($page);
79 $pc_media->createMediaObject();
80 $mob = $pc_media->getMediaObject();
82 $mob_gui = new \ilObjMediaObjectGUI(
"");
83 $mob_gui->initForm(
"create");
86 if ($mob_gui->checkFormInput()) {
89 $mob_gui->setObjectPerCreationForm($mob);
94 $media_item = $mob->getMediaItem(
"Standard");
95 if (!is_null($media_item)) {
96 $pc_media->createAlias($page, $hier_id, $pc_id);
98 $updated = $page->update();
102 if ($mob_gui->getForm()->getInput(
"standard_type") ===
"File") {
103 $edit_gui = new \ilPCMediaObjectEditorGUI();
104 $form = $edit_gui->getUploadForm($lng);
106 $input = $form->getItemByPostVar(
"standard_file");
110 $form->setValuesByPost();
111 $rendered_form = $edit_gui->getRenderedUploadForm(
116 return $this->ui_wrapper->sendFormError($rendered_form);
118 $edit_gui = new \ilPCMediaObjectEditorGUI();
119 $form = $edit_gui->getUrlForm($lng);
121 $form->setValuesByPost();
122 $rendered_form = $edit_gui->getRenderedUrlForm(
127 return $this->ui_wrapper->sendFormError($rendered_form);
132 return $this->ui_wrapper->sendPage($this->page_gui, $updated);
135 protected function updateCommand(array $body): Server\Response
137 $page = $this->page_gui->getPageObject();
140 $pc_media = $page->getContentObjectForPcId($body[
"pcid"]);
141 $quick_edit = new \ilPCMediaObjectQuickEdit($pc_media);
147 $quick_edit->setUseFullscreen((
bool) ($body[
"fullscreen"] ??
false));
151 $pc_media->getMediaObject()->update();
152 $updated = $page->update();
154 return $this->ui_wrapper->sendPage($this->page_gui, $updated);
ilPageObjectGUI $page_gui
handle(array $query, array $body)
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
Server UIWrapper $ui_wrapper
__construct(\ilPageObjectGUI $page_gui)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
insertCommand(array $body)