5include_once 
'./webservice/soap/classes/class.ilSoapAdministration.php';
 
   32                self::PROGRESS_FILTER_ALL,
 
   33                self::PROGRESS_FILTER_IN_PROGRESS,
 
   34                self::PROGRESS_FILTER_COMPLETED,
 
   35                self::PROGRESS_FILTER_FAILED,
 
   36                self::PROGRESS_FILTER_NOT_ATTEMPTED
 
   47        public function deleteProgress($sid, $ref_ids, $usr_ids, $type_filter, $progress_filter)
 
   52                if(!is_array($usr_ids))
 
   54                        $usr_ids = (array)$usr_ids;
 
   56                if(!is_array($type_filter))
 
   58                        $type_filter = (array)$type_filter;
 
   62                if(!$this->__checkSession($sid))
 
   68                if(array_diff((array) $type_filter, self::$DELETE_PROGRESS_FILTER_TYPES))
 
   70                        return $this->
__raiseError(
'Invalid filter type given', 
'Client');
 
   73                include_once 
'Services/User/classes/class.ilObjUser.php';
 
   76                        return $this->
__raiseError(
'Invalid user ids given', 
'Client');
 
   79                $valid_refs = array();
 
   80                foreach((array) $ref_ids as 
$ref_id)
 
   86                        if(
$GLOBALS[
'objDefinition']->isContainer($type))
 
   88                                $all_sub_objs = array();
 
   89                                foreach(($type_filter) as $type_filter_item)
 
   91                                        $sub_objs = 
$GLOBALS[
'tree']->getSubTree(
 
   96                                        $all_sub_objs = array_merge($all_sub_objs, $sub_objs);
 
   99                                foreach($all_sub_objs as $child_ref)
 
  102                                        if(!
$GLOBALS[
'ilAccess']->checkAccess(
'write', 
'', $child_ref))
 
  104                                                return $this->
__raiseError(
'Permission denied for : '. $ref_id.
' -> type '.$type, 
'Client');
 
  106                                        $valid_refs[] = $child_ref;
 
  110                        elseif(in_array($type, $type_filter))
 
  114                                        return $this->
__raiseError(
'Permission denied for : '. $ref_id.
' -> type '.$type, 
'Client');
 
  120                                return $this->
__raiseError(
'Invalid object type given for : '. $ref_id.
' -> type '.$type, 
'Client');
 
  125                foreach($valid_refs as 
$ref_id)
 
  127                        include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  132                                return $this->
__raiseError(
'Invalid reference id given : '. $ref_id.
' -> type '.$type, 
'Client');
 
  136                        $valid_users = $this->
applyProgressFilter($obj->getId(), (array) $usr_ids, (array) $progress_filter);
 
  138                        switch($obj->getType())
 
  141                                        include_once 
'./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
 
  159                                        $obj->removeTestResultsFromSoapLpAdministration(array_values((array)$valid_users));
 
  164                        include_once 
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
 
  179                if(!$this->__checkSession($sid))
 
  182                                self::SOAP_LP_ERROR_AUTHENTICATION);
 
  186                if(array_diff((array) $a_progress_filter, self::$PROGRESS_INFO_TYPES))
 
  188                        return $this->
__raiseError(
'Error '.self::SOAP_LP_ERROR_INVALID_FILTER.
': Invalid filter type given',
 
  189                                self::SOAP_LP_ERROR_INVALID_FILTER);
 
  192                include_once(
"Services/Tracking/classes/class.ilObjUserTracking.php");
 
  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);
 
  199                include_once 
'./Services/Object/classes/class.ilObjectFactory.php';
 
  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);
 
  208                include_once 
'./Services/Tracking/classes/class.ilLPObjSettings.php';
 
  212                        return $this->
__raiseError(
'Error '.self::SOAP_LP_ERROR_LP_NOT_AVAILABLE.
': Learning progress not available for objects of type '.
 
  214                                self::SOAP_LP_ERROR_LP_NOT_AVAILABLE);
 
  218                if(!$ilAccess->checkAccess(
'edit_learning_progress',
'',$a_ref_id))
 
  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);
 
  224                include_once 
'./Services/Xml/classes/class.ilXmlWriter.php';
 
  226                $writer->xmlStartTag(
 
  227                                'LearningProgressInfo',
 
  229                                        'ref_id' => $obj->getRefId(),
 
  230                                        'type' => $obj->getType()
 
  234                $writer->xmlStartTag(
'LearningProgressSummary');
 
  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))
 
  243                                                'type'  => self::PROGRESS_FILTER_COMPLETED,
 
  244                                                'num'   => (
int) $completed
 
  248                if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_IN_PROGRESS, $a_progress_filter))
 
  254                                                'type'  => self::PROGRESS_FILTER_IN_PROGRESS,
 
  255                                                'num'   => (
int) $completed
 
  259                if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_FAILED, $a_progress_filter))
 
  265                                                'type'  => self::PROGRESS_FILTER_FAILED,
 
  266                                                'num'   => (
int) $completed
 
  270                if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_NOT_ATTEMPTED, $a_progress_filter))
 
  276                                                'type'  => self::PROGRESS_FILTER_NOT_ATTEMPTED,
 
  277                                                'num'   => (
int) $completed
 
  281                $writer->xmlEndTag(
'LearningProgressSummary');
 
  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))
 
  288                        $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_COMPLETED);
 
  290                if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_IN_PROGRESS, $a_progress_filter))
 
  293                        $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_IN_PROGRESS);
 
  295                if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_FAILED, $a_progress_filter))
 
  298                        $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_FAILED);
 
  300                if(in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_NOT_ATTEMPTED, $a_progress_filter))
 
  303                        $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_NOT_ATTEMPTED);
 
  305                $writer->xmlEndTag(
'UserProgress');
 
  306                $writer->xmlEndTag(
'LearningProgressInfo');
 
  308                return $writer->xmlDumpMem();
 
  313                foreach($users  as $user_id)
 
  343                include_once 
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
 
  346                $all_users = array();
 
  347                if(in_array(self::USER_FILTER_ALL, $usr_ids))
 
  349                        $all_users = array_unique(
 
  359                        $all_users = $usr_ids;
 
  362                if(!$filter or in_array(self::PROGRESS_FILTER_ALL, $filter))
 
  364                        $GLOBALS[
'log']->write(__METHOD__.
': Deleting all progress data');
 
  368                $filter_users = array();
 
  369                if(in_array(self::PROGRESS_FILTER_IN_PROGRESS, $filter))
 
  371                        $GLOBALS[
'log']->write(__METHOD__.
': Filtering  in progress.');
 
  374                if(in_array(self::PROGRESS_FILTER_COMPLETED, $filter))
 
  376                        $GLOBALS[
'log']->write(__METHOD__.
': Filtering  completed.');
 
  379                if(in_array(self::PROGRESS_FILTER_FAILED, $filter))
 
  381                        $GLOBALS[
'log']->write(__METHOD__.
': Filtering  failed.');
 
  386                return array_intersect($all_users, $filter_users);
 
  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').
' ';
 
  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');
 
  424                        $scos[] = 
$row->cp_node_id;
 
  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');
 
  442                if(!$this->__checkSession($sid))
 
  446                global $rbacsystem, $tree, 
$ilLog;
 
  450                if (is_array($type_filter))
 
  452                        $types = implode($type_filter, 
",");
 
  458                        include_once 
'./Services/Tracking/classes/class.ilLPXmlWriter.php';
 
  461                        $writer->setIncludeRefIds($include_ref_ids);
 
  462                        $writer->setTypeFilter($type_filter);
 
  465                        return $writer->xmlDumpMem(
true);
 
  467                catch(UnexpectedValueException $e)
 
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
static _lookupDBMode($a_obj_id)
static _getNotAttempted($a_obj_id)
Static function to read the number of user who have the status 'not_attempted'.
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
static _resetInfoCaches($a_obj_id)
static _getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getCountCompleted($a_obj_id)
Static function to read the number of user who have the status 'completed'.
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static _getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
static _getCountNotAttempted($a_obj_id)
Static function to read the number of user who have the status 'not_attempted'.
static _getCountInProgress($a_obj_id)
Static function to read the number of user who have the status 'in_progress'.
static _getCountFailed($a_obj_id)
Static function to read the number of user who have the status 'failed'.
XML writer learning progress.
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, aicc, hacp)
static _enabledLearningProgress()
check wether learing progress is enabled or not
static userExists($a_usr_ids=array())
static _lookupName($a_user_id)
lookup user name
static 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.
static _lookupObjId($a_id)
static _lookupType($a_id, $a_reference=false)
lookup object type
initAuth($sid)
Init authentication.
__raiseError($a_message, $a_code)
This class handles all DB changes necessary for fraunhofer.
const PROGRESS_FILTER_IN_PROGRESS
const SOAP_LP_ERROR_LP_NOT_AVAILABLE
const PROGRESS_FILTER_COMPLETED
const PROGRESS_FILTER_NOT_ATTEMPTED
deleteScorm2004Tracking($a_obj_id, $a_usr_ids)
Delete scorm 2004 tracking.
const SOAP_LP_ERROR_LP_NOT_ENABLED
addUserProgress(ilXmlWriter $writer, $users, $a_type)
getProgressInfo($sid, $a_ref_id, $a_progress_filter)
getLearningProgressChanges($sid, $timestamp, $include_ref_ids, $type_filter)
Get learning progress changes.
applyProgressFilter($obj_id, Array $usr_ids, Array $filter)
Apply progress filter.
const PROGRESS_FILTER_ALL
const PROGRESS_FILTER_FAILED
const SOAP_LP_ERROR_INVALID_REF_ID
const SOAP_LP_ERROR_INVALID_FILTER
static $PROGRESS_INFO_TYPES
static $DELETE_PROGRESS_FILTER_TYPES
const SOAP_LP_ERROR_AUTHENTICATION
const SOAP_LP_ERROR_NO_PERMISSION
deleteScormTracking($a_obj_id, $a_usr_ids)
Delete SCORM Tracking @global type $ilDB.
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)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.