54 $this->obj_id = $a_obj_id;
67 $query =
'SELECT count(usr_id) num from crs_waiting_list WHERE obj_id = ' . $ilDB->quote($a_obj_id,
'integer');
71 return (
int)
$row->num;
87 $query =
"DELETE FROM crs_waiting_list WHERE obj_id = " . $ilDB->quote($a_obj_id,
'integer') .
" ";
104 $query =
"DELETE FROM crs_waiting_list WHERE usr_id = " . $ilDB->quote($a_usr_id,
'integer');
120 $query =
"DELETE FROM crs_waiting_list " .
121 "WHERE usr_id = " . $ilDB->quote($a_usr_id,
'integer') .
' ' .
122 "AND obj_id = " . $ilDB->quote($a_obj_id,
'integer');
152 $query =
"INSERT INTO crs_waiting_list (obj_id,usr_id,sub_time) " .
154 $ilDB->quote($this->
getObjId(),
'integer') .
", " .
155 $ilDB->quote($a_usr_id,
'integer') .
", " .
156 $ilDB->quote(
time(),
'integer') .
" " .
175 $query =
"UPDATE crs_waiting_list " .
176 "SET sub_time = " . $ilDB->quote($a_subtime,
'integer') .
" " .
177 "WHERE usr_id = " . $ilDB->quote($a_usr_id,
'integer') .
" " .
178 "AND obj_id = " . $ilDB->quote($this->
getObjId(),
'integer') .
" ";
194 $query =
"DELETE FROM crs_waiting_list " .
195 " WHERE obj_id = " . $ilDB->quote($this->
getObjId(),
'integer') .
" " .
196 " AND usr_id = " . $ilDB->quote($a_usr_id,
'integer') .
" ";
212 return isset($this->users[$a_usr_id]) ? true :
false;
227 if (isset(self::$is_on_list[$a_usr_id][$a_obj_id])) {
228 return self::$is_on_list[$a_usr_id][$a_obj_id];
231 $query =
"SELECT usr_id " .
232 "FROM crs_waiting_list " .
233 "WHERE obj_id = " . $ilDB->quote($a_obj_id,
'integer') .
" " .
234 "AND usr_id = " . $ilDB->quote($a_usr_id,
'integer');
236 return $res->numRows() ? true :
false;
252 if (!is_array($a_usr_ids)) {
253 $a_usr_ids =
array($a_usr_ids);
255 if (!is_array($a_obj_ids)) {
256 $a_obj_ids =
array($a_obj_ids);
258 foreach ($a_usr_ids as $usr_id) {
259 foreach ($a_obj_ids as
$obj_id) {
260 self::$is_on_list[$usr_id][
$obj_id] =
false;
263 $query =
"SELECT usr_id, obj_id " .
264 "FROM crs_waiting_list " .
266 $ilDB->in(
"obj_id", $a_obj_ids,
false,
"integer") .
" AND " .
267 $ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
269 while ($rec = $ilDB->fetchAssoc(
$res)) {
270 self::$is_on_list[$rec[
"usr_id"]][$rec[
"obj_id"]] =
true;
283 return count($this->users);
295 return isset($this->users[$a_usr_id]) ? $this->users[$a_usr_id][
'position'] : -1;
306 return $this->users ? $this->users :
array();
318 return isset($this->users[$a_usr_id]) ? $this->users[$a_usr_id] :
false;
328 return $this->user_ids ? $this->user_ids :
array();
343 $this->users =
array();
345 $query =
"SELECT * FROM crs_waiting_list " .
346 "WHERE obj_id = " . $ilDB->quote($this->
getObjId(),
'integer') .
" ORDER BY sub_time";
353 $this->users[
$row->usr_id][
'time'] =
$row->sub_time;
354 $this->users[
$row->usr_id][
'usr_id'] =
$row->usr_id;
356 $this->user_ids[] =
$row->usr_id;
updateSubscriptionTime($a_usr_id, $a_subtime)
update subscription time
Base class for course and group waiting lists.
getUser($a_usr_id)
get user
removeFromList($a_usr_id)
remove usr from list
static _deleteUser($a_usr_id)
Delete user.
static _preloadOnListInfo($a_usr_ids, $a_obj_ids)
Preload on list info.
getUserIds()
Get all user ids of users on waiting list.
getCountUsers()
get number of users
getAllUsers()
get all users on waiting list
foreach($_POST as $key=> $value) $res
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
Create styles array
The data for the language used.
getPosition($a_usr_id)
get position
static lookupListSize($a_obj_id)
Lookup waiting lit size.
__construct($a_obj_id)
Constructor.
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.
static _deleteAll($a_obj_id)
delete all
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
addToList($a_usr_id)
add to list
isOnList($a_usr_id)
check if is on waiting list