ILIAS  release_4-3 Revision
 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->setMaxLength(128);
226  $ti->setSize(40);
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  }
687 
688  // show standard meta data section
689  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
690 
691  // forward the command
692  $this->ctrl->forwardCommand($info);
693  }
694 
695 
696 
700  function setTabs()
701  {
702  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm_b.png"));
703 
704  $this->getTabs();
705  $this->tpl->setTitle($this->object->getTitle());
706  }
707 
711  function getTabs()
712  {
713  global $ilUser, $ilAccess, $ilTabs, $lng, $ilHelp;
714 
715  $ilHelp->setScreenIdComponent("htlm");
716 
717  if($ilAccess->checkAccess('write', '', $this->ref_id))
718  {
719  $ilTabs->addTab("id_list_files",
720  $lng->txt("cont_list_files"),
721  $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
722 
723  $ilTabs->addTab("id_info",
724  $lng->txt("info_short"),
725  $this->ctrl->getLinkTargetByClass(array("ilobjfilebasedlmgui", "ilinfoscreengui"), "showSummary"));
726 
727  $ilTabs->addTab("id_settings",
728  $lng->txt("settings"),
729  $this->ctrl->getLinkTarget($this, "properties"));
730  }
731 
732  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
733  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
734  {
735  $ilTabs->addTab("id_learning_progress",
736  $lng->txt("learning_progress"),
737  $this->ctrl->getLinkTargetByClass(array('ilobjfilebasedlmgui','illearningprogressgui'), ''));
738  }
739 
740  include_once("Services/License/classes/class.ilLicenseAccess.php");
741  if ($ilAccess->checkAccess('edit_permission', '', $this->ref_id)
743  {
744  $ilTabs->addTab("id_license",
745  $lng->txt("license"),
746  $this->ctrl->getLinkTargetByClass('illicensegui', ''));
747  }
748 
749  if($ilAccess->checkAccess('write', '', $this->ref_id))
750  {
751  $ilTabs->addTab("id_meta_data",
752  $lng->txt("meta_data"),
753  $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''));
754 
755  $ilTabs->addTab("id_bib_data",
756  $lng->txt("bib_data"),
757  $this->ctrl->getLinkTarget($this, "editBibItem"));
758  }
759 
760 
761  // export
762  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
763  {
764  $ilTabs->addTab("export",
765  $lng->txt("export"),
766  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
767  }
768 
769  if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
770  {
771  $ilTabs->addTab("id_permissions",
772  $lng->txt("perm_settings"),
773  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"));
774  }
775 
776  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
777  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
778 
779  if ($startfile != "")
780  {
781  $ilTabs->addNonTabbedLink("presentation_view",
782  $this->lng->txt("glo_presentation_view"),
783  "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID(),
784  "_blank"
785  );
786  }
787 
788  }
789 
795  function _goto($a_target)
796  {
797  global $rbacsystem, $ilErr, $lng, $ilAccess;
798 
799  if ($ilAccess->checkAccess("visible", "", $a_target))
800  {
801  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
802  }
803  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
804  {
805  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
808  }
809 
810  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
811  }
812 
813  function addLocatorItems()
814  {
815  global $ilLocator;
816 
817  if (is_object($this->object))
818  {
819  $ilLocator->addItem($this->object->getTitle(),
820  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "", $_GET["ref_id"]);
821  }
822  }
823 
824 
831  function importFileObject($parent_id = null)
832  {
833  try
834  {
835  return parent::importFileObject();
836  }
838  {
839  // since there is no manifest xml we assume that this is an HTML export file
840  $this->createFromDirectory($e->getTmpDir());
841  }
842  }
843 
850  function createFromDirectory($a_dir)
851  {
852  global $ilErr;
853 
854  if (!$this->checkPermissionBool("create", "", "htlm") || $a_dir == "")
855  {
856  $ilErr->raiseError($this->lng->txt("no_create_permission"));
857  }
858 
859  // create instance
860  $newObj = new ilObjFileBasedLM();
861  $filename = ilUtil::stripSlashes($_FILES["importfile"]["name"]);
862  $newObj->setTitle($filename);
863  $newObj->setDescription("");
864  $newObj->create();
865  $newObj->populateByDirectoy($a_dir, $filename);
866  $this->putObjectInTree($newObj);
867 
868  $this->afterSave($newObj);
869  }
870 
871 
872 
873 
877 
878 
882  function exportHTML()
883  {
884  $inst_id = IL_INST_ID;
885 
886  include_once("./Services/Export/classes/class.ilExport.php");
887 
888  ilExport::_createExportDirectory($this->object->getId(), "html",
889  $this->object->getType());
890  $export_dir = ilExport::_getExportDirectory($this->object->getId(), "html",
891  $this->object->getType());
892 
893  $subdir = $this->object->getType()."_".$this->object->getId();
894  $filename = $this->subdir.".zip";
895 
896  $target_dir = $export_dir."/".$subdir;
897 
898  ilUtil::delDir($target_dir);
899  ilUtil::makeDir($target_dir);
900 
901  $source_dir = $this->object->getDataDirectory();
902 
903  ilUtil::rCopy($source_dir, $target_dir);
904 
905  // zip it all
906  $date = time();
907  $zip_file = $export_dir."/".$date."__".IL_INST_ID."__".
908  $this->object->getType()."_".$this->object->getId().".zip";
909  ilUtil::zip($target_dir, $zip_file);
910 
911  ilUtil::delDir($target_dir);
912  }
913 
914 }
915 ?>