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[
'tree']->getSubTree(
84 $GLOBALS[
'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[
'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[
'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');
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';
151 public function getProgressInfo($sid, $a_ref_id, $a_progress_filter)
158 if (!$this->__checkSession($sid)) {
160 'Error ' . self::SOAP_LP_ERROR_AUTHENTICATION .
':' . $this->
__getMessage(),
161 self::SOAP_LP_ERROR_AUTHENTICATION
166 if (array_diff((
array) $a_progress_filter, self::$PROGRESS_INFO_TYPES)) {
168 'Error ' . self::SOAP_LP_ERROR_INVALID_FILTER .
': Invalid filter type given',
169 self::SOAP_LP_ERROR_INVALID_FILTER
173 include_once(
"Services/Tracking/classes/class.ilObjUserTracking.php");
176 'Error ' . self::SOAP_LP_ERROR_LP_NOT_ENABLED .
': Learning progress not enabled in ILIAS',
177 self::SOAP_LP_ERROR_LP_NOT_ENABLED
181 include_once
'./Services/Object/classes/class.ilObjectFactory.php';
185 'Error ' . self::SOAP_LP_ERROR_INVALID_REF_ID .
': Invalid reference id ' . $a_ref_id .
' given',
186 self::SOAP_LP_ERROR_INVALID_REF_ID
191 include_once
'./Services/Tracking/classes/class.ilLPObjSettings.php';
195 'Error ' . self::SOAP_LP_ERROR_LP_NOT_AVAILABLE .
': Learning progress not available for objects of type ' .
197 self::SOAP_LP_ERROR_LP_NOT_AVAILABLE
205 if (!$ilAccess->checkRbacOrPositionPermissionAccess(
'read_learning_progress',
'read_learning_progress', $a_ref_id)) {
207 'Error ' . self::SOAP_LP_ERROR_NO_PERMISSION .
': No Permission to access learning progress in this object',
208 self::SOAP_LP_ERROR_NO_PERMISSION
212 include_once
'./Services/Xml/classes/class.ilXmlWriter.php';
214 $writer->xmlStartTag(
215 'LearningProgressInfo',
217 'ref_id' => $obj->getRefId(),
218 'type' => $obj->getType()
222 $writer->xmlStartTag(
'LearningProgressSummary');
224 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
225 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_COMPLETED, $a_progress_filter)) {
227 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
228 'read_learning_progress',
233 $completed = count($completed);
238 'type' => self::PROGRESS_FILTER_COMPLETED,
239 'num' => (
int) $completed
243 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_IN_PROGRESS, $a_progress_filter)) {
245 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
246 'read_learning_progress',
251 $completed = count($completed);
256 'type' => self::PROGRESS_FILTER_IN_PROGRESS,
257 'num' => (
int) $completed
261 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_FAILED, $a_progress_filter)) {
263 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
264 'read_learning_progress',
269 $completed = count($completed);
274 'type' => self::PROGRESS_FILTER_FAILED,
275 'num' => (
int) $completed
279 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_NOT_ATTEMPTED, $a_progress_filter)) {
281 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
282 'read_learning_progress',
287 $completed = count($completed);
292 'type' => self::PROGRESS_FILTER_NOT_ATTEMPTED,
293 'num' => (
int) $completed
297 $writer->xmlEndTag(
'LearningProgressSummary');
300 $writer->xmlStartTag(
'UserProgress');
301 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_COMPLETED, $a_progress_filter)) {
303 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
304 'read_learning_progress',
310 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_COMPLETED);
312 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_IN_PROGRESS, $a_progress_filter)) {
314 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
315 'read_learning_progress',
320 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_IN_PROGRESS);
322 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_FAILED, $a_progress_filter)) {
324 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
325 'read_learning_progress',
330 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_FAILED);
332 if (in_array(self::PROGRESS_FILTER_ALL, $a_progress_filter) or in_array(self::PROGRESS_FILTER_NOT_ATTEMPTED, $a_progress_filter)) {
334 $completed =
$GLOBALS[
'DIC']->access()->filterUserIdsByRbacOrPositionOfCurrentUser(
335 'read_learning_progress',
341 $this->
addUserProgress($writer, $completed, self::PROGRESS_FILTER_NOT_ATTEMPTED);
343 $writer->xmlEndTag(
'UserProgress');
344 $writer->xmlEndTag(
'LearningProgressInfo');
346 return $writer->xmlDumpMem();
351 foreach (
$users as $user_id) {
362 $writer->
xmlElement(
'Firstname',
array(), (
string) $info[
'firstname']);
379 include_once
'./Services/Tracking/classes/class.ilLPStatusWrapper.php';
382 $all_users =
array();
383 if (in_array(self::USER_FILTER_ALL, $usr_ids)) {
384 $all_users = array_unique(
392 $all_users = $usr_ids;
395 if (!$filter or in_array(self::PROGRESS_FILTER_ALL, $filter)) {
396 $GLOBALS[
'log']->write(__METHOD__ .
': Deleting all progress data');
400 $filter_users =
array();
401 if (in_array(self::PROGRESS_FILTER_IN_PROGRESS, $filter)) {
402 $GLOBALS[
'log']->write(__METHOD__ .
': Filtering in progress.');
405 if (in_array(self::PROGRESS_FILTER_COMPLETED, $filter)) {
406 $GLOBALS[
'log']->write(__METHOD__ .
': Filtering completed.');
409 if (in_array(self::PROGRESS_FILTER_FAILED, $filter)) {
410 $GLOBALS[
'log']->write(__METHOD__ .
': Filtering failed.');
415 return array_intersect($all_users, $filter_users);
429 $query =
'DELETE FROM scorm_tracking ' .
430 'WHERE ' . $ilDB->in(
'user_id', $a_usr_ids,
false,
'integer') .
' ' .
431 'AND obj_id = ' . $ilDB->quote($a_obj_id,
'integer') .
' ';
445 $query =
'SELECT cp_node_id FROM cp_node ' .
446 'WHERE nodename = ' . $ilDB->quote(
'item',
'text') .
' ' .
447 'AND cp_node.slm_id = ' . $ilDB->quote($a_obj_id,
'integer');
452 $scos[] =
$row->cp_node_id;
455 $query =
'DELETE FROM cmi_node ' .
456 'WHERE ' . $ilDB->in(
'user_id', (
array) $a_usr_ids,
false,
'integer') .
' ' .
457 'AND ' . $ilDB->in(
'cp_node_id', $scos,
false,
'integer');
458 $ilDB->manipulate(
$query);
469 if (!$this->__checkSession($sid)) {
472 global $rbacsystem, $tree,
$ilLog;
476 if (is_array($type_filter)) {
477 $types = implode($type_filter,
",");
482 include_once
'./Services/Tracking/classes/class.ilLPXmlWriter.php';
485 $writer->setIncludeRefIds($include_ref_ids);
486 $writer->setTypeFilter($type_filter);
489 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
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
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.
Create styles array
The data for the language used.
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
const PROGRESS_FILTER_COMPLETED