64 protected \ILIAS\DI\UIServices
$ui;
65 protected \ILIAS\GlobalScreen\ScreenContext\ContextServices
$tool_context;
80 $this->
help = $DIC[
"ilHelp"];
81 $this->
user = $DIC->user();
82 $this->
access = $DIC->access();
84 $lng = $DIC->language();
85 $objDefinition = $DIC[
"objDefinition"];
86 $ilCtrl = $DIC->ctrl();
87 $ilTabs = $DIC->tabs();
89 $this->
ui = $DIC->ui();
91 $this->request = $DIC->copage()->internal()->gui()->page()->editRequest();
92 $this->requested_hier_id = $this->request->getHierId();
93 $this->requested_pc_id = $this->request->getPCId();
94 $this->requested_pl_pc_id = $this->request->getPlaceholderPCId();
95 $this->requested_ctype = $this->request->getCType();
96 $this->requested_cname = $this->request->getCName();
97 $this->requested_mob_id = $this->request->getMobId();
101 $this->tool_context = $DIC->globalScreen()->tool()->context();
104 $this->http_request = $DIC->http()->request();
105 $this->
ctrl = $ilCtrl;
109 $this->tabs_gui = $ilTabs;
110 $this->page = $a_page_object;
111 $this->page_gui = $a_page_object_gui;
113 $this->
ctrl->saveParameter($this, array(
"hier_id",
"pc_id"));
115 $this->edit_repo = $DIC
127 $this->header = $a_header;
137 $this->
ctrl->returnToParent($this);
142 $this->int_link_return = $a_return;
147 $this->page_back_title = $a_title;
157 $this->log->debug(
"begin =========================");
166 $cmd = $this->
ctrl->getCmd(
"displayPage");
167 $cmdClass = strtolower($this->
ctrl->getCmdClass());
171 $new_hier_id = $this->request->getString(
"new_hier_id");
172 if ($new_hier_id !=
"") {
173 $hier_id = $new_hier_id;
176 $this->log->debug(
"step BC: cmd:$cmd, cmdClass:$cmdClass, hier_id: $hier_id, pc_id: $pc_id");
180 if (substr($cmd, 0, 5) ==
"exec_") {
182 $pca = explode(
":", $this->
ctrl->getCmd());
184 $cmd = explode(
"_", $pca[0]);
186 $hier_id = implode(
"_", $cmd);
187 $cmd = $this->request->getString(
"command" . $hier_id);
189 $this->log->debug(
"step EC: cmd:$cmd, hier_id: $hier_id, pc_id: $pc_id");
193 $first_hier_character = substr($hier_id, 0, 1);
194 if ($first_hier_character ==
"c" ||
195 $first_hier_character ==
"r" ||
196 $first_hier_character ==
"g" ||
197 $first_hier_character ==
"i") {
198 $hier_id = substr($hier_id, 1);
200 $this->log->debug(
"step CC: cmd:$cmd, hier_id: $hier_id, pc_id: $pc_id");
203 $this->page->buildDom();
204 $this->page->addHierIDs();
209 if ($cmdClass !=
"ilfilesystemgui") {
210 $com = explode(
"_", $cmd);
213 $this->log->debug(
"step CS: cmd:$cmd");
217 $next_class = $this->
ctrl->getNextClass($this);
218 $this->log->debug(
"step NC: next class: " . $next_class);
222 if ($next_class ==
"ilpcplaceholdergui" && $hier_id ==
"" && $this->requested_pl_pc_id !=
"") {
223 $hid = $this->page->getHierIdsForPCIds(array($this->requested_pl_pc_id));
226 $this->log->debug(
"step PH: next class: " . $next_class);
228 if (!is_null($com) && ($com[0] ==
"insert" || $com[0] ==
"create")) {
231 $ctype = $com[1] ??
"";
232 $add_type = $this->request->getString(
"pluginName");
233 if ($ctype ==
"mob") {
237 $this->log->debug(
"step CM: cmd: " . $cmd .
", ctype: " . $ctype .
", add_type: " . $add_type);
239 $this->log->debug(
"step LM: cmd: " . $cmd .
", cmdClass: " . $cmdClass);
242 $this->log->debug(
"before PR: cmdClass: $cmdClass, nextClass: $next_class" .
243 ", hier_id: " . $hier_id .
", pc_id: " . $pc_id .
")");
246 if ($this->requested_ctype ==
"" && $this->requested_cname ==
"" &&
247 $cmd !=
"insertFromClipboard" && $cmd !=
"pasteFromClipboard" &&
248 $cmd !=
"setMediaMode" && $cmd !=
"copyLinkedMediaToClipboard" &&
249 $cmd !=
"activatePage" && $cmd !=
"deactivatePage" &&
250 $cmd !=
"copyLinkedMediaToMediaPool" && $cmd !=
"showSnippetInfo" &&
251 $cmd !=
"delete" && $cmd !=
"paste" &&
252 $cmd !=
"cancelDeleteSelected" && $cmd !=
"confirmedDeleteSelected" &&
253 $cmd !=
"copy" && $cmd !=
"cut" &&
254 ($cmd !=
"displayPage" || $this->request->getString(
"editImagemapForward_x") !=
"") &&
255 $cmd !=
"activate" && $cmd !=
"characteristic" &&
256 $cmd !=
"assignCharacteristic" &&
257 $cmdClass !=
"ilrepositoryselector2inputgui" &&
258 $cmdClass !=
"ilpageeditorserveradaptergui" &&
259 $cmd !=
"cancelCreate" && $cmd !=
"popup" &&
260 $cmdClass !=
"ileditclipboardgui" && $cmd !=
"addChangeComment" &&
261 ($cmdClass !=
"ilinternallinkgui" || ($next_class ==
"ilpcmediaobjectgui"))) {
262 $cont_obj = $this->page->getContentObject($hier_id, $pc_id);
263 if (!is_object($cont_obj)) {
264 $this->log->debug(
"returnToParent");
265 $ilCtrl->returnToParent($this);
272 if ($this->requested_ctype !=
"" || $this->requested_cname !=
"") {
274 if ($this->requested_cname !=
"") {
276 $ctype = $pc_def[
"pc_type"];
280 if (!in_array($cmd, [
"insert",
"create"])) {
281 $cont_obj = $this->page->getContentObject($hier_id, $pc_id);
285 if ($pc_id !=
"" && $hier_id ==
"") {
286 $hier_id = $this->page->getHierIdForPcId($pc_id);
288 if ($ctype !=
"media" || !is_object($cont_obj)) {
290 $this->tpl->setTitle($this->
getHeader());
297 $this->
ctrl->setParameter($this,
"hier_id", $hier_id);
298 $this->
ctrl->setParameter($this,
"pc_id", $pc_id);
299 $this->
ctrl->setCmd($cmd);
300 if ($next_class ==
"") {
302 if (is_array($pc_def)) {
303 $this->
ctrl->setCmdClass($pc_def[
"pc_gui_class"]);
305 $next_class = $this->
ctrl->getNextClass($this);
307 $this->log->debug(
"step NC2: next_class: $next_class");
311 if ($cmd ==
"displayPage" &&
312 $this->request->getString(
"editImagemapForward_x") ==
"" 313 && $this->request->getString(
"imagemap_x") ==
"") {
318 switch ($next_class) {
319 case "ilinternallinkgui":
321 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultType(),
322 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultId(),
323 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultIdIsRef()
326 $this->page_gui->getPageConfig()->getIntLinkFilterWhiteList()
328 foreach ($this->page_gui->getPageConfig()->getIntLinkFilters() as $filter) {
329 $link_gui->filterLinkType($filter);
331 $link_gui->setReturn($this->int_link_return);
333 $ret = $this->
ctrl->forwardCommand($link_gui);
337 case "ilpcmediaobjectgui":
338 $this->tabs_gui->clearTargets();
339 $this->tabs_gui->setBackTarget(
340 $this->page_gui->page_back_title,
341 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
344 $pcmob_gui->setStyleId($this->page_gui->getStyleId());
345 $pcmob_gui->setSubCmd($ctype);
346 $pcmob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
347 $ret = $this->
ctrl->forwardCommand($pcmob_gui);
348 $ilHelp->setScreenIdComponent(
"copg_media");
352 case "ilobjmediaobjectgui":
353 $this->tabs_gui->clearTargets();
354 $this->tabs_gui->setBackTarget(
355 $this->
lng->txt(
"back"),
356 (string) $ilCtrl->getParentReturn($this)
360 $mob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
361 $this->tpl->setTitle($this->
lng->txt(
"mob") .
": " .
363 $ret = $this->
ctrl->forwardCommand($mob_gui);
367 case "ilpcquestiongui":
368 $pc_question_gui =
new ilPCQuestionGUI($this->page, $cont_obj, $hier_id, $pc_id);
369 $pc_question_gui->setSelfAssessmentMode($this->page_gui->getPageConfig()->getEnableSelfAssessment());
370 $pc_question_gui->setPageConfig($this->page_gui->getPageConfig());
372 if ($this->page_gui->getPageConfig()->getEnableSelfAssessment()) {
373 $this->tabs_gui->clearTargets();
374 $ilHelp->setScreenIdComponent(
"copg_pcqst");
375 $this->tabs_gui->setBackTarget(
376 $this->
lng->txt(
"back"),
377 (string) $ilCtrl->getParentReturn($this)
379 $ret = $this->
ctrl->forwardCommand($pc_question_gui);
381 $cmd = $this->
ctrl->getCmd();
382 $pc_question_gui->$cmd();
383 $this->
ctrl->redirectByClass(array(
"ilobjquestionpoolgui", get_class($cont_obj)),
"editQuestion");
388 case "ilpcpluggedgui":
389 $this->tabs_gui->clearTargets();
397 $ret = $this->
ctrl->forwardCommand($plugged_gui);
400 case "ilpageeditorserveradaptergui":
407 $this->
ctrl->forwardCommand($adapter);
414 $this->log->debug(
"Generic Call");
416 $this->tabs_gui->clearTargets();
417 $this->tabs_gui->setBackTarget(
418 $this->page_gui->page_back_title,
419 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
421 $ilHelp->setScreenIdComponent(
"copg_" . $pc_def[
"pc_type"]);
423 $gui_class_name = $pc_def[
"pc_gui_class"];
424 $pc_gui =
new $gui_class_name($this->page, $cont_obj, $hier_id, $pc_id);
425 if ($pc_def[
"style_classes"]) {
426 $pc_gui->setStyleId($this->page_gui->getStyleId());
428 $pc_gui->setPageConfig($this->page_gui->getPageConfig());
429 $ret = $this->
ctrl->forwardCommand($pc_gui);
431 $this->log->debug(
"Call ilPageEditorGUI command.");
434 if ($cmd ==
"pasteFromClipboard") {
437 } elseif ($cmd ==
"paste") {
439 $this->
paste($hier_id);
441 $ret = $this->$cmd();
448 $this->log->debug(
"end --------------------");
450 return (
string) $ret;
455 $this->page_gui->activatePage();
460 $this->page_gui->deactivatePage();
471 "ilPageEditor_MediaMode",
472 $this->request->getString(
"media_mode")
475 "ilPageEditor_HTMLMode",
476 $this->request->getString(
"html_mode")
478 $js_mode = $this->request->getString(
"js_mode");
479 if (
$ilUser->getPref(
"ilPageEditor_JavaScript") != $js_mode) {
481 if ($this->page->getParentType() ==
"lm") {
482 $this->
ctrl->setParameterByClass(
"illmpageobjectgui",
"reloadTree",
"y");
485 $ilUser->writePref(
"ilPageEditor_JavaScript", $js_mode);
488 if ($this->page->getParentType() ==
"lm") {
489 $this->
ctrl->redirectByClass(
"illmpageobjectgui",
"edit");
491 $this->
ctrl->returnToParent($this);
502 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"copied_to_clipboard"),
true);
504 $this->requested_mob_id,
508 $this->
ctrl->returnToParent($this);
516 $this->
ctrl->setParameterByClass(
"ilmediapooltargetselector",
"mob_id", $this->requested_mob_id);
517 $this->
ctrl->redirectByClass(
"ilmediapooltargetselector",
"listPools");
526 $this->page->getId(),
529 $this->page->getParentType() .
":pg",
530 $this->request->getString(
"change_comment"),
533 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
"cont_added_comment"),
true);
534 $this->
ctrl->returnToParent($this);
540 public function delete():
void 546 $targets = $this->request->getIds();
548 if (count($targets) == 0) {
549 $this->tpl->setOnScreenMessage(
'info', $lng->
txt(
"no_checkbox"),
true);
550 $this->
ctrl->returnToParent($this);
553 $cgui->setFormAction($ilCtrl->getFormAction($this));
554 $cgui->setHeaderText($lng->
txt(
"copg_confirm_el_deletion"));
555 $cgui->setCancel($lng->
txt(
"cancel"),
"cancelDeleteSelected");
556 $cgui->setConfirm($lng->
txt(
"confirm"),
"confirmedDeleteSelected");
557 foreach ($targets as $t) {
558 $cgui->addHiddenItem(
"ids[]", $t);
567 $this->
ctrl->returnToParent($this);
572 $targets = $this->request->getIds();
573 if (count($targets) > 0) {
574 $updated = $this->page->deleteContents(
577 $this->page_gui->getPageConfig()->getEnableSelfAssessment()
580 $this->edit_repo->setPageError(
$updated);
582 $this->edit_repo->clearPageError();
585 $this->
ctrl->returnToParent($this);
595 $ids = $this->request->getIds();
596 if (count($ids) > 0) {
597 $this->page->copyContents($ids);
598 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"cont_sel_el_copied_use_paste"),
true);
600 $this->
ctrl->returnToParent($this);
606 public function cut(): void
610 $ids = $this->request->getIds();
612 $updated = $this->page->cutContents($ids);
614 $this->edit_repo->setPageError(
$updated);
616 $this->edit_repo->clearPageError();
618 $this->tpl->setOnScreenMessage(
'success', $lng->
txt(
"cont_sel_el_cut_use_paste"),
true);
620 $this->
ctrl->returnToParent($this);
626 public function paste(
string $a_hier_id): void
628 $this->page->pasteContents($a_hier_id, $this->page_gui->getPageConfig()->getEnableSelfAssessment());
630 $this->
ctrl->returnToParent($this);
638 $ids = $this->request->getIds();
639 if (count($ids) > 0) {
640 $updated = $this->page->switchEnableMultiple(
643 $this->page_gui->getPageConfig()->getEnableSelfAssessment()
646 $this->edit_repo->setPageError(
$updated);
648 $this->edit_repo->clearPageError();
651 $this->
ctrl->returnToParent($this);
662 $ids = $this->request->getIds();
663 if (count($ids) > 0) {
667 foreach ($ids as $t) {
668 $tarr = explode(
":", $t);
669 $cont_obj = $this->page->getContentObject($tarr[0], $tarr[1]);
670 if (is_object($cont_obj) && $cont_obj->
getType() ==
"par") {
671 $types[
"par"] =
"par";
673 if (is_object($cont_obj) && $cont_obj->
getType() ==
"sec") {
674 $types[
"sec"] =
"sec";
678 if (count($types) == 0) {
679 $this->tpl->setOnScreenMessage(
'failure', $lng->
txt(
"cont_select_par_or_section"),
true);
680 $this->
ctrl->returnToParent($this);
686 $this->
ctrl->returnToParent($this);
703 $this->
form->setTitle($this->
lng->txt(
"cont_choose_characteristic"));
705 if ($a_types[
"par"] ==
"par") {
707 $this->
lng->txt(
"cont_choose_characteristic_text"),
711 $select_prop->setOptions($options);
712 $this->
form->addItem($select_prop);
714 if ($a_types[
"sec"] ==
"sec") {
716 $this->
lng->txt(
"cont_choose_characteristic_section"),
720 $select_prop->setOptions($options);
721 $this->
form->addItem($select_prop);
724 foreach ($a_target as $t) {
726 $hidden->setValue($t);
727 $this->
form->addItem($hidden);
730 $this->
form->setFormAction($ilCtrl->getFormAction($this));
731 $this->
form->addCommandButton(
"assignCharacteristic", $lng->
txt(
"save"));
732 $this->
form->addCommandButton(
"showPage", $lng->
txt(
"cancel"));
737 $char_par = $this->request->getString(
"char_par");
738 $char_sec = $this->request->getString(
"char_sec");
740 $updated = $this->page->assignCharacteristic(
741 $this->request->getStringArray(
"target"),
747 $this->edit_repo->setPageError(
$updated);
749 $this->edit_repo->clearPageError();
751 $this->
ctrl->returnToParent($this);
762 $ilCtrl->setParameterByClass(
763 "ilEditClipboardGUI",
765 rawurlencode($ilCtrl->getLinkTarget(
767 "insertFromClipboard",
774 $ilCtrl->redirectByClass(
"ilEditClipboardGUI",
"getObject");
785 $hier_id = $this->page->getHierIdForPcId($this->requested_pc_id);
786 if ($hier_id ==
"") {
791 foreach ($ids as $id2) {
792 $id = explode(
":", $id2);
795 if (
$type ==
"mob") {
797 $this->content_obj->readMediaObject(
$id);
798 $this->content_obj->createAlias($this->page, $hier_id);
799 $this->page->update();
801 if (
$type ==
"incl") {
803 $this->content_obj->create($this->page, $hier_id);
804 $this->content_obj->setContentType(
"mep");
805 $this->content_obj->setContentId(
$id);
806 $this->page->update();
810 $this->
ctrl->returnToParent($this);
818 $this->
ctrl->returnToParent($this);
831 $stpl =
new ilTemplate(
"tpl.snippet_info.html",
true,
true,
"Services/COPage");
834 $this->request->getString(
"ci_id")
836 foreach ($mep_pools as $mep_id) {
839 foreach ($ref_ids as $rid) {
840 if (!$edit_link && $ilAccess->checkAccess(
"write",
"", $rid)) {
841 $stpl->setCurrentBlock(
"edit_link");
842 $stpl->setVariable(
"TXT_EDIT", $lng->
txt(
"edit"));
845 "./goto.php?target=mep_" . $rid
847 $stpl->parseCurrentBlock();
850 $stpl->setCurrentBlock(
"pool");
851 $stpl->setVariable(
"TXT_MEDIA_POOL", $lng->
txt(
"obj_mep"));
853 $stpl->parseCurrentBlock();
856 $stpl->setVariable(
"TXT_TITLE", $lng->
txt(
"title"));
861 $stpl->setVariable(
"TXT_BACK", $lng->
txt(
"back"));
864 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
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.
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 getPCDefinitionByName(string $a_pc_name)
Get PC definition by name.
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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)
static getPCDefinitionByType(string $a_pc_type)
Get PC definition by type.
setFilterWhiteList(bool $a_white_list)
Set filter list as white list (per detault it is a black list)
Adapter for JSON frontend.
ilObjectDefinition $objDefinition
static _getCharacteristics(string $a_style_id)
$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)
static getPCDefinitionByGUIClassName(string $a_gui_class_name)
Get PC definition by name.
setIntLinkReturn(string $a_return)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static isPCGUIClassName(string $a_class_name, bool $a_lower_case=false)