ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjFileBasedLMGUI.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2010 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 
19 require_once("./Services/Object/classes/class.ilObjectGUI.php");
20 require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLM.php");
21 require_once("./Services/Table/classes/class.ilTableGUI.php");
22 require_once("./Services/FileSystem/classes/class.ilFileSystemGUI.php");
23 
25 {
27 
33  function ilObjFileBasedLMGUI($a_data,$a_id = 0,$a_call_by_reference = true, $a_prepare_output = true)
34  {
35  global $lng, $ilCtrl;
36 
37  $this->ctrl =& $ilCtrl;
38  $this->ctrl->saveParameter($this, array("ref_id"));
39 
40  $this->type = "htlm";
41  $lng->loadLanguageModule("content");
42 
43  parent::ilObjectGUI($a_data, $a_id, $a_call_by_reference, false);
44  //$this->actions = $this->objDefinition->getActions("mep");
45  $this->output_prepared = $a_prepare_output;
46 
47  }
48 
52  function executeCommand()
53  {
54  global $ilUser, $ilLocator, $ilTabs;
55 
56  $next_class = $this->ctrl->getNextClass($this);
57  $cmd = $this->ctrl->getCmd();
58 
59  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
60  $this->getCreationMode() == true)
61  {
62  $this->prepareOutput();
63  }
64  else
65  {
66  if (!in_array($cmd, array("", "framset")) || $next_class != "")
67  {
68  $this->getTemplate();
69  $this->setLocator();
70  $this->setTabs();
71  }
72  }
73 
74 
75  if(!$this->getCreationMode())
76  {
77  if(IS_PAYMENT_ENABLED)
78  {
79  include_once 'Services/Payment/classes/class.ilPaymentObject.php';
80  if(ilPaymentObject::_requiresPurchaseToAccess($_GET['ref_id'], $type = (isset($_GET['purchasetype']) ? $_GET['purchasetype'] : NULL) ))
81  {
82  $this->tpl->getStandardTemplate();
83 
84  include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
85  $pp = new ilShopPurchaseGUI((int)$_GET['ref_id']);
86  $ret = $this->ctrl->forwardCommand($pp);
87  return true;
88  }
89  }
90  }
91 
92  switch($next_class)
93  {
94  case 'ilmdeditorgui':
95  $this->checkPermission("write");
96  $ilTabs->activateTab('id_meta_data');
97  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
98 
99  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
100  $md_gui->addObserver($this->object,'MDUpdateListener','General');
101 
102  $this->ctrl->forwardCommand($md_gui);
103  break;
104 
105  case "ilfilesystemgui":
106  $this->checkPermission("write");
107  $ilTabs->activateTab('id_list_files');
108  $fs_gui =& new ilFileSystemGUI($this->object->getDataDirectory());
109  $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose"));
110  $fs_gui->setTableId("htlmfs".$this->object->getId());
111  if ($this->object->getStartFile() != "")
112  {
113  $fs_gui->labelFile($this->object->getStartFile(),
114  $this->lng->txt("cont_startfile"));
115  }
116  $fs_gui->addCommand($this, "setStartFile", $this->lng->txt("cont_set_start_file"));
117  $ret =& $this->ctrl->forwardCommand($fs_gui);
118  break;
119 
120  case "ilinfoscreengui":
121  $ret =& $this->outputInfoScreen();
122  break;
123 
124  case "illearningprogressgui":
125  $ilTabs->activateTab('id_learning_progress');
126  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
128  $this->object->getRefId(),
129  $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
130  $this->ctrl->forwardCommand($new_gui);
131  break;
132 
133  case 'ilpermissiongui':
134  $ilTabs->activateTab('id_permissions');
135  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
136  $perm_gui =& new ilPermissionGUI($this);
137  $ret =& $this->ctrl->forwardCommand($perm_gui);
138  break;
139 
140  case 'illicensegui':
141  $ilTabs->activateTab('id_license');
142  include_once("./Services/License/classes/class.ilLicenseGUI.php");
143  $license_gui =& new ilLicenseGUI($this);
144  $ret =& $this->ctrl->forwardCommand($license_gui);
145  break;
146 
147  case "ilexportgui":
148  $ilTabs->activateTab("export");
149  include_once("./Services/Export/classes/class.ilExportGUI.php");
150  $exp_gui = new ilExportGUI($this);
151  $exp_gui->addFormat("xml");
152  $exp_gui->addFormat("html", "", $this, "exportHTML");
153  $ret = $this->ctrl->forwardCommand($exp_gui);
154 // $this->tpl->show();
155  break;
156 
157  case "ilcommonactiondispatchergui":
158  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
160  $this->ctrl->forwardCommand($gui);
161  break;
162 
163  default:
164  $cmd = $this->ctrl->getCmd("frameset");
165  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
166  $this->getCreationMode() == true)
167  {
168  $cmd.= "Object";
169  }
170  $ret =& $this->$cmd();
171  break;
172  }
173 
174  $this->addHeaderAction();
175  }
176 
177  protected function initCreationForms($a_new_type)
178  {
179  $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
180  self::CFORM_IMPORT => $this->initImportForm($a_new_type));
181 
182  return $forms;
183  }
184 
190  final function cancelCreationObject($in_rep = false)
191  {
192  global $ilCtrl;
193 
194  $ilCtrl->redirectByClass("ilrepositorygui", "frameset");
195  }
196 
202  function properties()
203  {
204  global $rbacsystem, $tree, $tpl, $ilTabs;
205 
206  $ilTabs->activateTab("id_settings");
207 
208  $this->initSettingsForm();
209  $this->getSettingsFormValues();
210  $tpl->setContent($this->form->getHTML());
211  }
212 
216  public function initSettingsForm()
217  {
218  global $lng, $ilCtrl;
219 
220  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
221  $this->form = new ilPropertyFormGUI();
222 
223  // title
224  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
225  $ti->setSize(min(40, ilObject::TITLE_LENGTH));
226  $ti->setMaxLength(ilObject::TITLE_LENGTH);
227  $ti->setRequired(true);
228  $this->form->addItem($ti);
229 
230  // description
231  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
232  $ta->setCols(40);
233  $ta->setRows(2);
234  $this->form->addItem($ta);
235 
236  // online
237  $cb = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
238  $cb->setOptionTitle($lng->txt(""));
239  $cb->setValue("y");
240  $this->form->addItem($cb);
241 
242  // startfile
243  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
244  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
245 
246  $ne = new ilNonEditableValueGUI($lng->txt("cont_startfile"), "");
247  if ($startfile != "")
248  {
249  $ne->setValue(basename($startfile));
250  }
251  else
252  {
253  $ne->setValue(basename($this->lng->txt("no_start_file")));
254  }
255  $this->form->addItem($ne);
256 
257  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
258  $this->form->addCommandButton("toFilesystem", $lng->txt("cont_set_start_file"));
259 
260  $this->form->setTitle($lng->txt("cont_lm_properties"));
261  $this->form->setFormAction($ilCtrl->getFormAction($this, "saveProperties"));
262  }
263 
267  public function getSettingsFormValues()
268  {
269  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
270  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
271 
272  $values = array();
273  $values["cobj_online"] = $this->object->getOnline();
274  if ($startfile != "")
275  {
276  $startfile = basename($startfile);
277  }
278  else
279  {
280  $startfile = $this->lng->txt("no_start_file");
281  }
282 
283  $values["cobj_online"] = $this->object->getOnline();
284  $values["startfile"] = $startfile;
285  $values["title"] = $this->object->getTitle();
286  $values["desc"] = $this->object->getDescription();
287 
288  $this->form->setValuesByArray($values);
289  }
290 
297  function toFilesystem()
298  {
299  global $ilCtrl;
300 
301  $ilCtrl->redirectByClass("ilfilesystemgui", "listFiles");
302  }
303 
307  public function saveProperties()
308  {
309  global $tpl, $lng, $ilCtrl, $ilTabs;
310 
311  $this->initSettingsForm("");
312  if ($this->form->checkInput())
313  {
314  $this->object->setTitle($this->form->getInput("title"));
315  $this->object->setDescription($this->form->getInput("desc"));
316  $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
317  $this->object->update();
318  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
319  $this->ctrl->redirect($this, "properties");
320  }
321 
322  $ilTabs->activateTab("id_settings");
323  $this->form->setValuesByPost();
324  $tpl->setContent($this->form->getHtml());
325  }
326 
332  function editObject()
333  {
334  global $rbacsystem, $tree, $tpl;
335 
336  if (!$rbacsystem->checkAccess("visible,write",$this->object->getRefId()))
337  {
338  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
339  }
340 
341  // edit button
342  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
343 
344  }
345 
349  function edit()
350  {
351  $this->prepareOutput();
352  $this->editObject();
353  }
354 
358  function cancel()
359  {
360  //$this->setReturnLocation("cancel","fblm_edit.php?cmd=listFiles&ref_id=".$_GET["ref_id"]);
361  $this->cancelObject();
362  }
363 
368  function afterSave($newObj)
369  {
370  // always send a message
371  ilUtil::sendSuccess($this->lng->txt("object_added"),true);
372  ilUtil::redirect("ilias.php?baseClass=ilHTLMEditorGUI&ref_id=".$newObj->getRefId());
373  }
374 
375 
379  function update()
380  {
381  //$this->setReturnLocation("update", "fblm_edit.php?cmd=listFiles&ref_id=".$_GET["ref_id"].
382  // "&obj_id=".$_GET["obj_id"]);
383  $this->updateObject();
384  }
385 
386 
387  function setStartFile($a_file)
388  {
389  $this->object->setStartFile($a_file);
390  $this->object->update();
391  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
392  }
393 
397  function perm()
398  {
399  $this->setFormAction("permSave", "fblm_edit.php?cmd=permSave&ref_id=".$_GET["ref_id"].
400  "&obj_id=".$_GET["obj_id"]);
401  $this->setFormAction("addRole", "fblm_edit.php?ref_id=".$_GET["ref_id"].
402  "&obj_id=".$_GET["obj_id"]."&cmd=addRole");
403  $this->permObject();
404  }
405 
409  function saveBibItemObject($a_target = "")
410  {
411  global $ilTabs;
412 
413  $ilTabs->activateTab("id_bib_data");
414 
415  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
416  $bib_gui =& new ilBibItemGUI();
417  $bib_gui->setObject($this->object);
418  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
419  $bibItemIndex *= 1;
420  if ($bibItemIndex < 0)
421  {
422  $bibItemIndex = 0;
423  }
424  $bibItemIndex = $bib_gui->save($bibItemIndex);
425 
426  if ($a_target == "")
427  {
428  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
429  }
430 
431  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
432  }
433 
437  function saveBibItem()
438  {
439  // questionable workaround to make this old stuff work
440  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
441 
442  //$this->setTabs();
443  $this->saveBibItemObject($this->ctrl->getLinkTarget($this));
444  }
445 
449  function editBibItemObject($a_target = "")
450  {
451  global $ilTabs;
452 
453  $ilTabs->activateTab("id_bib_data");
454 
455  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
456  $bib_gui =& new ilBibItemGUI();
457  $bib_gui->setObject($this->object);
458  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
459  $bibItemIndex *= 1;
460  if ($bibItemIndex < 0)
461  {
462  $bibItemIndex = 0;
463  }
464  if ($a_target == "")
465  {
466  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
467  }
468 
469  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
470  }
471 
475  function editBibItem()
476  {
477  // questionable workaround to make this old stuff work
478  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
479 
480  //$this->setTabs();
481  $this->editBibItemObject($this->ctrl->getLinkTarget($this));
482  }
483 
487  function deleteBibItemObject($a_target = "")
488  {
489  global $ilTabs;
490 
491  $ilTabs->activateTab("id_bib_data");
492 
493  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
494  $bib_gui =& new ilBibItemGUI();
495  $bib_gui->setObject($this->object);
496  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
497  $bib_gui->bib_obj->delete($_GET["bibItemName"], $_GET["bibItemPath"], $bibItemIndex);
498  if (strpos($bibItemIndex, ",") > 0)
499  {
500  $bibItemIndex = substr($bibItemIndex, 0, strpos($bibItemIndex, ","));
501  }
502  if ($a_target == "")
503  {
504  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
505  }
506 
507  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
508  }
509 
513  function deleteBibItem()
514  {
515  // questionable workaround to make this old stuff work
516  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
517 
518  //$this->setTabs();
519  $this->deleteBibItemObject($this->ctrl->getLinkTarget($this));
520  }
521 
525  function addBibItemObject($a_target = "")
526  {
527  global $ilTabs;
528 
529  $ilTabs->activateTab("id_bib_data");
530 
531  $bibItemName = $_POST["bibItemName"] ? $_POST["bibItemName"] : $_GET["bibItemName"];
532  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
533  if ($bibItemName == "BibItem")
534  {
535  include_once "./Modules/LearningModule/classes/class.ilBibItem.php";
536  $bib_item =& new ilBibItem();
537  $bib_item->setId($this->object->getId());
538  $bib_item->setType($this->object->getType());
539  $bib_item->read();
540  }
541 
542  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
543  $bib_gui =& new ilBibItemGUI();
544  $bib_gui->setObject($this->object);
545  if ($bibItemIndex == "")
546  $bibItemIndex = 0;
547  $bibItemPath = $_POST["bibItemPath"] ? $_POST["bibItemPath"] : $_GET["bibItemPath"];
548 
549  //if ($bibItemName != "" && $bibItemName != "BibItem")
550  if ($bibItemName != "")
551  {
552  $bib_gui->bib_obj->add($bibItemName, $bibItemPath, $bibItemIndex);
553  $data = $bib_gui->bib_obj->getElement("BibItem");
554  $bibItemIndex = (count($data) - 1);
555  }
556  else
557  {
558  ilUtil::sendInfo($this->lng->txt("bibitem_choose_element"), true);
559  }
560  if ($a_target == "")
561  {
562  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
563  }
564 
565  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
566  }
567 
571  function addBibItem()
572  {
573  // questionable workaround to make this old stuff work
574  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
575 
576  //$this->setTabs();
577  $this->addBibItemObject($this->ctrl->getLinkTarget($this));
578  }
579 
583  function frameset()
584  {
585  global $ilCtrl;
586 
587  $ilCtrl->setCmdClass("ilfilesystemgui");
588  $ilCtrl->setCmd("listFiles");
589  return $this->executeCommand();
590  }
591 
595  function getTemplate()
596  {
597  global $lng;
598 
599  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
600  //$this->tpl->setVariable("HEADER", $a_header_title);
601  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
602  //$this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
603  }
604 
606  {
607  global $ilUser;
608 
609  // Note license usage
610  include_once "Services/License/classes/class.ilLicense.php";
611  ilLicense::_noteAccess($this->object->getId(), $this->object->getType(),
612  $this->object->getRefId());
613 
614  // #9483
615  if ($ilUser->getId() != ANONYMOUS_USER_ID)
616  {
617  include_once "Services/Tracking/classes/class.ilLearningProgress.php";
618  ilLearningProgress::_tracProgress($ilUser->getId(), $this->object->getId(),
619  $this->object->getRefId(), "htlm");
620  }
621 
622  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
623  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
624  if ($startfile != "")
625  {
626  ilUtil::redirect($startfile);
627  }
628  }
629 
630  // InfoScreen methods
636  function infoScreen()
637  {
638  $this->ctrl->setCmd("showSummary");
639  $this->ctrl->setCmdClass("ilinfoscreengui");
640  $this->outputInfoScreen();
641  }
642 
646  function showInfoScreen()
647  {
648  $this->outputInfoScreen(true);
649  }
650 
654  function outputInfoScreen($a_standard_locator = true)
655  {
656  global $ilBench, $ilLocator, $ilAccess, $ilTabs;
657 
658  $ilTabs->activateTab('id_info');
659 
660  $this->lng->loadLanguageModule("meta");
661  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
662 
663  $info = new ilInfoScreenGUI($this);
664  $info->enablePrivateNotes();
665  $info->enableLearningProgress();
666 
667  $info->enableNews();
668  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
669  {
670  $info->enableNewsEditing();
671 
672  $news_set = new ilSetting("news");
673  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
674  if ($enable_internal_rss)
675  {
676  $info->setBlockProperty("news", "settings", true);
677  }
678  }
679 
680  // add read / back button
681  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
682  {
683  $info->addButton($this->lng->txt("view"),
684  "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID(),
685  ' target="ilContObj'.$this->object->getId().'" ',
686  'top', true);
687  }
688 
689  // show standard meta data section
690  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
691 
692  // forward the command
693  $this->ctrl->forwardCommand($info);
694  }
695 
696 
697 
701  function setTabs()
702  {
703  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm_b.png"));
704 
705  $this->getTabs();
706  $this->tpl->setTitle($this->object->getTitle());
707  }
708 
712  function getTabs()
713  {
714  global $ilUser, $ilAccess, $ilTabs, $lng, $ilHelp;
715 
716  $ilHelp->setScreenIdComponent("htlm");
717 
718  if($ilAccess->checkAccess('write', '', $this->ref_id))
719  {
720  $ilTabs->addTab("id_list_files",
721  $lng->txt("cont_list_files"),
722  $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
723 
724  $ilTabs->addTab("id_info",
725  $lng->txt("info_short"),
726  $this->ctrl->getLinkTargetByClass(array("ilobjfilebasedlmgui", "ilinfoscreengui"), "showSummary"));
727 
728  $ilTabs->addTab("id_settings",
729  $lng->txt("settings"),
730  $this->ctrl->getLinkTarget($this, "properties"));
731  }
732 
733  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
734  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
735  {
736  $ilTabs->addTab("id_learning_progress",
737  $lng->txt("learning_progress"),
738  $this->ctrl->getLinkTargetByClass(array('ilobjfilebasedlmgui','illearningprogressgui'), ''));
739  }
740 
741  include_once("Services/License/classes/class.ilLicenseAccess.php");
742  if ($ilAccess->checkAccess('edit_permission', '', $this->ref_id)
744  {
745  $ilTabs->addTab("id_license",
746  $lng->txt("license"),
747  $this->ctrl->getLinkTargetByClass('illicensegui', ''));
748  }
749 
750  if($ilAccess->checkAccess('write', '', $this->ref_id))
751  {
752  $ilTabs->addTab("id_meta_data",
753  $lng->txt("meta_data"),
754  $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''));
755 
756  $ilTabs->addTab("id_bib_data",
757  $lng->txt("bib_data"),
758  $this->ctrl->getLinkTarget($this, "editBibItem"));
759  }
760 
761 
762  // export
763  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
764  {
765  $ilTabs->addTab("export",
766  $lng->txt("export"),
767  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
768  }
769 
770  if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
771  {
772  $ilTabs->addTab("id_permissions",
773  $lng->txt("perm_settings"),
774  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"));
775  }
776 
777  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
778  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
779 
780  if ($startfile != "")
781  {
782  $ilTabs->addNonTabbedLink("presentation_view",
783  $this->lng->txt("glo_presentation_view"),
784  "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID(),
785  "_blank"
786  );
787  }
788 
789  }
790 
796  function _goto($a_target)
797  {
798  global $rbacsystem, $ilErr, $lng, $ilAccess;
799 
800  if ($ilAccess->checkAccess("visible", "", $a_target))
801  {
802  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
803  }
804  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
805  {
806  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
809  }
810 
811  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
812  }
813 
814  function addLocatorItems()
815  {
816  global $ilLocator;
817 
818  if (is_object($this->object))
819  {
820  $ilLocator->addItem($this->object->getTitle(),
821  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "", $_GET["ref_id"]);
822  }
823  }
824 
825 
832  function importFileObject($parent_id = null)
833  {
834  try
835  {
836  return parent::importFileObject();
837  }
839  {
840  // since there is no manifest xml we assume that this is an HTML export file
841  $this->createFromDirectory($e->getTmpDir());
842  }
843  }
844 
851  function createFromDirectory($a_dir)
852  {
853  global $ilErr;
854 
855  if (!$this->checkPermissionBool("create", "", "htlm") || $a_dir == "")
856  {
857  $ilErr->raiseError($this->lng->txt("no_create_permission"));
858  }
859 
860  // create instance
861  $newObj = new ilObjFileBasedLM();
862  $filename = ilUtil::stripSlashes($_FILES["importfile"]["name"]);
863  $newObj->setTitle($filename);
864  $newObj->setDescription("");
865  $newObj->create();
866  $newObj->populateByDirectoy($a_dir, $filename);
867  $this->putObjectInTree($newObj);
868 
869  $this->afterSave($newObj);
870  }
871 
872 
873 
874 
878 
879 
883  function exportHTML()
884  {
885  $inst_id = IL_INST_ID;
886 
887  include_once("./Services/Export/classes/class.ilExport.php");
888 
889  ilExport::_createExportDirectory($this->object->getId(), "html",
890  $this->object->getType());
891  $export_dir = ilExport::_getExportDirectory($this->object->getId(), "html",
892  $this->object->getType());
893 
894  $subdir = $this->object->getType()."_".$this->object->getId();
895  $filename = $this->subdir.".zip";
896 
897  $target_dir = $export_dir."/".$subdir;
898 
899  ilUtil::delDir($target_dir);
900  ilUtil::makeDir($target_dir);
901 
902  $source_dir = $this->object->getDataDirectory();
903 
904  ilUtil::rCopy($source_dir, $target_dir);
905 
906  // zip it all
907  $date = time();
908  $zip_file = $export_dir."/".$date."__".IL_INST_ID."__".
909  $this->object->getType()."_".$this->object->getId().".zip";
910  ilUtil::zip($target_dir, $zip_file);
911 
912  ilUtil::delDir($target_dir);
913  }
914 
915 }
916 ?>