ILIAS  release_8 Revision v8.24
class.ilLPStatusEvent.php
Go to the documentation of this file.
1<?php
2
3declare(strict_types=0);
4/*
5 +-----------------------------------------------------------------------------+
6 | ILIAS open source |
7 +-----------------------------------------------------------------------------+
8 | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
9 | |
10 | This program is free software; you can redistribute it and/or |
11 | modify it under the terms of the GNU General Public License |
12 | as published by the Free Software Foundation; either version 2 |
13 | of the License, or (at your option) any later version. |
14 | |
15 | This program is distributed in the hope that it will be useful, |
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
18 | GNU General Public License for more details. |
19 | |
20 | You should have received a copy of the GNU General Public License |
21 | along with this program; if not, write to the Free Software |
22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
23 +-----------------------------------------------------------------------------+
24*/
25
31{
32 public static function _getNotAttempted(int $a_obj_id): array
33 {
34 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
35
36 $users = array();
37
38 $members = self::getMembers($status_info['crs_id'], true);
39 if ($members) {
40 // diff in progress and completed (use stored result in LPStatusWrapper)
41 $users = array_diff(
42 $members,
44 );
45 $users = array_diff(
46 $users,
48 );
49 }
50
51 return $users;
52 }
53
54 public static function _getInProgress(int $a_obj_id): array
55 {
56 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
57
58 // If registration is disabled in_progress is not available
59 if (!$status_info['registration']) {
60 return array();
61 }
62 // If event has occured in_progress is impossible
63 if ($status_info['starting_time'] < time()) {
64 return array();
65 }
66
67 // Otherwise all users who registered will get the status in progress
68 return $status_info['registered_users'] ?: array();
69 }
70
71 public static function _getCompleted(int $a_obj_id): array
72 {
73 $status_info = ilLPStatusWrapper::_getStatusInfo($a_obj_id);
74 return $status_info['participated_users'] ?: array();
75 }
76
77 public static function _getStatusInfo(int $a_obj_id): array
78 {
79 $tree = $GLOBALS['DIC']->repositoryTree();
80
81 $references = ilObject::_getAllReferences($a_obj_id);
82 $ref_id = end($references);
83
84 $member_ref_id = null;
85 if ($id = $tree->checkForParentType($ref_id, 'grp')) {
86 $member_ref_id = $id;
87 } elseif ($id = $tree->checkForParentType($ref_id, 'crs')) {
88 $member_ref_id = $id;
89 }
90
91 $status_info = array();
92 $status_info['crs_id'] = ilObject::_lookupObjId($member_ref_id);
93 $status_info['registration'] = ilObjSession::_lookupRegistrationEnabled(
94 $a_obj_id
95 );
96 $status_info['title'] = ilObject::_lookupTitle($a_obj_id);
97 $status_info['description'] = ilObject::_lookupDescription($a_obj_id);
98
99 $time_info = ilSessionAppointment::_lookupAppointment($a_obj_id);
100 $status_info['starting_time'] = $time_info['start'];
101 $status_info['ending_time'] = $time_info['end'];
102 $status_info['fullday'] = $time_info['fullday'];
103
104 $status_info['registered_users'] = ilEventParticipants::_getRegistered(
105 $a_obj_id
106 );
107 $status_info['participated_users'] = ilEventParticipants::_getParticipated(
108 $a_obj_id
109 );
110
111 return $status_info;
112 }
113
114 public function determineStatus(
115 int $a_obj_id,
116 int $a_usr_id,
117 object $a_obj = null
118 ): int {
119 global $DIC;
120
121 $ilObjDataCache = $DIC['ilObjDataCache'];
122
124 switch ($this->ilObjDataCache->lookupType($a_obj_id)) {
125 case 'sess':
126
128 $a_obj_id
129 );
131 $a_obj_id
132 );
133
134 // If registration is disabled in_progress is not available
135 // If event has occured in_progress is impossible
136 if ($registration && $time_info['start'] >= time()) {
137 // is user registered -> in progress
139 $a_usr_id,
140 $a_obj_id
141 )) {
143 }
144 }
146 $a_usr_id,
147 $a_obj_id
148 )) {
150 }
151 break;
152 }
153 return $status;
154 }
155
159 protected static function getMembers(
160 int $a_obj_id,
161 bool $a_is_crs_id = false
162 ): array {
163 if (!$a_is_crs_id) {
164 $tree = $GLOBALS['DIC']->repositoryTree();
165 $references = ilObject::_getAllReferences($a_obj_id);
166 $ref_id = end($references);
167
168 $member_ref_id = null;
169 if ($id = $tree->checkForParentType($ref_id, 'grp')) {
170 $member_ref_id = $id;
171 } elseif ($id = $tree->checkForParentType($ref_id, 'crs')) {
172 $member_ref_id = $id;
173 } else {
174 return [];
175 }
176 $member_obj_id = ilObject::_lookupObjId($member_ref_id);
177 } else {
178 $member_obj_id = $a_obj_id;
179 }
180
181 $member_obj = ilParticipants::getInstanceByObjId($member_obj_id);
182 return $member_obj->getMembers();
183 }
184
188 public static function _lookupCompletedForObject(
189 int $a_obj_id,
190 ?array $a_user_ids = null
191 ): array {
192 if (!$a_user_ids) {
193 $a_user_ids = self::getMembers($a_obj_id);
194 if (!$a_user_ids) {
195 return array();
196 }
197 }
198 return self::_lookupStatusForObject(
199 $a_obj_id,
200 self::LP_STATUS_COMPLETED_NUM,
201 $a_user_ids
202 );
203 }
204
208 public static function _lookupFailedForObject(
209 int $a_obj_id,
210 ?array $a_user_ids = null
211 ): array {
212 return array();
213 }
214
218 public static function _lookupInProgressForObject(
219 int $a_obj_id,
220 ?array $a_user_ids = null
221 ): array {
222 if (!$a_user_ids) {
223 $a_user_ids = self::getMembers($a_obj_id);
224 if (!$a_user_ids) {
225 return array();
226 }
227 }
228 return self::_lookupStatusForObject(
229 $a_obj_id,
230 self::LP_STATUS_IN_PROGRESS_NUM,
231 $a_user_ids
232 );
233 }
234}
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static _isRegistered(int $a_usr_id, int $a_event_id)
static _getParticipated(int $a_event_id)
static _getRegistered(int $a_event_id)
static _hasParticipated(int $a_usr_id, int $a_event_id)
determineStatus(int $a_obj_id, int $a_usr_id, object $a_obj=null)
static getMembers(int $a_obj_id, bool $a_is_crs_id=false)
Get members for object.
static _getStatusInfo(int $a_obj_id)
static _lookupFailedForObject(int $a_obj_id, ?array $a_user_ids=null)
Get failed users for object.
static _getCompleted(int $a_obj_id)
static _lookupInProgressForObject(int $a_obj_id, ?array $a_user_ids=null)
Get in progress users for object.
static _getInProgress(int $a_obj_id)
static _getNotAttempted(int $a_obj_id)
static _lookupCompletedForObject(int $a_obj_id, ?array $a_user_ids=null)
Get completed users for object.
static _getInProgress(int $a_obj_id)
Static function to read users who have the status 'in_progress'.
static _getCompleted(int $a_obj_id)
Static function to read the users who have the status 'completed'.
static _getStatusInfo(int $a_obj_id)
Reads informations about the object e.g test results, tlt, number of visits.
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
ilObjectDataCache $ilObjDataCache
static _lookupRegistrationEnabled(int $a_obj_id)
static _getAllReferences(int $id)
get all reference ids for object ID
static _lookupObjId(int $ref_id)
static _lookupTitle(int $obj_id)
static _lookupDescription(int $obj_id)
static getInstanceByObjId(int $a_obj_id)
Get instance by obj type.
static _lookupAppointment(int $a_obj_id)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: confirmReg.php:20
return['3gp', '7z', 'ai', 'aif', 'aifc', 'aiff', 'au', 'arw', 'avi', 'backup', 'bak', 'bas', 'bpmn', 'bpmn2', 'bmp', 'bib', 'bibtex', 'bz', 'bz2', 'c', 'c++', 'cc', 'cct', 'cdf', 'cer', 'class', 'cls', 'conf', 'cpp', 'crt', 'crs', 'crw', 'cr2', 'css', 'cst', 'csv', 'cur', 'db', 'dcr', 'des', 'dng', 'doc', 'docx', 'dot', 'dotx', 'dtd', 'dvi', 'el', 'eps', 'epub', 'f', 'f77', 'f90', 'flv', 'for', 'g3', 'gif', 'gl', 'gan', 'ggb', 'gsd', 'gsm', 'gtar', 'gz', 'gzip', 'h', 'hpp', 'htm', 'html', 'htmls', 'ibooks', 'ico', 'ics', 'ini', 'ipynb', 'java', 'jbf', 'jpeg', 'jpg', 'js', 'jsf', 'jso', 'json', 'latex', 'lang', 'less', 'log', 'lsp', 'ltx', 'm1v', 'm2a', 'm2v', 'm3u', 'm4a', 'm4v', 'markdown', 'm', 'mat', 'md', 'mdl', 'mdown', 'mid', 'min', 'midi', 'mobi', 'mod', 'mov', 'movie', 'mp2', 'mp3', 'mp4', 'mpa', 'mpeg', 'mpg', 'mph', 'mpga', 'mpp', 'mpt', 'mpv', 'mpx', 'mv', 'mw', 'mv4', 'nb', 'nbp', 'nef', 'nif', 'niff', 'obj', 'obm', 'odt', 'ods', 'odp', 'odg', 'odf', 'oga', 'ogg', 'ogv', 'old', 'p', 'pas', 'pbm', 'pcl', 'pct', 'pcx', 'pdf', 'pgm', 'pic', 'pict', 'png', 'por', 'pov', 'project', 'properties', 'ppa', 'ppm', 'pps', 'ppsx', 'ppt', 'pptx', 'ppz', 'ps', 'psd', 'pwz', 'qt', 'qtc', 'qti', 'qtif', 'r', 'ra', 'ram', 'rar', 'rast', 'rda', 'rev', 'rexx', 'ris', 'rf', 'rgb', 'rm', 'rmd', 'rmi', 'rmm', 'rmp', 'rt', 'rtf', 'rtx', 'rv', 's', 's3m', 'sav', 'sbs', 'sec', 'sdml', 'sgm', 'sgml', 'smi', 'smil', 'srt', 'sps', 'spv', 'stl', 'svg', 'swa', 'swf', 'swz', 'tar', 'tex', 'texi', 'texinfo', 'text', 'tgz', 'tif', 'tiff', 'ttf', 'txt', 'tmp', 'uvproj', 'vdf', 'vimeo', 'viv', 'vivo', 'vrml', 'vsdx', 'wav', 'webm', 'wmv', 'wmx', 'wmz', 'woff', 'wwd', 'xhtml', 'xif', 'xls', 'xlsx', 'xmind', 'xml', 'xsl', 'xsd', 'zip']
global $DIC
Definition: feed.php:28
$ref_id
Definition: ltiauth.php:67