ILIAS  Release_4_2_x_branch Revision 61807
 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("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("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  ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
193  }
194 
200  function properties()
201  {
202  global $rbacsystem, $tree, $tpl, $ilTabs;
203 
204  $ilTabs->activateTab("id_settings");
205 
206  $this->initSettingsForm();
207  $this->getSettingsFormValues();
208  $tpl->setContent($this->form->getHTML());
209  }
210 
214  public function initSettingsForm()
215  {
216  global $lng, $ilCtrl;
217 
218  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
219  $this->form = new ilPropertyFormGUI();
220 
221  // title
222  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
223  $ti->setMaxLength(128);
224  $ti->setSize(40);
225  $ti->setRequired(true);
226  $this->form->addItem($ti);
227 
228  // description
229  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
230  $ta->setCols(40);
231  $ta->setRows(2);
232  $this->form->addItem($ta);
233 
234  // online
235  $cb = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
236  $cb->setOptionTitle($lng->txt(""));
237  $cb->setValue("y");
238  $this->form->addItem($cb);
239 
240  // startfile
241  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
242  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
243 
244  $ne = new ilNonEditableValueGUI($lng->txt("cont_startfile"), "");
245  if ($startfile != "")
246  {
247  $ne->setValue(basename($startfile));
248  }
249  else
250  {
251  $ne->setValue(basename($this->lng->txt("no_start_file")));
252  }
253  $this->form->addItem($ne);
254 
255  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
256  $this->form->addCommandButton("toFilesystem", $lng->txt("cont_set_start_file"));
257 
258  $this->form->setTitle($lng->txt("cont_lm_properties"));
259  $this->form->setFormAction($ilCtrl->getFormAction($this, "saveProperties"));
260  }
261 
265  public function getSettingsFormValues()
266  {
267  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
268  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
269 
270  $values = array();
271  $values["cobj_online"] = $this->object->getOnline();
272  if ($startfile != "")
273  {
274  $startfile = basename($startfile);
275  }
276  else
277  {
278  $startfile = $this->lng->txt("no_start_file");
279  }
280 
281  $values["cobj_online"] = $this->object->getOnline();
282  $values["startfile"] = $startfile;
283  $values["title"] = $this->object->getTitle();
284  $values["desc"] = $this->object->getDescription();
285 
286  $this->form->setValuesByArray($values);
287  }
288 
295  function toFilesystem()
296  {
297  global $ilCtrl;
298 
299  $ilCtrl->redirectByClass("ilfilesystemgui", "listFiles");
300  }
301 
305  public function saveProperties()
306  {
307  global $tpl, $lng, $ilCtrl, $ilTabs;
308 
309  $this->initSettingsForm("");
310  if ($this->form->checkInput())
311  {
312  $this->object->setTitle($this->form->getInput("title"));
313  $this->object->setDescription($this->form->getInput("desc"));
314  $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
315  $this->object->update();
316  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
317  $this->ctrl->redirect($this, "properties");
318  }
319 
320  $ilTabs->activateTab("id_settings");
321  $this->form->setValuesByPost();
322  $tpl->setContent($this->form->getHtml());
323  }
324 
330  function editObject()
331  {
332  global $rbacsystem, $tree, $tpl;
333 
334  if (!$rbacsystem->checkAccess("visible,write",$this->object->getRefId()))
335  {
336  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
337  }
338 
339  // edit button
340  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
341 
342  }
343 
347  function edit()
348  {
349  $this->prepareOutput();
350  $this->editObject();
351  }
352 
356  function cancel()
357  {
358  //$this->setReturnLocation("cancel","fblm_edit.php?cmd=listFiles&ref_id=".$_GET["ref_id"]);
359  $this->cancelObject();
360  }
361 
366  function afterSave($newObj)
367  {
368  // always send a message
369  ilUtil::sendSuccess($this->lng->txt("object_added"),true);
370  ilUtil::redirect("ilias.php?baseClass=ilHTLMEditorGUI&ref_id=".$newObj->getRefId());
371  }
372 
378  function cancelObject($in_rep = false)
379  {
380  ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
381  //$this->ctrl->redirectByClass("ilrepositorygui", "frameset");
382  }
383 
387  function update()
388  {
389  //$this->setReturnLocation("update", "fblm_edit.php?cmd=listFiles&ref_id=".$_GET["ref_id"].
390  // "&obj_id=".$_GET["obj_id"]);
391  $this->updateObject();
392  }
393 
394 
395  function setStartFile($a_file)
396  {
397  $this->object->setStartFile($a_file);
398  $this->object->update();
399  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
400  }
401 
405  function perm()
406  {
407  $this->setFormAction("permSave", "fblm_edit.php?cmd=permSave&ref_id=".$_GET["ref_id"].
408  "&obj_id=".$_GET["obj_id"]);
409  $this->setFormAction("addRole", "fblm_edit.php?ref_id=".$_GET["ref_id"].
410  "&obj_id=".$_GET["obj_id"]."&cmd=addRole");
411  $this->permObject();
412  }
413 
417  function saveBibItemObject($a_target = "")
418  {
419  global $ilTabs;
420 
421  $ilTabs->activateTab("id_bib_data");
422 
423  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
424  $bib_gui =& new ilBibItemGUI();
425  $bib_gui->setObject($this->object);
426  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
427  $bibItemIndex *= 1;
428  if ($bibItemIndex < 0)
429  {
430  $bibItemIndex = 0;
431  }
432  $bibItemIndex = $bib_gui->save($bibItemIndex);
433 
434  if ($a_target == "")
435  {
436  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
437  }
438 
439  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
440  }
441 
445  function saveBibItem()
446  {
447  // questionable workaround to make this old stuff work
448  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
449 
450  //$this->setTabs();
451  $this->saveBibItemObject($this->ctrl->getLinkTarget($this));
452  }
453 
457  function editBibItemObject($a_target = "")
458  {
459  global $ilTabs;
460 
461  $ilTabs->activateTab("id_bib_data");
462 
463  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
464  $bib_gui =& new ilBibItemGUI();
465  $bib_gui->setObject($this->object);
466  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
467  $bibItemIndex *= 1;
468  if ($bibItemIndex < 0)
469  {
470  $bibItemIndex = 0;
471  }
472  if ($a_target == "")
473  {
474  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
475  }
476 
477  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
478  }
479 
483  function editBibItem()
484  {
485  // questionable workaround to make this old stuff work
486  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
487 
488  //$this->setTabs();
489  $this->editBibItemObject($this->ctrl->getLinkTarget($this));
490  }
491 
495  function deleteBibItemObject($a_target = "")
496  {
497  global $ilTabs;
498 
499  $ilTabs->activateTab("id_bib_data");
500 
501  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
502  $bib_gui =& new ilBibItemGUI();
503  $bib_gui->setObject($this->object);
504  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
505  $bib_gui->bib_obj->delete($_GET["bibItemName"], $_GET["bibItemPath"], $bibItemIndex);
506  if (strpos($bibItemIndex, ",") > 0)
507  {
508  $bibItemIndex = substr($bibItemIndex, 0, strpos($bibItemIndex, ","));
509  }
510  if ($a_target == "")
511  {
512  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
513  }
514 
515  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
516  }
517 
521  function deleteBibItem()
522  {
523  // questionable workaround to make this old stuff work
524  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
525 
526  //$this->setTabs();
527  $this->deleteBibItemObject($this->ctrl->getLinkTarget($this));
528  }
529 
533  function addBibItemObject($a_target = "")
534  {
535  global $ilTabs;
536 
537  $ilTabs->activateTab("id_bib_data");
538 
539  $bibItemName = $_POST["bibItemName"] ? $_POST["bibItemName"] : $_GET["bibItemName"];
540  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
541  if ($bibItemName == "BibItem")
542  {
543  include_once "./Modules/LearningModule/classes/class.ilBibItem.php";
544  $bib_item =& new ilBibItem();
545  $bib_item->setId($this->object->getId());
546  $bib_item->setType($this->object->getType());
547  $bib_item->read();
548  }
549 
550  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
551  $bib_gui =& new ilBibItemGUI();
552  $bib_gui->setObject($this->object);
553  if ($bibItemIndex == "")
554  $bibItemIndex = 0;
555  $bibItemPath = $_POST["bibItemPath"] ? $_POST["bibItemPath"] : $_GET["bibItemPath"];
556 
557  //if ($bibItemName != "" && $bibItemName != "BibItem")
558  if ($bibItemName != "")
559  {
560  $bib_gui->bib_obj->add($bibItemName, $bibItemPath, $bibItemIndex);
561  $data = $bib_gui->bib_obj->getElement("BibItem");
562  $bibItemIndex = (count($data) - 1);
563  }
564  else
565  {
566  ilUtil::sendInfo($this->lng->txt("bibitem_choose_element"), true);
567  }
568  if ($a_target == "")
569  {
570  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
571  }
572 
573  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
574  }
575 
579  function addBibItem()
580  {
581  // questionable workaround to make this old stuff work
582  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
583 
584  //$this->setTabs();
585  $this->addBibItemObject($this->ctrl->getLinkTarget($this));
586  }
587 
593  function frameset()
594  {
595  global $ilCtrl;
596 
597  $ilCtrl->setCmdClass("ilfilesystemgui");
598  $ilCtrl->setCmd("listFiles");
599  return $this->executeCommand();
600 
601 /* $this->tpl = new ilTemplate("tpl.fblm_edit_frameset.html", false, false,
602  "Modules/HTMLLearningModule");
603  $this->tpl->setVariable("HREF_FILES",$this->ctrl->getLinkTargetByClass(
604  "ilfilesystemgui", "listFiles"));
605  $this->tpl->show();
606  exit;*/
607  }
608 
612  function explorer()
613  {
614  $this->tpl = new ilTemplate("tpl.main.html", true, true);
615 
616  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
617 
618  $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
619 
620  require_once ("./Modules/HTMLLearningModule/classes/class.ilFileExplorer.php");
621  $exp = new ilFileExplorer($this->lm->getDataDirectory());
622 
623  }
624 
628  function getTemplate()
629  {
630  global $lng;
631 
632  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
633  //$this->tpl->setVariable("HEADER", $a_header_title);
634  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
635  //$this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
636  }
637 
639  {
640  // Note license usage
641  include_once "Services/License/classes/class.ilLicense.php";
642  ilLicense::_noteAccess($this->object->getId(), $this->object->getType(),
643  $this->object->getRefId());
644 
645  // Track access
646  include_once "Services/Tracking/classes/class.ilTracking.php";
647  ilTracking::_trackAccess($this->object->getId(),$this->object->getRefId(),'htlm');
648 
649  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
650  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
651  if ($startfile != "")
652  {
653  ilUtil::redirect($startfile);
654  }
655  }
656 
657  // InfoScreen methods
663  function infoScreen()
664  {
665  $this->ctrl->setCmd("showSummary");
666  $this->ctrl->setCmdClass("ilinfoscreengui");
667  $this->outputInfoScreen();
668  }
669 
673  function showInfoScreen()
674  {
675  $this->outputInfoScreen(true);
676  }
677 
681  function outputInfoScreen($a_standard_locator = true)
682  {
683  global $ilBench, $ilLocator, $ilAccess, $ilTabs;
684 
685  $ilTabs->activateTab('id_info');
686 
687  $this->lng->loadLanguageModule("meta");
688  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
689 
690  $info = new ilInfoScreenGUI($this);
691  $info->enablePrivateNotes();
692  $info->enableLearningProgress();
693 
694  $info->enableNews();
695  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
696  {
697  $info->enableNewsEditing();
698 
699  $news_set = new ilSetting("news");
700  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
701  if ($enable_internal_rss)
702  {
703  $info->setBlockProperty("news", "settings", true);
704  }
705  }
706 
707  // add read / back button
708  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
709  {
710  $info->addButton($this->lng->txt("view"),
711  "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID(),
712  ' target="ilContObj'.$this->object->getId().'" ');
713  }
714 
715  // show standard meta data section
716  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
717 
718  // forward the command
719  $this->ctrl->forwardCommand($info);
720  }
721 
722 
723 
727  function setTabs()
728  {
729  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm_b.gif"));
730 
731  $this->getTabs();
732  $this->tpl->setTitle($this->object->getTitle());
733  }
734 
738  function getTabs()
739  {
740  global $ilUser, $ilAccess, $ilTabs, $lng;
741 
742  if($ilAccess->checkAccess('write', '', $this->ref_id))
743  {
744  $ilTabs->addTab("id_list_files",
745  $lng->txt("cont_list_files"),
746  $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
747 
748  $ilTabs->addTab("id_info",
749  $lng->txt("info_short"),
750  $this->ctrl->getLinkTargetByClass(array("ilobjfilebasedlmgui", "ilinfoscreengui"), "showSummary"));
751 
752  $ilTabs->addTab("id_settings",
753  $lng->txt("settings"),
754  $this->ctrl->getLinkTarget($this, "properties"));
755  }
756 
757  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
758  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
759  {
760  $ilTabs->addTab("id_learning_progress",
761  $lng->txt("learning_progress"),
762  $this->ctrl->getLinkTargetByClass(array('ilobjfilebasedlmgui','illearningprogressgui'), ''));
763  }
764 
765  include_once("Services/License/classes/class.ilLicenseAccess.php");
766  if ($ilAccess->checkAccess('edit_permission', '', $this->ref_id)
768  {
769  $ilTabs->addTab("id_license",
770  $lng->txt("license"),
771  $this->ctrl->getLinkTargetByClass('illicensegui', ''));
772  }
773 
774  if($ilAccess->checkAccess('write', '', $this->ref_id))
775  {
776  $ilTabs->addTab("id_meta_data",
777  $lng->txt("meta_data"),
778  $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''));
779 
780  $ilTabs->addTab("id_bib_data",
781  $lng->txt("bib_data"),
782  $this->ctrl->getLinkTarget($this, "editBibItem"));
783  }
784 
785 
786  // export
787  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
788  {
789  $ilTabs->addTab("export",
790  $lng->txt("export"),
791  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
792  }
793 
794  if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
795  {
796  $ilTabs->addTab("id_permissions",
797  $lng->txt("perm_settings"),
798  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"));
799  }
800 
801  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
802  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
803 
804  if ($startfile != "")
805  {
806  $ilTabs->addNonTabbedLink("presentation_view",
807  $this->lng->txt("glo_presentation_view"),
808  "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID(),
809  "_blank"
810  );
811  }
812 
813  }
814 
820  function _goto($a_target)
821  {
822  global $rbacsystem, $ilErr, $lng, $ilAccess;
823 
824  if ($ilAccess->checkAccess("visible", "", $a_target))
825  {
826  $_GET["ref_id"] = $a_target;
827  $_GET["cmd"] = "infoScreen";
828  include("repository.php");
829  exit;
830  }
831  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
832  {
833  $_GET["cmd"] = "frameset";
834  $_GET["target"] = "";
835  $_GET["ref_id"] = ROOT_FOLDER_ID;
836  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
838  include("repository.php");
839  exit;
840  }
841 
842  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
843  }
844 
845  function addLocatorItems()
846  {
847  global $ilLocator;
848 
849  if (is_object($this->object))
850  {
851  $ilLocator->addItem($this->object->getTitle(),
852  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "", $_GET["ref_id"]);
853  }
854  }
855 
856 
863  function importFileObject($parent_id = null)
864  {
865  try
866  {
867  return parent::importFileObject();
868  }
870  {
871  // since there is no manifest xml we assume that this is an HTML export file
872  $this->createFromDirectory($e->getTmpDir());
873  }
874  }
875 
882  function createFromDirectory($a_dir)
883  {
884  global $ilErr;
885 
886  if (!$this->checkPermissionBool("create", "", "htlm") || $a_dir == "")
887  {
888  $ilErr->raiseError($this->lng->txt("no_create_permission"));
889  }
890 
891  // create instance
892  $newObj = new ilObjFileBasedLM();
893  $filename = ilUtil::stripSlashes($_FILES["importfile"]["name"]);
894  $newObj->setTitle($filename);
895  $newObj->setDescription("");
896  $newObj->create();
897  $newObj->populateByDirectoy($a_dir, $filename);
898  $this->putObjectInTree($newObj);
899 
900  $this->afterSave($newObj);
901  }
902 
903 
904 
905 
909 
910 
914  function exportHTML()
915  {
916  $inst_id = IL_INST_ID;
917 
918  include_once("./Services/Export/classes/class.ilExport.php");
919 
920  ilExport::_createExportDirectory($this->object->getId(), "html",
921  $this->object->getType());
922  $export_dir = ilExport::_getExportDirectory($this->object->getId(), "html",
923  $this->object->getType());
924 
925  $subdir = $this->object->getType()."_".$this->object->getId();
926  $filename = $this->subdir.".zip";
927 
928  $target_dir = $export_dir."/".$subdir;
929 
930  ilUtil::delDir($target_dir);
931  ilUtil::makeDir($target_dir);
932 
933  $source_dir = $this->object->getDataDirectory();
934 
935  ilUtil::rCopy($source_dir, $target_dir);
936 
937  // zip it all
938  $date = time();
939  $zip_file = $export_dir."/".$date."__".IL_INST_ID."__".
940  $this->object->getType()."_".$this->object->getId().".zip";
941  ilUtil::zip($target_dir, $zip_file);
942 
943  ilUtil::delDir($target_dir);
944  }
945 
946 }
947 ?>