5 include_once
'./webservice/soap/classes/class.ilSoapAdministration.php';
29 public function deleteProgress($sid, $ref_ids, $usr_ids, $type_filter, $progress_filter)
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
'./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';
155 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
158 $all_users = array();
159 if(in_array(self::USER_FILTER_ALL, $usr_ids))
161 $all_users = array_unique(
171 $all_users = $usr_ids;
174 if(!$filter or in_array(self::PROGRESS_FILTER_ALL, $filter))
176 $GLOBALS[
'log']->write(__METHOD__.
': Deleting all progress data');
180 $filter_users = array();
181 if(in_array(self::PROGRESS_FILTER_IN_PROGRESS, $filter))
183 $GLOBALS[
'log']->write(__METHOD__.
': Filtering in progress.');
186 if(in_array(self::PROGRESS_FILTER_COMPLETED, $filter))
188 $GLOBALS[
'log']->write(__METHOD__.
': Filtering completed.');
191 if(in_array(self::PROGRESS_FILTER_FAILED, $filter))
193 $GLOBALS[
'log']->write(__METHOD__.
': Filtering failed.');
198 return array_intersect($all_users, $filter_users);
212 $query =
'DELETE FROM scorm_tracking '.
213 'WHERE '.$ilDB->in(
'user_id',$a_usr_ids,
false,
'integer').
' '.
214 'AND obj_id = '. $ilDB->quote($a_obj_id,
'integer').
' ';
228 $query =
'SELECT cp_node_id FROM cp_node '.
229 'WHERE nodename = '. $ilDB->quote(
'item',
'text').
' '.
230 'AND cp_node.slm_id = '.$ilDB->quote($a_obj_id,
'integer');
236 $scos[] =
$row->cp_node_id;
239 $query =
'DELETE FROM cmi_node '.
240 'WHERE '.$ilDB->in(
'user_id',(array) $a_usr_ids,
false,
'integer').
' '.
241 'AND '.$ilDB->in(
'cp_node_id',$scos,
false,
'integer');
242 $ilDB->manipulate(
$query);