ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
class.ilPageEditorGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
4include_once ("./Services/COPage/classes/class.ilPageObjectGUI.php");
5
27{
33 var $ilias;
34 var $tpl;
35 var $lng;
36 var $ctrl;
38 var $page;
42 var $tabs;
46
50 protected $log;
51
58 function ilPageEditorGUI(&$a_page_object, &$a_page_object_gui)
59 {
60 global $ilias, $tpl, $lng, $objDefinition, $ilCtrl,$ilTabs;
61
62 $this->log = ilLoggerFactory::getLogger('copg');
63
64 // initiate variables
65 $this->ilias =& $ilias;
66 $this->ctrl =& $ilCtrl;
67 $this->tpl =& $tpl;
68 $this->lng =& $lng;
69 $this->objDefinition = $objDefinition;
70 $this->tabs_gui =& $ilTabs;
71 $this->page =& $a_page_object;
72 $this->page_gui =& $a_page_object_gui;
73
74 $this->ctrl->saveParameter($this, array("hier_id", "pc_id"));
75 }
76
77
83 function setHeader($a_header)
84 {
85 $this->header = $a_header;
86 }
87
93 function getHeader()
94 {
95 return $this->header;
96 }
97
103 function setLocator(&$a_locator)
104 {
105 $this->locator =& $a_locator;
106 }
107
112 {
113 $this->ctrl->returnToParent($this);
114 }
115
116 function setIntLinkReturn($a_return)
117 {
118 $this->int_link_return = $a_return;
119 }
120
121
122 function setPageBackTitle($a_title)
123 {
124 $this->page_back_title = $a_title;
125 }
126
130 function &executeCommand()
131 {
132 global $ilCtrl, $ilHelp;;
133
134 $this->log->debug("ilPageEditorGUI: executeCommand begin");
135
136 $cmd = $this->ctrl->getCmd("displayPage");
137//echo "-$cmd-"; exit;
138 $cmdClass = strtolower($this->ctrl->getCmdClass());
139
140 $hier_id = $_GET["hier_id"];
141 $pc_id = $_GET["pc_id"];
142 if(isset($_POST["new_hier_id"]))
143 {
144 $hier_id = $_POST["new_hier_id"];
145 }
146//echo "GEThier_id:".$_GET["hier_id"]."<br>";
147//$this->ctrl->debug("hier_id:".$hier_id);
148
149 $new_type = (isset($_GET["new_type"]))
150 ? $_GET["new_type"]
151 : $_POST["new_type"];
152
153//echo "-$cmd-";
154//var_dump($_GET); var_dump($_POST); exit;
155/*array
156 'target' =>
157 array
158 0 => string '' (length=0)
159 'commandpg' => string 'insertJS' (length=8)
160 'cmd' =>
161 array
162 'exec_pg:' => string 'Ok' (length=2)
163 'ajaxform_content' => string '<div class=\"ilc_text_block_Standard\">sdfsdfsd sd</div>' (length=56)
164 'ajaxform_char' => string '' (length=0)*/
165/*array
166 'usedwsiwygeditor' => string '0' (length=1)
167 'par_characteristic' => string 'Standard' (length=8)
168 'par_content' => string 'adasdaasda a
169
170' (length=14)
171 'par_language' => string 'en' (length=2)
172 'cmd' =>
173 array
174 'create_par' => string 'Save' (length=4)*/
175
176 if (substr($cmd, 0, 5) == "exec_")
177 {
178//echo ":".key($_POST["cmd"]).":";
179 // check whether pc id is given
180 $pca = explode(":", key($_POST["cmd"]));
181 $pc_id = $pca[1];
182//echo "<br />exec_pc_id:-$pc_id-";
183 $cmd = explode("_", $pca[0]);
184 unset($cmd[0]);
185 $hier_id = implode($cmd, "_");
186 $cmd = $_POST["command".$hier_id];
187 }
188//echo "<br>cmd:$cmd:";exit;
189 // strip "c" "r" of table ids from hierarchical id
190 $first_hier_character = substr($hier_id, 0, 1);
191 if ($first_hier_character == "c" ||
192 $first_hier_character == "r" ||
193 $first_hier_character == "i")
194 {
195 $hier_id = substr($hier_id, 1);
196 }
197 $this->page->buildDom();
198 $this->page->addHierIDs();
199
200 // determine command and content object
201 if ($cmdClass != "ilfilesystemgui")
202 {
203 $com = explode("_", $cmd);
204 $cmd = $com[0];
205 }
206
207
208 $next_class = $this->ctrl->getNextClass($this);
209
210
211 // determine content type
212 if ($com[0] == "insert" || $com[0] == "create")
213 {
214 $cmd = $com[0];
215 $ctype = $com[1];
216 $add_type = $com[2];
217 if ($ctype == "mob") $ctype = "media";
218 }
219 else
220 {
221 // setting cmd and cmdclass for editing of linked media
222 if ($cmd == "editLinkedMedia")
223 {
224 $this->ctrl->setCmd("edit");
225 $cmd = "edit";
226 $_GET["pgEdMediaMode"] = "editLinkedMedia";
227 $_GET["mob_id"] = $_POST["mob_id"];
228 }
229 if ($_GET["pgEdMediaMode"] == "editLinkedMedia")
230 {
231 $this->ctrl->setParameter($this, "pgEdMediaMode", "editLinkedMedia");
232 $this->ctrl->setParameter($this, "mob_id", $_GET["mob_id"]);
233 if ($cmdClass != "ilinternallinkgui" && $cmdClass != "ilmdeditorgui"
234 && $cmdClass != "ilimagemapeditorgui" && $cmdClass != "ilfilesystemgui")
235 {
236 $this->ctrl->setCmdClass("ilobjmediaobjectgui");
237 $cmdClass = "ilobjmediaobjectgui";
238 }
239 }
240if (false)
241{
242var_dump($_POST);
243var_dump($_GET);
244echo ";$cmd;".$next_class.";";
245echo "-$pc_id-";
246echo "-$cmd-".$this->ctrl->getCmd()."-";
247exit;
248}
249
250//var_dump($_POST);
251 // note: ilinternallinkgui for page: no cont_obj is received
252 // ilinternallinkgui for mob: cont_obj is received
253 if ($cmd != "insertFromClipboard" && $cmd != "pasteFromClipboard" &&
254 $cmd != "setMediaMode" && $cmd != "copyLinkedMediaToClipboard" &&
255 $cmd != "activatePage" && $cmd != "deactivatePage" &&
256 $cmd != "copyLinkedMediaToMediaPool" && $cmd != "showSnippetInfo" &&
257 $cmd != "deleteSelected" && $cmd != "paste" &&
258 $cmd != "copySelected" && $cmd != "cutSelected" &&
259 ($cmd != "displayPage" || $_POST["editImagemapForward_x"] != "" || $_POST["imagemap_x"] != "") &&
260 ($cmd != "displayPage" || $_POST["editImagemapForward_x"] != "") &&
261 $cmd != "activateSelected" && $cmd != "assignCharacteristicForm" &&
262 $cmd != "assignCharacteristic" &&
263 $cmd != "cancelCreate" && $cmd != "popup" &&
264 $cmdClass != "ileditclipboardgui" && $cmd != "addChangeComment" &&
265 ($cmdClass != "ilinternallinkgui" || ($next_class == "ilpcmediaobjectgui")))
266 {
267 if ($_GET["pgEdMediaMode"] != "editLinkedMedia")
268 {
269//$this->ctrl->debug("gettingContentObject (no linked media)");
270//echo $hier_id."-".$pc_id;
271 $cont_obj =& $this->page->getContentObject($hier_id, $pc_id);
272 if (!is_object($cont_obj))
273 {
274 $this->log->debug("ilPageEditorGUI: ...returnToParent");
275 $ilCtrl->returnToParent($this);
276 }
277 $ctype = $cont_obj->getType();
278 }
279 }
280 }
281
282//$this->ctrl->debug("+ctype:".$ctype."+");
283// $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
284// $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
285
286 if ($ctype != "media" || !is_object ($cont_obj))
287 {
288 if ($this->getHeader() != "")
289 {
290 $this->tpl->setTitle($this->getHeader());
291 }
292 $this->displayLocator();
293 }
294
295 $this->cont_obj =& $cont_obj;
296
297
298 // special command / command class handling
299 $this->ctrl->setParameter($this, "hier_id", $hier_id);
300 $this->ctrl->setParameter($this, "pc_id", $pc_id);
301 $this->ctrl->setCmd($cmd);
302 //$next_class = $this->ctrl->getNextClass($this);
303//$this->ctrl->debug("+next_class:".$next_class."+");
304//echo("+next_class:".$next_class."+".$ctype."+"); exit;
305
306 if ($next_class == "")
307 {
308 include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
309 $pc_def = ilCOPagePCDef::getPCDefinitionByType($ctype);
310 if (is_array($pc_def))
311 {
312 $this->ctrl->setCmdClass($pc_def["pc_gui_class"]);
313 }
314 $next_class = $this->ctrl->getNextClass($this);
315 }
316
317 // do not do this while imagemap editing is ongoing
318 if ($cmd == "displayPage" && $_POST["editImagemapForward_x"] == "" && $_POST["imagemap_x"] == "")
319 {
320 $next_class = "";
321 }
322
323//echo "hier_id:$hier_id:type:$type:cmd:$cmd:ctype:$ctype:next_class:$next_class:<br>"; exit;
324 $this->log->debug("ilPageEditorGUI: ... next_class:".$next_class.", pc_id:".$pc_id.
325 ", hier_id:".$hier_id.", ctype:".$ctype.", cmd:".$cmd);
326 switch($next_class)
327 {
328 case "ilinternallinkgui":
329 $link_gui = new ilInternalLinkGUI(
330 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultType(),
331 $this->page_gui->getPageConfig()->getIntLinkHelpDefaultId());
332 $link_gui->setMode("normal");
333 $link_gui->setFilterWhiteList(
334 $this->page_gui->getPageConfig()->getIntLinkFilterWhiteList());
335 foreach ($this->page_gui->getPageConfig()->getIntLinkFilters() as $filter)
336 {
337 $link_gui->filterLinkType($filter);
338 }
339// $link_gui->setSetLinkTargetScript(
340// $this->ctrl->getLinkTarget($this, "setInternalLink"));
341 $link_gui->setReturn($this->int_link_return);
342 if ($ilCtrl->isAsynch())
343 {
344 $link_gui->setMode("asynch");
345 }
346
347 $ret =& $this->ctrl->forwardCommand($link_gui);
348 break;
349
350 // PC Media Object
351 case "ilpcmediaobjectgui":
352 include_once ("./Services/COPage/classes/class.ilPCMediaObjectGUI.php");
353
354 $this->tabs_gui->clearTargets();
355 $this->tabs_gui->setBackTarget($this->page_gui->page_back_title,
356 $ilCtrl->getLinkTarget($this->page_gui, "edit"));
357 $pcmob_gui =& new ilPCMediaObjectGUI($this->page, $cont_obj, $hier_id, $pc_id);
358 $pcmob_gui->setStyleId($this->page_gui->getStyleId());
359 $pcmob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
360 $ret =& $this->ctrl->forwardCommand($pcmob_gui);
361 $ilHelp->setScreenIdComponent("copg_media");
362 break;
363
364 // only for "linked" media
365 case "ilobjmediaobjectgui":
366 $this->tabs_gui->clearTargets();
367 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
368 $ilCtrl->getParentReturn($this));
369 $mob_gui =& new ilObjMediaObjectGUI("", $_GET["mob_id"],false, false);
370 $mob_gui->getTabs($this->tabs_gui);
371 $mob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
372 $this->tpl->setTitle($this->lng->txt("mob").": ".
373 ilObject::_lookupTitle($_GET["mob_id"]));
374 $ret =& $this->ctrl->forwardCommand($mob_gui);
375 break;
376
377 // Question
378 case "ilpcquestiongui":
379 include_once("./Services/COPage/classes/class.ilPCQuestionGUI.php");
380 $pc_question_gui =& new ilPCQuestionGUI($this->page, $cont_obj, $hier_id, $pc_id);
381 $pc_question_gui->setSelfAssessmentMode($this->page_gui->getPageConfig()->getEnableSelfAssessment());
382 $pc_question_gui->setPageConfig($this->page_gui->getPageConfig());
383
384 if ($this->page_gui->getPageConfig()->getEnableSelfAssessment())
385 {
386 $this->tabs_gui->clearTargets();
387 $ilHelp->setScreenIdComponent("copg_pcqst");
388 $this->tabs_gui->setBackTarget($this->lng->txt("back"),
389 $ilCtrl->getParentReturn($this));
390 $ret = $this->ctrl->forwardCommand($pc_question_gui);
391 }
392 else
393 {
394 $cmd = $this->ctrl->getCmd();
395 $pc_question_gui->$cmd();
396 $this->ctrl->redirectByClass(array("ilobjquestionpoolgui", get_class($cont_obj)), "editQuestion");
397 }
398 break;
399
400 // Plugged Component
401 case "ilpcpluggedgui":
402 $this->tabs_gui->clearTargets();
403 include_once ("./Services/COPage/classes/class.ilPCPluggedGUI.php");
404 $plugged_gui = new ilPCPluggedGUI($this->page, $cont_obj, $hier_id,
405 $add_type, $pc_id);
406 $ret = $this->ctrl->forwardCommand($plugged_gui);
407 break;
408
409 default:
410
411 // generic calls to gui classes
412 include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
413 if (ilCOPagePCDef::isPCGUIClassName($next_class, true))
414 {
416 $this->tabs_gui->clearTargets();
417 $this->tabs_gui->setBackTarget($this->page_gui->page_back_title,
418 $ilCtrl->getLinkTarget($this->page_gui, "edit"));
419 $ilHelp->setScreenIdComponent("copg_".$pc_def["pc_type"]);
421 $gui_class_name = $pc_def["pc_gui_class"];
422 $pc_gui = new $gui_class_name($this->page, $cont_obj, $hier_id, $pc_id);
423 if ($pc_def["style_classes"])
424 {
425 $pc_gui->setStyleId($this->page_gui->getStyleId());
426 }
427 $pc_gui->setPageConfig($this->page_gui->getPageConfig());
428 $ret = $this->ctrl->forwardCommand($pc_gui);
429 }
430 else
431 {
432 // cmd belongs to ilPageEditorGUI
433
434 if ($cmd == "pasteFromClipboard")
435 {
436 $ret = $this->pasteFromClipboard($hier_id);
437 }
438 else if ($cmd == "paste")
439 {
440 $ret = $this->paste($hier_id);
441 }
442 else
443 {
444 $ret = $this->$cmd();
445 }
446 }
447 break;
448
449 }
450
451 $this->log->debug("ilPageEditorGUI: executeCommand end");
452
453 return $ret;
454 }
455
460 function _doJSEditing()
461 {
462 global $ilUser, $ilias, $ilSetting;
463
464 if ($ilUser->getPref("ilPageEditor_JavaScript") != "disable"
466 {
467 return true;
468 }
469 return false;
470 }
471
476 {
477 global $ilBrowser;
478return true;
479 $version = $ilBrowser->getVersion();
480
481 if ($ilBrowser->isFirefox() ||
482 ($ilBrowser->isIE() && !$ilBrowser->isMac()) ||
483 ($ilBrowser->isMozilla() && $version[0] >= 5))
484 {
485 return true;
486 }
487 return false;
488 }
489
490 function activatePage()
491 {
492 $this->page_gui->activatePage();
493 }
494
495 function deactivatePage()
496 {
497 $this->page_gui->deactivatePage();
498 }
499
503 function setMediaMode()
504 {
505 global $ilUser, $ilias;
506
507 $ilUser->writePref("ilPageEditor_MediaMode", $_POST["media_mode"]);
508 $ilUser->writePref("ilPageEditor_HTMLMode", $_POST["html_mode"]);
509 if ($ilUser->getPref("ilPageEditor_JavaScript") != $_POST["js_mode"])
510 {
511 // not nice, should be solved differently in the future
512 if ($this->page->getParentType() == "lm" ||
513 $this->page->getParentType() == "dbk")
514 {
515 $this->ctrl->setParameterByClass("illmpageobjectgui", "reloadTree", "y");
516 }
517 }
518 $ilUser->writePref("ilPageEditor_JavaScript", $_POST["js_mode"]);
519
520 // again not so nice...
521 if ($this->page->getParentType() == "lm" ||
522 $this->page->getParentType() == "dbk")
523 {
524 $this->ctrl->redirectByClass("illmpageobjectgui", "edit");
525 }
526 else
527 {
528 $this->ctrl->returnToParent($this);
529 }
530 }
531
536 {
537 global $ilUser;
538
539 ilUtil::sendSuccess($this->lng->txt("copied_to_clipboard"), true);
540 $ilUser->addObjectToClipboard($_POST["mob_id"], "mob", ilObject::_lookupTitle($_POST["mob_id"]));
541 $this->ctrl->returnToParent($this);
542 }
543
548 {
549 global $ilUser;
550
551 $this->ctrl->setParameterByClass("ilmediapooltargetselector", "mob_id", $_POST["mob_id"]);
552 $this->ctrl->redirectByClass("ilmediapooltargetselector", "listPools");
553 }
554
559 {
560 include_once("./Services/History/classes/class.ilHistory.php");
561 ilHistory::_createEntry($this->page->getId(), "update",
562 "", $this->page->getParentType().":pg",
563 ilUtil::stripSlashes($_POST["change_comment"]), true);
564 ilUtil::sendSuccess($this->lng->txt("cont_added_comment"), true);
565 $this->ctrl->returnToParent($this);
566 }
567
571 function deleteSelected()
572 {
573 if (is_int(strpos($_POST["target"][0], ";")))
574 {
575 $_POST["target"] = explode(";", $_POST["target"][0]);
576 }
577 if (is_array($_POST["target"]))
578 {
579 $updated = $this->page->deleteContents($_POST["target"], true,
580 $this->page_gui->getPageConfig()->getEnableSelfAssessment());
581 if($updated !== true)
582 {
583 $_SESSION["il_pg_error"] = $updated;
584 }
585 else
586 {
587 unset($_SESSION["il_pg_error"]);
588 }
589 }
590 $this->ctrl->returnToParent($this);
591 }
592
596 function copySelected()
597 {
598 global $lng;
599
600 if (is_int(strpos($_POST["target"][0], ";")))
601 {
602 $_POST["target"] = explode(";", $_POST["target"][0]);
603 }
604 if (is_array($_POST["target"]))
605 {
606 $this->page->copyContents($_POST["target"]);
607 ilUtil::sendSuccess($lng->txt("cont_sel_el_copied_use_paste"), true);
608 }
609 $this->ctrl->returnToParent($this);
610 }
611
615 function cutSelected()
616 {
617 global $lng;
618
619 if (is_int(strpos($_POST["target"][0], ";")))
620 {
621 $_POST["target"] = explode(";", $_POST["target"][0]);
622 }
623 if (is_array($_POST["target"]))
624 {
625 $updated = $this->page->cutContents($_POST["target"]);
626 if($updated !== true)
627 {
628 $_SESSION["il_pg_error"] = $updated;
629 }
630 else
631 {
632 unset($_SESSION["il_pg_error"]);
633 }
634 ilUtil::sendSuccess($lng->txt("cont_sel_el_cut_use_paste"), true);
635 }
636 $this->ctrl->returnToParent($this);
637 }
638
642 function paste($a_hier_id)
643 {
644 global $ilCtrl;
645 $this->page->pasteContents($a_hier_id, $this->page_gui->getPageConfig()->getEnableSelfAssessment());
646 include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
648 $this->ctrl->returnToParent($this);
649 }
650
655 {
656 if (is_int(strpos($_POST["target"][0], ";")))
657 {
658 $_POST["target"] = explode(";", $_POST["target"][0]);
659 }
660 if (is_array($_POST["target"]))
661 {
662 $updated = $this->page->switchEnableMultiple($_POST["target"], true,
663 $this->page_gui->getPageConfig()->getEnableSelfAssessment());
664 if($updated !== true)
665 {
666 $_SESSION["il_pg_error"] = $updated;
667 }
668 else
669 {
670 unset($_SESSION["il_pg_error"]);
671 }
672 }
673 $this->ctrl->returnToParent($this);
674 }
675
680 {
681 global $tpl, $lng;
682
683 if (is_int(strpos($_POST["target"][0], ";")))
684 {
685 $_POST["target"] = explode(";", $_POST["target"][0]);
686 }
687 if (is_array($_POST["target"]))
688 {
689 $types = array();
690
691 // check what content element types have been selected
692 foreach ($_POST["target"] as $t)
693 {
694 $tarr = explode(":", $t);
695 $cont_obj =& $this->page->getContentObject($tarr[0], $tarr[1]);
696 if (is_object($cont_obj) && $cont_obj->getType() == "par")
697 {
698 $types["par"] = "par";
699 }
700 if (is_object($cont_obj) && $cont_obj->getType() == "sec")
701 {
702 $types["sec"] = "sec";
703 }
704 }
705
706 if (count($types) == 0)
707 {
708 ilUtil::sendFailure($lng->txt("cont_select_par_or_section"), true);
709 $this->ctrl->returnToParent($this);
710 }
711 else
712 {
713 $this->initCharacteristicForm($_POST["target"], $types);
714 $tpl->setContent($this->form->getHTML());
715 }
716 }
717 else
718 {
719 $this->ctrl->returnToParent($this);
720 }
721 }
722
726 function initCharacteristicForm($a_target, $a_types)
727 {
728 global $ilCtrl, $lng;
729
730
731 // edit form
732 include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
733 $this->form = new ilPropertyFormGUI();
734 $this->form->setTitle($this->lng->txt("cont_choose_characteristic"));
735
736 if ($a_types["par"] == "par")
737 {
738 $select_prop = new ilSelectInputGUI($this->lng->txt("cont_choose_characteristic_text"),
739 "char_par");
740 include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
741 $options = ilPCParagraphGUI::_getCharacteristics($this->page_gui->getStyleId());
742 $select_prop->setOptions($options);
743 $this->form->addItem($select_prop);
744 }
745 if ($a_types["sec"] == "sec")
746 {
747 $select_prop = new ilSelectInputGUI($this->lng->txt("cont_choose_characteristic_section"),
748 "char_sec");
749 include_once("./Services/COPage/classes/class.ilPCSectionGUI.php");
750 $options = ilPCSectionGUI::_getCharacteristics($this->page_gui->getStyleId());
751 $select_prop->setOptions($options);
752 $this->form->addItem($select_prop);
753 }
754
755 foreach ($a_target as $t)
756 {
757 $hidden = new ilHiddenInputGUI("target[]");
758 $hidden->setValue($t);
759 $this->form->addItem($hidden);
760 }
761
762 $this->form->setFormAction($ilCtrl->getFormAction($this));
763 $this->form->addCommandButton("assignCharacteristic", $lng->txt("save"));
764 $this->form->addCommandButton("showPage", $lng->txt("cancel"));
765
766 }
767
772 {
773 $char_par = ilUtil::stripSlashes($_POST["char_par"]);
774 $char_sec = ilUtil::stripSlashes($_POST["char_sec"]);
775 if (is_array($_POST["target"]))
776 {
777 foreach ($_POST["target"] as $t)
778 {
779 $tarr = explode(":", $t);
780 $cont_obj =& $this->page->getContentObject($tarr[0], $tarr[1]);
781 if (is_object($cont_obj) && $cont_obj->getType() == "par")
782 {
783 $cont_obj->setCharacteristic($char_par);
784 }
785 if (is_object($cont_obj) && $cont_obj->getType() == "sec")
786 {
787 $cont_obj->setCharacteristic($char_sec);
788 }
789 }
790 $updated = $this->page->update();
791 if($updated !== true)
792 {
793 $_SESSION["il_pg_error"] = $updated;
794 }
795 else
796 {
797 unset($_SESSION["il_pg_error"]);
798 }
799 }
800 $this->ctrl->returnToParent($this);
801 }
802
806 function pasteFromClipboard($a_hier_id)
807 {
808 global $ilCtrl;
809//var_dump($a_hier_id);
810 $ilCtrl->setParameter($this, "hier_id", $a_hier_id);
811 $ilCtrl->setParameterByClass("ilEditClipboardGUI", "returnCommand",
812 rawurlencode($ilCtrl->getLinkTarget($this,
813 "insertFromClipboard", "", false, false)));
814//echo ":".$ilCtrl->getLinkTarget($this, "insertFromClipboard").":";
815 $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
816 }
817
822 {
823 include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
825 include_once ("./Services/COPage/classes/class.ilPCMediaObject.php");
826 if ($ids != "")
827 {
828 foreach ($ids as $id2)
829 {
830 $id = explode(":", $id2);
831 $type = $id[0];
832 $id = $id[1];
833 if ($type == "mob")
834 {
835 $this->content_obj = new ilPCMediaObject($this->page);
836 $this->content_obj->readMediaObject($id);
837 $this->content_obj->createAlias($this->page, $_GET["hier_id"]);
838 $this->updated = $this->page->update();
839 }
840 if ($type == "incl")
841 {
842 include_once("./Services/COPage/classes/class.ilPCContentInclude.php");
843 $this->content_obj = new ilPCContentInclude($this->page);
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();
848 }
849 }
850 }
851 $this->ctrl->returnToParent($this);
852 }
853
857 function displayPage()
858 {
859 $this->ctrl->returnToParent($this);
860 }
861
865 function displayLocator()
866 {
867 if(is_object($this->locator))
868 {
869 $this->locator->display();
870 }
871 }
872
877 {
878 global $tpl, $lng, $ilAccess, $ilCtrl;
879
880 $stpl = new ilTemplate("tpl.snippet_info.html", true, true, "Services/COPage");
881
882 include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
883 $mep_pools = ilMediaPoolItem::getPoolForItemId($_POST["ci_id"]);
884 foreach ($mep_pools as $mep_id)
885 {
886 $ref_ids = ilObject::_getAllReferences($mep_id);
887 $edit_link = false;
888 foreach ($ref_ids as $rid)
889 {
890 if (!$edit_link && $ilAccess->checkAccess("write", "", $rid))
891 {
892 $stpl->setCurrentBlock("edit_link");
893 $stpl->setVariable("TXT_EDIT", $lng->txt("edit"));
894 $stpl->setVariable("HREF_EDIT",
895 "./goto.php?target=mep_".$rid);
896 $stpl->parseCurrentBlock();
897 }
898 }
899 $stpl->setCurrentBlock("pool");
900 $stpl->setVariable("TXT_MEDIA_POOL", $lng->txt("obj_mep"));
901 $stpl->setVariable("VAL_MEDIA_POOL", ilObject::_lookupTitle($mep_id));
902 $stpl->parseCurrentBlock();
903 }
904
905 include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
906 $stpl->setVariable("TXT_TITLE", $lng->txt("title"));
907 $stpl->setVariable("VAL_TITLE", ilMediaPoolPage::lookupTitle($_POST["ci_id"]));
908 $stpl->setVariable("TXT_BACK", $lng->txt("back"));
909 $stpl->setVariable("HREF_BACK",
910 $ilCtrl->getLinkTarget($this->page_gui, "edit"));
911 $tpl->setContent($stpl->get());
912 }
913
914}
915?>
$_GET["client_id"]
$_SESSION["AccountId"]
getPCDefinitionByGUIClassName($a_gui_class_name)
Get PC definition by name.
getPCDefinitionByType($a_pc_type)
Get PC definition by type.
isPCGUIClassName($a_class_name, $a_lower_case=false)
Is given class name a pc gui class?
static requirePCGUIClassByName($a_name)
Get instance.
This class represents a hidden form property in a property form.
_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.
Class ilInternalLinkGUI.
static getLogger($a_component_id)
Get component logger.
static getPoolForItemId($a_id)
Get media pools for item id.
static lookupTitle($a_page_id)
Lookup title.
Class ilObjMediaObjectGUI.
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
Class ilPCContentInclude.
Class ilPCMediaObjectGUI.
Class ilPCMediaObject.
static _getCharacteristics($a_style_id)
Get characteristics.
Class ilPCPluggedGUI.
Class ilPCQuestionGUI.
static _getCharacteristics($a_style_id)
Get characteristics.
Page Editor GUI class.
copyLinkedMediaToMediaPool()
copy linked media object to media pool
activateSelected()
(de-)activate selected items
_doJSEditing()
checks if current user has activated js editing and if browser is js capable
copySelected()
Copy selected items.
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
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)
& executeCommand()
execute command
ilPageEditorGUI(&$a_page_object, &$a_page_object_gui)
Constructor.
displayLocator()
display locator
_isBrowserJSEditCapable()
checks wether browser is javascript editing capable
setHeader($a_header)
set header title
showSnippetInfo()
Show snippet info.
returnToContext()
redirect to parent context
cutSelected()
Cut selected items.
deleteSelected()
Delete selected items.
getHeader()
get header title
assignCharacteristic()
Assign characteristic.
This class represents a property form user interface.
This class represents a selection list property in a property form.
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
$_POST['username']
Definition: cron.php:12
global $ilCtrl
Definition: ilias.php:18
exit
Definition: login.php:54
redirection script todo: (a better solution should control the processing via a xml file)
global $ilSetting
Definition: privfeed.php:40
$cmd
Definition: sahs_server.php:35
if(!is_array($argv)) $options
global $ilUser
Definition: imgupload.php:15