ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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...
 
 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 {
58 {
59 $this->user_id = $user_id;
60 }
61 else
62 {
63 $user_id = false;
64 }
65 }
66 if(!$user_id)
67 {
68 $this->user_id = $ilUser->getId();
69 }
70
71 $this->ctrl = $ilCtrl;
72 $this->lng = $lng;
73 $this->tpl = $tpl;
74 }
global $tpl
Definition: ilias.php:8
$_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 345 of file class.ilConsultationHoursGUI.php.

346 {
347 global $ilTabs, $tpl;
348
349 $this->setSubTabs();
350 $ilTabs->activateSubTab('cal_ch_app_grp');
351
352 if($form == null)
353 {
354 $form = $this->initGroupForm();
355 }
356 $tpl->setContent($form->getHTML());
357 }
initGroupForm($a_group_id=0)
Init new/update group form.
setSubTabs()
Set sub tabs @global type $ilTabs @global type $ilCtrl.

References $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 643 of file class.ilConsultationHoursGUI.php.

644 {
645 global $ilToolbar, $ilHelp, $ilTabs;
646
647 $ilHelp->setScreenId("consultation_hours");
648
649 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
650 $ilToolbar->addButton($this->lng->txt('cal_ch_add_sequence'),$this->ctrl->getLinkTarget($this,'createSequence'));
651
652 $this->setSubTabs();
653 $ilTabs->activateSubTab('cal_ch_app_list');
654
655 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursTableGUI.php';
656 $tbl = new ilConsultationHoursTableGUI($this,'appointmentList',$this->getUserId());
657 $tbl->parse();
658 $this->tpl->setContent($tbl->getHTML());
659 }
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 226 of file class.ilConsultationHoursGUI.php.

227 {
228 global $ilCtrl;
229
230 if($a_app)
231 {
232 $app = $a_app;
233 }
234 else
235 {
236 $app = $_REQUEST['apps'];
237 }
238
239 include_once './Services/Booking/classes/class.ilBookingEntry.php';
241
242 $assigned_users = array();
243 foreach($users as $user)
244 {
245 if($booking->getCurrentNumberOfBookings($app) >= $booking->getNumberOfBookings())
246 {
247 break;
248 }
249 if(!ilBookingEntry::lookupBookingsOfUser((array) $app, $user))
250 {
251 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
253 $assigned_users[] = $user;
254 }
255 }
256
257 $unassigned_users = array_diff($users, $assigned_users);
258
259 if($a_redirect)
260 {
261 $this->sendInfoAboutUnassignedUsers($unassigned_users);
262 $ilCtrl->redirect($this,'appointmentList');
263 }
264 else
265 {
266 return $unassigned_users;
267 }
268
269 }
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.

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

Referenced by assignUsersToAppointments().

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

◆ assignUsersToAppointments()

ilConsultationHoursGUI::assignUsersToAppointments ( array  $users)

Assign users to multiple appointments.

Parameters
type$users

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

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

References $_SESSION, $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 276 of file class.ilConsultationHoursGUI.php.

277 {
278 global $ilCtrl;
279
280 $group_id = (int) $_REQUEST['grp_id'];
281
282 $tomorrow = new ilDateTime(time(),IL_CAL_UNIX);
283 $tomorrow->increment(IL_CAL_DAY,1);
284
285 // Get all future consultation hours
286 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
287 include_once './Services/Booking/classes/class.ilBookingEntry.php';
289 $this->user_id,
290 $group_id,
291 $tomorrow
292 );
293 $users = $usr_ids;
294 $assigned_users = array();
295 foreach($apps as $app)
296 {
298 foreach($users as $user)
299 {
300 if($booking->getCurrentNumberOfBookings($app) >= $booking->getNumberOfBookings())
301 {
302 break;
303 }
304 if(!ilBookingEntry::lookupBookingsOfUser($apps, $user))
305 {
306 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
308 $assigned_users[] = $user;
309 }
310 }
311 }
312
313 $this->sendInfoAboutUnassignedUsers(array_diff($users, $assigned_users));
314 $ilCtrl->redirect($this,'bookingList');
315 }
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, 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 529 of file class.ilConsultationHoursGUI.php.

530 {
531 global $ilToolbar, $ilTabs, $tpl;
532
533 $this->setSubTabs();
534 $ilTabs->activateSubTab('cal_ch_app_bookings');
535
536 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourBookingTableGUI.php';
537 $btable = new ilConsultationHourBookingTableGUI($this,'bookingList',$this->getUserId());
539 $tpl->setContent($btable->getHTML());
540 }
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 1140 of file class.ilConsultationHoursGUI.php.

1141 {
1142 global $tpl;
1143
1144 if(!isset($_REQUEST['apps']))
1145 {
1146 ilUtil::sendFailure($this->lng->txt('select_one'));
1147 return $this->appointmentList();
1148 }
1149
1150 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
1151
1152
1153 $this->ctrl->saveParameter($this,array('seed','app_id','dt'));
1154
1155 $confirm = new ilConfirmationGUI();
1156 $confirm->setFormAction($this->ctrl->getFormAction($this));
1157 $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
1158 $confirm->setCancel($this->lng->txt('cancel'),'cancel');
1159
1160 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1161
1162 $bookings_available = array();
1163 foreach((array) $_REQUEST['apps'] as $entry_id)
1164 {
1165 $entry = new ilCalendarEntry($entry_id);
1166 $confirm->addItem('apps[]', $entry_id, ilDatePresentation::formatDate($entry->getStart()).', '.$entry->getTitle());
1167
1168 include_once './Services/Booking/classes/class.ilBookingEntry.php';
1170 {
1171 $bookings_available[] = ilDatePresentation::formatDate($entry->getStart()).', '.$entry->getTitle();
1172 }
1173 }
1174
1175 if($bookings_available)
1176 {
1177 ilUtil::sendInfo($this->lng->txt('cal_ch_delete_app_booking_info').'<br />'.implode('<br />',$bookings_available));
1178 }
1179
1180 $confirm->setConfirm($this->lng->txt('delete'),'delete');
1181 $confirm->setCancel($this->lng->txt('cancel'),'appointmentList');
1182
1183 $tpl->setContent($confirm->getHTML());
1184 }
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)
Format a date @access public.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
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 545 of file class.ilConsultationHoursGUI.php.

546 {
547 $this->confirmRejectBooking(false);
548 }
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 437 of file class.ilConsultationHoursGUI.php.

438 {
439 global $ilCtrl, $ilTabs, $tpl;
440
441 $ilCtrl->setParameter($this,'grp_id',(int) $_REQUEST['grp_id']);
442 $groups = array((int) $_REQUEST['grp_id']);
443
444 $this->setSubTabs();
445 $ilTabs->activateSubTab('cal_ch_app_grp');
446
447
448 include_once './Services/Utilities/classes/class.ilConfirmationGUI.php';
449 $confirm = new ilConfirmationGUI();
450 $confirm->setFormAction($ilCtrl->getFormAction($this));
451 $confirm->setHeaderText($GLOBALS['lng']->txt('cal_ch_grp_delete_sure'));
452 $confirm->setConfirm($GLOBALS['lng']->txt('delete'), 'deleteGroup');
453 $confirm->setCancel($GLOBALS['lng']->txt('cancel'), 'groupList');
454
455 foreach($groups as $grp_id)
456 {
457 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
458 $group = new ilConsultationHourGroup($grp_id);
459
460 $confirm->addItem('groups[]', $grp_id, $group->getTitle());
461 }
462 $tpl->setContent($confirm->getHTML());
463 }
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

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

554 {
555 global $ilTabs, $tpl;
556
557 $this->setSubTabs();
558 $ilTabs->activateSubTab('cal_ch_app_bookings');
559
560 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
561
562 $confirm = new ilConfirmationGUI();
563 $confirm->setFormAction($this->ctrl->getFormAction($this));
564
565 if($a_send_notification)
566 {
567 ilUtil::sendInfo($this->lng->txt('cal_ch_cancel_booking_info'));
568 $confirm->setHeaderText($this->lng->txt('cal_ch_cancel_booking_sure'));
569 $confirm->setConfirm($this->lng->txt('cal_ch_reject_booking'), 'rejectBooking');
570 }
571 else
572 {
573 ilUtil::sendInfo($this->lng->txt('cal_ch_delete_booking_info'));
574 $confirm->setHeaderText($this->lng->txt('cal_ch_delete_booking_sure'));
575 $confirm->setConfirm($this->lng->txt('cal_ch_delete_booking'), 'deleteBooking');
576 }
577
578 $confirm->setCancel($this->lng->txt('cancel'),'bookingList');
579
580 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
581 foreach((array) $_REQUEST['bookuser'] as $bookuser)
582 {
583 $ids = explode('_',$bookuser);
584
585 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
586 include_once './Services/User/classes/class.ilUserUtil.php';
587 $entry = new ilCalendarEntry($ids[0]);
588 $confirm->addItem(
589 'bookuser[]',
590 $bookuser,
592 $ids[1],
593 true,
594 false,
595 '',
596 true,
597 true
598 ).', '.ilDatePresentation::formatDate($entry->getStart())
599 );
600 }
601 $tpl->setContent($confirm->getHTML());
602 }
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)
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 876 of file class.ilConsultationHoursGUI.php.

877 {
878 include_once './Services/Calendar/classes/class.ilDateList.php';
879 $concurrent_dates = new ilDateList(ilDateList::TYPE_DATETIME);
880 $start = clone $this->form->getItemByPostVar('st')->getDate();
881 for($i = 0; $i < $this->form->getItemByPostVar('ap')->getValue(); $i++)
882 {
883 $concurrent_dates->add(clone $start);
884
885 $start->increment(ilDateTime::MINUTE,$this->form->getItemByPostVar('du')->getMinutes());
886 $start->increment(ilDateTime::HOUR,$this->form->getItemByPostVar('du')->getHours());
887 #$start = new ilDateTime(,IL_CAL_UNIX);
888 }
889
890 include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
891 $def_cat = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_CH,$this->getUserId(),$this->lng->txt('cal_ch_personal_ch'),true);
892
893 // Add calendar appointment for each
894 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
895 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
896 include_once './Services/Calendar/classes/class.ilCalendarRecurrenceCalculator.php';
897 include_once './Services/Booking/classes/class.ilBookingPeriod.php';
898
899 $num_appointments = 0;
900 foreach($concurrent_dates as $dt)
901 {
902 if($num_appointments >= self::MAX_APPOINTMENTS_PER_SEQUENCE)
903 {
904 break;
905 }
906
907 $end = clone $dt;
908 $end->increment(ilDateTime::MINUTE,$this->form->getItemByPostVar('du')->getMinutes());
909 $end->increment(ilDateTime::HOUR,$this->form->getItemByPostVar('du')->getHours());
910
912 new ilBookingPeriod($dt,$end),
913 $this->form->getItemByPostVar('frequence')->getRecurrence()
914 );
915
916 // Calculate with one year limit
917 $limit = clone $dt;
918 $limit->increment(ilDateTime::YEAR,1);
919
920 $date_list = $calc->calculateDateList($dt,$limit);
921
922 $num = 0;
923 foreach($date_list as $app_start)
924 {
925 $app_end = clone $app_start;
926 $app_end->increment(ilDateTime::MINUTE,$this->form->getItemByPostVar('du')->getMinutes());
927 $app_end->increment(ilDateTime::HOUR,$this->form->getItemByPostVar('du')->getHours());
928
929
930 $entry = new ilCalendarEntry();
931 $entry->setContextId($booking->getId());
932 $entry->setTitle($this->form->getInput('ti'));
933 $entry->setSubtitle("#consultationhour#"); // dynamic, see ilCalendarEntry
934 $entry->setDescription($this->form->getInput('de'));
935 $entry->setLocation($this->form->getInput('lo'));
936 $entry->setStart($app_start);
937 $entry->setEnd($app_end);
938
939 $entry->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
940 $entry->save();
941
942 $cat_assign = new ilCalendarCategoryAssignments($entry->getEntryId());
943 $cat_assign->addAssignment($def_cat->getCategoryID());
944
945 $num_appointments++;
946 }
947 }
948 }
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.

References $booking, $start, 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:

◆ createSequence()

ilConsultationHoursGUI::createSequence ( )
protected

Create new sequence.

Returns

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

666 {
667 $this->initFormSequence(self::MODE_CREATE);
668
669 $this->booking = new ilBookingEntry();
670 $this->form->getItemByPostVar('bo')->setValue($this->booking->getNumberOfBookings());
671 $this->form->getItemByPostVar('ap')->setValue(1);
672 $this->form->getItemByPostVar('du')->setMinutes(15);
673 $this->form->getItemByPostVar('st')->setDate(
674 new ilDateTime(mktime(8,0,0,date('n',time()),date('d',time()),date('Y',time())),IL_CAL_UNIX));
675
676 $this->tpl->setContent($this->form->getHTML());
677 }
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 1189 of file class.ilConsultationHoursGUI.php.

1190 {
1191 if(!isset($_POST['apps']))
1192 {
1193 ilUtil::sendFailure($this->lng->txt('select_one'));
1194 return $this->appointmentList();
1195 }
1196
1197 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1198 include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1199 foreach($_POST['apps'] as $entry_id)
1200 {
1201 // cancel booking for users
1203 if($booking)
1204 {
1205 foreach($booking->getCurrentBookings($entry_id) as $user_id)
1206 {
1207 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1209 }
1210 }
1211 // remove calendar entries
1212 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1213 $entry = new ilCalendarEntry($entry_id);
1214 $entry->delete();
1215
1217 }
1218
1220
1221 ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
1222 $this->ctrl->redirect($this, 'appointmentList');
1223 }
$_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 607 of file class.ilConsultationHoursGUI.php.

608 {
609 $this->rejectBooking(false);
610 }
rejectBooking($a_send_notification=true)

References rejectBooking().

+ Here is the call graph for this function:

◆ deleteGroup()

ilConsultationHoursGUI::deleteGroup ( )
protected

Delete groups.

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

469 {
470 global $ilCtrl;
471
472 foreach((array) $_REQUEST['groups'] as $grp_id)
473 {
474 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
475 $group = new ilConsultationHourGroup($grp_id);
476 $group->delete();
477 }
478 ilUtil::sendSuccess($GLOBALS['lng']->txt('cal_ch_grp_deleted'));
479 $ilCtrl->redirect($this,'groupList');
480 }

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

+ Here is the call graph for this function:

◆ edit()

ilConsultationHoursGUI::edit ( )

Edit multiple sequence items.

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

992 {
993 global $ilTabs;
994
995 if(!isset($_REQUEST['apps']))
996 {
997 ilUtil::sendFailure($this->lng->txt('select_one'));
998 return $this->appointmentList();
999 }
1000
1001 $this->initFormSequence(self::MODE_MULTI);
1002
1003 if($_REQUEST['apps'] && !is_array($_REQUEST['apps']))
1004 {
1005 $_REQUEST['apps'] = explode(';', $_REQUEST['apps']);
1006 }
1007
1008 $hidden = new ilHiddenInputGUI('apps');
1009 $hidden->setValue(implode(';', $_REQUEST['apps']));
1010 $this->form->addItem($hidden);
1011
1012 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1013 $first = $_REQUEST['apps'];
1014 $first = array_shift($_REQUEST['apps']);
1015 $entry = new ilCalendarEntry($first);
1016
1017 $this->form->getItemByPostVar('ti')->setValue($entry->getTitle());
1018 $this->form->getItemByPostVar('lo')->setValue($entry->getLocation());
1019 $this->form->getItemByPostVar('de')->setValue($entry->getDescription());
1020
1021 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1022 $booking = new ilBookingEntry($entry->getContextId());
1023
1024 $this->form->getItemByPostVar('bo')->setValue($booking->getNumberOfBookings());
1025
1026 $ref_ids = array();
1027 foreach($booking->getTargetObjIds() as $obj_id)
1028 {
1029 $refs = ilObject::_getAllReferences($obj_id);
1030 $ref_ids[] = end($refs);
1031 }
1032 $this->form->getItemByPostVar('tgt')->setValue(implode(',',$ref_ids));
1033
1034 $deadline = $booking->getDeadlineHours();
1035 $this->form->getItemByPostVar('dead')->setDays(floor($deadline/24));
1036 $this->form->getItemByPostVar('dead')->setHours($deadline%24);
1037
1038 if($booking->getBookingGroup())
1039 {
1040 $this->form->getItemByPostVar('grp')->setValue($booking->getBookingGroup());
1041 }
1042
1043 $this->tpl->setContent($this->form->getHTML());
1044 }
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 387 of file class.ilConsultationHoursGUI.php.

388 {
389 global $ilCtrl, $tpl, $ilTabs;
390
391 $ilCtrl->setParameter($this,'grp_id',(int) $_REQUEST['grp_id']);
392 $this->setSubTabs();
393 $ilTabs->activateSubTab('cal_ch_app_grp');
394
395 if($form == null)
396 {
397 $form = $this->initGroupForm((int) $_REQUEST['grp_id']);
398 }
399 $tpl->setContent($form->getHTML());
400 }

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

Referenced by updateGroup().

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

◆ executeCommand()

ilConsultationHoursGUI::executeCommand ( )

Execute command.

Returns

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

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

References $cmd, $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 1247 of file class.ilConsultationHoursGUI.php.

1248 {
1249 // from repository
1250 if(isset($_REQUEST["ref_id"]))
1251 {
1252 $url = $this->ctrl->getLinkTargetByClass('ilCalendarMonthGUI');
1253 }
1254 // from panel
1255 else if(isset($_GET['panel']))
1256 {
1257 $url = $this->ctrl->getLinkTargetByClass('ilCalendarPresentationGUI');
1258 }
1259 // from appointments
1260 else
1261 {
1262 $url = $this->ctrl->getLinkTarget($this, 'appointmentList');
1263 }
1264 return $url;
1265 }
$url
Definition: shib_logout.php:72

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

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

References $user_id.

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

+ Here is the caller graph for this function:

◆ groupList()

ilConsultationHoursGUI::groupList ( )
protected

Show consultation hour group @global type $ilToolbar.

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

323 {
324 global $ilToolbar, $ilTabs, $tpl;
325
326 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
327 $ilToolbar->addButton($this->lng->txt('cal_ch_add_grp'),$this->ctrl->getLinkTarget($this,'addGroup'));
328
329 $this->setSubTabs();
330 $ilTabs->activateSubTab('cal_ch_app_grp');
331
332 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroupTableGUI.php';
333 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
334 $gtbl = new ilConsultationHourGroupTableGUI($this,'groupList',$this->getUserId());
336
337 $tpl->setContent($gtbl->getHTML());
338 }
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 684 of file class.ilConsultationHoursGUI.php.

685 {
686 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
687
688 include_once('./Services/YUI/classes/class.ilYuiUtil.php');
690
691 $this->form = new ilPropertyFormGUI();
692 $this->form->setFormAction($this->ctrl->getFormAction($this));
693
694 switch($a_mode)
695 {
697 $this->form->setTitle($this->lng->txt('cal_ch_add_sequence'));
698 $this->form->addCommandButton('saveSequence', $this->lng->txt('save'));
699 $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
700 break;
701
702 /*
703 case self::MODE_UPDATE:
704 $this->form->setTitle($this->lng->txt('cal_ch_edit_sequence'));
705 $this->form->addCommandButton('updateSequence', $this->lng->txt('save'));
706 $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
707 break;
708 */
709
710 case self::MODE_MULTI:
711 $this->form->setTitle($this->lng->txt('cal_ch_multi_edit_sequence'));
712 $this->form->addCommandButton('updateMulti', $this->lng->txt('save'));
713 $this->form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
714 break;
715 }
716
717 // in case of existing groups show a selection
718 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
720 {
721 $group = new ilSelectInputGUI($this->lng->txt('cal_ch_grp_selection'),'grp');
722 $group->setOptions($options);
723 $group->setRequired(false);
724 $this->form->addItem($group);
725 }
726
727 // Title
728 $ti = new ilTextInputGUI($this->lng->txt('title'),'ti');
729 $ti->setSize(32);
730 $ti->setMaxLength(128);
731 $ti->setRequired(true);
732 $this->form->addItem($ti);
733
734 if($a_mode != self::MODE_MULTI)
735 {
736 // Start
737 include_once './Services/Form/classes/class.ilDateTimeInputGUI.php';
738 $dur = new ilDateTimeInputGUI($this->lng->txt('cal_start'),'st');
739 $dur->setShowTime(true);
740 $dur->setRequired(true);
741 $this->form->addItem($dur);
742
743 // Duration
744 $du = new ilDurationInputGUI($this->lng->txt('cal_ch_duration'),'du');
745 $du->setShowMinutes(true);
746 $du->setShowHours(true);
747 $this->form->addItem($du);
748
749 // Number of appointments
750 $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_appointments'),'ap');
751 $nu->setInfo($this->lng->txt('cal_ch_num_appointments_info'));
752 $nu->setSize(2);
753 $nu->setMaxLength(2);
754 $nu->setRequired(true);
755 $nu->setMinValue(1);
756 $this->form->addItem($nu);
757
758 // Recurrence
759 include_once('./Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php');
760 $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'),'frequence');
761 $rec->setEnabledSubForms(
762 array(
766 )
767 );
768 $this->form->addItem($rec);
769 }
770
771 // Number of bookings
772 $nu = new ilNumberInputGUI($this->lng->txt('cal_ch_num_bookings'),'bo');
773 $nu->setSize(2);
774 $nu->setMaxLength(2);
775 $nu->setMinValue(1);
776 $nu->setRequired(true);
777 $this->form->addItem($nu);
778
779 // Deadline
780 $dead = new ilDurationInputGUI($this->lng->txt('cal_ch_deadline'),'dead');
781 $dead->setInfo($this->lng->txt('cal_ch_deadline_info'));
782 $dead->setShowMinutes(false);
783 $dead->setShowHours(true);
784 $dead->setShowDays(true);
785 $this->form->addItem($dead);
786
787 // Location
788 $lo = new ilTextInputGUI($this->lng->txt('cal_where'),'lo');
789 $lo->setSize(32);
790 $lo->setMaxLength(128);
791 $this->form->addItem($lo);
792
793 // Description
794 $de = new ilTextAreaInputGUI($this->lng->txt('description'),'de');
795 $de->setRows(10);
796 $de->setCols(60);
797 $this->form->addItem($de);
798
799 // Target Object
800 $tgt = new ilTextInputGUI($this->lng->txt('cal_ch_target_object'),'tgt');
801 $tgt->setInfo($this->lng->txt('cal_ch_target_object_info'));
802 $tgt->setSize(16);
803 $tgt->setMaxLength(128);
804 $this->form->addItem($tgt);
805 }
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.
if(!is_array($argv)) $options

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

486 {
487 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
488 $group = new ilConsultationHourGroup($a_group_id);
489
490 include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
491 $form = new ilPropertyFormGUI();
492 $form->setFormAction($GLOBALS['ilCtrl']->getFormAction($this));
493
494 if($a_group_id)
495 {
496 $form->setTitle($GLOBALS['lng']->txt('cal_ch_grp_update_tbl'));
497 $form->addCommandButton('updateGroup', $GLOBALS['lng']->txt('save'));
498 $form->addCommandButton('groupList', $GLOBALS['lng']->txt('cancel'));
499 }
500 else
501 {
502 $form->setTitle($GLOBALS['lng']->txt('cal_ch_grp_add_tbl'));
503 $form->addCommandButton('saveGroup', $GLOBALS['lng']->txt('save'));
504 $form->addCommandButton('appointmentList', $GLOBALS['lng']->txt('cancel'));
505 }
506
507 $title = new ilTextInputGUI($GLOBALS['lng']->txt('title'),'title');
508 $title->setMaxLength(128);
509 $title->setSize(40);
510 $title->setRequired(true);
511 $title->setValue($group->getTitle());
512 $form->addItem($title);
513
514 $multiple = new ilNumberInputGUI($GLOBALS['lng']->txt('cal_ch_grp_multiple'),'multiple');
515 $multiple->setRequired(true);
516 $multiple->setMinValue(1);
517 $multiple->setSize(1);
518 $multiple->setMaxLength(2);
519 $multiple->setInfo($GLOBALS['lng']->txt('cal_ch_grp_multiple_info'));
520 $multiple->setValue($group->getMaxAssignments());
521 $form->addItem($multiple);
522
523 return $form;
524 }

References $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 1285 of file class.ilConsultationHoursGUI.php.

1286 {
1287 global $ilDB, $ilUser;
1288
1289 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1290
1291 $form = new ilPropertyFormGUI();
1292 $form->setFormAction($this->ctrl->getFormAction($this));
1293
1294 $mng = new ilTextInputGUI($this->lng->txt('cal_ch_manager'), 'mng');
1295 $mng->setInfo($this->lng->txt('cal_ch_manager_info'));
1296 $form->addItem($mng);
1297
1298 $mng->setValue(ilConsultationHourAppointments::getManager(true));
1299
1300 $form->setTitle($this->lng->txt('settings'));
1301 $form->addCommandButton('updateSettings', $this->lng->txt('save'));
1302 // $form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
1303 return $form;
1304 }
static getManager($a_as_name=false)
Get consultation hour manager for current user.
global $ilDB

References $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 616 of file class.ilConsultationHoursGUI.php.

617 {
618 global $ilCtrl;
619
620 foreach((array) $_REQUEST['bookuser'] as $bookuser)
621 {
622 $ids = explode('_',$bookuser);
623
624 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
625 ilConsultationHourUtils::cancelBooking($ids[1],$ids[0],$a_send_notification);
626 }
627 if($a_send_notification)
628 {
629 ilUtil::sendSuccess($this->lng->txt('cal_ch_canceled_bookings'),true);
630 }
631 else
632 {
633 ilUtil::sendSuccess($this->lng->txt('cal_ch_deleted_bookings'),true);
634 }
635 $ilCtrl->redirect($this,'bookingList');
636 }

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:

◆ saveGroup()

ilConsultationHoursGUI::saveGroup ( )
protected

Save new group.

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

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

References $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 811 of file class.ilConsultationHoursGUI.php.

812 {
813 global $ilObjDataCache;
814
815 $this->initFormSequence(self::MODE_CREATE);
816
817 if($this->form->checkInput())
818 {
819 $this->form->setValuesByPost();
820
821 $booking = new ilBookingEntry();
822 $booking->setObjId($this->getUserId());
823 $booking->setNumberOfBookings($this->form->getInput('bo'));
824
825 $deadline = $this->form->getInput('dead');
826 $deadline = $deadline['dd'] * 24 + $deadline['hh'];
827 $booking->setDeadlineHours($deadline);
828
829 // consultation hour group
830 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
832 {
833 $booking->setBookingGroup((int) $this->form->getInput('grp'));
834 }
835
836 $tgt = explode(',',$this->form->getInput('tgt'));
837 $obj_ids = array();
838 foreach((array) $tgt as $ref_id)
839 {
840 if(!trim($ref_id))
841 {
842 continue;
843 }
844 $obj_id = $ilObjDataCache->lookupObjId($ref_id);
845 $type = ilObject::_lookupType($obj_id);
846 $valid_types = array('crs','grp');
847 if(!$obj_id or !in_array($type, $valid_types))
848 {
849 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_repository_object'));
850 $this->tpl->setContent($this->form->getHTML());
851 return;
852 }
853
854 $obj_ids[] = $obj_id;
855 }
856 $booking->setTargetObjIds($obj_ids);
857
858 $booking->save();
860
861 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
862 $this->ctrl->redirect($this,'appointmentList');
863 }
864 else
865 {
866 $this->form->setValuesByPost();
867 $this->tpl->setContent($this->form->getHTML());
868 }
869 }
createAppointments(ilBookingEntry $booking)
Create calendar appointments.
static _lookupType($a_id, $a_reference=false)
lookup object type
$ref_id
Definition: sahs_server.php:39

References $booking, $ref_id, 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 165 of file class.ilConsultationHoursGUI.php.

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

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

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

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

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

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

◆ setSubTabs()

ilConsultationHoursGUI::setSubTabs ( )
protected

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

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

979 {
980 global $ilTabs, $ilCtrl;
981
982 $ilCtrl->setParameter($this,'user_id',$this->getUserId());
983 $ilTabs->addSubTab('cal_ch_app_list',$this->lng->txt('cal_ch_app_list'),$ilCtrl->getLinkTarget($this,'appointmentList'));
984 $ilTabs->addSubTab('cal_ch_app_grp',$this->lng->txt('cal_ch_app_grp'),$ilCtrl->getLinkTarget($this,'groupList'));
985 $ilTabs->addSubTab('cal_ch_app_bookings',$this->lng->txt('cal_ch_app_bookings'),$ilCtrl->getLinkTarget($this,'bookingList'));
986 }

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

955 {
956 global $ilTabs, $ilUser, $ilCtrl;
957
958 $ilCtrl->setParameter($this, 'user_id', '');
959 $ilTabs->addTab('consultation_hours_'.$ilUser->getId(), $this->lng->txt('cal_ch_ch'), $this->ctrl->getLinkTarget($this,'appointmentList'));
960
962 {
963 $ilCtrl->setParameter($this, 'user_id', $user_id);
964 $ilTabs->addTab('consultation_hours_'.$user_id, $this->lng->txt('cal_ch_ch').': '.$login, $this->ctrl->getLinkTarget($this,'appointmentList'));
965 }
966 $ilCtrl->setParameter($this, 'user_id', '');
967
968 $ilTabs->addTab('ch_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this,'settings'));
969
970 $ilTabs->activateTab('consultation_hours_'.$this->getUserId());
971 }

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

1271 {
1272 global $tpl, $ilTabs, $ilHelp;
1273
1274 $ilHelp->setScreenId("consultation_hours_settings");
1275 $ilTabs->activateTab('ch_settings');
1276
1277 $form = $this->initSettingsForm();
1278 $tpl->setContent($form->getHTML());
1279 }

References $tpl, and initSettingsForm().

+ Here is the call graph for this function:

◆ showProfile()

ilConsultationHoursGUI::showProfile ( )

show public profile of given user

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

1229 {
1230 global $tpl, $ilTabs, $ilCtrl;
1231
1232 $ilTabs->clearTargets();
1233
1234 $user_id = (int)$_GET['user'];
1235
1236 include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
1237 $profile = new ilPublicUserProfileGUI($user_id);
1238 $profile->setBackUrl($this->getProfileBackUrl());
1239 $tpl->setContent($ilCtrl->getHTML($profile));
1240 }

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

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

References $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 1050 of file class.ilConsultationHoursGUI.php.

1051 {
1052 global $ilObjDataCache;
1053
1054 $this->initFormSequence(self::MODE_MULTI);
1055
1056 if($this->form->checkInput())
1057 {
1058 $this->form->setValuesByPost();
1059 $apps = explode(';', $_POST['apps']);
1060
1061 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1062 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1063
1064 // do collision-check if max bookings were reduced
1065 // no collision check
1066 $first = $apps;
1067 $first = array_shift($first);
1069 #if($this->form->getInput('bo') < $entry->getNumberOfBookings())
1070 #{
1071 # $this->edit();
1072 # return;
1073 #}
1074
1075 // create new context
1076 $booking = new ilBookingEntry();
1077
1078 $booking->setObjId($this->getUserId());
1079 $booking->setNumberOfBookings($this->form->getInput('bo'));
1080
1081 $deadline = $this->form->getInput('dead');
1082 $deadline = $deadline['dd']*24+$deadline['hh'];
1083 $booking->setDeadlineHours($deadline);
1084
1085 $tgt = explode(',',$this->form->getInput('tgt'));
1086 $obj_ids = array();
1087 foreach((array) $tgt as $ref_id)
1088 {
1089 if(!trim($ref_id))
1090 {
1091 continue;
1092 }
1093 $obj_id = $ilObjDataCache->lookupObjId($ref_id);
1094 $type = ilObject::_lookupType($obj_id);
1095 $valid_types = array('crs','grp');
1096 if(!$obj_id or !in_array($type, $valid_types))
1097 {
1098 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_repository_object'));
1099 $this->edit();
1100 return;
1101 }
1102 $obj_ids[] = $obj_id;
1103 }
1104 $booking->setTargetObjIds($obj_ids);
1105
1106 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
1108 {
1109 $booking->setBookingGroup($this->form->getInput('grp'));
1110 }
1111 $booking->save();
1112
1113
1114 // update entries
1115 $title = $this->form->getInput('ti');
1116 $location = $this->form->getInput('lo');
1117 $description = $this->form->getInput('de');
1118
1119 foreach($apps as $item_id)
1120 {
1121 $entry = new ilCalendarEntry($item_id);
1122 $entry->setContextId($booking->getId());
1123 $entry->setTitle($title);
1124 $entry->setLocation($location);
1125 $entry->setDescription($description);
1126 $entry->update();
1127 }
1128
1130
1131 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1132 $this->ctrl->redirect($this,'appointmentList');
1133 }
1134 $this->tpl->setContent($this->form->getHTML());
1135 }
$location
Definition: buildRTE.php:44
static getCountGroupsOfUser($a_user_id)
Get number of consultation hour groups @global type $ilDB.
edit()
Edit multiple sequence items.

References $_POST, $booking, $location, $ref_id, $title, ilObject\_lookupType(), edit(), ilConsultationHourGroups\getCountGroupsOfUser(), ilBookingEntry\getInstanceByCalendarEntryId(), getUserId(), initFormSequence(), ilBookingEntry\removeObsoleteEntries(), ilUtil\sendFailure(), and ilUtil\sendSuccess().

+ Here is the call graph for this function:

◆ updateSettings()

ilConsultationHoursGUI::updateSettings ( )

save settings

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

1310 {
1311 global $ilDB, $ilCtrl, $ilUser, $tpl, $ilTabs;
1312
1313 $form = $this->initSettingsForm();
1314 if($form->checkInput())
1315 {
1316 $mng = $form->getInput('mng');
1318 {
1319 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1320 $ilCtrl->redirect($this, 'settings');
1321 }
1322 else
1323 {
1324 $ilTabs->activateTab('ch_settings');
1325
1326 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_user'));
1327 $field = $form->getItemByPostVar('mng');
1328 $field->setValue($mng);
1329 $tpl->setContent($form->getHTML());
1330 return;
1331 }
1332 }
1333 }
static setManager($a_user_name)
Set consultation hour manager for current user.

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

+ Here is the call graph for this function:

Field Documentation

◆ $booking

ilConsultationHoursGUI::$booking = null
protected

◆ $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: