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');
72 return (
int)
$row->num;
88 $query =
"DELETE FROM crs_waiting_list WHERE obj_id = ".$ilDB->quote($a_obj_id ,
'integer').
" ";
105 $query =
"DELETE FROM crs_waiting_list WHERE usr_id = ".$ilDB->quote($a_usr_id ,
'integer');
121 $query =
"DELETE FROM crs_waiting_list ".
122 "WHERE usr_id = ".$ilDB->quote($a_usr_id,
'integer').
' '.
123 "AND obj_id = ".$ilDB->quote($a_obj_id,
'integer');
154 $query =
"INSERT INTO crs_waiting_list (obj_id,usr_id,sub_time) ".
156 $ilDB->quote($this->
getObjId() ,
'integer').
", ".
157 $ilDB->quote($a_usr_id ,
'integer').
", ".
158 $ilDB->quote(
time() ,
'integer').
" ".
177 $query =
"UPDATE crs_waiting_list ".
178 "SET sub_time = ".$ilDB->quote($a_subtime ,
'integer').
" ".
179 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,
'integer').
" ".
180 "AND obj_id = ".$ilDB->quote($this->
getObjId() ,
'integer').
" ";
196 $query =
"DELETE FROM crs_waiting_list ".
197 " WHERE obj_id = ".$ilDB->quote($this->
getObjId() ,
'integer').
" ".
198 " AND usr_id = ".$ilDB->quote($a_usr_id ,
'integer').
" ";
214 return isset($this->users[$a_usr_id]) ? true :
false;
229 if (isset(self::$is_on_list[$a_usr_id][$a_obj_id]))
231 return self::$is_on_list[$a_usr_id][$a_obj_id];
234 $query =
"SELECT usr_id ".
235 "FROM crs_waiting_list ".
236 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
'integer').
" ".
237 "AND usr_id = ".$ilDB->quote($a_usr_id,
'integer');
239 return $res->numRows() ? true :
false;
255 if (!is_array($a_usr_ids))
257 $a_usr_ids =
array($a_usr_ids);
259 if (!is_array($a_obj_ids))
261 $a_obj_ids =
array($a_obj_ids);
263 foreach ($a_usr_ids as $usr_id)
265 foreach ($a_obj_ids as
$obj_id)
267 self::$is_on_list[$usr_id][
$obj_id] =
false;
270 $query =
"SELECT usr_id, obj_id ".
271 "FROM crs_waiting_list ".
273 $ilDB->in(
"obj_id", $a_obj_ids,
false,
"integer").
" AND ".
274 $ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
276 while ($rec = $ilDB->fetchAssoc(
$res))
278 self::$is_on_list[$rec[
"usr_id"]][$rec[
"obj_id"]] =
true;
291 return count($this->users);
303 return isset($this->users[$a_usr_id]) ? $this->users[$a_usr_id][
'position'] : -1;
314 return $this->users ? $this->users :
array();
326 return isset($this->users[$a_usr_id]) ? $this->users[$a_usr_id] :
false;
336 return $this->user_ids ? $this->user_ids :
array();
351 $this->users =
array();
353 $query =
"SELECT * FROM crs_waiting_list ".
354 "WHERE obj_id = ".$ilDB->quote($this->
getObjId() ,
'integer').
" ORDER BY sub_time";
362 $this->users[
$row->usr_id][
'time'] =
$row->sub_time;
363 $this->users[
$row->usr_id][
'usr_id'] =
$row->usr_id;
365 $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
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