ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 
33 include_once './webservice/soap/classes/class.ilSoapAdministration.php';
34 
36 {
38  {
40  }
41 
51  function getIMSManifestXML ($sid, $ref_id)
52  {
53  $this->initAuth($sid);
54  $this->initIlias();
55 
56  if(!$this->__checkSession($sid))
57  {
58  return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
59  }
60  if(!strlen($ref_id))
61  {
62  return $this->__raiseError('No ref id given. Aborting!',
63  'Client');
64  }
65  global $rbacsystem, $tree, $ilLog;
66 
67  // get obj_id
68  if(!$obj_id = ilObject::_lookupObjectId($ref_id))
69  {
70  return $this->__raiseError('No exercise found for id: '.$ref_id,
71  'Client');
72  }
73 
75  {
76  return $this->__raiseError("Parent with ID $ref_id has been deleted.", 'Client');
77  }
78 
79  // Check access
80  $permission_ok = false;
81  foreach($ref_ids = ilObject::_getAllReferences($obj_id) as $ref_id)
82  {
83  if($rbacsystem->checkAccess('read',$ref_id))
84  {
85  $permission_ok = true;
86  break;
87  }
88  }
89 
90  if(!$permission_ok)
91  {
92  return $this->__raiseError('No permission to read the object with id: '.$ref_id,
93  'Server');
94  }
95 
96  $lm_obj = ilObjectFactory::getInstanceByObjId($obj_id, false);
97  if (!is_object($lm_obj) || $lm_obj->getType()!= "sahs")
98  {
99  return $this->__raiseError('Wrong obj id or type for scorm object with id '.$ref_id,
100  'Server');
101  }
102  // get scorm xml
103  require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMObject.php");
104  require_once("./Modules/ScormAicc/classes/SCORM/class.ilSCORMResource.php");
105 
106  $imsFilename = $lm_obj->getDataDirectory().DIRECTORY_SEPARATOR."imsmanifest.xml";
107 
108  if (!file_exists($imsFilename)) {
109  return $this->__raiseError('Could not find manifest file for object with ref id '.$ref_id,
110  'Server');
111 
112  }
113  return file_get_contents($imsFilename);
114  }
115 
116  public function hasSCORMCertificate($sid, $ref_id, $usr_id)
117  {
118  $this->initAuth($sid);
119  $this->initIlias();
120 
121  if(!$this->__checkSession($sid))
122  {
123  return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
124  }
125  if(!strlen($ref_id))
126  {
127  return $this->__raiseError('No ref id given. Aborting!',
128  'Client');
129  }
130  global $rbacsystem, $tree, $ilLog;
131 
132  // get obj_id
133  if(!$obj_id = ilObject::_lookupObjectId($ref_id))
134  {
135  return $this->__raiseError('No exercise found for id: '.$ref_id,
136  'Client');
137  }
138 
140  {
141  return $this->__raiseError("Parent with ID $ref_id has been deleted.", 'Client');
142  }
143 
144  $result = false;
145  include_once("./Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php");
147 
148  return $result;
149  }
150 
151  public function getSCORMCompletionStatus($sid, $a_usr_id, $a_ref_id)
152  {
153  $this->initAuth($sid);
154  $this->initIlias();
155 
156  if(!$this->__checkSession($sid))
157  {
158  return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
159  }
160 
161  if(!strlen($a_ref_id))
162  {
163  return $this->__raiseError('No ref_id given. Aborting!', 'Client');
164  }
165 
166  include_once 'include/inc.header.php';
167 
168  // get obj_id
169  if(!$obj_id = ilObject::_lookupObjectId($a_ref_id))
170  {
171  return $this->__raiseError('No scorm module found for id: '.$a_ref_id,
172  'Client');
173  }
174 
175  include_once 'Services/Tracking/classes/class.ilLPStatus.php';
176  include_once 'Services/Tracking/classes/class.ilObjUserTracking.php';
177 
179  {
180  return $this->__raiseError('Learning progress not enabled in this installation. Aborting!', 'Server');
181  }
182 
183  $status = ilLPStatus::_lookupStatus($obj_id, $a_usr_id);
184  if($status == LP_STATUS_COMPLETED_NUM)
185  {
186  return 'completed';
187  }
188  else if($status == LP_STATUS_FAILED)
189  {
190  return 'failed';
191  }
192  else if($status == LP_STATUS_IN_PROGRESS_NUM)
193  {
194  return 'in_progress';
195  }
196  else
197  {
198  return 'not_attempted';
199  }
200  }
201 }
202 ?>