56 $this->obj_id = $a_obj_id;
71 $query =
'SELECT count(usr_id) num from crs_waiting_list WHERE obj_id = ' .
$ilDB->quote($a_obj_id,
'integer');
75 return (
int) $row->num;
93 $query =
"DELETE FROM crs_waiting_list WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" ";
112 $query =
"DELETE FROM crs_waiting_list WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer');
130 $query =
"DELETE FROM crs_waiting_list " .
131 "WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
' ' .
132 "AND obj_id = " .
$ilDB->quote($a_obj_id,
'integer');
164 $query =
"INSERT INTO crs_waiting_list (obj_id,usr_id,sub_time) " .
167 $ilDB->quote($a_usr_id,
'integer') .
", " .
168 $ilDB->quote(time(),
'integer') .
" " .
189 $query =
"UPDATE crs_waiting_list " .
190 "SET sub_time = " .
$ilDB->quote($a_subtime,
'integer') .
" " .
191 "WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" " .
192 "AND obj_id = " .
$ilDB->quote($this->
getObjId(),
'integer') .
" ";
210 $query =
"DELETE FROM crs_waiting_list " .
211 " WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
'integer') .
" " .
212 " AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer') .
" ";
228 return isset($this->users[$a_usr_id]) ?
true :
false;
245 if (isset(self::$is_on_list[$a_usr_id][$a_obj_id])) {
246 return self::$is_on_list[$a_usr_id][$a_obj_id];
249 $query =
"SELECT usr_id " .
250 "FROM crs_waiting_list " .
251 "WHERE obj_id = " .
$ilDB->quote($a_obj_id,
'integer') .
" " .
252 "AND usr_id = " .
$ilDB->quote($a_usr_id,
'integer');
254 return $res->numRows() ?
true :
false;
272 if (!is_array($a_usr_ids)) {
273 $a_usr_ids = array($a_usr_ids);
275 if (!is_array($a_obj_ids)) {
276 $a_obj_ids = array($a_obj_ids);
278 foreach ($a_usr_ids as $usr_id) {
279 foreach ($a_obj_ids as
$obj_id) {
280 self::$is_on_list[$usr_id][
$obj_id] =
false;
283 $query =
"SELECT usr_id, obj_id " .
284 "FROM crs_waiting_list " .
286 $ilDB->in(
"obj_id", $a_obj_ids,
false,
"integer") .
" AND " .
287 $ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
290 self::$is_on_list[$rec[
"usr_id"]][$rec[
"obj_id"]] =
true;
303 return count($this->users);
315 return isset($this->users[$a_usr_id]) ? $this->users[$a_usr_id][
'position'] : -1;
326 return $this->users ? $this->users : array();
338 return isset($this->users[$a_usr_id]) ? $this->users[$a_usr_id] :
false;
348 return $this->user_ids ? $this->user_ids : array();
365 $this->users = array();
367 $query =
"SELECT * FROM crs_waiting_list " .
368 "WHERE obj_id = " .
$ilDB->quote($this->
getObjId(),
'integer') .
" ORDER BY sub_time";
374 $this->users[$row->usr_id][
'position'] = $counter;
375 $this->users[$row->usr_id][
'time'] = $row->sub_time;
376 $this->users[$row->usr_id][
'usr_id'] = $row->usr_id;
378 $this->user_ids[] = $row->usr_id;
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
Base class for course and group waiting lists.
static _deleteUser($a_usr_id)
Delete user.
getUserIds()
Get all user ids of users on waiting list.
isOnList($a_usr_id)
check if is on waiting list
static deleteUserEntry($a_usr_id, $a_obj_id)
Delete one user entry.
removeFromList($a_usr_id)
remove usr from list
addToList($a_usr_id)
add to list
updateSubscriptionTime($a_usr_id, $a_subtime)
update subscription time
getCountUsers()
get number of users
static _isOnList($a_usr_id, $a_obj_id)
Check if a user on the waiting list.
static _deleteAll($a_obj_id)
delete all
getAllUsers()
get all users on waiting list
static _preloadOnListInfo($a_usr_ids, $a_obj_ids)
Preload on list info.
getPosition($a_usr_id)
get position
static lookupListSize($a_obj_id)
Lookup waiting lit size.
__construct($a_obj_id)
Constructor.
getUser($a_usr_id)
get user
foreach($_POST as $key=> $value) $res