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();
101 if ($mob_gui->getForm()->getInput(
"standard_type") ===
"File") {
102 $edit_gui = new \ilPCMediaObjectEditorGUI();
103 $form = $edit_gui->getUploadForm($lng);
105 $input = $form->getItemByPostVar(
"standard_file");
109 $form->setValuesByPost();
110 $rendered_form = $edit_gui->getRenderedUploadForm(
115 return $this->ui_wrapper->sendFormError($rendered_form);
117 $edit_gui = new \ilPCMediaObjectEditorGUI();
118 $form = $edit_gui->getUrlForm($lng);
120 $form->setValuesByPost();
121 $rendered_form = $edit_gui->getRenderedUrlForm(
126 return $this->ui_wrapper->sendFormError($rendered_form);
131 return $this->ui_wrapper->sendPage($this->page_gui, $updated);
134 protected function updateCommand(array $body): Server\Response
136 $page = $this->page_gui->getPageObject();
139 $pc_media = $page->getContentObjectForPcId($body[
"pcid"]);
140 $quick_edit = new \ilPCMediaObjectQuickEdit($pc_media);
146 $quick_edit->setUseFullscreen((
bool) ($body[
"fullscreen"] ??
false));
150 $pc_media->getMediaObject()->update();
151 $updated = $page->update();
153 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)