ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilConsultationHoursGUI Class Reference

Consultation hours editor. More...

+ Collaboration diagram for ilConsultationHoursGUI:

Public Member Functions

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

Data Fields

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

Protected Member Functions

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

Protected Attributes

 $user_id
 
 $ctrl
 
 $booking = null
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilConsultationHoursGUI::__construct ( )

Constructor.

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

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

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

+ Here is the call graph for this function:

Member Function Documentation

◆ addGroup()

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

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

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

322 {
323 global $ilTabs, $tpl;
324
325 $this->setSubTabs();
326 $ilTabs->activateSubTab('cal_ch_app_grp');
327
328 if ($form == null) {
329 $form = $this->initGroupForm();
330 }
331 $tpl->setContent($form->getHTML());
332 }
initGroupForm($a_group_id=0)
Init new/update group form.
setSubTabs()
Set sub tabs @global type $ilTabs @global type $ilCtrl.
if(isset($_POST['submit'])) $form

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

Referenced by saveGroup().

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

◆ appointmentList()

ilConsultationHoursGUI::appointmentList ( )
protected

Show settings of consultation hours.

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

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

603 {
604 global $ilToolbar, $ilHelp, $ilTabs;
605
606 $ilHelp->setScreenId("consultation_hours");
607
608 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
609 $ilToolbar->addButton($this->lng->txt('cal_ch_add_sequence'), $this->ctrl->getLinkTarget($this, 'createSequence'));
610
611 $this->setSubTabs();
612 $ilTabs->activateSubTab('cal_ch_app_list');
613
614 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursTableGUI.php';
615 $tbl = new ilConsultationHoursTableGUI($this, 'appointmentList', $this->getUserId());
616 $tbl->parse();
617 $this->tpl->setContent($tbl->getHTML());
618 }
Consultation hours administration.
$tbl
Definition: example_048.php:81

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

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

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

◆ assignUsersToAppointment()

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

Assign users to an appointment.

Parameters
array$usr_ids
Returns
array $unassigned_users

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

211 {
212 global $ilCtrl;
213
214 if ($a_app) {
215 $app = $a_app;
216 } else {
217 $app = $_REQUEST['apps'];
218 }
219
220 if (!count($users)) {
221 ilUtil::sendFailure($GLOBALS['DIC']->language()->txt('select_one'), true);
222 return false;
223 }
224
225
226 include_once './Services/Booking/classes/class.ilBookingEntry.php';
228
229 $assigned_users = array();
230 foreach ($users as $user) {
231 if ($booking->getCurrentNumberOfBookings($app) >= $booking->getNumberOfBookings()) {
232 break;
233 }
234 if (!ilBookingEntry::lookupBookingsOfUser((array) $app, $user)) {
235 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
237 $assigned_users[] = $user;
238 }
239 }
240
241 $unassigned_users = array_diff($users, $assigned_users);
242
243 if ($a_redirect) {
244 $this->sendInfoAboutUnassignedUsers($unassigned_users);
245 $ilCtrl->redirect($this, 'appointmentList');
246 } else {
247 return $unassigned_users;
248 }
249 }
$users
Definition: authpage.php:44
static lookupBookingsOfUser($a_app_ids, $a_usr_id, ilDateTime $start=null)
Lookup bookings if user.
static getInstanceByCalendarEntryId($a_id)
Get instance by calendar entry.
static bookAppointment($a_usr_id, $a_app_id)
Book an appointment.
sendInfoAboutUnassignedUsers($unassigned)
Send info message about unassigned users.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

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

Referenced by assignUsersToAppointments().

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

◆ assignUsersToAppointments()

ilConsultationHoursGUI::assignUsersToAppointments ( array  $users)

Assign users to multiple appointments.

Parameters
type$users

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

192 {
193 global $ilCtrl;
194
195 $unassigned_users = array();
196 foreach ($_SESSION['ch_apps'] as $app) {
197 $unassigned_users = array_unique(array_merge($unassigned_users, $this->assignUsersToAppointment($users, $app, false)));
198 }
199
200 $this->sendInfoAboutUnassignedUsers($unassigned_users);
201 $ilCtrl->redirect($this, 'appointmentList');
202 }
$_SESSION["AccountId"]
assignUsersToAppointment(array $users, $a_app=0, $a_redirect=true)
Assign users to an appointment.

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

+ Here is the call graph for this function:

◆ assignUsersToGroup()

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

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

257 {
258 global $ilCtrl;
259
260 $group_id = (int) $_REQUEST['grp_id'];
261
262 $tomorrow = new ilDateTime(time(), IL_CAL_UNIX);
263 $tomorrow->increment(IL_CAL_DAY, 1);
264
265 // Get all future consultation hours
266 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
267 include_once './Services/Booking/classes/class.ilBookingEntry.php';
269 $this->user_id,
270 $group_id,
271 $tomorrow
272 );
273 $users = $usr_ids;
274 $assigned_users = array();
275 foreach ($apps as $app) {
277 foreach ($users as $user) {
278 if ($booking->getCurrentNumberOfBookings($app) >= $booking->getNumberOfBookings()) {
279 break;
280 }
281 if (!ilBookingEntry::lookupBookingsOfUser($apps, $user)) {
282 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
284 $assigned_users[] = $user;
285 }
286 }
287 }
288
289 $this->sendInfoAboutUnassignedUsers(array_diff($users, $assigned_users));
290 $ilCtrl->redirect($this, 'bookingList');
291 }
const IL_CAL_UNIX
const IL_CAL_DAY
static getAppointmentIdsByGroup($a_user_id, $a_ch_group_id, ilDateTime $start=null)
Get appointment ids by consultation hour group.
@classDescription Date and time handling

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

+ Here is the call graph for this function:

◆ bookingList()

ilConsultationHoursGUI::bookingList ( )
protected

Show list of bookings.

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

497 {
498 global $ilToolbar, $ilTabs, $tpl;
499
500 $this->setSubTabs();
501 $ilTabs->activateSubTab('cal_ch_app_bookings');
502
503 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourBookingTableGUI.php';
504 $btable = new ilConsultationHourBookingTableGUI($this, 'bookingList', $this->getUserId());
506 $tpl->setContent($btable->getHTML());
507 }
static getAppointmentIds($a_user_id, $a_context_id=null, $a_start=null, $a_type=null, $a_check_owner=true)
Get all appointment ids.

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

+ Here is the call graph for this function:

◆ confirmDelete()

ilConsultationHoursGUI::confirmDelete ( )

confirm delete for multiple entries

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

1102 {
1103 global $tpl;
1104
1105 if (!isset($_REQUEST['apps'])) {
1106 ilUtil::sendFailure($this->lng->txt('select_one'));
1107 return $this->appointmentList();
1108 }
1109
1110 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
1111
1112
1113 $this->ctrl->saveParameter($this, array('seed','app_id','dt'));
1114
1115 $confirm = new ilConfirmationGUI();
1116 $confirm->setFormAction($this->ctrl->getFormAction($this));
1117 $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
1118 $confirm->setCancel($this->lng->txt('cancel'), 'cancel');
1119
1120 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1121
1122 $bookings_available = array();
1123 foreach ((array) $_REQUEST['apps'] as $entry_id) {
1124 $entry = new ilCalendarEntry($entry_id);
1125 $confirm->addItem('apps[]', $entry_id, ilDatePresentation::formatDate($entry->getStart()) . ', ' . $entry->getTitle());
1126
1127 include_once './Services/Booking/classes/class.ilBookingEntry.php';
1129 $bookings_available[] = ilDatePresentation::formatDate($entry->getStart()) . ', ' . $entry->getTitle();
1130 }
1131 }
1132
1133 if ($bookings_available) {
1134 ilUtil::sendInfo($this->lng->txt('cal_ch_delete_app_booking_info') . '<br />' . implode('<br />', $bookings_available));
1135 }
1136
1137 $confirm->setConfirm($this->lng->txt('delete'), 'delete');
1138 $confirm->setCancel($this->lng->txt('cancel'), 'appointmentList');
1139
1140 $tpl->setContent($confirm->getHTML());
1141 }
static lookupBookingsForAppointment($a_app_id)
Lookup booked users for appointment @global type $ilDB.
Model for a calendar entry.
Confirmation screen class.
appointmentList()
Show settings of consultation hours.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date @access public.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

+ Here is the call graph for this function:

◆ confirmDeleteBooking()

ilConsultationHoursGUI::confirmDeleteBooking ( )
protected

Show delete booking confirmation.

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

513 {
514 $this->confirmRejectBooking(false);
515 }
confirmRejectBooking($a_send_notification=true)
Show delete booking confirmation.

References confirmRejectBooking().

+ Here is the call graph for this function:

◆ confirmDeleteGroup()

ilConsultationHoursGUI::confirmDeleteGroup ( )
protected

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

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

410 {
411 global $ilCtrl, $ilTabs, $tpl;
412
413 $ilCtrl->setParameter($this, 'grp_id', (int) $_REQUEST['grp_id']);
414 $groups = array((int) $_REQUEST['grp_id']);
415
416 $this->setSubTabs();
417 $ilTabs->activateSubTab('cal_ch_app_grp');
418
419
420 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
421 $confirm = new ilConfirmationGUI();
422 $confirm->setFormAction($ilCtrl->getFormAction($this));
423 $confirm->setHeaderText($GLOBALS['lng']->txt('cal_ch_grp_delete_sure'));
424 $confirm->setConfirm($GLOBALS['lng']->txt('delete'), 'deleteGroup');
425 $confirm->setCancel($GLOBALS['lng']->txt('cancel'), 'groupList');
426
427 foreach ($groups as $grp_id) {
428 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
429 $group = new ilConsultationHourGroup($grp_id);
430
431 $confirm->addItem('groups[]', $grp_id, $group->getTitle());
432 }
433 $tpl->setContent($confirm->getHTML());
434 }

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

+ Here is the call graph for this function:

◆ confirmRejectBooking()

ilConsultationHoursGUI::confirmRejectBooking (   $a_send_notification = true)
protected

Show delete booking confirmation.

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

521 {
522 global $ilTabs, $tpl;
523
524 $this->setSubTabs();
525 $ilTabs->activateSubTab('cal_ch_app_bookings');
526
527 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
528
529 $confirm = new ilConfirmationGUI();
530 $confirm->setFormAction($this->ctrl->getFormAction($this));
531
532 if ($a_send_notification) {
533 ilUtil::sendInfo($this->lng->txt('cal_ch_cancel_booking_info'));
534 $confirm->setHeaderText($this->lng->txt('cal_ch_cancel_booking_sure'));
535 $confirm->setConfirm($this->lng->txt('cal_ch_reject_booking'), 'rejectBooking');
536 } else {
537 ilUtil::sendInfo($this->lng->txt('cal_ch_delete_booking_info'));
538 $confirm->setHeaderText($this->lng->txt('cal_ch_delete_booking_sure'));
539 $confirm->setConfirm($this->lng->txt('cal_ch_delete_booking'), 'deleteBooking');
540 }
541
542 $confirm->setCancel($this->lng->txt('cancel'), 'bookingList');
543
544 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
545 foreach ((array) $_REQUEST['bookuser'] as $bookuser) {
546 $ids = explode('_', $bookuser);
547
548 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
549 include_once './Services/User/classes/class.ilUserUtil.php';
550 $entry = new ilCalendarEntry($ids[0]);
551 $confirm->addItem(
552 'bookuser[]',
553 $bookuser,
555 $ids[1],
556 true,
557 false,
558 '',
559 true,
560 true
561 ) . ', ' . ilDatePresentation::formatDate($entry->getStart())
562 );
563 }
564 $tpl->setContent($confirm->getHTML());
565 }
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:

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

Referenced by confirmDeleteBooking().

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

◆ createAppointments()

ilConsultationHoursGUI::createAppointments ( ilBookingEntry  $booking)
protected

Create calendar appointments.

Parameters
ilBookingEntry$booking
Returns

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

827 {
828 include_once './Services/Calendar/classes/class.ilDateList.php';
829 $concurrent_dates = new ilDateList(ilDateList::TYPE_DATETIME);
830 $start = clone $this->form->getItemByPostVar('st')->getDate();
831 for ($i = 0; $i < $this->form->getItemByPostVar('ap')->getValue(); $i++) {
832 $concurrent_dates->add(clone $start);
833
834 $start->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
835 $start->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
836 #$start = new ilDateTime(,IL_CAL_UNIX);
837 }
838
839 include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
840 $def_cat = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_CH, $this->getUserId(), $this->lng->txt('cal_ch_personal_ch'), true);
841
842 // Add calendar appointment for each
843 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
844 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
845 include_once './Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
846 include_once './Services/Booking/classes/class.ilBookingPeriod.php';
847
848 $num_appointments = 0;
849 foreach ($concurrent_dates as $dt) {
850 if ($num_appointments >= self::MAX_APPOINTMENTS_PER_SEQUENCE) {
851 break;
852 }
853
854 $end = clone $dt;
855 $end->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
856 $end->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
857
859 new ilBookingPeriod($dt, $end),
860 $this->form->getItemByPostVar('frequence')->getRecurrence()
861 );
862
863 // Calculate with one year limit
864 $limit = clone $dt;
865 $limit->increment(ilDateTime::YEAR, 1);
866
867 $date_list = $calc->calculateDateList($dt, $limit);
868
869 $num = 0;
870 foreach ($date_list as $app_start) {
871 $app_end = clone $app_start;
872 $app_end->increment(ilDateTime::MINUTE, $this->form->getItemByPostVar('du')->getMinutes());
873 $app_end->increment(ilDateTime::HOUR, $this->form->getItemByPostVar('du')->getHours());
874
875
876 $entry = new ilCalendarEntry();
877 $entry->setContextId($booking->getId());
878 $entry->setTitle($this->form->getInput('ti'));
879 $entry->setSubtitle("#consultationhour#"); // dynamic, see ilCalendarEntry
880 $entry->setDescription($this->form->getInput('de'));
881 $entry->setLocation($this->form->getInput('lo'));
882 $entry->setStart($app_start);
883 $entry->setEnd($app_end);
884
885 $entry->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
886 $entry->save();
887
888 $cat_assign = new ilCalendarCategoryAssignments($entry->getEntryId());
889 $cat_assign->addAssignment($def_cat->getCategoryID());
890
891 $num_appointments++;
892 }
893 }
894 }
const IL_CAL_TRANSLATION_SYSTEM
Booking period Used for calculation of recurring events.
Calculates an ilDateList for a given calendar entry and recurrence rule.
static initDefaultCalendarByType($a_type_id, $a_usr_id, $a_title, $a_create=false)
Init the default calendar for given type and user.
List of dates.
$i
Definition: disco.tpl.php:19
$end
Definition: saml1-acs.php:18

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

Referenced by saveSequence().

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

◆ createNewBookingEntry()

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

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

992 {
993 global $DIC;
994
995 $obj_cache = $DIC['ilObjDataCache'];
996
997 $booking = new \ilBookingEntry();
998 $booking->setObjId($this->user_id);
999 $booking->setNumberOfBookings((int) $this->form->getInput('bo'));
1000
1001 $deadline = $this->form->getInput('dead');
1002 $deadline = $deadline['dd'] * 24 + $deadline['hh'];
1003 $booking->setDeadlineHours($deadline);
1004
1005 $tgt = explode(',', (string) $this->form->getInput('tgt'));
1006 $obj_ids = [];
1007 foreach ((array) $tgt as $ref_id) {
1008 if (!trim($ref_id)) {
1009 continue;
1010 }
1011 $obj_id = $obj_cache->lookupObjId($ref_id);
1012 $type = ilObject::_lookupType($obj_id);
1013 $valid_types = ['crs', 'grp'];
1014 if (!$obj_id or !in_array($type, $valid_types)) {
1015 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_repository_object'));
1016 return null;
1017 }
1018 $obj_ids[] = $obj_id;
1019 }
1020 $booking->setTargetObjIds($obj_ids);
1021
1023 $booking->setBookingGroup($this->form->getInput('grp'));
1024 }
1025 $booking->save();
1026 return $booking;
1027 }
static getCountGroupsOfUser($a_user_id)
Get number of consultation hour groups @global type $ilDB.
static _lookupType($a_id, $a_reference=false)
lookup object type
$type
global $DIC
Definition: saml.php:7

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

Referenced by updateMulti().

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

◆ createSequence()

ilConsultationHoursGUI::createSequence ( )
protected

Create new sequence.

Returns

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

625 {
626 $this->initFormSequence(self::MODE_CREATE);
627
628 $this->booking = new ilBookingEntry();
629 $this->form->getItemByPostVar('bo')->setValue($this->booking->getNumberOfBookings());
630 $this->form->getItemByPostVar('ap')->setValue(1);
631 $this->form->getItemByPostVar('du')->setMinutes(15);
632 $this->form->getItemByPostVar('st')->setDate(
633 new ilDateTime(mktime(8, 0, 0, date('n', time()), date('d', time()), date('Y', time())), IL_CAL_UNIX)
634 );
635
636 $this->tpl->setContent($this->form->getHTML());
637 }
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
Booking definition.

References date, IL_CAL_UNIX, and initFormSequence().

+ Here is the call graph for this function:

◆ delete()

ilConsultationHoursGUI::delete ( )

delete multiple entries

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

1147 {
1148 if (!isset($_POST['apps'])) {
1149 ilUtil::sendFailure($this->lng->txt('select_one'));
1150 return $this->appointmentList();
1151 }
1152
1153 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1154 include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1155 foreach ($_POST['apps'] as $entry_id) {
1156 // cancel booking for users
1158 if ($booking) {
1159 foreach ($booking->getCurrentBookings($entry_id) as $user_id) {
1160 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1162 }
1163 }
1164 // remove calendar entries
1165 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1166 $entry = new ilCalendarEntry($entry_id);
1167 $entry->delete();
1168
1170 }
1171
1173
1174 ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
1175 $this->ctrl->redirect($this, 'appointmentList');
1176 }
$_POST["username"]
static removeObsoleteEntries()
Remove unused booking entries.
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
static cancelBooking($a_usr_id, $a_app_id, $a_send_notification=true)
Cancel a booking.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ deleteBooking()

ilConsultationHoursGUI::deleteBooking ( )
protected

Delete booking.

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

571 {
572 $this->rejectBooking(false);
573 }
rejectBooking($a_send_notification=true)

References rejectBooking().

+ Here is the call graph for this function:

◆ deleteGroup()

ilConsultationHoursGUI::deleteGroup ( )
protected

Delete groups.

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

440 {
441 global $ilCtrl;
442
443 foreach ((array) $_REQUEST['groups'] as $grp_id) {
444 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
445 $group = new ilConsultationHourGroup($grp_id);
446 $group->delete();
447 }
448 ilUtil::sendSuccess($GLOBALS['lng']->txt('cal_ch_grp_deleted'));
449 $ilCtrl->redirect($this, 'groupList');
450 }

References $GLOBALS, $ilCtrl, and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ edit()

ilConsultationHoursGUI::edit ( )

Edit multiple sequence items.

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

937 {
938 global $ilTabs;
939
940 if (!isset($_REQUEST['apps'])) {
941 ilUtil::sendFailure($this->lng->txt('select_one'));
942 return $this->appointmentList();
943 }
944
945 $this->initFormSequence(self::MODE_MULTI);
946
947 if ($_REQUEST['apps'] && !is_array($_REQUEST['apps'])) {
948 $_REQUEST['apps'] = explode(';', $_REQUEST['apps']);
949 }
950
951 $hidden = new ilHiddenInputGUI('apps');
952 $hidden->setValue(implode(';', $_REQUEST['apps']));
953 $this->form->addItem($hidden);
954
955 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
956 $first = $_REQUEST['apps'];
957 $first = array_shift($_REQUEST['apps']);
958 $entry = new ilCalendarEntry($first);
959
960 $this->form->getItemByPostVar('ti')->setValue($entry->getTitle());
961 $this->form->getItemByPostVar('lo')->setValue($entry->getLocation());
962 $this->form->getItemByPostVar('de')->setValue($entry->getDescription());
963
964 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
965 $booking = new ilBookingEntry($entry->getContextId());
966
967 $this->form->getItemByPostVar('bo')->setValue($booking->getNumberOfBookings());
968
969 $ref_ids = array();
970 foreach ($booking->getTargetObjIds() as $obj_id) {
971 $refs = ilObject::_getAllReferences($obj_id);
972 $ref_ids[] = end($refs);
973 }
974 $this->form->getItemByPostVar('tgt')->setValue(implode(',', $ref_ids));
975
976 $deadline = $booking->getDeadlineHours();
977 $this->form->getItemByPostVar('dead')->setDays(floor($deadline/24));
978 $this->form->getItemByPostVar('dead')->setHours($deadline%24);
979
980 if ($booking->getBookingGroup()) {
981 $this->form->getItemByPostVar('grp')->setValue($booking->getBookingGroup());
982 }
983
984 $this->tpl->setContent($this->form->getHTML());
985 }
This class represents a hidden form property in a property form.
static _getAllReferences($a_id)
get all reference ids of object

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

Referenced by updateMulti().

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

◆ editGroup()

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

Edit group @global type $ilCtrl.

Parameters
ilPropertyFormGUI$form

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

362 {
363 global $ilCtrl, $tpl, $ilTabs;
364
365 $ilCtrl->setParameter($this, 'grp_id', (int) $_REQUEST['grp_id']);
366 $this->setSubTabs();
367 $ilTabs->activateSubTab('cal_ch_app_grp');
368
369 if ($form == null) {
370 $form = $this->initGroupForm((int) $_REQUEST['grp_id']);
371 }
372 $tpl->setContent($form->getHTML());
373 }

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

Referenced by updateGroup().

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

◆ executeCommand()

ilConsultationHoursGUI::executeCommand ( )

Execute command.

Returns

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

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

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

Referenced by searchUsersForAppointments().

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

◆ getProfileBackUrl()

ilConsultationHoursGUI::getProfileBackUrl ( )
protected

Build context-sensitive profile back url.

Returns
string

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

1201 {
1202 // from repository
1203 if (isset($_REQUEST["ref_id"])) {
1204 $url = $this->ctrl->getLinkTargetByClass('ilCalendarMonthGUI');
1205 }
1206 // from panel
1207 elseif (isset($_GET['panel'])) {
1208 $url = $this->ctrl->getLinkTargetByClass('ilCalendarPresentationGUI');
1209 }
1210 // from appointments
1211 else {
1212 $url = $this->ctrl->getLinkTarget($this, 'appointmentList');
1213 }
1214 return $url;
1215 }
$url

References $_GET, and $url.

Referenced by executeCommand(), and showProfile().

+ Here is the caller graph for this function:

◆ getUserId()

ilConsultationHoursGUI::getUserId ( )

Get user id.

Returns

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

146 {
147 return $this->user_id;
148 }

References $user_id.

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

+ Here is the caller graph for this function:

◆ groupList()

ilConsultationHoursGUI::groupList ( )
protected

Show consultation hour group @global type $ilToolbar.

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

299 {
300 global $ilToolbar, $ilTabs, $tpl;
301
302 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
303 $ilToolbar->addButton($this->lng->txt('cal_ch_add_grp'), $this->ctrl->getLinkTarget($this, 'addGroup'));
304
305 $this->setSubTabs();
306 $ilTabs->activateSubTab('cal_ch_app_grp');
307
308 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroupTableGUI.php';
309 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
310 $gtbl = new ilConsultationHourGroupTableGUI($this, 'groupList', $this->getUserId());
312
313 $tpl->setContent($gtbl->getHTML());
314 }
static getGroupsOfUser($a_user_id)
Get a all groups of an user.

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

+ Here is the call graph for this function:

◆ initFormSequence()

ilConsultationHoursGUI::initFormSequence (   $a_mode)
protected

Init form.

Parameters
int$a_mode
Returns

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

645 {
646 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
647
648 include_once('./Services/YUI/classes/class.ilYuiUtil.php');
650
651 $this->form = new ilPropertyFormGUI();
652 $this->form->setFormAction($this->ctrl->getFormAction($this));
653
654 switch ($a_mode) {
656 $this->form->setTitle($this->lng->txt('cal_ch_add_sequence'));
657 $this->form->addCommandButton('saveSequence', $this->lng->txt('save'));
658 $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
659 break;
660
661 /*
662 case self::MODE_UPDATE:
663 $this->form->setTitle($this->lng->txt('cal_ch_edit_sequence'));
664 $this->form->addCommandButton('updateSequence', $this->lng->txt('save'));
665 $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
666 break;
667 */
668
669 case self::MODE_MULTI:
670 $this->form->setTitle($this->lng->txt('cal_ch_multi_edit_sequence'));
671 $this->form->addCommandButton('updateMulti', $this->lng->txt('save'));
672 $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
673 break;
674 }
675
676 // in case of existing groups show a selection
677 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
679 $group = new ilSelectInputGUI($this->lng->txt('cal_ch_grp_selection'), 'grp');
680 $group->setOptions($options);
681 $group->setRequired(false);
682 $this->form->addItem($group);
683 }
684
685 // Title
686 $ti = new ilTextInputGUI($this->lng->txt('title'), 'ti');
687 $ti->setSize(32);
688 $ti->setMaxLength(128);
689 $ti->setRequired(true);
690 $this->form->addItem($ti);
691
692 if ($a_mode != self::MODE_MULTI) {
693 // Start
694 include_once './Services/Form/classes/class.ilDateTimeInputGUI.php';
695 $dur = new ilDateTimeInputGUI($this->lng->txt('cal_start'), 'st');
696 $dur->setShowTime(true);
697 $dur->setRequired(true);
698 $this->form->addItem($dur);
699
700 // Duration
701 $du = new ilDurationInputGUI($this->lng->txt('cal_ch_duration'), 'du');
702 $du->setShowMinutes(true);
703 $du->setShowHours(true);
704 $this->form->addItem($du);
705
706 // Number of appointments
707 $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_appointments'), 'ap');
708 $nu->setInfo($this->lng->txt('cal_ch_num_appointments_info'));
709 $nu->setSize(2);
710 $nu->setMaxLength(2);
711 $nu->setRequired(true);
712 $nu->setMinValue(1);
713 $this->form->addItem($nu);
714
715 // Recurrence
716 include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
717 $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence');
718 $rec->setEnabledSubForms(
719 array(
723 )
724 );
725 $this->form->addItem($rec);
726 }
727
728 // Number of bookings
729 $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_bookings'), 'bo');
730 $nu->setSize(2);
731 $nu->setMaxLength(2);
732 $nu->setMinValue(1);
733 $nu->setRequired(true);
734 $this->form->addItem($nu);
735
736 // Deadline
737 $dead = new ilDurationInputGUI($this->lng->txt('cal_ch_deadline'), 'dead');
738 $dead->setInfo($this->lng->txt('cal_ch_deadline_info'));
739 $dead->setShowMinutes(false);
740 $dead->setShowHours(true);
741 $dead->setShowDays(true);
742 $this->form->addItem($dead);
743
744 // Location
745 $lo = new ilTextInputGUI($this->lng->txt('cal_where'), 'lo');
746 $lo->setSize(32);
747 $lo->setMaxLength(128);
748 $this->form->addItem($lo);
749
750 // Description
751 $de = new ilTextAreaInputGUI($this->lng->txt('description'), 'de');
752 $de->setRows(10);
753 $de->setCols(60);
754 $this->form->addItem($de);
755
756 // Target Object
757 $tgt = new ilTextInputGUI($this->lng->txt('cal_ch_target_object'), 'tgt');
758 $tgt->setInfo($this->lng->txt('cal_ch_target_object_info'));
759 $tgt->setSize(16);
760 $tgt->setMaxLength(128);
761 $this->form->addItem($tgt);
762 }
if(!isset( $_REQUEST[ 'ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
const IL_CAL_FREQ_MONTHLY
const IL_CAL_FREQ_WEEKLY
static getGroupSelectOptions($a_user_id)
Get group selection options.
This class represents a date/time property in a property form.
This class represents a duration (typical hh:mm:ss) property in a property form.
This class represents a number property in a property form.
This class represents a property form user interface.
This class represents an input GUI for recurring events/appointments (course events or calendar appoi...
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
static initDomEvent()
Init YUI DomEvent.
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.

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

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

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

◆ initGroupForm()

ilConsultationHoursGUI::initGroupForm (   $a_group_id = 0)
protected

Init new/update group form.

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

456 {
457 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
458 $group = new ilConsultationHourGroup($a_group_id);
459
460 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
461 $form = new ilPropertyFormGUI();
462 $form->setFormAction($GLOBALS['ilCtrl']->getFormAction($this));
463
464 if ($a_group_id) {
465 $form->setTitle($GLOBALS['lng']->txt('cal_ch_grp_update_tbl'));
466 $form->addCommandButton('updateGroup', $GLOBALS['lng']->txt('save'));
467 $form->addCommandButton('groupList', $GLOBALS['lng']->txt('cancel'));
468 } else {
469 $form->setTitle($GLOBALS['lng']->txt('cal_ch_grp_add_tbl'));
470 $form->addCommandButton('saveGroup', $GLOBALS['lng']->txt('save'));
471 $form->addCommandButton('appointmentList', $GLOBALS['lng']->txt('cancel'));
472 }
473
474 $title = new ilTextInputGUI($GLOBALS['lng']->txt('title'), 'title');
475 $title->setMaxLength(128);
476 $title->setSize(40);
477 $title->setRequired(true);
478 $title->setValue($group->getTitle());
479 $form->addItem($title);
480
481 $multiple = new ilNumberInputGUI($GLOBALS['lng']->txt('cal_ch_grp_multiple'), 'multiple');
482 $multiple->setRequired(true);
483 $multiple->setMinValue(1);
484 $multiple->setSize(1);
485 $multiple->setMaxLength(2);
486 $multiple->setInfo($GLOBALS['lng']->txt('cal_ch_grp_multiple_info'));
487 $multiple->setValue($group->getMaxAssignments());
488 $form->addItem($multiple);
489
490 return $form;
491 }

References $form, $GLOBALS, and $title.

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

+ Here is the caller graph for this function:

◆ initSettingsForm()

ilConsultationHoursGUI::initSettingsForm ( )
protected

build settings form

Returns
object

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

1236 {
1237 global $ilDB, $ilUser;
1238
1239 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1240
1241 $form = new ilPropertyFormGUI();
1242 $form->setFormAction($this->ctrl->getFormAction($this));
1243
1244 $mng = new ilTextInputGUI($this->lng->txt('cal_ch_manager'), 'mng');
1245 $mng->setInfo($this->lng->txt('cal_ch_manager_info'));
1246 $form->addItem($mng);
1247
1248 $mng->setValue(ilConsultationHourAppointments::getManager(true));
1249
1250 $form->setTitle($this->lng->txt('settings'));
1251 $form->addCommandButton('updateSettings', $this->lng->txt('save'));
1252 // $form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
1253 return $form;
1254 }
static getManager($a_as_name=false, $a_full_name=false, $a_user_id=null)
Get consultation hour manager for current user or specific user.
global $ilDB

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

Referenced by settings(), and updateSettings().

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

◆ rejectBooking()

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

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

580 {
581 global $ilCtrl;
582
583 foreach ((array) $_REQUEST['bookuser'] as $bookuser) {
584 $ids = explode('_', $bookuser);
585
586 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
587 ilConsultationHourUtils::cancelBooking($ids[1], $ids[0], $a_send_notification);
588 }
589 if ($a_send_notification) {
590 ilUtil::sendSuccess($this->lng->txt('cal_ch_canceled_bookings'), true);
591 } else {
592 ilUtil::sendSuccess($this->lng->txt('cal_ch_deleted_bookings'), true);
593 }
594 $ilCtrl->redirect($this, 'bookingList');
595 }

References $ilCtrl, ilConsultationHourUtils\cancelBooking(), and ilUtil\sendSuccess().

Referenced by deleteBooking().

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

◆ rewriteBookingIdsForAppointments()

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

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

1034 {
1035 foreach ($appointments as $appointment_id) {
1036
1037 $booking_appointment = new \ilCalendarEntry($appointment_id);
1038 $booking_start = $booking_appointment->getStart();
1039 $booking_end = $booking_appointment->getEnd();
1040
1041 $deprecatedBooking = \ilBookingEntry::getInstanceByCalendarEntryId($appointment_id);
1042 if (!$deprecatedBooking instanceof \ilBookingEntry) {
1043 // @todo error handling
1044 continue;
1045 }
1046
1048 $deprecatedBooking,
1049 $booking_start,
1050 $booking_end
1051 );
1052 foreach ($relevant_appointments as $relevant_appointment_id) {
1053
1054 $entry = new \ilCalendarEntry($relevant_appointment_id);
1055 $entry->setContextId($booking->getId());
1056 $entry->setTitle($form->getInput('ti'));
1057 $entry->setLocation($form->getInput('lo'));
1058 $entry->setDescription($form->getInput('de'));
1059 $entry->update();
1060 }
1061 }
1062 }
static findCalendarAppointmentsForBooking(\ilBookingEntry $booking, \ilDateTime $start, \ilDateTime $end)

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

Referenced by updateMulti().

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

◆ saveGroup()

ilConsultationHoursGUI::saveGroup ( )
protected

Save new group.

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

338 {
339 $form = $this->initGroupForm();
340 if ($form->checkInput()) {
341 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
342 $group = new ilConsultationHourGroup();
343 $group->setTitle($form->getInput('title'));
344 $group->setMaxAssignments($form->getInput('multiple'));
345 $group->setUserId($this->getUserId());
346 $group->save();
347
348 ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'), true);
349 $GLOBALS['ilCtrl']->redirect($this, 'groupList');
350 }
351
352 ilUtil::sendFailure($GLOBALS['lng']->txt('err_check_input'), true);
353 $this->addGroup($form);
354 }
addGroup(ilPropertyFormGUI $form=null)
Show add group form @global type $ilToolbar @global type $ilTabs.

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

+ Here is the call graph for this function:

◆ saveSequence()

ilConsultationHoursGUI::saveSequence ( )
protected

Save new sequence.

Returns

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

769 {
770 global $ilObjDataCache;
771
772 $this->initFormSequence(self::MODE_CREATE);
773
774 if ($this->form->checkInput()) {
775 $this->form->setValuesByPost();
776
777 $booking = new ilBookingEntry();
778 $booking->setObjId($this->getUserId());
779 $booking->setNumberOfBookings($this->form->getInput('bo'));
780
781 $deadline = $this->form->getInput('dead');
782 $deadline = $deadline['dd'] * 24 + $deadline['hh'];
783 $booking->setDeadlineHours($deadline);
784
785 // consultation hour group
786 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
788 $booking->setBookingGroup((int) $this->form->getInput('grp'));
789 }
790
791 $tgt = explode(',', $this->form->getInput('tgt'));
792 $obj_ids = array();
793 foreach ((array) $tgt as $ref_id) {
794 if (!trim($ref_id)) {
795 continue;
796 }
797 $obj_id = $ilObjDataCache->lookupObjId($ref_id);
798 $type = ilObject::_lookupType($obj_id);
799 $valid_types = array('crs','grp');
800 if (!$obj_id or !in_array($type, $valid_types)) {
801 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_repository_object'));
802 $this->tpl->setContent($this->form->getHTML());
803 return;
804 }
805
806 $obj_ids[] = $obj_id;
807 }
808 $booking->setTargetObjIds($obj_ids);
809
810 $booking->save();
812
813 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
814 $this->ctrl->redirect($this, 'appointmentList');
815 } else {
816 $this->form->setValuesByPost();
817 $this->tpl->setContent($this->form->getHTML());
818 }
819 }
createAppointments(ilBookingEntry $booking)
Create calendar appointments.

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

+ Here is the call graph for this function:

◆ searchUsersForAppointments()

ilConsultationHoursGUI::searchUsersForAppointments ( )
protected

start searching for users

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

154 {
155 global $ilCtrl, $ilTabs;
156
157 $_SESSION['ch_apps'] = $_REQUEST['apps'];
158
159 if (!count($_SESSION['ch_apps'])) {
160 ilUtil::sendFailure($this->lng->txt('select_one'), true);
161 $GLOBALS['ilCtrl']->redirect($this, 'appointmentList');
162 }
163 $_REQUEST['assignM'] = 1;
164 $ilCtrl->setCmdClass('ilrepositorysearchgui');
165 $ilCtrl->setcmd('');
166 $this->executeCommand();
167 }

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

+ Here is the call graph for this function:

◆ sendInfoAboutUnassignedUsers()

ilConsultationHoursGUI::sendInfoAboutUnassignedUsers (   $unassigned)
protected

Send info message about unassigned users.

Parameters
array$unassigned

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

174 {
175 if (!$unassigned) {
176 return true;
177 }
178 $users = array();
179 foreach ($unassigned as $user_id) {
180 include_once './Services/User/classes/class.ilObjUser.php';
182 }
183 ilUtil::sendInfo($this->lng->txt('cal_ch_user_assignment_failed_info') . '<br />' . implode('<br />', $users), true);
184 return true;
185 }
static _lookupFullname($a_user_id)
Lookup Full Name.

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

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

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

◆ setSubTabs()

ilConsultationHoursGUI::setSubTabs ( )
protected

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

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

924 {
925 global $ilTabs, $ilCtrl;
926
927 $ilCtrl->setParameter($this, 'user_id', $this->getUserId());
928 $ilTabs->addSubTab('cal_ch_app_list', $this->lng->txt('cal_ch_app_list'), $ilCtrl->getLinkTarget($this, 'appointmentList'));
929 $ilTabs->addSubTab('cal_ch_app_grp', $this->lng->txt('cal_ch_app_grp'), $ilCtrl->getLinkTarget($this, 'groupList'));
930 $ilTabs->addSubTab('cal_ch_app_bookings', $this->lng->txt('cal_ch_app_bookings'), $ilCtrl->getLinkTarget($this, 'bookingList'));
931 }

References $ilCtrl, and getUserId().

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

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

◆ setTabs()

ilConsultationHoursGUI::setTabs ( )
protected

Set tabs.

Returns

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

901 {
902 global $ilTabs, $ilUser, $ilCtrl;
903
904 $ilCtrl->setParameter($this, 'user_id', '');
905 $ilTabs->addTab('consultation_hours_' . $ilUser->getId(), $this->lng->txt('cal_ch_ch'), $this->ctrl->getLinkTarget($this, 'appointmentList'));
906
908 $ilCtrl->setParameter($this, 'user_id', $user_id);
909 $ilTabs->addTab('consultation_hours_' . $user_id, $this->lng->txt('cal_ch_ch') . ': ' . $login, $this->ctrl->getLinkTarget($this, 'appointmentList'));
910 }
911 $ilCtrl->setParameter($this, 'user_id', '');
912
913 $ilTabs->addTab('ch_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this, 'settings'));
914
915 $ilTabs->activateTab('consultation_hours_' . $this->getUserId());
916 }

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

Referenced by executeCommand().

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

◆ settings()

ilConsultationHoursGUI::settings ( )

display settings gui

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

1221 {
1222 global $tpl, $ilTabs, $ilHelp;
1223
1224 $ilHelp->setScreenId("consultation_hours_settings");
1225 $ilTabs->activateTab('ch_settings');
1226
1227 $form = $this->initSettingsForm();
1228 $tpl->setContent($form->getHTML());
1229 }

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

+ Here is the call graph for this function:

◆ showProfile()

ilConsultationHoursGUI::showProfile ( )

show public profile of given user

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

1182 {
1183 global $tpl, $ilTabs, $ilCtrl;
1184
1185 $ilTabs->clearTargets();
1186
1187 $user_id = (int) $_GET['user'];
1188
1189 include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
1190 $profile = new ilPublicUserProfileGUI($user_id);
1191 $profile->setBackUrl($this->getProfileBackUrl());
1192 $tpl->setContent($ilCtrl->getHTML($profile));
1193 }

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

+ Here is the call graph for this function:

◆ updateGroup()

ilConsultationHoursGUI::updateGroup ( )
protected

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

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

382 {
383 global $ilCtrl, $tpl, $ilTabs;
384
385 $ilCtrl->setParameter($this, 'grp_id', (int) $_REQUEST['grp_id']);
386
387 $form = $this->initGroupForm((int) $_REQUEST['grp_id']);
388 if ($form->checkInput()) {
389 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
390 $group = new ilConsultationHourGroup((int) $_REQUEST['grp_id']);
391 $group->setTitle($form->getInput('title'));
392 $group->setMaxAssignments($form->getInput('multiple'));
393 $group->setUserId($this->getUserId());
394 $group->update();
395
396 ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'), true);
397 $GLOBALS['ilCtrl']->redirect($this, 'groupList');
398 }
399
400 ilUtil::sendFailure($GLOBALS['lng']->txt('err_check_input'), true);
401 $this->editGroup($form);
402 }
editGroup(ilPropertyFormGUI $form=null)
Edit group @global type $ilCtrl.

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

+ Here is the call graph for this function:

◆ updateMulti()

ilConsultationHoursGUI::updateMulti ( )
protected

Update multiple sequence items.

Returns

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

1069 {
1070 global $DIC;
1071
1072 $ilObjDataCache = $DIC['ilObjDataCache'];
1073
1074 $this->initFormSequence(self::MODE_MULTI);
1075
1076 if ($this->form->checkInput()) {
1077
1078 $this->form->setValuesByPost();
1079 $apps = explode(';', (string) $_POST['apps']);
1080
1081 // create new booking
1082 $booking = $this->createNewBookingEntry($this->form);
1083 if (!$booking instanceof \ilBookingEntry) {
1084 $this->edit();
1085 return false;
1086 }
1087 $this->rewriteBookingIdsForAppointments($booking, $apps, $this->form);
1089
1090 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1091 $this->ctrl->redirect($this, 'appointmentList');
1092 }
1093 $this->tpl->setContent($this->form->getHTML());
1094 }
rewriteBookingIdsForAppointments(\ilBookingEntry $booking, $appointments, \ilPropertyFormGUI $form)
edit()
Edit multiple sequence items.
createNewBookingEntry(\ilPropertyFormGUI $validate_form)

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

+ Here is the call graph for this function:

◆ updateSettings()

ilConsultationHoursGUI::updateSettings ( )

save settings

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

1260 {
1261 global $ilDB, $ilCtrl, $ilUser, $tpl, $ilTabs;
1262
1263 $form = $this->initSettingsForm();
1264 if ($form->checkInput()) {
1265 $mng = $form->getInput('mng');
1267 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1268 $ilCtrl->redirect($this, 'settings');
1269 } else {
1270 $ilTabs->activateTab('ch_settings');
1271
1272 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_user'));
1273 $field = $form->getItemByPostVar('mng');
1274 $field->setValue($mng);
1275 $tpl->setContent($form->getHTML());
1276 return;
1277 }
1278 }
1279 }
static setManager($a_user_name)
Set consultation hour manager for current user.

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

+ Here is the call graph for this function:

Field Documentation

◆ $booking

◆ $ctrl

ilConsultationHoursGUI::$ctrl
protected

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

◆ $user_id

ilConsultationHoursGUI::$user_id
protected

◆ MAX_APPOINTMENTS_PER_SEQUENCE

const ilConsultationHoursGUI::MAX_APPOINTMENTS_PER_SEQUENCE = 1000

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

◆ MODE_CREATE

const ilConsultationHoursGUI::MODE_CREATE = 1

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

Referenced by initFormSequence().

◆ MODE_MULTI

const ilConsultationHoursGUI::MODE_MULTI = 3

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

Referenced by initFormSequence().

◆ MODE_UPDATE

const ilConsultationHoursGUI::MODE_UPDATE = 2

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


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