ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilSoapLearningProgressAdministration Class Reference

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

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

Public Member Functions

 deleteProgress ($sid, $ref_ids, $usr_ids, $type_filter, $progress_filter)
 Delete progress of users and objects Implemented for.
 getLearningProgressChanges ($sid, $timestamp, $include_ref_ids, $type_filter)
 Get learning progress changes.
- Public Member Functions inherited from ilSoapAdministration
 ilSoapAdministration ($use_nusoap=true)
 initErrorWriter ()
 Overwrite error handler.
 __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
 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
 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 USER_FILTER_ALL = -1
- Data Fields inherited from ilSoapAdministration
 $sauth = null
 $error_method = null

Protected Member Functions

 applyProgressFilter ($obj_id, Array $usr_ids, Array $filter)
 Apply progress filter.
 deleteScormTracking ($a_obj_id, $a_usr_ids)
 Delete SCORM Tracking type $ilDB.
 deleteScorm2004Tracking ($a_obj_id, $a_usr_ids)
 Delete scorm 2004 tracking.

Static Protected Attributes

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

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
- 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:
class.ilSoapLearningProgressAdministration.php 60574 2015-09-01 12:41:14Z gitmgr

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

Member Function Documentation

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

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

Referenced by deleteProgress().

{
include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
$all_users = array();
if(in_array(self::USER_FILTER_ALL, $usr_ids))
{
$all_users = array_unique(
array_merge(
)
);
}
else
{
$all_users = $usr_ids;
}
if(!$filter or in_array(self::PROGRESS_FILTER_ALL, $filter))
{
$GLOBALS['log']->write(__METHOD__.': Deleting all progress data');
return $all_users;
}
$filter_users = array();
if(in_array(self::PROGRESS_FILTER_IN_PROGRESS, $filter))
{
$GLOBALS['log']->write(__METHOD__.': Filtering in progress.');
$filter_users = array_merge($filter, ilLPStatusWrapper::_getInProgress($obj_id));
}
if(in_array(self::PROGRESS_FILTER_COMPLETED, $filter))
{
$GLOBALS['log']->write(__METHOD__.': Filtering completed.');
$filter_users = array_merge($filter, ilLPStatusWrapper::_getCompleted($obj_id));
}
if(in_array(self::PROGRESS_FILTER_FAILED, $filter))
{
$GLOBALS['log']->write(__METHOD__.': Filtering failed.');
$filter_users = array_merge($filter, ilLPStatusWrapper::_getFailed($obj_id));
}
// Build intersection
return array_intersect($all_users, $filter_users);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilSoapLearningProgressAdministration::deleteProgress (   $sid,
  $ref_ids,
  $usr_ids,
  $type_filter,
  $progress_filter 
)

Delete progress of users and objects Implemented for.

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

References $GLOBALS, $ref_id, ilSoapAdministration\__getMessage(), ilSoapAdministration\__getMessageCode(), ilSoapAdministration\__raiseError(), ilObject\_lookupObjId(), ilObjSAHSLearningModule\_lookupSubType(), ilObject\_lookupType(), ilLPStatusWrapper\_refreshStatus(), ilLPStatusWrapper\_resetInfoCaches(), applyProgressFilter(), deleteScorm2004Tracking(), deleteScormTracking(), ilObjectFactory\getInstanceByRefId(), ilSoapAdministration\initAuth(), ilSoapAdministration\initIlias(), and ilObjUser\userExists().

{
$this->initAuth($sid);
$this->initIlias();
// Check session
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
// Check filter
if(array_diff((array) $type_filter, self::$DELETE_PROGRESS_FILTER_TYPES))
{
return $this->__raiseError('Invalid filter type given', 'Client');
}
include_once 'Services/User/classes/class.ilObjUser.php';
if(!in_array(self::USER_FILTER_ALL, $usr_ids) and !ilObjUser::userExists($usr_ids))
{
return $this->__raiseError('Invalid user ids given', 'Client');
}
$valid_refs = array();
foreach((array) $ref_ids as $ref_id)
{
$obj_id = ilObject::_lookupObjId($ref_id);
$type = ilObject::_lookupType($obj_id);
// All containers
if($GLOBALS['objDefinition']->isContainer($type))
{
$all_sub_objs = array();
foreach(($type_filter) as $type_filter_item)
{
$sub_objs = $GLOBALS['tree']->getSubTree(
$GLOBALS['tree']->getNodeData($ref_id),
false,
$type_filter_item
);
$all_sub_objs = array_merge($all_sub_objs, $sub_objs);
}
foreach($all_sub_objs as $child_ref)
{
$child_type = ilObject::_lookupType(ilObject::_lookupObjId($child_ref));
if(!$GLOBALS['ilAccess']->checkAccess('write', '', $child_ref))
{
return $this->__raiseError('Permission denied for : '. $ref_id.' -> type '.$type, 'Client');
}
$valid_refs[] = $child_ref;
}
}
elseif(in_array($type, $type_filter))
{
if(!$GLOBALS['ilAccess']->checkAccess('write','',$ref_id))
{
return $this->__raiseError('Permission denied for : '. $ref_id.' -> type '.$type, 'Client');
}
$valid_refs[] = $ref_id;
}
else
{
return $this->__raiseError('Invalid object type given for : '. $ref_id.' -> type '.$type, 'Client');
}
}
// Delete tracking data
foreach($valid_refs as $ref_id)
{
include_once './Services/Object/classes/class.ilObjectFactory.php';
$obj = ilObjectFactory::getInstanceByRefId($ref_id, false);
if(!$obj instanceof ilObject)
{
return $this->__raiseError('Invalid reference id given : '. $ref_id.' -> type '.$type, 'Client');
}
// filter users
$valid_users = $this->applyProgressFilter($obj->getId(), (array) $usr_ids, (array) $progress_filter);
switch($obj->getType())
{
case 'sahs':
include_once './Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
$subtype = ilObjSAHSLearningModule::_lookupSubType($obj->getId());
switch($subtype)
{
case 'scorm':
$this->deleteScormTracking($obj->getId(),(array) $valid_users);
break;
case 'scorm2004':
$this->deleteScorm2004Tracking($obj->getId(), (array) $valid_users);
break;
}
break;
case 'tst':
foreach((array) $valid_users as $usr_id)
{
$obj->removeTestResultsForUser($usr_id);
}
break;
}
// Refresh status
include_once './Services/Tracking/classes/class.ilLPStatusWrapper.php';
ilLPStatusWrapper::_refreshStatus($obj->getId(), $valid_users);
}
return true;
}

+ Here is the call graph for this function:

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

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

Referenced by deleteProgress().

{
global $ilDB;
$query = 'SELECT cp_node_id FROM cp_node '.
'WHERE nodename = '. $ilDB->quote('item','text').' '.
'AND cp_node.slm_id = '.$ilDB->quote($a_obj_id,'integer');
$res = $ilDB->query($query);
$scos = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$scos[] = $row->cp_node_id;
}
$query = 'DELETE FROM cmi_node '.
'WHERE '.$ilDB->in('user_id',(array) $a_usr_ids,false,'integer').' '.
'AND '.$ilDB->in('cp_node_id',$scos,false,'integer');
$ilDB->manipulate($query);
}

+ Here is the caller graph for this function:

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

Delete SCORM Tracking type $ilDB.

Parameters
type$a_obj_id
type$a_usr_ids
Returns
boolean

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

References $ilDB, $query, and $res.

Referenced by deleteProgress().

{
global $ilDB;
$query = 'DELETE FROM scorm_tracking '.
'WHERE '.$ilDB->in('user_id',$a_usr_ids,false,'integer').' '.
'AND obj_id = '. $ilDB->quote($a_obj_id,'integer').' ';
$res = $ilDB->manipulate($query);
return true;
}

+ Here is the caller graph for this function:

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

Get learning progress changes.

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

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

{
$this->initAuth($sid);
$this->initIlias();
if(!$this->__checkSession($sid))
{
return $this->__raiseError($this->__getMessage(),$this->__getMessageCode());
}
global $rbacsystem, $tree, $ilLog;
// check administrator
$types = "";
if (is_array($type_filter))
{
$types = implode($type_filter, ",");
}
// output lp changes as xml
try
{
include_once './Services/Tracking/classes/class.ilLPXmlWriter.php';
$writer = new ilLPXmlWriter(true);
$writer->setTimestamp($timestamp);
$writer->setIncludeRefIds($include_ref_ids);
$writer->setTypeFilter($type_filter);
$writer->write();
return $writer->xmlDumpMem(true);
}
catch(UnexpectedValueException $e)
{
return $this->__raiseError($e->getMessage(), 'Client');
}
}

+ Here is the call graph for this function:

Field Documentation

ilSoapLearningProgressAdministration::$DELETE_PROGRESS_FILTER_TYPES = array('sahs', 'tst')
staticprotected
const ilSoapLearningProgressAdministration::PROGRESS_FILTER_ALL = 0
const ilSoapLearningProgressAdministration::PROGRESS_FILTER_COMPLETED = 2
const ilSoapLearningProgressAdministration::PROGRESS_FILTER_FAILED = 3
const ilSoapLearningProgressAdministration::PROGRESS_FILTER_IN_PROGRESS = 1
const ilSoapLearningProgressAdministration::USER_FILTER_ALL = -1

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