Query usr_data.
224 if (is_array($this->additional_fields))
226 foreach ($this->additional_fields as $f)
228 if (!in_array($f, $this->default_fields))
230 if($f ==
"online_time")
232 $this->default_fields[] =
"ut_online.online_time";
233 $ut_join =
" LEFT JOIN ut_online ON usr_data.usr_id = ut_online.usr_id";
237 $this->default_fields[] = $f;
243 $count_query =
"SELECT count(usr_id) cnt".
246 $all_multi_fields =
array(
"interests_general",
"interests_help_offered",
"interests_help_looking");
247 $multi_fields =
array();
249 $sql_fields =
array();
250 foreach($this->default_fields as $idx => $field)
257 if(in_array($field, $all_multi_fields))
259 $multi_fields[] = $field;
261 else if(!stristr($field,
"."))
263 $sql_fields[] =
"usr_data.".$field;
267 $sql_fields[] = $field;
272 $query =
"SELECT ".implode($sql_fields,
",").
277 $query.=
" WHERE usr_data.usr_id <> ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer");
280 if($this->users
and is_array(($this->users)))
282 $query .=
' AND '.$ilDB->in(
'usr_data.usr_id',$this->users,
false,
'integer');
285 $count_query.=
" WHERE usr_data.usr_id <> ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer");
288 if ($this->first_letter !=
"")
290 $add = $where.
" (".$ilDB->upper($ilDB->substr(
"usr_data.lastname", 1, 1)).
" = ".$ilDB->upper($ilDB->quote($this->first_letter,
"text")).
") ";
296 if ($this->text_filter !=
"")
298 $add = $where.
" (".$ilDB->like(
"usr_data.login",
"text",
"%".$this->text_filter.
"%").
" ".
299 "OR ".$ilDB->like(
"usr_data.firstname",
"text",
"%".$this->text_filter.
"%").
" ".
300 "OR ".$ilDB->like(
"usr_data.lastname",
"text",
"%".$this->text_filter.
"%").
" ".
301 "OR ".$ilDB->like(
"usr_data.email",
"text",
"%".$this->text_filter.
"%").
") ";
307 if ($this->activation !=
"")
309 if ($this->activation ==
"inactive")
311 $add = $where.
" usr_data.active = ".$ilDB->quote(0,
"integer").
" ";
315 $add = $where.
" usr_data.active = ".$ilDB->quote(1,
"integer").
" ";
326 $add = $where.
" usr_data.last_login < ".
333 if ($this->limited_access)
335 $add = $where.
" usr_data.time_limit_unlimited= ".$ilDB->quote(0,
"integer");
341 if($this->has_access)
343 $unlimited =
"time_limit_unlimited = ". $ilDB->quote(1,
'integer');
344 $from =
"time_limit_from < ". $ilDB->quote(
time(),
'integer');
345 $until =
"time_limit_until > ". $ilDB->quote(
time(),
'integer');
347 $add = $where.
' (' .$unlimited.
' OR ('.$from.
' AND ' .$until.
'))';
352 if ($this->no_courses)
354 $add = $where.
" usr_data.usr_id NOT IN (".
355 "SELECT DISTINCT ud.usr_id ".
356 "FROM usr_data ud join rbac_ua ON (ud.usr_id = rbac_ua.usr_id) ".
357 "JOIN object_data od ON (rbac_ua.rol_id = od.obj_id) ".
358 "WHERE od.title LIKE 'il_crs_%')";
363 if ($this->no_groups)
365 $add = $where.
" usr_data.usr_id NOT IN (".
366 "SELECT DISTINCT ud.usr_id ".
367 "FROM usr_data ud join rbac_ua ON (ud.usr_id = rbac_ua.usr_id) ".
368 "JOIN object_data od ON (rbac_ua.rol_id = od.obj_id) ".
369 "WHERE od.title LIKE 'il_grp_%')";
374 if ($this->crs_grp > 0)
377 $add = $where.
" usr_data.usr_id IN (".
378 "SELECT DISTINCT ud.usr_id ".
379 "FROM usr_data ud join rbac_ua ON (ud.usr_id = rbac_ua.usr_id) ".
380 "JOIN object_data od ON (rbac_ua.rol_id = od.obj_id) ".
381 "WHERE od.title = ".$ilDB->quote(
"il_".$cgtype.
"_member_".$this->crs_grp,
"text").
")";
388 $add = $where.
" usr_data.usr_id IN (".
389 "SELECT DISTINCT ud.usr_id ".
390 "FROM usr_data ud join rbac_ua ON (ud.usr_id = rbac_ua.usr_id) ".
391 "WHERE rbac_ua.rol_id = ".$ilDB->quote($this->role,
"integer").
")";
397 if($this->user_folder)
399 $add = $where.
" ".$ilDB->in(
'usr_data.time_limit_owner',$this->user_folder,
false,
'integer');
406 switch($this->order_field)
409 if ($this->order_dir ==
"desc")
411 $query.=
" ORDER BY usr_data.active DESC, usr_data.time_limit_unlimited DESC, usr_data.time_limit_until DESC";
415 $query.=
" ORDER BY usr_data.active ASC, usr_data.time_limit_unlimited ASC, usr_data.time_limit_until ASC";
420 if ($this->order_dir ==
"desc")
422 $query.=
" ORDER BY ut_online.online_time DESC";
426 $query.=
" ORDER BY ut_online.online_time ASC";
431 if (!in_array($this->order_field, $this->default_fields))
433 $this->order_field =
"login";
435 if ($this->order_dir !=
"asc" && $this->order_dir !=
"desc")
437 $this->order_dir =
"asc";
439 $query .=
" ORDER BY usr_data.".$this->order_field.
" ".strtoupper($this->order_dir);
444 $set = $ilDB->query($count_query);
446 if ($rec = $ilDB->fetchAssoc($set))
452 $limit = (int) $this->limit;
462 if(
sizeof($multi_fields))
468 $set = $ilDB->query(
$query);
470 while($rec = $ilDB->fetchAssoc($set))
474 if(
sizeof($multi_fields))
476 $usr_ids[] = $rec[
"usr_id"];
481 if(
sizeof($multi_fields) &&
sizeof($usr_ids))
483 $usr_multi =
array();
484 $set = $ilDB->query(
"SELECT * FROM usr_data_multi".
485 " WHERE ".$ilDB->in(
"usr_id", $usr_ids,
"",
"integer"));
486 while(
$row = $ilDB->fetchAssoc($set))
488 $usr_multi[
$row[
"usr_id"]][
$row[
"field_id"]][] = $row[
"value"];
490 foreach(
$result as $idx => $item)
492 if(isset($usr_multi[$item[
"usr_id"]]))
494 $result[$idx] = array_merge($item, $usr_multi[$item[
"usr_id"]]);
static _before(ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
compare two dates and check start is before end This method does not consider tz offsets.
Create styles array
The data for the language used.
static _lookupType($a_id, $a_reference=false)
lookup object type
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.