54 $this->obj_id = $a_obj_id;
70 $query =
"DELETE FROM crs_waiting_list WHERE obj_id = ".$ilDB->quote($a_obj_id ,
'integer').
" ";
87 $query =
"DELETE FROM crs_waiting_list WHERE usr_id = ".$ilDB->quote($a_usr_id ,
'integer');
103 $query =
"DELETE FROM crs_waiting_list ".
104 "WHERE usr_id = ".$ilDB->quote($a_usr_id,
'integer').
' '.
105 "AND obj_id = ".$ilDB->quote($a_obj_id,
'integer');
136 $query =
"INSERT INTO crs_waiting_list (obj_id,usr_id,sub_time) ".
138 $ilDB->quote($this->
getObjId() ,
'integer').
", ".
139 $ilDB->quote($a_usr_id ,
'integer').
", ".
140 $ilDB->quote(time() ,
'integer').
" ".
159 $query =
"UPDATE crs_waiting_list ".
160 "SET sub_time = ".$ilDB->quote($a_subtime ,
'integer').
" ".
161 "WHERE usr_id = ".$ilDB->quote($a_usr_id ,
'integer').
" ".
162 "AND obj_id = ".$ilDB->quote($this->
getObjId() ,
'integer').
" ";
178 $query =
"DELETE FROM crs_waiting_list ".
179 " WHERE obj_id = ".$ilDB->quote($this->
getObjId() ,
'integer').
" ".
180 " AND usr_id = ".$ilDB->quote($a_usr_id ,
'integer').
" ";
196 return isset($this->users[$a_usr_id]) ?
true :
false;
211 if (isset(self::$is_on_list[$a_usr_id][$a_obj_id]))
213 return self::$is_on_list[$a_usr_id][$a_obj_id];
216 $query =
"SELECT usr_id ".
217 "FROM crs_waiting_list ".
218 "WHERE obj_id = ".$ilDB->quote($a_obj_id,
'integer').
" ".
219 "AND usr_id = ".$ilDB->quote($a_usr_id,
'integer');
221 return $res->numRows() ?
true :
false;
237 if (!is_array($a_usr_ids))
239 $a_usr_ids = array($a_usr_ids);
241 if (!is_array($a_obj_ids))
243 $a_obj_ids = array($a_obj_ids);
245 foreach ($a_usr_ids as
$usr_id)
247 foreach ($a_obj_ids as
$obj_id)
252 $query =
"SELECT usr_id, obj_id ".
253 "FROM crs_waiting_list ".
255 $ilDB->in(
"obj_id", $a_obj_ids,
false,
"integer").
" AND ".
256 $ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
258 while ($rec = $ilDB->fetchAssoc(
$res))
260 self::$is_on_list[$rec[
"usr_id"]][$rec[
"obj_id"]] =
true;
273 return count($this->users);
285 return isset($this->users[$a_usr_id]) ? $this->users[$a_usr_id][
'position'] : -1;
296 return $this->users ? $this->users : array();
308 return isset($this->users[$a_usr_id]) ? $this->users[$a_usr_id] :
false;
318 return $this->user_ids ? $this->user_ids : array();
333 $this->users = array();
335 $query =
"SELECT * FROM crs_waiting_list ".
336 "WHERE obj_id = ".$ilDB->quote($this->
getObjId() ,
'integer').
" ORDER BY sub_time";
343 $this->users[
$row->usr_id][
'position'] = $counter;
344 $this->users[
$row->usr_id][
'time'] =
$row->sub_time;
345 $this->users[
$row->usr_id][
'usr_id'] =
$row->usr_id;
347 $this->user_ids[] =
$row->usr_id;