ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilLPStatusSCORMPackage.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
32include_once './Services/Tracking/classes/class.ilLPStatus.php';
33
35{
36 public function __construct($a_obj_id)
37 {
38 global $ilDB;
39
40 parent::__construct($a_obj_id);
41 $this->db = $ilDB;
42 }
43
44 public static function _getInProgress($a_obj_id)
45 {
46 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
47 $users = $status_info['in_progress'];
48 return array_unique($users);
49 }
50
51 public static function _getCompleted($a_obj_id)
52 {
53 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
54 $users = $status_info['completed'];
55 return array_unique($users);
56 }
57
58 public static function _getFailed($a_obj_id)
59 {
60 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
61 $users = $status_info['failed'];
62 return array_unique($users);
63 }
64
65
66 public static function _getStatusInfo($a_obj_id)
67 {
68 include_once './Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php';
69 $status_info['subtype'] = "scorm2004";
71
72 $status_info['completed'] = $info['completed'];
73 $status_info['failed'] = $info['failed'];
74 $status_info['in_progress'] = $info['in_progress'];
75
76 return $status_info;
77 }
78
87 public function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
88 {
89 global $ilObjDataCache, $ilDB, $ilLog;
90
91 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
92 $scorm_status = ilSCORM2004Tracking::_getProgressInfoOfUser($a_obj_id, $a_user_id);
94 switch ($scorm_status) {
95 case "in_progress":
97 break;
98 case "completed":
100 break;
101 case "failed":
103 break;
104 }
105
106 return $status;
107 }
108
109 public function refreshStatus($a_obj_id, $a_users = null)
110 {
111 parent::refreshStatus($a_obj_id, $a_users);
112
113 include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
114 $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
115 $completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
117 $all_active_users = array_unique(array_merge($in_progress, $completed, $failed));
118
119 // get all tracked users regardless of SCOs
120 include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
121 $all_tracked_users = ilSCORM2004Tracking::_getTrackedUsers($a_obj_id);
122
123 $not_attempted_users = array_diff($all_tracked_users, $all_active_users);
124 unset($all_tracked_users);
125 unset($all_active_users);
126
127 // reset all users which have no data for the current SCOs
128 if ($not_attempted_users) {
129 foreach ($not_attempted_users as $usr_id) {
130 // this will update any (parent) collections if necessary
131 ilLPStatus::writeStatus($a_obj_id, $usr_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, 0);
132 }
133 }
134 }
143 public function determinePercentage($a_obj_id, $a_user_id, $a_obj = null)
144 {
145 return null;//todo!
146 }
147}
$failed
Definition: Utf8Test.php:85
$users
Definition: authpage.php:44
An exception for terminatinating execution or to throw for unit testing.
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
Determine status.
determinePercentage($a_obj_id, $a_user_id, $a_obj=null)
Determine percentage.
refreshStatus($a_obj_id, $a_users=null)
Refresh status.
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
static _getCompleted($a_obj_id)
Static function to read the users who have the status 'completed'.
static _getInProgress($a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getFailed($a_obj_id)
Static function to read the users who have the status 'completed'.
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
const LP_STATUS_COMPLETED_NUM
const LP_STATUS_IN_PROGRESS_NUM
const LP_STATUS_NOT_ATTEMPTED_NUM
const LP_STATUS_FAILED_NUM
static writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
Write status for user and object.
static _getProgressInfoOfUser($a_obj_id, $a_user_id)
Get overall scorm status.
static _getTrackedUsers($a_obj_id)
Get all tracked users.
static _getProgressInfo($a_obj_id)
Get overall scorm status.
$info
Definition: index.php:5
global $ilDB