ILIAS  trunk Revision v11.0_alpha-1861-g09f3d197f78
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilSoapLearningProgressAdministration Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. 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 file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning 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 24 of file class.ilSoapLearningProgressAdministration.php.

Member Function Documentation

◆ addUserProgress()

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

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

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

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

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

413  : array
414  {
415  $all_users = array();
416  if (in_array(self::USER_FILTER_ALL, $usr_ids)) {
417  $all_users = array_unique(
418  array_merge(
422  )
423  );
424  } else {
425  $all_users = $usr_ids;
426  }
427 
428  if (!$filter || in_array(self::PROGRESS_FILTER_ALL, $filter)) {
429  $GLOBALS['DIC']['log']->write(__METHOD__ . ': Deleting all progress data');
430  return $all_users;
431  }
432 
433  $filter_users = array();
434  if (in_array(self::PROGRESS_FILTER_IN_PROGRESS, $filter)) {
435  $GLOBALS['DIC']['log']->write(__METHOD__ . ': Filtering in progress.');
436  $filter_users = array_merge($filter, ilLPStatusWrapper::_getInProgress($obj_id));
437  }
438  if (in_array(self::PROGRESS_FILTER_COMPLETED, $filter)) {
439  $GLOBALS['DIC']['log']->write(__METHOD__ . ': Filtering completed.');
440  $filter_users = array_merge($filter, ilLPStatusWrapper::_getCompleted($obj_id));
441  }
442  if (in_array(self::PROGRESS_FILTER_FAILED, $filter)) {
443  $GLOBALS['DIC']['log']->write(__METHOD__ . ': Filtering failed.');
444  $filter_users = array_merge($filter, ilLPStatusWrapper::_getFailed($obj_id));
445  }
446 
447  // Build intersection
448  return array_intersect($all_users, $filter_users);
449  }
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.
static _getInProgress(int $a_obj_id)
Static function to read users who have the status 'in_progress'.
$GLOBALS["DIC"]
Definition: wac.php:53
static _getFailed(int $a_obj_id)
Static function to read the users who have the status 'completed'.
+ 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 470 of file class.ilSoapLearningProgressAdministration.php.

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

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

◆ deleteScormTracking()

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

Delete SCORM Tracking.

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

References $DIC, $ilDB, and $res.

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

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

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

497  {
498  $this->initAuth($sid);
499  $this->initIlias();
500 
501  if (!$this->checkSession($sid)) {
502  return $this->raiseError($this->getMessage(), $this->getMessageCode());
503  }
504  global $DIC;
505 
506  $rbacsystem = $DIC['rbacsystem'];
507  $tree = $DIC['tree'];
508  $ilLog = $DIC['ilLog'];
509 
510  // check administrator
511  $types = "";
512  if (is_array($type_filter)) {
513  $types = implode(",", $type_filter);
514  }
515 
516  // output lp changes as xml
517  try {
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  }
raiseError(string $a_message, $a_code)
XML writer learning progress.
global $DIC
Definition: shib_login.php:22
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:70
+ 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

array ilSoapLearningProgressAdministration::$PROGRESS_INFO_TYPES
staticprotected
Initial value:
= [
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 43 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: