ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ilConsultationHoursGUI Class Reference

Consultation hours editor. More...

+ Collaboration diagram for ilConsultationHoursGUI:

Public Member Functions

 __construct ()
 Constructor. More...
 
 executeCommand ()
 
 getUserId ()
 
 assignUsersToAppointments (array $users)
 Assign users to multiple appointments. More...
 
 assignUsersToAppointment (array $users, int $a_app=0, bool $a_redirect=true)
 Assign users to an appointment. More...
 
 edit ()
 
 showProfile ()
 show public profile of given user More...
 
 settings ()
 display settings gui More...
 
 updateSettings ()
 save settings More...
 

Data Fields

const VIEW_MODE_PERIOD_UPCOMING = 'upcoming'
 
const VIEW_MODE_PERIOD_PAST = 'past'
 
const VIEW_MODE_PERIOD_ALL = 'all'
 
const VIEW_MODE_STATUS_BOOKED = 'booked'
 
const VIEW_MODE_STATUS_OPEN = 'open'
 
const VIEW_MODE_STATUS_ALL = 'all'
 

Protected Member Functions

 initSearchAssignmentToAppointments ($a_default=false)
 
 initAppointmentIdsFromTableAction ()
 
 initAppointmentIdsFromQuery ()
 
 initAppointmentIdsFromPost ()
 
 initAppointmentIdsFromPostString ()
 
 initBookingUsersFromPost ()
 
 initBookingUsersFromQuery ()
 
 searchUsersForAppointments ()
 
 sendInfoAboutUnassignedUsers (array $unassigned)
 Send info message about unassigned users. More...
 
 createSequence ()
 Create new sequence. More...
 
 initFormSequence (int $a_mode)
 
 saveSequence ()
 Save new sequence. More...
 
 createAppointments (ilBookingEntry $booking)
 Create calendar appointments. More...
 
 setTabs ()
 
 createNewBookingEntry (ilPropertyFormGUI $validate_form)
 
 rewriteBookingIdsForAppointments (ilBookingEntry $booking, array $appointments, ilPropertyFormGUI $form)
 
 updateMulti ()
 Update multiple sequence items. More...
 
 getProfileBackUrl ()
 Build context-sensitive profile back url. More...
 
 initSettingsForm ()
 build settings form More...
 
 appointments ()
 
 handleBookingTableActions ()
 
 sendMailToSelectedUsers ()
 
 confirmCancelBooking (bool $with_notification=true)
 
 deleteBooking ()
 
 cancelBooking (bool $with_notification=true)
 
 confirmDeleteAppointments ()
 
 deleteAppointments ()
 
 initSequenceCreation ()
 
 renderViewControl ()
 
 initViewMode ()
 

Protected Attributes

const MODE_CREATE = 1
 
const MODE_UPDATE = 2
 
const MODE_MULTI = 3
 
const MAX_APPOINTMENTS_PER_SEQUENCE = 1000
 
ilCtrlInterface $ctrl
 
ilLanguage $lng
 
ilGlobalTemplateInterface $tpl
 
ilObjUser $global_user
 
ilHelpGUI $help
 
ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
RefineryFactory $refinery
 
GlobalHttpState $http
 

Private Attributes

UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
int $user_id
 
bool $search_assignment_to_appointments = false
 
ilBookingEntry $booking = null
 
ilPropertyFormGUI $form = null
 
string $vm_period = ''
 
string $vm_status = ''
 

Detailed Description

Consultation hours editor.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e @ilCtrl_Calls ilConsultationHoursGUI: ILIAS\User\Profile\PublicProfileGUI, ilRepositorySearchGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilConsultationHoursGUI::__construct ( )

Constructor.

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

79 {
80 global $DIC;
81
82 $this->http = $DIC->http();
83 $this->refinery = $DIC->refinery();
84
85 $user_id = 0;
86 if ($this->http->wrapper()->query()->has('user_id')) {
87 $user_id = $this->http->wrapper()->query()->retrieve(
88 'user_id',
89 $this->refinery->kindlyTo()->int()
90 );
91 }
92 if ($user_id) {
93 if (in_array($user_id, array_keys(ilConsultationHourAppointments::getManagedUsers()))) {
94 $this->user_id = $user_id;
95 } else {
96 $user_id = false;
97 }
98 }
99 if (!$user_id) {
100 $this->user_id = $DIC->user()->getId();
101 }
102
103 $this->ctrl = $DIC->ctrl();
104 $this->lng = $DIC->language();
105 $this->tpl = $DIC->ui()->mainTemplate();
106 $this->help = $DIC->help();
107 $this->tabs = $DIC->tabs();
108 $this->toolbar = $DIC->toolbar();
109 $this->global_user = $DIC->user();
110 $this->ui_factory = $DIC->ui()->factory();
111 $this->ui_renderer = $DIC->ui()->renderer();
112 }
static getManagedUsers()
Get all managed consultation hours users for current users.
static http()
Fetches the global http state from ILIAS.
global $DIC
Definition: shib_login.php:26

References $DIC, $user_id, ILIAS\Repository\ctrl(), ilConsultationHourAppointments\getManagedUsers(), ILIAS\Repository\help(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

+ Here is the call graph for this function:

Member Function Documentation

◆ appointments()

ilConsultationHoursGUI::appointments ( )
protected

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

848 : void
849 {
850 $this->initViewMode();
851 $table = new BookingTableGUI(
852 new BookingDataProvider($this->getUserId(), $this->vm_period, $this->vm_status)
853 );
854 $this->tpl->setContent(
855 $this->renderViewControl() .
856 $table->render()
857 );
858 }

Referenced by edit().

+ Here is the caller graph for this function:

◆ assignUsersToAppointment()

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

Assign users to an appointment.

Parameters
array$users
int$a_app
bool$a_redirect
Returns
int[] $unassigned_users
Exceptions
ilCtrlException

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

327 : array
328 {
329 if ($a_app) {
330 $app = $a_app;
331 } elseif ($this->initBookingUsersFromPost() !== []) {
332 $app = $this->initAppointmentIdsFromPost();
333 $app = current($app);
334 } elseif ($this->initAppointmentIdsFromQuery() !== []) {
335 $app = $this->initAppointmentIdsFromQuery();
336 $app = current($app);
337 }
338 if (!count($users)) {
339 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
340 return [];
341 }
343 $assigned_users = array();
344 foreach ($users as $user) {
346 break;
347 }
348 if (!ilBookingEntry::lookupBookingsOfUser((array) $app, $user)) {
350 $assigned_users[] = $user;
351 }
352 }
353 $unassigned_users = array_diff($users, $assigned_users);
354 if ($a_redirect) {
355 $this->sendInfoAboutUnassignedUsers($unassigned_users);
356 $this->ctrl->redirect($this, 'appointments');
357 } else {
358 return $unassigned_users;
359 }
360 return [];
361 }
static getInstanceByCalendarEntryId(int $a_id)
Get instance by calendar entry.
getCurrentNumberOfBookings(int $a_entry_id)
get current number of bookings
static lookupBookingsOfUser(array $a_app_ids, int $a_usr_id, ?ilDateTime $start=null)
Lookup bookings of user.
static bookAppointment(int $a_usr_id, int $a_app_id, string $comment='')
Book an appointment.
sendInfoAboutUnassignedUsers(array $unassigned)
Send info message about unassigned users.

References $booking, ilConsultationHourUtils\bookAppointment(), ILIAS\Repository\ctrl(), ilBookingEntry\getCurrentNumberOfBookings(), ilBookingEntry\getInstanceByCalendarEntryId(), ilBookingEntry\getNumberOfBookings(), initAppointmentIdsFromPost(), initAppointmentIdsFromQuery(), initBookingUsersFromPost(), ILIAS\Repository\lng(), ilBookingEntry\lookupBookingsOfUser(), 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.

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

305 {
306 $unassigned_users = [];
307 $ch_apps = (array) (ilSession::get('ch_apps') ?? []);
308 foreach ($ch_apps as $app) {
309 $unassigned_users = array_unique(array_merge(
310 $unassigned_users,
311 $this->assignUsersToAppointment($users, $app, false)
312 ));
313 }
314
315 $this->sendInfoAboutUnassignedUsers($unassigned_users);
316 $this->ctrl->redirect($this, 'appointments');
317 }
assignUsersToAppointment(array $users, int $a_app=0, bool $a_redirect=true)
Assign users to an appointment.
static get(string $a_var)

References assignUsersToAppointment(), ILIAS\Repository\ctrl(), ilSession\get(), and sendInfoAboutUnassignedUsers().

+ Here is the call graph for this function:

◆ cancelBooking()

ilConsultationHoursGUI::cancelBooking ( bool  $with_notification = true)
protected

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

952 : void
953 {
954 $appointment_id = $this->http->wrapper()->query()->retrieve(
955 'appointment_id',
956 $this->refinery->byTrying(
957 [
958 $this->refinery->kindlyTo()->int(),
959 $this->refinery->always(0)
960 ]
961 )
962 );
963 if (!$appointment_id) {
964 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
965 $this->appointments();
966 return;
967 }
968
969 $entry = new ilCalendarEntry($appointment_id);
970 $booking = new ilBookingEntry($entry->getContextId());
971 $cancel = new \ILIAS\Calendar\ConsultationHours\BookingCancellationGUI(
972 $this,
973 $entry,
974 $booking,
975 $with_notification ?
976 \ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::TYPE_CANCEL :
977 \ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::TYPE_DELETE
978 );
979 $data = $cancel->renderModal()->withRequest($this->http->request())->getData();
980 foreach ((array) $data['bookings'] as $user => $checked) {
981 if ($checked) {
983 $user,
984 $appointment_id,
985 $with_notification
986 );
987 }
988 }
989 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_ch_canceled_bookings'), true);
990 $this->ctrl->redirect($this, 'appointments');
991 }
Booking definition.
Model for a calendar entry.
static cancelBooking(int $a_usr_id, int $a_app_id, bool $a_send_notification=true)
Cancel a booking.
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
$data
Definition: storeScorm.php:45

References $data, ilConsultationHourUtils\cancelBooking(), ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ confirmCancelBooking()

ilConsultationHoursGUI::confirmCancelBooking ( bool  $with_notification = true)
protected

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

916 : void
917 {
918 $appointment_ids = $this->initAppointmentIdsFromTableAction();
919 if ($appointment_ids === []) {
920 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
921 $this->appointments();
922 return;
923 }
924
925 $appointment = end($appointment_ids);
926 $this->ctrl->setParameter($this, 'appointment_id', $appointment);
927 $entry = new ilCalendarEntry($appointment);
928 $booking = new ilBookingEntry($entry->getContextId());
929
930 $cancel = new \ILIAS\Calendar\ConsultationHours\BookingCancellationGUI(
931 $this,
932 $entry,
933 $booking,
934 $with_notification ?
935 \ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::TYPE_CANCEL :
936 \ILIAS\Calendar\ConsultationHours\BookingCancellationGUI::TYPE_DELETE
937 );
938 $modal = $cancel->renderModal();
939 $output = $this->ui_renderer->renderAsync($modal);
940 $this->http->saveResponse($this->http->response()->withBody(
941 Streams::ofString($output)
942 ));
943 $this->http->sendResponse();
944 $this->http->close();
945 }

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ confirmDeleteAppointments()

ilConsultationHoursGUI::confirmDeleteAppointments ( )
protected

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

993 : void
994 {
995 $appointment_ids = $this->initAppointmentIdsFromTableAction();
996 if (!count($appointment_ids)) {
997 $output = $this->ui_factory->messageBox()->failure($this->lng->txt('select_one'));
998 } else {
999 $items = [];
1000 foreach ($appointment_ids as $appointment) {
1001 $entry = new ilCalendarEntry($appointment);
1002 $items[] = $this->ui_factory->modal()->interruptiveItem()->standard(
1003 (string) $appointment,
1004 ilDatePresentation::formatDate($entry->getStart()) . ', ' . $entry->getTitle()
1005 );
1006 }
1007
1008 $output = $this->ui_factory->modal()->interruptive(
1009 $this->lng->txt('confirm'),
1010 $this->lng->txt('cal_ch_delete_app_booking_info'),
1011 $this->ctrl->getFormAction($this, 'deleteAppointments')
1012 )->withAffectedItems($items);
1013 }
1014
1015 $rendered_output = $this->ui_renderer->renderAsync($output);
1016 $this->http->saveResponse($this->http->response()->withBody(
1017 Streams::ofString($rendered_output)
1018 ));
1019 $this->http->sendResponse();
1020 $this->http->close();
1021 }
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false, ?ilObjUser $user=null,)

References ilDatePresentation\formatDate(), ILIAS\FileDelivery\http(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ createAppointments()

ilConsultationHoursGUI::createAppointments ( ilBookingEntry  $booking)
protected

Create calendar appointments.

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

529 : void
530 {
531 $concurrent_dates = new ilDateList(ilDateList::TYPE_DATETIME);
532 $start = clone $this->form->getItemByPostVar('st')->getDate();
533 for ($i = 0; $i < $this->form->getItemByPostVar('ap')->getValue(); $i++) {
534 $concurrent_dates->add(clone $start);
535
536 $start->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
537 $start->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
538 #$start = new ilDateTime(,IL_CAL_UNIX);
539 }
540
543 $this->getUserId(),
544 $this->lng->txt('cal_ch_personal_ch'),
545 true
546 );
547
548 // Add calendar appointment for each
549
550 $num_appointments = 0;
551 foreach ($concurrent_dates as $dt) {
552 if ($num_appointments >= self::MAX_APPOINTMENTS_PER_SEQUENCE) {
553 break;
554 }
555
556 $end = clone $dt;
557 $end->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
558 $end->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
559
561 new ilBookingPeriod($dt, $end),
562 $this->form->getItemByPostVar('frequence')->getRecurrence()
563 );
564
565 // Calculate with one year limit
566 $limit = clone $dt;
567 $limit->increment(ilDateTime::YEAR, 1);
568
569 $date_list = $calc->calculateDateList($dt, $limit);
570
571 $num = 0;
572 foreach ($date_list as $app_start) {
573 $app_end = clone $app_start;
574 $app_end->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
575 $app_end->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
576
577 $entry = new ilCalendarEntry();
578 $entry->setContextId($booking->getId());
579 $entry->setTitle($this->form->getInput('ti'));
580 $entry->setSubtitle("#consultationhour#"); // dynamic, see ilCalendarEntry
581 $entry->setDescription($this->form->getInput('de'));
582 $entry->setLocation($this->form->getInput('lo'));
583 $entry->setStart($app_start);
584 $entry->setEnd($app_end);
585
586 $entry->setTranslationType(ilCalendarEntry::TRANSLATION_SYSTEM);
587 $entry->save();
588
589 $cat_assign = new ilCalendarCategoryAssignments($entry->getEntryId());
590 $cat_assign->addAssignment($def_cat->getCategoryID());
591
592 $num_appointments++;
593 }
594 }
595 }
Booking period Used for calculation of recurring events.
Calculates an ilDateList for a given calendar entry and recurrence rule.
static initDefaultCalendarByType(int $a_type_id, int $a_usr_id, string $a_title, bool $a_create=false)
Init the default calendar for given type and user.
List of dates.
form(?array $class_path, string $cmd, string $submit_caption="")
getValue()
Get the value that is displayed in the input client side.
Definition: Group.php:49

References $booking, ILIAS\Repository\form(), ilBookingEntry\getId(), getUserId(), ILIAS\UI\Implementation\Component\Input\getValue(), ilDateTime\HOUR, ilCalendarUtil\initDefaultCalendarByType(), ILIAS\Repository\lng(), ilDateTime\MINUTE, ilCalendarEntry\TRANSLATION_SYSTEM, 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

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

666 {
667 $booking = new \ilBookingEntry();
668 $booking->setObjId($this->user_id);
669 $booking->setNumberOfBookings((int) $this->form->getInput('bo'));
670
671 $deadline = $this->form->getInput('dead');
672 $deadline = $deadline['dd'] * 24 + $deadline['hh'];
673 $booking->setDeadlineHours($deadline);
674
675 $tgt = array_map('intval', explode(',', (string) $this->form->getInput('tgt')));
676 $obj_ids = [];
677 foreach ($tgt as $ref_id) {
678 if ($ref_id === 0) {
679 continue;
680 }
681 $obj_id = ilObject::_lookupObjId($ref_id);
682 $type = ilObject::_lookupType($obj_id);
683 $valid_types = ['crs', 'grp'];
684 if (!$obj_id or !in_array($type, $valid_types)) {
685 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cal_ch_unknown_repository_object'));
686 return null;
687 }
688 $obj_ids[] = $obj_id;
689 }
690 $booking->setTargetObjIds($obj_ids);
691 $booking->save();
692 return $booking;
693 }
setDeadlineHours(int $a_hours)
setTargetObjIds(?array $a_obj_id)
setNumberOfBookings(int $a_num)
static _lookupType(int $id, bool $reference=false)
static _lookupObjId(int $ref_id)

References $booking, ilObject\_lookupObjId(), ilObject\_lookupType(), ILIAS\Repository\form(), ILIAS\Repository\lng(), ilBookingEntry\save(), ilBookingEntry\setDeadlineHours(), ilBookingEntry\setNumberOfBookings(), ilBookingEntry\setObjId(), and ilBookingEntry\setTargetObjIds().

+ Here is the call graph for this function:

◆ createSequence()

ilConsultationHoursGUI::createSequence ( )
protected

Create new sequence.

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

366 : void
367 {
368 $this->initFormSequence(self::MODE_CREATE);
369
370 $this->booking = new ilBookingEntry();
371 $this->form->getItemByPostVar('bo')->setValue((string) $this->booking->getNumberOfBookings());
372 $this->form->getItemByPostVar('ap')->setValue("1");
373 $this->form->getItemByPostVar('du')->setMinutes(15);
374 $this->form->getItemByPostVar('st')->setDate(
375 new ilDateTime(mktime(8, 0, 0, (int) date('n', time()), (int) date('d', time()), (int) date('Y', time())), IL_CAL_UNIX)
376 );
377 $this->tpl->setContent($this->form->getHTML());
378 }
const IL_CAL_UNIX
@classDescription Date and time handling

References ILIAS\UI\examples\Symbol\Glyph\Date\date(), ILIAS\Repository\form(), IL_CAL_UNIX, and initFormSequence().

+ Here is the call graph for this function:

◆ deleteAppointments()

ilConsultationHoursGUI::deleteAppointments ( )
protected

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

1023 : void
1024 {
1025 $appointment_ids = $this->http->wrapper()->post()->retrieve(
1026 'interruptive_items',
1027 $this->refinery->byTrying(
1028 [
1029 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
1030 $this->refinery->always([])
1031 ]
1032 )
1033 );
1034 if (!count($appointment_ids)) {
1035 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1036 $this->appointments();
1037 return;
1038 }
1039
1040 foreach ($appointment_ids as $appointment_id) {
1041 // cancel booking for users
1043 if ($booking) {
1044 foreach ($booking->getCurrentBookings($appointment_id) as $user_id) {
1045 ilConsultationHourUtils::cancelBooking($user_id, $appointment_id, false);
1046 }
1047 }
1048 // remove calendar entries
1049 $entry = new ilCalendarEntry($appointment_id);
1050 $entry->delete();
1052 }
1054 $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_deleted_app'), true);
1055 $this->ctrl->redirect($this, 'appointments');
1056 }
static removeObsoleteEntries()
Remove unused booking entries.
getCurrentBookings(int $a_entry_id)
get current bookings
static _deleteByAppointmentId(int $a_app_id)
Delete appointment assignment.

References $user_id, ilCalendarCategoryAssignments\_deleteByAppointmentId(), ilConsultationHourUtils\cancelBooking(), ILIAS\Repository\ctrl(), ilBookingEntry\getInstanceByCalendarEntryId(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), and ilBookingEntry\removeObsoleteEntries().

+ Here is the call graph for this function:

◆ deleteBooking()

ilConsultationHoursGUI::deleteBooking ( )
protected

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

947 : void
948 {
949 $this->cancelBooking(false);
950 }
cancelBooking(bool $with_notification=true)

◆ edit()

ilConsultationHoursGUI::edit ( )

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

619 : void
620 {
621 $apps = $this->initAppointmentIdsFromTableAction();
622 if (!count($apps)) {
623 if ($this->initAppointmentIdsFromPostString() !== []) {
624 $apps = $this->initAppointmentIdsFromPostString();
625 }
626 }
627
628 // first read from hidden input
629 if (!count($apps)) {
630 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
631 $this->appointments();
632 return;
633 }
634
635 $this->initFormSequence(self::MODE_MULTI);
636 $hidden = new ilHiddenInputGUI('apps_string');
637 $hidden->setValue(implode(';', $apps));
638 $this->form->addItem($hidden);
639
640 $first = $apps;
641 $first = array_shift($apps);
642 $entry = new ilCalendarEntry($first);
643
644 $this->form->getItemByPostVar('ti')->setValue($entry->getTitle());
645 $this->form->getItemByPostVar('lo')->setValue($entry->getLocation());
646 $this->form->getItemByPostVar('de')->setValue($entry->getDescription());
647
648 $booking = new ilBookingEntry($entry->getContextId());
649
650 $this->form->getItemByPostVar('bo')->setValue((string) $booking->getNumberOfBookings());
651
652 $ref_ids = array();
653 foreach ($booking->getTargetObjIds() as $obj_id) {
654 $refs = ilObject::_getAllReferences($obj_id);
655 $ref_ids[] = end($refs);
656 }
657 $this->form->getItemByPostVar('tgt')->setValue(implode(',', $ref_ids));
658
659 $deadline = $booking->getDeadlineHours();
660 $this->form->getItemByPostVar('dead')->setDays((int) floor($deadline / 24));
661 $this->form->getItemByPostVar('dead')->setHours($deadline % 24);
662 $this->tpl->setContent($this->form->getHTML());
663 }
This class represents a hidden form property in a property form.
static _getAllReferences(int $id)
get all reference ids for object ID

References $booking, ilObject\_getAllReferences(), appointments(), ILIAS\Repository\form(), ilBookingEntry\getDeadlineHours(), ilBookingEntry\getNumberOfBookings(), ilBookingEntry\getTargetObjIds(), initAppointmentIdsFromPostString(), initAppointmentIdsFromTableAction(), initFormSequence(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ executeCommand()

ilConsultationHoursGUI::executeCommand ( )

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

211 : void
212 {
213 $this->help->setScreenIdComponent("cal");
214 switch ($this->ctrl->getNextClass($this)) {
215 case strtolower(PublicProfileGUI::class):
216 #22168 don't send the current user if no GET user_id
217 //$profile = new ilPublicUserProfileGUI($this->user_id);
218 $profile = new PublicProfileGUI();
219 $profile->setBackUrl($this->getProfileBackUrl());
220 $ret = $this->ctrl->forwardCommand($profile);
221 $this->tpl->setContent($ret);
222 break;
223
224 case 'ilrepositorysearchgui':
225 $rep_search = new ilRepositorySearchGUI();
226 if ($this->initSearchAssignmentToAppointments()) {
227 $rep_search->setCallback(
228 $this,
230 array()
231 );
232 $this->ctrl->setParameter($this, 'assignM', 1);
233 $this->ctrl->setReturn($this, 'appointments');
234 } elseif (count($this->initAppointmentIdsFromPost())) {
235 $rep_search->setCallback(
236 $this,
238 array()
239 );
240 $this->ctrl->saveParameter($this, 'apps');
241 $this->ctrl->setReturn($this, 'appointments');
242 } elseif ($this->initAppointmentIdsFromQuery()) {
243 $rep_search->setCallback(
244 $this,
246 array()
247 );
248 $this->ctrl->saveParameter($this, 'apps');
249 $this->ctrl->setReturn($this, 'appointments');
250 }
251 $this->ctrl->forwardCommand($rep_search);
252 break;
253
254 default:
255 $this->tpl->setTitle($this->lng->txt("cal_ch_form_header")); // #12220
256
257 $this->setTabs();
258 if ($this->global_user->getId() != $this->user_id) {
259 $this->ctrl->setParameter($this, 'user_id', $this->user_id);
260 }
261 $cmd = $this->ctrl->getCmd('appointments');
262 $this->$cmd();
263 }
264 }
assignUsersToAppointments(array $users)
Assign users to multiple appointments.

References ILIAS\Repository\ctrl(), getProfileBackUrl(), ILIAS\Repository\help(), initAppointmentIdsFromPost(), initAppointmentIdsFromQuery(), initSearchAssignmentToAppointments(), ILIAS\Repository\lng(), and setTabs().

+ Here is the call graph for this function:

◆ getProfileBackUrl()

ilConsultationHoursGUI::getProfileBackUrl ( )
protected

Build context-sensitive profile back url.

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

779 : string
780 {
781 // from repository
782 if ($this->http->wrapper()->query()->has('ref_id')) {
783 $url = $this->ctrl->getLinkTargetByClass('ilCalendarMonthGUI');
784 } // from panel
785 elseif ($this->http->wrapper()->query()->has('panel')) {
786 $url = $this->ctrl->getLinkTargetByClass('ilCalendarPresentationGUI');
787 } // from appointments
788 else {
789 $url = $this->ctrl->getLinkTarget($this, 'appointments');
790 }
791 return $url;
792 }

References ILIAS\Repository\ctrl(), and ILIAS\FileDelivery\http().

Referenced by executeCommand().

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

◆ getUserId()

ilConsultationHoursGUI::getUserId ( )

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

266 : int
267 {
268 return $this->user_id;
269 }

References $user_id.

Referenced by createAppointments(), initAppointmentIdsFromTableAction(), saveSequence(), and setTabs().

+ Here is the caller graph for this function:

◆ handleBookingTableActions()

ilConsultationHoursGUI::handleBookingTableActions ( )
protected

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

861 : void
862 {
863 $action = $this->http->wrapper()->query()->retrieve(
864 BookingTableGUI::ACTION_TOKEN_NS,
865 $this->refinery->byTrying(
866 [
867 $this->refinery->kindlyTo()->string(),
868 $this->refinery->always('')
869 ]
870 )
871 );
872 match ($action) {
873 'edit' => $this->edit(),
874 'searchUsersForAppointments' => $this->searchUsersForAppointments(),
875 'confirmDeleteAppointments' => $this->confirmDeleteAppointments(),
876 'confirmCancelBooking' => $this->confirmCancelBooking(true),
877 'confirmDeleteBooking' => $this->confirmCancelBooking(false),
878 'sendMail' => $this->sendMailToSelectedUsers(),
879 default => $this->ctrl->redirect($this, 'appointments')
880 };
881 }
confirmCancelBooking(bool $with_notification=true)

References ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ initAppointmentIdsFromPost()

ilConsultationHoursGUI::initAppointmentIdsFromPost ( )
protected

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

154 : array
155 {
156 if ($this->http->wrapper()->post()->has('apps')) {
157 return $this->http->wrapper()->post()->retrieve(
158 'apps',
159 $this->refinery->kindlyTo()->dictOf(
160 $this->refinery->kindlyTo()->int()
161 )
162 );
163 }
164 return [];
165 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by assignUsersToAppointment(), and executeCommand().

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

◆ initAppointmentIdsFromPostString()

ilConsultationHoursGUI::initAppointmentIdsFromPostString ( )
protected

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

167 : array
168 {
169 if ($this->http->wrapper()->post()->has('apps_string')) {
170 $app_string = $this->http->wrapper()->post()->retrieve(
171 'apps_string',
172 $this->refinery->kindlyTo()->string()
173 );
174 return array_map('intval', explode(';', $app_string));
175 }
176 return [];
177 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by edit().

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

◆ initAppointmentIdsFromQuery()

ilConsultationHoursGUI::initAppointmentIdsFromQuery ( )
protected

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

146 : array
147 {
148 if ($this->http->wrapper()->query()->has('apps')) {
149 return [$this->http->wrapper()->query()->retrieve('apps', $this->refinery->kindlyTo()->int())];
150 }
151 return [];
152 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by assignUsersToAppointment(), and executeCommand().

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

◆ initAppointmentIdsFromTableAction()

ilConsultationHoursGUI::initAppointmentIdsFromTableAction ( )
protected

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

126 : array
127 {
128 $current_user_id = $this->getUserId();
129 return $this->http->wrapper()->query()->retrieve(
130 BookingTableGUI::ID_TOKEN_NS,
131 $this->refinery->byTrying(
132 [
133 $this->refinery->custom()->transformation(function ($value) use ($current_user_id) {
134 if ($value !== ['ALL_OBJECTS']) {
135 throw new Exception('Invalid token');
136 }
138 }),
139 $this->refinery->kindlyTo()->listOf($this->refinery->kindlyTo()->int()),
140 $this->refinery->always([])
141 ]
142 )
143 );
144 }
static getAppointmentIds(int $a_user_id, ?int $a_context_id=null, ?ilDateTime $a_start=null, ?int $a_type=null, bool $a_check_owner=true)

References ilConsultationHourAppointments\getAppointmentIds(), getUserId(), ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by edit(), and searchUsersForAppointments().

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

◆ initBookingUsersFromPost()

ilConsultationHoursGUI::initBookingUsersFromPost ( )
protected
Returns
string[]

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

182 : array
183 {
184 if ($this->http->wrapper()->post()->has('bookuser')) {
185 return $this->http->wrapper()->post()->retrieve(
186 'bookuser',
187 $this->refinery->kindlyTo()->dictOf(
188 $this->refinery->kindlyTo()->string()
189 )
190 );
191 }
192 return [];
193 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by assignUsersToAppointment().

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

◆ initBookingUsersFromQuery()

ilConsultationHoursGUI::initBookingUsersFromQuery ( )
protected
Returns
string[]

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

198 : array
199 {
200 if ($this->http->wrapper()->query()->has('bookuser')) {
201 return [
202 $this->http->wrapper()->query()->retrieve(
203 'bookuser',
204 $this->refinery->kindlyTo()->string()
205 )
206 ];
207 }
208 return [];
209 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ initFormSequence()

ilConsultationHoursGUI::initFormSequence ( int  $a_mode)
protected
Todo:
get rid of $this->form

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

384 {
385 $this->form = new ilPropertyFormGUI();
386 $this->form->setFormAction($this->ctrl->getFormAction($this));
387
388 switch ($a_mode) {
390 $this->form->setTitle($this->lng->txt('cal_ch_add_sequence'));
391 $this->form->addCommandButton('saveSequence', $this->lng->txt('save'));
392 $this->form->addCommandButton('appointments', $this->lng->txt('cancel'));
393 break;
394
395 case self::MODE_MULTI:
396 $this->form->setTitle($this->lng->txt('cal_ch_multi_edit_sequence'));
397 $this->form->addCommandButton('updateMulti', $this->lng->txt('save'));
398 $this->form->addCommandButton('appointments', $this->lng->txt('cancel'));
399 break;
400 }
401
402 // Title
403 $ti = new ilTextInputGUI($this->lng->txt('title'), 'ti');
404 $ti->setSize(32);
405 $ti->setMaxLength(128);
406 $ti->setRequired(true);
407 $this->form->addItem($ti);
408
409 if ($a_mode != self::MODE_MULTI) {
410 // Start
411 $dur = new ilDateTimeInputGUI($this->lng->txt('cal_start'), 'st');
412 $dur->setShowTime(true);
413 $dur->setRequired(true);
414 $this->form->addItem($dur);
415
416 // Duration
417 $du = new ilDurationInputGUI($this->lng->txt('cal_ch_duration'), 'du');
418 $du->setShowMinutes(true);
419 $du->setShowHours(true);
420 $this->form->addItem($du);
421
422 // Number of appointments
423 $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_appointments'), 'ap');
424 $nu->setInfo($this->lng->txt('cal_ch_num_appointments_info'));
425 $nu->setSize(2);
426 $nu->setMaxLength(2);
427 $nu->setRequired(true);
428 $nu->setMinValue(1);
429 $this->form->addItem($nu);
430
431 // Recurrence
432 $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
433 $rec->setEnabledSubForms(
434 array(
438 )
439 );
440 $this->form->addItem($rec);
441 }
442
443 // Number of bookings
444 $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_bookings'), 'bo');
445 $nu->setSize(2);
446 $nu->setMaxLength(2);
447 $nu->setMinValue(1);
448 $nu->setRequired(true);
449 $this->form->addItem($nu);
450
451 // Deadline
452 $dead = new ilDurationInputGUI($this->lng->txt('cal_ch_deadline'), 'dead');
453 $dead->setInfo($this->lng->txt('cal_ch_deadline_info'));
454 $dead->setShowMinutes(false);
455 $dead->setShowHours(true);
456 $dead->setShowDays(true);
457 $this->form->addItem($dead);
458
459 // Location
460 $lo = new ilTextInputGUI($this->lng->txt('cal_where'), 'lo');
461 $lo->setSize(32);
462 $lo->setMaxLength(128);
463 $this->form->addItem($lo);
464
465 // Description
466 $de = new ilTextAreaInputGUI($this->lng->txt('description'), 'de');
467 $de->setRows(10);
468 $de->setCols(60);
469 $this->form->addItem($de);
470
471 // Target Object
472 $tgt = new ilTextInputGUI($this->lng->txt('cal_ch_target_object'), 'tgt');
473 $tgt->setInfo($this->lng->txt('cal_ch_target_object_info'));
474 $tgt->setSize(16);
475 $tgt->setMaxLength(128);
476 $this->form->addItem($tgt);
477 return $this->form;
478 }
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 text area property in a property form.
This class represents a text property in a property form.

References $form, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilCalendarRecurrence\FREQ_DAILY, ilCalendarRecurrence\FREQ_MONTHLY, ilCalendarRecurrence\FREQ_WEEKLY, ILIAS\Repository\lng(), MODE_CREATE, and MODE_MULTI.

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

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

◆ initSearchAssignmentToAppointments()

ilConsultationHoursGUI::initSearchAssignmentToAppointments (   $a_default = false)
protected

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

114 : bool
115 {
116 $this->search_assignment_to_appointments = $a_default;
117 if ($this->http->wrapper()->query()->has('assignM')) {
118 $this->search_assignment_to_appointments = $this->http->wrapper()->query()->retrieve(
119 'assignM',
120 $this->refinery->kindlyTo()->bool()
121 );
122 }
124 }

References $search_assignment_to_appointments, ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

Referenced by executeCommand().

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

◆ initSequenceCreation()

ilConsultationHoursGUI::initSequenceCreation ( )
protected

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

1059 {
1060 $add_sequence_button = $this->ui_factory->button()->standard(
1061 $this->lng->txt('cal_ch_add_sequence'),
1062 $this->ctrl->getLinkTarget($this, 'createSequence')
1063 );
1064 return $add_sequence_button;
1065 }
A component is the most general form of an entity in the UI.
Definition: Component.php:28

References ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initSettingsForm()

ilConsultationHoursGUI::initSettingsForm ( )
protected

build settings form

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

810 {
811 $form = new ilPropertyFormGUI();
812 $form->setFormAction($this->ctrl->getFormAction($this));
813
814 $mng = new ilTextInputGUI($this->lng->txt('cal_ch_manager'), 'mng');
815 $mng->setInfo($this->lng->txt('cal_ch_manager_info'));
816 $form->addItem($mng);
817
818 $mng->setValue(ilConsultationHourAppointments::getManager(true));
819
820 $form->setTitle($this->lng->txt('settings'));
821 $form->addCommandButton('updateSettings', $this->lng->txt('save'));
822 return $form;
823 }
static getManager(bool $a_as_name=false, bool $a_full_name=false, ?int $a_user_id=null)
Get consultation hour manager for current user or specific user.
setFormAction(string $a_formaction)
addCommandButton(string $a_cmd, string $a_text, string $a_id="")

References ILIAS\Repository\ctrl(), ilConsultationHourAppointments\getManager(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ initViewMode()

ilConsultationHoursGUI::initViewMode ( )
protected

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

1124 : void
1125 {
1126 global $DIC;
1127
1128 $user = $DIC->user();
1129 $vm_period = $this->http->wrapper()->query()->retrieve(
1130 'vm_period',
1131 $this->refinery->byTrying(
1132 [
1133 $this->refinery->kindlyTo()->string(),
1134 $this->refinery->always('')
1135 ]
1136 )
1137 );
1138 $vm_status = $this->http->wrapper()->query()->retrieve(
1139 'vm_status',
1140 $this->refinery->byTrying(
1141 [
1142 $this->refinery->kindlyTo()->string(),
1143 $this->refinery->always('')
1144 ]
1145 )
1146 );
1147
1148 if ($vm_period !== '') {
1149 $user->writePref('cal_ch_vm_period', $vm_period);
1150 }
1151 if ($vm_status !== '') {
1152 $user->writePref('cal_ch_vm_status', $vm_status);
1153 }
1154 $this->vm_period = $user->getPref('cal_ch_vm_period') ? $user->getPref('cal_ch_vm_period') : self::VIEW_MODE_PERIOD_ALL;
1155 $this->vm_status = $user->getPref('cal_ch_vm_status') ? $user->getPref('cal_ch_vm_status') : self::VIEW_MODE_STATUS_ALL;
1156
1157 }

References $DIC, ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ renderViewControl()

ilConsultationHoursGUI::renderViewControl ( )
protected

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

1067 : string
1068 {
1069 $toolbar = new ilToolbarGUI();
1072
1073 $this->ctrl->setParameter($this, 'vm_period', self::VIEW_MODE_PERIOD_PAST);
1074 $actions[$this->lng->txt('cal_ch_vm_period_' . self::VIEW_MODE_PERIOD_PAST)] = $this->ctrl->getLinkTarget(
1075 $this,
1076 'appointments'
1077 );
1078 $this->ctrl->setParameter($this, 'vm_period', self::VIEW_MODE_PERIOD_UPCOMING);
1079 $actions[$this->lng->txt('cal_ch_vm_period_' . self::VIEW_MODE_PERIOD_UPCOMING)] = $this->ctrl->getLinkTarget(
1080 $this,
1081 'appointments'
1082 );
1083 $this->ctrl->setParameter($this, 'vm_period', self::VIEW_MODE_PERIOD_ALL);
1084 $actions[$this->lng->txt('cal_ch_vm_period_' . self::VIEW_MODE_PERIOD_ALL)] = $this->ctrl->getLinkTarget(
1085 $this,
1086 'appointments'
1087 );
1088 $this->ctrl->setParameter($this, 'vm_period', '');
1089
1090 $view_control_period = $this->ui_factory->viewControl()->mode(
1091 $actions,
1092 $this->lng->txt('meta_aria_language_selection')
1093 )->withActive($this->lng->txt('cal_ch_vm_period_' . $this->vm_period));
1094
1095 $toolbar->addComponent($view_control_period);
1096
1097 $actions = [];
1098 $this->ctrl->setParameter($this, 'vm_status', self::VIEW_MODE_STATUS_OPEN);
1099 $actions[$this->lng->txt('cal_ch_vm_status_' . self::VIEW_MODE_STATUS_OPEN)] = $this->ctrl->getLinkTarget(
1100 $this,
1101 'appointments'
1102 );
1103 $this->ctrl->setParameter($this, 'vm_status', self::VIEW_MODE_STATUS_BOOKED);
1104 $actions[$this->lng->txt('cal_ch_vm_status_' . self::VIEW_MODE_STATUS_BOOKED)] = $this->ctrl->getLinkTarget(
1105 $this,
1106 'appointments'
1107 );
1108 $this->ctrl->setParameter($this, 'vm_status', self::VIEW_MODE_STATUS_ALL);
1109 $actions[$this->lng->txt('cal_ch_vm_status_' . self::VIEW_MODE_STATUS_ALL)] = $this->ctrl->getLinkTarget(
1110 $this,
1111 'appointments'
1112 );
1113 $this->ctrl->setParameter($this, 'vm_status', '');
1114
1115 $view_control_status = $this->ui_factory->viewControl()->mode(
1116 $actions,
1117 $this->lng->txt('meta_aria_language_selection')
1118 )->withActive($this->lng->txt('cal_ch_vm_status_' . $this->vm_status));
1119
1120 $toolbar->addComponent($view_control_status);
1121 return $toolbar->getHTML();
1122 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addComponent(\ILIAS\UI\Component\Component $a_comp)

References ILIAS\Repository\ctrl(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ rewriteBookingIdsForAppointments()

ilConsultationHoursGUI::rewriteBookingIdsForAppointments ( ilBookingEntry  $booking,
array  $appointments,
ilPropertyFormGUI  $form 
)
protected

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

699 : void {
700 foreach ($appointments as $appointment_id) {
701 $booking_appointment = new \ilCalendarEntry($appointment_id);
702 $booking_start = $booking_appointment->getStart();
703 $booking_end = $booking_appointment->getEnd();
704
705 $deprecatedBooking = \ilBookingEntry::getInstanceByCalendarEntryId($appointment_id);
706 if (!$deprecatedBooking instanceof \ilBookingEntry) {
707 // @todo error handling
708 continue;
709 }
710
712 $deprecatedBooking,
713 $booking_start,
714 $booking_end
715 );
716 foreach ($relevant_appointments as $relevant_appointment_id) {
717 $entry = new \ilCalendarEntry($relevant_appointment_id);
718 $entry->setContextId($booking->getId());
719 $entry->setTitle($form->getInput('ti'));
720 $entry->setLocation($form->getInput('lo'));
721 $entry->setDescription($form->getInput('de'));
722 $entry->update();
723 }
724 }
725 }
static findCalendarAppointmentsForBooking(ilBookingEntry $booking, ilDateTime $start, ilDateTime $end)
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...

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

+ Here is the call graph for this function:

◆ saveSequence()

ilConsultationHoursGUI::saveSequence ( )
protected

Save new sequence.

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

483 : void
484 {
485 $this->initFormSequence(self::MODE_CREATE);
486
487 if ($this->form->checkInput()) {
488 $this->form->setValuesByPost();
489
490 $booking = new ilBookingEntry();
491 $booking->setObjId($this->getUserId());
492 $booking->setNumberOfBookings((int) $this->form->getInput('bo'));
493
494 $deadline = $this->form->getInput('dead');
495 $deadline = $deadline['dd'] * 24 + $deadline['hh'];
496 $booking->setDeadlineHours($deadline);
497
498 $tgt = array_map('intval', explode(',', $this->form->getInput('tgt')));
499 $obj_ids = array();
500 foreach ($tgt as $ref_id) {
501 if ($ref_id === 0) {
502 continue;
503 }
504 $obj_id = ilObject::_lookupObjId($ref_id);
505 $type = ilObject::_lookupType($obj_id);
506 $valid_types = array('crs', 'grp');
507 if (!$obj_id or !in_array($type, $valid_types)) {
508 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cal_ch_unknown_repository_object'));
509 $this->tpl->setContent($this->form->getHTML());
510 return;
511 }
512
513 $obj_ids[] = $obj_id;
514 }
515 $booking->setTargetObjIds($obj_ids);
516 $booking->save();
518 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
519 $this->ctrl->redirect($this, 'appointments');
520 } else {
521 $this->form->setValuesByPost();
522 $this->tpl->setContent($this->form->getHTML());
523 }
524 }
createAppointments(ilBookingEntry $booking)
Create calendar appointments.

References $booking, ilObject\_lookupObjId(), ilObject\_lookupType(), createAppointments(), ILIAS\Repository\ctrl(), ILIAS\Repository\form(), getUserId(), initFormSequence(), ILIAS\Repository\lng(), ilBookingEntry\save(), ilBookingEntry\setDeadlineHours(), ilBookingEntry\setNumberOfBookings(), ilBookingEntry\setObjId(), and ilBookingEntry\setTargetObjIds().

+ Here is the call graph for this function:

◆ searchUsersForAppointments()

ilConsultationHoursGUI::searchUsersForAppointments ( )
protected

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

271 : void
272 {
273 $apps = $this->initAppointmentIdsFromTableAction();
274 if ($apps === []) {
275 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
276 $this->ctrl->redirect($this, 'appointments');
277 }
278 ilSession::set('ch_apps', $apps);
279 $this->ctrl->setParameterByClass(ilConsultationHoursGUI::class, 'assignM', 1);
280 $this->ctrl->redirectByClass(ilRepositorySearchGUI::class, '');
281 }
static set(string $a_var, $a_val)
Set a value.

References ILIAS\Repository\ctrl(), initAppointmentIdsFromTableAction(), ILIAS\Repository\lng(), and ilSession\set().

+ Here is the call graph for this function:

◆ sendInfoAboutUnassignedUsers()

ilConsultationHoursGUI::sendInfoAboutUnassignedUsers ( array  $unassigned)
protected

Send info message about unassigned users.

Parameters
int[]$unassigned

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

287 : bool
288 {
289 if (!$unassigned) {
290 return true;
291 }
292 $users = array();
293 foreach ($unassigned as $user_id) {
295 }
296 $this->tpl->setOnScreenMessage('info', $this->lng->txt('cal_ch_user_assignment_failed_info') .
297 '<br />' . implode('<br />', $users), true);
298 return true;
299 }
static _lookupFullname(int $a_user_id)

References $user_id, ilObjUser\_lookupFullname(), and ILIAS\Repository\lng().

Referenced by assignUsersToAppointment(), and assignUsersToAppointments().

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

◆ sendMailToSelectedUsers()

ilConsultationHoursGUI::sendMailToSelectedUsers ( )
protected

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

883 : void
884 {
885 $appointment_ids = $this->initAppointmentIdsFromTableAction();
886 if ($appointment_ids === []) {
887 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
888 $this->appointments();
889 return;
890 }
891
892 $bookusers = [];
893 foreach ($appointment_ids as $appointment_id) {
894 $entry = new ilCalendarEntry($appointment_id);
895 $booking = new ilBookingEntry($entry->getContextId());
896 foreach ($booking->getCurrentBookings($entry->getEntryId()) as $bookuser) {
897 $login = ilObjUser::_lookupLogin($bookuser);
898 if (!in_array($login, $bookusers)) {
899 $bookusers[] = $login;
900 }
901 }
902 }
903 $this->ctrl->redirectToURL(
905 $this,
906 'appointments',
907 [],
908 [
909 'type' => 'new',
910 'rcp_to' => implode(',', $bookusers)
911 ]
912 )
913 );
914 }
static getRedirectTarget( $gui, string $cmd, array $gui_params=[], array $mail_params=[], array $context_params=[])
static _lookupLogin(int $a_user_id)

References ilObjUser\_lookupLogin(), ILIAS\Repository\ctrl(), ilMailFormCall\getRedirectTarget(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ setTabs()

ilConsultationHoursGUI::setTabs ( )
protected

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

597 : void
598 {
599 $this->ctrl->setParameter($this, 'user_id', '');
600 $this->tabs->addTab(
601 'consultation_hours_' . $this->user_id,
602 $this->lng->txt('cal_ch_ch'),
603 $this->ctrl->getLinkTarget($this, 'appointments')
604 );
605
607 $this->ctrl->setParameter($this, 'user_id', $user_id);
608 $this->tabs->addTab(
609 'consultation_hours_' . $user_id,
610 $this->lng->txt('cal_ch_ch') . ': ' . $login,
611 $this->ctrl->getLinkTarget($this, 'appointments')
612 );
613 }
614 $this->ctrl->setParameter($this, 'user_id', '');
615 $this->tabs->addTab('ch_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'settings'));
616 $this->tabs->activateTab('consultation_hours_' . $this->getUserId());
617 }

References $user_id, ILIAS\Repository\ctrl(), ilConsultationHourAppointments\getManagedUsers(), getUserId(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

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 797 of file class.ilConsultationHoursGUI.php.

797 : void
798 {
799 $this->help->setScreenId("consultation_hours_settings");
800 $this->tabs->activateTab('ch_settings');
801
802 $form = $this->initSettingsForm();
803 $this->tpl->setContent($form->getHTML());
804 }

References ILIAS\Repository\help(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ showProfile()

ilConsultationHoursGUI::showProfile ( )

show public profile of given user

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

760 : void
761 {
762 $this->tabs->clearTargets();
763
764 $user_id = 0;
765 if ($this->http->wrapper()->query()->has('user')) {
766 $user_id = $this->http->wrapper()->query()->retrieve(
767 'user',
768 $this->refinery->kindlyTo()->int()
769 );
770 }
771 $profile = new PublicProfileGUI($user_id);
772 $profile->setBackUrl($this->getProfileBackUrl());
773 $this->tpl->setContent($this->ctrl->getHTML($profile));
774 }
GUI class for public user profile presentation.
getProfileBackUrl()
Build context-sensitive profile back url.

References $user_id, ILIAS\Repository\ctrl(), ILIAS\FileDelivery\http(), ILIAS\Repository\refinery(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

◆ updateMulti()

ilConsultationHoursGUI::updateMulti ( )
protected

Update multiple sequence items.

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

730 : void
731 {
732 $this->initFormSequence(self::MODE_MULTI);
733 if (!$this->form->checkInput()) {
734 $this->form->setValuesByPost();
735 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
736 $this->edit();
737 return;
738 }
739
740 $this->form->setValuesByPost();
741 $apps = $this->initAppointmentIdsFromPostString();
742
743 // create new booking
744 $booking = $this->createNewBookingEntry($this->form);
745 if (!$booking instanceof \ilBookingEntry) {
746 $this->edit();
747 return;
748 }
749 $this->rewriteBookingIdsForAppointments($booking, $apps, $this->form);
751
752 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
753 $this->ctrl->redirect($this, 'appointments');
754 $this->tpl->setContent($this->form->getHTML());
755 }
rewriteBookingIdsForAppointments(ilBookingEntry $booking, array $appointments, ilPropertyFormGUI $form)
createNewBookingEntry(ilPropertyFormGUI $validate_form)

References ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ILIAS\Repository\lng(), and ilBookingEntry\removeObsoleteEntries().

+ Here is the call graph for this function:

◆ updateSettings()

ilConsultationHoursGUI::updateSettings ( )

save settings

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

828 : void
829 {
830 $form = $this->initSettingsForm();
831 if ($form->checkInput()) {
832 $mng = $form->getInput('mng');
834 $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
835 $this->ctrl->redirect($this, 'settings');
836 } else {
837 $this->tabs->activateTab('ch_settings');
838
839 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cal_ch_unknown_user'));
840 $field = $form->getItemByPostVar('mng');
841 $field->setValue($mng);
842 $this->tpl->setContent($form->getHTML());
843 return;
844 }
845 }
846 }
static setManager(string $a_user_name)
Set consultation hour manager for current user.
getItemByPostVar(string $a_post_var)

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), ilConsultationHourAppointments\setManager(), and ILIAS\Repository\tabs().

+ Here is the call graph for this function:

Field Documentation

◆ $booking

◆ $ctrl

ilCtrlInterface ilConsultationHoursGUI::$ctrl
protected

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

◆ $form

ilPropertyFormGUI ilConsultationHoursGUI::$form = null
private

◆ $global_user

ilObjUser ilConsultationHoursGUI::$global_user
protected

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

◆ $help

ilHelpGUI ilConsultationHoursGUI::$help
protected

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

◆ $http

GlobalHttpState ilConsultationHoursGUI::$http
protected

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

◆ $lng

ilLanguage ilConsultationHoursGUI::$lng
protected

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

◆ $refinery

RefineryFactory ilConsultationHoursGUI::$refinery
protected

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

◆ $search_assignment_to_appointments

bool ilConsultationHoursGUI::$search_assignment_to_appointments = false
private

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

Referenced by initSearchAssignmentToAppointments().

◆ $tabs

ilTabsGUI ilConsultationHoursGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilConsultationHoursGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilConsultationHoursGUI::$tpl
protected

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

◆ $ui_factory

UIFactory ilConsultationHoursGUI::$ui_factory
private

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

◆ $ui_renderer

UIRenderer ilConsultationHoursGUI::$ui_renderer
private

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

◆ $user_id

int ilConsultationHoursGUI::$user_id
private

◆ $vm_period

string ilConsultationHoursGUI::$vm_period = ''
private

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

◆ $vm_status

string ilConsultationHoursGUI::$vm_status = ''
private

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

◆ MAX_APPOINTMENTS_PER_SEQUENCE

const ilConsultationHoursGUI::MAX_APPOINTMENTS_PER_SEQUENCE = 1000
protected

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

◆ MODE_CREATE

const ilConsultationHoursGUI::MODE_CREATE = 1
protected

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

Referenced by initFormSequence().

◆ MODE_MULTI

const ilConsultationHoursGUI::MODE_MULTI = 3
protected

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

Referenced by initFormSequence().

◆ MODE_UPDATE

const ilConsultationHoursGUI::MODE_UPDATE = 2
protected

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

◆ VIEW_MODE_PERIOD_ALL

const ilConsultationHoursGUI::VIEW_MODE_PERIOD_ALL = 'all'

◆ VIEW_MODE_PERIOD_PAST

const ilConsultationHoursGUI::VIEW_MODE_PERIOD_PAST = 'past'

◆ VIEW_MODE_PERIOD_UPCOMING

const ilConsultationHoursGUI::VIEW_MODE_PERIOD_UPCOMING = 'upcoming'

◆ VIEW_MODE_STATUS_ALL

const ilConsultationHoursGUI::VIEW_MODE_STATUS_ALL = 'all'

◆ VIEW_MODE_STATUS_BOOKED

const ilConsultationHoursGUI::VIEW_MODE_STATUS_BOOKED = 'booked'

◆ VIEW_MODE_STATUS_OPEN

const ilConsultationHoursGUI::VIEW_MODE_STATUS_OPEN = 'open'

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