ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilSoapLearningProgressAdministration Class Reference

This class handles all DB changes necessary for fraunhofer. More...

+ Inheritance diagram for ilSoapLearningProgressAdministration:
+ Collaboration diagram for ilSoapLearningProgressAdministration:

Public Member Functions

 getProgressInfo ($sid, $a_ref_id, $a_progress_filter)
 
 getLearningProgressChanges ($sid, $timestamp, $include_ref_ids, $type_filter)
 Get learning progress changes. More...
 
- Public Member Functions inherited from ilSoapAdministration
 ilSoapAdministration ($use_nusoap=true)
 
 initErrorWriter ()
 Overwrite error handler. More...
 
 __explodeSid ($sid)
 
 __setMessage ($a_str)
 
 __getMessage ()
 
 __appendMessage ($a_str)
 
 __setMessageCode ($a_code)
 
 __getMessageCode ()
 
 initAuth ($sid)
 
 initIlias ()
 
 __initAuthenticationObject ($a_auth_mode=AUTH_LOCAL)
 
 __raiseError ($a_message, $a_code)
 
 getNIC ($sid)
 get client information from current as xml result set More...
 
 isFault ($object)
 
 checkObjectAccess ($ref_id, $expected_type, $permission, $returnObject=false)
 check access for ref id: expected type, permission, return object instance if returnobject is true More...
 
 getInstallationInfoXML ()
 
 getClientInfoXML ($clientid)
 

Data Fields

const PROGRESS_FILTER_ALL = 0
 
const PROGRESS_FILTER_IN_PROGRESS = 1
 
const PROGRESS_FILTER_COMPLETED = 2
 
const PROGRESS_FILTER_FAILED = 3
 
const PROGRESS_FILTER_NOT_ATTEMPTED = 4
 
const SOAP_LP_ERROR_AUTHENTICATION = 50
 
const SOAP_LP_ERROR_INVALID_FILTER = 52
 
const SOAP_LP_ERROR_INVALID_REF_ID = 54
 
const SOAP_LP_ERROR_LP_NOT_AVAILABLE = 56
 
const SOAP_LP_ERROR_NO_PERMISSION = 58
 
const SOAP_LP_ERROR_LP_NOT_ENABLED = 60
 
const USER_FILTER_ALL = -1
 
- Data Fields inherited from ilSoapAdministration
 $sauth = null
 
 $error_method = null
 

Protected Member Functions

 addUserProgress (ilXmlWriter $writer, $users, $a_type)
 
 applyProgressFilter ($obj_id, Array $usr_ids, Array $filter)
 Apply progress filter. More...
 
 deleteScormTracking ($a_obj_id, $a_usr_ids)
 Delete SCORM Tracking @global type $ilDB. More...
 
 deleteScorm2004Tracking ($a_obj_id, $a_usr_ids)
 Delete scorm 2004 tracking. More...
 

Static Protected Attributes

static $DELETE_PROGRESS_FILTER_TYPES = array('sahs', 'tst')
 
static $PROGRESS_INFO_TYPES
 

Additional Inherited Members

- Static Public Member Functions inherited from ilSoapAdministration
static return_bytes ($val)
 calculate bytes from K,M,G modifiers e.g: 8M = 8 * 1024 * 1024 bytes More...
 
- Protected Attributes inherited from ilSoapAdministration
 $soap_check = true
 

Detailed Description

This class handles all DB changes necessary for fraunhofer.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

Definition at line 14 of file class.ilSoapLearningProgressAdministration.php.

Member Function Documentation

◆ addUserProgress()

ilSoapLearningProgressAdministration::addUserProgress ( ilXmlWriter  $writer,
  $users,
  $a_type 
)
protected

Definition at line 311 of file class.ilSoapLearningProgressAdministration.php.

312 {
313 foreach($users as $user_id)
314 {
315 $writer->xmlStartTag(
316 'User',
317 array(
318 'id' => $user_id,
319 'status' => $a_type
320 )
321 );
322
323 $info = ilObjUser::_lookupName($user_id);
324 $writer->xmlElement('Login',array(),(string) $info['login']);
325 $writer->xmlElement('Firstname',array(),(string) $info['firstname']);
326 $writer->xmlElement('Lastname',array(),(string) $info['lastname']);
327 $writer->xmlEndTag('User');
328
329 }
330 }
static _lookupName($a_user_id)
lookup user name
xmlEndTag($tag)
Writes an endtag.
xmlStartTag($tag, $attrs=NULL, $empty=FALSE, $encode=TRUE, $escape=TRUE)
Writes a starttag.
xmlElement($tag, $attrs=NULL, $data=Null, $encode=TRUE, $escape=TRUE)
Writes a basic element (no children, just textual content)
$info
Definition: example_052.php:80

References $info, ilObjUser\_lookupName(), ilXmlWriter\xmlElement(), ilXmlWriter\xmlEndTag(), and ilXmlWriter\xmlStartTag().

Referenced by getProgressInfo().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ applyProgressFilter()

ilSoapLearningProgressAdministration::applyProgressFilter (   $obj_id,
Array  $usr_ids,
Array  $filter 
)
protected

Apply progress filter.

Parameters
int$obj_id
array$usr_ids
array$filter
Returns
array $filtered_users

Definition at line 341 of file class.ilSoapLearningProgressAdministration.php.

342 {
343 include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
344
345
346 $all_users = array();
347 if(in_array(self::USER_FILTER_ALL, $usr_ids))
348 {
349 $all_users = array_unique(
350 array_merge(
354 )
355 );
356 }
357 else
358 {
359 $all_users = $usr_ids;
360 }
361
362 if(!$filter or in_array(self::PROGRESS_FILTER_ALL, $filter))
363 {
364 $GLOBALS['log']->write(__METHOD__.': Deleting all progress data');
365 return $all_users;
366 }
367
368 $filter_users = array();
369 if(in_array(self::PROGRESS_FILTER_IN_PROGRESS, $filter))
370 {
371 $GLOBALS['log']->write(__METHOD__.': Filtering in progress.');
372 $filter_users = array_merge($filter, ilLPStatusWrapper::_getInProgress($obj_id));
373 }
374 if(in_array(self::PROGRESS_FILTER_COMPLETED, $filter))
375 {
376 $GLOBALS['log']->write(__METHOD__.': Filtering completed.');
377 $filter_users = array_merge($filter, ilLPStatusWrapper::_getCompleted($obj_id));
378 }
379 if(in_array(self::PROGRESS_FILTER_FAILED, $filter))
380 {
381 $GLOBALS['log']->write(__METHOD__.': Filtering failed.');
382 $filter_users = array_merge($filter, ilLPStatusWrapper::_getFailed($obj_id));
383 }
384
385 // Build intersection
386 return array_intersect($all_users, $filter_users);
387 }
_getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
_getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
_getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS, ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getFailed(), and ilLPStatusWrapper\_getInProgress().

+ Here is the call graph for this function:

◆ deleteScorm2004Tracking()

ilSoapLearningProgressAdministration::deleteScorm2004Tracking (   $a_obj_id,
  $a_usr_ids 
)
protected

Delete scorm 2004 tracking.

Parameters
type$a_obj_id
type$a_usr_ids

Definition at line 412 of file class.ilSoapLearningProgressAdministration.php.

413 {
414 global $ilDB;
415
416 $query = 'SELECT cp_node_id FROM cp_node '.
417 'WHERE nodename = '. $ilDB->quote('item','text').' '.
418 'AND cp_node.slm_id = '.$ilDB->quote($a_obj_id,'integer');
419 $res = $ilDB->query($query);
420
421 $scos = array();
422 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
423 {
424 $scos[] = $row->cp_node_id;
425 }
426
427 $query = 'DELETE FROM cmi_node '.
428 'WHERE '.$ilDB->in('user_id',(array) $a_usr_ids,false,'integer').' '.
429 'AND '.$ilDB->in('cp_node_id',$scos,false,'integer');
430 $ilDB->manipulate($query);
431
432 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

◆ deleteScormTracking()

ilSoapLearningProgressAdministration::deleteScormTracking (   $a_obj_id,
  $a_usr_ids 
)
protected

Delete SCORM Tracking @global type $ilDB.

Parameters
type$a_obj_id
type$a_usr_ids
Returns
boolean

Definition at line 396 of file class.ilSoapLearningProgressAdministration.php.

397 {
398 global $ilDB;
399
400 $query = 'DELETE FROM scorm_tracking '.
401 'WHERE '.$ilDB->in('user_id',$a_usr_ids,false,'integer').' '.
402 'AND obj_id = '. $ilDB->quote($a_obj_id,'integer').' ';
403 $res = $ilDB->manipulate($query);
404 return true;
405 }

References $ilDB, $query, and $res.

◆ getLearningProgressChanges()

ilSoapLearningProgressAdministration::getLearningProgressChanges (   $sid,
  $timestamp,
  $include_ref_ids,
  $type_filter 
)

Get learning progress changes.

Definition at line 437 of file class.ilSoapLearningProgressAdministration.php.

438 {
439 $this->initAuth($sid);
440 $this->initIlias();
441
442 if(!$this->__checkSession($sid))
443 {
444 return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
445 }
446 global $rbacsystem, $tree, $ilLog;
447
448 // check administrator
449 $types = "";
450 if (is_array($type_filter))
451 {
452 $types = implode($type_filter, ",");
453 }
454
455 // output lp changes as xml
456 try
457 {
458 include_once './Services/Tracking/classes/class.ilLPXmlWriter.php';
459 $writer = new ilLPXmlWriter(true);
460 $writer->setTimestamp($timestamp);
461 $writer->setIncludeRefIds($include_ref_ids);
462 $writer->setTypeFilter($type_filter);
463 $writer->write();
464
465 return $writer->xmlDumpMem(true);
466 }
467 catch(UnexpectedValueException $e)
468 {
469 return $this->__raiseError($e->getMessage(), 'Client');
470 }
471 }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
XML writer learning progress.
__raiseError($a_message, $a_code)

References $ilLog, $timestamp, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilSoapAdministration\initAuth(), and ilSoapAdministration\initIlias().

+ Here is the call graph for this function:

◆ getProgressInfo()

ilSoapLearningProgressAdministration::getProgressInfo (   $sid,
  $a_ref_id,
  $a_progress_filter 
)

Definition at line 172 of file class.ilSoapLearningProgressAdministration.php.

173 {
174 global $ilAccess;
175 $this->initAuth($sid);
176 $this->initIlias();
177
178 // Check session
179 if(!$this->__checkSession($sid))
180 {
181 return $this->__raiseError('Error '.self::SOAP_LP_ERROR_AUTHENTICATION.':'.$this->__getMessage(),
182 self::SOAP_LP_ERROR_AUTHENTICATION);
183 }
184
185 // Check filter
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 // Check LP enabled
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';
200 $obj = ilObjectFactory::getInstanceByRefId($a_ref_id, false);
201 if(!$obj instanceof ilObject)
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 // check lp available
208 include_once './Services/Tracking/classes/class.ilLPObjSettings.php';
209 $mode = ilLPObjSettings::_lookupDBMode($obj->getId());
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 // check rbac
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';
225 $writer = new ilXmlWriter();
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 {
239 $completed = ilLPStatusWrapper::_getCountCompleted($obj->getId());
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 {
250 $completed = ilLPStatusWrapper::_getCountInProgress($obj->getId());
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 {
261 $completed = ilLPStatusWrapper::_getCountFailed($obj->getId());
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 {
272 $completed = ilLPStatusWrapper::_getCountNotAttempted($obj->getId());
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 {
287 $completed = ilLPStatusWrapper::_getCompleted($obj->getId());
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 {
292 $completed = ilLPStatusWrapper::_getInProgress($obj->getId());
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 {
297 $completed = ilLPStatusWrapper::_getFailed($obj->getId());
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 {
302 $completed = ilLPStatusWrapper::_getNotAttempted($obj->getId());
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.
XML writer class.

References ilSoapAdministration\__getMessage(), ilSoapAdministration\__raiseError(), ilObjUserTracking\_enabledLearningProgress(), ilLPStatusWrapper\_getCompleted(), ilLPStatusWrapper\_getCountCompleted(), ilLPStatusWrapper\_getCountFailed(), ilLPStatusWrapper\_getCountInProgress(), ilLPStatusWrapper\_getCountNotAttempted(), ilLPStatusWrapper\_getFailed(), ilLPStatusWrapper\_getInProgress(), ilLPStatusWrapper\_getNotAttempted(), ilLPObjSettings\_lookupDBMode(), addUserProgress(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilLPObjSettings\LP_MODE_UNDEFINED.

+ Here is the call graph for this function:

Field Documentation

◆ $DELETE_PROGRESS_FILTER_TYPES

ilSoapLearningProgressAdministration::$DELETE_PROGRESS_FILTER_TYPES = array('sahs', 'tst')
staticprotected

◆ $PROGRESS_INFO_TYPES

ilSoapLearningProgressAdministration::$PROGRESS_INFO_TYPES
staticprotected
Initial value:
= array(
self::PROGRESS_FILTER_ALL,
self::PROGRESS_FILTER_IN_PROGRESS,
self::PROGRESS_FILTER_COMPLETED,
self::PROGRESS_FILTER_FAILED,
self::PROGRESS_FILTER_NOT_ATTEMPTED
)

Definition at line 31 of file class.ilSoapLearningProgressAdministration.php.

◆ PROGRESS_FILTER_ALL

const ilSoapLearningProgressAdministration::PROGRESS_FILTER_ALL = 0

◆ PROGRESS_FILTER_COMPLETED

const ilSoapLearningProgressAdministration::PROGRESS_FILTER_COMPLETED = 2

◆ PROGRESS_FILTER_FAILED

const ilSoapLearningProgressAdministration::PROGRESS_FILTER_FAILED = 3

◆ PROGRESS_FILTER_IN_PROGRESS

const ilSoapLearningProgressAdministration::PROGRESS_FILTER_IN_PROGRESS = 1

◆ PROGRESS_FILTER_NOT_ATTEMPTED

const ilSoapLearningProgressAdministration::PROGRESS_FILTER_NOT_ATTEMPTED = 4

◆ SOAP_LP_ERROR_AUTHENTICATION

const ilSoapLearningProgressAdministration::SOAP_LP_ERROR_AUTHENTICATION = 50

◆ SOAP_LP_ERROR_INVALID_FILTER

const ilSoapLearningProgressAdministration::SOAP_LP_ERROR_INVALID_FILTER = 52

◆ SOAP_LP_ERROR_INVALID_REF_ID

const ilSoapLearningProgressAdministration::SOAP_LP_ERROR_INVALID_REF_ID = 54

◆ SOAP_LP_ERROR_LP_NOT_AVAILABLE

const ilSoapLearningProgressAdministration::SOAP_LP_ERROR_LP_NOT_AVAILABLE = 56

◆ SOAP_LP_ERROR_LP_NOT_ENABLED

const ilSoapLearningProgressAdministration::SOAP_LP_ERROR_LP_NOT_ENABLED = 60

◆ SOAP_LP_ERROR_NO_PERMISSION

const ilSoapLearningProgressAdministration::SOAP_LP_ERROR_NO_PERMISSION = 58

◆ USER_FILTER_ALL

const ilSoapLearningProgressAdministration::USER_FILTER_ALL = -1

The documentation for this class was generated from the following file: