ILIAS  release_8 Revision v8.24
ilConsultationHourGroups Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Collaboration diagram for ilConsultationHourGroups:

Static Public Member Functions

static getGroupsOfUser (int $a_user_id)
 Get a all groups of an user. More...
 
static getCountGroupsOfUser (int $a_user_id)
 Get number of consultation hour groups. More...
 
static lookupTitle (int $a_group_id)
 Lookup group title. More...
 
static lookupMaxBookings (int $a_group_id)
 Lookup max number of bookings for group. More...
 
static getGroupSelectOptions (int $a_user_id)
 Get group selection options. More...
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 25 of file class.ilConsultationHourGroups.php.

Member Function Documentation

◆ getCountGroupsOfUser()

static ilConsultationHourGroups::getCountGroupsOfUser ( int  $a_user_id)
static

Get number of consultation hour groups.

Definition at line 49 of file class.ilConsultationHourGroups.php.

49 : int
50 {
51 global $DIC;
52
53 $ilDB = $DIC->database();
54 $query = 'SELECT COUNT(grp_id) num FROM cal_ch_group ' .
55 'WHERE usr_id = ' . $ilDB->quote($a_user_id, 'integer') . ' ' .
56 'GROUP BY grp_id';
57
58 $res = $ilDB->query($query);
59 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
60 return (int) $row->num;
61 }
62 return 0;
63 }
global $DIC
Definition: feed.php:28
$res
Definition: ltiservices.php:69
$query

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilConsultationHoursTableGUI\__construct(), and ilConsultationHoursGUI\createNewBookingEntry().

+ Here is the caller graph for this function:

◆ getGroupSelectOptions()

static ilConsultationHourGroups::getGroupSelectOptions ( int  $a_user_id)
static

Get group selection options.

Definition at line 102 of file class.ilConsultationHourGroups.php.

102 : array
103 {
104 global $DIC;
105
106 $lng = $DIC->language();
107 $groups = self::getGroupsOfUser($a_user_id);
108 if (!count($groups)) {
109 return array();
110 }
111 $options = array();
112 foreach ($groups as $group) {
113 $options[(string) $group->getGroupId()] = $group->getTitle();
114 }
115 asort($options, SORT_STRING);
116 $sorted_options = array();
117 $sorted_options[0] = $lng->txt('cal_ch_grp_no_assignment');
118 foreach ($options as $key => $opt) {
119 $sorted_options[$key] = $opt;
120 }
121 return $sorted_options;
122 }
static getGroupsOfUser(int $a_user_id)
Get a all groups of an user.
string $key
Consumer key/client ID value.
Definition: System.php:193
$lng

References $DIC, ILIAS\LTI\ToolProvider\$key, $lng, and getGroupsOfUser().

Referenced by ilConsultationHoursGUI\initFormSequence().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getGroupsOfUser()

static ilConsultationHourGroups::getGroupsOfUser ( int  $a_user_id)
static

Get a all groups of an user.

Returns
ilConsultationHourGroup[]

Definition at line 31 of file class.ilConsultationHourGroups.php.

31 : array
32 {
33 global $DIC;
34
35 $ilDB = $DIC->database();
36 $query = 'SELECT grp_id FROM cal_ch_group ' .
37 'WHERE usr_id = ' . $ilDB->quote($a_user_id, 'integer');
38 $res = $ilDB->query($query);
39 $groups = array();
40 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
41 $groups[] = new ilConsultationHourGroup((int) $row->grp_id);
42 }
43 return $groups;
44 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by getGroupSelectOptions(), ilConsultationHoursGUI\groupList(), ilPCConsultationHoursGUI\initForm(), and ilConsultationHoursGUI\saveSequence().

+ Here is the caller graph for this function:

◆ lookupMaxBookings()

static ilConsultationHourGroups::lookupMaxBookings ( int  $a_group_id)
static

Lookup max number of bookings for group.

Definition at line 85 of file class.ilConsultationHourGroups.php.

85 : int
86 {
87 global $DIC;
88
89 $ilDB = $DIC['ilDB'];
90 $query = 'SELECT multiple_assignments from cal_ch_group ' .
91 'WHERE grp_id = ' . $ilDB->quote($a_group_id, 'integer');
92 $res = $ilDB->query($query);
93 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
94 return (int) $row->multiple_assignments;
95 }
96 return 0;
97 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilBookingEntry\isAppointmentBookableForUser().

+ Here is the caller graph for this function:

◆ lookupTitle()

static ilConsultationHourGroups::lookupTitle ( int  $a_group_id)
static

Lookup group title.

Definition at line 68 of file class.ilConsultationHourGroups.php.

68 : string
69 {
70 global $DIC;
71
72 $ilDB = $DIC['ilDB'];
73 $query = 'SELECT title from cal_ch_group ' .
74 'WHERE grp_id = ' . $ilDB->quote($a_group_id, 'integer');
75 $res = $ilDB->query($query);
76 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
77 return $row->title;
78 }
79 return '';
80 }

References $DIC, $ilDB, $query, $res, and ilDBConstants\FETCHMODE_OBJECT.

Referenced by ilConsultationHoursTableGUI\parse().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: