ILIAS  eassessment Revision 61809
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilObjSAHSLearningModuleGUI.php
Go to the documentation of this file.
1 <?php
2 /*
3  +-----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +-----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +-----------------------------------------------------------------------------+
22 */
23 
24 require_once "classes/class.ilObjectGUI.php";
25 require_once("classes/class.ilFileSystemGUI.php");
26 require_once("classes/class.ilTabsGUI.php");
27 
40 {
46  function ilObjSAHSLearningModuleGUI($a_data,$a_id,$a_call_by_reference, $a_prepare_output = true)
47  {
48  global $lng;
49 
50  $lng->loadLanguageModule("content");
51  $this->type = "sahs";
52  $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference,false);
53  #$this->tabs_gui =& new ilTabsGUI();
54 
55  }
56 
60  function &executeCommand()
61  {
62  global $ilAccess, $ilTabs;
63 
64  if (strtolower($_GET["baseClass"]) == "iladministrationgui" ||
65  $this->getCreationMode() == true)
66  {
67  $this->prepareOutput();
68  }
69  else
70  {
71  $this->getTemplate();
72  $this->setLocator();
73  $this->setTabs();
74  }
75 
76  $next_class = $this->ctrl->getNextClass($this);
77  $cmd = $this->ctrl->getCmd();
78 
79  switch($next_class)
80  {
81  case 'ilmdeditorgui':
82 
83  include_once 'Services/MetaData/classes/class.ilMDEditorGUI.php';
84 
85  $md_gui =& new ilMDEditorGUI($this->object->getId(), 0, $this->object->getType());
86  $md_gui->addObserver($this->object,'MDUpdateListener','General');
87 
88  $this->ctrl->forwardCommand($md_gui);
89  break;
90 
91  case 'ilpermissiongui':
92  include_once("Services/AccessControl/classes/class.ilPermissionGUI.php");
93  $perm_gui =& new ilPermissionGUI($this);
94  $ret =& $this->ctrl->forwardCommand($perm_gui);
95  break;
96 
97  case "ilfilesystemgui":
98  $this->fs_gui =& new ilFileSystemGUI($this->object->getDataDirectory());
99  $this->fs_gui->setTableId("sahsfs".$this->object->getId());
100  $ret =& $this->ctrl->forwardCommand($this->fs_gui);
101  break;
102 
103  case "ilcertificategui":
104  include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
105  include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
106  $output_gui = new ilCertificateGUI(new ilSCORMCertificateAdapter($this->object));
107  $ret =& $this->ctrl->forwardCommand($output_gui);
108  break;
109 
110  case "illearningprogressgui":
111  include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
112 
113  $new_gui =& new ilLearningProgressGUI(LP_MODE_REPOSITORY,$this->object->getRefId());
114  $this->ctrl->forwardCommand($new_gui);
115 
116  break;
117 
118  case 'illicensegui':
119  include_once("./Services/License/classes/class.ilLicenseGUI.php");
120  $license_gui =& new ilLicenseGUI($this);
121  $ret =& $this->ctrl->forwardCommand($license_gui);
122  break;
123 
124  case "ilinfoscreengui":
125  include_once("./Services/InfoScreen/classes/class.ilInfoScreenGUI.php");
126 
127  $info = new ilInfoScreenGUI($this);
128  $info->enablePrivateNotes();
129  $info->enableLearningProgress();
130 
131  // add read / back button
132  if ($ilAccess->checkAccess("read", "", $_GET["ref_id"]))
133  {
134  if (!$this->object->getEditable())
135  {
136  $info->addButton($this->lng->txt("view"),
137  "ilias.php?baseClass=ilSAHSPresentationGUI&amp;ref_id=".$this->object->getRefID(),
138  ' target="ilContObj'.$this->object->getId().'" ');
139  }
140  }
141 
142  $info->enableNews();
143  if ($ilAccess->checkAccess("write", "", $_GET["ref_id"]))
144  {
145  $info->enableNewsEditing();
146  $news_set = new ilSetting("news");
147  $enable_internal_rss = $news_set->get("enable_rss_for_internal");
148  if ($enable_internal_rss)
149  {
150  $info->setBlockProperty("news", "settings", true);
151  }
152  }
153  // show standard meta data section
154  $info->addMetaDataSections($this->object->getId(),0, $this->object->getType());
155 
156  // forward the command
157  $this->ctrl->forwardCommand($info);
158  break;
159 
160  case "ilobjstylesheetgui":
161  //$this->addLocations();
162  $this->ctrl->setReturn($this, "editStyleProperties");
163  $ilTabs->clearTargets();
164  $style_gui =& new ilObjStyleSheetGUI("", $this->object->getStyleSheetId(), false, false);
165  $style_gui->omitLocator();
166  if ($cmd == "create" || $_GET["new_type"]=="sty")
167  {
168  $style_gui->setCreationMode(true);
169  }
170  //$ret =& $style_gui->executeCommand();
171 
172  if ($cmd == "confirmedDelete")
173  {
174  $this->object->setStyleSheetId(0);
175  $this->object->update();
176  }
177  $ret =& $this->ctrl->forwardCommand($style_gui);
178  if ($cmd == "save" || $cmd == "copyStyle" || $cmd == "importStyle")
179  {
180  $style_id = $ret;
181  $this->object->setStyleSheetId($style_id);
182  $this->object->update();
183  $this->ctrl->redirectByClass("ilobjstylesheetgui", "edit");
184  }
185  break;
186  default:
187  $cmd = $this->ctrl->getCmd("frameset");
188  if ((strtolower($_GET["baseClass"]) == "iladministrationgui" ||
189  $this->getCreationMode() == true) &&
190  $cmd != "frameset")
191  {
192  $cmd.= "Object";
193  }
194 
195  $ret =& $this->$cmd();
196  break;
197  }
198  }
199 
200 
201  function viewObject()
202  {
203  if (strtolower($_GET["baseClass"]) == "iladministrationgui")
204  {
206  }
207  else
208  {
209  }
210  }
211 
215  function properties()
216  {
217  }
218 
222  function saveProperties()
223  {
224  }
225 
229 
233  function createObject()
234  {
235  $this->ctrl->setParameter($this, "new_type", "sahs");
236  $this->initUploadForm();
237  $html = $this->form->getHTML();
238  $this->initCreationForm();
239  $html.= "<br />".$this->form->getHTML();
240  $this->tpl->setContent($html);
241 return;
242  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.slm_create.html", "Modules/ScormAicc");
243 
244  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_slm.gif'));
245 
246  $this->tpl->setVariable("ALT_IMG", $this->lng->txt("obj_sahs"));
247 
248  $this->ctrl->setParameter($this, "new_type", "sahs");
249  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
250  $this->tpl->setVariable("CMD_SUBMIT", "save");
251 
252  $this->tpl->setVariable("TXT_HEADER", $this->lng->txt("scorm_new"));
253  $this->tpl->setVariable("TXT_TITLE", $this->lng->txt("title"));
254  $this->tpl->setVariable("TXT_DESC", $this->lng->txt("desc"));
255  $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("scorm_add"));
256 
257  $this->tpl->setVariable("BTN_NAME", "upload");
258  $this->tpl->setVariable("TARGET", ' target="'.ilFrameTargetInfo::_getFrame("MainContent").'" ');
259 
260  $this->tpl->setVariable("TXT_SELECT_LMTYPE", $this->lng->txt("type"));
261  $this->tpl->setVariable("TXT_TYPE_AICC", $this->lng->txt("lm_type_aicc"));
262  $this->tpl->setVariable("TXT_TYPE_HACP", $this->lng->txt("lm_type_hacp"));
263  $this->tpl->setVariable("TXT_TYPE_SCORM", $this->lng->txt("lm_type_scorm"));
264 
265  $this->tpl->setVariable("TXT_TYPE_SCORM2004", $this->lng->txt("lm_type_scorm2004"));
266 
267  $this->tpl->setVariable("TXT_UPLOAD", $this->lng->txt("upload"));
268  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
269  $this->tpl->setVariable("TXT_IMPORT_LM", $this->lng->txt("import_sahs"));
270  $this->tpl->setVariable("TXT_SELECT_FILE", $this->lng->txt("select_file"));
271  $this->tpl->setVariable("TXT_VALIDATE_FILE", $this->lng->txt("cont_validate_file"));
272  $this->tpl->setVariable("TXT_EDITABLE_LM", $this->lng->txt("scorm_editable"));
273  $this->tpl->setVariable("TXT_EDITABLE_LM_COMMENTS", $this->lng->txt("scorm_editable_comments"));
274 
275 
276  // get the value for the maximal uploadable filesize from the php.ini (if available)
277  $umf=get_cfg_var("upload_max_filesize");
278  // get the value for the maximal post data from the php.ini (if available)
279  $pms=get_cfg_var("post_max_size");
280 
281  //convert from short-string representation to "real" bytes
282  $multiplier_a=array("K"=>1024, "M"=>1024*1024, "G"=>1024*1024*1024);
283 
284  $umf_parts=preg_split("/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
285  $pms_parts=preg_split("/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
286 
287  if (count($umf_parts) == 2) { $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]]; }
288  if (count($pms_parts) == 2) { $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]]; }
289 
290  // use the smaller one as limit
291  $max_filesize=min($umf, $pms);
292 
293  if (!$max_filesize) $max_filesize=max($umf, $pms);
294 
295  //format for display in mega-bytes
296  $max_filesize=sprintf("%.1f MB",$max_filesize/1024/1024);
297 
298  // gives out the limit as a little notice
299  $this->tpl->setVariable("TXT_FILE_INFO", $this->lng->txt("file_notice")." $max_filesize");
300 
301  include_once 'Services/FileSystemStorage/classes/class.ilUploadFiles.php';
303  {
305  foreach($files as $file)
306  {
307  $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
308  $this->tpl->setCurrentBlock("option_uploaded_file");
309  $this->tpl->setVariable("UPLOADED_FILENAME", $file);
310  $this->tpl->setVariable("TXT_UPLOADED_FILENAME", $file);
311  $this->tpl->parseCurrentBlock();
312  }
313  $this->tpl->setCurrentBlock("select_uploaded_file");
314  $this->tpl->setVariable("TXT_SELECT_FROM_UPLOAD_DIR", $this->lng->txt("cont_select_from_upload_dir"));
315  $this->tpl->setVariable("TXT_UPLOADED_FILE", $this->lng->txt("cont_uploaded_file"));
316  $this->tpl->parseCurrentBlock();
317  }
318 
319  //$this->importObject();
320  }
321 
327  public function initCreationForm()
328  {
329  global $lng, $ilCtrl;
330 
331  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
332  $this->form = new ilPropertyFormGUI();
333 
334  // title
335  $ti = new ilTextInputGUI($this->lng->txt("title"), "title");
336  $ti->setMaxLength(128);
337  $ti->setSize(40);
338  $ti->setRequired(true);
339  $this->form->addItem($ti);
340 
341  // text area
342  $ta = new ilTextAreaInputGUI($this->lng->txt("description"), "desc");
343  $ta->setCols(40);
344  $ta->setRows(2);
345  $this->form->addItem($ta);
346 
347 
348  $this->form->addCommandButton("save", $lng->txt("create"));
349  $this->form->addCommandButton("cancel", $lng->txt("cancel"));
350 
351  $this->form->setTitle($lng->txt("scorm_new"));
352  $this->form->setFormAction($ilCtrl->getFormAction($this));
353  $this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
354  }
355 
359  public function initUploadForm()
360  {
361  global $lng, $ilCtrl;
362 
363  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
364  $this->form = new ilPropertyFormGUI();
365 
366  // type selection
367  $options = array(
368  "scorm2004" => $lng->txt("lm_type_scorm2004"),
369  "scorm" => $lng->txt("lm_type_scorm"),
370  "aicc" => $lng->txt("lm_type_aicc"),
371  "hacp" => $lng->txt("lm_type_hacp")
372  );
373  $si = new ilSelectInputGUI($this->lng->txt("type"), "sub_type");
374  $si->setOptions($options);
375  $this->form->addItem($si);
376 
377  // input file
378  $fi = new ilFileInputGUI($this->lng->txt("select_file"), "scormfile");
379  $fi->setRequired(true);
380  $this->form->addItem($fi);
381 
382  // todo "uploaded file"
383  // todo wysiwyg editor removement
384 
385  include_once 'Services/FileSystemStorage/classes/class.ilUploadFiles.php';
387  {
388  $options = array();
389  $fi->setRequired(false);
391  $options[""] = $this->lng->txt("cont_select_from_upload_dir");
392  foreach($files as $file)
393  {
394  $file = htmlspecialchars($file, ENT_QUOTES, "utf-8");
395  $options[$file] = $file;
396  }
397  //
398  $si = new ilSelectInputGUI($this->lng->txt("cont_uploaded_file"), "uploaded_file");
399  $si->setOptions($options);
400  $this->form->addItem($si);
401  }
402 
403 
404  // validate file
405  $cb = new ilCheckboxInputGUI($this->lng->txt("cont_validate_file"), "validate");
406  $cb->setValue("y");
407  $cb->setChecked(true);
408  $this->form->addItem($cb);
409 
410  // import for editing
411  $cb = new ilCheckboxInputGUI($this->lng->txt("scorm_editable"), "editable");
412  $cb->setValue("y");
413  $cb->setInfo($this->lng->txt("scorm_editable_comments"));
414  $this->form->addItem($cb);
415 
416 
417  $this->form->addCommandButton("upload", $lng->txt("import"));
418  $this->form->addCommandButton("cancel", $lng->txt("cancel"));
419 
420  $this->form->setTitle($lng->txt("import_sahs"));
421  $this->form->setFormAction($ilCtrl->getFormAction($this));
422  $this->form->setTarget(ilFrameTargetInfo::_getFrame("MainContent"));
423  }
424 
428  function cancelObject($in_rep = false)
429  {
430  ilUtil::redirect("repository.php?cmd=frameset&ref_id=".$_GET["ref_id"]);
431  //$this->ctrl->redirectByClass("ilrepositorygui", "frameset");
432  }
433 
439 /* DEPRECATED
440  function importObject()
441  {
442 
443  // display import form
444  $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.slm_import.html", "Modules/ScormAicc");
445 
446  $this->tpl->setVariable("TYPE_IMG",ilUtil::getImagePath('icon_slm.gif'));
447  $this->tpl->setVariable("ALT_IMG", $this->lng->txt("obj_sahs"));
448 
449  $this->ctrl->setParameter($this, "new_type", "sahs");
450  $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
451 
452  $this->tpl->setVariable("BTN_NAME", "save");
453  $this->tpl->setVariable("TARGET", ' target="'.ilFrameTargetInfo::_getFrame("MainContent").'" ');
454 
455  $this->tpl->setVariable("TXT_SELECT_LMTYPE", $this->lng->txt("type"));
456  $this->tpl->setVariable("TXT_TYPE_AICC", $this->lng->txt("lm_type_aicc"));
457  $this->tpl->setVariable("TXT_TYPE_HACP", $this->lng->txt("lm_type_hacp"));
458  $this->tpl->setVariable("TXT_TYPE_SCORM", $this->lng->txt("lm_type_scorm"));
459 
460  $this->tpl->setVariable("TXT_TYPE_SCORM2004", $this->lng->txt("lm_type_scorm2004"));
461 
462  $this->tpl->setVariable("TXT_UPLOAD", $this->lng->txt("upload"));
463  $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
464  $this->tpl->setVariable("TXT_IMPORT_LM", $this->lng->txt("import_sahs"));
465  $this->tpl->setVariable("TXT_SELECT_FILE", $this->lng->txt("select_file"));
466  $this->tpl->setVariable("TXT_VALIDATE_FILE", $this->lng->txt("cont_validate_file"));
467 
468  // get the value for the maximal uploadable filesize from the php.ini (if available)
469  $umf=get_cfg_var("upload_max_filesize");
470  // get the value for the maximal post data from the php.ini (if available)
471  $pms=get_cfg_var("post_max_size");
472 
473  //convert from short-string representation to "real" bytes
474  $multiplier_a=array("K"=>1024, "M"=>1024*1024, "G"=>1024*1024*1024);
475 
476  $umf_parts=preg_split("/(\d+)([K|G|M])/", $umf, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
477  $pms_parts=preg_split("/(\d+)([K|G|M])/", $pms, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
478 
479  if (count($umf_parts) == 2) { $umf = $umf_parts[0]*$multiplier_a[$umf_parts[1]]; }
480  if (count($pms_parts) == 2) { $pms = $pms_parts[0]*$multiplier_a[$pms_parts[1]]; }
481 
482  // use the smaller one as limit
483  $max_filesize=min($umf, $pms);
484 
485  if (!$max_filesize) $max_filesize=max($umf, $pms);
486 
487  //format for display in mega-bytes
488  $max_filesize=sprintf("%.1f MB",$max_filesize/1024/1024);
489 
490  // gives out the limit as a little notice
491  $this->tpl->setVariable("TXT_FILE_INFO", $this->lng->txt("file_notice")." $max_filesize");
492  }
493 */
494 
501  function uploadObject()
502  {
503  global $_FILES, $rbacsystem;
504 
505  include_once 'Services/FileSystemStorage/classes/class.ilUploadFiles.php';
506 
507  // check create permission
508  if (!$rbacsystem->checkAccess("create", $_GET["ref_id"], "sahs"))
509  {
510  $this->ilias->raiseError($this->lng->txt("no_create_permission"), $this->ilias->error_obj->WARNING);
511  }
512  elseif ($_FILES["scormfile"]["name"])
513  {
514  // check if file was uploaded
515  $source = $_FILES["scormfile"]["tmp_name"];
516  if (($source == 'none') || (!$source))
517  {
518  $this->ilias->raiseError($this->lng->txt("msg_no_file"),$this->ilias->error_obj->MESSAGE);
519  }
520  // get_cfg_var("upload_max_filesize"); // get the may filesize form t he php.ini
521  switch ($__FILES["scormfile"]["error"])
522  {
523  case UPLOAD_ERR_INI_SIZE:
524  $this->ilias->raiseError($this->lng->txt("err_max_file_size_exceeds"),$this->ilias->error_obj->MESSAGE);
525  break;
526 
527  case UPLOAD_ERR_FORM_SIZE:
528  $this->ilias->raiseError($this->lng->txt("err_max_file_size_exceeds"),$this->ilias->error_obj->MESSAGE);
529  break;
530 
531  case UPLOAD_ERR_PARTIAL:
532  $this->ilias->raiseError($this->lng->txt("err_partial_file_upload"),$this->ilias->error_obj->MESSAGE);
533  break;
534 
535  case UPLOAD_ERR_NO_FILE:
536  $this->ilias->raiseError($this->lng->txt("err_no_file_uploaded"),$this->ilias->error_obj->MESSAGE);
537  break;
538  }
539 
540  $file = pathinfo($_FILES["scormfile"]["name"]);
541  }
542  elseif ($_POST["uploaded_file"])
543  {
544  // check if the file is in the upload directory and readable
545  if (!ilUploadFiles::_checkUploadFile($_POST["uploaded_file"]))
546  {
547  $this->ilias->raiseError($this->lng->txt("upload_error_file_not_found"),$this->ilias->error_obj->MESSAGE);
548  }
549 
550  $file = pathinfo($_POST["uploaded_file"]);
551  }
552  else
553  {
554  $this->ilias->raiseError($this->lng->txt("msg_no_file"),$this->ilias->error_obj->MESSAGE);
555  }
556 
557  $name = substr($file["basename"], 0, strlen($file["basename"]) - strlen($file["extension"]) - 1);
558  if ($name == "")
559  {
560  $name = $this->lng->txt("no_title");
561  }
562 
563  // create and insert object in objecttree
564  switch ($_POST["sub_type"])
565  {
566 
567  case "scorm2004":
568  include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
569  $newObj = new ilObjSCORM2004LearningModule();
570  $newObj->setEditable($_POST["editable"]=='y');
571  break;
572 
573  case "scorm":
574  include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php");
575  $newObj = new ilObjSCORMLearningModule();
576  break;
577 
578  case "aicc":
579  include_once("./Modules/ScormAicc/classes/class.ilObjAICCLearningModule.php");
580  $newObj = new ilObjAICCLearningModule();
581  break;
582 
583  case "hacp":
584  include_once("./Modules/ScormAicc/classes/class.ilObjHACPLearningModule.php");
585  $newObj = new ilObjHACPLearningModule();
586  break;
587  }
588 
589  $newObj->setTitle($name);
590  $newObj->setSubType($_POST["sub_type"]);
591  $newObj->setDescription("");
592  $newObj->create(true);
593  $newObj->createReference();
594  $newObj->putInTree($_GET["ref_id"]);
595  $newObj->setPermissions($_GET["ref_id"]);
596  $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
597 
598  // create data directory, copy file to directory
599  $newObj->createDataDirectory();
600 
601  if ($_FILES["scormfile"]["name"])
602  {
603  // copy uploaded file to data directory
604  $file_path = $newObj->getDataDirectory()."/".$_FILES["scormfile"]["name"];
605 
606  ilUtil::moveUploadedFile($_FILES["scormfile"]["tmp_name"],
607  $_FILES["scormfile"]["name"], $file_path);
608  }
609  else
610  {
611  // copy uploaded file to data directory
612  $file_path = $newObj->getDataDirectory()."/". $_POST["uploaded_file"];
613 
614  ilUploadFiles::_copyUploadFile($_POST["uploaded_file"], $file_path);
615  }
616 
617  ilUtil::unzip($file_path);
618  ilUtil::renameExecutables($newObj->getDataDirectory());
619 
620  $title = $newObj->readObject();
621  if ($title != "")
622  {
623  ilObject::_writeTitle($newObj->getId(), $title);
624  /*$md = new ilMD($newObj->getId(),0, $newObj->getType());
625  if(is_object($md_gen = $md->getGeneral()))
626  {
627  $md_gen->setTitle($title);
628  $md_gen->update();
629  }*/
630  }
631 
632  ilUtil::sendInfo( $this->lng->txt($newObj->getType()."_added"), true);
633  ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=".$newObj->getRefId());
634  }
635 
636  function upload()
637  {
638  $this->uploadObject();
639  }
640 
641 
642 
646  function saveObject()
647  {
648  if (trim($_POST["title"]) == "")
649  {
650  $this->ilias->raiseError($this->lng->txt("msg_no_title"),$this->ilias->error_obj->MESSAGE);
651  }
652 
653  include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModule.php");
654  $newObj = new ilObjSCORM2004LearningModule();
655  $newObj->setTitle(ilUtil::stripSlashes($_POST["title"]));
656  $newObj->setSubType("scorm2004");
657  $newObj->setEditable(true);
658  $newObj->setDescription(ilUtil::stripSlashes($_POST["desc"]));
659  $newObj->create();
660  $newObj->createReference();
661  $newObj->putInTree($_GET["ref_id"]);
662  $newObj->setPermissions($_GET["ref_id"]);
663  $newObj->notify("new",$_GET["ref_id"],$_GET["parent_non_rbac_id"],$_GET["ref_id"],$newObj->getRefId());
664  $newObj->createDataDirectory();
665  $newObj->createScorm2004Tree();
666  ilUtil::sendInfo( $this->lng->txt($newObj->getType()."_added"), true);
667  ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&ref_id=".$newObj->getRefId());
668  }
669 
670 
674  function info()
675  {
676  $this->infoObject();
677  }
678 
682  function owner()
683  {
684  $this->ownerObject();
685  }
686 
690  function getTemplate()
691  {
692  global $lng;
693 
694  $this->tpl->addBlockFile("CONTENT", "content", "tpl.adm_content.html");
695  //$this->tpl->setVariable("HEADER", $a_header_title);
696  $this->tpl->addBlockFile("STATUSLINE", "statusline", "tpl.statusline.html");
697  //$this->tpl->setVariable("TXT_LOCATOR",$this->lng->txt("locator"));
698  }
699 
700 
706  function frameset()
707  {
708  $this->tpl = new ilTemplate("tpl.sahs_edit_frameset.html", false, false, "Modules/ScormAicc");
709  $this->tpl->setVariable("SRC",
710  $this->ctrl->getLinkTarget($this, "properties"));
711  $this->tpl->show("DEFAULT", false);
712  exit;
713  }
714 
718  function setTabs()
719  {
720  $this->tpl->setCurrentBlock("header_image");
721  $this->tpl->setVariable("IMG_HEADER", ilUtil::getImagePath("icon_lm_b.gif"));
722  $this->tpl->parseCurrentBlock();
723 
724  $this->getTabs($this->tabs_gui);
725  #$this->tpl->setVariable("TABS", $this->tabs_gui->getHTML());
726  $this->tpl->setVariable("HEADER", $this->object->getTitle());
727  }
728 
732  function certificate()
733  {
734  include_once "./Services/Certificate/classes/class.ilCertificateGUI.php";
735  include_once "./Modules/ScormAicc/classes/class.ilSCORMCertificateAdapter.php";
736  $output_gui = new ilCertificateGUI(new ilSCORMCertificateAdapter($this->object));
737  $output_gui->certificateEditor();
738  }
739 
745  function getTabs(&$tabs_gui)
746  {
747  global $rbacsystem, $ilUser, $ilCtrl;
748 
749  if ($this->ctrl->getCmd() == "delete")
750  {
751  return;
752  }
753 
754  // file system gui tabs
755  // properties
756  $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", 1);
757  $tabs_gui->addTarget("cont_list_files",
758  $this->ctrl->getLinkTargetByClass("ilfilesystemgui", "listFiles"), "",
759  "ilfilesystemgui");
760  $ilCtrl->setParameterByClass("ilfilesystemgui", "resetoffset", "");
761 
762  // info screen
763  $force_active = ($this->ctrl->getNextClass() == "ilinfoscreengui")
764  ? true
765  : false;
766  $tabs_gui->addTarget("info_short",
767  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "",
768  "ilinfoscreengui", "", $force_active);
769 
770  // properties
771  $tabs_gui->addTarget("settings",
772  $this->ctrl->getLinkTarget($this, "properties"), "properties",
773  get_class($this));
774 
775  // learning progress
776  include_once './Services/Tracking/classes/class.ilLearningProgressAccess.php';
777  if(ilLearningProgressAccess::checkAccess($this->object->getRefId()))
778  {
779  $tabs_gui->addTarget('learning_progress',
780  $this->ctrl->getLinkTargetByClass(array('illearningprogressgui'),''),
781  '',
782  array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
783  }
784 
785  // tracking data
786  $tabs_gui->addTarget("cont_tracking_data",
787  $this->ctrl->getLinkTarget($this, "showTrackingItems"), "showTrackingItems",
788  get_class($this));
789 
790  // create and insert object in objecttree
791  switch ($this->object->getSubType())
792  {
793 
794  case "scorm2004":
795  case "scorm":
796  // certificate
797  $tabs_gui->addTarget("certificate",
798  $this->ctrl->getLinkTarget($this, "certificate"),
799  array("certificate", "certificateEditor", "certificateRemoveBackground", "certificateSave",
800  "certificatePreview", "certificateDelete", "certificateUpload", "certificateImport")
801  );
802  break;
803  }
804 
805  include_once("Services/License/classes/class.ilLicenseAccess.php");
806  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId())
808  {
809  $tabs_gui->addTarget("license",
810  $this->ctrl->getLinkTargetByClass('illicensegui', ''),
811  "", "illicensegui");
812  }
813 
814  // edit meta
815  $tabs_gui->addTarget("meta_data",
816  $this->ctrl->getLinkTargetByClass('ilmdeditorgui',''),
817  "", "ilmdeditorgui");
818 
819  // perm
820  if ($rbacsystem->checkAccess('edit_permission',$this->object->getRefId()))
821  {
822  $tabs_gui->addTarget("perm_settings",
823  $this->ctrl->getLinkTargetByClass(array(get_class($this),'ilpermissiongui'), "perm"), array("perm","info","owner"), 'ilpermissiongui');
824  }
825  }
826 
830  function _goto($a_target)
831  {
832  global $ilAccess, $ilErr, $lng;
833 
834  $parts = explode("_", $a_target);
835 
836  if ($ilAccess->checkAccess("write", "", $parts[0]))
837  {
838  $_GET["cmd"] = "";
839  $_GET["baseClass"] = "ilSAHSEditGUI";
840  $_GET["ref_id"] = $parts[0];
841  $_GET["obj_id"] = $parts[1];
842  include("ilias.php");
843  exit;
844  }
845  if ($ilAccess->checkAccess("visible", "", $parts[0]))
846  {
847  $_GET["cmd"] = "infoScreen";
848  $_GET["baseClass"] = "ilSAHSPresentationGUI";
849  $_GET["ref_id"] = $parts[0];
850  include("ilias.php");
851  exit;
852  }
853  else
854  {
855  if ($ilAccess->checkAccess("read", "", ROOT_FOLDER_ID))
856  {
857  $_GET["cmd"] = "frameset";
858  $_GET["target"] = "";
859  $_GET["ref_id"] = ROOT_FOLDER_ID;
860  ilUtil::sendInfo(sprintf($lng->txt("msg_no_perm_read_item"),
862  include("repository.php");
863  exit;
864  }
865  }
866 
867  $ilErr->raiseError($lng->txt("msg_no_perm_read"), $ilErr->FATAL);
868  }
869 
870  function addLocatorItems()
871  {
872  global $ilLocator;
873 
874  if (is_object($this->object))
875  {
876  $ilLocator->addItem($this->object->getTitle(),
877  $this->ctrl->getLinkTargetByClass("ilinfoscreengui", "showSummary"), "", $_GET["ref_id"]);
878  }
879  }
880 
881 } // END class.ilObjSAHSLearningModule
882 ?>