ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilSoapSCORMAdministration.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
33include_once './webservice/soap/classes/class.ilSoapAdministration.php';
34
36{
37
47 function getIMSManifestXML ($sid, $ref_id)
48 {
49 $this->initAuth($sid);
50 $this->initIlias();
51
52 if(!$this->__checkSession($sid))
53 {
54 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
55 }
56 if(!strlen($ref_id))
57 {
58 return $this->__raiseError('No ref id given. Aborting!',
59 'Client');
60 }
61 global $rbacsystem, $tree, $ilLog;
62
63 // get obj_id
65 {
66 return $this->__raiseError('No exercise found for id: '.$ref_id,
67 'Client');
68 }
69
71 {
72 return $this->__raiseError("Parent with ID $ref_id has been deleted.", 'Client');
73 }
74
75 // Check access
76 $permission_ok = false;
77 foreach($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id)
78 {
79 if($rbacsystem->checkAccess('read',$ref_id))
80 {
81 $permission_ok = true;
82 break;
83 }
84 }
85
86 if(!$permission_ok)
87 {
88 return $this->__raiseError('No permission to read the object with id: '.$ref_id,
89 'Server');
90 }
91
92 $lm_obj = ilObjectFactory::getInstanceByObjId($obj_id, false);
93 if (!is_object($lm_obj) || $lm_obj->getType()!= "sahs")
94 {
95 return $this->__raiseError('Wrong obj id or type for scorm object with id '.$ref_id,
96 'Server');
97 }
98 // get scorm xml
99 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
100 require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
101
102 $imsFilename = $lm_obj->getDataDirectory().DIRECTORY_SEPARATOR."imsmanifest.xml";
103
104 if (!file_exists($imsFilename)) {
105 return $this->__raiseError('Could not find manifest file for object with ref id '.$ref_id,
106 'Server');
107
108 }
109 return file_get_contents($imsFilename);
110 }
111
112 public function hasSCORMCertificate($sid, $ref_id, $usr_id)
113 {
114 $this->initAuth($sid);
115 $this->initIlias();
116
117 if(!$this->__checkSession($sid))
118 {
119 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
120 }
121 if(!strlen($ref_id))
122 {
123 return $this->__raiseError('No ref id given. Aborting!',
124 'Client');
125 }
126 global $rbacsystem, $tree, $ilLog;
127
128 // get obj_id
129 if(!$obj_id = ilObject::_lookupObjectId($ref_id))
130 {
131 return $this->__raiseError('No exercise found for id: '.$ref_id,
132 'Client');
133 }
134
136 {
137 return $this->__raiseError("Parent with ID $ref_id has been deleted.", 'Client');
138 }
139
140 $result = false;
141 include_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php");
143
144 return $result;
145 }
146
147 public function getSCORMCompletionStatus($sid, $a_usr_id, $a_ref_id)
148 {
149 $this->initAuth($sid);
150 $this->initIlias();
151
152 if(!$this->__checkSession($sid))
153 {
154 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
155 }
156
157 if(!strlen($a_ref_id))
158 {
159 return $this->__raiseError('No ref_id given. Aborting!', 'Client');
160 }
161
162 include_once 'include/inc.header.php';
163
164 // get obj_id
165 if(!$obj_id = ilObject::_lookupObjectId($a_ref_id))
166 {
167 return $this->__raiseError('No scorm module found for id: '.$a_ref_id,
168 'Client');
169 }
170
171 include_once 'Services/Tracking/classes/class.ilLPStatus.php';
172 include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
173
175 {
176 return $this->__raiseError('Learning progress not enabled in this installation. Aborting!', 'Server');
177 }
178
179 $status = ilLPStatus::_lookupStatus($obj_id, $a_usr_id);
181 {
182 return 'completed';
183 }
184 else if($status == ilLPStatus::LP_STATUS_FAILED_NUM)
185 {
186 return 'failed';
187 }
188 else if($status == ilLPStatus::LP_STATUS_IN_PROGRESS_NUM)
189 {
190 return 'in_progress';
191 }
192 else
193 {
194 return 'not_attempted';
195 }
196 }
197}
198?>
$result
An exception for terminatinating execution or to throw for unit testing.
const LP_STATUS_COMPLETED_NUM
static _lookupStatus($a_obj_id, $a_user_id, $a_create=true)
Lookup status.
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_FAILED_NUM
static _lookupUserCertificate($obj_id, $usr_id=0)
Checks whether a certificate exists for the active user or not.
static _enabledLearningProgress()
check wether learing progress is enabled or not
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupObjectId($a_ref_id)
lookup object id
static _getAllReferences($a_id)
get all reference ids of object
static _isInTrash($a_ref_id)
checks wether object is in trash
initAuth($sid)
Init authentication.
__raiseError($a_message, $a_code)
getIMSManifestXML($sid, $ref_id)
get ims manifest xml
getSCORMCompletionStatus($sid, $a_usr_id, $a_ref_id)
$ref_id
Definition: sahs_server.php:39