ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilConsultationHourGroups.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
11 {
12 
18  public static function getGroupsOfUser($a_user_id)
19  {
20  global $ilDB;
21 
22  $query = 'SELECT grp_id FROM cal_ch_group ' .
23  'WHERE usr_id = ' . $ilDB->quote($a_user_id, 'integer');
24  $res = $ilDB->query($query);
25  $groups = array();
26  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
27  include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
28  $groups[] = new ilConsultationHourGroup($row->grp_id);
29  }
30  return $groups;
31  }
32 
39  public static function getCountGroupsOfUser($a_user_id)
40  {
41  global $ilDB;
42 
43  $query = 'SELECT COUNT(grp_id) num FROM cal_ch_group ' .
44  'WHERE usr_id = ' . $ilDB->quote($a_user_id, 'integer') . ' ' .
45  'GROUP BY grp_id';
46 
47  $res = $ilDB->query($query);
49  return (int) $row->num;
50  }
51 
55  public static function lookupAssignedAppointments()
56  {
57  global $ilDB;
58 
59  //@todo
60  }
61 
65  public static function lookupTitle($a_group_id)
66  {
67  global $ilDB;
68 
69  $query = 'SELECT title from cal_ch_group ' .
70  'WHERE grp_id = ' . $ilDB->quote($a_group_id, 'integer');
71  $res = $ilDB->query($query);
72  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
73  return $row->title;
74  }
75  return '';
76  }
77 
84  public static function lookupMaxBookings($a_group_id)
85  {
86  global $ilDB;
87 
88  $query = 'SELECT multiple_assignments from cal_ch_group ' .
89  'WHERE grp_id = ' . $ilDB->quote($a_group_id, 'integer');
90  $res = $ilDB->query($query);
91  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
92  return $row->multiple_assignments;
93  }
94  return 0;
95  }
96 
97 
102  public static function getGroupSelectOptions($a_user_id)
103  {
104  global $lng;
105 
106  $groups = self::getGroupsOfUser($a_user_id);
107  if (!count($groups)) {
108  return array();
109  }
110  $options = array();
111  foreach ($groups as $group) {
112  $options[(string) $group->getGroupId()] = $group->getTitle();
113  }
114  asort($options, SORT_STRING);
115  $sorted_options = array();
116  $sorted_options[0] = $lng->txt('cal_ch_grp_no_assignment');
117  foreach ($options as $key => $opt) {
118  $sorted_options[$key] = $opt;
119  }
120  return $sorted_options;
121  }
122 }
Add rich text string
static lookupTitle($a_group_id)
Lookup group title.
static getGroupSelectOptions($a_user_id)
Get group selection options.
static getGroupsOfUser($a_user_id)
Get a all groups of an user.
foreach($_POST as $key=> $value) $res
$query
static lookupAssignedAppointments()
Lookup number of assigned appointments.
Create styles array
The data for the language used.
static lookupMaxBookings($a_group_id)
Lookup max number of bookings for group type $ilDB.
global $lng
Definition: privfeed.php:17
global $ilDB
static getCountGroupsOfUser($a_user_id)
Get number of consultation hour groups type $ilDB.
$key
Definition: croninfo.php:18
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20