4include_once(
"./Services/COPage/classes/class.ilPageObjectGUI.php");
73 public function __construct(&$a_page_object, &$a_page_object_gui)
77 $this->help =
$DIC[
"ilHelp"];
78 $this->
user = $DIC->user();
79 $this->access =
$DIC->access();
84 $ilTabs =
$DIC->tabs();
93 $this->tabs_gui = $ilTabs;
94 $this->page = $a_page_object;
95 $this->page_gui = $a_page_object_gui;
97 $this->ctrl->saveParameter($this, array(
"hier_id",
"pc_id"));
108 $this->header = $a_header;
128 $this->locator = $a_locator;
136 $this->ctrl->returnToParent($this);
141 $this->int_link_return = $a_return;
147 $this->page_back_title = $a_title;
158 $this->log->debug(
"ilPageEditorGUI: executeCommand begin");
160 $cmd = $this->ctrl->getCmd(
"displayPage");
162 $cmdClass = strtolower($this->ctrl->getCmdClass());
164 $hier_id =
$_GET[
"hier_id"];
165 $pc_id =
$_GET[
"pc_id"];
166 if (isset(
$_POST[
"new_hier_id"])) {
167 $hier_id =
$_POST[
"new_hier_id"];
172 $new_type = (isset(
$_GET[
"new_type"]))
199 if (substr($cmd, 0, 5) ==
"exec_") {
202 $pca = explode(
":", key(
$_POST[
"cmd"]));
205 $cmd = explode(
"_", $pca[0]);
207 $hier_id = implode($cmd,
"_");
208 $cmd =
$_POST[
"command" . $hier_id];
212 $first_hier_character = substr($hier_id, 0, 1);
213 if ($first_hier_character ==
"c" ||
214 $first_hier_character ==
"r" ||
215 $first_hier_character ==
"g" ||
216 $first_hier_character ==
"i") {
217 $hier_id = substr($hier_id, 1);
219 $this->page->buildDom();
220 $this->page->addHierIDs();
224 if ($cmdClass !=
"ilfilesystemgui") {
225 $com = explode(
"_", $cmd);
230 $next_class = $this->ctrl->getNextClass($this);
231 $this->log->debug(
"next class: " . $next_class);
234 if ($next_class ==
"ilpcplaceholdergui" && $hier_id ==
"" &&
$_GET[
"pl_pc_id"] !=
"") {
235 $hid = $this->page->getHierIdsForPCIds(array(
$_GET[
"pl_pc_id"]));
236 $hier_id = $hid[
$_GET[
"pl_pc_id"]];
240 if ($com[0] ==
"insert" || $com[0] ==
"create") {
244 if ($ctype ==
"mob") {
249 if ($cmd ==
"editLinkedMedia") {
250 $this->ctrl->setCmd(
"edit");
252 $_GET[
"pgEdMediaMode"] =
"editLinkedMedia";
255 if (
$_GET[
"pgEdMediaMode"] ==
"editLinkedMedia") {
256 $this->ctrl->setParameter($this,
"pgEdMediaMode",
"editLinkedMedia");
257 $this->ctrl->setParameter($this,
"mob_id",
$_GET[
"mob_id"]);
258 if ($cmdClass !=
"ilinternallinkgui" && $cmdClass !=
"ilmdeditorgui"
259 && $cmdClass !=
"ilimagemapeditorgui" && $cmdClass !=
"ilfilesystemgui") {
260 $this->ctrl->setCmdClass(
"ilobjmediaobjectgui");
261 $cmdClass =
"ilobjmediaobjectgui";
267 echo
";$cmd;" . $next_class .
";";
269 echo
"-$cmd-" . $this->ctrl->getCmd() .
"-";
276 if ($cmd !=
"insertFromClipboard" && $cmd !=
"pasteFromClipboard" &&
277 $cmd !=
"setMediaMode" && $cmd !=
"copyLinkedMediaToClipboard" &&
278 $cmd !=
"activatePage" && $cmd !=
"deactivatePage" &&
279 $cmd !=
"copyLinkedMediaToMediaPool" && $cmd !=
"showSnippetInfo" &&
280 $cmd !=
"deleteSelected" && $cmd !=
"paste" &&
281 $cmd !=
"cancelDeleteSelected" && $cmd !=
"confirmedDeleteSelected" &&
282 $cmd !=
"copySelected" && $cmd !=
"cutSelected" &&
283 ($cmd !=
"displayPage" ||
$_POST[
"editImagemapForward_x"] !=
"" ||
$_POST[
"imagemap_x"] !=
"") &&
284 ($cmd !=
"displayPage" ||
$_POST[
"editImagemapForward_x"] !=
"") &&
285 $cmd !=
"activateSelected" && $cmd !=
"assignCharacteristicForm" &&
286 $cmd !=
"assignCharacteristic" &&
287 $cmdClass !=
"ilrepositoryselector2inputgui" &&
288 $cmd !=
"cancelCreate" && $cmd !=
"popup" &&
289 $cmdClass !=
"ileditclipboardgui" && $cmd !=
"addChangeComment" &&
290 ($cmdClass !=
"ilinternallinkgui" || ($next_class ==
"ilpcmediaobjectgui"))) {
291 if (
$_GET[
"pgEdMediaMode"] !=
"editLinkedMedia") {
294 $cont_obj = $this->page->getContentObject($hier_id, $pc_id);
296 $this->log->debug(
"ilPageEditorGUI: ...returnToParent (cmdClass: $cmdClass, nextClass: $next_class" .
297 ", hier_id: " . $hier_id .
", pc_id: " . $pc_id .
")");
298 $ilCtrl->returnToParent($this);
309 if ($ctype !=
"media" || !is_object(
$cont_obj)) {
311 $this->tpl->setTitle($this->
getHeader());
320 $this->ctrl->setParameter($this,
"hier_id", $hier_id);
321 $this->ctrl->setParameter($this,
"pc_id", $pc_id);
322 $this->ctrl->setCmd($cmd);
327 $this->log->debug(
"(2) next class: " . $next_class .
", ctype: " . $ctype);
329 if ($next_class ==
"") {
330 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
332 if (is_array($pc_def)) {
333 $this->ctrl->setCmdClass($pc_def[
"pc_gui_class"]);
335 $next_class = $this->ctrl->getNextClass($this);
339 if ($cmd ==
"displayPage" &&
$_POST[
"editImagemapForward_x"] ==
"" &&
$_POST[
"imagemap_x"] ==
"") {
344 $this->log->debug(
"ilPageEditorGUI: ... next_class:" . $next_class .
", pc_id:" . $pc_id .
345 ", hier_id:" . $hier_id .
", ctype:" . $ctype .
", cmd:" . $cmd);
346 switch ($next_class) {
347 case "ilinternallinkgui":
349 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultType(),
350 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultId(),
351 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultIdIsRef()
353 $link_gui->setFilterWhiteList(
354 $this->page_gui->getPageConfig()->getIntLinkFilterWhiteList()
356 foreach ($this->page_gui->getPageConfig()->getIntLinkFilters() as $filter) {
357 $link_gui->filterLinkType($filter);
359 $link_gui->setReturn($this->int_link_return);
361 $ret = $this->ctrl->forwardCommand($link_gui);
365 case "ilpcmediaobjectgui":
366 include_once(
"./Services/COPage/classes/class.ilPCMediaObjectGUI.php");
368 $this->tabs_gui->clearTargets();
369 $this->tabs_gui->setBackTarget(
370 $this->page_gui->page_back_title,
371 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
374 $pcmob_gui->setStyleId($this->page_gui->getStyleId());
375 $pcmob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
376 $ret = $this->ctrl->forwardCommand($pcmob_gui);
377 $ilHelp->setScreenIdComponent(
"copg_media");
381 case "ilobjmediaobjectgui":
382 $this->tabs_gui->clearTargets();
383 $this->tabs_gui->setBackTarget(
384 $this->lng->txt(
"back"),
385 $ilCtrl->getParentReturn($this)
389 $mob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
390 $this->tpl->setTitle($this->lng->txt(
"mob") .
": " .
392 $ret = $this->ctrl->forwardCommand($mob_gui);
396 case "ilpcquestiongui":
397 include_once(
"./Services/COPage/classes/class.ilPCQuestionGUI.php");
399 $pc_question_gui->setSelfAssessmentMode($this->page_gui->getPageConfig()->getEnableSelfAssessment());
400 $pc_question_gui->setPageConfig($this->page_gui->getPageConfig());
402 if ($this->page_gui->getPageConfig()->getEnableSelfAssessment()) {
403 $this->tabs_gui->clearTargets();
404 $ilHelp->setScreenIdComponent(
"copg_pcqst");
405 $this->tabs_gui->setBackTarget(
406 $this->lng->txt(
"back"),
407 $ilCtrl->getParentReturn($this)
409 $ret = $this->ctrl->forwardCommand($pc_question_gui);
411 $cmd = $this->ctrl->getCmd();
412 $pc_question_gui->$cmd();
413 $this->ctrl->redirectByClass(array(
"ilobjquestionpoolgui", get_class(
$cont_obj)),
"editQuestion");
418 case "ilpcpluggedgui":
419 $this->tabs_gui->clearTargets();
420 include_once(
"./Services/COPage/classes/class.ilPCPluggedGUI.php");
428 $ret = $this->ctrl->forwardCommand($plugged_gui);
434 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
437 $this->tabs_gui->clearTargets();
438 $this->tabs_gui->setBackTarget(
439 $this->page_gui->page_back_title,
440 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
442 $ilHelp->setScreenIdComponent(
"copg_" . $pc_def[
"pc_type"]);
444 $gui_class_name = $pc_def[
"pc_gui_class"];
445 $pc_gui =
new $gui_class_name($this->page,
$cont_obj, $hier_id, $pc_id);
446 if ($pc_def[
"style_classes"]) {
447 $pc_gui->setStyleId($this->page_gui->getStyleId());
449 $pc_gui->setPageConfig($this->page_gui->getPageConfig());
450 $ret = $this->ctrl->forwardCommand($pc_gui);
454 if ($cmd ==
"pasteFromClipboard") {
456 } elseif ($cmd ==
"paste") {
459 $ret = $this->$cmd();
466 $this->log->debug(
"ilPageEditorGUI: executeCommand end");
481 if (
$ilUser->getPref(
"ilPageEditor_JavaScript") !=
"disable"
498 $this->page_gui->activatePage();
503 $this->page_gui->deactivatePage();
513 $ilUser->writePref(
"ilPageEditor_MediaMode",
$_POST[
"media_mode"]);
514 $ilUser->writePref(
"ilPageEditor_HTMLMode",
$_POST[
"html_mode"]);
515 if (
$ilUser->getPref(
"ilPageEditor_JavaScript") !=
$_POST[
"js_mode"]) {
517 if ($this->page->getParentType() ==
"lm") {
518 $this->ctrl->setParameterByClass(
"illmpageobjectgui",
"reloadTree",
"y");
521 $ilUser->writePref(
"ilPageEditor_JavaScript",
$_POST[
"js_mode"]);
524 if ($this->page->getParentType() ==
"lm") {
525 $this->ctrl->redirectByClass(
"illmpageobjectgui",
"edit");
527 $this->ctrl->returnToParent($this);
540 $this->ctrl->returnToParent($this);
550 $this->ctrl->setParameterByClass(
"ilmediapooltargetselector",
"mob_id",
$_POST[
"mob_id"]);
551 $this->ctrl->redirectByClass(
"ilmediapooltargetselector",
"listPools");
559 include_once(
"./Services/History/classes/class.ilHistory.php");
561 $this->page->getId(),
564 $this->page->getParentType() .
":pg",
569 $this->ctrl->returnToParent($this);
581 $targets = explode(
";",
$_POST[
"target"][0]);
583 if (count($targets) == 0) {
585 $this->ctrl->returnToParent($this);
587 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
589 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
590 $cgui->setHeaderText(
$lng->txt(
"copg_confirm_el_deletion"));
591 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelDeleteSelected");
592 $cgui->setConfirm(
$lng->txt(
"confirm"),
"confirmedDeleteSelected");
593 $cgui->addHiddenItem(
"target",
$_POST[
"target"][0]);
595 $tpl->setContent($cgui->getHTML());
607 $this->ctrl->returnToParent($this);
616 $targets = explode(
";",
$_POST[
"target"]);
617 if (count($targets) > 0) {
618 $updated = $this->page->deleteContents(
621 $this->page_gui->getPageConfig()->getEnableSelfAssessment()
623 if ($updated !==
true) {
629 $this->ctrl->returnToParent($this);
639 if (is_int(strpos(
$_POST[
"target"][0],
";"))) {
642 if (is_array(
$_POST[
"target"])) {
643 $this->page->copyContents(
$_POST[
"target"]);
646 $this->ctrl->returnToParent($this);
656 if (is_int(strpos(
$_POST[
"target"][0],
";"))) {
659 if (is_array(
$_POST[
"target"])) {
660 $updated = $this->page->cutContents(
$_POST[
"target"]);
661 if ($updated !==
true) {
668 $this->ctrl->returnToParent($this);
677 $this->page->pasteContents($a_hier_id, $this->page_gui->getPageConfig()->getEnableSelfAssessment());
678 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
680 $this->ctrl->returnToParent($this);
688 if (is_int(strpos(
$_POST[
"target"][0],
";"))) {
691 if (is_array(
$_POST[
"target"])) {
692 $updated = $this->page->switchEnableMultiple(
695 $this->page_gui->getPageConfig()->getEnableSelfAssessment()
697 if ($updated !==
true) {
703 $this->ctrl->returnToParent($this);
714 if (is_int(strpos(
$_POST[
"target"][0],
";"))) {
717 if (is_array(
$_POST[
"target"])) {
722 $tarr = explode(
":",
$t);
723 $cont_obj = $this->page->getContentObject($tarr[0], $tarr[1]);
725 $types[
"par"] =
"par";
728 $types[
"sec"] =
"sec";
732 if (count($types) == 0) {
734 $this->ctrl->returnToParent($this);
737 $tpl->setContent($this->form->getHTML());
740 $this->ctrl->returnToParent($this);
754 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
756 $this->form->setTitle($this->lng->txt(
"cont_choose_characteristic"));
758 if ($a_types[
"par"] ==
"par") {
760 $this->lng->txt(
"cont_choose_characteristic_text"),
763 include_once(
"./Services/COPage/classes/class.ilPCParagraphGUI.php");
766 $this->form->addItem($select_prop);
768 if ($a_types[
"sec"] ==
"sec") {
770 $this->lng->txt(
"cont_choose_characteristic_section"),
773 include_once(
"./Services/COPage/classes/class.ilPCSectionGUI.php");
776 $this->form->addItem($select_prop);
779 foreach ($a_target as
$t) {
781 $hidden->setValue(
$t);
782 $this->form->addItem($hidden);
785 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
786 $this->form->addCommandButton(
"assignCharacteristic",
$lng->txt(
"save"));
787 $this->form->addCommandButton(
"showPage",
$lng->txt(
"cancel"));
797 if (is_array(
$_POST[
"target"])) {
799 $tarr = explode(
":",
$t);
800 $cont_obj = $this->page->getContentObject($tarr[0], $tarr[1]);
808 $updated = $this->page->update();
809 if ($updated !==
true) {
815 $this->ctrl->returnToParent($this);
825 $ilCtrl->setParameter($this,
"hier_id", $a_hier_id);
827 "ilEditClipboardGUI",
829 rawurlencode(
$ilCtrl->getLinkTarget(
831 "insertFromClipboard",
838 $ilCtrl->redirectByClass(
"ilEditClipboardGUI",
"getObject");
846 include_once(
"./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
848 include_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
850 foreach ($ids as $id2) {
851 $id = explode(
":", $id2);
854 if (
$type ==
"mob") {
856 $this->content_obj->readMediaObject(
$id);
857 $this->content_obj->createAlias($this->page,
$_GET[
"hier_id"]);
858 $this->updated = $this->page->update();
860 if (
$type ==
"incl") {
861 include_once(
"./Services/COPage/classes/class.ilPCContentInclude.php");
863 $this->content_obj->create($this->page,
$_GET[
"hier_id"]);
864 $this->content_obj->setContentType(
"mep");
865 $this->content_obj->setContentId(
$id);
866 $this->updated = $this->page->update();
870 $this->ctrl->returnToParent($this);
878 $this->ctrl->returnToParent($this);
902 $stpl =
new ilTemplate(
"tpl.snippet_info.html",
true,
true,
"Services/COPage");
904 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
906 foreach ($mep_pools as $mep_id) {
909 foreach ($ref_ids as $rid) {
910 if (!$edit_link && $ilAccess->checkAccess(
"write",
"", $rid)) {
911 $stpl->setCurrentBlock(
"edit_link");
912 $stpl->setVariable(
"TXT_EDIT",
$lng->txt(
"edit"));
915 "./goto.php?target=mep_" . $rid
917 $stpl->parseCurrentBlock();
920 $stpl->setCurrentBlock(
"pool");
921 $stpl->setVariable(
"TXT_MEDIA_POOL",
$lng->txt(
"obj_mep"));
923 $stpl->parseCurrentBlock();
926 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
927 $stpl->setVariable(
"TXT_TITLE",
$lng->txt(
"title"));
929 $stpl->setVariable(
"TXT_BACK",
$lng->txt(
"back"));
932 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
934 $tpl->setContent($stpl->get());
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
An exception for terminatinating execution or to throw for unit testing.
static getPCDefinitionByGUIClassName($a_gui_class_name)
Get PC definition by name.
static getPCDefinitionByType($a_pc_type)
Get PC definition by type.
static requirePCGUIClassByName($a_name)
Get instance.
static isPCGUIClassName($a_class_name, $a_lower_case=false)
Is given class name a pc gui class?
Confirmation screen class.
static _createEntry( $a_obj_id, $a_action, $a_info_params="", $a_obj_type="", $a_user_comment="", $a_update_last=false)
Creates a new history entry for an object.
static getLogger($a_component_id)
Get component logger.
static lookupTitle($a_page_id)
Lookup title.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
Class ilPCContentInclude.
static _getCharacteristics($a_style_id)
Get characteristics.
static _getCharacteristics($a_style_id)
Get characteristics.
copyLinkedMediaToMediaPool()
copy linked media object to media pool
setPageBackTitle($a_title)
activateSelected()
(de-)activate selected items
copySelected()
Copy selected items.
__construct(&$a_page_object, &$a_page_object_gui)
Constructor.
addChangeComment()
add change comment to history
initCharacteristicForm($a_target, $a_types)
Init map creation/update form.
insertFromClipboard()
insert object from clipboard
copyLinkedMediaToClipboard()
copy linked media object to clipboard
setLocator(&$a_locator)
set locator object
cancelDeleteSelected()
Cancel deletion.
displayPage()
Default for POST reloads and missing.
assignCharacteristicForm()
Assign characeristic to text blocks/sections.
pasteFromClipboard($a_hier_id)
paste from clipboard (redirects to clipboard)
setMediaMode()
set media and editing mode
paste($a_hier_id)
paste from clipboard (redirects to clipboard)
setIntLinkReturn($a_return)
static _isBrowserJSEditCapable()
checks wether browser is javascript editing capable
static _doJSEditing()
checks if current user has activated js editing and if browser is js capable
confirmedDeleteSelected()
Delete selected items.
displayLocator()
display locator
setHeader($a_header)
set header title
showSnippetInfo()
Show snippet info.
returnToContext()
redirect to parent context
cutSelected()
Cut selected items.
getHeader()
get header title
executeCommand()
execute command
assignCharacteristic()
Assign characteristic.
special template class to simplify handling of ITX/PEAR
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
if(!array_key_exists('StateId', $_REQUEST)) $id