173 {
174 global $ilAccess;
177
178
179 if(!$this->__checkSession($sid))
180 {
182 self::SOAP_LP_ERROR_AUTHENTICATION);
183 }
184
185
186 if(array_diff((array) $a_progress_filter, self::$PROGRESS_INFO_TYPES))
187 {
188 return $this->
__raiseError(
'Error '.self::SOAP_LP_ERROR_INVALID_FILTER.
': Invalid filter type given',
189 self::SOAP_LP_ERROR_INVALID_FILTER);
190 }
191
192 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
194 {
195 return $this->
__raiseError(
'Error '. self::SOAP_LP_ERROR_LP_NOT_ENABLED .
': Learning progress not enabled in ILIAS',
196 self::SOAP_LP_ERROR_LP_NOT_ENABLED);
197 }
198
199 include_once './Services/Object/classes/class.ilObjectFactory.php';
202 {
203 return $this->
__raiseError(
'Error '.self::SOAP_LP_ERROR_INVALID_REF_ID.
': Invalid reference id '. $a_ref_id.
' given',
204 self::SOAP_LP_ERROR_INVALID_REF_ID);
205 }
206
207
208 include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
211 {
212 return $this->
__raiseError(
'Error '.self::SOAP_LP_ERROR_LP_NOT_AVAILABLE.
': Learning progress not available for objects of type '.
213 $obj->getType(),
214 self::SOAP_LP_ERROR_LP_NOT_AVAILABLE);
215 }
216
217
218 if(!$ilAccess->checkAccess('edit_learning_progress','',$a_ref_id))
219 {
220 return $this->
__raiseError(
'Error '. self::SOAP_LP_ERROR_NO_PERMISSION .
': No Permission to access learning progress in this object',
221 self::SOAP_LP_ERROR_NO_PERMISSION);
222 }
223
224 include_once './Services/Xml/classes/class.ilXmlWriter.php';
226 $writer->xmlStartTag(
227 'LearningProgressInfo',
228 array(
229 'ref_id' => $obj->getRefId(),
230 'type' => $obj->getType()
231 )
232 );
233
234 $writer->xmlStartTag('LearningProgressSummary');
235
236 include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
237 if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_COMPLETED, $a_progress_filter))
238 {
240 $writer->xmlElement(
241 'Status',
242 array(
243 'type' => self::PROGRESS_FILTER_COMPLETED,
244 'num' => (int) $completed
245 )
246 );
247 }
248 if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_IN_PROGRESS, $a_progress_filter))
249 {
251 $writer->xmlElement(
252 'Status',
253 array(
254 'type' => self::PROGRESS_FILTER_IN_PROGRESS,
255 'num' => (int) $completed
256 )
257 );
258 }
259 if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_FAILED, $a_progress_filter))
260 {
262 $writer->xmlElement(
263 'Status',
264 array(
265 'type' => self::PROGRESS_FILTER_FAILED,
266 'num' => (int) $completed
267 )
268 );
269 }
270 if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_NOT_ATTEMPTED, $a_progress_filter))
271 {
273 $writer->xmlElement(
274 'Status',
275 array(
276 'type' => self::PROGRESS_FILTER_NOT_ATTEMPTED,
277 'num' => (int) $completed
278 )
279 );
280 }
281 $writer->xmlEndTag('LearningProgressSummary');
282
283
284 $writer->xmlStartTag('UserProgress');
285 if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_COMPLETED, $a_progress_filter))
286 {
288 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_COMPLETED);
289 }
290 if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_IN_PROGRESS, $a_progress_filter))
291 {
293 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_IN_PROGRESS);
294 }
295 if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_FAILED, $a_progress_filter))
296 {
298 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_FAILED);
299 }
300 if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_NOT_ATTEMPTED, $a_progress_filter))
301 {
303 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_NOT_ATTEMPTED);
304 }
305 $writer->xmlEndTag('UserProgress');
306 $writer->xmlEndTag('LearningProgressInfo');
307
308 return $writer->xmlDumpMem();
309 }
static _lookupDBMode($a_obj_id)
_getCountCompleted($a_obj_id)
Static function to read the number of user who have the status 'completed'.
_getCountInProgress($a_obj_id)
Static function to read the number of user who have the status 'in_progress'.
_getNotAttempted($a_obj_id)
Static function to read the number of user who have the status 'not_attempted'.
_getCountNotAttempted($a_obj_id)
Static function to read the number of user who have the status 'not_attempted'.
_getCountFailed($a_obj_id)
Static function to read the number of user who have the status 'failed'.
static _enabledLearningProgress()
check wether learing progress is enabled or not
getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
Class ilObject Basic functions for all objects.
addUserProgress(ilXmlWriter $writer, $users, $a_type)