5 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
29 public function deleteProgress($sid, $ref_ids, $usr_ids, $type_filter, $progress_filter)
35 if(!$this->__checkSession($sid))
41 if(array_diff((array) $type_filter, self::$DELETE_PROGRESS_FILTER_TYPES))
43 return $this->
__raiseError(
'Invalid filter type given',
'Client');
46 include_once
'Services/User/classes/class.ilObjUser.php';
49 return $this->
__raiseError(
'Invalid user ids given',
'Client');
52 $valid_refs = array();
53 foreach((array) $ref_ids as
$ref_id)
59 if(
$GLOBALS[
'objDefinition']->isContainer($type))
61 $all_sub_objs = array();
62 foreach(($type_filter) as $type_filter_item)
64 $sub_objs =
$GLOBALS[
'tree']->getSubTree(
65 $GLOBALS[
'tree']->getNodeData($ref_id),
69 $all_sub_objs = array_merge($all_sub_objs, $sub_objs);
72 foreach($all_sub_objs as $child_ref)
75 if(!
$GLOBALS[
'ilAccess']->checkAccess(
'write',
'', $child_ref))
77 return $this->
__raiseError(
'Permission denied for : '. $ref_id.
' -> type '.$type,
'Client');
79 $valid_refs[] = $child_ref;
83 elseif(in_array($type, $type_filter))
85 if(!
$GLOBALS[
'ilAccess']->checkAccess(
'write',
'',$ref_id))
87 return $this->
__raiseError(
'Permission denied for : '. $ref_id.
' -> type '.$type,
'Client');
93 return $this->
__raiseError(
'Invalid object type given for : '. $ref_id.
' -> type '.$type,
'Client');
98 foreach($valid_refs as $ref_id)
100 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
105 return $this->
__raiseError(
'Invalid reference id given : '. $ref_id.
' -> type '.$type,
'Client');
109 $valid_users = $this->
applyProgressFilter($obj->getId(), (array) $usr_ids, (array) $progress_filter);
111 switch($obj->getType())
114 include_once
'./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
130 foreach((array) $valid_users as $usr_id)
132 $obj->removeTestResultsForUser($usr_id);
138 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
156 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
159 $all_users = array();
160 if(in_array(self::USER_FILTER_ALL, $usr_ids))
162 $all_users = array_unique(
172 $all_users = $usr_ids;
175 if(!$filter or in_array(self::PROGRESS_FILTER_ALL, $filter))
177 $GLOBALS[
'log']->write(__METHOD__.
': Deleting all progress data');
181 $filter_users = array();
182 if(in_array(self::PROGRESS_FILTER_IN_PROGRESS, $filter))
184 $GLOBALS[
'log']->write(__METHOD__.
': Filtering in progress.');
187 if(in_array(self::PROGRESS_FILTER_COMPLETED, $filter))
189 $GLOBALS[
'log']->write(__METHOD__.
': Filtering completed.');
192 if(in_array(self::PROGRESS_FILTER_FAILED, $filter))
194 $GLOBALS[
'log']->write(__METHOD__.
': Filtering failed.');
199 return array_intersect($all_users, $filter_users);
213 $query =
'DELETE FROM scorm_tracking '.
214 'WHERE '.$ilDB->in(
'user_id',$a_usr_ids,
false,
'integer').
' '.
215 'AND obj_id = '. $ilDB->quote($a_obj_id,
'integer').
' ';
229 $query =
'SELECT cp_node_id FROM cp_node '.
230 'WHERE nodename = '. $ilDB->quote(
'item',
'text').
' '.
231 'AND cp_node.slm_id = '.$ilDB->quote($a_obj_id,
'integer');
237 $scos[] =
$row->cp_node_id;
240 $query =
'DELETE FROM cmi_node '.
241 'WHERE '.$ilDB->in(
'user_id',(array) $a_usr_ids,
false,
'integer').
' '.
242 'AND '.$ilDB->in(
'cp_node_id',$scos,
false,
'integer');
243 $ilDB->manipulate(
$query);
255 if(!$this->__checkSession($sid))
259 global $rbacsystem, $tree,
$ilLog;
263 if (is_array($type_filter))
265 $types = implode($type_filter,
",");
271 include_once
'./Services/Tracking/classes/class.ilLPXmlWriter.php';
274 $writer->setIncludeRefIds($include_ref_ids);
275 $writer->setTypeFilter($type_filter);
278 return $writer->xmlDumpMem(
true);
280 catch(UnexpectedValueException $e)