65 protected \ILIAS\DI\UIServices
$ui;
66 protected \ILIAS\GlobalScreen\ScreenContext\ContextServices
$tool_context;
81 $this->
help = $DIC[
"ilHelp"];
82 $this->
user = $DIC->user();
83 $this->
access = $DIC->access();
85 $lng = $DIC->language();
86 $objDefinition = $DIC[
"objDefinition"];
87 $ilCtrl = $DIC->ctrl();
88 $ilTabs = $DIC->tabs();
90 $this->
ui = $DIC->ui();
92 $this->request = $DIC->copage()->internal()->gui()->page()->editRequest();
93 $this->requested_hier_id = $this->request->getHierId();
94 $this->requested_pc_id = $this->request->getPCId();
95 $this->requested_pl_pc_id = $this->request->getPlaceholderPCId();
96 $this->requested_ctype = $this->request->getCType();
97 $this->requested_cname = $this->request->getCName();
98 $this->requested_mob_id = $this->request->getMobId();
102 $this->tool_context = $DIC->globalScreen()->tool()->context();
105 $this->http_request = $DIC->http()->request();
106 $this->
ctrl = $ilCtrl;
110 $this->tabs_gui = $ilTabs;
111 $this->page = $a_page_object;
112 $this->page_gui = $a_page_object_gui;
114 $this->
ctrl->saveParameter($this, array(
"hier_id",
"pc_id"));
116 $this->edit_repo = $DIC
121 $this->pc_definition = $DIC
134 $this->
header = $a_header;
144 $this->
ctrl->returnToParent($this);
149 $this->int_link_return = $a_return;
154 $this->page_back_title = $a_title;
164 $this->log->debug(
"begin =========================");
173 $cmd = $this->
ctrl->getCmd(
"displayPage");
174 $cmdClass = strtolower($this->
ctrl->getCmdClass());
178 $new_hier_id = $this->request->getString(
"new_hier_id");
179 if ($new_hier_id !=
"") {
180 $hier_id = $new_hier_id;
183 $this->log->debug(
"step BC: cmd:$cmd, cmdClass:$cmdClass, hier_id: $hier_id, pc_id: $pc_id");
187 if (substr($cmd, 0, 5) ==
"exec_") {
189 $pca = explode(
":", $this->
ctrl->getCmd());
191 $cmd = explode(
"_", $pca[0]);
193 $hier_id = implode(
"_", $cmd);
194 $cmd = $this->request->getString(
"command" . $hier_id);
196 $this->log->debug(
"step EC: cmd:$cmd, hier_id: $hier_id, pc_id: $pc_id");
200 $first_hier_character = substr($hier_id, 0, 1);
201 if ($first_hier_character ==
"c" ||
202 $first_hier_character ==
"r" ||
203 $first_hier_character ==
"g" ||
204 $first_hier_character ==
"i") {
205 $hier_id = substr($hier_id, 1);
207 $this->log->debug(
"step CC: cmd:$cmd, hier_id: $hier_id, pc_id: $pc_id");
210 $this->page->buildDom();
211 $this->page->addHierIDs();
216 if ($cmdClass !=
"ilfilesystemgui") {
217 $com = explode(
"_", $cmd);
220 $this->log->debug(
"step CS: cmd:$cmd");
224 $next_class = $this->
ctrl->getNextClass($this);
225 $this->log->debug(
"step NC: next class: " . $next_class);
229 if ($next_class ==
"ilpcplaceholdergui" && $hier_id ==
"" && $this->requested_pl_pc_id !=
"") {
230 $hid = $this->page->getHierIdsForPCIds(array($this->requested_pl_pc_id));
233 $this->log->debug(
"step PH: next class: " . $next_class);
235 if (!is_null($com) && ($com[0] ==
"insert" || $com[0] ==
"create")) {
238 $ctype = $com[1] ??
"";
239 $add_type = $this->request->getString(
"pluginName");
240 if ($ctype ==
"mob") {
244 $this->log->debug(
"step CM: cmd: " . $cmd .
", ctype: " . $ctype .
", add_type: " . $add_type);
246 $this->log->debug(
"step LM: cmd: " . $cmd .
", cmdClass: " . $cmdClass);
249 $this->log->debug(
"before PR: cmdClass: $cmdClass, nextClass: $next_class" .
250 ", hier_id: " . $hier_id .
", pc_id: " . $pc_id .
")");
253 if ($this->requested_ctype ==
"" && $this->requested_cname ==
"" &&
254 $cmd !=
"insertFromClipboard" && $cmd !=
"pasteFromClipboard" &&
255 $cmd !=
"setMediaMode" && $cmd !=
"copyLinkedMediaToClipboard" &&
256 $cmd !=
"activatePage" && $cmd !=
"deactivatePage" &&
257 $cmd !=
"copyLinkedMediaToMediaPool" && $cmd !=
"showSnippetInfo" &&
258 $cmd !=
"delete" && $cmd !=
"paste" &&
259 $cmd !=
"cancelDeleteSelected" && $cmd !=
"confirmedDeleteSelected" &&
260 $cmd !=
"copy" && $cmd !=
"cut" &&
261 ($cmd !=
"displayPage" || $this->request->getString(
"editImagemapForward_x") !=
"") &&
262 $cmd !=
"activate" && $cmd !=
"characteristic" &&
263 $cmd !=
"assignCharacteristic" &&
264 $cmdClass !=
"ilrepositoryselector2inputgui" &&
265 $cmdClass !=
"ilpageeditorserveradaptergui" &&
266 $cmd !=
"cancelCreate" && $cmd !=
"popup" &&
267 $cmdClass !=
"ileditclipboardgui" && $cmd !=
"addChangeComment" &&
268 ($cmdClass !=
"ilinternallinkgui" || ($next_class ==
"ilpcmediaobjectgui"))) {
269 $cont_obj = $this->page->getContentObject($hier_id, $pc_id);
270 if (!is_object($cont_obj)) {
271 $this->log->debug(
"returnToParent");
272 $ilCtrl->returnToParent($this);
278 if ($this->requested_ctype !=
"" || $this->requested_cname !=
"") {
280 if ($this->requested_cname !=
"") {
281 $pc_def = $this->pc_definition->getPCDefinitionByName($this->requested_cname);
282 $ctype = $pc_def[
"pc_type"];
286 if (!in_array($cmd, [
"insert",
"create"])) {
287 $cont_obj = $this->page->getContentObject($hier_id, $pc_id);
291 if ($pc_id !=
"" && $hier_id ==
"") {
292 $hier_id = $this->page->getHierIdForPcId($pc_id);
294 if ($ctype !=
"media" || !is_object($cont_obj)) {
296 $this->tpl->setTitle($this->
getHeader());
303 $this->
ctrl->setParameter($this,
"hier_id", $hier_id);
304 $this->
ctrl->setParameter($this,
"pc_id", $pc_id);
305 $this->
ctrl->setCmd($cmd);
306 if ($next_class ==
"") {
307 $pc_def = $this->pc_definition->getPCDefinitionByType($ctype);
308 if (is_array($pc_def)) {
309 $this->
ctrl->setCmdClass($pc_def[
"pc_gui_class"]);
311 $next_class = $this->
ctrl->getNextClass($this);
313 $this->log->debug(
"step NC2: next_class: $next_class");
317 if ($cmd ==
"displayPage" &&
318 $this->request->getString(
"editImagemapForward_x") ==
"" 319 && $this->request->getString(
"imagemap_x") ==
"") {
324 switch ($next_class) {
325 case "ilinternallinkgui":
327 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultType(),
328 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultId(),
329 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultIdIsRef()
332 $this->page_gui->getPageConfig()->getIntLinkFilterWhiteList()
334 foreach ($this->page_gui->getPageConfig()->getIntLinkFilters() as $filter) {
335 $link_gui->filterLinkType($filter);
337 $link_gui->setReturn($this->int_link_return);
339 $ret = $this->
ctrl->forwardCommand($link_gui);
343 case "ilpcmediaobjectgui":
344 $this->tabs_gui->clearTargets();
345 $this->tabs_gui->setBackTarget(
346 $this->page_gui->page_back_title,
347 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
350 $pcmob_gui->setStyleId($this->page_gui->getStyleId());
351 $pcmob_gui->setSubCmd($ctype);
352 $pcmob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
353 $ret = $this->
ctrl->forwardCommand($pcmob_gui);
354 $ilHelp->setScreenIdComponent(
"copg_media");
358 case "ilobjmediaobjectgui":
359 $this->tabs_gui->clearTargets();
360 $this->tabs_gui->setBackTarget(
361 $this->
lng->txt(
"back"),
362 (string) $ilCtrl->getParentReturn($this)
366 $mob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
367 $this->tpl->setTitle($this->
lng->txt(
"mob") .
": " .
369 $ret = $this->
ctrl->forwardCommand($mob_gui);
373 case "ilpcquestiongui":
374 $pc_question_gui =
new ilPCQuestionGUI($this->page, $cont_obj, $hier_id, $pc_id);
375 $pc_question_gui->setSelfAssessmentMode($this->page_gui->getPageConfig()->getEnableSelfAssessment());
376 $pc_question_gui->setPageConfig($this->page_gui->getPageConfig());
378 if ($this->page_gui->getPageConfig()->getEnableSelfAssessment()) {
379 $this->tabs_gui->clearTargets();
380 $ilHelp->setScreenIdComponent(
"copg_pcqst");
381 $this->tabs_gui->setBackTarget(
382 $this->
lng->txt(
"back"),
383 (string) $ilCtrl->getParentReturn($this)
385 $ret = $this->
ctrl->forwardCommand($pc_question_gui);
387 $cmd = $this->
ctrl->getCmd();
388 $pc_question_gui->$cmd();
389 $this->
ctrl->redirectByClass(array(
"ilobjquestionpoolgui", get_class($cont_obj)),
"editQuestion");
394 case "ilpcpluggedgui":
395 $this->tabs_gui->clearTargets();
403 $ret = $this->
ctrl->forwardCommand($plugged_gui);
406 case "ilpageeditorserveradaptergui":
413 $this->
ctrl->forwardCommand($adapter);
419 if ($this->pc_definition->isPCGUIClassName($next_class,
true)) {
420 $this->log->debug(
"Generic Call");
421 $pc_def = $this->pc_definition->getPCDefinitionByGUIClassName($next_class);
422 $this->tabs_gui->clearTargets();
423 $this->tabs_gui->setBackTarget(
424 $this->page_gui->page_back_title,
425 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
427 $ilHelp->setScreenIdComponent(
"copg_" . $pc_def[
"pc_type"]);
428 $gui_class_name = $pc_def[
"pc_gui_class"];
429 $pc_gui =
new $gui_class_name($this->page, $cont_obj, $hier_id, $pc_id);
430 if ($pc_def[
"style_classes"]) {
431 $pc_gui->setStyleId($this->page_gui->getStyleId());
433 $pc_gui->setPageConfig($this->page_gui->getPageConfig());
434 $ret = $this->
ctrl->forwardCommand($pc_gui);
436 $this->log->debug(
"Call ilPageEditorGUI command.");
439 if ($cmd ==
"pasteFromClipboard") {
442 } elseif ($cmd ==
"paste") {
444 $this->
paste($hier_id);
446 $ret = $this->$cmd();
452 $this->log->debug(
"end --------------------");
454 return (
string) $ret;
459 $this->page_gui->activatePage();
464 $this->page_gui->deactivatePage();
475 "ilPageEditor_MediaMode",
476 $this->request->getString(
"media_mode")
479 "ilPageEditor_HTMLMode",
480 $this->request->getString(
"html_mode")
482 $js_mode = $this->request->getString(
"js_mode");
483 $ilUser->writePref(
"ilPageEditor_JavaScript", $js_mode);
486 if ($this->page->getParentType() ==
"lm") {
487 $this->
ctrl->redirectByClass(
"illmpageobjectgui",
"edit");
489 $this->
ctrl->returnToParent($this);
500 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"copied_to_clipboard"),
true);
502 $this->requested_mob_id,
506 $this->
ctrl->returnToParent($this);
514 $this->
ctrl->setParameterByClass(
"ilmediapooltargetselector",
"mob_id", $this->requested_mob_id);
515 $this->
ctrl->redirectByClass(
"ilmediapooltargetselector",
"listPools");
524 $this->page->getId(),
527 $this->page->getParentType() .
":pg",
528 $this->request->getString(
"change_comment"),
531 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"cont_added_comment"),
true);
532 $this->
ctrl->returnToParent($this);
538 public function delete():
void 544 $targets = $this->request->getIds();
546 if (count($targets) == 0) {
547 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"no_checkbox"),
true);
548 $this->
ctrl->returnToParent($this);
551 $cgui->setFormAction($ilCtrl->getFormAction($this));
552 $cgui->setHeaderText($lng->
txt(
"copg_confirm_el_deletion"));
553 $cgui->setCancel($lng->
txt(
"cancel"),
"cancelDeleteSelected");
554 $cgui->setConfirm($lng->
txt(
"confirm"),
"confirmedDeleteSelected");
555 foreach ($targets as $t) {
556 $cgui->addHiddenItem(
"ids[]", $t);
565 $this->
ctrl->returnToParent($this);
570 $targets = $this->request->getIds();
571 if (count($targets) > 0) {
572 $updated = $this->page->deleteContents(
575 $this->page_gui->getPageConfig()->getEnableSelfAssessment()
578 $this->edit_repo->setPageError(
$updated);
580 $this->edit_repo->clearPageError();
583 $this->
ctrl->returnToParent($this);
593 $ids = $this->request->getIds();
594 if (count($ids) > 0) {
595 $this->page->copyContents($ids);
596 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"cont_sel_el_copied_use_paste"),
true);
598 $this->
ctrl->returnToParent($this);
604 public function cut(): void
608 $ids = $this->request->getIds();
610 $updated = $this->page->cutContents($ids);
612 $this->edit_repo->setPageError(
$updated);
614 $this->edit_repo->clearPageError();
616 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"cont_sel_el_cut_use_paste"),
true);
618 $this->
ctrl->returnToParent($this);
624 public function paste(
string $a_hier_id): void
626 $this->page->pasteContents($a_hier_id, $this->page_gui->getPageConfig()->getEnableSelfAssessment());
628 $this->
ctrl->returnToParent($this);
636 $ids = $this->request->getIds();
637 if (count($ids) > 0) {
638 $updated = $this->page->switchEnableMultiple(
641 $this->page_gui->getPageConfig()->getEnableSelfAssessment()
644 $this->edit_repo->setPageError(
$updated);
646 $this->edit_repo->clearPageError();
649 $this->
ctrl->returnToParent($this);
660 $ids = $this->request->getIds();
661 if (count($ids) > 0) {
665 foreach ($ids as $t) {
666 $tarr = explode(
":", $t);
667 $cont_obj = $this->page->getContentObject($tarr[0], $tarr[1]);
668 if (is_object($cont_obj) && $cont_obj->
getType() ==
"par") {
669 $types[
"par"] =
"par";
671 if (is_object($cont_obj) && $cont_obj->
getType() ==
"sec") {
672 $types[
"sec"] =
"sec";
676 if (count($types) == 0) {
677 $this->tpl->setOnScreenMessage(
'failure', $lng->
txt(
"cont_select_par_or_section"),
true);
678 $this->
ctrl->returnToParent($this);
684 $this->
ctrl->returnToParent($this);
701 $this->
form->setTitle($this->
lng->txt(
"cont_choose_characteristic"));
703 if ($a_types[
"par"] ==
"par") {
705 $this->
lng->txt(
"cont_choose_characteristic_text"),
709 $select_prop->setOptions($options);
710 $this->
form->addItem($select_prop);
712 if ($a_types[
"sec"] ==
"sec") {
714 $this->
lng->txt(
"cont_choose_characteristic_section"),
718 $select_prop->setOptions($options);
719 $this->
form->addItem($select_prop);
722 foreach ($a_target as $t) {
724 $hidden->setValue($t);
725 $this->
form->addItem($hidden);
728 $this->
form->setFormAction($ilCtrl->getFormAction($this));
729 $this->
form->addCommandButton(
"assignCharacteristic", $lng->
txt(
"save"));
730 $this->
form->addCommandButton(
"showPage", $lng->
txt(
"cancel"));
735 $char_par = $this->request->getString(
"char_par");
736 $char_sec = $this->request->getString(
"char_sec");
738 $updated = $this->page->assignCharacteristic(
739 $this->request->getStringArray(
"target"),
745 $this->edit_repo->setPageError(
$updated);
747 $this->edit_repo->clearPageError();
749 $this->
ctrl->returnToParent($this);
760 $ilCtrl->setParameterByClass(
761 "ilEditClipboardGUI",
763 rawurlencode($ilCtrl->getLinkTarget(
765 "insertFromClipboard",
772 $ilCtrl->redirectByClass(
"ilEditClipboardGUI",
"getObject");
783 $hier_id = $this->page->getHierIdForPcId($this->requested_pc_id);
784 if ($hier_id ==
"") {
789 foreach ($ids as $id2) {
790 $id = explode(
":", $id2);
793 if ($type ==
"mob") {
795 $this->content_obj->readMediaObject(
$id);
796 $this->content_obj->createAlias($this->page, $hier_id);
797 $this->page->update();
799 if ($type ==
"incl") {
801 $this->content_obj->create($this->page, $hier_id);
802 $this->content_obj->setContentType(
"mep");
803 $this->content_obj->setContentId(
$id);
804 $this->page->update();
808 $this->
ctrl->returnToParent($this);
816 $this->
ctrl->returnToParent($this);
829 $stpl =
new ilTemplate(
"tpl.snippet_info.html",
true,
true,
"Services/COPage");
832 $this->request->getString(
"ci_id")
834 foreach ($mep_pools as $mep_id) {
837 foreach ($ref_ids as $rid) {
838 if (!$edit_link && $ilAccess->checkAccess(
"write",
"", $rid)) {
839 $stpl->setCurrentBlock(
"edit_link");
840 $stpl->setVariable(
"TXT_EDIT", $lng->
txt(
"edit"));
843 "./goto.php?target=mep_" . $rid
845 $stpl->parseCurrentBlock();
848 $stpl->setCurrentBlock(
"pool");
849 $stpl->setVariable(
"TXT_MEDIA_POOL", $lng->
txt(
"obj_mep"));
851 $stpl->parseCurrentBlock();
854 $stpl->setVariable(
"TXT_TITLE", $lng->
txt(
"title"));
859 $stpl->setVariable(
"TXT_BACK", $lng->
txt(
"back"));
862 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
ILIAS COPage PC PCDefinition $pc_definition
setPageBackTitle(string $a_title)
ilPageContent $content_obj
copy()
Copy selected items.
ServerRequestInterface $http_request
Editing session repository.
static getLogger(string $a_component_id)
Get component logger.
writePref(string $a_keyword, string $a_value)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
setMediaMode()
set media and editing mode
static _createEntry(int $a_obj_id, string $a_action, array $a_info_params=[], string $a_obj_type="", string $a_user_comment="", bool $a_update_last=false)
Creates a new history entry for an object.
showSnippetInfo()
Show snippet info.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAllReferences(int $id)
get all reference ids for object ID
paste(string $a_hier_id)
paste from clipboard (redirects to clipboard)
confirmedDeleteSelected()
displayPage()
Default for POST reloads and missing.
static lookupTitle(int $a_page_id)
characteristic()
Assign characeristic to text blocks/sections.
activate()
(de-)activate selected items
setHeader(string $a_header)
set header title
executeCommand()
execute command
ilPageObjectGUI $page_gui
static _getCharacteristics(int $a_style_id)
Content object of ilPageObject (see ILIAS DTD).
addObjectToClipboard(int $a_item_id, string $a_type, string $a_title, int $a_parent=0, string $a_time="", int $a_order_nr=0)
add an item to user's personal clipboard
ILIAS GlobalScreen ScreenContext ContextServices $tool_context
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
copyLinkedMediaToClipboard()
copy linked media object to clipboard
parses the objects.xml it handles the xml-description of all ilias objects
string $requested_pl_pc_id
Class ilPCContentInclude.
initCharacteristicForm(array $a_target, array $a_types)
Init map creation/update form.
static _lookupTitle(int $obj_id)
setContent(string $a_html)
Sets content for standard template.
insertFromClipboard()
insert object from clipboard
copyLinkedMediaToMediaPool()
copy linked media object to media pool
Class ilPageObject Handles PageObjects of ILIAS Learning Modules (see ILIAS DTD)
static _getCharacteristics(int $a_style_id)
Get characteristics.
addChangeComment()
add change comment to history
ilGlobalTemplateInterface $tpl
string $requested_hier_id
form( $class_path, string $cmd, string $submit_caption="")
setFilterWhiteList(bool $a_white_list)
Set filter list as white list (per detault it is a black list)
Adapter for JSON frontend.
ilObjectDefinition $objDefinition
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Page component editing request.
setParameter(object $a_gui_obj, string $a_parameter, $a_value)
EditSessionRepository $edit_repo
pasteFromClipboard(string $a_hier_id)
paste from clipboard (redirects to clipboard)
__construct(ilPageObject $a_page_object, ilPageObjectGUI $a_page_object_gui)
setIntLinkReturn(string $a_return)