ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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 
32 include_once './Services/Tracking/classes/class.ilLPStatus.php';
33 
35 {
36  public function __construct($a_obj_id)
37  {
38  global $DIC;
39 
40  $ilDB = $DIC['ilDB'];
41 
42  parent::__construct($a_obj_id);
43  $this->db = $ilDB;
44  }
45 
46  public static function _getInProgress($a_obj_id)
47  {
48  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
49  $users = $status_info['in_progress'];
50  return array_unique($users);
51  }
52 
53  public static function _getCompleted($a_obj_id)
54  {
55  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
56  $users = $status_info['completed'];
57  return array_unique($users);
58  }
59 
60  public static function _getFailed($a_obj_id)
61  {
62  $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
63  $users = $status_info['failed'];
64  return array_unique($users);
65  }
66 
67 
68  public static function _getStatusInfo($a_obj_id)
69  {
70  include_once './Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php';
71  $status_info['subtype'] = "scorm2004";
73 
74  $status_info['completed'] = $info['completed'];
75  $status_info['failed'] = $info['failed'];
76  $status_info['in_progress'] = $info['in_progress'];
77 
78  return $status_info;
79  }
80 
89  public function determineStatus($a_obj_id, $a_user_id, $a_obj = null)
90  {
91  global $DIC;
92 
93  $ilObjDataCache = $DIC['ilObjDataCache'];
94  $ilDB = $DIC['ilDB'];
95  $ilLog = $DIC['ilLog'];
96 
97  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
98  $scorm_status = ilSCORM2004Tracking::_getProgressInfoOfUser($a_obj_id, $a_user_id);
99  $status = self::LP_STATUS_NOT_ATTEMPTED_NUM;
100  switch ($scorm_status) {
101  case "in_progress":
102  $status = self::LP_STATUS_IN_PROGRESS_NUM;
103  break;
104  case "completed":
105  $status = self::LP_STATUS_COMPLETED_NUM;
106  break;
107  case "failed":
108  $status = self::LP_STATUS_FAILED_NUM;
109  break;
110  }
111 
112  return $status;
113  }
114 
115  public function refreshStatus($a_obj_id, $a_users = null)
116  {
117  parent::refreshStatus($a_obj_id, $a_users);
118 
119  include_once("./Services/Tracking/classes/class.ilLPStatusWrapper.php");
120  $in_progress = ilLPStatusWrapper::_getInProgress($a_obj_id);
121  $completed = ilLPStatusWrapper::_getCompleted($a_obj_id);
123  $all_active_users = array_unique(array_merge($in_progress, $completed, $failed));
124 
125  // get all tracked users regardless of SCOs
126  include_once("./Modules/Scorm2004/classes/class.ilSCORM2004Tracking.php");
127  $all_tracked_users = ilSCORM2004Tracking::_getTrackedUsers($a_obj_id);
128 
129  $not_attempted_users = array_diff($all_tracked_users, $all_active_users);
130  unset($all_tracked_users);
131  unset($all_active_users);
132 
133  // reset all users which have no data for the current SCOs
134  if ($not_attempted_users) {
135  foreach ($not_attempted_users as $usr_id) {
136  // this will update any (parent) collections if necessary
137  ilLPStatus::writeStatus($a_obj_id, $usr_id, self::LP_STATUS_NOT_ATTEMPTED_NUM, 0);
138  }
139  }
140  }
149  public function determinePercentage($a_obj_id, $a_user_id, $a_obj = null)
150  {
151  return null;//todo!
152  }
153 }
static _getInProgress($a_obj_id)
Static function to read users who have the status &#39;in_progress&#39;.
refreshStatus($a_obj_id, $a_users=null)
static _getCompleted($a_obj_id)
Static function to read the users who have the status &#39;completed&#39;.
global $DIC
Definition: saml.php:7
static _getProgressInfo($a_obj_id)
Get overall scorm status.
determineStatus($a_obj_id, $a_user_id, $a_obj=null)
Determine status.
static _getProgressInfoOfUser($a_obj_id, $a_user_id)
Get overall scorm status.
static _getFailed($a_obj_id)
Static function to read the users who have the status &#39;completed&#39;.
static _getTrackedUsers($a_obj_id)
Get all tracked users.
$failed
Definition: Utf8Test.php:85
static _getStatusInfo($a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
$users
Definition: authpage.php:44
static writeStatus($a_obj_id, $a_user_id, $a_status, $a_percentage=false, $a_force_per=false)
Write status for user and object.
global $ilDB
Abstract class ilLPStatus for all learning progress modes E.g ilLPStatusManual, ilLPStatusObjectives ...
$info
Definition: index.php:5
determinePercentage($a_obj_id, $a_user_id, $a_obj=null)
Determine percentage.