ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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 
4 include_once ("./Services/COPage/classes/class.ilPageObjectGUI.php");
5 
27 {
33  var $ilias;
34  var $tpl;
35  var $lng;
36  var $ctrl;
38  var $page;
41  var $header;
42  var $tabs;
43  var $cont_obj;
46 
50  protected $log;
51 
58  function __construct(&$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 
111  function returnToContext()
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  }
240 if (false)
241 {
242 var_dump($_POST);
243 var_dump($_GET);
244 echo ";$cmd;".$next_class.";";
245 echo "-$pc_id-";
246 echo "-$cmd-".$this->ctrl->getCmd()."-";
247 exit;
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 != "cancelDeleteSelected" && $cmd != "confirmedDeleteSelected" &&
259  $cmd != "copySelected" && $cmd != "cutSelected" &&
260  ($cmd != "displayPage" || $_POST["editImagemapForward_x"] != "" || $_POST["imagemap_x"] != "") &&
261  ($cmd != "displayPage" || $_POST["editImagemapForward_x"] != "") &&
262  $cmd != "activateSelected" && $cmd != "assignCharacteristicForm" &&
263  $cmd != "assignCharacteristic" &&
264  $cmdClass != "ilrepositoryselector2inputgui" &&
265  $cmd != "cancelCreate" && $cmd != "popup" &&
266  $cmdClass != "ileditclipboardgui" && $cmd != "addChangeComment" &&
267  ($cmdClass != "ilinternallinkgui" || ($next_class == "ilpcmediaobjectgui")))
268  {
269  if ($_GET["pgEdMediaMode"] != "editLinkedMedia")
270  {
271 //$this->ctrl->debug("gettingContentObject (no linked media)");
272 //echo $hier_id."-".$pc_id;
273  $cont_obj = $this->page->getContentObject($hier_id, $pc_id);
274  if (!is_object($cont_obj))
275  {
276  $this->log->debug("ilPageEditorGUI: ...returnToParent (cmdClass: $cmdClass, nextClass: $next_class".
277  ", hier_id: ".$hier_id.", pc_id: ".$pc_id.")");
278  $ilCtrl->returnToParent($this);
279  }
280  $ctype = $cont_obj->getType();
281  }
282  }
283  }
284 
285 //$this->ctrl->debug("+ctype:".$ctype."+");
286 // $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
287 // $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
288 
289  if ($ctype != "media" || !is_object ($cont_obj))
290  {
291  if ($this->getHeader() != "")
292  {
293  $this->tpl->setTitle($this->getHeader());
294  }
295  $this->displayLocator();
296  }
297 
298  $this->cont_obj = $cont_obj;
299 
300 
301  // special command / command class handling
302  $this->ctrl->setParameter($this, "hier_id", $hier_id);
303  $this->ctrl->setParameter($this, "pc_id", $pc_id);
304  $this->ctrl->setCmd($cmd);
305  //$next_class = $this->ctrl->getNextClass($this);
306 //$this->ctrl->debug("+next_class:".$next_class."+");
307 //echo("+next_class:".$next_class."+".$ctype."+"); exit;
308 
309  if ($next_class == "")
310  {
311  include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
312  $pc_def = ilCOPagePCDef::getPCDefinitionByType($ctype);
313  if (is_array($pc_def))
314  {
315  $this->ctrl->setCmdClass($pc_def["pc_gui_class"]);
316  }
317  $next_class = $this->ctrl->getNextClass($this);
318  }
319 
320  // do not do this while imagemap editing is ongoing
321  if ($cmd == "displayPage" && $_POST["editImagemapForward_x"] == "" && $_POST["imagemap_x"] == "")
322  {
323  $next_class = "";
324  }
325 
326 //echo "hier_id:$hier_id:type:$type:cmd:$cmd:ctype:$ctype:next_class:$next_class:<br>"; exit;
327  $this->log->debug("ilPageEditorGUI: ... next_class:".$next_class.", pc_id:".$pc_id.
328  ", hier_id:".$hier_id.", ctype:".$ctype.", cmd:".$cmd);
329  switch($next_class)
330  {
331  case "ilinternallinkgui":
332  $link_gui = new ilInternalLinkGUI(
333  $this->page_gui->getPageConfig()->getIntLinkHelpDefaultType(),
334  $this->page_gui->getPageConfig()->getIntLinkHelpDefaultId());
335  $link_gui->setMode("normal");
336  $link_gui->setFilterWhiteList(
337  $this->page_gui->getPageConfig()->getIntLinkFilterWhiteList());
338  foreach ($this->page_gui->getPageConfig()->getIntLinkFilters() as $filter)
339  {
340  $link_gui->filterLinkType($filter);
341  }
342 // $link_gui->setSetLinkTargetScript(
343 // $this->ctrl->getLinkTarget($this, "setInternalLink"));
344  $link_gui->setReturn($this->int_link_return);
345  if ($ilCtrl->isAsynch())
346  {
347  $link_gui->setMode("asynch");
348  }
349 
350  $ret = $this->ctrl->forwardCommand($link_gui);
351  break;
352 
353  // PC Media Object
354  case "ilpcmediaobjectgui":
355  include_once ("./Services/COPage/classes/class.ilPCMediaObjectGUI.php");
356 
357  $this->tabs_gui->clearTargets();
358  $this->tabs_gui->setBackTarget($this->page_gui->page_back_title,
359  $ilCtrl->getLinkTarget($this->page_gui, "edit"));
360  $pcmob_gui = new ilPCMediaObjectGUI($this->page, $cont_obj, $hier_id, $pc_id);
361  $pcmob_gui->setStyleId($this->page_gui->getStyleId());
362  $pcmob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
363  $ret = $this->ctrl->forwardCommand($pcmob_gui);
364  $ilHelp->setScreenIdComponent("copg_media");
365  break;
366 
367  // only for "linked" media
368  case "ilobjmediaobjectgui":
369  $this->tabs_gui->clearTargets();
370  $this->tabs_gui->setBackTarget($this->lng->txt("back"),
371  $ilCtrl->getParentReturn($this));
372  $mob_gui = new ilObjMediaObjectGUI("", $_GET["mob_id"],false, false);
373  $mob_gui->getTabs();
374  $mob_gui->setEnabledMapAreas($this->page_gui->getPageConfig()->getEnableInternalLinks());
375  $this->tpl->setTitle($this->lng->txt("mob").": ".
376  ilObject::_lookupTitle($_GET["mob_id"]));
377  $ret = $this->ctrl->forwardCommand($mob_gui);
378  break;
379 
380  // Question
381  case "ilpcquestiongui":
382  include_once("./Services/COPage/classes/class.ilPCQuestionGUI.php");
383  $pc_question_gui = new ilPCQuestionGUI($this->page, $cont_obj, $hier_id, $pc_id);
384  $pc_question_gui->setSelfAssessmentMode($this->page_gui->getPageConfig()->getEnableSelfAssessment());
385  $pc_question_gui->setPageConfig($this->page_gui->getPageConfig());
386 
387  if ($this->page_gui->getPageConfig()->getEnableSelfAssessment())
388  {
389  $this->tabs_gui->clearTargets();
390  $ilHelp->setScreenIdComponent("copg_pcqst");
391  $this->tabs_gui->setBackTarget($this->lng->txt("back"),
392  $ilCtrl->getParentReturn($this));
393  $ret = $this->ctrl->forwardCommand($pc_question_gui);
394  }
395  else
396  {
397  $cmd = $this->ctrl->getCmd();
398  $pc_question_gui->$cmd();
399  $this->ctrl->redirectByClass(array("ilobjquestionpoolgui", get_class($cont_obj)), "editQuestion");
400  }
401  break;
402 
403  // Plugged Component
404  case "ilpcpluggedgui":
405  $this->tabs_gui->clearTargets();
406  include_once ("./Services/COPage/classes/class.ilPCPluggedGUI.php");
407  $plugged_gui = new ilPCPluggedGUI($this->page, $cont_obj, $hier_id,
408  $add_type, $pc_id);
409  $ret = $this->ctrl->forwardCommand($plugged_gui);
410  break;
411 
412  default:
413 
414  // generic calls to gui classes
415  include_once("./Services/COPage/classes/class.ilCOPagePCDef.php");
416  if (ilCOPagePCDef::isPCGUIClassName($next_class, true))
417  {
418  $pc_def = ilCOPagePCDef::getPCDefinitionByGUIClassName($next_class);
419  $this->tabs_gui->clearTargets();
420  $this->tabs_gui->setBackTarget($this->page_gui->page_back_title,
421  $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  {
428  $pc_gui->setStyleId($this->page_gui->getStyleId());
429  }
430  $pc_gui->setPageConfig($this->page_gui->getPageConfig());
431  $ret = $this->ctrl->forwardCommand($pc_gui);
432  }
433  else
434  {
435  // cmd belongs to ilPageEditorGUI
436 
437  if ($cmd == "pasteFromClipboard")
438  {
439  $ret = $this->pasteFromClipboard($hier_id);
440  }
441  else if ($cmd == "paste")
442  {
443  $ret = $this->paste($hier_id);
444  }
445  else
446  {
447  $ret = $this->$cmd();
448  }
449  }
450  break;
451 
452  }
453 
454  $this->log->debug("ilPageEditorGUI: executeCommand end");
455 
456  return $ret;
457  }
458 
463  static function _doJSEditing()
464  {
465  global $ilUser;
466 
467  if ($ilUser->getPref("ilPageEditor_JavaScript") != "disable"
469  {
470  return true;
471  }
472  return false;
473  }
474 
478  static function _isBrowserJSEditCapable()
479  {
480  return true;
481  }
482 
483  function activatePage()
484  {
485  $this->page_gui->activatePage();
486  }
487 
488  function deactivatePage()
489  {
490  $this->page_gui->deactivatePage();
491  }
492 
496  function setMediaMode()
497  {
498  global $ilUser, $ilias;
499 
500  $ilUser->writePref("ilPageEditor_MediaMode", $_POST["media_mode"]);
501  $ilUser->writePref("ilPageEditor_HTMLMode", $_POST["html_mode"]);
502  if ($ilUser->getPref("ilPageEditor_JavaScript") != $_POST["js_mode"])
503  {
504  // not nice, should be solved differently in the future
505  if ($this->page->getParentType() == "lm")
506  {
507  $this->ctrl->setParameterByClass("illmpageobjectgui", "reloadTree", "y");
508  }
509  }
510  $ilUser->writePref("ilPageEditor_JavaScript", $_POST["js_mode"]);
511 
512  // again not so nice...
513  if ($this->page->getParentType() == "lm")
514  {
515  $this->ctrl->redirectByClass("illmpageobjectgui", "edit");
516  }
517  else
518  {
519  $this->ctrl->returnToParent($this);
520  }
521  }
522 
527  {
528  global $ilUser;
529 
530  ilUtil::sendSuccess($this->lng->txt("copied_to_clipboard"), true);
531  $ilUser->addObjectToClipboard($_POST["mob_id"], "mob", ilObject::_lookupTitle($_POST["mob_id"]));
532  $this->ctrl->returnToParent($this);
533  }
534 
539  {
540  global $ilUser;
541 
542  $this->ctrl->setParameterByClass("ilmediapooltargetselector", "mob_id", $_POST["mob_id"]);
543  $this->ctrl->redirectByClass("ilmediapooltargetselector", "listPools");
544  }
545 
549  function addChangeComment()
550  {
551  include_once("./Services/History/classes/class.ilHistory.php");
552  ilHistory::_createEntry($this->page->getId(), "update",
553  "", $this->page->getParentType().":pg",
554  ilUtil::stripSlashes($_POST["change_comment"]), true);
555  ilUtil::sendSuccess($this->lng->txt("cont_added_comment"), true);
556  $this->ctrl->returnToParent($this);
557  }
558 
562  function deleteSelected()
563  {
564  global $ilCtrl, $tpl, $lng;
565 
566  $targets = explode(";", $_POST["target"][0]);
567 
568  if (count($targets) == 0)
569  {
570  ilUtil::sendInfo($lng->txt("no_checkbox"), true);
571  $this->ctrl->returnToParent($this);
572  }
573  else
574  {
575  include_once("./Services/Utilities/classes/class.ilConfirmationGUI.php");
576  $cgui = new ilConfirmationGUI();
577  $cgui->setFormAction($ilCtrl->getFormAction($this));
578  $cgui->setHeaderText($lng->txt("copg_confirm_el_deletion"));
579  $cgui->setCancel($lng->txt("cancel"), "cancelDeleteSelected");
580  $cgui->setConfirm($lng->txt("confirm"), "confirmedDeleteSelected");
581  $cgui->addHiddenItem("target", $_POST["target"][0]);
582 
583  $tpl->setContent($cgui->getHTML());
584  }
585  }
586 
594  {
595  $this->ctrl->returnToParent($this);
596  }
597 
598 
603  {
604  $targets = explode(";", $_POST["target"]);
605  if (count($targets) > 0)
606  {
607  $updated = $this->page->deleteContents($targets, true,
608  $this->page_gui->getPageConfig()->getEnableSelfAssessment());
609  if($updated !== true)
610  {
611  $_SESSION["il_pg_error"] = $updated;
612  }
613  else
614  {
615  unset($_SESSION["il_pg_error"]);
616  }
617  }
618  $this->ctrl->returnToParent($this);
619  }
620 
624  function copySelected()
625  {
626  global $lng;
627 
628  if (is_int(strpos($_POST["target"][0], ";")))
629  {
630  $_POST["target"] = explode(";", $_POST["target"][0]);
631  }
632  if (is_array($_POST["target"]))
633  {
634  $this->page->copyContents($_POST["target"]);
635  ilUtil::sendSuccess($lng->txt("cont_sel_el_copied_use_paste"), true);
636  }
637  $this->ctrl->returnToParent($this);
638  }
639 
643  function cutSelected()
644  {
645  global $lng;
646 
647  if (is_int(strpos($_POST["target"][0], ";")))
648  {
649  $_POST["target"] = explode(";", $_POST["target"][0]);
650  }
651  if (is_array($_POST["target"]))
652  {
653  $updated = $this->page->cutContents($_POST["target"]);
654  if($updated !== true)
655  {
656  $_SESSION["il_pg_error"] = $updated;
657  }
658  else
659  {
660  unset($_SESSION["il_pg_error"]);
661  }
662  ilUtil::sendSuccess($lng->txt("cont_sel_el_cut_use_paste"), true);
663  }
664  $this->ctrl->returnToParent($this);
665  }
666 
670  function paste($a_hier_id)
671  {
672  global $ilCtrl;
673  $this->page->pasteContents($a_hier_id, $this->page_gui->getPageConfig()->getEnableSelfAssessment());
674  include_once("./Modules/LearningModule/classes/class.ilEditClipboard.php");
676  $this->ctrl->returnToParent($this);
677  }
678 
682  function activateSelected()
683  {
684  if (is_int(strpos($_POST["target"][0], ";")))
685  {
686  $_POST["target"] = explode(";", $_POST["target"][0]);
687  }
688  if (is_array($_POST["target"]))
689  {
690  $updated = $this->page->switchEnableMultiple($_POST["target"], true,
691  $this->page_gui->getPageConfig()->getEnableSelfAssessment());
692  if($updated !== true)
693  {
694  $_SESSION["il_pg_error"] = $updated;
695  }
696  else
697  {
698  unset($_SESSION["il_pg_error"]);
699  }
700  }
701  $this->ctrl->returnToParent($this);
702  }
703 
708  {
709  global $tpl, $lng;
710 
711  if (is_int(strpos($_POST["target"][0], ";")))
712  {
713  $_POST["target"] = explode(";", $_POST["target"][0]);
714  }
715  if (is_array($_POST["target"]))
716  {
717  $types = array();
718 
719  // check what content element types have been selected
720  foreach ($_POST["target"] as $t)
721  {
722  $tarr = explode(":", $t);
723  $cont_obj = $this->page->getContentObject($tarr[0], $tarr[1]);
724  if (is_object($cont_obj) && $cont_obj->getType() == "par")
725  {
726  $types["par"] = "par";
727  }
728  if (is_object($cont_obj) && $cont_obj->getType() == "sec")
729  {
730  $types["sec"] = "sec";
731  }
732  }
733 
734  if (count($types) == 0)
735  {
736  ilUtil::sendFailure($lng->txt("cont_select_par_or_section"), true);
737  $this->ctrl->returnToParent($this);
738  }
739  else
740  {
741  $this->initCharacteristicForm($_POST["target"], $types);
742  $tpl->setContent($this->form->getHTML());
743  }
744  }
745  else
746  {
747  $this->ctrl->returnToParent($this);
748  }
749  }
750 
754  function initCharacteristicForm($a_target, $a_types)
755  {
756  global $ilCtrl, $lng;
757 
758 
759  // edit form
760  include_once("./Services/Form/classes/class.ilPropertyFormGUI.php");
761  $this->form = new ilPropertyFormGUI();
762  $this->form->setTitle($this->lng->txt("cont_choose_characteristic"));
763 
764  if ($a_types["par"] == "par")
765  {
766  $select_prop = new ilSelectInputGUI($this->lng->txt("cont_choose_characteristic_text"),
767  "char_par");
768  include_once("./Services/COPage/classes/class.ilPCParagraphGUI.php");
769  $options = ilPCParagraphGUI::_getCharacteristics($this->page_gui->getStyleId());
770  $select_prop->setOptions($options);
771  $this->form->addItem($select_prop);
772  }
773  if ($a_types["sec"] == "sec")
774  {
775  $select_prop = new ilSelectInputGUI($this->lng->txt("cont_choose_characteristic_section"),
776  "char_sec");
777  include_once("./Services/COPage/classes/class.ilPCSectionGUI.php");
778  $options = ilPCSectionGUI::_getCharacteristics($this->page_gui->getStyleId());
779  $select_prop->setOptions($options);
780  $this->form->addItem($select_prop);
781  }
782 
783  foreach ($a_target as $t)
784  {
785  $hidden = new ilHiddenInputGUI("target[]");
786  $hidden->setValue($t);
787  $this->form->addItem($hidden);
788  }
789 
790  $this->form->setFormAction($ilCtrl->getFormAction($this));
791  $this->form->addCommandButton("assignCharacteristic", $lng->txt("save"));
792  $this->form->addCommandButton("showPage", $lng->txt("cancel"));
793 
794  }
795 
800  {
801  $char_par = ilUtil::stripSlashes($_POST["char_par"]);
802  $char_sec = ilUtil::stripSlashes($_POST["char_sec"]);
803  if (is_array($_POST["target"]))
804  {
805  foreach ($_POST["target"] as $t)
806  {
807  $tarr = explode(":", $t);
808  $cont_obj = $this->page->getContentObject($tarr[0], $tarr[1]);
809  if (is_object($cont_obj) && $cont_obj->getType() == "par")
810  {
811  $cont_obj->setCharacteristic($char_par);
812  }
813  if (is_object($cont_obj) && $cont_obj->getType() == "sec")
814  {
815  $cont_obj->setCharacteristic($char_sec);
816  }
817  }
818  $updated = $this->page->update();
819  if($updated !== true)
820  {
821  $_SESSION["il_pg_error"] = $updated;
822  }
823  else
824  {
825  unset($_SESSION["il_pg_error"]);
826  }
827  }
828  $this->ctrl->returnToParent($this);
829  }
830 
834  function pasteFromClipboard($a_hier_id)
835  {
836  global $ilCtrl;
837 //var_dump($a_hier_id);
838  $ilCtrl->setParameter($this, "hier_id", $a_hier_id);
839  $ilCtrl->setParameterByClass("ilEditClipboardGUI", "returnCommand",
840  rawurlencode($ilCtrl->getLinkTarget($this,
841  "insertFromClipboard", "", false, false)));
842 //echo ":".$ilCtrl->getLinkTarget($this, "insertFromClipboard").":";
843  $ilCtrl->redirectByClass("ilEditClipboardGUI", "getObject");
844  }
845 
850  {
851  include_once("./Services/Clipboard/classes/class.ilEditClipboardGUI.php");
853  include_once ("./Services/COPage/classes/class.ilPCMediaObject.php");
854  if ($ids != "")
855  {
856  foreach ($ids as $id2)
857  {
858  $id = explode(":", $id2);
859  $type = $id[0];
860  $id = $id[1];
861  if ($type == "mob")
862  {
863  $this->content_obj = new ilPCMediaObject($this->page);
864  $this->content_obj->readMediaObject($id);
865  $this->content_obj->createAlias($this->page, $_GET["hier_id"]);
866  $this->updated = $this->page->update();
867  }
868  if ($type == "incl")
869  {
870  include_once("./Services/COPage/classes/class.ilPCContentInclude.php");
871  $this->content_obj = new ilPCContentInclude($this->page);
872  $this->content_obj->create($this->page, $_GET["hier_id"]);
873  $this->content_obj->setContentType("mep");
874  $this->content_obj->setContentId($id);
875  $this->updated = $this->page->update();
876  }
877  }
878  }
879  $this->ctrl->returnToParent($this);
880  }
881 
885  function displayPage()
886  {
887  $this->ctrl->returnToParent($this);
888  }
889 
893  function displayLocator()
894  {
895  if(is_object($this->locator))
896  {
897  $this->locator->display();
898  }
899  }
900 
904  function showSnippetInfo()
905  {
906  global $tpl, $lng, $ilAccess, $ilCtrl;
907 
908  $stpl = new ilTemplate("tpl.snippet_info.html", true, true, "Services/COPage");
909 
910  include_once("./Modules/MediaPool/classes/class.ilMediaPoolItem.php");
911  $mep_pools = ilMediaPoolItem::getPoolForItemId($_POST["ci_id"]);
912  foreach ($mep_pools as $mep_id)
913  {
914  $ref_ids = ilObject::_getAllReferences($mep_id);
915  $edit_link = false;
916  foreach ($ref_ids as $rid)
917  {
918  if (!$edit_link && $ilAccess->checkAccess("write", "", $rid))
919  {
920  $stpl->setCurrentBlock("edit_link");
921  $stpl->setVariable("TXT_EDIT", $lng->txt("edit"));
922  $stpl->setVariable("HREF_EDIT",
923  "./goto.php?target=mep_".$rid);
924  $stpl->parseCurrentBlock();
925  }
926  }
927  $stpl->setCurrentBlock("pool");
928  $stpl->setVariable("TXT_MEDIA_POOL", $lng->txt("obj_mep"));
929  $stpl->setVariable("VAL_MEDIA_POOL", ilObject::_lookupTitle($mep_id));
930  $stpl->parseCurrentBlock();
931  }
932 
933  include_once("./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
934  $stpl->setVariable("TXT_TITLE", $lng->txt("title"));
935  $stpl->setVariable("VAL_TITLE", ilMediaPoolPage::lookupTitle($_POST["ci_id"]));
936  $stpl->setVariable("TXT_BACK", $lng->txt("back"));
937  $stpl->setVariable("HREF_BACK",
938  $ilCtrl->getLinkTarget($this->page_gui, "edit"));
939  $tpl->setContent($stpl->get());
940  }
941 
942 }
943 ?>
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
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?
static getPoolForItemId($a_id)
Get media pools for item id.
returnToContext()
redirect to parent context
$_SESSION["AccountId"]
This class represents a selection list property in a property form.
displayLocator()
display locator
This class represents a property form user interface.
setMediaMode()
set media and editing mode
cutSelected()
Cut selected items.
$_GET["client_id"]
showSnippetInfo()
Show snippet info.
Class ilPCPluggedGUI.
static getPCDefinitionByGUIClassName($a_gui_class_name)
Get PC definition by name.
$cmd
Definition: sahs_server.php:35
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.
static _lookupTitle($a_id)
lookup object title
Class ilInternalLinkGUI.
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 _getAllReferences($a_id)
get all reference ids of object
__construct(&$a_page_object, &$a_page_object_gui)
Constructor.
Class ilPCMediaObjectGUI.
setMode($a_mode="text")
Set mode.
Page Editor GUI class.
global $ilCtrl
Definition: ilias.php:18
copySelected()
Copy selected items.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Class ilPCQuestionGUI.
initCharacteristicForm($a_target, $a_types)
Init map creation/update form.
copyLinkedMediaToClipboard()
copy linked media object to clipboard
This class represents a hidden form property in a property form.
Class ilPCContentInclude.
static _getCharacteristics($a_style_id)
Get characteristics.
if(!is_array($argv)) $options
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
$ilUser
Definition: imgupload.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
setHeader($a_header)
set header title
addChangeComment()
add change comment to history
Add a drawing to the header
Definition: 04printing.php:69
cancelDeleteSelected()
Cancel deletion.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
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.
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
Class ilObjMediaObjectGUI.
static requirePCGUIClassByName($a_name)
Get instance.
$ret
Definition: parser.php:6
static getLogger($a_component_id)
Get component logger.
Class ilPCMediaObject.
static getPCDefinitionByType($a_pc_type)
Get PC definition by type.
static setAction($a_action)
$_POST["username"]
pasteFromClipboard($a_hier_id)
paste from clipboard (redirects to clipboard)
Confirmation screen class.
getHeader()
get header title