ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilConsultationHoursGUI Class Reference

Consultation hours editor. More...

+ Collaboration diagram for ilConsultationHoursGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getUserId ()
 Get user id. More...
 
 assignUsersToAppointments (array $users)
 Assign users to multiple appointments. More...
 
 assignUsersToAppointment (array $users, $a_app=0, $a_redirect=true)
 Assign users to an appointment. More...
 
 assignUsersToGroup (array $usr_ids)
 
 edit ()
 Edit multiple sequence items. More...
 
 confirmDelete ()
 confirm delete for multiple entries More...
 
 delete ()
 delete multiple entries More...
 
 showProfile ()
 show public profile of given user More...
 
 settings ()
 display settings gui More...
 
 updateSettings ()
 save settings More...
 

Data Fields

const MODE_CREATE = 1
 
const MODE_UPDATE = 2
 
const MODE_MULTI = 3
 
const MAX_APPOINTMENTS_PER_SEQUENCE = 1000
 

Protected Member Functions

 searchUsersForAppointments ()
 start searching for users More...
 
 sendInfoAboutUnassignedUsers ($unassigned)
 Send info message about unassigned users. More...
 
 groupList ()
 Show consultation hour group @global type $ilToolbar. More...
 
 addGroup (ilPropertyFormGUI $form=null)
 Show add group form @global type $ilToolbar @global type $ilTabs. More...
 
 saveGroup ()
 Save new group. More...
 
 editGroup (ilPropertyFormGUI $form=null)
 Edit group @global type $ilCtrl. More...
 
 updateGroup ()
 Update group @global type $ilCtrl @global type $tpl @global type $ilTabs. More...
 
 confirmDeleteGroup ()
 Confirm delete @global type $ilCtrl @global type $ilTabs. More...
 
 deleteGroup ()
 Delete groups. More...
 
 initGroupForm ($a_group_id=0)
 Init new/update group form. More...
 
 bookingList ()
 Show list of bookings. More...
 
 confirmDeleteBooking ()
 Show delete booking confirmation. More...
 
 confirmRejectBooking ($a_send_notification=true)
 Show delete booking confirmation. More...
 
 deleteBooking ()
 Delete booking. More...
 
 rejectBooking ($a_send_notification=true)
 
 appointmentList ()
 Show settings of consultation hours. More...
 
 createSequence ()
 Create new sequence. More...
 
 initFormSequence ($a_mode)
 Init form. More...
 
 saveSequence ()
 Save new sequence. More...
 
 createAppointments (ilBookingEntry $booking)
 Create calendar appointments. More...
 
 setTabs ()
 Set tabs. More...
 
 setSubTabs ()
 Set sub tabs @global type $ilTabs @global type $ilCtrl. More...
 
 createNewBookingEntry (\ilPropertyFormGUI $validate_form)
 
 rewriteBookingIdsForAppointments (\ilBookingEntry $booking, $appointments, \ilPropertyFormGUI $form)
 
 updateMulti ()
 Update multiple sequence items. More...
 
 getProfileBackUrl ()
 Build context-sensitive profile back url. More...
 
 initSettingsForm ()
 build settings form More...
 

Protected Attributes

 $user_id
 
 $ctrl
 
 $booking = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilConsultationHoursGUI::__construct ( )

Constructor.

Definition at line 50 of file class.ilConsultationHoursGUI.php.

51 {
52 global $DIC;
53
54 $lng = $DIC['lng'];
55 $ilCtrl = $DIC['ilCtrl'];
56 $tpl = $DIC['tpl'];
57 $ilUser = $DIC['ilUser'];
58
59 $user_id = (int) $_GET['user_id'];
60 if ($user_id) {
61 if (in_array($user_id, array_keys(ilConsultationHourAppointments::getManagedUsers()))) {
62 $this->user_id = $user_id;
63 } else {
64 $user_id = false;
65 }
66 }
67 if (!$user_id) {
68 $this->user_id = $ilUser->getId();
69 }
70
71 $this->ctrl = $ilCtrl;
72 $this->lng = $lng;
73 $this->tpl = $tpl;
74 }
$_GET["client_id"]
static getManagedUsers()
Get all managed consultation hours users for current users.
global $ilCtrl
Definition: ilias.php:18
$lng
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
$ilUser
Definition: imgupload.php:18
$DIC
Definition: xapitoken.php:46

References $_GET, $DIC, $ilCtrl, $ilUser, $lng, $tpl, $user_id, and ilConsultationHourAppointments\getManagedUsers().

+ Here is the call graph for this function:

Member Function Documentation

◆ addGroup()

ilConsultationHoursGUI::addGroup ( ilPropertyFormGUI  $form = null)
protected

Show add group form @global type $ilToolbar @global type $ilTabs.

Definition at line 348 of file class.ilConsultationHoursGUI.php.

349 {
350 global $DIC;
351
352 $ilTabs = $DIC['ilTabs'];
353 $tpl = $DIC['tpl'];
354
355 $this->setSubTabs();
356 $ilTabs->activateSubTab('cal_ch_app_grp');
357
358 if ($form == null) {
359 $form = $this->initGroupForm();
360 }
361 $tpl->setContent($form->getHTML());
362 }
initGroupForm($a_group_id=0)
Init new/update group form.
setSubTabs()
Set sub tabs @global type $ilTabs @global type $ilCtrl.

References $DIC, $tpl, initGroupForm(), and setSubTabs().

Referenced by saveGroup().

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

◆ appointmentList()

ilConsultationHoursGUI::appointmentList ( )
protected

Show settings of consultation hours.

Todo:
add list/filter of consultation hours if user is responsible for more than one other consultation hour series.
Returns

Definition at line 658 of file class.ilConsultationHoursGUI.php.

659 {
660 global $DIC;
661
662 $ilToolbar = $DIC['ilToolbar'];
663 $ilHelp = $DIC['ilHelp'];
664 $ilTabs = $DIC['ilTabs'];
665
666 $ilHelp->setScreenId("consultation_hours");
667
668 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
669 $ilToolbar->addButton($this->lng->txt('cal_ch_add_sequence'), $this->ctrl->getLinkTarget($this, 'createSequence'));
670
671 $this->setSubTabs();
672 $ilTabs->activateSubTab('cal_ch_app_list');
673
674 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursTableGUI.php';
675 $tbl = new ilConsultationHoursTableGUI($this, 'appointmentList', $this->getUserId());
676 $tbl->parse();
677 $this->tpl->setContent($tbl->getHTML());
678 }
Consultation hours administration.

References $DIC, getUserId(), and setSubTabs().

Referenced by confirmDelete(), delete(), and edit().

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

◆ assignUsersToAppointment()

ilConsultationHoursGUI::assignUsersToAppointment ( array  $users,
  $a_app = 0,
  $a_redirect = true 
)

Assign users to an appointment.

Parameters
array$usr_ids
Returns
array $unassigned_users

Definition at line 226 of file class.ilConsultationHoursGUI.php.

227 {
228 global $DIC;
229
230 $ilCtrl = $DIC['ilCtrl'];
231
232 if ($a_app) {
233 $app = $a_app;
234 } else {
235 $app = $_REQUEST['apps'];
236 }
237
238 if (!count($users)) {
239 ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('select_one'), true);
240 return false;
241 }
242
243
244 include_once './Services/Booking/classes/class.ilBookingEntry.php';
246
247 $assigned_users = array();
248 foreach ($users as $user) {
249 if ($booking->getCurrentNumberOfBookings($app) >= $booking->getNumberOfBookings()) {
250 break;
251 }
252 if (!ilBookingEntry::lookupBookingsOfUser((array) $app, $user)) {
253 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
255 $assigned_users[] = $user;
256 }
257 }
258
259 $unassigned_users = array_diff($users, $assigned_users);
260
261 if ($a_redirect) {
262 $this->sendInfoAboutUnassignedUsers($unassigned_users);
263 $ilCtrl->redirect($this, 'appointmentList');
264 } else {
265 return $unassigned_users;
266 }
267 }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static lookupBookingsOfUser($a_app_ids, $a_usr_id, ilDateTime $start=null)
Lookup bookings if user.
static getInstanceByCalendarEntryId($a_id)
Get instance by calendar entry.
static bookAppointment($a_usr_id, $a_app_id)
Book an appointment.
sendInfoAboutUnassignedUsers($unassigned)
Send info message about unassigned users.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$app
Definition: cli.php:38
language()
Definition: language.php:2

References $app, $booking, $DIC, $GLOBALS, $ilCtrl, ilConsultationHourUtils\bookAppointment(), ilBookingEntry\getInstanceByCalendarEntryId(), language(), ilBookingEntry\lookupBookingsOfUser(), ilUtil\sendFailure(), and sendInfoAboutUnassignedUsers().

Referenced by assignUsersToAppointments().

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

◆ assignUsersToAppointments()

ilConsultationHoursGUI::assignUsersToAppointments ( array  $users)

Assign users to multiple appointments.

Parameters
type$users

Definition at line 205 of file class.ilConsultationHoursGUI.php.

206 {
207 global $DIC;
208
209 $ilCtrl = $DIC['ilCtrl'];
210
211 $unassigned_users = array();
212 foreach ($_SESSION['ch_apps'] as $app) {
213 $unassigned_users = array_unique(array_merge($unassigned_users, $this->assignUsersToAppointment($users, $app, false)));
214 }
215
216 $this->sendInfoAboutUnassignedUsers($unassigned_users);
217 $ilCtrl->redirect($this, 'appointmentList');
218 }
$_SESSION["AccountId"]
assignUsersToAppointment(array $users, $a_app=0, $a_redirect=true)
Assign users to an appointment.

References $_SESSION, $app, $DIC, $ilCtrl, assignUsersToAppointment(), and sendInfoAboutUnassignedUsers().

+ Here is the call graph for this function:

◆ assignUsersToGroup()

ilConsultationHoursGUI::assignUsersToGroup ( array  $usr_ids)
Parameters
array$usr_ids
type$type

Definition at line 274 of file class.ilConsultationHoursGUI.php.

275 {
276 global $DIC;
277
278 $ilCtrl = $DIC['ilCtrl'];
279
280 $group_id = (int) $_REQUEST['grp_id'];
281
282 $tomorrow = new ilDateTime(time(), IL_CAL_UNIX);
283 $tomorrow->increment(IL_CAL_DAY, 1);
284
285 // Get all future consultation hours
286 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
287 include_once './Services/Booking/classes/class.ilBookingEntry.php';
289 $this->user_id,
290 $group_id,
291 $tomorrow
292 );
293 $users = $usr_ids;
294 $assigned_users = array();
295 foreach ($apps as $app) {
297 foreach ($users as $user) {
298 if ($booking->getCurrentNumberOfBookings($app) >= $booking->getNumberOfBookings()) {
299 break;
300 }
301 if (!ilBookingEntry::lookupBookingsOfUser($apps, $user)) {
302 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
304 $assigned_users[] = $user;
305 }
306 }
307 }
308
309 $this->sendInfoAboutUnassignedUsers(array_diff($users, $assigned_users));
310 $ilCtrl->redirect($this, 'bookingList');
311 }
const IL_CAL_UNIX
const IL_CAL_DAY
static getAppointmentIdsByGroup($a_user_id, $a_ch_group_id, ilDateTime $start=null)
Get appointment ids by consultation hour group.
@classDescription Date and time handling

References $app, $booking, $DIC, $ilCtrl, ilConsultationHourUtils\bookAppointment(), ilConsultationHourAppointments\getAppointmentIdsByGroup(), ilBookingEntry\getInstanceByCalendarEntryId(), IL_CAL_DAY, IL_CAL_UNIX, ilBookingEntry\lookupBookingsOfUser(), and sendInfoAboutUnassignedUsers().

+ Here is the call graph for this function:

◆ bookingList()

ilConsultationHoursGUI::bookingList ( )
protected

Show list of bookings.

Definition at line 540 of file class.ilConsultationHoursGUI.php.

541 {
542 global $DIC;
543
544 $ilToolbar = $DIC['ilToolbar'];
545 $ilTabs = $DIC['ilTabs'];
546 $tpl = $DIC['tpl'];
547 $ilHelp = $DIC['ilHelp'];
548
549 $ilHelp->setScreenId("consultation_hours");
550
551 $this->setSubTabs();
552 $ilTabs->activateSubTab('cal_ch_app_bookings');
553
554 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourBookingTableGUI.php';
555 $btable = new ilConsultationHourBookingTableGUI($this, 'bookingList', $this->getUserId());
557 $tpl->setContent($btable->getHTML());
558 }
static getAppointmentIds($a_user_id, $a_context_id=null, $a_start=null, $a_type=null, $a_check_owner=true)
Get all appointment ids.

References $DIC, $tpl, ilConsultationHourAppointments\getAppointmentIds(), getUserId(), and setSubTabs().

+ Here is the call graph for this function:

◆ confirmDelete()

ilConsultationHoursGUI::confirmDelete ( )

confirm delete for multiple entries

Definition at line 1170 of file class.ilConsultationHoursGUI.php.

1171 {
1172 global $DIC;
1173
1174 $tpl = $DIC['tpl'];
1175
1176 if (!isset($_REQUEST['apps'])) {
1177 ilUtil::sendFailure($this->lng->txt('select_one'));
1178 return $this->appointmentList();
1179 }
1180
1181 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
1182
1183
1184 $this->ctrl->saveParameter($this, array('seed','app_id','dt'));
1185
1186 $confirm = new ilConfirmationGUI();
1187 $confirm->setFormAction($this->ctrl->getFormAction($this));
1188 $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
1189 $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
1190
1191 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1192
1193 $bookings_available = array();
1194 foreach ((array) $_REQUEST['apps'] as $entry_id) {
1195 $entry = new ilCalendarEntry($entry_id);
1196 $confirm->addItem('apps[]', $entry_id, ilDatePresentation::formatDate($entry->getStart()) . ', ' . $entry->getTitle());
1197
1198 include_once './Services/Booking/classes/class.ilBookingEntry.php';
1200 $bookings_available[] = ilDatePresentation::formatDate($entry->getStart()) . ', ' . $entry->getTitle();
1201 }
1202 }
1203
1204 if ($bookings_available) {
1205 ilUtil::sendInfo($this->lng->txt('cal_ch_delete_app_booking_info') . '<br />' . implode('<br />', $bookings_available));
1206 }
1207
1208 $confirm->setConfirm($this->lng->txt('delete'), 'delete');
1209 $confirm->setCancel($this->lng->txt('cancel'), 'appointmentList');
1210
1211 $tpl->setContent($confirm->getHTML());
1212 }
static lookupBookingsForAppointment($a_app_id)
Lookup booked users for appointment @global type $ilDB.
Model for a calendar entry.
Confirmation screen class.
appointmentList()
Show settings of consultation hours.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $DIC, $tpl, appointmentList(), ilDatePresentation\formatDate(), ilBookingEntry\lookupBookingsForAppointment(), ilUtil\sendFailure(), and ilUtil\sendInfo().

+ Here is the call graph for this function:

◆ confirmDeleteBooking()

ilConsultationHoursGUI::confirmDeleteBooking ( )
protected

Show delete booking confirmation.

Definition at line 563 of file class.ilConsultationHoursGUI.php.

564 {
565 $this->confirmRejectBooking(false);
566 }
confirmRejectBooking($a_send_notification=true)
Show delete booking confirmation.

References confirmRejectBooking().

+ Here is the call graph for this function:

◆ confirmDeleteGroup()

ilConsultationHoursGUI::confirmDeleteGroup ( )
protected

Confirm delete @global type $ilCtrl @global type $ilTabs.

Definition at line 447 of file class.ilConsultationHoursGUI.php.

448 {
449 global $DIC;
450
451 $ilCtrl = $DIC['ilCtrl'];
452 $ilTabs = $DIC['ilTabs'];
453 $tpl = $DIC['tpl'];
454
455 $ilCtrl->setParameter($this, 'grp_id', (int) $_REQUEST['grp_id']);
456 $groups = array((int) $_REQUEST['grp_id']);
457
458 $this->setSubTabs();
459 $ilTabs->activateSubTab('cal_ch_app_grp');
460
461
462 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
463 $confirm = new ilConfirmationGUI();
464 $confirm->setFormAction($ilCtrl->getFormAction($this));
465 $confirm->setHeaderText($GLOBALS['DIC']['lng']->txt('cal_ch_grp_delete_sure'));
466 $confirm->setConfirm($GLOBALS['DIC']['lng']->txt('delete'), 'deleteGroup');
467 $confirm->setCancel($GLOBALS['DIC']['lng']->txt('cancel'), 'groupList');
468
469 foreach ($groups as $grp_id) {
470 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
471 $group = new ilConsultationHourGroup($grp_id);
472
473 $confirm->addItem('groups[]', $grp_id, $group->getTitle());
474 }
475 $tpl->setContent($confirm->getHTML());
476 }

References $DIC, $GLOBALS, $ilCtrl, $tpl, and setSubTabs().

+ Here is the call graph for this function:

◆ confirmRejectBooking()

ilConsultationHoursGUI::confirmRejectBooking (   $a_send_notification = true)
protected

Show delete booking confirmation.

Definition at line 571 of file class.ilConsultationHoursGUI.php.

572 {
573 global $DIC;
574
575 $ilTabs = $DIC['ilTabs'];
576 $tpl = $DIC['tpl'];
577
578 $this->setSubTabs();
579 $ilTabs->activateSubTab('cal_ch_app_bookings');
580
581 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
582
583 $confirm = new ilConfirmationGUI();
584 $confirm->setFormAction($this->ctrl->getFormAction($this));
585
586 if ($a_send_notification) {
587 ilUtil::sendInfo($this->lng->txt('cal_ch_cancel_booking_info'));
588 $confirm->setHeaderText($this->lng->txt('cal_ch_cancel_booking_sure'));
589 $confirm->setConfirm($this->lng->txt('cal_ch_reject_booking'), 'rejectBooking');
590 } else {
591 ilUtil::sendInfo($this->lng->txt('cal_ch_delete_booking_info'));
592 $confirm->setHeaderText($this->lng->txt('cal_ch_delete_booking_sure'));
593 $confirm->setConfirm($this->lng->txt('cal_ch_delete_booking'), 'deleteBooking');
594 }
595
596 $confirm->setCancel($this->lng->txt('cancel'), 'bookingList');
597
598 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
599 foreach ((array) $_REQUEST['bookuser'] as $bookuser) {
600 $ids = explode('_', $bookuser);
601
602 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
603 include_once './Services/User/classes/class.ilUserUtil.php';
604 $entry = new ilCalendarEntry($ids[0]);
605 $confirm->addItem(
606 'bookuser[]',
607 $bookuser,
609 $ids[1],
610 true,
611 false,
612 '',
613 true,
614 true
615 ) . ', ' . ilDatePresentation::formatDate($entry->getStart())
616 );
617 }
618 $tpl->setContent($confirm->getHTML());
619 }
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:

References $DIC, $tpl, ilDatePresentation\formatDate(), ilUserUtil\getNamePresentation(), ilUtil\sendInfo(), and setSubTabs().

Referenced by confirmDeleteBooking().

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

◆ createAppointments()

ilConsultationHoursGUI::createAppointments ( ilBookingEntry  $booking)
protected

Create calendar appointments.

Parameters
ilBookingEntry$booking
Returns

Definition at line 888 of file class.ilConsultationHoursGUI.php.

889 {
890 include_once './Services/Calendar/classes/class.ilDateList.php';
891 $concurrent_dates = new ilDateList(ilDateList::TYPE_DATETIME);
892 $start = clone $this->form->getItemByPostVar('st')->getDate();
893 for ($i = 0; $i < $this->form->getItemByPostVar('ap')->getValue(); $i++) {
894 $concurrent_dates->add(clone $start);
895
896 $start->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
897 $start->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
898 #$start = new ilDateTime(,IL_CAL_UNIX);
899 }
900
901 include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
902 $def_cat = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_CH, $this->getUserId(), $this->lng->txt('cal_ch_personal_ch'), true);
903
904 // Add calendar appointment for each
905 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
906 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
907 include_once './Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
908 include_once './Services/Booking/classes/class.ilBookingPeriod.php';
909
910 $num_appointments = 0;
911 foreach ($concurrent_dates as $dt) {
912 if ($num_appointments >= self::MAX_APPOINTMENTS_PER_SEQUENCE) {
913 break;
914 }
915
916 $end = clone $dt;
917 $end->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
918 $end->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
919
921 new ilBookingPeriod($dt, $end),
922 $this->form->getItemByPostVar('frequence')->getRecurrence()
923 );
924
925 // Calculate with one year limit
926 $limit = clone $dt;
927 $limit->increment(ilDateTime::YEAR, 1);
928
929 $date_list = $calc->calculateDateList($dt, $limit);
930
931 $num = 0;
932 foreach ($date_list as $app_start) {
933 $app_end = clone $app_start;
934 $app_end->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
935 $app_end->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
936
937
938 $entry = new ilCalendarEntry();
939 $entry->setContextId($booking->getId());
940 $entry->setTitle($this->form->getInput('ti'));
941 $entry->setSubtitle("#consultationhour#"); // dynamic, see ilCalendarEntry
942 $entry->setDescription($this->form->getInput('de'));
943 $entry->setLocation($this->form->getInput('lo'));
944 $entry->setStart($app_start);
945 $entry->setEnd($app_end);
946
947 $entry->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
948 $entry->save();
949
950 $cat_assign = new ilCalendarCategoryAssignments($entry->getEntryId());
951 $cat_assign->addAssignment($def_cat->getCategoryID());
952
953 $num_appointments++;
954 }
955 }
956 }
const IL_CAL_TRANSLATION_SYSTEM
Booking period Used for calculation of recurring events.
Calculates an ilDateList for a given calendar entry and recurrence rule.
static initDefaultCalendarByType($a_type_id, $a_usr_id, $a_title, $a_create=false)
Init the default calendar for given type and user.
List of dates.
$i
Definition: metadata.php:24

References $booking, $i, getUserId(), ilDateTime\HOUR, IL_CAL_TRANSLATION_SYSTEM, ilCalendarUtil\initDefaultCalendarByType(), ilDateTime\MINUTE, ilCalendarCategory\TYPE_CH, ilDateList\TYPE_DATETIME, and ilDateTime\YEAR.

Referenced by saveSequence().

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

◆ createNewBookingEntry()

ilConsultationHoursGUI::createNewBookingEntry ( \ilPropertyFormGUI  $validate_form)
protected
Parameters
ilPropertyFormGUI$validated_form
Returns
\ilBookingEntry | null

Definition at line 1062 of file class.ilConsultationHoursGUI.php.

1063 {
1064 global $DIC;
1065
1066 $obj_cache = $DIC['ilObjDataCache'];
1067
1068 $booking = new \ilBookingEntry();
1069 $booking->setObjId($this->user_id);
1070 $booking->setNumberOfBookings((int) $this->form->getInput('bo'));
1071
1072 $deadline = $this->form->getInput('dead');
1073 $deadline = $deadline['dd'] * 24 + $deadline['hh'];
1074 $booking->setDeadlineHours($deadline);
1075
1076 $tgt = explode(',', (string) $this->form->getInput('tgt'));
1077 $obj_ids = [];
1078 foreach ((array) $tgt as $ref_id) {
1079 if (!trim($ref_id)) {
1080 continue;
1081 }
1082 $obj_id = $obj_cache->lookupObjId($ref_id);
1083 $type = ilObject::_lookupType($obj_id);
1084 $valid_types = ['crs', 'grp'];
1085 if (!$obj_id or !in_array($type, $valid_types)) {
1086 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_repository_object'));
1087 return null;
1088 }
1089 $obj_ids[] = $obj_id;
1090 }
1091 $booking->setTargetObjIds($obj_ids);
1092
1094 $booking->setBookingGroup($this->form->getInput('grp'));
1095 }
1096 $booking->save();
1097 return $booking;
1098 }
static getCountGroupsOfUser($a_user_id)
Get number of consultation hour groups @global type $ilDB.
static _lookupType($a_id, $a_reference=false)
lookup object type
$type

References $booking, $DIC, $type, ilObject\_lookupType(), ilConsultationHourGroups\getCountGroupsOfUser(), getUserId(), and ilUtil\sendFailure().

Referenced by updateMulti().

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

◆ createSequence()

ilConsultationHoursGUI::createSequence ( )
protected

Create new sequence.

Returns

Definition at line 684 of file class.ilConsultationHoursGUI.php.

685 {
686 $this->initFormSequence(self::MODE_CREATE);
687
688 $this->booking = new ilBookingEntry();
689 $this->form->getItemByPostVar('bo')->setValue($this->booking->getNumberOfBookings());
690 $this->form->getItemByPostVar('ap')->setValue(1);
691 $this->form->getItemByPostVar('du')->setMinutes(15);
692 $this->form->getItemByPostVar('st')->setDate(
693 new ilDateTime(mktime(8, 0, 0, date('n', time()), date('d', time()), date('Y', time())), IL_CAL_UNIX)
694 );
695
696 $this->tpl->setContent($this->form->getHTML());
697 }
Booking definition.

References IL_CAL_UNIX, and initFormSequence().

+ Here is the call graph for this function:

◆ delete()

ilConsultationHoursGUI::delete ( )

delete multiple entries

Definition at line 1217 of file class.ilConsultationHoursGUI.php.

1218 {
1219 if (!isset($_POST['apps'])) {
1220 ilUtil::sendFailure($this->lng->txt('select_one'));
1221 return $this->appointmentList();
1222 }
1223
1224 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1225 include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1226 foreach ($_POST['apps'] as $entry_id) {
1227 // cancel booking for users
1229 if ($booking) {
1230 foreach ($booking->getCurrentBookings($entry_id) as $user_id) {
1231 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1233 }
1234 }
1235 // remove calendar entries
1236 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1237 $entry = new ilCalendarEntry($entry_id);
1238 $entry->delete();
1239
1241 }
1242
1244
1245 ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
1246 $this->ctrl->redirect($this, 'appointmentList');
1247 }
$_POST["username"]
static removeObsoleteEntries()
Remove unused booking entries.
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
static cancelBooking($a_usr_id, $a_app_id, $a_send_notification=true)
Cancel a booking.

References $_POST, $booking, $user_id, ilCalendarCategoryAssignments\_deleteByAppointmentId(), appointmentList(), ilConsultationHourUtils\cancelBooking(), ilBookingEntry\getInstanceByCalendarEntryId(), ilBookingEntry\removeObsoleteEntries(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ deleteBooking()

ilConsultationHoursGUI::deleteBooking ( )
protected

Delete booking.

Definition at line 624 of file class.ilConsultationHoursGUI.php.

625 {
626 $this->rejectBooking(false);
627 }
rejectBooking($a_send_notification=true)

References rejectBooking().

+ Here is the call graph for this function:

◆ deleteGroup()

ilConsultationHoursGUI::deleteGroup ( )
protected

Delete groups.

Definition at line 481 of file class.ilConsultationHoursGUI.php.

482 {
483 global $DIC;
484
485 $ilCtrl = $DIC['ilCtrl'];
486
487 foreach ((array) $_REQUEST['groups'] as $grp_id) {
488 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
489 $group = new ilConsultationHourGroup($grp_id);
490 $group->delete();
491 }
492 ilUtil::sendSuccess($GLOBALS['DIC']['lng']->txt('cal_ch_grp_deleted'));
493 $ilCtrl->redirect($this, 'groupList');
494 }

References $DIC, $GLOBALS, and $ilCtrl.

◆ edit()

ilConsultationHoursGUI::edit ( )

Edit multiple sequence items.

Definition at line 1005 of file class.ilConsultationHoursGUI.php.

1006 {
1007 global $DIC;
1008
1009 $ilTabs = $DIC['ilTabs'];
1010
1011 if (!isset($_REQUEST['apps'])) {
1012 ilUtil::sendFailure($this->lng->txt('select_one'));
1013 return $this->appointmentList();
1014 }
1015
1016 $this->initFormSequence(self::MODE_MULTI);
1017
1018 if ($_REQUEST['apps'] && !is_array($_REQUEST['apps'])) {
1019 $_REQUEST['apps'] = explode(';', $_REQUEST['apps']);
1020 }
1021
1022 $hidden = new ilHiddenInputGUI('apps');
1023 $hidden->setValue(implode(';', $_REQUEST['apps']));
1024 $this->form->addItem($hidden);
1025
1026 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1027 $first = $_REQUEST['apps'];
1028 $first = array_shift($_REQUEST['apps']);
1029 $entry = new ilCalendarEntry($first);
1030
1031 $this->form->getItemByPostVar('ti')->setValue($entry->getTitle());
1032 $this->form->getItemByPostVar('lo')->setValue($entry->getLocation());
1033 $this->form->getItemByPostVar('de')->setValue($entry->getDescription());
1034
1035 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1036 $booking = new ilBookingEntry($entry->getContextId());
1037
1038 $this->form->getItemByPostVar('bo')->setValue($booking->getNumberOfBookings());
1039
1040 $ref_ids = array();
1041 foreach ($booking->getTargetObjIds() as $obj_id) {
1042 $refs = ilObject::_getAllReferences($obj_id);
1043 $ref_ids[] = end($refs);
1044 }
1045 $this->form->getItemByPostVar('tgt')->setValue(implode(',', $ref_ids));
1046
1047 $deadline = $booking->getDeadlineHours();
1048 $this->form->getItemByPostVar('dead')->setDays(floor($deadline / 24));
1049 $this->form->getItemByPostVar('dead')->setHours($deadline % 24);
1050
1051 if ($booking->getBookingGroup()) {
1052 $this->form->getItemByPostVar('grp')->setValue($booking->getBookingGroup());
1053 }
1054
1055 $this->tpl->setContent($this->form->getHTML());
1056 }
This class represents a hidden form property in a property form.
static _getAllReferences($a_id)
get all reference ids of object

References $booking, $DIC, ilObject\_getAllReferences(), appointmentList(), initFormSequence(), and ilUtil\sendFailure().

Referenced by updateMulti().

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

◆ editGroup()

ilConsultationHoursGUI::editGroup ( ilPropertyFormGUI  $form = null)
protected

Edit group @global type $ilCtrl.

Parameters
ilPropertyFormGUI$form

Definition at line 391 of file class.ilConsultationHoursGUI.php.

392 {
393 global $DIC;
394
395 $ilCtrl = $DIC['ilCtrl'];
396 $tpl = $DIC['tpl'];
397 $ilTabs = $DIC['ilTabs'];
398
399 $ilCtrl->setParameter($this, 'grp_id', (int) $_REQUEST['grp_id']);
400 $this->setSubTabs();
401 $ilTabs->activateSubTab('cal_ch_app_grp');
402
403 if ($form == null) {
404 $form = $this->initGroupForm((int) $_REQUEST['grp_id']);
405 }
406 $tpl->setContent($form->getHTML());
407 }

References $DIC, $ilCtrl, $tpl, initGroupForm(), and setSubTabs().

Referenced by updateGroup().

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

◆ executeCommand()

ilConsultationHoursGUI::executeCommand ( )

Execute command.

Returns

Definition at line 80 of file class.ilConsultationHoursGUI.php.

81 {
82 global $DIC;
83
84 $ilUser = $DIC['ilUser'];
85 $ilCtrl = $DIC['ilCtrl'];
86 $tpl = $DIC['tpl'];
87 $ilHelp = $DIC['ilHelp'];
88 $ilTabs = $DIC['ilTabs'];
89
90 $ilHelp->setScreenIdComponent("cal");
91
92 switch ($this->ctrl->getNextClass()) {
93 case "ilpublicuserprofilegui":
94 include_once('./Services/User/classes/class.ilPublicUserProfileGUI.php');
95 #22168 don't send the current user if no GET user_id
96 //$profile = new ilPublicUserProfileGUI($this->user_id);
97 $profile = new ilPublicUserProfileGUI();
98 $profile->setBackUrl($this->getProfileBackUrl());
99 $ret = $ilCtrl->forwardCommand($profile);
100 $tpl->setContent($ret);
101 break;
102
103 case 'ilrepositorysearchgui':
104
105 include_once('./Services/Search/classes/class.ilRepositorySearchGUI.php');
106 $rep_search = new ilRepositorySearchGUI();
107
108 if (isset($_REQUEST['assignM'])) {
109 $rep_search->setCallback(
110 $this,
111 'assignUsersToAppointments',
112 array()
113 );
114 $ilCtrl->setParameter($this, 'assignM', 1);
115 $ilCtrl->setReturn($this, 'appointmentList');
116 $ilTabs->activateSubTab('cal_ch_app_list');
117 } elseif (isset($_REQUEST['grp_id'])) {
118 $rep_search->setCallback(
119 $this,
120 'assignUsersToGroup',
121 array()
122 );
123 $ilCtrl->saveParameter($this, 'grp_id');
124 $ilCtrl->setReturn($this, 'groupList');
125 $ilTabs->activateSubTab('cal_ch_app_grp');
126 } elseif (isset($_REQUEST['apps'])) {
127 $rep_search->setCallback(
128 $this,
129 'assignUsersToAppointment',
130 array()
131 );
132 $ilCtrl->saveParameter($this, 'apps');
133 $ilCtrl->setReturn($this, 'appointmentList');
134 $ilTabs->activateSubTab('cal_ch_app_list');
135 }
136 $ilCtrl->forwardCommand($rep_search);
137 break;
138
139 default:
140 $tpl->setTitle($this->lng->txt("cal_ch_form_header")); // #12220
141
142 $this->setTabs();
143 if ($ilUser->getId() != $this->user_id) {
144 $ilCtrl->setParameter($this, 'user_id', $this->user_id);
145 }
146
147 $cmd = $this->ctrl->getCmd('appointmentList');
148 $this->$cmd();
149 }
150 }
getProfileBackUrl()
Build context-sensitive profile back url.
GUI class for public user profile presentation.
$ret
Definition: parser.php:6

References $DIC, $ilCtrl, $ilUser, $ret, $tpl, getProfileBackUrl(), and setTabs().

Referenced by searchUsersForAppointments().

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

◆ getProfileBackUrl()

ilConsultationHoursGUI::getProfileBackUrl ( )
protected

Build context-sensitive profile back url.

Returns
string

Definition at line 1275 of file class.ilConsultationHoursGUI.php.

1276 {
1277 // from repository
1278 if (isset($_REQUEST["ref_id"])) {
1279 $url = $this->ctrl->getLinkTargetByClass('ilCalendarMonthGUI');
1280 }
1281 // from panel
1282 elseif (isset($_GET['panel'])) {
1283 $url = $this->ctrl->getLinkTargetByClass('ilCalendarPresentationGUI');
1284 }
1285 // from appointments
1286 else {
1287 $url = $this->ctrl->getLinkTarget($this, 'appointmentList');
1288 }
1289 return $url;
1290 }
$url

References $_GET, and $url.

Referenced by executeCommand(), and showProfile().

+ Here is the caller graph for this function:

◆ getUserId()

ilConsultationHoursGUI::getUserId ( )

Get user id.

Returns

Definition at line 156 of file class.ilConsultationHoursGUI.php.

157 {
158 return $this->user_id;
159 }

References $user_id.

Referenced by appointmentList(), bookingList(), createAppointments(), createNewBookingEntry(), groupList(), initFormSequence(), saveGroup(), saveSequence(), setSubTabs(), setTabs(), and updateGroup().

+ Here is the caller graph for this function:

◆ groupList()

ilConsultationHoursGUI::groupList ( )
protected

Show consultation hour group @global type $ilToolbar.

Definition at line 318 of file class.ilConsultationHoursGUI.php.

319 {
320 global $DIC;
321
322 $ilToolbar = $DIC['ilToolbar'];
323 $ilTabs = $DIC['ilTabs'];
324 $tpl = $DIC['tpl'];
325 $ilHelp = $DIC['ilHelp'];
326
327 $ilHelp->setScreenId("consultation_hours");
328
329 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
330 $ilToolbar->addButton($this->lng->txt('cal_ch_add_grp'), $this->ctrl->getLinkTarget($this, 'addGroup'));
331
332 $this->setSubTabs();
333 $ilTabs->activateSubTab('cal_ch_app_grp');
334
335 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroupTableGUI.php';
336 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
337 $gtbl = new ilConsultationHourGroupTableGUI($this, 'groupList', $this->getUserId());
339
340 $tpl->setContent($gtbl->getHTML());
341 }
static getGroupsOfUser($a_user_id)
Get a all groups of an user.

References $DIC, $tpl, ilConsultationHourGroups\getGroupsOfUser(), getUserId(), and setSubTabs().

+ Here is the call graph for this function:

◆ initFormSequence()

ilConsultationHoursGUI::initFormSequence (   $a_mode)
protected

Init form.

Parameters
int$a_mode
Returns

Definition at line 704 of file class.ilConsultationHoursGUI.php.

705 {
706 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
707
708 include_once('./Services/YUI/classes/class.ilYuiUtil.php');
710
711 $this->form = new ilPropertyFormGUI();
712 $this->form->setFormAction($this->ctrl->getFormAction($this));
713
714 switch ($a_mode) {
716 $this->form->setTitle($this->lng->txt('cal_ch_add_sequence'));
717 $this->form->addCommandButton('saveSequence', $this->lng->txt('save'));
718 $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
719 break;
720
721 /*
722 case self::MODE_UPDATE:
723 $this->form->setTitle($this->lng->txt('cal_ch_edit_sequence'));
724 $this->form->addCommandButton('updateSequence', $this->lng->txt('save'));
725 $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
726 break;
727 */
728
729 case self::MODE_MULTI:
730 $this->form->setTitle($this->lng->txt('cal_ch_multi_edit_sequence'));
731 $this->form->addCommandButton('updateMulti', $this->lng->txt('save'));
732 $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
733 break;
734 }
735
736 // in case of existing groups show a selection
737 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
738 if (count($options = ilConsultationHourGroups::getGroupSelectOptions($this->getUserId()))) {
739 $group = new ilSelectInputGUI($this->lng->txt('cal_ch_grp_selection'), 'grp');
740 $group->setOptions($options);
741 $group->setRequired(false);
742 $this->form->addItem($group);
743 }
744
745 // Title
746 $ti = new ilTextInputGUI($this->lng->txt('title'), 'ti');
747 $ti->setSize(32);
748 $ti->setMaxLength(128);
749 $ti->setRequired(true);
750 $this->form->addItem($ti);
751
752 if ($a_mode != self::MODE_MULTI) {
753 // Start
754 include_once './Services/Form/classes/class.ilDateTimeInputGUI.php';
755 $dur = new ilDateTimeInputGUI($this->lng->txt('cal_start'), 'st');
756 $dur->setShowTime(true);
757 $dur->setRequired(true);
758 $this->form->addItem($dur);
759
760 // Duration
761 $du = new ilDurationInputGUI($this->lng->txt('cal_ch_duration'), 'du');
762 $du->setShowMinutes(true);
763 $du->setShowHours(true);
764 $this->form->addItem($du);
765
766 // Number of appointments
767 $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_appointments'), 'ap');
768 $nu->setInfo($this->lng->txt('cal_ch_num_appointments_info'));
769 $nu->setSize(2);
770 $nu->setMaxLength(2);
771 $nu->setRequired(true);
772 $nu->setMinValue(1);
773 $this->form->addItem($nu);
774
775 // Recurrence
776 include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
777 $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
778 $rec->setEnabledSubForms(
779 array(
783 )
784 );
785 $this->form->addItem($rec);
786 }
787
788 // Number of bookings
789 $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_bookings'), 'bo');
790 $nu->setSize(2);
791 $nu->setMaxLength(2);
792 $nu->setMinValue(1);
793 $nu->setRequired(true);
794 $this->form->addItem($nu);
795
796 // Deadline
797 $dead = new ilDurationInputGUI($this->lng->txt('cal_ch_deadline'), 'dead');
798 $dead->setInfo($this->lng->txt('cal_ch_deadline_info'));
799 $dead->setShowMinutes(false);
800 $dead->setShowHours(true);
801 $dead->setShowDays(true);
802 $this->form->addItem($dead);
803
804 // Location
805 $lo = new ilTextInputGUI($this->lng->txt('cal_where'), 'lo');
806 $lo->setSize(32);
807 $lo->setMaxLength(128);
808 $this->form->addItem($lo);
809
810 // Description
811 $de = new ilTextAreaInputGUI($this->lng->txt('description'), 'de');
812 $de->setRows(10);
813 $de->setCols(60);
814 $this->form->addItem($de);
815
816 // Target Object
817 $tgt = new ilTextInputGUI($this->lng->txt('cal_ch_target_object'), 'tgt');
818 $tgt->setInfo($this->lng->txt('cal_ch_target_object_info'));
819 $tgt->setSize(16);
820 $tgt->setMaxLength(128);
821 $this->form->addItem($tgt);
822 }
const IL_CAL_FREQ_MONTHLY
const IL_CAL_FREQ_WEEKLY
static getGroupSelectOptions($a_user_id)
Get group selection options.
This class represents a date/time property in a property form.
This class represents a duration (typical hh:mm:ss) property in a property form.
This class represents a number property in a property form.
This class represents a property form user interface.
This class represents an input GUI for recurring events/appointments (course events or calendar appoi...
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static initDomEvent(ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent.
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.

References ilConsultationHourGroups\getGroupSelectOptions(), getUserId(), IL_CAL_FREQ_DAILY, IL_CAL_FREQ_MONTHLY, IL_CAL_FREQ_WEEKLY, ilYuiUtil\initDomEvent(), MODE_CREATE, and MODE_MULTI.

Referenced by createSequence(), edit(), saveSequence(), and updateMulti().

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

◆ initGroupForm()

ilConsultationHoursGUI::initGroupForm (   $a_group_id = 0)
protected

Init new/update group form.

Definition at line 499 of file class.ilConsultationHoursGUI.php.

500 {
501 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
502 $group = new ilConsultationHourGroup($a_group_id);
503
504 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
505 $form = new ilPropertyFormGUI();
506 $form->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this));
507
508 if ($a_group_id) {
509 $form->setTitle($GLOBALS['DIC']['lng']->txt('cal_ch_grp_update_tbl'));
510 $form->addCommandButton('updateGroup', $GLOBALS['DIC']['lng']->txt('save'));
511 $form->addCommandButton('groupList', $GLOBALS['DIC']['lng']->txt('cancel'));
512 } else {
513 $form->setTitle($GLOBALS['DIC']['lng']->txt('cal_ch_grp_add_tbl'));
514 $form->addCommandButton('saveGroup', $GLOBALS['DIC']['lng']->txt('save'));
515 $form->addCommandButton('appointmentList', $GLOBALS['DIC']['lng']->txt('cancel'));
516 }
517
518 $title = new ilTextInputGUI($GLOBALS['DIC']['lng']->txt('title'), 'title');
519 $title->setMaxLength(128);
520 $title->setSize(40);
521 $title->setRequired(true);
522 $title->setValue($group->getTitle());
523 $form->addItem($title);
524
525 $multiple = new ilNumberInputGUI($GLOBALS['DIC']['lng']->txt('cal_ch_grp_multiple'), 'multiple');
526 $multiple->setRequired(true);
527 $multiple->setMinValue(1);
528 $multiple->setSize(1);
529 $multiple->setMaxLength(2);
530 $multiple->setInfo($GLOBALS['DIC']['lng']->txt('cal_ch_grp_multiple_info'));
531 $multiple->setValue($group->getMaxAssignments());
532 $form->addItem($multiple);
533
534 return $form;
535 }

References $GLOBALS.

Referenced by addGroup(), editGroup(), saveGroup(), and updateGroup().

+ Here is the caller graph for this function:

◆ initSettingsForm()

ilConsultationHoursGUI::initSettingsForm ( )
protected

build settings form

Returns
object

Definition at line 1314 of file class.ilConsultationHoursGUI.php.

1315 {
1316 global $DIC;
1317
1318 $ilDB = $DIC['ilDB'];
1319 $ilUser = $DIC['ilUser'];
1320
1321 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1322
1323 $form = new ilPropertyFormGUI();
1324 $form->setFormAction($this->ctrl->getFormAction($this));
1325
1326 $mng = new ilTextInputGUI($this->lng->txt('cal_ch_manager'), 'mng');
1327 $mng->setInfo($this->lng->txt('cal_ch_manager_info'));
1328 $form->addItem($mng);
1329
1330 $mng->setValue(ilConsultationHourAppointments::getManager(true));
1331
1332 $form->setTitle($this->lng->txt('settings'));
1333 $form->addCommandButton('updateSettings', $this->lng->txt('save'));
1334 // $form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
1335 return $form;
1336 }
static getManager($a_as_name=false, $a_full_name=false, $a_user_id=null)
Get consultation hour manager for current user or specific user.
global $ilDB

References $DIC, $ilDB, $ilUser, and ilConsultationHourAppointments\getManager().

Referenced by settings(), and updateSettings().

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

◆ rejectBooking()

ilConsultationHoursGUI::rejectBooking (   $a_send_notification = true)
protected
Parameters
type$a_send_notification

Definition at line 633 of file class.ilConsultationHoursGUI.php.

634 {
635 global $DIC;
636
637 $ilCtrl = $DIC['ilCtrl'];
638
639 foreach ((array) $_REQUEST['bookuser'] as $bookuser) {
640 $ids = explode('_', $bookuser);
641
642 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
643 ilConsultationHourUtils::cancelBooking($ids[1], $ids[0], $a_send_notification);
644 }
645 if ($a_send_notification) {
646 ilUtil::sendSuccess($this->lng->txt('cal_ch_canceled_bookings'), true);
647 } else {
648 ilUtil::sendSuccess($this->lng->txt('cal_ch_deleted_bookings'), true);
649 }
650 $ilCtrl->redirect($this, 'bookingList');
651 }

References $DIC, $ilCtrl, and ilConsultationHourUtils\cancelBooking().

Referenced by deleteBooking().

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

◆ rewriteBookingIdsForAppointments()

ilConsultationHoursGUI::rewriteBookingIdsForAppointments ( \ilBookingEntry  $booking,
  $appointments,
\ilPropertyFormGUI  $form 
)
protected
Parameters
ilBookingEntry$booking
int[]$appointments

Definition at line 1104 of file class.ilConsultationHoursGUI.php.

1105 {
1106 foreach ($appointments as $appointment_id) {
1107
1108 $booking_appointment = new \ilCalendarEntry($appointment_id);
1109 $booking_start = $booking_appointment->getStart();
1110 $booking_end = $booking_appointment->getEnd();
1111
1112 $deprecatedBooking = \ilBookingEntry::getInstanceByCalendarEntryId($appointment_id);
1113 if (!$deprecatedBooking instanceof \ilBookingEntry) {
1114 // @todo error handling
1115 continue;
1116 }
1117
1119 $deprecatedBooking,
1120 $booking_start,
1121 $booking_end
1122 );
1123 foreach ($relevant_appointments as $relevant_appointment_id) {
1124
1125 $entry = new \ilCalendarEntry($relevant_appointment_id);
1126 $entry->setContextId($booking->getId());
1127 $entry->setTitle($form->getInput('ti'));
1128 $entry->setLocation($form->getInput('lo'));
1129 $entry->setDescription($form->getInput('de'));
1130 $entry->update();
1131 }
1132 }
1133 }
static findCalendarAppointmentsForBooking(\ilBookingEntry $booking, \ilDateTime $start, \ilDateTime $end)

References $booking, ilConsultationHourUtils\findCalendarAppointmentsForBooking(), ilPropertyFormGUI\getInput(), and ilBookingEntry\getInstanceByCalendarEntryId().

Referenced by updateMulti().

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

◆ saveGroup()

ilConsultationHoursGUI::saveGroup ( )
protected

Save new group.

Definition at line 367 of file class.ilConsultationHoursGUI.php.

368 {
369 $form = $this->initGroupForm();
370 if ($form->checkInput()) {
371 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
372 $group = new ilConsultationHourGroup();
373 $group->setTitle($form->getInput('title'));
374 $group->setMaxAssignments($form->getInput('multiple'));
375 $group->setUserId($this->getUserId());
376 $group->save();
377
378 ilUtil::sendSuccess($GLOBALS['DIC']['lng']->txt('settings_saved'), true);
379 $GLOBALS['DIC']['ilCtrl']->redirect($this, 'groupList');
380 }
381
382 ilUtil::sendFailure($GLOBALS['DIC']['lng']->txt('err_check_input'), true);
383 $this->addGroup($form);
384 }
addGroup(ilPropertyFormGUI $form=null)
Show add group form @global type $ilToolbar @global type $ilTabs.

References $GLOBALS, addGroup(), getUserId(), initGroupForm(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ saveSequence()

ilConsultationHoursGUI::saveSequence ( )
protected

Save new sequence.

Returns

Definition at line 828 of file class.ilConsultationHoursGUI.php.

829 {
830 global $DIC;
831
832 $ilObjDataCache = $DIC['ilObjDataCache'];
833
834 $this->initFormSequence(self::MODE_CREATE);
835
836 if ($this->form->checkInput()) {
837 $this->form->setValuesByPost();
838
839 $booking = new ilBookingEntry();
840 $booking->setObjId($this->getUserId());
841 $booking->setNumberOfBookings($this->form->getInput('bo'));
842
843 $deadline = $this->form->getInput('dead');
844 $deadline = $deadline['dd'] * 24 + $deadline['hh'];
845 $booking->setDeadlineHours($deadline);
846
847 // consultation hour group
848 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
850 $booking->setBookingGroup((int) $this->form->getInput('grp'));
851 }
852
853 $tgt = explode(',', $this->form->getInput('tgt'));
854 $obj_ids = array();
855 foreach ((array) $tgt as $ref_id) {
856 if (!trim($ref_id)) {
857 continue;
858 }
859 $obj_id = $ilObjDataCache->lookupObjId($ref_id);
860 $type = ilObject::_lookupType($obj_id);
861 $valid_types = array('crs','grp');
862 if (!$obj_id or !in_array($type, $valid_types)) {
863 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_repository_object'));
864 $this->tpl->setContent($this->form->getHTML());
865 return;
866 }
867
868 $obj_ids[] = $obj_id;
869 }
870 $booking->setTargetObjIds($obj_ids);
871
872 $booking->save();
874
875 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
876 $this->ctrl->redirect($this, 'appointmentList');
877 } else {
878 $this->form->setValuesByPost();
879 $this->tpl->setContent($this->form->getHTML());
880 }
881 }
createAppointments(ilBookingEntry $booking)
Create calendar appointments.

References $booking, $DIC, $type, ilObject\_lookupType(), createAppointments(), ilConsultationHourGroups\getGroupsOfUser(), getUserId(), initFormSequence(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ searchUsersForAppointments()

ilConsultationHoursGUI::searchUsersForAppointments ( )
protected

start searching for users

Definition at line 164 of file class.ilConsultationHoursGUI.php.

165 {
166 global $DIC;
167
168 $ilCtrl = $DIC['ilCtrl'];
169 $ilTabs = $DIC['ilTabs'];
170
171 $_SESSION['ch_apps'] = $_REQUEST['apps'];
172
173 if (empty($_SESSION['ch_apps'])) {
174 ilUtil::sendFailure($this->lng->txt('select_one'), true);
175 $GLOBALS['DIC']['ilCtrl']->redirect($this, 'appointmentList');
176 }
177 $_REQUEST['assignM'] = 1;
178 $ilCtrl->setCmdClass('ilrepositorysearchgui');
179 $ilCtrl->setcmd('');
180 $this->executeCommand();
181 }

References $_SESSION, $DIC, $GLOBALS, $ilCtrl, executeCommand(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ sendInfoAboutUnassignedUsers()

ilConsultationHoursGUI::sendInfoAboutUnassignedUsers (   $unassigned)
protected

Send info message about unassigned users.

Parameters
array$unassigned

Definition at line 187 of file class.ilConsultationHoursGUI.php.

188 {
189 if (!$unassigned) {
190 return true;
191 }
192 $users = array();
193 foreach ($unassigned as $user_id) {
194 include_once './Services/User/classes/class.ilObjUser.php';
196 }
197 ilUtil::sendInfo($this->lng->txt('cal_ch_user_assignment_failed_info') . '<br />' . implode('<br />', $users), true);
198 return true;
199 }
static _lookupFullname($a_user_id)
Lookup Full Name.

References $user_id, ilObjUser\_lookupFullname(), and ilUtil\sendInfo().

Referenced by assignUsersToAppointment(), assignUsersToAppointments(), and assignUsersToGroup().

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

◆ setSubTabs()

ilConsultationHoursGUI::setSubTabs ( )
protected

Set sub tabs @global type $ilTabs @global type $ilCtrl.

Definition at line 989 of file class.ilConsultationHoursGUI.php.

990 {
991 global $DIC;
992
993 $ilTabs = $DIC['ilTabs'];
994 $ilCtrl = $DIC['ilCtrl'];
995
996 $ilCtrl->setParameter($this, 'user_id', $this->getUserId());
997 $ilTabs->addSubTab('cal_ch_app_list', $this->lng->txt('cal_ch_app_list'), $ilCtrl->getLinkTarget($this, 'appointmentList'));
998 $ilTabs->addSubTab('cal_ch_app_grp', $this->lng->txt('cal_ch_app_grp'), $ilCtrl->getLinkTarget($this, 'groupList'));
999 $ilTabs->addSubTab('cal_ch_app_bookings', $this->lng->txt('cal_ch_app_bookings'), $ilCtrl->getLinkTarget($this, 'bookingList'));
1000 }

References $DIC, $ilCtrl, and getUserId().

Referenced by addGroup(), appointmentList(), bookingList(), confirmDeleteGroup(), confirmRejectBooking(), editGroup(), and groupList().

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

◆ setTabs()

ilConsultationHoursGUI::setTabs ( )
protected

Set tabs.

Returns

Definition at line 962 of file class.ilConsultationHoursGUI.php.

963 {
964 global $DIC;
965
966 $ilTabs = $DIC['ilTabs'];
967 $ilUser = $DIC['ilUser'];
968 $ilCtrl = $DIC['ilCtrl'];
969
970 $ilCtrl->setParameter($this, 'user_id', '');
971 $ilTabs->addTab('consultation_hours_' . $ilUser->getId(), $this->lng->txt('cal_ch_ch'), $this->ctrl->getLinkTarget($this, 'appointmentList'));
972
974 $ilCtrl->setParameter($this, 'user_id', $user_id);
975 $ilTabs->addTab('consultation_hours_' . $user_id, $this->lng->txt('cal_ch_ch') . ': ' . $login, $this->ctrl->getLinkTarget($this, 'appointmentList'));
976 }
977 $ilCtrl->setParameter($this, 'user_id', '');
978
979 $ilTabs->addTab('ch_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'settings'));
980
981 $ilTabs->activateTab('consultation_hours_' . $this->getUserId());
982 }
$login
Definition: cron.php:13

References $DIC, $ilCtrl, $ilUser, $login, $user_id, ilConsultationHourAppointments\getManagedUsers(), and getUserId().

Referenced by executeCommand().

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

◆ settings()

ilConsultationHoursGUI::settings ( )

display settings gui

Definition at line 1295 of file class.ilConsultationHoursGUI.php.

1296 {
1297 global $DIC;
1298
1299 $tpl = $DIC['tpl'];
1300 $ilTabs = $DIC['ilTabs'];
1301 $ilHelp = $DIC['ilHelp'];
1302
1303 $ilHelp->setScreenId("consultation_hours_settings");
1304 $ilTabs->activateTab('ch_settings');
1305
1306 $form = $this->initSettingsForm();
1307 $tpl->setContent($form->getHTML());
1308 }

References $DIC, $tpl, and initSettingsForm().

+ Here is the call graph for this function:

◆ showProfile()

ilConsultationHoursGUI::showProfile ( )

show public profile of given user

Definition at line 1252 of file class.ilConsultationHoursGUI.php.

1253 {
1254 global $DIC;
1255
1256 $tpl = $DIC['tpl'];
1257 $ilTabs = $DIC['ilTabs'];
1258 $ilCtrl = $DIC['ilCtrl'];
1259
1260 $ilTabs->clearTargets();
1261
1262 $user_id = (int) $_GET['user'];
1263
1264 include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
1265 $profile = new ilPublicUserProfileGUI($user_id);
1266 $profile->setBackUrl($this->getProfileBackUrl());
1267 $tpl->setContent($ilCtrl->getHTML($profile));
1268 }

References $_GET, $DIC, $ilCtrl, $tpl, $user_id, and getProfileBackUrl().

+ Here is the call graph for this function:

◆ updateGroup()

ilConsultationHoursGUI::updateGroup ( )
protected

Update group @global type $ilCtrl @global type $tpl @global type $ilTabs.

Definition at line 415 of file class.ilConsultationHoursGUI.php.

416 {
417 global $DIC;
418
419 $ilCtrl = $DIC['ilCtrl'];
420 $tpl = $DIC['tpl'];
421 $ilTabs = $DIC['ilTabs'];
422
423 $ilCtrl->setParameter($this, 'grp_id', (int) $_REQUEST['grp_id']);
424
425 $form = $this->initGroupForm((int) $_REQUEST['grp_id']);
426 if ($form->checkInput()) {
427 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
428 $group = new ilConsultationHourGroup((int) $_REQUEST['grp_id']);
429 $group->setTitle($form->getInput('title'));
430 $group->setMaxAssignments($form->getInput('multiple'));
431 $group->setUserId($this->getUserId());
432 $group->update();
433
434 ilUtil::sendSuccess($GLOBALS['DIC']['lng']->txt('settings_saved'), true);
435 $GLOBALS['DIC']['ilCtrl']->redirect($this, 'groupList');
436 }
437
438 ilUtil::sendFailure($GLOBALS['DIC']['lng']->txt('err_check_input'), true);
439 $this->editGroup($form);
440 }
editGroup(ilPropertyFormGUI $form=null)
Edit group @global type $ilCtrl.

References $DIC, $GLOBALS, $ilCtrl, $tpl, editGroup(), getUserId(), initGroupForm(), and ilUtil\sendFailure().

+ Here is the call graph for this function:

◆ updateMulti()

ilConsultationHoursGUI::updateMulti ( )
protected

Update multiple sequence items.

Returns

Definition at line 1139 of file class.ilConsultationHoursGUI.php.

1140 {
1141 global $DIC;
1142
1143 $ilObjDataCache = $DIC['ilObjDataCache'];
1144
1145 $this->initFormSequence(self::MODE_MULTI);
1146
1147 if ($this->form->checkInput()) {
1148
1149 $this->form->setValuesByPost();
1150 $apps = explode(';', (string) $_POST['apps']);
1151
1152 // create new booking
1153 $booking = $this->createNewBookingEntry($this->form);
1154 if (!$booking instanceof \ilBookingEntry) {
1155 $this->edit();
1156 return false;
1157 }
1158 $this->rewriteBookingIdsForAppointments($booking, $apps, $this->form);
1160
1161 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1162 $this->ctrl->redirect($this, 'appointmentList');
1163 }
1164 $this->tpl->setContent($this->form->getHTML());
1165 }
rewriteBookingIdsForAppointments(\ilBookingEntry $booking, $appointments, \ilPropertyFormGUI $form)
edit()
Edit multiple sequence items.
createNewBookingEntry(\ilPropertyFormGUI $validate_form)

References $_POST, $booking, $DIC, createNewBookingEntry(), edit(), initFormSequence(), ilBookingEntry\removeObsoleteEntries(), and rewriteBookingIdsForAppointments().

+ Here is the call graph for this function:

◆ updateSettings()

ilConsultationHoursGUI::updateSettings ( )

save settings

Definition at line 1341 of file class.ilConsultationHoursGUI.php.

1342 {
1343 global $DIC;
1344
1345 $ilDB = $DIC['ilDB'];
1346 $ilCtrl = $DIC['ilCtrl'];
1347 $ilUser = $DIC['ilUser'];
1348 $tpl = $DIC['tpl'];
1349 $ilTabs = $DIC['ilTabs'];
1350
1351 $form = $this->initSettingsForm();
1352 if ($form->checkInput()) {
1353 $mng = $form->getInput('mng');
1355 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1356 $ilCtrl->redirect($this, 'settings');
1357 } else {
1358 $ilTabs->activateTab('ch_settings');
1359
1360 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_user'));
1361 $field = $form->getItemByPostVar('mng');
1362 $field->setValue($mng);
1363 $tpl->setContent($form->getHTML());
1364 return;
1365 }
1366 }
1367 }
static setManager($a_user_name)
Set consultation hour manager for current user.

References $DIC, $ilCtrl, $ilDB, $ilUser, $tpl, initSettingsForm(), ilUtil\sendFailure(), and ilConsultationHourAppointments\setManager().

+ Here is the call graph for this function:

Field Documentation

◆ $booking

◆ $ctrl

ilConsultationHoursGUI::$ctrl
protected

Definition at line 43 of file class.ilConsultationHoursGUI.php.

◆ $user_id

ilConsultationHoursGUI::$user_id
protected

◆ MAX_APPOINTMENTS_PER_SEQUENCE

const ilConsultationHoursGUI::MAX_APPOINTMENTS_PER_SEQUENCE = 1000

Definition at line 40 of file class.ilConsultationHoursGUI.php.

◆ MODE_CREATE

const ilConsultationHoursGUI::MODE_CREATE = 1

Definition at line 36 of file class.ilConsultationHoursGUI.php.

Referenced by initFormSequence().

◆ MODE_MULTI

const ilConsultationHoursGUI::MODE_MULTI = 3

Definition at line 38 of file class.ilConsultationHoursGUI.php.

Referenced by initFormSequence().

◆ MODE_UPDATE

const ilConsultationHoursGUI::MODE_UPDATE = 2

Definition at line 37 of file class.ilConsultationHoursGUI.php.


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