ILIAS  release_8 Revision v8.24
ilSoapLearningProgressAdministration Class Reference

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

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

Public Member Functions

 getLearningProgressChanges (string $sid, string $timestamp, bool $include_ref_ids, array $type_filter)
 
- Public Member Functions inherited from ilSoapAdministration
 __construct (bool $use_nusoap=true)
 
 getMessage ()
 
 appendMessage (string $a_str)
 
 setMessageCode (string $a_code)
 
 getMessageCode ()
 
 reInitUser ()
 
 isFault ($object)
 
 getInstallationInfoXML ()
 
 getClientInfoXML (string $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
const NUSOAP = 1
 
const PHP5 = 2
 
int $error_method
 Defines type of error handling (PHP5 || NUSOAP) More...
 

Protected Member Functions

 addUserProgress (ilXmlWriter $writer, array $users, int $a_type)
 
 applyProgressFilter (int $obj_id, array $usr_ids, array $filter)
 Apply progress filter. More...
 
 deleteScormTracking (int $a_obj_id, array $a_usr_ids)
 Delete SCORM Tracking. More...
 
 deleteScorm2004Tracking (int $a_obj_id, array $a_usr_ids)
 Delete scorm 2004 tracking. More...
 
- Protected Member Functions inherited from ilSoapAdministration
 checkSession (string $sid)
 
 explodeSid (string $sid)
 
 setMessage (string $a_str)
 
 initAuth (string $sid)
 
 initIlias ()
 
 initAuthenticationObject ()
 
 raiseError (string $a_message, $a_code)
 
 checkObjectAccess (int $ref_id, array $expected_type, string $permission, bool $returnObject=false)
 check access for ref id: expected type, permission, return object instance if returnobject is true More...
 

Static Protected Attributes

static array $DELETE_PROGRESS_FILTER_TYPES = ['sahs', 'tst']
 
static array $PROGRESS_INFO_TYPES
 

Additional Inherited Members

- Protected Attributes inherited from ilSoapAdministration
bool $soap_check = true
 
string $message = ''
 
string $message_code = ''
 

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 12 of file class.ilSoapLearningProgressAdministration.php.

Member Function Documentation

◆ addUserProgress()

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

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

384 : void
385 {
386 foreach ($users as $user_id) {
387 $writer->xmlStartTag(
388 'User',
389 array(
390 'id' => $user_id,
391 'status' => $a_type
392 )
393 );
394
395 $info = ilObjUser::_lookupName($user_id);
396 $writer->xmlElement('Login', array(), (string) $info['login']);
397 $writer->xmlElement('Firstname', array(), (string) $info['firstname']);
398 $writer->xmlElement('Lastname', array(), (string) $info['lastname']);
399 $writer->xmlEndTag('User');
400 }
401 }
static _lookupName(int $a_user_id)
lookup user name
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
xmlEndTag(string $tag)
Writes an endtag.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.

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

+ Here is the call graph for this function:

◆ applyProgressFilter()

ilSoapLearningProgressAdministration::applyProgressFilter ( int  $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 410 of file class.ilSoapLearningProgressAdministration.php.

410 : array
411 {
412 include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
413
414 $all_users = array();
415 if (in_array(self::USER_FILTER_ALL, $usr_ids)) {
416 $all_users = array_unique(
417 array_merge(
421 )
422 );
423 } else {
424 $all_users = $usr_ids;
425 }
426
427 if (!$filter || in_array(self::PROGRESS_FILTER_ALL, $filter)) {
428 $GLOBALS['DIC']['log']->write(__METHOD__ . ': Deleting all progress data');
429 return $all_users;
430 }
431
432 $filter_users = array();
433 if (in_array(self::PROGRESS_FILTER_IN_PROGRESS, $filter)) {
434 $GLOBALS['DIC']['log']->write(__METHOD__ . ': Filtering in progress.');
435 $filter_users = array_merge($filter, ilLPStatusWrapper::_getInProgress($obj_id));
436 }
437 if (in_array(self::PROGRESS_FILTER_COMPLETED, $filter)) {
438 $GLOBALS['DIC']['log']->write(__METHOD__ . ': Filtering completed.');
439 $filter_users = array_merge($filter, ilLPStatusWrapper::_getCompleted($obj_id));
440 }
441 if (in_array(self::PROGRESS_FILTER_FAILED, $filter)) {
442 $GLOBALS['DIC']['log']->write(__METHOD__ . ': Filtering failed.');
443 $filter_users = array_merge($filter, ilLPStatusWrapper::_getFailed($obj_id));
444 }
445
446 // Build intersection
447 return array_intersect($all_users, $filter_users);
448 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static _getInProgress(int $a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getFailed(int $a_obj_id)
Static function to read the users who have the status 'completed'.
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.

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

+ Here is the call graph for this function:

◆ deleteScorm2004Tracking()

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

Delete scorm 2004 tracking.

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

469 : void
470 {
471 global $DIC;
472
473 $ilDB = $DIC['ilDB'];
474
475 $query = 'SELECT cp_node_id FROM cp_node ' .
476 'WHERE nodename = ' . $ilDB->quote('item', 'text') . ' ' .
477 'AND cp_node.slm_id = ' . $ilDB->quote($a_obj_id, 'integer');
478 $res = $ilDB->query($query);
479
480 $scos = array();
481 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
482 $scos[] = $row->cp_node_id;
483 }
484
485 $query = 'DELETE FROM cmi_node ' .
486 'WHERE ' . $ilDB->in('user_id', $a_usr_ids, false, 'integer') . ' ' .
487 'AND ' . $ilDB->in('cp_node_id', $scos, false, 'integer');
488 $ilDB->manipulate($query);
489 }
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

◆ deleteScormTracking()

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

Delete SCORM Tracking.

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

453 : bool
454 {
455 global $DIC;
456
457 $ilDB = $DIC['ilDB'];
458
459 $query = 'DELETE FROM scorm_tracking ' .
460 'WHERE ' . $ilDB->in('user_id', $a_usr_ids, false, 'integer') . ' ' .
461 'AND obj_id = ' . $ilDB->quote($a_obj_id, 'integer') . ' ';
462 $res = $ilDB->manipulate($query);
463 return true;
464 }

References $DIC, $ilDB, $query, and $res.

◆ getLearningProgressChanges()

ilSoapLearningProgressAdministration::getLearningProgressChanges ( string  $sid,
string  $timestamp,
bool  $include_ref_ids,
array  $type_filter 
)
Parameters
string[]$type_filter
Returns
soap_fault|SoapFault|string|null

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

496 {
497 $this->initAuth($sid);
498 $this->initIlias();
499
500 if (!$this->checkSession($sid)) {
501 return $this->raiseError($this->getMessage(), $this->getMessageCode());
502 }
503 global $DIC;
504
505 $rbacsystem = $DIC['rbacsystem'];
506 $tree = $DIC['tree'];
507 $ilLog = $DIC['ilLog'];
508
509 // check administrator
510 $types = "";
511 if (is_array($type_filter)) {
512 $types = implode(",", $type_filter);
513 }
514
515 // output lp changes as xml
516 try {
517 include_once './Services/Tracking/classes/class.ilLPXmlWriter.php';
518 $writer = new ilLPXmlWriter(true);
519 $writer->setTimestamp($timestamp);
520 $writer->setIncludeRefIds($include_ref_ids);
521 $writer->setTypeFilter($type_filter);
522 $writer->write();
523
524 return $writer->xmlDumpMem(true);
525 } catch (UnexpectedValueException $e) {
526 return $this->raiseError($e->getMessage(), 'Client');
527 }
528 }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70
XML writer learning progress.
raiseError(string $a_message, $a_code)

References $DIC, Vendor\Package\$e, $timestamp, ilSoapAdministration\checkSession(), ilSoapAdministration\getMessage(), ilSoapAdministration\getMessageCode(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilSoapAdministration\raiseError().

+ Here is the call graph for this function:

Field Documentation

◆ $DELETE_PROGRESS_FILTER_TYPES

array ilSoapLearningProgressAdministration::$DELETE_PROGRESS_FILTER_TYPES = ['sahs', 'tst']
staticprotected

◆ $PROGRESS_INFO_TYPES

◆ 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: