ILIAS  eassessment Revision 61809
 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::_isBuyable($_GET['ref_id']) &&
82  {
83  $this->tpl->getStandardTemplate();
84 
85  include_once 'Services/Payment/classes/class.ilShopPurchaseGUI.php';
86  $pp = new ilShopPurchaseGUI((int)$_GET['ref_id']);
87  $ret = $this->ctrl->forwardCommand($pp);
88  return true;
89  }
90  }
91  }
92 
93  switch($next_class)
94  {
95  case 'ilmdeditorgui':
96  $this->checkPermission("write");
97  $ilTabs->activateTab('id_meta_data');
98  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
99 
100  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
101  $md_gui->addObserver($this->object,'MDUpdateListener','General');
102 
103  $this->ctrl->forwardCommand($md_gui);
104  break;
105 
106  case "ilfilesystemgui":
107  $this->checkPermission("write");
108  $ilTabs->activateTab('id_list_files');
109  $fs_gui =& new ilFileSystemGUI($this->object->getDataDirectory());
110  $fs_gui->activateLabels(true, $this->lng->txt("cont_purpose"));
111  $fs_gui->setTableId("htlmfs".$this->object->getId());
112  if ($this->object->getStartFile() != "")
113  {
114  $fs_gui->labelFile($this->object->getStartFile(),
115  $this->lng->txt("cont_startfile"));
116  }
117  $fs_gui->addCommand($this, "setStartFile", $this->lng->txt("cont_set_start_file"));
118  $ret =& $this->ctrl->forwardCommand($fs_gui);
119  break;
120 
121  case "ilinfoscreengui":
122  $ret =& $this->outputInfoScreen();
123  break;
124 
125  case "illearningprogressgui":
126  $ilTabs->activateTab('id_learning_progress');
127  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
129  $this->object->getRefId(),
130  $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
131  $this->ctrl->forwardCommand($new_gui);
132  break;
133 
134  case 'ilpermissiongui':
135  $ilTabs->activateTab('id_permissions');
136  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
137  $perm_gui =& new ilPermissionGUI($this);
138  $ret =& $this->ctrl->forwardCommand($perm_gui);
139  break;
140 
141  case 'illicensegui':
142  $ilTabs->activateTab('id_license');
143  include_once("./Services/License/classes/class.ilLicenseGUI.php");
144  $license_gui =& new ilLicenseGUI($this);
145  $ret =& $this->ctrl->forwardCommand($license_gui);
146  break;
147 
148  case "ilexportgui":
149  $ilTabs->activateTab("export");
150  include_once("./Services/Export/classes/class.ilExportGUI.php");
151  $exp_gui = new ilExportGUI($this);
152  $exp_gui->addFormat("xml");
153  $exp_gui->addFormat("html", "", $this, "exportHTML");
154  $ret = $this->ctrl->forwardCommand($exp_gui);
155 // $this->tpl->show();
156  break;
157 
158 
159  default:
160  $cmd = $this->ctrl->getCmd("frameset");
161  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
162  $this->getCreationMode() == true)
163  {
164  $cmd.= "Object";
165  }
166  $ret =& $this->$cmd();
167  break;
168  }
169  }
170 
176  function createObject()
177  {
178  global $rbacsystem, $tpl;
179 
180  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
181 
182  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
183  {
184  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
185  }
186  else
187  {
188  $this->ctrl->setParameter($this, "new_type", $new_type);
189  $this->initEditForm("create", $new_type);
190  $html = $this->form->getHTML();
191 
192  $this->initImportForm("htlm");
193  $html2 = $this->form->getHTML();
194 
195  $tpl->setContent($html."<br/>".$html2.$clone_html);
196  }
197  }
198 
204  public function initImportForm($a_new_type = "")
205  {
206  global $lng, $ilCtrl;
207 
208  $lng->loadLanguageModule("content");
209 
210  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
211  $this->form = new ilPropertyFormGUI();
212  $this->form->setTarget("_top");
213 
214  // Import file
215  include_once("./Services/Form/classes/class.ilFileInputGUI.php");
216  $fi = new ilFileInputGUI($lng->txt("import_file"), "importfile");
217  $fi->setSuffixes(array("zip"));
218  $fi->setRequired(true);
219  $this->form->addItem($fi);
220 
221  $this->form->addCommandButton("importFile", $lng->txt("import"));
222  $this->form->addCommandButton("cancel", $lng->txt("cancel"));
223  $this->form->setTitle($lng->txt($a_new_type."_import"));
224 
225  $this->form->setFormAction($ilCtrl->getFormAction($this));
226  }
227 
233  function importFileObject()
234  {
235  global $rbacsystem, $objDefinition, $tpl, $lng;
236 
237  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
238 
239  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
240  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
241  {
242  $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
243  }
244  $this->ctrl->setParameter($this, "new_type", $new_type);
245  $this->initImportForm($new_type);
246  if ($this->form->checkInput())
247  {
248  // todo: make some check on manifest file
249  include_once("./Services/Export/classes/class.ilImport.php");
250  $imp = new ilImport((int) $_GET['ref_id']);
251  $new_id = $imp->importObject($newObj, $_FILES["importfile"]["tmp_name"],
252  $_FILES["importfile"]["name"], $new_type);
253 
254  // put new object id into tree
255  if ($new_id > 0)
256  {
257  $newObj = ilObjectFactory::getInstanceByObjId($new_id);
258  $newObj->createReference();
259  $newObj->putInTree($_GET["ref_id"]);
260  $newObj->setPermissions($_GET["ref_id"]);
261  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
262  $this->afterSave($newObj);
263  }
264  return;
265  }
266 
267  $this->form->setValuesByPost();
268  $tpl->setContent($this->form->getHtml());
269  }
270 
276  function saveObject()
277  {
278  global $rbacsystem, $objDefinition, $tpl, $lng;
279 
280  $new_type = $_POST["new_type"] ? $_POST["new_type"] : $_GET["new_type"];
281 
282  // create permission is already checked in createObject. This check here is done to prevent hacking attempts
283  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], $new_type))
284  {
285  $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->MESSAGE);
286  }
287  $this->ctrl->setParameter($this, "new_type", $new_type);
288  $this->initEditForm("create", $new_type);
289  if ($this->form->checkInput())
290  {
291 
292  $location = $objDefinition->getLocation($new_type);
293 
294  // create and insert object in objecttree
295  $class_name = "ilObj".$objDefinition->getClassName($new_type);
296  include_once($location."/class.".$class_name.".php");
297  $newObj = new $class_name();
298  $newObj->setType($new_type);
299  $newObj->setTitle(ilUtil::stripSlashes($_POST["title"]));
300  $newObj->setDescription(ilUtil::stripSlashes($_POST["desc"]));
301  $newObj->create();
302  $newObj->createReference();
303  $newObj->putInTree($_GET["ref_id"]);
304  $newObj->setPermissions($_GET["ref_id"]);
305  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
306  $this->afterSave($newObj);
307  return;
308  }
309 
310  $this->form->setValuesByPost();
311  $tpl->setContent($this->form->getHtml());
312  }
313 
319  public function initEditForm($a_mode = "edit", $a_new_type = "")
320  {
321  global $lng, $ilCtrl;
322 
323  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
324  $this->form = new ilPropertyFormGUI();
325  $this->form->setTarget("_top");
326 
327  // title
328  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
329  $ti->setMaxLength(128);
330  $ti->setSize(40);
331  $ti->setRequired(true);
332  $this->form->addItem($ti);
333 
334  // description
335  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
336  $ta->setCols(40);
337  $ta->setRows(2);
338  $this->form->addItem($ta);
339 
340  // save and cancel commands
341  if ($a_mode == "create")
342  {
343  $this->form->addCommandButton("save", $lng->txt($a_new_type."_add"));
344  $this->form->addCommandButton("cancelCreation", $lng->txt("cancel"));
345  $this->form->setTitle($lng->txt($a_new_type."_new"));
346  }
347  else
348  {
349  $this->form->addCommandButton("update", $lng->txt("save"));
350  $this->form->addCommandButton("cancelUpdate", $lng->txt("cancel"));
351  $this->form->setTitle($lng->txt("edit"));
352  }
353 
354  $this->form->setFormAction($ilCtrl->getFormAction($this));
355 
356  }
357 
361  function getEditFormValues()
362  {
363  $values["title"] = $this->object->getTitle();
364  $values["desc"] = $this->object->getDescription();
365  $this->form->setValuesByArray($values);
366  }
367 
373  final function cancelCreationObject($in_rep = false)
374  {
375  ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
376  }
377 
383  function properties()
384  {
385  global $rbacsystem, $tree, $tpl, $ilTabs;
386 
387  $ilTabs->activateTab("id_settings");
388 
389  $this->initSettingsForm();
390  $this->getSettingsFormValues();
391  $tpl->setContent($this->form->getHTML());
392 
393  }
394 
398  public function initSettingsForm()
399  {
400  global $lng, $ilCtrl;
401 
402  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
403  $this->form = new ilPropertyFormGUI();
404 
405  // online
406  $cb = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
407  $cb->setOptionTitle($lng->txt(""));
408  $cb->setValue("y");
409  $this->form->addItem($cb);
410 
411  // startfile
412  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
413  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
414 
415  $ne = new ilNonEditableValueGUI($lng->txt("cont_startfile"), "");
416  if ($startfile != "")
417  {
418  $ne->setValue(basename($startfile));
419  }
420  else
421  {
422  $ne->setValue(basename($this->lng->txt("no_start_file")));
423  }
424 
425  $this->form->addItem($ne);
426 
427  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
428  $this->form->addCommandButton("toFilesystem", $lng->txt("cont_set_start_file"));
429 
430  $this->form->setTitle($lng->txt("cont_lm_properties"));
431  $this->form->setFormAction($ilCtrl->getFormAction($this, "saveProperties"));
432  }
433 
437  public function getSettingsFormValues()
438  {
439  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
440  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
441 
442  $values = array();
443  $values["cobj_online"] = $this->object->getOnline();
444  if ($startfile != "")
445  {
446  $startfile = basename($startfile);
447  }
448  else
449  {
450  $startfile = $this->lng->txt("no_start_file");
451  }
452 
453  $values["cobj_online"] = $this->object->getOnline();
454  $values["startfile"] = $startfile;
455 
456  $this->form->setValuesByArray($values);
457  }
458 
465  function toFilesystem()
466  {
467  global $ilCtrl;
468 
469  $ilCtrl->redirectByClass("ilfilesystemgui", "listFiles");
470  }
471 
475  public function saveProperties()
476  {
477  global $tpl, $lng, $ilCtrl;
478 
479  $this->initSettingsForm("");
480  if ($this->form->checkInput())
481  {
482  $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
483  $this->object->update();
484  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
485  $this->ctrl->redirect($this, "properties");
486  }
487 
488  $this->form->setValuesByPost();
489  $tpl->setContent($this->form->getHtml());
490  }
491 
497  function editObject()
498  {
499  global $rbacsystem, $tree, $tpl;
500 
501  if (!$rbacsystem->checkAccess("visible,write",$this->object->getRefId()))
502  {
503  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
504  }
505 
506  // edit button
507  $this->tpl->addBlockfile("BUTTONS", "buttons", "tpl.buttons.html");
508 
509  }
510 
514  function edit()
515  {
516  $this->prepareOutput();
517  $this->editObject();
518  }
519 
523  function cancel()
524  {
525  //$this->setReturnLocation("cancel","fblm_edit.php?cmd=listFiles&ref_id=".$_GET["ref_id"]);
526  $this->cancelObject();
527  }
528 
533  function afterSave($newObj)
534  {
535  // always send a message
536  ilUtil::sendSuccess($this->lng->txt("object_added"),true);
537 
538  ilUtil::redirect("ilias.php?baseClass=ilHTLMEditorGUI&ref_id=".$newObj->getRefId());
539  }
540 
546  function cancelObject($in_rep = false)
547  {
548  ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
549  //$this->ctrl->redirectByClass("ilrepositorygui", "frameset");
550  }
551 
552 
556  function update()
557  {
558  //$this->setReturnLocation("update", "fblm_edit.php?cmd=listFiles&ref_id=".$_GET["ref_id"].
559  // "&obj_id=".$_GET["obj_id"]);
560  $this->updateObject();
561  }
562 
563 
564  function setStartFile($a_file)
565  {
566  $this->object->setStartFile($a_file);
567  $this->object->update();
568  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
569  }
570 
574  function perm()
575  {
576  $this->setFormAction("permSave", "fblm_edit.php?cmd=permSave&ref_id=".$_GET["ref_id"].
577  "&obj_id=".$_GET["obj_id"]);
578  $this->setFormAction("addRole", "fblm_edit.php?ref_id=".$_GET["ref_id"].
579  "&obj_id=".$_GET["obj_id"]."&cmd=addRole");
580  $this->permObject();
581  }
582 
586  function saveBibItemObject($a_target = "")
587  {
588  global $ilTabs;
589 
590  $ilTabs->activateTab("id_bib_data");
591 
592  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
593  $bib_gui =& new ilBibItemGUI();
594  $bib_gui->setObject($this->object);
595  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
596  $bibItemIndex *= 1;
597  if ($bibItemIndex < 0)
598  {
599  $bibItemIndex = 0;
600  }
601  $bibItemIndex = $bib_gui->save($bibItemIndex);
602 
603  if ($a_target == "")
604  {
605  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
606  }
607 
608  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
609  }
610 
614  function saveBibItem()
615  {
616  // questionable workaround to make this old stuff work
617  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
618 
619  //$this->setTabs();
620  $this->saveBibItemObject($this->ctrl->getLinkTarget($this));
621  }
622 
626  function editBibItemObject($a_target = "")
627  {
628  global $ilTabs;
629 
630  $ilTabs->activateTab("id_bib_data");
631 
632  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
633  $bib_gui =& new ilBibItemGUI();
634  $bib_gui->setObject($this->object);
635  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
636  $bibItemIndex *= 1;
637  if ($bibItemIndex < 0)
638  {
639  $bibItemIndex = 0;
640  }
641  if ($a_target == "")
642  {
643  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
644  }
645 
646  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
647  }
648 
652  function editBibItem()
653  {
654  // questionable workaround to make this old stuff work
655  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
656 
657  //$this->setTabs();
658  $this->editBibItemObject($this->ctrl->getLinkTarget($this));
659  }
660 
664  function deleteBibItemObject($a_target = "")
665  {
666  global $ilTabs;
667 
668  $ilTabs->activateTab("id_bib_data");
669 
670  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
671  $bib_gui =& new ilBibItemGUI();
672  $bib_gui->setObject($this->object);
673  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
674  $bib_gui->bib_obj->delete($_GET["bibItemName"], $_GET["bibItemPath"], $bibItemIndex);
675  if (strpos($bibItemIndex, ",") > 0)
676  {
677  $bibItemIndex = substr($bibItemIndex, 0, strpos($bibItemIndex, ","));
678  }
679  if ($a_target == "")
680  {
681  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
682  }
683 
684  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
685  }
686 
690  function deleteBibItem()
691  {
692  // questionable workaround to make this old stuff work
693  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
694 
695  //$this->setTabs();
696  $this->deleteBibItemObject($this->ctrl->getLinkTarget($this));
697  }
698 
702  function addBibItemObject($a_target = "")
703  {
704  global $ilTabs;
705 
706  $ilTabs->activateTab("id_bib_data");
707 
708  $bibItemName = $_POST["bibItemName"] ? $_POST["bibItemName"] : $_GET["bibItemName"];
709  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
710  if ($bibItemName == "BibItem")
711  {
712  include_once "./Modules/LearningModule/classes/class.ilBibItem.php";
713  $bib_item =& new ilBibItem();
714  $bib_item->setId($this->object->getId());
715  $bib_item->setType($this->object->getType());
716  $bib_item->read();
717  }
718 
719  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
720  $bib_gui =& new ilBibItemGUI();
721  $bib_gui->setObject($this->object);
722  if ($bibItemIndex == "")
723  $bibItemIndex = 0;
724  $bibItemPath = $_POST["bibItemPath"] ? $_POST["bibItemPath"] : $_GET["bibItemPath"];
725 
726  //if ($bibItemName != "" && $bibItemName != "BibItem")
727  if ($bibItemName != "")
728  {
729  $bib_gui->bib_obj->add($bibItemName, $bibItemPath, $bibItemIndex);
730  $data = $bib_gui->bib_obj->getElement("BibItem");
731  $bibItemIndex = (count($data) - 1);
732  }
733  else
734  {
735  ilUtil::sendInfo($this->lng->txt("bibitem_choose_element"), true);
736  }
737  if ($a_target == "")
738  {
739  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
740  }
741 
742  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
743  }
744 
748  function addBibItem()
749  {
750  // questionable workaround to make this old stuff work
751  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
752 
753  //$this->setTabs();
754  $this->addBibItemObject($this->ctrl->getLinkTarget($this));
755  }
756 
762  function frameset()
763  {
764  global $ilCtrl;
765 
766  $ilCtrl->setCmdClass("ilfilesystemgui");
767  $ilCtrl->setCmd("listFiles");
768  return $this->executeCommand();
769 
770 /* $this->tpl = new ilTemplate("tpl.fblm_edit_frameset.html", false, false,
771  "Modules/HTMLLearningModule");
772  $this->tpl->setVariable("HREF_FILES",$this->ctrl->getLinkTargetByClass(
773  "ilfilesystemgui", "listFiles"));
774  $this->tpl->show();
775  exit;*/
776  }
777 
781  function explorer()
782  {
783  $this->tpl = new ilTemplate("tpl.main.html", true, true);
784 
785  $this->tpl->setVariable("LOCATION_STYLESHEET", ilUtil::getStyleSheetLocation());
786 
787  $this->tpl->addBlockFile("CONTENT", "content", "tpl.explorer.html");
788 
789  require_once ("./Modules/HTMLLearningModule/classes/class.ilFileExplorer.php");
790  $exp = new ilFileExplorer($this->lm->getDataDirectory());
791 
792  }
793 
797  function getTemplate()
798  {
799  global $lng;
800 
801  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
802  //$this->tpl->setVariable("HEADER", $a_header_title);
803  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
804  //$this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
805  }
806 
808  {
809  // Note license usage
810  include_once "Services/License/classes/class.ilLicense.php";
811  ilLicense::_noteAccess($this->object->getId(), $this->object->getType(),
812  $this->object->getRefId());
813 
814  // Track access
815  include_once "Services/Tracking/classes/class.ilTracking.php";
816  ilTracking::_trackAccess($this->object->getId(),$this->object->getRefId(),'htlm');
817 
818  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
819  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
820  if ($startfile != "")
821  {
822  ilUtil::redirect($startfile);
823  }
824  }
825 
826  // InfoScreen methods
832  function infoScreen()
833  {
834  $this->ctrl->setCmd("showSummary");
835  $this->ctrl->setCmdClass("ilinfoscreengui");
836  $this->outputInfoScreen();
837  }
838 
842  function showInfoScreen()
843  {
844  $this->outputInfoScreen(true);
845  }
846 
850  function outputInfoScreen($a_standard_locator = true)
851  {
852  global $ilBench, $ilLocator, $ilAccess, $ilTabs;
853 
854  $ilTabs->activateTab('id_info');
855 
856  $this->lng->loadLanguageModule("meta");
857  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
858 
859  $info = new ilInfoScreenGUI($this);
860  $info->enablePrivateNotes();
861  $info->enableLearningProgress();
862 
863  $info->enableNews();
864  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
865  {
866  $info->enableNewsEditing();
867 
868  $news_set = new ilSetting("news");
869  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
870  if ($enable_internal_rss)
871  {
872  $info->setBlockProperty("news", "settings", true);
873  }
874  }
875 
876  // add read / back button
877  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
878  {
879  $info->addButton($this->lng->txt("view"),
880  "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID(),
881  ' target="ilContObj'.$this->object->getId().'" ');
882  }
883 
884  // show standard meta data section
885  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
886 
887  // forward the command
888  $this->ctrl->forwardCommand($info);
889  }
890 
891 
892 
896  function setTabs()
897  {
898  $this->tpl->setCurrentBlock("header_image");
899  $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_lm_b.gif"));
900  $this->tpl->parseCurrentBlock();
901 
902  $this->getTabs();
903  $this->tpl->setVariable("HEADER", $this->object->getTitle());
904  }
905 
909  function getTabs()
910  {
911  global $ilUser, $ilAccess, $ilTabs, $lng;
912 
913  if($ilAccess->checkAccess('write', '', $this->ref_id))
914  {
915  $ilTabs->addTab("id_list_files",
916  $lng->txt("cont_list_files"),
917  $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
918 
919  $ilTabs->addTab("id_info",
920  $lng->txt("info_short"),
921  $this->ctrl->getLinkTargetByClass(array("ilobjfilebasedlmgui", "ilinfoscreengui"), "showSummary"));
922 
923  $ilTabs->addTab("id_settings",
924  $lng->txt("settings"),
925  $this->ctrl->getLinkTarget($this, "properties"));
926  }
927 
928  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
929  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
930  {
931  $ilTabs->addTab("id_learning_progress",
932  $lng->txt("learning_progress"),
933  $this->ctrl->getLinkTargetByClass(array('ilobjfilebasedlmgui','illearningprogressgui'), ''));
934  }
935 
936  include_once("Services/License/classes/class.ilLicenseAccess.php");
937  if ($ilAccess->checkAccess('edit_permission', '', $this->ref_id)
939  {
940  $ilTabs->addTab("id_license",
941  $lng->txt("license"),
942  $this->ctrl->getLinkTargetByClass('illicensegui', ''));
943  }
944 
945  if($ilAccess->checkAccess('write', '', $this->ref_id))
946  {
947  $ilTabs->addTab("id_meta_data",
948  $lng->txt("meta_data"),
949  $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''));
950 
951  $ilTabs->addTab("id_bib_data",
952  $lng->txt("bib_data"),
953  $this->ctrl->getLinkTarget($this, "editBibItem"));
954  }
955 
956 
957  // export
958  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
959  {
960  $ilTabs->addTab("export",
961  $lng->txt("export"),
962  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
963  }
964 
965  if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
966  {
967  $ilTabs->addTab("id_permissions",
968  $lng->txt("perm_settings"),
969  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"));
970  }
971 
972  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
973  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
974 
975  if ($startfile != "")
976  {
977  $ilTabs->addNonTabbedLink("presentation_view",
978  $this->lng->txt("glo_presentation_view"),
979  "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID(),
980  "_blank"
981  );
982  }
983 
984  }
985 
991  function _goto($a_target)
992  {
993  global $rbacsystem, $ilErr, $lng, $ilAccess;
994 
995  if ($ilAccess->checkAccess("visible", "", $a_target))
996  {
997  $_GET["ref_id"] = $a_target;
998  $_GET["cmd"] = "infoScreen";
999  include("repository.php");
1000  exit;
1001  }
1002  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
1003  {
1004  $_GET["cmd"] = "frameset";
1005  $_GET["target"] = "";
1006  $_GET["ref_id"] = ROOT_FOLDER_ID;
1007  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
1008  ilObject::_lookupTitle(ilObject::_lookupObjId($a_target))), true);
1009  include("repository.php");
1010  exit;
1011  }
1012 
1013  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
1014  }
1015 
1016  function addLocatorItems()
1017  {
1018  global $ilLocator;
1019 
1020  if (is_object($this->object))
1021  {
1022  $ilLocator->addItem($this->object->getTitle(),
1023  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "", $_GET["ref_id"]);
1024  }
1025  }
1026 
1027 
1031 
1032 
1036  function exportHTML()
1037  {
1038  $inst_id = IL_INST_ID;
1039 
1040  include_once("./Services/Export/classes/class.ilExport.php");
1041  $export_dir = ilExport::_getExportDirectory($this->object->getId(), "html",
1042  $this->object->getType());
1043 
1044  $subdir = $this->object->getType()."_".$this->object->getId();
1045  $filename = $this->subdir.".zip";
1046 
1047  $target_dir = $export_dir."/".$subdir;
1048 
1049  ilUtil::delDir($target_dir);
1050  ilUtil::makeDir($target_dir);
1051 
1052  $source_dir = $this->object->getDataDirectory();
1053 
1054  ilUtil::rCopy($source_dir, $target_dir);
1055 
1056  // zip it all
1057  $date = time();
1058  $zip_file = $export_dir."/".$date."__".IL_INST_ID."__".
1059  $this->object->getType()."_".$this->object->getId().".zip";
1060  ilUtil::zip($target_dir, $zip_file);
1061 
1062  ilUtil::delDir($target_dir);
1063  }
1064 
1065 }
1066 ?>