ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
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
 

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

49 {
50 global $lng, $ilCtrl, $tpl, $ilUser;
51
52 $user_id = (int)$_GET['user_id'];
53 if($user_id)
54 {
56 {
57 $this->user_id = $user_id;
58 }
59 else
60 {
61 $user_id = false;
62 }
63 }
64 if(!$user_id)
65 {
66 $this->user_id = $ilUser->getId();
67 }
68
69 $this->ctrl = $ilCtrl;
70 $this->lng = $lng;
71 $this->tpl = $tpl;
72 }
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:40
global $ilUser
Definition: imgupload.php:15

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

342 {
343 global $ilTabs, $tpl;
344
345 $this->setSubTabs();
346 $ilTabs->activateSubTab('cal_ch_app_grp');
347
348 if($form == null)
349 {
350 $form = $this->initGroupForm();
351 }
352 $tpl->setContent($form->getHTML());
353 }
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 639 of file class.ilConsultationHoursGUI.php.

640 {
641 global $ilToolbar, $ilHelp, $ilTabs;
642
643 $ilHelp->setScreenId("consultation_hours");
644
645 $ilToolbar->setFormAction($this->ctrl->getFormAction($this));
646 $ilToolbar->addButton($this->lng->txt('cal_ch_add_sequence'),$this->ctrl->getLinkTarget($this,'createSequence'));
647
648 $this->setSubTabs();
649 $ilTabs->activateSubTab('cal_ch_app_list');
650
651 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHoursTableGUI.php';
652 $tbl = new ilConsultationHoursTableGUI($this,'appointmentList',$this->getUserId());
653 $tbl->parse();
654 $this->tpl->setContent($tbl->getHTML());
655 }
Consultation hours administration.

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

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

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

203 {
204 global $ilCtrl;
205
206 $unassigned_users = array();
207 foreach($_SESSION['ch_apps'] as $app)
208 {
209 $unassigned_users = array_unique(array_merge($unassigned_users,$this->assignUsersToAppointment($users,$app,false)));
210 }
211
212 $this->sendInfoAboutUnassignedUsers($unassigned_users);
213 $ilCtrl->redirect($this,'appointmentList');
214 }
assignUsersToAppointment(array $users, $a_app=0, $a_redirect=true)
Assign users to an appointment.
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']

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

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

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

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

1127 {
1128 global $tpl;
1129
1130 if(!isset($_REQUEST['apps']))
1131 {
1132 ilUtil::sendFailure($this->lng->txt('select_one'));
1133 return $this->appointmentList();
1134 }
1135
1136 include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
1137
1138
1139 $this->ctrl->saveParameter($this,array('seed','app_id','dt'));
1140
1141 $confirm = new ilConfirmationGUI();
1142 $confirm->setFormAction($this->ctrl->getFormAction($this));
1143 $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
1144 $confirm->setCancel($this->lng->txt('cancel'),'cancel');
1145
1146 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1147
1148 $bookings_available = array();
1149 foreach((array) $_REQUEST['apps'] as $entry_id)
1150 {
1151 $entry = new ilCalendarEntry($entry_id);
1152 $confirm->addItem('apps[]', $entry_id, ilDatePresentation::formatDate($entry->getStart()).', '.$entry->getTitle());
1153
1154 include_once './Services/Booking/classes/class.ilBookingEntry.php';
1156 {
1157 $bookings_available[] = ilDatePresentation::formatDate($entry->getStart()).', '.$entry->getTitle();
1158 }
1159 }
1160
1161 if($bookings_available)
1162 {
1163 ilUtil::sendInfo($this->lng->txt('cal_ch_delete_app_booking_info').'<br />'.implode('<br />',$bookings_available));
1164 }
1165
1166 $confirm->setConfirm($this->lng->txt('delete'),'delete');
1167 $confirm->setCancel($this->lng->txt('cancel'),'appointmentList');
1168
1169 $tpl->setContent($confirm->getHTML());
1170 }
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 $_REQUEST, $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 541 of file class.ilConsultationHoursGUI.php.

542 {
543 $this->confirmRejectBooking(false);
544 }
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 433 of file class.ilConsultationHoursGUI.php.

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

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

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

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

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

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

662 {
663 $this->initFormSequence(self::MODE_CREATE);
664
665 $this->booking = new ilBookingEntry();
666 $this->form->getItemByPostVar('bo')->setValue($this->booking->getNumberOfBookings());
667 $this->form->getItemByPostVar('ap')->setValue(1);
668 $this->form->getItemByPostVar('du')->setMinutes(15);
669 $this->form->getItemByPostVar('st')->setDate(
670 new ilDateTime(mktime(8,0,0,date('n',time()),date('d',time()),date('Y',time())),IL_CAL_UNIX));
671
672 $this->tpl->setContent($this->form->getHTML());
673 }
Booking definition.

References IL_CAL_UNIX, and initFormSequence().

+ Here is the call graph for this function:

◆ delete()

ilConsultationHoursGUI::delete ( )

delete multiple entries

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

1176 {
1177 if(!isset($_POST['apps']))
1178 {
1179 ilUtil::sendFailure($this->lng->txt('select_one'));
1180 return $this->appointmentList();
1181 }
1182
1183 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1184 include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1185 foreach($_POST['apps'] as $entry_id)
1186 {
1187 // cancel booking for users
1189 if($booking)
1190 {
1191 foreach($booking->getCurrentBookings($entry_id) as $user_id)
1192 {
1193 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1195 }
1196 }
1197 // remove calendar entries
1198 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1199 $entry = new ilCalendarEntry($entry_id);
1200 $entry->delete();
1201
1203 }
1204
1206
1207 ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
1208 $this->ctrl->redirect($this, 'appointmentList');
1209 }
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.
$_POST['username']
Definition: cron.php:12

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

604 {
605 $this->rejectBooking(false);
606 }
rejectBooking($a_send_notification=true)

References rejectBooking().

+ Here is the call graph for this function:

◆ deleteGroup()

ilConsultationHoursGUI::deleteGroup ( )
protected

Delete groups.

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

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

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

+ Here is the call graph for this function:

◆ edit()

ilConsultationHoursGUI::edit ( )

Edit multiple sequence items.

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

978 {
979 global $ilTabs;
980
981 if(!isset($_REQUEST['apps']))
982 {
983 ilUtil::sendFailure($this->lng->txt('select_one'));
984 return $this->appointmentList();
985 }
986
987 $this->initFormSequence(self::MODE_MULTI);
988
989 if($_REQUEST['apps'] && !is_array($_REQUEST['apps']))
990 {
991 $_REQUEST['apps'] = explode(';', $_REQUEST['apps']);
992 }
993
994 $hidden = new ilHiddenInputGUI('apps');
995 $hidden->setValue(implode(';', $_REQUEST['apps']));
996 $this->form->addItem($hidden);
997
998 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
999 $first = $_REQUEST['apps'];
1000 $first = array_shift($_REQUEST['apps']);
1001 $entry = new ilCalendarEntry($first);
1002
1003 $this->form->getItemByPostVar('ti')->setValue($entry->getTitle());
1004 $this->form->getItemByPostVar('lo')->setValue($entry->getLocation());
1005 $this->form->getItemByPostVar('de')->setValue($entry->getDescription());
1006
1007 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1008 $booking = new ilBookingEntry($entry->getContextId());
1009
1010 $this->form->getItemByPostVar('bo')->setValue($booking->getNumberOfBookings());
1011
1012 $ref_ids = array();
1013 foreach($booking->getTargetObjIds() as $obj_id)
1014 {
1015 $refs = ilObject::_getAllReferences($obj_id);
1016 $ref_ids[] = end($refs);
1017 }
1018 $this->form->getItemByPostVar('tgt')->setValue(implode(',',$ref_ids));
1019
1020 $deadline = $booking->getDeadlineHours();
1021 $this->form->getItemByPostVar('dead')->setDays(floor($deadline/24));
1022 $this->form->getItemByPostVar('dead')->setHours($deadline%24);
1023
1024 if($booking->getBookingGroup())
1025 {
1026 $this->form->getItemByPostVar('grp')->setValue($booking->getBookingGroup());
1027 }
1028
1029 $this->tpl->setContent($this->form->getHTML());
1030 }
This class represents a hidden form property in a property form.
static _getAllReferences($a_id)
get all reference ids of object

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

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

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

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

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

1234 {
1235 // from repository
1236 if(isset($_REQUEST["ref_id"]))
1237 {
1238 $url = $this->ctrl->getLinkTargetByClass('ilCalendarMonthGUI');
1239 }
1240 // from panel
1241 else if(isset($_GET['panel']))
1242 {
1243 $url = $this->ctrl->getLinkTargetByClass('ilCalendarPresentationGUI');
1244 }
1245 // from appointments
1246 else
1247 {
1248 $url = $this->ctrl->getLinkTarget($this, 'appointmentList');
1249 }
1250 return $url;
1251 }

References $_GET, and $_REQUEST.

Referenced by executeCommand(), and showProfile().

+ Here is the caller graph for this function:

◆ getUserId()

ilConsultationHoursGUI::getUserId ( )

Get user id.

Returns

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

154 {
155 return $this->user_id;
156 }

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

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

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

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

References $GLOBALS.

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

+ Here is the caller graph for this function:

◆ initSettingsForm()

ilConsultationHoursGUI::initSettingsForm ( )
protected

build settings form

Returns
object

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

1272 {
1273 global $ilDB, $ilUser;
1274
1275 include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1276
1277 $form = new ilPropertyFormGUI();
1278 $form->setFormAction($this->ctrl->getFormAction($this));
1279
1280 $mng = new ilTextInputGUI($this->lng->txt('cal_ch_manager'), 'mng');
1281 $mng->setInfo($this->lng->txt('cal_ch_manager_info'));
1282 $form->addItem($mng);
1283
1284 $mng->setValue(ilConsultationHourAppointments::getManager(true));
1285
1286 $form->setTitle($this->lng->txt('settings'));
1287 $form->addCommandButton('updateSettings', $this->lng->txt('save'));
1288 // $form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
1289 return $form;
1290 }
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 612 of file class.ilConsultationHoursGUI.php.

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

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

359 {
360 $form = $this->initGroupForm();
361 if($form->checkInput())
362 {
363 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroup.php';
364 $group = new ilConsultationHourGroup();
365 $group->setTitle($form->getInput('title'));
366 $group->setMaxAssignments($form->getInput('multiple'));
367 $group->setUserId($this->getUserId());
368 $group->save();
369
370 ilUtil::sendSuccess($GLOBALS['lng']->txt('settings_saved'),true);
371 $GLOBALS['ilCtrl']->redirect($this,'groupList');
372 }
373
374 ilUtil::sendFailure($GLOBALS['lng']->txt('err_check_input'),true);
375 $this->addGroup($form);
376 }
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 807 of file class.ilConsultationHoursGUI.php.

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

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

References $_REQUEST, $_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 182 of file class.ilConsultationHoursGUI.php.

183 {
184 if(!$unassigned)
185 {
186 return true;
187 }
188 $users = array();
189 foreach($unassigned as $user_id)
190 {
191 include_once './Services/User/classes/class.ilObjUser.php';
193 }
194 ilUtil::sendInfo($this->lng->txt('cal_ch_user_assignment_failed_info').'<br />'.implode('<br />', $users),true);
195 return true;
196 }
_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 964 of file class.ilConsultationHoursGUI.php.

965 {
966 global $ilTabs, $ilCtrl;
967
968 $ilCtrl->setParameter($this,'user_id',$this->getUserId());
969 $ilTabs->addSubTab('cal_ch_app_list',$this->lng->txt('cal_ch_app_list'),$ilCtrl->getLinkTarget($this,'appointmentList'));
970 $ilTabs->addSubTab('cal_ch_app_grp',$this->lng->txt('cal_ch_app_grp'),$ilCtrl->getLinkTarget($this,'groupList'));
971 $ilTabs->addSubTab('cal_ch_app_bookings',$this->lng->txt('cal_ch_app_bookings'),$ilCtrl->getLinkTarget($this,'bookingList'));
972 }

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

941 {
942 global $ilTabs, $ilUser, $ilCtrl;
943
944 $ilCtrl->setParameter($this, 'user_id', '');
945 $ilTabs->addTab('consultation_hours_'.$ilUser->getId(), $this->lng->txt('cal_ch_ch'), $this->ctrl->getLinkTarget($this,'appointmentList'));
946
948 {
949 $ilCtrl->setParameter($this, 'user_id', $user_id);
950 $ilTabs->addTab('consultation_hours_'.$user_id, $this->lng->txt('cal_ch_ch').': '.$login, $this->ctrl->getLinkTarget($this,'appointmentList'));
951 }
952 $ilCtrl->setParameter($this, 'user_id', '');
953
954 $ilTabs->addTab('ch_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this,'settings'));
955
956 $ilTabs->activateTab('consultation_hours_'.$this->getUserId());
957 }

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

1257 {
1258 global $tpl, $ilTabs, $ilHelp;
1259
1260 $ilHelp->setScreenId("consultation_hours_settings");
1261 $ilTabs->activateTab('ch_settings');
1262
1263 $form = $this->initSettingsForm();
1264 $tpl->setContent($form->getHTML());
1265 }

References $tpl, and initSettingsForm().

+ Here is the call graph for this function:

◆ showProfile()

ilConsultationHoursGUI::showProfile ( )

show public profile of given user

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

1215 {
1216 global $tpl, $ilTabs, $ilCtrl;
1217
1218 $ilTabs->clearTargets();
1219
1220 $user_id = (int)$_GET['user'];
1221
1222 include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
1223 $profile = new ilPublicUserProfileGUI($user_id);
1224 $profile->setBackUrl($this->getProfileBackUrl());
1225 $tpl->setContent($ilCtrl->getHTML($profile));
1226 }

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

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

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

1037 {
1038 global $ilObjDataCache;
1039
1040 $this->initFormSequence(self::MODE_MULTI);
1041
1042 if($this->form->checkInput())
1043 {
1044 $this->form->setValuesByPost();
1045 $apps = explode(';', $_POST['apps']);
1046
1047 include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1048 include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1049
1050 // do collision-check if max bookings were reduced
1051 // no collision check
1052 $first = $apps;
1053 $first = array_shift($first);
1055 #if($this->form->getInput('bo') < $entry->getNumberOfBookings())
1056 #{
1057 # $this->edit();
1058 # return;
1059 #}
1060
1061 // create new context
1062 $booking = new ilBookingEntry();
1063
1064 $booking->setObjId($this->getUserId());
1065 $booking->setNumberOfBookings($this->form->getInput('bo'));
1066
1067 $deadline = $this->form->getInput('dead');
1068 $deadline = $deadline['dd']*24+$deadline['hh'];
1069 $booking->setDeadlineHours($deadline);
1070
1071 $tgt = explode(',',$this->form->getInput('tgt'));
1072 $obj_ids = array();
1073 foreach((array) $tgt as $ref_id)
1074 {
1075 if(!trim($ref_id))
1076 {
1077 continue;
1078 }
1079 $obj_id = $ilObjDataCache->lookupObjId($ref_id);
1080 $type = ilObject::_lookupType($obj_id);
1081 $valid_types = array('crs','grp');
1082 if(!$obj_id or !in_array($type, $valid_types))
1083 {
1084 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_repository_object'));
1085 $this->edit();
1086 return;
1087 }
1088 $obj_ids[] = $obj_id;
1089 }
1090 $booking->setTargetObjIds($obj_ids);
1091
1092 include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
1094 {
1095 $booking->setBookingGroup($this->form->getInput('grp'));
1096 }
1097 $booking->save();
1098
1099
1100 // update entries
1101 $title = $this->form->getInput('ti');
1102 $location = $this->form->getInput('lo');
1103 $description = $this->form->getInput('de');
1104
1105 foreach($apps as $item_id)
1106 {
1107 $entry = new ilCalendarEntry($item_id);
1108 $entry->setContextId($booking->getId());
1109 $entry->setTitle($title);
1110 $entry->setLocation($location);
1111 $entry->setDescription($description);
1112 $entry->update();
1113 }
1114
1116
1117 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1118 $this->ctrl->redirect($this,'appointmentList');
1119 }
1120 $this->tpl->setContent($this->form->getHTML());
1121 }
$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, 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 1295 of file class.ilConsultationHoursGUI.php.

1296 {
1297 global $ilDB, $ilCtrl, $ilUser, $tpl, $ilTabs;
1298
1299 $form = $this->initSettingsForm();
1300 if($form->checkInput())
1301 {
1302 $mng = $form->getInput('mng');
1304 {
1305 ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1306 $ilCtrl->redirect($this, 'settings');
1307 }
1308 else
1309 {
1310 $ilTabs->activateTab('ch_settings');
1311
1312 ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_user'));
1313 $field = $form->getItemByPostVar('mng');
1314 $field->setValue($mng);
1315 $tpl->setContent($form->getHTML());
1316 return;
1317 }
1318 }
1319 }
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 41 of file class.ilConsultationHoursGUI.php.

◆ $user_id

ilConsultationHoursGUI::$user_id
protected

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