ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilSAHSEditGUI.php
Go to the documentation of this file.
1<?php
2/* Copyright (c) 1998-2012 ILIAS open source, Extended GPL, see docs/LICENSE */
3
18{
19 public $ilias;
20 public $tpl;
21 public $lng;
22
23 public function __construct()
24 {
25 global $DIC;
26 $ilias = $DIC['ilias'];
27 $tpl = $DIC['tpl'];
28 $lng = $DIC['lng'];
29 $ilCtrl = $DIC['ilCtrl'];
30
31 $this->ilias = $ilias;
32 $this->tpl = $tpl;
33 $this->lng = $lng;
34 $this->ctrl = $ilCtrl;
35
36 $this->ctrl->saveParameter($this, "ref_id");
37 }
38
42 public function executeCommand()
43 {
44 global $DIC;
45
46 $DIC->globalScreen()->tool()->context()->claim()->repository();
47
48 $lng = $DIC['lng'];
49 $ilAccess = $DIC['ilAccess'];
50 $ilNavigationHistory = $DIC['ilNavigationHistory'];
51 $ilias = $DIC['ilias'];
52 $ilCtrl = $DIC['ilCtrl'];
53 $GLOBALS['DIC']["ilLog"]->write("bc:" . $_GET["baseClass"] . "; nc:" . $this->ctrl->getNextClass($this) . "; cmd:" . $this->ctrl->getCmd());
54
55 include_once "./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php";
56
57 $lng->loadLanguageModule("content");
58
59 // permission
60 if (!$ilAccess->checkAccess("write", "", $_GET["ref_id"])) {
61 $this->ilias->raiseError($lng->txt("permission_denied"), $ilias->error_obj->MESSAGE);
62 }
63
64 // add entry to navigation history
65 $ilNavigationHistory->addItem(
66 $_GET["ref_id"],
67 "ilias.php?baseClass=ilSAHSEditGUI&ref_id=" . $_GET["ref_id"],
68 "lm"
69 );
70
71 $next_class = $this->ctrl->getNextClass($this);
72 $cmd = $this->ctrl->getCmd();
73
74 $obj_id = ilObject::_lookupObjectId($_GET['ref_id']);
76
77 switch ($type) {
78
79 case "scorm2004":
80 include_once("./Modules/Scorm2004/classes/class.ilObjSCORM2004LearningModuleGUI.php");
81 $this->slm_gui = new ilObjSCORM2004LearningModuleGUI("", $_GET["ref_id"], true, false);
82 break;
83
84 case "scorm":
85 include_once("./Modules/ScormAicc/classes/class.ilObjSCORMLearningModuleGUI.php");
86 $this->slm_gui = new ilObjSCORMLearningModuleGUI("", $_GET["ref_id"], true, false);
87 break;
88 }
89
90 if ($next_class == "") {
91 switch ($type) {
92
93 case "scorm2004":
94 $this->ctrl->setCmdClass("ilobjscorm2004learningmodulegui");
95 break;
96
97 case "scorm":
98 $this->ctrl->setCmdClass("ilobjscormlearningmodulegui");
99 break;
100 }
101 $next_class = $this->ctrl->getNextClass($this);
102 }
103
104 switch ($next_class) {
105 case "ilobjscormlearningmodulegui":
106 case "ilobjscorm2004learningmodulegui":
107 $ret = $this->ctrl->forwardCommand($this->slm_gui);
108 break;
109
110 case "ilexportgui":
111 $obj_id = ilObject::_lookupObjectId($_GET["ref_id"]);
112 if ($cmd == "create_xml") {
113 require_once("Modules/ScormAicc/classes/class.ilScormAiccExporter.php");
114 $exporter = new ilScormAiccExporter();
115 $xml = $exporter->getXmlRepresentation("sahs", "5.1.0", $obj_id);
116 } elseif ($cmd == "download") {
117 $file = $_GET["file"];
118 $ftmp = explode(":", $file);
119 $fileName = $ftmp[1];
120 require_once("./Services/Export/classes/class.ilExport.php");
121 $exportDir = ilExport::_getExportDirectory($obj_id);
122 ilUtil::deliverFile($exportDir . "/" . $fileName, $fileName);
123 } elseif ($cmd == "confirmDeletion") {
124 require_once("./Services/Export/classes/class.ilExport.php");
125 $exportDir = ilExport::_getExportDirectory($obj_id);
126 foreach ($_POST["file"] as $file) {
127 $file = explode(":", $file);
128 $file[1] = basename($file[1]);
129 $exp_file = $exportDir . "/" . str_replace("..", "", $file[1]);
130 if (@is_file($exp_file)) {
131 unlink($exp_file);
132 }
133 }
134 }
135 $this->ctrl->setCmd("export");
136 ilUtil::redirect("ilias.php?baseClass=ilSAHSEditGUI&cmd=export&ref_id=" . $_GET["ref_id"]);
137 break;
138
139
140 default:
141 die("ilSAHSEdit: Class $next_class not found.");;
142 }
143
144 $this->tpl->printToStdout();
145 }
146}
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
$_GET["client_id"]
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
Class ilObjSCORMLearningModuleGUI.
static _lookupObjectId($a_ref_id)
lookup object id
Class ilSAHSPresentationGUI.
executeCommand()
execute command
static redirect($a_script)
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
global $DIC
Definition: goto.php:24
$xml
Definition: metadata.php:332
redirection script todo: (a better solution should control the processing via a xml file)
$ret
Definition: parser.php:6
$type