ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilConsultationHoursGUI Class Reference

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

+ Collaboration diagram for 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...
 
 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...
 

Protected Member Functions

 initSearchAssignmentToAppointments ($a_default=false)
 
 initGroupIdFromQuery ()
 
 initAppointmentIdsFromQuery ()
 
 initAppointmentIdsFromPost ()
 
 initAppointmentIdsFromPostString ()
 
 initGroupIdsFromPost ()
 
 initBookingUsersFromPost ()
 
 initBookingUsersFromQuery ()
 
 searchUsersForAppointments ()
 
 sendInfoAboutUnassignedUsers (array $unassigned)
 Send info message about unassigned users. More...
 
 groupList ()
 Show consultation hour group. More...
 
 addGroup (?ilPropertyFormGUI $form=null)
 Show add group form. More...
 
 saveGroup ()
 Save new group. More...
 
 editGroup (?ilPropertyFormGUI $form=null)
 Edit group. More...
 
 updateGroup ()
 Update group. More...
 
 confirmDeleteGroup ()
 Confirm delete. More...
 
 deleteGroup ()
 Delete groups. More...
 
 initGroupForm (int $a_group_id=0)
 
 bookingList ()
 Show list of bookings. More...
 
 confirmDeleteBooking ()
 Show delete booking confirmation. More...
 
 confirmRejectBooking (bool $a_send_notification=true)
 Show delete booking confirmation. More...
 
 deleteBooking ()
 Delete booking. More...
 
 rejectBooking (bool $a_send_notification=true)
 
 appointmentList ()
 Show settings of consultation hours. More...
 
 createSequence ()
 Create new sequence. More...
 
 initFormSequence (int $a_mode)
 
 saveSequence ()
 Save new sequence. More...
 
 createAppointments (ilBookingEntry $booking)
 Create calendar appointments. More...
 
 setTabs ()
 
 setSubTabs ()
 
 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...
 

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
 
HttpServices $http
 

Private Attributes

int $user_id
 
bool $search_assignment_to_appointments = false
 
ilBookingEntry $booking = null
 
ilPropertyFormGUI $form = null
 

Detailed Description

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

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

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

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e ilConsultationHoursGUI: ilPublicUserProfileGUI, ilRepositorySearchGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilConsultationHoursGUI::__construct ( )

Constructor.

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

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().

58  {
59  global $DIC;
60 
61  $this->http = $DIC->http();
62  $this->refinery = $DIC->refinery();
63 
64  $user_id = 0;
65  if ($this->http->wrapper()->query()->has('user_id')) {
66  $user_id = $this->http->wrapper()->query()->retrieve(
67  'user_id',
68  $this->refinery->kindlyTo()->int()
69  );
70  }
71  if ($user_id) {
72  if (in_array($user_id, array_keys(ilConsultationHourAppointments::getManagedUsers()))) {
73  $this->user_id = $user_id;
74  } else {
75  $user_id = false;
76  }
77  }
78  if (!$user_id) {
79  $this->user_id = $DIC->user()->getId();
80  }
81 
82  $this->ctrl = $DIC->ctrl();
83  $this->lng = $DIC->language();
84  $this->tpl = $DIC->ui()->mainTemplate();
85  $this->help = $DIC->help();
86  $this->tabs = $DIC->tabs();
87  $this->toolbar = $DIC->toolbar();
88  $this->global_user = $DIC->user();
89  }
global $DIC
Definition: feed.php:28
static http()
Fetches the global http state from ILIAS.
static getManagedUsers()
Get all managed consultation hours users for current users.
+ Here is the call graph for this function:

Member Function Documentation

◆ addGroup()

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

Show add group form.

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

References ilPropertyFormGUI\getHTML(), initGroupForm(), setSubTabs(), and ILIAS\Repository\tabs().

Referenced by saveGroup().

419  : void
420  {
421  $this->setSubTabs();
422  $this->tabs->activateSubTab('cal_ch_app_grp');
423 
424  if ($form == null) {
425  $form = $this->initGroupForm();
426  }
427  $this->tpl->setContent($form->getHTML());
428  }
+ 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.

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

References ILIAS\Repository\ctrl(), getUserId(), ILIAS\Repository\help(), ILIAS\Repository\lng(), setSubTabs(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

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

668  : void
669  {
670  $this->help->setScreenId("consultation_hours");
671 
672  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
673  $this->toolbar->addButton(
674  $this->lng->txt('cal_ch_add_sequence'),
675  $this->ctrl->getLinkTarget($this, 'createSequence')
676  );
677 
678  $this->setSubTabs();
679  $this->tabs->activateSubTab('cal_ch_app_list');
680 
681  $tbl = new ilConsultationHoursTableGUI($this, 'appointmentList', $this->getUserId());
682  $tbl->parse();
683  $this->tpl->setContent($tbl->getHTML());
684  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ 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 326 of file class.ilConsultationHoursGUI.php.

References $app, ilConsultationHourUtils\bookAppointment(), ILIAS\Repository\ctrl(), ilBookingEntry\getCurrentNumberOfBookings(), ilBookingEntry\getInstanceByCalendarEntryId(), ilBookingEntry\getNumberOfBookings(), initAppointmentIdsFromPost(), initAppointmentIdsFromQuery(), initBookingUsersFromPost(), ILIAS\Repository\lng(), ilBookingEntry\lookupBookingsOfUser(), and sendInfoAboutUnassignedUsers().

Referenced by assignUsersToAppointments().

326  : array
327  {
328  if ($a_app) {
329  $app = $a_app;
330  } elseif ($this->initBookingUsersFromPost() !== []) {
331  $app = $this->initAppointmentIdsFromPost();
332  $app = current($app);
333  } elseif ($this->initAppointmentIdsFromQuery() !== []) {
335  $app = current($app);
336  }
337  if (!count($users)) {
338  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
339  return [];
340  }
342  $assigned_users = array();
343  foreach ($users as $user) {
345  break;
346  }
347  if (!ilBookingEntry::lookupBookingsOfUser((array) $app, $user)) {
349  $assigned_users[] = $user;
350  }
351  }
352  $unassigned_users = array_diff($users, $assigned_users);
353  if ($a_redirect) {
354  $this->sendInfoAboutUnassignedUsers($unassigned_users);
355  $this->ctrl->redirect($this, 'appointmentList');
356  } else {
357  return $unassigned_users;
358  }
359  return [];
360  }
$app
Definition: cli.php:39
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)
Book an appointment.
static getInstanceByCalendarEntryId(int $a_id)
Get instance by calendar entry.
sendInfoAboutUnassignedUsers(array $unassigned)
Send info message about unassigned users.
+ 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 303 of file class.ilConsultationHoursGUI.php.

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

304  {
305  $unassigned_users = [];
306  $ch_apps = (array) (ilSession::get('ch_apps') ?? []);
307  foreach ($ch_apps as $app) {
308  $unassigned_users = array_unique(array_merge(
309  $unassigned_users,
310  $this->assignUsersToAppointment($users, $app, false)
311  ));
312  }
313 
314  $this->sendInfoAboutUnassignedUsers($unassigned_users);
315  $this->ctrl->redirect($this, 'appointmentList');
316  }
$app
Definition: cli.php:39
static get(string $a_var)
assignUsersToAppointment(array $users, int $a_app=0, bool $a_redirect=true)
Assign users to an appointment.
sendInfoAboutUnassignedUsers(array $unassigned)
Send info message about unassigned users.
+ Here is the call graph for this function:

◆ assignUsersToGroup()

ilConsultationHoursGUI::assignUsersToGroup ( array  $usr_ids)
Parameters
int[]$usr_ids

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

References $app, ilConsultationHourUtils\bookAppointment(), ILIAS\Repository\ctrl(), ilConsultationHourAppointments\getAppointmentIdsByGroup(), ilBookingEntry\getCurrentNumberOfBookings(), ilBookingEntry\getInstanceByCalendarEntryId(), ilBookingEntry\getNumberOfBookings(), IL_CAL_DAY, IL_CAL_UNIX, initGroupIdFromQuery(), ilBookingEntry\lookupBookingsOfUser(), and sendInfoAboutUnassignedUsers().

365  : void
366  {
367  $group_id = $this->initGroupIdFromQuery();
368 
369  $tomorrow = new ilDateTime(time(), IL_CAL_UNIX);
370  $tomorrow->increment(IL_CAL_DAY, 1);
371 
372  // Get all future consultation hours
374  $this->user_id,
375  $group_id,
376  $tomorrow
377  );
378  $users = $usr_ids;
379  $assigned_users = array();
380  foreach ($apps as $app) {
382  foreach ($users as $user) {
384  break;
385  }
386  if (!ilBookingEntry::lookupBookingsOfUser($apps, $user)) {
388  $assigned_users[] = $user;
389  }
390  }
391  }
392 
393  $this->sendInfoAboutUnassignedUsers(array_diff($users, $assigned_users));
394  $this->ctrl->redirect($this, 'bookingList');
395  }
$app
Definition: cli.php:39
getCurrentNumberOfBookings(int $a_entry_id)
get current number of bookings
const IL_CAL_UNIX
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)
Book an appointment.
static getInstanceByCalendarEntryId(int $a_id)
Get instance by calendar entry.
const IL_CAL_DAY
sendInfoAboutUnassignedUsers(array $unassigned)
Send info message about unassigned users.
static getAppointmentIdsByGroup(int $a_user_id, int $a_ch_group_id, ?ilDateTime $start=null)
Get appointment ids by consultation hour group.
+ Here is the call graph for this function:

◆ bookingList()

ilConsultationHoursGUI::bookingList ( )
protected

Show list of bookings.

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

References ilConsultationHourAppointments\getAppointmentIds(), getUserId(), ILIAS\Repository\help(), setSubTabs(), and ILIAS\Repository\tabs().

Referenced by confirmRejectBooking().

567  : void
568  {
569  $this->help->setScreenId("consultation_hours");
570 
571  $this->setSubTabs();
572  $this->tabs->activateSubTab('cal_ch_app_bookings');
573 
574  $btable = new ilConsultationHourBookingTableGUI($this, 'bookingList', $this->getUserId());
576  $this->tpl->setContent($btable->getHTML());
577  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getAppointmentIds(int $a_user_id, int $a_context_id=null, ?ilDateTime $a_start=null, ?int $a_type=null, bool $a_check_owner=true)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ confirmDelete()

ilConsultationHoursGUI::confirmDelete ( )

confirm delete for multiple entries

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

References appointmentList(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), initAppointmentIdsFromPost(), initAppointmentIdsFromQuery(), ILIAS\Repository\lng(), and ilBookingEntry\lookupBookingsForAppointment().

1130  : void
1131  {
1132  $apps = [];
1133  if ($this->initAppointmentIdsFromPost() !== []) {
1134  $apps = $this->initAppointmentIdsFromPost();
1135  } elseif ($this->initAppointmentIdsFromQuery() !== []) {
1136  $apps = $this->initAppointmentIdsFromQuery();
1137  }
1138  if ($apps === []) {
1139  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1140  $this->appointmentList();
1141  return;
1142  }
1143 
1144  $this->ctrl->saveParameter($this, array('seed', 'app_id', 'dt'));
1145  $confirm = new ilConfirmationGUI();
1146  $confirm->setFormAction($this->ctrl->getFormAction($this));
1147  $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
1148  $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
1149 
1150  $bookings_available = array();
1151  foreach ($apps as $entry_id) {
1152  $entry = new ilCalendarEntry($entry_id);
1153  $confirm->addItem(
1154  'apps[]',
1155  (string) $entry_id,
1156  ilDatePresentation::formatDate($entry->getStart()) . ', ' . $entry->getTitle()
1157  );
1158 
1160  $bookings_available[] = ilDatePresentation::formatDate($entry->getStart()) . ', ' . $entry->getTitle();
1161  }
1162  }
1163  if ($bookings_available) {
1164  $this->tpl->setOnScreenMessage('info', $this->lng->txt('cal_ch_delete_app_booking_info') . '<br />' . implode(
1165  '<br />',
1166  $bookings_available
1167  ));
1168  }
1169  $confirm->setConfirm($this->lng->txt('delete'), 'delete');
1170  $confirm->setCancel($this->lng->txt('cancel'), 'appointmentList');
1171  $this->tpl->setContent($confirm->getHTML());
1172  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
appointmentList()
Show settings of consultation hours.
static lookupBookingsForAppointment(int $a_app_id)
Lookup booked users for appointment.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ confirmDeleteBooking()

ilConsultationHoursGUI::confirmDeleteBooking ( )
protected

Show delete booking confirmation.

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

References confirmRejectBooking().

582  : void
583  {
584  $this->confirmRejectBooking(false);
585  }
confirmRejectBooking(bool $a_send_notification=true)
Show delete booking confirmation.
+ Here is the call graph for this function:

◆ confirmDeleteGroup()

ilConsultationHoursGUI::confirmDeleteGroup ( )
protected

Confirm delete.

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

References $GLOBALS, ILIAS\Repository\ctrl(), initGroupIdFromQuery(), setSubTabs(), and ILIAS\Repository\tabs().

493  : void
494  {
495  $group_id = $this->initGroupIdFromQuery();
496  $this->ctrl->setParameter($this, 'grp_id', $group_id);
497  $groups = array($group_id);
498 
499  $this->setSubTabs();
500  $this->tabs->activateSubTab('cal_ch_app_grp');
501  $confirm = new ilConfirmationGUI();
502  $confirm->setFormAction($this->ctrl->getFormAction($this));
503  $confirm->setHeaderText($GLOBALS['DIC']['lng']->txt('cal_ch_grp_delete_sure'));
504  $confirm->setConfirm($GLOBALS['DIC']['lng']->txt('delete'), 'deleteGroup');
505  $confirm->setCancel($GLOBALS['DIC']['lng']->txt('cancel'), 'groupList');
506 
507  foreach ($groups as $grp_id) {
508  $group = new ilConsultationHourGroup($grp_id);
509 
510  $confirm->addItem('groups[]', (string) $grp_id, $group->getTitle());
511  }
512  $this->tpl->setContent($confirm->getHTML());
513  }
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:

◆ confirmRejectBooking()

ilConsultationHoursGUI::confirmRejectBooking ( bool  $a_send_notification = true)
protected

Show delete booking confirmation.

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

References bookingList(), ILIAS\Repository\ctrl(), ilDatePresentation\formatDate(), ilUserUtil\getNamePresentation(), initBookingUsersFromPost(), initBookingUsersFromQuery(), ILIAS\Repository\lng(), setSubTabs(), and ILIAS\Repository\tabs().

Referenced by confirmDeleteBooking().

590  : void
591  {
592  $bookusers = [];
593  if ($this->initBookingUsersFromPost() !== []) {
594  $bookusers = $this->initBookingUsersFromPost();
595  } elseif ($this->initBookingUsersFromQuery() !== []) {
596  $bookusers = $this->initBookingUsersFromQuery();
597  }
598 
599  if ($bookusers === []) {
600  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
601  $this->bookingList();
602  return;
603  }
604  $this->setSubTabs();
605  $this->tabs->activateSubTab('cal_ch_app_bookings');
606 
607  $confirm = new ilConfirmationGUI();
608  $confirm->setFormAction($this->ctrl->getFormAction($this));
609 
610  if ($a_send_notification) {
611  $this->tpl->setOnScreenMessage('info', $this->lng->txt('cal_ch_cancel_booking_info'));
612  $confirm->setHeaderText($this->lng->txt('cal_ch_cancel_booking_sure'));
613  $confirm->setConfirm($this->lng->txt('cal_ch_reject_booking'), 'rejectBooking');
614  } else {
615  $this->tpl->setOnScreenMessage('info', $this->lng->txt('cal_ch_delete_booking_info'));
616  $confirm->setHeaderText($this->lng->txt('cal_ch_delete_booking_sure'));
617  $confirm->setConfirm($this->lng->txt('cal_ch_delete_booking'), 'deleteBooking');
618  }
619 
620  $confirm->setCancel($this->lng->txt('cancel'), 'bookingList');
621 
622  foreach ($bookusers as $bookuser) {
623  $ids = explode('_', $bookuser);
624 
625  $entry = new ilCalendarEntry((int) $ids[0]);
626  $confirm->addItem(
627  'bookuser[]',
628  $bookuser,
630  $ids[1],
631  true,
632  false,
633  '',
634  true,
635  true
636  ) . ', ' . ilDatePresentation::formatDate($entry->getStart())
637  );
638  }
639  $this->tpl->setContent($confirm->getHTML());
640  }
bookingList()
Show list of bookings.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getNamePresentation( $a_user_id, bool $a_user_image=false, bool $a_profile_link=false, string $a_profile_back_link="", bool $a_force_first_lastname=false, bool $a_omit_login=false, bool $a_sortable=true, bool $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ 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.

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

References $i, ilCalendarCategoryAssignments\addAssignment(), ilCalendarRecurrenceCalculator\calculateDateList(), ILIAS\Repository\form(), ilBookingEntry\getId(), getUserId(), ilDateTime\HOUR, ilCalendarUtil\initDefaultCalendarByType(), ILIAS\Repository\lng(), ilDateTime\MINUTE, ilCalendarEntry\TRANSLATION_SYSTEM, ilCalendarCategory\TYPE_CH, ilDateList\TYPE_DATETIME, and ilDateTime\YEAR.

Referenced by saveSequence().

867  : void
868  {
869  $concurrent_dates = new ilDateList(ilDateList::TYPE_DATETIME);
870  $start = clone $this->form->getItemByPostVar('st')->getDate();
871  for ($i = 0; $i < $this->form->getItemByPostVar('ap')->getValue(); $i++) {
872  $concurrent_dates->add(clone $start);
873 
874  $start->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
875  $start->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
876  #$start = new ilDateTime(,IL_CAL_UNIX);
877  }
878 
881  $this->getUserId(),
882  $this->lng->txt('cal_ch_personal_ch'),
883  true
884  );
885 
886  // Add calendar appointment for each
887 
888  $num_appointments = 0;
889  foreach ($concurrent_dates as $dt) {
890  if ($num_appointments >= self::MAX_APPOINTMENTS_PER_SEQUENCE) {
891  break;
892  }
893 
894  $end = clone $dt;
895  $end->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
896  $end->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
897 
898  $calc = new ilCalendarRecurrenceCalculator(
899  new ilBookingPeriod($dt, $end),
900  $this->form->getItemByPostVar('frequence')->getRecurrence()
901  );
902 
903  // Calculate with one year limit
904  $limit = clone $dt;
905  $limit->increment(ilDateTime::YEAR, 1);
906 
907  $date_list = $calc->calculateDateList($dt, $limit);
908 
909  $num = 0;
910  foreach ($date_list as $app_start) {
911  $app_end = clone $app_start;
912  $app_end->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
913  $app_end->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
914 
915  $entry = new ilCalendarEntry();
916  $entry->setContextId($booking->getId());
917  $entry->setTitle($this->form->getInput('ti'));
918  $entry->setSubtitle("#consultationhour#"); // dynamic, see ilCalendarEntry
919  $entry->setDescription($this->form->getInput('de'));
920  $entry->setLocation($this->form->getInput('lo'));
921  $entry->setStart($app_start);
922  $entry->setEnd($app_end);
923 
924  $entry->setTranslationType(ilCalendarEntry::TRANSLATION_SYSTEM);
925  $entry->save();
926 
927  $cat_assign = new ilCalendarCategoryAssignments($entry->getEntryId());
928  $cat_assign->addAssignment($def_cat->getCategoryID());
929 
930  $num_appointments++;
931  }
932  }
933  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
List of dates.
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.
form( $class_path, string $cmd)
Booking period Used for calculation of recurring events.
calculateDateList(ilDateTime $a_start, ilDateTime $a_end, int $a_limit=-1)
calculate date list
$i
Definition: metadata.php:41
+ 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 1031 of file class.ilConsultationHoursGUI.php.

References $booking, $ref_id, $type, ilObject\_lookupObjId(), ilObject\_lookupType(), ILIAS\Repository\form(), ilConsultationHourGroups\getCountGroupsOfUser(), getUserId(), ILIAS\Repository\lng(), ilBookingEntry\save(), ilBookingEntry\setBookingGroup(), ilBookingEntry\setDeadlineHours(), ilBookingEntry\setNumberOfBookings(), ilBookingEntry\setObjId(), and ilBookingEntry\setTargetObjIds().

Referenced by updateMulti().

1031  : ?ilBookingEntry
1032  {
1033  $booking = new \ilBookingEntry();
1034  $booking->setObjId($this->user_id);
1035  $booking->setNumberOfBookings((int) $this->form->getInput('bo'));
1036 
1037  $deadline = $this->form->getInput('dead');
1038  $deadline = $deadline['dd'] * 24 + $deadline['hh'];
1039  $booking->setDeadlineHours($deadline);
1040 
1041  $tgt = array_map('intval', explode(',', (string) $this->form->getInput('tgt')));
1042  $obj_ids = [];
1043  foreach ($tgt as $ref_id) {
1044  if ($ref_id === 0) {
1045  continue;
1046  }
1047  $obj_id = ilObject::_lookupObjId($ref_id);
1048  $type = ilObject::_lookupType($obj_id);
1049  $valid_types = ['crs', 'grp'];
1050  if (!$obj_id or !in_array($type, $valid_types)) {
1051  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cal_ch_unknown_repository_object'));
1052  return null;
1053  }
1054  $obj_ids[] = $obj_id;
1055  }
1056  $booking->setTargetObjIds($obj_ids);
1057 
1059  $booking->setBookingGroup((int) $this->form->getInput('grp'));
1060  }
1061  $booking->save();
1062  return $booking;
1063  }
$type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _lookupObjId(int $ref_id)
$ref_id
Definition: ltiauth.php:67
setDeadlineHours(int $a_hours)
static getCountGroupsOfUser(int $a_user_id)
Get number of consultation hour groups.
form( $class_path, string $cmd)
setNumberOfBookings(int $a_num)
static _lookupType(int $id, bool $reference=false)
setTargetObjIds(?array $a_obj_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ createSequence()

ilConsultationHoursGUI::createSequence ( )
protected

Create new sequence.

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

References ILIAS\Repository\form(), IL_CAL_UNIX, and initFormSequence().

689  : void
690  {
691  $this->initFormSequence(self::MODE_CREATE);
692 
693  $this->booking = new ilBookingEntry();
694  $this->form->getItemByPostVar('bo')->setValue((string) $this->booking->getNumberOfBookings());
695  $this->form->getItemByPostVar('ap')->setValue("1");
696  $this->form->getItemByPostVar('du')->setMinutes(15);
697  $this->form->getItemByPostVar('st')->setDate(
698  new ilDateTime(mktime(8, 0, 0, (int) date('n', time()), (int) date('d', time()), (int) date('Y', time())), IL_CAL_UNIX)
699  );
700  $this->tpl->setContent($this->form->getHTML());
701  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_UNIX
form( $class_path, string $cmd)
+ Here is the call graph for this function:

◆ delete()

ilConsultationHoursGUI::delete ( )

delete multiple entries

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

References $user_id, ilCalendarCategoryAssignments\_deleteByAppointmentId(), appointmentList(), ilConsultationHourUtils\cancelBooking(), ILIAS\Repository\ctrl(), ilBookingEntry\getCurrentBookings(), ilBookingEntry\getInstanceByCalendarEntryId(), initAppointmentIdsFromPost(), ILIAS\Repository\lng(), and ilBookingEntry\removeObsoleteEntries().

1177  : void
1178  {
1179  if (!count($this->initAppointmentIdsFromPost())) {
1180  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
1181  $this->appointmentList();
1182  return;
1183  }
1184  foreach ($this->initAppointmentIdsFromPost() as $entry_id) {
1185  // cancel booking for users
1187  if ($booking) {
1188  foreach ($booking->getCurrentBookings($entry_id) as $user_id) {
1190  }
1191  }
1192  // remove calendar entries
1193  $entry = new ilCalendarEntry($entry_id);
1194  $entry->delete();
1196  }
1198  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_deleted_app'), true);
1199  $this->ctrl->redirect($this, 'appointmentList');
1200  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getCurrentBookings(int $a_entry_id)
get current bookings
static cancelBooking(int $a_usr_id, int $a_app_id, bool $a_send_notification=true)
Cancel a booking.
static removeObsoleteEntries()
Remove unused booking entries.
static getInstanceByCalendarEntryId(int $a_id)
Get instance by calendar entry.
static _deleteByAppointmentId(int $a_app_id)
Delete appointment assignment.
appointmentList()
Show settings of consultation hours.
+ Here is the call graph for this function:

◆ deleteBooking()

ilConsultationHoursGUI::deleteBooking ( )
protected

Delete booking.

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

References rejectBooking().

645  : void
646  {
647  $this->rejectBooking(false);
648  }
rejectBooking(bool $a_send_notification=true)
+ Here is the call graph for this function:

◆ deleteGroup()

ilConsultationHoursGUI::deleteGroup ( )
protected

Delete groups.

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

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

518  : void
519  {
520  foreach ($this->initGroupIdsFromPost() as $grp_id) {
521  $group = new ilConsultationHourGroup($grp_id);
522  $group->delete();
523  }
524  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_ch_grp_deleted'));
525  $this->ctrl->redirect($this, 'groupList');
526  }
+ Here is the call graph for this function:

◆ edit()

ilConsultationHoursGUI::edit ( )

Edit multiple sequence items.

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

References ilObject\_getAllReferences(), appointmentList(), ILIAS\Repository\form(), ilBookingEntry\getBookingGroup(), ilBookingEntry\getDeadlineHours(), ilBookingEntry\getNumberOfBookings(), ilBookingEntry\getTargetObjIds(), initAppointmentIdsFromPost(), initAppointmentIdsFromPostString(), initAppointmentIdsFromQuery(), initFormSequence(), and ILIAS\Repository\lng().

Referenced by updateMulti().

980  : void
981  {
982  // first read from hidden input
983  $apps = [];
984  if ($this->initAppointmentIdsFromPostString() !== []) {
985  $apps = $this->initAppointmentIdsFromPostString();
986  } elseif ($this->initAppointmentIdsFromPost() !== []) {
987  $apps = $this->initAppointmentIdsFromPost();
988  } elseif ($this->initAppointmentIdsFromQuery()) {
989  $apps = $this->initAppointmentIdsFromQuery();
990  }
991  if (!count($apps)) {
992  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'));
993  $this->appointmentList();
994  return;
995  }
996 
997  $this->initFormSequence(self::MODE_MULTI);
998  $hidden = new ilHiddenInputGUI('apps_string');
999  $hidden->setValue(implode(';', $apps));
1000  $this->form->addItem($hidden);
1001 
1002  $first = $apps;
1003  $first = array_shift($apps);
1004  $entry = new ilCalendarEntry($first);
1005 
1006  $this->form->getItemByPostVar('ti')->setValue($entry->getTitle());
1007  $this->form->getItemByPostVar('lo')->setValue($entry->getLocation());
1008  $this->form->getItemByPostVar('de')->setValue($entry->getDescription());
1009 
1010  $booking = new ilBookingEntry($entry->getContextId());
1011 
1012  $this->form->getItemByPostVar('bo')->setValue((string) $booking->getNumberOfBookings());
1013 
1014  $ref_ids = array();
1015  foreach ($booking->getTargetObjIds() as $obj_id) {
1016  $refs = ilObject::_getAllReferences($obj_id);
1017  $ref_ids[] = end($refs);
1018  }
1019  $this->form->getItemByPostVar('tgt')->setValue(implode(',', $ref_ids));
1020 
1021  $deadline = $booking->getDeadlineHours();
1022  $this->form->getItemByPostVar('dead')->setDays((int) floor($deadline / 24));
1023  $this->form->getItemByPostVar('dead')->setHours($deadline % 24);
1024 
1025  if ($booking->getBookingGroup()) {
1026  $this->form->getItemByPostVar('grp')->setValue($booking->getBookingGroup());
1027  }
1028  $this->tpl->setContent($this->form->getHTML());
1029  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getAllReferences(int $id)
get all reference ids for object ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
form( $class_path, string $cmd)
appointmentList()
Show settings of consultation hours.
+ 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.

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

References ILIAS\Repository\ctrl(), ilPropertyFormGUI\getHTML(), initGroupForm(), initGroupIdFromQuery(), setSubTabs(), and ILIAS\Repository\tabs().

Referenced by updateGroup().

454  : void
455  {
456  $this->ctrl->setParameter($this, 'grp_id', $this->initGroupIdFromQuery());
457  $this->setSubTabs();
458  $this->tabs->activateSubTab('cal_ch_app_grp');
459 
460  if ($form == null) {
461  $form = $this->initGroupForm($this->initGroupIdFromQuery());
462  }
463  $this->tpl->setContent($form->getHTML());
464  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilConsultationHoursGUI::executeCommand ( )

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

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

192  : void
193  {
194  $this->help->setScreenIdComponent("cal");
195  switch ($this->ctrl->getNextClass($this)) {
196  case "ilpublicuserprofilegui":
197  #22168 don't send the current user if no GET user_id
198  //$profile = new ilPublicUserProfileGUI($this->user_id);
199  $profile = new ilPublicUserProfileGUI();
200  $profile->setBackUrl($this->getProfileBackUrl());
201  $ret = $this->ctrl->forwardCommand($profile);
202  $this->tpl->setContent($ret);
203  break;
204 
205  case 'ilrepositorysearchgui':
206  $rep_search = new ilRepositorySearchGUI();
207  if ($this->initSearchAssignmentToAppointments()) {
208  $rep_search->setCallback(
209  $this,
210  'assignUsersToAppointments',
211  array()
212  );
213  $this->ctrl->setParameter($this, 'assignM', 1);
214  $this->ctrl->setReturn($this, 'appointmentList');
215  $this->tabs->activateSubTab('cal_ch_app_list');
216  } elseif ($this->initGroupIdFromQuery()) {
217  $rep_search->setCallback(
218  $this,
219  'assignUsersToGroup',
220  array()
221  );
222  $this->ctrl->saveParameter($this, 'grp_id');
223  $this->ctrl->setReturn($this, 'groupList');
224  $this->tabs->activateSubTab('cal_ch_app_grp');
225  } elseif (count($this->initAppointmentIdsFromPost())) {
226  $rep_search->setCallback(
227  $this,
228  'assignUsersToAppointment',
229  array()
230  );
231  $this->ctrl->saveParameter($this, 'apps');
232  $this->ctrl->setReturn($this, 'appointmentList');
233  $this->tabs->activateSubTab('cal_ch_app_list');
234  } elseif ($this->initAppointmentIdsFromQuery()) {
235  $rep_search->setCallback(
236  $this,
237  'assignUsersToAppointment',
238  array()
239  );
240  $this->ctrl->saveParameter($this, 'apps');
241  $this->ctrl->setReturn($this, 'appointmentList');
242  $this->tabs->activateSubTab('cal_ch_app_list');
243  }
244  $this->ctrl->forwardCommand($rep_search);
245  break;
246 
247  default:
248  $this->tpl->setTitle($this->lng->txt("cal_ch_form_header")); // #12220
249 
250  $this->setTabs();
251  if ($this->global_user->getId() != $this->user_id) {
252  $this->ctrl->setParameter($this, 'user_id', $this->user_id);
253  }
254  $cmd = $this->ctrl->getCmd('appointmentList');
255  $this->$cmd();
256  }
257  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
initSearchAssignmentToAppointments($a_default=false)
getProfileBackUrl()
Build context-sensitive profile back url.
+ Here is the call graph for this function:

◆ getProfileBackUrl()

ilConsultationHoursGUI::getProfileBackUrl ( )
protected

Build context-sensitive profile back url.

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

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

Referenced by executeCommand(), and showProfile().

1224  : string
1225  {
1226  // from repository
1227  if ($this->http->wrapper()->query()->has('ref_id')) {
1228  $url = $this->ctrl->getLinkTargetByClass('ilCalendarMonthGUI');
1229  } // from panel
1230  elseif ($this->http->wrapper()->query()->has('panel')) {
1231  $url = $this->ctrl->getLinkTargetByClass('ilCalendarPresentationGUI');
1232  } // from appointments
1233  else {
1234  $url = $this->ctrl->getLinkTarget($this, 'appointmentList');
1235  }
1236  return $url;
1237  }
static http()
Fetches the global http state from ILIAS.
$url
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getUserId()

ilConsultationHoursGUI::getUserId ( )

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

References $user_id.

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

259  : int
260  {
261  return $this->user_id;
262  }
+ Here is the caller graph for this function:

◆ groupList()

ilConsultationHoursGUI::groupList ( )
protected

Show consultation hour group.

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

References ILIAS\Repository\ctrl(), ilConsultationHourGroups\getGroupsOfUser(), getUserId(), ILIAS\Repository\help(), ILIAS\Repository\lng(), setSubTabs(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

400  : void
401  {
402  $this->help->setScreenId("consultation_hours");
403 
404  $this->toolbar->setFormAction($this->ctrl->getFormAction($this));
405  $this->toolbar->addButton($this->lng->txt('cal_ch_add_grp'), $this->ctrl->getLinkTarget($this, 'addGroup'));
406 
407  $this->setSubTabs();
408  $this->tabs->activateSubTab('cal_ch_app_grp');
409 
410  $gtbl = new ilConsultationHourGroupTableGUI($this, 'groupList', $this->getUserId());
412 
413  $this->tpl->setContent($gtbl->getHTML());
414  }
static getGroupsOfUser(int $a_user_id)
Get a all groups of an user.
+ Here is the call graph for this function:

◆ initAppointmentIdsFromPost()

ilConsultationHoursGUI::initAppointmentIdsFromPost ( )
protected

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

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

Referenced by assignUsersToAppointment(), confirmDelete(), delete(), edit(), executeCommand(), and searchUsersForAppointments().

122  : array
123  {
124  if ($this->http->wrapper()->post()->has('apps')) {
125  return $this->http->wrapper()->post()->retrieve(
126  'apps',
127  $this->refinery->kindlyTo()->dictOf(
128  $this->refinery->kindlyTo()->int()
129  )
130  );
131  }
132  return [];
133  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initAppointmentIdsFromPostString()

ilConsultationHoursGUI::initAppointmentIdsFromPostString ( )
protected

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

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

Referenced by edit(), and updateMulti().

135  : array
136  {
137  if ($this->http->wrapper()->post()->has('apps_string')) {
138  $app_string = $this->http->wrapper()->post()->retrieve(
139  'apps_string',
140  $this->refinery->kindlyTo()->string()
141  );
142  return array_map('intval', explode(';', $app_string));
143  }
144  return [];
145  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initAppointmentIdsFromQuery()

ilConsultationHoursGUI::initAppointmentIdsFromQuery ( )
protected

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

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

Referenced by assignUsersToAppointment(), confirmDelete(), edit(), executeCommand(), and searchUsersForAppointments().

114  : array
115  {
116  if ($this->http->wrapper()->query()->has('apps')) {
117  return [$this->http->wrapper()->query()->retrieve('apps', $this->refinery->kindlyTo()->int())];
118  }
119  return [];
120  }
static http()
Fetches the global http state from ILIAS.
+ 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 163 of file class.ilConsultationHoursGUI.php.

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

Referenced by assignUsersToAppointment(), confirmRejectBooking(), and rejectBooking().

163  : array
164  {
165  if ($this->http->wrapper()->post()->has('bookuser')) {
166  return $this->http->wrapper()->post()->retrieve(
167  'bookuser',
168  $this->refinery->kindlyTo()->dictOf(
169  $this->refinery->kindlyTo()->string()
170  )
171  );
172  }
173  return [];
174  }
static http()
Fetches the global http state from ILIAS.
+ 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 179 of file class.ilConsultationHoursGUI.php.

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

Referenced by confirmRejectBooking().

179  : array
180  {
181  if ($this->http->wrapper()->query()->has('bookuser')) {
182  return [
183  $this->http->wrapper()->query()->retrieve(
184  'bookuser',
185  $this->refinery->kindlyTo()->string()
186  )
187  ];
188  }
189  return [];
190  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initFormSequence()

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

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

References $form, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilCalendarRecurrence\FREQ_DAILY, ilCalendarRecurrence\FREQ_MONTHLY, ilCalendarRecurrence\FREQ_WEEKLY, ilConsultationHourGroups\getGroupSelectOptions(), getUserId(), ilYuiUtil\initDomEvent(), ILIAS\Repository\lng(), ilRecurrenceInputGUI\setEnabledSubForms(), ilFormPropertyGUI\setInfo(), ilTextAreaInputGUI\setRows(), ilDurationInputGUI\setShowMinutes(), ilDateTimeInputGUI\setShowTime(), and ilNumberInputGUI\setSize().

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

707  {
709 
710  $this->form = new ilPropertyFormGUI();
711  $this->form->setFormAction($this->ctrl->getFormAction($this));
712 
713  switch ($a_mode) {
714  case self::MODE_CREATE:
715  $this->form->setTitle($this->lng->txt('cal_ch_add_sequence'));
716  $this->form->addCommandButton('saveSequence', $this->lng->txt('save'));
717  $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
718  break;
719 
720  case self::MODE_MULTI:
721  $this->form->setTitle($this->lng->txt('cal_ch_multi_edit_sequence'));
722  $this->form->addCommandButton('updateMulti', $this->lng->txt('save'));
723  $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
724  break;
725  }
726 
727  // in case of existing groups show a selection
728  if (count($options = ilConsultationHourGroups::getGroupSelectOptions($this->getUserId()))) {
729  $group = new ilSelectInputGUI($this->lng->txt('cal_ch_grp_selection'), 'grp');
730  $group->setOptions($options);
731  $group->setRequired(false);
732  $this->form->addItem($group);
733  }
734 
735  // Title
736  $ti = new ilTextInputGUI($this->lng->txt('title'), 'ti');
737  $ti->setSize(32);
738  $ti->setMaxLength(128);
739  $ti->setRequired(true);
740  $this->form->addItem($ti);
741 
742  if ($a_mode != self::MODE_MULTI) {
743  // Start
744  $dur = new ilDateTimeInputGUI($this->lng->txt('cal_start'), 'st');
745  $dur->setShowTime(true);
746  $dur->setRequired(true);
747  $this->form->addItem($dur);
748 
749  // Duration
750  $du = new ilDurationInputGUI($this->lng->txt('cal_ch_duration'), 'du');
751  $du->setShowMinutes(true);
752  $du->setShowHours(true);
753  $this->form->addItem($du);
754 
755  // Number of appointments
756  $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_appointments'), 'ap');
757  $nu->setInfo($this->lng->txt('cal_ch_num_appointments_info'));
758  $nu->setSize(2);
759  $nu->setMaxLength(2);
760  $nu->setRequired(true);
761  $nu->setMinValue(1);
762  $this->form->addItem($nu);
763 
764  // Recurrence
765  $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
766  $rec->setEnabledSubForms(
767  array(
771  )
772  );
773  $this->form->addItem($rec);
774  }
775 
776  // Number of bookings
777  $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_bookings'), 'bo');
778  $nu->setSize(2);
779  $nu->setMaxLength(2);
780  $nu->setMinValue(1);
781  $nu->setRequired(true);
782  $this->form->addItem($nu);
783 
784  // Deadline
785  $dead = new ilDurationInputGUI($this->lng->txt('cal_ch_deadline'), 'dead');
786  $dead->setInfo($this->lng->txt('cal_ch_deadline_info'));
787  $dead->setShowMinutes(false);
788  $dead->setShowHours(true);
789  $dead->setShowDays(true);
790  $this->form->addItem($dead);
791 
792  // Location
793  $lo = new ilTextInputGUI($this->lng->txt('cal_where'), 'lo');
794  $lo->setSize(32);
795  $lo->setMaxLength(128);
796  $this->form->addItem($lo);
797 
798  // Description
799  $de = new ilTextAreaInputGUI($this->lng->txt('description'), 'de');
800  $de->setRows(10);
801  $de->setCols(60);
802  $this->form->addItem($de);
803 
804  // Target Object
805  $tgt = new ilTextInputGUI($this->lng->txt('cal_ch_target_object'), 'tgt');
806  $tgt->setInfo($this->lng->txt('cal_ch_target_object_info'));
807  $tgt->setSize(16);
808  $tgt->setMaxLength(128);
809  $this->form->addItem($tgt);
810  return $this->form;
811  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static initDomEvent(?ilGlobalTemplateInterface $a_main_tpl=null)
Init YUI DomEvent used in Services/Calendar, Modules/Session, Modules/Test (Jan 2022) ...
setShowTime(bool $a_showtime)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setEnabledSubForms(array $a_sub_forms)
set enabled subforms
This class represents a number property in a property form.
form( $class_path, string $cmd)
setShowMinutes(bool $a_showminutes)
This class represents a text area property in a property form.
static getGroupSelectOptions(int $a_user_id)
Get group selection options.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initGroupForm()

ilConsultationHoursGUI::initGroupForm ( int  $a_group_id = 0)
protected

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

References $form, $GLOBALS, ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ilFormGUI\setFormAction(), and ilPropertyFormGUI\setTitle().

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

529  {
530  $group = new ilConsultationHourGroup($a_group_id);
531 
532  $form = new ilPropertyFormGUI();
533  $form->setFormAction($GLOBALS['DIC']['ilCtrl']->getFormAction($this));
534 
535  if ($a_group_id) {
536  $form->setTitle($GLOBALS['DIC']['lng']->txt('cal_ch_grp_update_tbl'));
537  $form->addCommandButton('updateGroup', $GLOBALS['DIC']['lng']->txt('save'));
538  $form->addCommandButton('groupList', $GLOBALS['DIC']['lng']->txt('cancel'));
539  } else {
540  $form->setTitle($GLOBALS['DIC']['lng']->txt('cal_ch_grp_add_tbl'));
541  $form->addCommandButton('saveGroup', $GLOBALS['DIC']['lng']->txt('save'));
542  $form->addCommandButton('appointmentList', $GLOBALS['DIC']['lng']->txt('cancel'));
543  }
544 
545  $title = new ilTextInputGUI($GLOBALS['DIC']['lng']->txt('title'), 'title');
546  $title->setMaxLength(128);
547  $title->setSize(40);
548  $title->setRequired(true);
549  $title->setValue($group->getTitle());
550  $form->addItem($title);
551 
552  $multiple = new ilNumberInputGUI($GLOBALS['DIC']['lng']->txt('cal_ch_grp_multiple'), 'multiple');
553  $multiple->setRequired(true);
554  $multiple->setMinValue(1);
555  $multiple->setSize(1);
556  $multiple->setMaxLength(2);
557  $multiple->setInfo($GLOBALS['DIC']['lng']->txt('cal_ch_grp_multiple_info'));
558  $multiple->setValue((string) $group->getMaxAssignments());
559  $form->addItem($multiple);
560 
561  return $form;
562  }
setFormAction(string $a_formaction)
This class represents a number property in a property form.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
addCommandButton(string $a_cmd, string $a_text, string $a_id="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initGroupIdFromQuery()

ilConsultationHoursGUI::initGroupIdFromQuery ( )
protected

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

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

Referenced by assignUsersToGroup(), confirmDeleteGroup(), editGroup(), executeCommand(), and updateGroup().

103  : int
104  {
105  if ($this->http->wrapper()->query()->has('grp_id')) {
106  return $this->http->wrapper()->query()->retrieve(
107  'grp_id',
108  $this->refinery->kindlyTo()->int()
109  );
110  }
111  return 0;
112  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initGroupIdsFromPost()

ilConsultationHoursGUI::initGroupIdsFromPost ( )
protected

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

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

Referenced by deleteGroup().

147  : array
148  {
149  if ($this->http->wrapper()->post()->has('groups')) {
150  return $this->http->wrapper()->post()->retrieve(
151  'groups',
152  $this->refinery->kindlyTo()->listOf(
153  $this->refinery->kindlyTo()->int()
154  )
155  );
156  }
157  return [];
158  }
static http()
Fetches the global http state from ILIAS.
+ 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 91 of file class.ilConsultationHoursGUI.php.

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

Referenced by executeCommand().

91  : bool
92  {
93  $this->search_assignment_to_appointments = $a_default;
94  if ($this->http->wrapper()->query()->has('assignM')) {
95  $this->search_assignment_to_appointments = $this->http->wrapper()->query()->retrieve(
96  'assignM',
97  $this->refinery->kindlyTo()->bool()
98  );
99  }
101  }
static http()
Fetches the global http state from ILIAS.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initSettingsForm()

ilConsultationHoursGUI::initSettingsForm ( )
protected

build settings form

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

References $form, ilPropertyFormGUI\addCommandButton(), ilPropertyFormGUI\addItem(), ILIAS\Repository\ctrl(), ilConsultationHourAppointments\getManager(), ILIAS\Repository\lng(), ilFormGUI\setFormAction(), and ilPropertyFormGUI\setTitle().

Referenced by settings(), and updateSettings().

1255  {
1256  $form = new ilPropertyFormGUI();
1257  $form->setFormAction($this->ctrl->getFormAction($this));
1258 
1259  $mng = new ilTextInputGUI($this->lng->txt('cal_ch_manager'), 'mng');
1260  $mng->setInfo($this->lng->txt('cal_ch_manager_info'));
1261  $form->addItem($mng);
1262 
1263  $mng->setValue(ilConsultationHourAppointments::getManager(true));
1264 
1265  $form->setTitle($this->lng->txt('settings'));
1266  $form->addCommandButton('updateSettings', $this->lng->txt('save'));
1267  return $form;
1268  }
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="")
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rejectBooking()

ilConsultationHoursGUI::rejectBooking ( bool  $a_send_notification = true)
protected

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

References ilConsultationHourUtils\cancelBooking(), ILIAS\Repository\ctrl(), initBookingUsersFromPost(), and ILIAS\Repository\lng().

Referenced by deleteBooking().

650  : void
651  {
652  foreach ($this->initBookingUsersFromPost() as $bookuser) {
653  $ids = explode('_', $bookuser);
654  ilConsultationHourUtils::cancelBooking((int) $ids[1], (int) $ids[0], $a_send_notification);
655  }
656  if ($a_send_notification) {
657  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_ch_canceled_bookings'), true);
658  } else {
659  $this->tpl->setOnScreenMessage('success', $this->lng->txt('cal_ch_deleted_bookings'), true);
660  }
661  $this->ctrl->redirect($this, 'bookingList');
662  }
static cancelBooking(int $a_usr_id, int $a_app_id, bool $a_send_notification=true)
Cancel a booking.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rewriteBookingIdsForAppointments()

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

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

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

Referenced by updateMulti().

1069  : void {
1070  foreach ($appointments as $appointment_id) {
1071  $booking_appointment = new \ilCalendarEntry($appointment_id);
1072  $booking_start = $booking_appointment->getStart();
1073  $booking_end = $booking_appointment->getEnd();
1074 
1075  $deprecatedBooking = \ilBookingEntry::getInstanceByCalendarEntryId($appointment_id);
1076  if (!$deprecatedBooking instanceof \ilBookingEntry) {
1077  // @todo error handling
1078  continue;
1079  }
1080 
1082  $deprecatedBooking,
1083  $booking_start,
1084  $booking_end
1085  );
1086  foreach ($relevant_appointments as $relevant_appointment_id) {
1087  $entry = new \ilCalendarEntry($relevant_appointment_id);
1088  $entry->setContextId($booking->getId());
1089  $entry->setTitle($form->getInput('ti'));
1090  $entry->setLocation($form->getInput('lo'));
1091  $entry->setDescription($form->getInput('de'));
1092  $entry->update();
1093  }
1094  }
1095  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
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-...
static getInstanceByCalendarEntryId(int $a_id)
Get instance by calendar entry.
static findCalendarAppointmentsForBooking(ilBookingEntry $booking, ilDateTime $start, ilDateTime $end)
+ 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 433 of file class.ilConsultationHoursGUI.php.

References $GLOBALS, addGroup(), ilPropertyFormGUI\checkInput(), ilPropertyFormGUI\getInput(), getUserId(), and initGroupForm().

433  : void
434  {
435  $form = $this->initGroupForm();
436  if ($form->checkInput()) {
437  $group = new ilConsultationHourGroup();
438  $group->setTitle($form->getInput('title'));
439  $group->setMaxAssignments((int) $form->getInput('multiple'));
440  $group->setUserId($this->getUserId());
441  $group->save();
442 
443  $this->tpl->setOnScreenMessage('success', $GLOBALS['DIC']['lng']->txt('settings_saved'), true);
444  $GLOBALS['DIC']['ilCtrl']->redirect($this, 'groupList');
445  }
446 
447  $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']['lng']->txt('err_check_input'), true);
448  $this->addGroup($form);
449  }
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-...
addGroup(?ilPropertyFormGUI $form=null)
Show add group form.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

◆ saveSequence()

ilConsultationHoursGUI::saveSequence ( )
protected

Save new sequence.

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

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

816  : void
817  {
818  $this->initFormSequence(self::MODE_CREATE);
819 
820  if ($this->form->checkInput()) {
821  $this->form->setValuesByPost();
822 
823  $booking = new ilBookingEntry();
824  $booking->setObjId($this->getUserId());
825  $booking->setNumberOfBookings((int) $this->form->getInput('bo'));
826 
827  $deadline = $this->form->getInput('dead');
828  $deadline = $deadline['dd'] * 24 + $deadline['hh'];
829  $booking->setDeadlineHours($deadline);
830 
831  // consultation hour group
833  $booking->setBookingGroup((int) $this->form->getInput('grp'));
834  }
835 
836  $tgt = array_map('intval', explode(',', $this->form->getInput('tgt')));
837  $obj_ids = array();
838  foreach ($tgt as $ref_id) {
839  if ($ref_id === 0) {
840  continue;
841  }
842  $obj_id = ilObject::_lookupObjId($ref_id);
843  $type = ilObject::_lookupType($obj_id);
844  $valid_types = array('crs', 'grp');
845  if (!$obj_id or !in_array($type, $valid_types)) {
846  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cal_ch_unknown_repository_object'));
847  $this->tpl->setContent($this->form->getHTML());
848  return;
849  }
850 
851  $obj_ids[] = $obj_id;
852  }
853  $booking->setTargetObjIds($obj_ids);
854  $booking->save();
856  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
857  $this->ctrl->redirect($this, 'appointmentList');
858  } else {
859  $this->form->setValuesByPost();
860  $this->tpl->setContent($this->form->getHTML());
861  }
862  }
$type
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getGroupsOfUser(int $a_user_id)
Get a all groups of an user.
static _lookupObjId(int $ref_id)
createAppointments(ilBookingEntry $booking)
Create calendar appointments.
$ref_id
Definition: ltiauth.php:67
setDeadlineHours(int $a_hours)
form( $class_path, string $cmd)
setNumberOfBookings(int $a_num)
static _lookupType(int $id, bool $reference=false)
setTargetObjIds(?array $a_obj_id)
+ Here is the call graph for this function:

◆ searchUsersForAppointments()

ilConsultationHoursGUI::searchUsersForAppointments ( )
protected

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

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

264  : void
265  {
266  $apps = [];
267  if ($this->initAppointmentIdsFromPost() !== []) {
268  $apps = $this->initAppointmentIdsFromPost();
269  } elseif ($this->initAppointmentIdsFromQuery() !== []) {
270  $apps = $this->initAppointmentIdsFromQuery();
271  }
272 
273  if ($apps === []) {
274  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('select_one'), true);
275  $this->ctrl->redirect($this, 'appointmentList');
276  }
277  ilSession::set('ch_apps', $apps);
278  $this->ctrl->setParameterByClass(ilConsultationHoursGUI::class, 'assignM', 1);
279  $this->ctrl->redirectByClass(ilRepositorySearchGUI::class, '');
280  }
static set(string $a_var, $a_val)
Set a value.
+ 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 286 of file class.ilConsultationHoursGUI.php.

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

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

286  : bool
287  {
288  if (!$unassigned) {
289  return true;
290  }
291  $users = array();
292  foreach ($unassigned as $user_id) {
293  $users[] = ilObjUser::_lookupFullname($user_id);
294  }
295  $this->tpl->setOnScreenMessage('info', $this->lng->txt('cal_ch_user_assignment_failed_info') .
296  '<br />' . implode('<br />', $users), true);
297  return true;
298  }
static _lookupFullname(int $a_user_id)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubTabs()

ilConsultationHoursGUI::setSubTabs ( )
protected

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

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

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

957  : void
958  {
959  $this->ctrl->setParameter($this, 'user_id', $this->getUserId());
960  $this->tabs->addSubTab(
961  'cal_ch_app_list',
962  $this->lng->txt('cal_ch_app_list'),
963  $this->ctrl->getLinkTarget($this, 'appointmentList')
964  );
965  $this->tabs->addSubTab(
966  'cal_ch_app_grp',
967  $this->lng->txt('cal_ch_app_grp'),
968  $this->ctrl->getLinkTarget($this, 'groupList')
969  );
970  $this->tabs->addSubTab(
971  'cal_ch_app_bookings',
972  $this->lng->txt('cal_ch_app_bookings'),
973  $this->ctrl->getLinkTarget($this, 'bookingList')
974  );
975  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setTabs()

ilConsultationHoursGUI::setTabs ( )
protected

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

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

Referenced by executeCommand().

935  : void
936  {
937  $this->ctrl->setParameter($this, 'user_id', '');
938  $this->tabs->addTab(
939  'consultation_hours_' . $this->user_id,
940  $this->lng->txt('cal_ch_ch'),
941  $this->ctrl->getLinkTarget($this, 'appointmentList')
942  );
943 
945  $this->ctrl->setParameter($this, 'user_id', $user_id);
946  $this->tabs->addTab(
947  'consultation_hours_' . $user_id,
948  $this->lng->txt('cal_ch_ch') . ': ' . $login,
949  $this->ctrl->getLinkTarget($this, 'appointmentList')
950  );
951  }
952  $this->ctrl->setParameter($this, 'user_id', '');
953  $this->tabs->addTab('ch_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'settings'));
954  $this->tabs->activateTab('consultation_hours_' . $this->getUserId());
955  }
static getManagedUsers()
Get all managed consultation hours users for current users.
+ 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 1242 of file class.ilConsultationHoursGUI.php.

References ilPropertyFormGUI\getHTML(), ILIAS\Repository\help(), initSettingsForm(), and ILIAS\Repository\tabs().

1242  : void
1243  {
1244  $this->help->setScreenId("consultation_hours_settings");
1245  $this->tabs->activateTab('ch_settings');
1246 
1247  $form = $this->initSettingsForm();
1248  $this->tpl->setContent($form->getHTML());
1249  }
+ Here is the call graph for this function:

◆ showProfile()

ilConsultationHoursGUI::showProfile ( )

show public profile of given user

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

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

1205  : void
1206  {
1207  $this->tabs->clearTargets();
1208 
1209  $user_id = 0;
1210  if ($this->http->wrapper()->query()->has('user')) {
1211  $user_id = $this->http->wrapper()->query()->retrieve(
1212  'user',
1213  $this->refinery->kindlyTo()->int()
1214  );
1215  }
1216  $profile = new ilPublicUserProfileGUI($user_id);
1217  $profile->setBackUrl($this->getProfileBackUrl());
1218  $this->tpl->setContent($this->ctrl->getHTML($profile));
1219  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static http()
Fetches the global http state from ILIAS.
getProfileBackUrl()
Build context-sensitive profile back url.
+ Here is the call graph for this function:

◆ updateGroup()

ilConsultationHoursGUI::updateGroup ( )
protected

Update group.

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

References $GLOBALS, ilPropertyFormGUI\checkInput(), ILIAS\Repository\ctrl(), editGroup(), ilPropertyFormGUI\getInput(), getUserId(), initGroupForm(), initGroupIdFromQuery(), and ILIAS\Repository\lng().

469  : void
470  {
471  $group_id = $this->initGroupIdFromQuery();
472  $this->ctrl->setParameter($this, 'grp_id', $group_id);
473 
474  $form = $this->initGroupForm($group_id);
475  if ($form->checkInput()) {
476  $group = new ilConsultationHourGroup($group_id);
477  $group->setTitle($form->getInput('title'));
478  $group->setMaxAssignments((int) $form->getInput('multiple'));
479  $group->setUserId($this->getUserId());
480  $group->update();
481 
482  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
483  $this->ctrl->redirect($this, 'groupList');
484  }
485 
486  $this->tpl->setOnScreenMessage('failure', $GLOBALS['DIC']['lng']->txt('err_check_input'), true);
487  $this->editGroup($form);
488  }
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-...
editGroup(?ilPropertyFormGUI $form=null)
Edit group.
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
+ Here is the call graph for this function:

◆ updateMulti()

ilConsultationHoursGUI::updateMulti ( )
protected

Update multiple sequence items.

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

References createNewBookingEntry(), ILIAS\Repository\ctrl(), edit(), ILIAS\Repository\form(), initAppointmentIdsFromPostString(), initFormSequence(), ILIAS\Repository\lng(), ilBookingEntry\removeObsoleteEntries(), and rewriteBookingIdsForAppointments().

1100  : void
1101  {
1102  $this->initFormSequence(self::MODE_MULTI);
1103  if (!$this->form->checkInput()) {
1104  $this->form->setValuesByPost();
1105  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
1106  $this->edit();
1107  return;
1108  }
1109 
1110  $this->form->setValuesByPost();
1111  $apps = $this->initAppointmentIdsFromPostString();
1112 
1113  // create new booking
1114  $booking = $this->createNewBookingEntry($this->form);
1115  if (!$booking instanceof \ilBookingEntry) {
1116  $this->edit();
1117  return;
1118  }
1119  $this->rewriteBookingIdsForAppointments($booking, $apps, $this->form);
1121 
1122  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1123  $this->ctrl->redirect($this, 'appointmentList');
1124  $this->tpl->setContent($this->form->getHTML());
1125  }
rewriteBookingIdsForAppointments(ilBookingEntry $booking, array $appointments, ilPropertyFormGUI $form)
edit()
Edit multiple sequence items.
static removeObsoleteEntries()
Remove unused booking entries.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
createNewBookingEntry(ilPropertyFormGUI $validate_form)
form( $class_path, string $cmd)
+ Here is the call graph for this function:

◆ updateSettings()

ilConsultationHoursGUI::updateSettings ( )

save settings

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

References ilPropertyFormGUI\checkInput(), ILIAS\Repository\ctrl(), ilPropertyFormGUI\getHTML(), ilPropertyFormGUI\getInput(), ilPropertyFormGUI\getItemByPostVar(), initSettingsForm(), ILIAS\Repository\lng(), ilConsultationHourAppointments\setManager(), and ILIAS\Repository\tabs().

1273  : void
1274  {
1275  $form = $this->initSettingsForm();
1276  if ($form->checkInput()) {
1277  $mng = $form->getInput('mng');
1279  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
1280  $this->ctrl->redirect($this, 'settings');
1281  } else {
1282  $this->tabs->activateTab('ch_settings');
1283 
1284  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('cal_ch_unknown_user'));
1285  $field = $form->getItemByPostVar('mng');
1286  $field->setValue($mng);
1287  $this->tpl->setContent($form->getHTML());
1288  return;
1289  }
1290  }
1291  }
getItemByPostVar(string $a_post_var)
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-...
static setManager(string $a_user_name)
Set consultation hour manager for current user.
+ Here is the call graph for this function:

Field Documentation

◆ $booking

ilBookingEntry ilConsultationHoursGUI::$booking = null
private

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

Referenced by createNewBookingEntry().

◆ $ctrl

ilCtrlInterface ilConsultationHoursGUI::$ctrl
protected

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

◆ $form

ilPropertyFormGUI ilConsultationHoursGUI::$form = null
private

◆ $global_user

ilObjUser ilConsultationHoursGUI::$global_user
protected

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

◆ $help

ilHelpGUI ilConsultationHoursGUI::$help
protected

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

◆ $http

HttpServices ilConsultationHoursGUI::$http
protected

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

◆ $lng

ilLanguage ilConsultationHoursGUI::$lng
protected

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

◆ $refinery

RefineryFactory ilConsultationHoursGUI::$refinery
protected

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

◆ $search_assignment_to_appointments

bool ilConsultationHoursGUI::$search_assignment_to_appointments = false
private

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

Referenced by initSearchAssignmentToAppointments().

◆ $tabs

ilTabsGUI ilConsultationHoursGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilConsultationHoursGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilConsultationHoursGUI::$tpl
protected

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

◆ $user_id

int ilConsultationHoursGUI::$user_id
private

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

Referenced by __construct(), delete(), executeCommand(), and getUserId().

◆ MAX_APPOINTMENTS_PER_SEQUENCE

const ilConsultationHoursGUI::MAX_APPOINTMENTS_PER_SEQUENCE = 1000
protected

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

◆ MODE_CREATE

const ilConsultationHoursGUI::MODE_CREATE = 1
protected

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

◆ MODE_MULTI

const ilConsultationHoursGUI::MODE_MULTI = 3
protected

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

◆ MODE_UPDATE

const ilConsultationHoursGUI::MODE_UPDATE = 2
protected

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


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