ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilConsultationHourUtils Class Reference

Description of class. More...

+ Collaboration diagram for ilConsultationHourUtils:

Static Public Member Functions

static bookAppointment ($a_usr_id, $a_app_id)
 Book an appointment. More...
 
static cancelBooking ($a_usr_id, $a_app_id, $a_send_notification=true)
 Cancel a booking. More...
 
static lookupManagedUsers ($a_usr_id)
 Lookup managed users. More...
 

Detailed Description

Description of class.

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

Definition at line 10 of file class.ilConsultationHourUtils.php.

Member Function Documentation

◆ bookAppointment()

static ilConsultationHourUtils::bookAppointment (   $a_usr_id,
  $a_app_id 
)
static

Book an appointment.

All checks (assignment possible, max booking) must be done before

Parameters
type$a_usr_id
type$a_app_id
Returns
bool

Definition at line 20 of file class.ilConsultationHourUtils.php.

21 {
22 global $lng;
23
24 // Create new default consultation hour calendar
25 include_once './Services/Language/classes/class.ilLanguageFactory.php';
26 $cal_lang = ilLanguageFactory::_getLanguage($lng->getDefaultLanguage());
27 $cal_lang->loadLanguageModule('dateplaner');
28
29 include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
30 include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
33 $a_usr_id,
34 $cal_lang->txt('cal_ch_personal_ch'),
35 true
36 );
37
38 // duplicate appointment
39 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
40 $app = new ilCalendarEntry($a_app_id);
41 $personal_app = clone $app;
42 $personal_app->save();
43
44 // assign appointment to category
45 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
46 $assignment = new ilCalendarCategoryAssignments($personal_app->getEntryId());
47 $assignment->addAssignment($ch->getCategoryID());
48
49 // book appointment
50 include_once './Services/Booking/classes/class.ilBookingEntry.php';
51 $booking = new ilBookingEntry($app->getContextId());
52 $booking->book($app->getEntryId(),$a_usr_id);
53 return true;
54 }
Booking definition.
Model for a calendar entry.
static initDefaultCalendarByType($a_type_id, $a_usr_id, $a_title, $a_create=false)
Init the default calendar for given type and user.
static _getLanguage($a_lang_key='')
Get langauge object.
global $lng
Definition: privfeed.php:40

References $lng, ilLanguageFactory\_getLanguage(), ilCalendarUtil\initDefaultCalendarByType(), and ilCalendarCategory\TYPE_CH.

Referenced by ilConsultationHoursGUI\assignUsersToAppointment(), ilConsultationHoursGUI\assignUsersToGroup(), and ilCalendarAppointmentGUI\bookconfirmed().

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

◆ cancelBooking()

static ilConsultationHourUtils::cancelBooking (   $a_usr_id,
  $a_app_id,
  $a_send_notification = true 
)
static

Cancel a booking.

Parameters
type$a_usr_id
type$a_app_id
Returns
bool

Definition at line 62 of file class.ilConsultationHourUtils.php.

63 {
64 // Delete personal copy of appointment
65 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
66 $app = new ilCalendarEntry($a_app_id);
67
68 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
70 $a_usr_id,
71 $app->getContextId(),
72 $app->getStart(),
74 false
75 );
76 foreach($user_apps as $uapp_id)
77 {
78 $uapp = new ilCalendarEntry($uapp_id);
79 $uapp->delete();
80
81 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
83
84 break;
85 }
86
87 // Delete booking entries
88 // Send notification
89 $booking = new ilBookingEntry($app->getContextId());
90 if($a_send_notification)
91 {
92 $booking->cancelBooking($a_app_id,$a_usr_id);
93 }
94 else
95 {
96 $booking->deleteBooking($a_app_id, $a_usr_id);
97 }
98 return true;
99 }
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
static getAppointmentIds($a_user_id, $a_context_id=NULL, $a_start=NULL, $a_type=NULL, $a_check_owner=true)
Get all appointment ids.

References ilCalendarCategoryAssignments\_deleteByAppointmentId(), ilConsultationHourAppointments\getAppointmentIds(), and ilCalendarCategory\TYPE_CH.

Referenced by ilConsultationHoursGUI\delete(), and ilConsultationHoursGUI\rejectBooking().

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

◆ lookupManagedUsers()

static ilConsultationHourUtils::lookupManagedUsers (   $a_usr_id)
static

Lookup managed users.

Parameters
type$a_usr_id

Definition at line 105 of file class.ilConsultationHourUtils.php.

106 {
107 global $ilDB;
108
109 $query = 'SELECT user_id FROM cal_ch_settings '.
110 'WHERE admin_id = '.$ilDB->quote($a_usr_id,'integer');
111 $res = $ilDB->query($query);
112
113 $users = array();
114 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
115 {
116 $users[] = $row->user_id;
117 }
118 return $users;
119 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
global $ilDB

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilBookingEntry\lookupManagedBookingsForObject().

+ Here is the caller graph for this function:

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