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') .
" ";
110 $ilDB = $DIC[
'ilDB'];
112 $query =
"DELETE FROM crs_waiting_list WHERE usr_id = " .
$ilDB->quote($a_usr_id,
'integer');
128 $ilDB = $DIC[
'ilDB'];
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');
159 $ilDB = $DIC[
'ilDB'];
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') .
" " .
187 $ilDB = $DIC[
'ilDB'];
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') .
" ";
208 $ilDB = $DIC[
'ilDB'];
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;
243 $ilDB = $DIC[
'ilDB'];
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;
270 $ilDB = $DIC[
'ilDB'];
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();
363 $ilDB = $DIC[
'ilDB'];
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;
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.
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
addToList($a_usr_id)
add to list
isOnList($a_usr_id)
check if is on waiting list