4 include_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();
81 $lng = $DIC->language();
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(
"begin ============");
162 $cmd = $this->ctrl->getCmd(
"displayPage");
163 $cmdClass = strtolower($this->ctrl->getCmdClass());
165 $hier_id =
$_GET[
"hier_id"];
166 $pc_id =
$_GET[
"pc_id"];
167 if (isset(
$_POST[
"new_hier_id"])) {
168 $hier_id =
$_POST[
"new_hier_id"];
171 $new_type = (isset(
$_GET[
"new_type"]))
175 $this->log->debug(
"step BC: cmd:$cmd, cmdClass:$cmdClass, hier_id: $hier_id, pc_id: $pc_id");
179 if (substr($cmd, 0, 5) ==
"exec_") {
181 $pca = explode(
":", key(
$_POST[
"cmd"]));
183 $cmd = explode(
"_", $pca[0]);
185 $hier_id = implode($cmd,
"_");
186 $cmd =
$_POST[
"command" . $hier_id];
188 $this->log->debug(
"step EC: cmd:$cmd, hier_id: $hier_id, pc_id: $pc_id");
192 $first_hier_character = substr($hier_id, 0, 1);
193 if ($first_hier_character ==
"c" ||
194 $first_hier_character ==
"r" ||
195 $first_hier_character ==
"g" ||
196 $first_hier_character ==
"i") {
197 $hier_id = substr($hier_id, 1);
199 $this->log->debug(
"step CC: cmd:$cmd, hier_id: $hier_id, pc_id: $pc_id");
202 $this->page->buildDom();
203 $this->page->addHierIDs();
207 if ($cmdClass !=
"ilfilesystemgui") {
208 $com = explode(
"_", $cmd);
211 $this->log->debug(
"step CS: cmd:$cmd");
215 $next_class = $this->ctrl->getNextClass($this);
216 $this->log->debug(
"step NC: next class: " . $next_class);
220 if ($next_class ==
"ilpcplaceholdergui" && $hier_id ==
"" &&
$_GET[
"pl_pc_id"] !=
"") {
221 $hid = $this->page->getHierIdsForPCIds(array(
$_GET[
"pl_pc_id"]));
222 $hier_id = $hid[
$_GET[
"pl_pc_id"]];
224 $this->log->debug(
"step PH: next class: " . $next_class);
226 if ($com[0] ==
"insert" || $com[0] ==
"create") {
231 if ($ctype ==
"mob") {
235 $this->log->debug(
"step CM: cmd: " . $cmd .
", ctype: " . $ctype .
", add_type: " . $add_type);
238 if ($cmd ==
"editLinkedMedia") {
239 $this->ctrl->setCmd(
"edit");
241 $_GET[
"pgEdMediaMode"] =
"editLinkedMedia";
244 if (
$_GET[
"pgEdMediaMode"] ==
"editLinkedMedia") {
245 $this->ctrl->setParameter($this,
"pgEdMediaMode",
"editLinkedMedia");
246 $this->ctrl->setParameter($this,
"mob_id",
$_GET[
"mob_id"]);
247 if ($cmdClass !=
"ilinternallinkgui" && $cmdClass !=
"ilmdeditorgui" 248 && $cmdClass !=
"ilimagemapeditorgui" && $cmdClass !=
"ilfilesystemgui") {
249 $this->ctrl->setCmdClass(
"ilobjmediaobjectgui");
250 $cmdClass =
"ilobjmediaobjectgui";
253 $this->log->debug(
"step LM: cmd: " . $cmd .
", cmdClass: " . $cmdClass);
257 $this->log->debug(
"before PR: cmdClass: $cmdClass, nextClass: $next_class" .
258 ", hier_id: " . $hier_id .
", pc_id: " . $pc_id .
")");
261 if ($cmd !=
"insertFromClipboard" && $cmd !=
"pasteFromClipboard" &&
262 $cmd !=
"setMediaMode" && $cmd !=
"copyLinkedMediaToClipboard" &&
263 $cmd !=
"activatePage" && $cmd !=
"deactivatePage" &&
264 $cmd !=
"copyLinkedMediaToMediaPool" && $cmd !=
"showSnippetInfo" &&
265 $cmd !=
"deleteSelected" && $cmd !=
"paste" &&
266 $cmd !=
"cancelDeleteSelected" && $cmd !=
"confirmedDeleteSelected" &&
267 $cmd !=
"copySelected" && $cmd !=
"cutSelected" &&
268 ($cmd !=
"displayPage" ||
$_POST[
"editImagemapForward_x"] !=
"" ||
$_POST[
"imagemap_x"] !=
"") &&
269 ($cmd !=
"displayPage" ||
$_POST[
"editImagemapForward_x"] !=
"") &&
270 $cmd !=
"activateSelected" && $cmd !=
"assignCharacteristicForm" &&
271 $cmd !=
"assignCharacteristic" &&
272 $cmdClass !=
"ilrepositoryselector2inputgui" &&
273 $cmd !=
"cancelCreate" && $cmd !=
"popup" &&
274 $cmdClass !=
"ileditclipboardgui" && $cmd !=
"addChangeComment" &&
275 ($cmdClass !=
"ilinternallinkgui" || ($next_class ==
"ilpcmediaobjectgui"))) {
276 if (
$_GET[
"pgEdMediaMode"] !=
"editLinkedMedia") {
277 $cont_obj = $this->page->getContentObject($hier_id, $pc_id);
279 $this->log->debug(
"returnToParent");
280 $ilCtrl->returnToParent($this);
285 $this->log->debug(
"step PR: ctype: $ctype");
289 if ($ctype !=
"media" || !is_object(
$cont_obj)) {
291 $this->tpl->setTitle($this->
getHeader());
300 $this->ctrl->setParameter($this,
"hier_id", $hier_id);
301 $this->ctrl->setParameter($this,
"pc_id", $pc_id);
302 $this->ctrl->setCmd($cmd);
303 if ($next_class ==
"") {
304 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
306 if (is_array($pc_def)) {
307 $this->ctrl->setCmdClass($pc_def[
"pc_gui_class"]);
309 $next_class = $this->ctrl->getNextClass($this);
311 $this->log->debug(
"step NC: next_class: $next_class");
315 if ($cmd ==
"displayPage" &&
$_POST[
"editImagemapForward_x"] ==
"" &&
$_POST[
"imagemap_x"] ==
"") {
318 $this->log->debug(
"step IM: next_class: $next_class");
322 $this->log->debug(
"before FC: next_class:" . $next_class .
", pc_id:" . $pc_id .
323 ", hier_id:" . $hier_id .
", ctype:" . $ctype .
", cmd:" . $cmd .
", _GET[cmd]: " .
$_GET[
"cmd"]);
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 include_once(
"./Services/COPage/classes/class.ilPCMediaObjectGUI.php");
346 $this->tabs_gui->clearTargets();
347 $this->tabs_gui->setBackTarget(
348 $this->page_gui->page_back_title,
349 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
352 $pcmob_gui->setStyleId($this->page_gui->getStyleId());
353 $pcmob_gui->setSubCmd($ctype);
354 $pcmob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
355 $ret = $this->ctrl->forwardCommand($pcmob_gui);
356 $ilHelp->setScreenIdComponent(
"copg_media");
360 case "ilobjmediaobjectgui":
361 $this->tabs_gui->clearTargets();
362 $this->tabs_gui->setBackTarget(
363 $this->lng->txt(
"back"),
364 $ilCtrl->getParentReturn($this)
368 $mob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
369 $this->tpl->setTitle($this->lng->txt(
"mob") .
": " .
371 $ret = $this->ctrl->forwardCommand($mob_gui);
375 case "ilpcquestiongui":
376 include_once(
"./Services/COPage/classes/class.ilPCQuestionGUI.php");
378 $pc_question_gui->setSelfAssessmentMode($this->page_gui->getPageConfig()->getEnableSelfAssessment());
379 $pc_question_gui->setPageConfig($this->page_gui->getPageConfig());
381 if ($this->page_gui->getPageConfig()->getEnableSelfAssessment()) {
382 $this->tabs_gui->clearTargets();
383 $ilHelp->setScreenIdComponent(
"copg_pcqst");
384 $this->tabs_gui->setBackTarget(
385 $this->lng->txt(
"back"),
386 $ilCtrl->getParentReturn($this)
388 $ret = $this->ctrl->forwardCommand($pc_question_gui);
390 $cmd = $this->ctrl->getCmd();
391 $pc_question_gui->$cmd();
392 $this->ctrl->redirectByClass(array(
"ilobjquestionpoolgui", get_class(
$cont_obj)),
"editQuestion");
397 case "ilpcpluggedgui":
398 $this->tabs_gui->clearTargets();
399 include_once(
"./Services/COPage/classes/class.ilPCPluggedGUI.php");
407 $ret = $this->ctrl->forwardCommand($plugged_gui);
413 include_once(
"./Services/COPage/classes/class.ilCOPagePCDef.php");
415 $this->log->debug(
"Generic Call");
417 $this->tabs_gui->clearTargets();
418 $this->tabs_gui->setBackTarget(
419 $this->page_gui->page_back_title,
420 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
422 $ilHelp->setScreenIdComponent(
"copg_" . $pc_def[
"pc_type"]);
424 $gui_class_name = $pc_def[
"pc_gui_class"];
425 $pc_gui =
new $gui_class_name($this->page,
$cont_obj, $hier_id, $pc_id);
426 if ($pc_def[
"style_classes"]) {
427 $pc_gui->setStyleId($this->page_gui->getStyleId());
429 $pc_gui->setPageConfig($this->page_gui->getPageConfig());
430 $ret = $this->ctrl->forwardCommand($pc_gui);
432 $this->log->debug(
"Call ilPageEditorGUI command.");
435 if ($cmd ==
"pasteFromClipboard") {
437 } elseif ($cmd ==
"paste") {
440 $ret = $this->$cmd();
447 $this->log->debug(
"end ---");
462 if (
$ilUser->getPref(
"ilPageEditor_JavaScript") !=
"disable" 479 $this->page_gui->activatePage();
484 $this->page_gui->deactivatePage();
494 $ilUser->writePref(
"ilPageEditor_MediaMode",
$_POST[
"media_mode"]);
495 $ilUser->writePref(
"ilPageEditor_HTMLMode",
$_POST[
"html_mode"]);
496 if (
$ilUser->getPref(
"ilPageEditor_JavaScript") !=
$_POST[
"js_mode"]) {
498 if ($this->page->getParentType() ==
"lm") {
499 $this->ctrl->setParameterByClass(
"illmpageobjectgui",
"reloadTree",
"y");
502 $ilUser->writePref(
"ilPageEditor_JavaScript",
$_POST[
"js_mode"]);
505 if ($this->page->getParentType() ==
"lm") {
506 $this->ctrl->redirectByClass(
"illmpageobjectgui",
"edit");
508 $this->ctrl->returnToParent($this);
519 ilUtil::sendSuccess($this->lng->txt(
"copied_to_clipboard"),
true);
521 $this->ctrl->returnToParent($this);
531 $this->ctrl->setParameterByClass(
"ilmediapooltargetselector",
"mob_id",
$_POST[
"mob_id"]);
532 $this->ctrl->redirectByClass(
"ilmediapooltargetselector",
"listPools");
540 include_once(
"./Services/History/classes/class.ilHistory.php");
542 $this->page->getId(),
545 $this->page->getParentType() .
":pg",
549 ilUtil::sendSuccess($this->lng->txt(
"cont_added_comment"),
true);
550 $this->ctrl->returnToParent($this);
562 $targets = explode(
";",
$_POST[
"target"][0]);
564 if (count($targets) == 0) {
566 $this->ctrl->returnToParent($this);
568 include_once(
"./Services/Utilities/classes/class.ilConfirmationGUI.php");
570 $cgui->setFormAction(
$ilCtrl->getFormAction($this));
571 $cgui->setHeaderText(
$lng->txt(
"copg_confirm_el_deletion"));
572 $cgui->setCancel(
$lng->txt(
"cancel"),
"cancelDeleteSelected");
573 $cgui->setConfirm(
$lng->txt(
"confirm"),
"confirmedDeleteSelected");
574 $cgui->addHiddenItem(
"target",
$_POST[
"target"][0]);
576 $tpl->setContent($cgui->getHTML());
588 $this->ctrl->returnToParent($this);
597 $targets = explode(
";",
$_POST[
"target"]);
598 if (count($targets) > 0) {
599 $updated = $this->page->deleteContents(
602 $this->page_gui->getPageConfig()->getEnableSelfAssessment()
604 if ($updated !==
true) {
610 $this->ctrl->returnToParent($this);
620 if (is_int(strpos(
$_POST[
"target"][0],
";"))) {
623 if (is_array(
$_POST[
"target"])) {
624 $this->page->copyContents(
$_POST[
"target"]);
625 ilUtil::sendSuccess(
$lng->txt(
"cont_sel_el_copied_use_paste"),
true);
627 $this->ctrl->returnToParent($this);
637 if (is_int(strpos(
$_POST[
"target"][0],
";"))) {
640 if (is_array(
$_POST[
"target"])) {
641 $updated = $this->page->cutContents(
$_POST[
"target"]);
642 if ($updated !==
true) {
647 ilUtil::sendSuccess(
$lng->txt(
"cont_sel_el_cut_use_paste"),
true);
649 $this->ctrl->returnToParent($this);
658 $this->page->pasteContents($a_hier_id, $this->page_gui->getPageConfig()->getEnableSelfAssessment());
659 include_once(
"./Modules/LearningModule/classes/class.ilEditClipboard.php");
661 $this->ctrl->returnToParent($this);
669 if (is_int(strpos(
$_POST[
"target"][0],
";"))) {
672 if (is_array(
$_POST[
"target"])) {
673 $updated = $this->page->switchEnableMultiple(
676 $this->page_gui->getPageConfig()->getEnableSelfAssessment()
678 if ($updated !==
true) {
684 $this->ctrl->returnToParent($this);
695 if (is_int(strpos(
$_POST[
"target"][0],
";"))) {
698 if (is_array(
$_POST[
"target"])) {
703 $tarr = explode(
":", $t);
704 $cont_obj = $this->page->getContentObject($tarr[0], $tarr[1]);
706 $types[
"par"] =
"par";
709 $types[
"sec"] =
"sec";
713 if (count($types) == 0) {
715 $this->ctrl->returnToParent($this);
718 $tpl->setContent($this->form->getHTML());
721 $this->ctrl->returnToParent($this);
735 include_once(
"./Services/Form/classes/class.ilPropertyFormGUI.php");
737 $this->form->setTitle($this->lng->txt(
"cont_choose_characteristic"));
739 if ($a_types[
"par"] ==
"par") {
741 $this->lng->txt(
"cont_choose_characteristic_text"),
744 include_once(
"./Services/COPage/classes/class.ilPCParagraphGUI.php");
747 $this->form->addItem($select_prop);
749 if ($a_types[
"sec"] ==
"sec") {
751 $this->lng->txt(
"cont_choose_characteristic_section"),
754 include_once(
"./Services/COPage/classes/class.ilPCSectionGUI.php");
757 $this->form->addItem($select_prop);
760 foreach ($a_target as
$t) {
762 $hidden->setValue($t);
763 $this->form->addItem($hidden);
766 $this->form->setFormAction(
$ilCtrl->getFormAction($this));
767 $this->form->addCommandButton(
"assignCharacteristic",
$lng->txt(
"save"));
768 $this->form->addCommandButton(
"showPage",
$lng->txt(
"cancel"));
778 if (is_array(
$_POST[
"target"])) {
780 $tarr = explode(
":", $t);
781 $cont_obj = $this->page->getContentObject($tarr[0], $tarr[1]);
789 $updated = $this->page->update();
790 if ($updated !==
true) {
796 $this->ctrl->returnToParent($this);
806 $ilCtrl->setParameter($this,
"hier_id", $a_hier_id);
808 "ilEditClipboardGUI",
810 rawurlencode(
$ilCtrl->getLinkTarget(
812 "insertFromClipboard",
819 $ilCtrl->redirectByClass(
"ilEditClipboardGUI",
"getObject");
827 include_once(
"./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
829 include_once(
"./Services/COPage/classes/class.ilPCMediaObject.php");
831 foreach ($ids as $id2) {
832 $id = explode(
":", $id2);
835 if (
$type ==
"mob") {
837 $this->content_obj->readMediaObject(
$id);
838 $this->content_obj->createAlias($this->page,
$_GET[
"hier_id"]);
839 $this->updated = $this->page->update();
841 if (
$type ==
"incl") {
842 include_once(
"./Services/COPage/classes/class.ilPCContentInclude.php");
844 $this->content_obj->create($this->page,
$_GET[
"hier_id"]);
845 $this->content_obj->setContentType(
"mep");
846 $this->content_obj->setContentId(
$id);
847 $this->updated = $this->page->update();
851 $this->ctrl->returnToParent($this);
859 $this->ctrl->returnToParent($this);
883 $stpl =
new ilTemplate(
"tpl.snippet_info.html",
true,
true,
"Services/COPage");
885 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
887 foreach ($mep_pools as $mep_id) {
890 foreach ($ref_ids as $rid) {
891 if (!$edit_link && $ilAccess->checkAccess(
"write",
"", $rid)) {
892 $stpl->setCurrentBlock(
"edit_link");
893 $stpl->setVariable(
"TXT_EDIT",
$lng->txt(
"edit"));
896 "./goto.php?target=mep_" . $rid
898 $stpl->parseCurrentBlock();
901 $stpl->setCurrentBlock(
"pool");
902 $stpl->setVariable(
"TXT_MEDIA_POOL",
$lng->txt(
"obj_mep"));
904 $stpl->parseCurrentBlock();
907 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
908 $stpl->setVariable(
"TXT_TITLE",
$lng->txt(
"title"));
910 $stpl->setVariable(
"TXT_BACK",
$lng->txt(
"back"));
913 $ilCtrl->getLinkTarget($this->page_gui,
"edit")
915 $tpl->setContent($stpl->get());
static _isBrowserJSEditCapable()
checks wether browser is javascript editing capable
static isPCGUIClassName($a_class_name, $a_lower_case=false)
Is given class name a pc gui class?
setIntLinkReturn($a_return)
returnToContext()
redirect to parent context
displayLocator()
display locator
setMediaMode()
set media and editing mode
cutSelected()
Cut selected items.
showSnippetInfo()
Show snippet info.
static getPCDefinitionByGUIClassName($a_gui_class_name)
Get PC definition by name.
if(!array_key_exists('StateId', $_REQUEST)) $id
confirmedDeleteSelected()
Delete selected items.
assignCharacteristicForm()
Assign characeristic to text blocks/sections.
displayPage()
Default for POST reloads and missing.
static _getCharacteristics($a_style_id)
Get characteristics.
setFilterWhiteList($a_white_list)
Set filter list as white list (per detault it is a black list)
static _lookupTitle($a_id)
lookup object title
paste($a_hier_id)
paste from clipboard (redirects to clipboard)
executeCommand()
execute command
setLocator(&$a_locator)
set locator object
static lookupTitle($a_page_id)
Lookup title.
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 _getAllReferences($a_id)
get all reference ids of object
__construct(&$a_page_object, &$a_page_object_gui)
Constructor.
copySelected()
Copy selected items.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
initCharacteristicForm($a_target, $a_types)
Init map creation/update form.
copyLinkedMediaToClipboard()
copy linked media object to clipboard
Class ilPCContentInclude.
static _getCharacteristics($a_style_id)
Get characteristics.
assignCharacteristic()
Assign characteristic.
insertFromClipboard()
insert object from clipboard
copyLinkedMediaToMediaPool()
copy linked media object to media pool
activateSelected()
(de-)activate selected items
special template class to simplify handling of ITX/PEAR
static _doJSEditing()
checks if current user has activated js editing and if browser is js capable
setHeader($a_header)
set header title
addChangeComment()
add change comment to history
cancelDeleteSelected()
Cancel deletion.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static requirePCGUIClassByName($a_name)
Get instance.
setPageBackTitle($a_title)
static getLogger($a_component_id)
Get component logger.
static getPCDefinitionByType($a_pc_type)
Get PC definition by type.
pasteFromClipboard($a_hier_id)
paste from clipboard (redirects to clipboard)
Confirmation screen class.
getHeader()
get header title