ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules 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->setUseUploadDirectory(true);
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 
119  $this->ctrl->forwardCommand($fs_gui);
120 
121  // try to set start file automatically
122  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
123  if (!ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId()))
124  {
125  $do_update = false;
126 
127  $pcommand = $fs_gui->getLastPerformedCommand();
128  if (is_array($pcommand))
129  {
130  $valid = array("index.htm", "index.html", "start.htm", "start.html");
131  if($pcommand["cmd"] == "create_file")
132  {
133  $file = strtolower(basename($pcommand["name"]));
134  if(in_array($file, $valid))
135  {
136  $this->object->setStartFile($pcommand["name"]);
137  $do_update = $pcommand["name"];
138  }
139  }
140  else if($pcommand["cmd"] == "unzip_file")
141  {
142  $zip_file = strtolower(basename($pcommand["name"]));
143  $suffix = strrpos($zip_file, ".");
144  if($suffix)
145  {
146  $zip_file = substr($zip_file, 0, $suffix);
147  }
148  foreach($pcommand["added"] as $file)
149  {
150  $chk_file = null;
151  if(stristr($file, ".htm"))
152  {
153  $chk_file = strtolower(basename($file));
154  $suffix = strrpos($chk_file, ".");
155  if($suffix)
156  {
157  $chk_file = substr($chk_file, 0, $suffix);
158  }
159  }
160  if(in_array(basename($file), $valid) ||
161  ($zip_file && $chk_file && $chk_file == $zip_file))
162  {
163  $this->object->setStartFile($file);
164  $do_update = $file;
165  break;
166  }
167  }
168  }
169  }
170 
171  if($do_update)
172  {
173  ilUtil::sendInfo(sprintf($this->lng->txt("cont_start_file_set_to"), $do_update), true);
174 
175  $this->object->update();
176  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
177  }
178  }
179  break;
180 
181  case "ilinfoscreengui":
182  $ret =& $this->outputInfoScreen();
183  break;
184 
185  case "illearningprogressgui":
186  $ilTabs->activateTab('id_learning_progress');
187  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
189  $this->object->getRefId(),
190  $_GET['user_id'] ? $_GET['user_id'] : $ilUser->getId());
191  $this->ctrl->forwardCommand($new_gui);
192  break;
193 
194  case 'ilpermissiongui':
195  $ilTabs->activateTab('id_permissions');
196  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
197  $perm_gui =& new ilPermissionGUI($this);
198  $ret =& $this->ctrl->forwardCommand($perm_gui);
199  break;
200 
201  case 'illicensegui':
202  $ilTabs->activateTab('id_license');
203  include_once("./Services/License/classes/class.ilLicenseGUI.php");
204  $license_gui =& new ilLicenseGUI($this);
205  $ret =& $this->ctrl->forwardCommand($license_gui);
206  break;
207 
208  case "ilexportgui":
209  $ilTabs->activateTab("export");
210  include_once("./Services/Export/classes/class.ilExportGUI.php");
211  $exp_gui = new ilExportGUI($this);
212  $exp_gui->addFormat("xml");
213  $exp_gui->addFormat("html", "", $this, "exportHTML");
214  $ret = $this->ctrl->forwardCommand($exp_gui);
215 // $this->tpl->show();
216  break;
217 
218  case "ilcommonactiondispatchergui":
219  include_once("Services/Object/classes/class.ilCommonActionDispatcherGUI.php");
221  $this->ctrl->forwardCommand($gui);
222  break;
223 
224  default:
225  $cmd = $this->ctrl->getCmd("frameset");
226  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
227  $this->getCreationMode() == true)
228  {
229  $cmd.= "Object";
230  }
231  $ret =& $this->$cmd();
232  break;
233  }
234 
235  $this->addHeaderAction();
236  }
237 
238  protected function initCreationForms($a_new_type)
239  {
240  $forms = array(self::CFORM_NEW => $this->initCreateForm($a_new_type),
241  self::CFORM_IMPORT => $this->initImportForm($a_new_type));
242 
243  return $forms;
244  }
245 
251  final function cancelCreationObject($in_rep = false)
252  {
253  global $ilCtrl;
254 
255  $ilCtrl->redirectByClass("ilrepositorygui", "frameset");
256  }
257 
263  function properties()
264  {
265  global $rbacsystem, $tree, $tpl, $ilTabs;
266 
267  $ilTabs->activateTab("id_settings");
268 
269  $this->initSettingsForm();
270  $this->getSettingsFormValues();
271  $tpl->setContent($this->form->getHTML());
272  }
273 
277  public function initSettingsForm()
278  {
279  global $lng, $ilCtrl, $ilAccess;
280 
281  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
282  $this->form = new ilPropertyFormGUI();
283 
284  // title
285  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
286  $ti->setSize(min(40, ilObject::TITLE_LENGTH));
287  $ti->setMaxLength(ilObject::TITLE_LENGTH);
288  $ti->setRequired(true);
289  $this->form->addItem($ti);
290 
291  // description
292  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
293  $ta->setCols(40);
294  $ta->setRows(2);
295  $this->form->addItem($ta);
296 
297  // online
298  $cb = new ilCheckboxInputGUI($lng->txt("cont_online"), "cobj_online");
299  $cb->setOptionTitle($lng->txt(""));
300  $cb->setValue("y");
301  $this->form->addItem($cb);
302 
303  // startfile
304  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
305  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
306 
307  $ne = new ilNonEditableValueGUI($lng->txt("cont_startfile"), "");
308  if ($startfile != "")
309  {
310  $ne->setValue(basename($startfile));
311  }
312  else
313  {
314  $ne->setValue(basename($this->lng->txt("no_start_file")));
315  }
316  $this->form->addItem($ne);
317 
318  include_once("Services/License/classes/class.ilLicenseAccess.php");
320  {
321  $lic = new ilCheckboxInputGUI($lng->txt("cont_license"), "lic");
322  $lic->setInfo($lng->txt("cont_license_info"));
323  $this->form->addItem($lic);
324 
325  if(!$ilAccess->checkAccess('edit_permission', '', $this->ref_id))
326  {
327  $lic->setDisabled(true);
328  }
329  }
330 
331  $bib = new ilCheckboxInputGUI($lng->txt("cont_biblio"), "bib");
332  $bib->setInfo($lng->txt("cont_biblio_info"));
333  $this->form->addItem($bib);
334 
335  $this->form->addCommandButton("saveProperties", $lng->txt("save"));
336  $this->form->addCommandButton("toFilesystem", $lng->txt("cont_set_start_file"));
337 
338  $this->form->setTitle($lng->txt("cont_lm_properties"));
339  $this->form->setFormAction($ilCtrl->getFormAction($this, "saveProperties"));
340  }
341 
345  public function getSettingsFormValues()
346  {
347  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
348  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
349 
350  $values = array();
351  $values["cobj_online"] = $this->object->getOnline();
352  if ($startfile != "")
353  {
354  $startfile = basename($startfile);
355  }
356  else
357  {
358  $startfile = $this->lng->txt("no_start_file");
359  }
360 
361  $values["cobj_online"] = $this->object->getOnline();
362  $values["startfile"] = $startfile;
363  $values["title"] = $this->object->getTitle();
364  $values["desc"] = $this->object->getDescription();
365  $values["lic"] = $this->object->getShowLicense();
366  $values["bib"] = $this->object->getShowBibliographicalData();
367 
368  $this->form->setValuesByArray($values);
369  }
370 
377  function toFilesystem()
378  {
379  global $ilCtrl;
380 
381  $ilCtrl->redirectByClass("ilfilesystemgui", "listFiles");
382  }
383 
387  public function saveProperties()
388  {
389  global $tpl, $ilAccess, $ilTabs;
390 
391  $this->initSettingsForm("");
392  if ($this->form->checkInput())
393  {
394  $this->object->setTitle($this->form->getInput("title"));
395  $this->object->setDescription($this->form->getInput("desc"));
396  $this->object->setOnline(ilUtil::yn2tf($_POST["cobj_online"]));
397  $this->object->setShowBibliographicalData($this->form->getInput("bib"));
398 
399  $lic = $this->form->getItemByPostVar("lic");
400  if($lic && !$lic->getDisabled())
401  {
402  $this->object->setShowLicense($this->form->getInput("lic"));
403  }
404 
405  $this->object->update();
406  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
407  $this->ctrl->redirect($this, "properties");
408  }
409 
410  $ilTabs->activateTab("id_settings");
411  $this->form->setValuesByPost();
412  $tpl->setContent($this->form->getHtml());
413  }
414 
420  function editObject()
421  {
422  global $rbacsystem, $tree, $tpl;
423 
424  if (!$rbacsystem->checkAccess("visible,write",$this->object->getRefId()))
425  {
426  $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
427  }
428 
429  }
430 
434  function edit()
435  {
436  $this->prepareOutput();
437  $this->editObject();
438  }
439 
443  function cancel()
444  {
445  //$this->setReturnLocation("cancel","fblm_edit.php?cmd=listFiles&ref_id=".$_GET["ref_id"]);
446  $this->cancelObject();
447  }
448 
453  function afterSave($newObj)
454  {
455  if(!$newObj->getStartFile())
456  {
457  // try to set start file automatically
458  $files = array();
459  include_once "Services/Utilities/classes/class.ilFileUtils.php";
460  ilFileUtils::recursive_dirscan($newObj->getDataDirectory(), $files);
461  if(is_array($files["file"]))
462  {
463  $zip_file = null;
464  if(stristr($newObj->getTitle(), ".zip"))
465  {
466  $zip_file = strtolower($newObj->getTitle());
467  $suffix = strrpos($zip_file, ".");
468  if($suffix)
469  {
470  $zip_file = substr($zip_file, 0, $suffix);
471  }
472  }
473  $valid = array("index.htm", "index.html", "start.htm", "start.html");
474  foreach($files["file"] as $idx => $file)
475  {
476  $chk_file = null;
477  if(stristr($file, ".htm"))
478  {
479  $chk_file = strtolower($file);
480  $suffix = strrpos($chk_file, ".");
481  if($suffix)
482  {
483  $chk_file = substr($chk_file, 0, $suffix);
484  }
485  }
486  if(in_array($file, $valid) ||
487  ($chk_file && $zip_file && $chk_file == $zip_file))
488  {
489  $newObj->setStartFile(str_replace($newObj->getDataDirectory()."/", "", $files["path"][$idx]).$file);
490  $newObj->update();
491  break;
492  }
493  }
494  }
495  }
496 
497  // always send a message
498  ilUtil::sendSuccess($this->lng->txt("object_added"),true);
499  ilUtil::redirect("ilias.php?baseClass=ilHTLMEditorGUI&ref_id=".$newObj->getRefId());
500  }
501 
502 
506  function update()
507  {
508  //$this->setReturnLocation("update", "fblm_edit.php?cmd=listFiles&ref_id=".$_GET["ref_id"].
509  // "&obj_id=".$_GET["obj_id"]);
510  $this->updateObject();
511  }
512 
513 
514  function setStartFile($a_file)
515  {
516  $this->object->setStartFile($a_file);
517  $this->object->update();
518  $this->ctrl->redirectByClass("ilfilesystemgui", "listFiles");
519  }
520 
524  function perm()
525  {
526  $this->setFormAction("permSave", "fblm_edit.php?cmd=permSave&ref_id=".$_GET["ref_id"].
527  "&obj_id=".$_GET["obj_id"]);
528  $this->setFormAction("addRole", "fblm_edit.php?ref_id=".$_GET["ref_id"].
529  "&obj_id=".$_GET["obj_id"]."&cmd=addRole");
530  $this->permObject();
531  }
532 
536  function saveBibItemObject($a_target = "")
537  {
538  global $ilTabs;
539 
540  $ilTabs->activateTab("id_bib_data");
541 
542  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
543  $bib_gui =& new ilBibItemGUI();
544  $bib_gui->setObject($this->object);
545  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
546  $bibItemIndex *= 1;
547  if ($bibItemIndex < 0)
548  {
549  $bibItemIndex = 0;
550  }
551  $bibItemIndex = $bib_gui->save($bibItemIndex);
552 
553  if ($a_target == "")
554  {
555  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
556  }
557 
558  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
559  }
560 
564  function saveBibItem()
565  {
566  // questionable workaround to make this old stuff work
567  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
568 
569  //$this->setTabs();
570  $this->saveBibItemObject($this->ctrl->getLinkTarget($this));
571  }
572 
576  function editBibItemObject($a_target = "")
577  {
578  global $ilTabs;
579 
580  $ilTabs->activateTab("id_bib_data");
581 
582  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
583  $bib_gui =& new ilBibItemGUI();
584  $bib_gui->setObject($this->object);
585  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
586  $bibItemIndex *= 1;
587  if ($bibItemIndex < 0)
588  {
589  $bibItemIndex = 0;
590  }
591  if ($a_target == "")
592  {
593  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
594  }
595 
596  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
597  }
598 
602  function editBibItem()
603  {
604  // questionable workaround to make this old stuff work
605  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
606 
607  //$this->setTabs();
608  $this->editBibItemObject($this->ctrl->getLinkTarget($this));
609  }
610 
614  function deleteBibItemObject($a_target = "")
615  {
616  global $ilTabs;
617 
618  $ilTabs->activateTab("id_bib_data");
619 
620  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
621  $bib_gui =& new ilBibItemGUI();
622  $bib_gui->setObject($this->object);
623  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
624  $bib_gui->bib_obj->delete($_GET["bibItemName"], $_GET["bibItemPath"], $bibItemIndex);
625  if (strpos($bibItemIndex, ",") > 0)
626  {
627  $bibItemIndex = substr($bibItemIndex, 0, strpos($bibItemIndex, ","));
628  }
629  if ($a_target == "")
630  {
631  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
632  }
633 
634  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, max(0, $bibItemIndex - 1));
635  }
636 
640  function deleteBibItem()
641  {
642  // questionable workaround to make this old stuff work
643  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
644 
645  //$this->setTabs();
646  $this->deleteBibItemObject($this->ctrl->getLinkTarget($this));
647  }
648 
652  function addBibItemObject($a_target = "")
653  {
654  global $ilTabs;
655 
656  $ilTabs->activateTab("id_bib_data");
657 
658  $bibItemName = $_POST["bibItemName"] ? $_POST["bibItemName"] : $_GET["bibItemName"];
659  $bibItemIndex = $_POST["bibItemIndex"] ? $_POST["bibItemIndex"] : $_GET["bibItemIndex"];
660  if ($bibItemName == "BibItem")
661  {
662  include_once "./Modules/LearningModule/classes/class.ilBibItem.php";
663  $bib_item =& new ilBibItem();
664  $bib_item->setId($this->object->getId());
665  $bib_item->setType($this->object->getType());
666  $bib_item->read();
667  }
668 
669  include_once "./Modules/LearningModule/classes/class.ilBibItemGUI.php";
670  $bib_gui =& new ilBibItemGUI();
671  $bib_gui->setObject($this->object);
672  if ($bibItemIndex == "")
673  $bibItemIndex = 0;
674  $bibItemPath = $_POST["bibItemPath"] ? $_POST["bibItemPath"] : $_GET["bibItemPath"];
675 
676  //if ($bibItemName != "" && $bibItemName != "BibItem")
677  if ($bibItemName != "")
678  {
679  $bib_gui->bib_obj->add($bibItemName, $bibItemPath, $bibItemIndex);
680  $data = $bib_gui->bib_obj->getElement("BibItem");
681  $bibItemIndex = (count($data) - 1);
682  }
683  else
684  {
685  ilUtil::sendInfo($this->lng->txt("bibitem_choose_element"), true);
686  }
687  if ($a_target == "")
688  {
689  $a_target = "adm_object.php?ref_id=" . $this->object->getRefId();
690  }
691 
692  $bib_gui->edit("ADM_CONTENT", "adm_content", $a_target, $bibItemIndex);
693  }
694 
698  function addBibItem()
699  {
700  // questionable workaround to make this old stuff work
701  $this->ctrl->setParameter($this, ilCtrl::IL_RTOKEN_NAME, $this->ctrl->getRequestToken());
702 
703  //$this->setTabs();
704  $this->addBibItemObject($this->ctrl->getLinkTarget($this));
705  }
706 
710  function frameset()
711  {
712  global $ilCtrl;
713 
714  $ilCtrl->setCmdClass("ilfilesystemgui");
715  $ilCtrl->setCmd("listFiles");
716  return $this->executeCommand();
717  }
718 
722  function getTemplate()
723  {
724  global $lng;
725 
726  $this->tpl->getStandardTemplate();
727  }
728 
730  {
731  global $ilUser;
732 
733  // Note license usage
734  include_once "Services/License/classes/class.ilLicense.php";
735  ilLicense::_noteAccess($this->object->getId(), $this->object->getType(),
736  $this->object->getRefId());
737 
738  // #9483
739  if ($ilUser->getId() != ANONYMOUS_USER_ID)
740  {
741  include_once "Services/Tracking/classes/class.ilLearningProgress.php";
742  ilLearningProgress::_tracProgress($ilUser->getId(), $this->object->getId(),
743  $this->object->getRefId(), "htlm");
744  }
745 
746  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
747  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
748  if ($startfile != "")
749  {
750  ilUtil::redirect($startfile);
751  }
752  }
753 
754  // InfoScreen methods
760  function infoScreen()
761  {
762  $this->ctrl->setCmd("showSummary");
763  $this->ctrl->setCmdClass("ilinfoscreengui");
764  $this->outputInfoScreen();
765  }
766 
770  function showInfoScreen()
771  {
772  $this->outputInfoScreen(true);
773  }
774 
778  function outputInfoScreen($a_standard_locator = true)
779  {
780  global $ilToolbar, $ilAccess, $ilTabs;
781 
782  $ilTabs->activateTab('id_info');
783 
784  $this->lng->loadLanguageModule("meta");
785  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
786 
787  $info = new ilInfoScreenGUI($this);
788  $info->enablePrivateNotes();
789  $info->enableLearningProgress();
790 
791  $info->enableNews();
792  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
793  {
794  $info->enableNewsEditing();
795 
796  $news_set = new ilSetting("news");
797  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
798  if ($enable_internal_rss)
799  {
800  $info->setBlockProperty("news", "settings", true);
801  }
802  }
803 
804  // add read / back button
805  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
806  {
807  // #15127
808  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
809  $button = ilLinkButton::getInstance();
810  $button->setCaption("view");
811  $button->setPrimary(true);
812  $button->setUrl("ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID());
813  $button->setTarget("ilContObj".$this->object->getId());
814  $ilToolbar->addButtonInstance($button);
815  }
816 
817  // show standard meta data section
818  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
819 
820  // forward the command
821  $this->ctrl->forwardCommand($info);
822  }
823 
824 
825 
829  function setTabs()
830  {
831  $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_lm.svg"));
832 
833  $this->getTabs();
834  $this->tpl->setTitle($this->object->getTitle());
835  }
836 
840  function getTabs()
841  {
842  global $ilUser, $ilAccess, $ilTabs, $lng, $ilHelp;
843 
844  $ilHelp->setScreenIdComponent("htlm");
845 
846  if($ilAccess->checkAccess('write', '', $this->ref_id))
847  {
848  $ilTabs->addTab("id_list_files",
849  $lng->txt("cont_list_files"),
850  $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"));
851  }
852 
853  if($ilAccess->checkAccess('visible', '', $this->ref_id))
854  {
855  $ilTabs->addTab("id_info",
856  $lng->txt("info_short"),
857  $this->ctrl->getLinkTargetByClass(array("ilobjfilebasedlmgui", "ilinfoscreengui"), "showSummary"));
858  }
859 
860  if($ilAccess->checkAccess('write', '', $this->ref_id))
861  {
862  $ilTabs->addTab("id_settings",
863  $lng->txt("settings"),
864  $this->ctrl->getLinkTarget($this, "properties"));
865  }
866 
867  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
868  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
869  {
870  $ilTabs->addTab("id_learning_progress",
871  $lng->txt("learning_progress"),
872  $this->ctrl->getLinkTargetByClass(array('ilobjfilebasedlmgui','illearningprogressgui'), ''));
873  }
874 
875  include_once("Services/License/classes/class.ilLicenseAccess.php");
876  if ($ilAccess->checkAccess('edit_permission', '', $this->ref_id) &&
878  $this->object->getShowLicense())
879  {
880  $ilTabs->addTab("id_license",
881  $lng->txt("license"),
882  $this->ctrl->getLinkTargetByClass('illicensegui', ''));
883  }
884 
885  if($ilAccess->checkAccess('write', '', $this->ref_id))
886  {
887  $ilTabs->addTab("id_meta_data",
888  $lng->txt("meta_data"),
889  $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''));
890 
891  if($this->object->getShowBibliographicalData())
892  {
893  $ilTabs->addTab("id_bib_data",
894  $lng->txt("bib_data"),
895  $this->ctrl->getLinkTarget($this, "editBibItem"));
896  }
897  }
898 
899 
900  // export
901  if ($ilAccess->checkAccess("write", "", $this->object->getRefId()))
902  {
903  $ilTabs->addTab("export",
904  $lng->txt("export"),
905  $this->ctrl->getLinkTargetByClass("ilexportgui", ""));
906  }
907 
908  if ($ilAccess->checkAccess('edit_permission', '', $this->object->getRefId()))
909  {
910  $ilTabs->addTab("id_permissions",
911  $lng->txt("perm_settings"),
912  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"));
913  }
914 
915  require_once("./Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php");
916  $startfile = ilObjFileBasedLMAccess::_determineStartUrl($this->object->getId());
917 
918  if ($startfile != "")
919  {
920  $ilTabs->addNonTabbedLink("presentation_view",
921  $this->lng->txt("glo_presentation_view"),
922  "ilias.php?baseClass=ilHTLMPresentationGUI&ref_id=".$this->object->getRefID(),
923  "_blank"
924  );
925  }
926 
927  }
928 
934  public static function _goto($a_target)
935  {
936  global $rbacsystem, $ilErr, $lng, $ilAccess;
937 
938  if ($ilAccess->checkAccess("read", "", $a_target) ||
939  $ilAccess->checkAccess("visible", "", $a_target))
940  {
941  ilObjectGUI::_gotoRepositoryNode($a_target, "infoScreen");
942  }
943  else if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
944  {
945  ilUtil::sendFailure(sprintf($lng->txt("msg_no_perm_read_item"),
948  }
949 
950  $ilErr->raiseError($lng->txt("msg_no_perm_read_lm"), $ilErr->FATAL);
951  }
952 
953  function addLocatorItems()
954  {
955  global $ilLocator;
956 
957  if (is_object($this->object))
958  {
959  $ilLocator->addItem($this->object->getTitle(),
960  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "", $_GET["ref_id"]);
961  }
962  }
963 
964 
971  function importFileObject($parent_id = null)
972  {
973  try
974  {
975  return parent::importFileObject();
976  }
978  {
979  // since there is no manifest xml we assume that this is an HTML export file
980  $this->createFromDirectory($e->getTmpDir());
981  }
982  }
983 
990  function createFromDirectory($a_dir)
991  {
992  global $ilErr;
993 
994  if (!$this->checkPermissionBool("create", "", "htlm") || $a_dir == "")
995  {
996  $ilErr->raiseError($this->lng->txt("no_create_permission"));
997  }
998 
999  // create instance
1000  $newObj = new ilObjFileBasedLM();
1001  $filename = ilUtil::stripSlashes($_FILES["importfile"]["name"]);
1002  $newObj->setTitle($filename);
1003  $newObj->setDescription("");
1004  $newObj->create();
1005  $newObj->populateByDirectoy($a_dir, $filename);
1006  $this->putObjectInTree($newObj);
1007 
1008  $this->afterSave($newObj);
1009  }
1010 
1011 
1012 
1013 
1017 
1018 
1022  function exportHTML()
1023  {
1024  $inst_id = IL_INST_ID;
1025 
1026  include_once("./Services/Export/classes/class.ilExport.php");
1027 
1028  ilExport::_createExportDirectory($this->object->getId(), "html",
1029  $this->object->getType());
1030  $export_dir = ilExport::_getExportDirectory($this->object->getId(), "html",
1031  $this->object->getType());
1032 
1033  $subdir = $this->object->getType()."_".$this->object->getId();
1034  $filename = $this->subdir.".zip";
1035 
1036  $target_dir = $export_dir."/".$subdir;
1037 
1038  ilUtil::delDir($target_dir);
1039  ilUtil::makeDir($target_dir);
1040 
1041  $source_dir = $this->object->getDataDirectory();
1042 
1043  ilUtil::rCopy($source_dir, $target_dir);
1044 
1045  // zip it all
1046  $date = time();
1047  $zip_file = $export_dir."/".$date."__".IL_INST_ID."__".
1048  $this->object->getType()."_".$this->object->getId().".zip";
1049  ilUtil::zip($target_dir, $zip_file);
1050 
1051  ilUtil::delDir($target_dir);
1052  }
1053 
1054 }
1055 ?>
importFileObject($parent_id=null)
Import file.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
afterSave($newObj)
save object public
outputInfoScreen($a_standard_locator=true)
info screen
ILIAS Setting Class.
print $file
getTemplate()
output main header (title and locator)
Class ilInfoScreenGUI.
$_POST['username']
Definition: cron.php:12
exportHTML()
create html package
activateLabels($a_act, $a_label_header)
activate file labels
This class represents a property form user interface.
static rCopy($a_sdir, $a_tdir, $preserveTimeAttributes=false)
Copies content of a directory $a_sdir recursively to a directory $a_tdir.
const TITLE_LENGTH
max length of object title
$_GET["client_id"]
Class ilBibItem.
cancelCreationObject($in_rep=false)
cancel action and go back to previous page public
_determineStartUrl($a_id)
check wether learning module is online
addBibItem()
add bib item (module call)
static _isEnabled()
Check, if licencing is enabled This check is called from the ilAccessHandler class.
$valid
edit()
edit properties of object (module form)
File Based Learning Module (HTML) object.
Class ilShopPurchaseGUI.
$cmd
Definition: sahs_server.php:35
static _requiresPurchaseToAccess($a_ref_id, $a_purchasetype='')
this function should be used by all buyable repository objects !!
addObserver(&$a_class, $a_method, $a_element)
_createExportDirectory($a_obj_id, $a_export_type="xml", $a_obj_type="")
Create export directory.
static _gotoRepositoryRoot($a_raise_error=false)
Goto repository root.
getSettingsFormValues()
Get current values for settings from.
setFormAction($a_cmd, $a_formaction)
set specific form action for command
static _tracProgress($a_user_id, $a_obj_id, $a_ref_id, $a_obj_type='')
This class represents a checkbox property in a property form.
cancelObject($in_rep=false)
cancel action and go back to previous page public
static _lookupTitle($a_id)
lookup object title
editObject()
edit properties of object (admin form)
saveProperties()
Save properties form.
executeCommand()
execute command
initSettingsForm()
Init settings form.
static _goto($a_target)
redirect script
deleteBibItemObject($a_target="")
delete bib item (admin call)
showInfoScreen()
info screen call from inside learning module
infoScreen()
this one is called from the info button in the repository not very nice to set cmdClass/Cmd manually...
global $ilCtrl
Definition: ilias.php:18
const IL_RTOKEN_NAME
saveBibItem()
save bib item (module call)
setInfo($a_info)
Set Information Text.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
Export User Interface Class.
static checkAccess($a_ref_id, $a_allow_only_read=true)
check access to learning progress
initImportForm($a_new_type)
Init object import form.
ilObjFileBasedLMGUI($a_data, $a_id=0, $a_call_by_reference=true, $a_prepare_output=true)
Constructor.
static _gotoRepositoryNode($a_ref_id, $a_cmd="frameset")
Goto repository root.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
Class ilObjectGUI Basic methods of all Output classes.
static _lookupObjId($a_id)
setSize($a_size)
Set Size.
This class represents a text property in a property form.
Class ilBibItemGUI.
redirection script todo: (a better solution should control the processing via a xml file) ...
frameset()
Frameset -> Output list of files.
initCreateForm($a_new_type)
Init object creation form.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
manifest.xml file not found-exception for import
static zip($a_dir, $a_file, $compress_content=false)
zips given directory/file into given zip.file
prepareOutput()
prepare output
deleteBibItem()
delete bib item (module call)
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$filename
Definition: buildRTE.php:89
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
editBibItemObject($a_target="")
edit bib items (admin call)
addBibItemObject($a_target="")
add bib item (admin call)
createFromDirectory($a_dir)
Create new object from a html zip file.
saveBibItemObject($a_target="")
save bib item (admin call)
This class represents a non editable value in a property form.
global $ilUser
Definition: imgupload.php:15
recursive_dirscan($dir, &$arr)
Recursively scans a given directory and writes path and filename into referenced array.
This class represents a text area property in a property form.
properties()
edit properties of object (admin form)
getCreationMode()
get creation mode
User Interface class for file based learning modules (HTML)
updateObject()
updates object entry in object_data
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
putObjectInTree(ilObject $a_obj, $a_parent_node_id=null)
Add object to tree at given position.
checkPermission($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission and redirect on error.
getTabs()
adds tabs to tab gui object
New PermissionGUI (extends from old ilPermission2GUI) RBAC related output.
_noteAccess($a_obj_id, $a_type, $a_ref_id)
Note the access of the current usr to an object.
File System Explorer GUI class.
static yn2tf($a_yn)
convert "y"/"n" to true/false
setOptionTitle($a_optiontitle)
Set Option Title (optional).
static redirect($a_script)
http redirect to other script
addHeaderAction()
Add header action menu.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
checkPermissionBool($a_perm, $a_cmd="", $a_type="", $a_ref_id=null)
Check permission.
Class ilObjUserTrackingGUI.
static getInstanceFromAjaxCall()
(Re-)Build instance from ajax call
editBibItem()
edit bib items (module call)
setLocator()
set Locator