5 include_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)) {
53 $usr_ids = (array) $usr_ids;
55 if (!is_array($type_filter)) {
56 $type_filter = (array) $type_filter;
60 if (!$this->__checkSession($sid)) {
65 if (array_diff((array) $type_filter, self::$DELETE_PROGRESS_FILTER_TYPES)) {
66 return $this->
__raiseError(
'Invalid filter type given',
'Client');
69 include_once
'Services/User/classes/class.ilObjUser.php';
71 return $this->
__raiseError(
'Invalid user ids given',
'Client');
74 $valid_refs = array();
75 foreach ((array) $ref_ids as $ref_id) {
81 $all_sub_objs = array();
82 foreach (($type_filter) as $type_filter_item) {
83 $sub_objs =
$GLOBALS[
'DIC'][
'tree']->getSubTree(
84 $GLOBALS[
'DIC'][
'tree']->getNodeData($ref_id),
88 $all_sub_objs = array_merge($all_sub_objs, $sub_objs);
91 foreach ($all_sub_objs as $child_ref) {
93 if (!
$GLOBALS[
'DIC'][
'ilAccess']->checkAccess(
'write',
'', $child_ref)) {
94 return $this->
__raiseError(
'Permission denied for : ' . $ref_id .
' -> type ' .
$type,
'Client');
96 $valid_refs[] = $child_ref;
98 } elseif (in_array(
$type, $type_filter)) {
99 if (!
$GLOBALS[
'DIC'][
'ilAccess']->checkAccess(
'write',
'', $ref_id)) {
100 return $this->
__raiseError(
'Permission denied for : ' . $ref_id .
' -> type ' .
$type,
'Client');
102 $valid_refs[] = $ref_id;
104 return $this->
__raiseError(
'Invalid object type given for : ' . $ref_id .
' -> type ' .
$type,
'Client');
109 foreach ($valid_refs as $ref_id) {
110 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
114 return $this->
__raiseError(
'Invalid reference id given : ' . $ref_id .
' -> type ' .
$type,
'Client');
118 $valid_users = $this->
applyProgressFilter($obj->getId(), (array) $usr_ids, (array) $progress_filter);
120 switch ($obj->getType()) {
122 include_once
'./Modules/ScormAicc/classes/class.ilObjSAHSLearningModule.php';
139 $obj->removeTestResultsFromSoapLpAdministration(array_values((array) $valid_users));
144 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
157 public function getProgressInfo($sid, $a_ref_id, $a_progress_filter)
164 $ilAccess = $DIC->access();
167 if (!$this->__checkSession($sid)) {
169 'Error ' . self::SOAP_LP_ERROR_AUTHENTICATION .
':' . $this->
__getMessage(),
170 self::SOAP_LP_ERROR_AUTHENTICATION
175 if (array_diff((array) $a_progress_filter, self::$PROGRESS_INFO_TYPES)) {
177 'Error ' . self::SOAP_LP_ERROR_INVALID_FILTER .
': Invalid filter type given',
178 self::SOAP_LP_ERROR_INVALID_FILTER
182 include_once(
"Services/Tracking/classes/class.ilObjUserTracking.php");
185 'Error ' . self::SOAP_LP_ERROR_LP_NOT_ENABLED .
': Learning progress not enabled in ILIAS',
186 self::SOAP_LP_ERROR_LP_NOT_ENABLED
190 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
194 'Error ' . self::SOAP_LP_ERROR_INVALID_REF_ID .
': Invalid reference id ' . $a_ref_id .
' given',
195 self::SOAP_LP_ERROR_INVALID_REF_ID
200 include_once
'./Services/Tracking/classes/class.ilLPObjSettings.php';
204 'Error ' . self::SOAP_LP_ERROR_LP_NOT_AVAILABLE .
': Learning progress not available for objects of type ' .
206 self::SOAP_LP_ERROR_LP_NOT_AVAILABLE
214 if (!$ilAccess->checkRbacOrPositionPermissionAccess(
'read_learning_progress',
'read_learning_progress', $a_ref_id)) {
216 'Error ' . self::SOAP_LP_ERROR_NO_PERMISSION .
': No Permission to access learning progress in this object',
217 self::SOAP_LP_ERROR_NO_PERMISSION
221 include_once
'./Services/Xml/classes/class.ilXmlWriter.php';
223 $writer->xmlStartTag(
224 'LearningProgressInfo',
226 'ref_id' => $obj->getRefId(),
227 'type' => $obj->getType()
231 $writer->xmlStartTag(
'LearningProgressSummary');
233 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
234 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter)
or in_array(self::PROGRESS_FILTER_COMPLETED, $a_progress_filter)) {
236 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
237 'read_learning_progress',
242 $completed = count($completed);
247 'type' => self::PROGRESS_FILTER_COMPLETED,
248 'num' => (
int) $completed
252 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter)
or in_array(self::PROGRESS_FILTER_IN_PROGRESS, $a_progress_filter)) {
254 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
255 'read_learning_progress',
260 $completed = count($completed);
265 'type' => self::PROGRESS_FILTER_IN_PROGRESS,
266 'num' => (
int) $completed
270 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter)
or in_array(self::PROGRESS_FILTER_FAILED, $a_progress_filter)) {
272 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
273 'read_learning_progress',
278 $completed = count($completed);
283 'type' => self::PROGRESS_FILTER_FAILED,
284 'num' => (
int) $completed
288 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter)
or in_array(self::PROGRESS_FILTER_NOT_ATTEMPTED, $a_progress_filter)) {
290 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
291 'read_learning_progress',
296 $completed = count($completed);
301 'type' => self::PROGRESS_FILTER_NOT_ATTEMPTED,
302 'num' => (
int) $completed
306 $writer->xmlEndTag(
'LearningProgressSummary');
309 $writer->xmlStartTag(
'UserProgress');
310 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter)
or in_array(self::PROGRESS_FILTER_COMPLETED, $a_progress_filter)) {
312 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
313 'read_learning_progress',
319 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_COMPLETED);
321 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter)
or in_array(self::PROGRESS_FILTER_IN_PROGRESS, $a_progress_filter)) {
323 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
324 'read_learning_progress',
329 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_IN_PROGRESS);
331 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter)
or in_array(self::PROGRESS_FILTER_FAILED, $a_progress_filter)) {
333 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
334 'read_learning_progress',
339 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_FAILED);
341 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter)
or in_array(self::PROGRESS_FILTER_NOT_ATTEMPTED, $a_progress_filter)) {
343 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
344 'read_learning_progress',
350 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_NOT_ATTEMPTED);
352 $writer->xmlEndTag(
'UserProgress');
353 $writer->xmlEndTag(
'LearningProgressInfo');
355 return $writer->xmlDumpMem();
360 foreach (
$users as $user_id) {
371 $writer->
xmlElement(
'Firstname', array(), (
string) $info[
'firstname']);
372 $writer->
xmlElement(
'Lastname', array(), (
string) $info[
'lastname']);
388 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
391 $all_users = array();
392 if (in_array(self::USER_FILTER_ALL, $usr_ids)) {
393 $all_users = array_unique(
401 $all_users = $usr_ids;
404 if (!$filter
or in_array(self::PROGRESS_FILTER_ALL, $filter)) {
405 $GLOBALS[
'DIC'][
'log']->write(__METHOD__ .
': Deleting all progress data');
409 $filter_users = array();
410 if (in_array(self::PROGRESS_FILTER_IN_PROGRESS, $filter)) {
411 $GLOBALS[
'DIC'][
'log']->write(__METHOD__ .
': Filtering in progress.');
414 if (in_array(self::PROGRESS_FILTER_COMPLETED, $filter)) {
415 $GLOBALS[
'DIC'][
'log']->write(__METHOD__ .
': Filtering completed.');
418 if (in_array(self::PROGRESS_FILTER_FAILED, $filter)) {
419 $GLOBALS[
'DIC'][
'log']->write(__METHOD__ .
': Filtering failed.');
424 return array_intersect($all_users, $filter_users);
438 $ilDB = $DIC[
'ilDB'];
440 $query =
'DELETE FROM scorm_tracking ' .
441 'WHERE ' .
$ilDB->in(
'user_id', $a_usr_ids,
false,
'integer') .
' ' .
442 'AND obj_id = ' .
$ilDB->quote($a_obj_id,
'integer') .
' ';
456 $ilDB = $DIC[
'ilDB'];
458 $query =
'SELECT cp_node_id FROM cp_node ' .
459 'WHERE nodename = ' .
$ilDB->quote(
'item',
'text') .
' ' .
460 'AND cp_node.slm_id = ' .
$ilDB->quote($a_obj_id,
'integer');
465 $scos[] =
$row->cp_node_id;
468 $query =
'DELETE FROM cmi_node ' .
469 'WHERE ' .
$ilDB->in(
'user_id', (array) $a_usr_ids,
false,
'integer') .
' ' .
470 'AND ' .
$ilDB->in(
'cp_node_id', $scos,
false,
'integer');
482 if (!$this->__checkSession($sid)) {
487 $rbacsystem = $DIC[
'rbacsystem'];
488 $tree = $DIC[
'tree'];
493 if (is_array($type_filter)) {
494 $types = implode(
",", $type_filter);
499 include_once
'./Services/Tracking/classes/class.ilLPXmlWriter.php';
502 $writer->setIncludeRefIds($include_ref_ids);
503 $writer->setTypeFilter($type_filter);
506 return $writer->xmlDumpMem(
true);
static _lookupName($a_user_id)
lookup user name
static _getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
addUserProgress(ilXmlWriter $writer, $users, $a_type)
xmlStartTag($tag, $attrs=null, $empty=false, $encode=true, $escape=true)
Writes a starttag.
applyProgressFilter($obj_id, array $usr_ids, array $filter)
Apply progress filter.
const PROGRESS_FILTER_IN_PROGRESS
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
This class handles all DB changes necessary for fraunhofer.
const SOAP_LP_ERROR_AUTHENTICATION
const PROGRESS_FILTER_FAILED
const SOAP_LP_ERROR_INVALID_REF_ID
const PROGRESS_FILTER_NOT_ATTEMPTED
static _refreshStatus($a_obj_id, $a_users=null)
Set dirty.
static userExists($a_usr_ids=array())
const SOAP_LP_ERROR_NO_PERMISSION
static _lookupSubType($a_obj_id)
lookup subtype id (scorm, )
static _resetInfoCaches($a_obj_id)
const PROGRESS_FILTER_ALL
xmlEndTag($tag)
Writes an endtag.
const SOAP_LP_ERROR_LP_NOT_AVAILABLE
static _getNotAttempted($a_obj_id)
Static function to read the number of user who have the status 'not_attempted'.
static _getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
const SOAP_LP_ERROR_INVALID_FILTER
static _enabledLearningProgress()
check wether learing progress is enabled or not
const OP_READ_LEARNING_PROGRESS
XML writer learning progress.
static _lookupDBMode($a_obj_id)
foreach($_POST as $key=> $value) $res
static _lookupObjId($a_id)
__raiseError($a_message, $a_code)
static $PROGRESS_INFO_TYPES
getLearningProgressChanges($sid, $timestamp, $include_ref_ids, $type_filter)
Get learning progress changes.
deleteScormTracking($a_obj_id, $a_usr_ids)
Delete SCORM Tracking type $ilDB.
static _lookupType($a_id, $a_reference=false)
lookup object type
xmlElement($tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static $DELETE_PROGRESS_FILTER_TYPES
foreach($mandatory_scripts as $file) $timestamp
deleteScorm2004Tracking($a_obj_id, $a_usr_ids)
Delete scorm 2004 tracking.
initAuth($sid)
Init authentication.
static getInstanceByRefId($a_ref_id, $stop_on_error=true)
get an instance of an Ilias object by reference id
const SOAP_LP_ERROR_LP_NOT_ENABLED
$GLOBALS['JPEG_Segment_Names']
Global Variable: XMP_tag_captions.
const PROGRESS_FILTER_COMPLETED