ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
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 type $ilToolbar. More...
 
 addGroup (ilPropertyFormGUI $form=null)
 Show add group form type $ilToolbar type $ilTabs. More...
 
 saveGroup ()
 Save new group. More...
 
 editGroup (ilPropertyFormGUI $form=null)
 Edit group type $ilCtrl. More...
 
 updateGroup ()
 Update group type $ilCtrl type $tpl type $ilTabs. More...
 
 confirmDeleteGroup ()
 Confirm delete type $ilCtrl 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 type $ilTabs 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.

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

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  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
static getManagedUsers()
Get all managed consultation hours users for current users.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $ilUser
Definition: imgupload.php:15
global $lng
Definition: privfeed.php:40
+ Here is the call graph for this function:

Member Function Documentation

◆ addGroup()

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

Show add group form type $ilToolbar type $ilTabs.

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

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

Referenced by saveGroup().

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 type $ilTabs type $ilCtrl.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ 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.

References getUserId(), and setSubTabs().

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

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  }
setSubTabs()
Set sub tabs type $ilTabs type $ilCtrl.
Consultation hours administration.
+ 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.

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

Referenced by assignUsersToAppointments().

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 getInstanceByCalendarEntryId($a_id)
Get instance by calendar entry.
global $ilCtrl
Definition: ilias.php:18
sendInfoAboutUnassignedUsers($unassigned)
Send info message about unassigned users.
static lookupBookingsOfUser($a_app_ids, $a_usr_id, ilDateTime $start=null)
Lookup bookings if user.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static bookAppointment($a_usr_id, $a_app_id)
Book an appointment.
+ 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.

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

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  }
< 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']
global $ilCtrl
Definition: ilias.php:18
sendInfoAboutUnassignedUsers($unassigned)
Send info message about unassigned users.
assignUsersToAppointment(array $users, $a_app=0, $a_redirect=true)
Assign users to an appointment.
+ 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.

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

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  }
static getInstanceByCalendarEntryId($a_id)
Get instance by calendar entry.
const IL_CAL_UNIX
global $ilCtrl
Definition: ilias.php:18
const IL_CAL_DAY
Date and time handling
sendInfoAboutUnassignedUsers($unassigned)
Send info message about unassigned users.
static getAppointmentIdsByGroup($a_user_id, $a_ch_group_id, ilDateTime $start=null)
Get appointment ids by consultation hour group.
static lookupBookingsOfUser($a_app_ids, $a_usr_id, ilDateTime $start=null)
Lookup bookings if user.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
static bookAppointment($a_usr_id, $a_app_id)
Book an appointment.
+ 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.

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

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.
setSubTabs()
Set sub tabs type $ilTabs type $ilCtrl.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the call graph for this function:

◆ confirmDelete()

ilConsultationHoursGUI::confirmDelete ( )

confirm delete for multiple entries

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

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

1126  {
1127  global $tpl;
1128 
1129  if(!isset($_REQUEST['apps']))
1130  {
1131  ilUtil::sendFailure($this->lng->txt('select_one'));
1132  return $this->appointmentList();
1133  }
1134 
1135  include_once('./Services/Utilities/classes/class.ilConfirmationGUI.php');
1136 
1137 
1138  $this->ctrl->saveParameter($this,array('seed','app_id','dt'));
1139 
1140  $confirm = new ilConfirmationGUI();
1141  $confirm->setFormAction($this->ctrl->getFormAction($this));
1142  $confirm->setHeaderText($this->lng->txt('cal_delete_app_sure'));
1143  $confirm->setCancel($this->lng->txt('cancel'),'cancel');
1144 
1145  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1146 
1147  $bookings_available = array();
1148  foreach((array) $_REQUEST['apps'] as $entry_id)
1149  {
1150  $entry = new ilCalendarEntry($entry_id);
1151  $confirm->addItem('apps[]', $entry_id, ilDatePresentation::formatDate($entry->getStart()).', '.$entry->getTitle());
1152 
1153  include_once './Services/Booking/classes/class.ilBookingEntry.php';
1155  {
1156  $bookings_available[] = ilDatePresentation::formatDate($entry->getStart()).', '.$entry->getTitle();
1157  }
1158  }
1159 
1160  if($bookings_available)
1161  {
1162  ilUtil::sendInfo($this->lng->txt('cal_ch_delete_app_booking_info').'<br />'.implode('<br />',$bookings_available));
1163  }
1164 
1165  $confirm->setConfirm($this->lng->txt('delete'),'delete');
1166  $confirm->setCancel($this->lng->txt('cancel'),'appointmentList');
1167 
1168  $tpl->setContent($confirm->getHTML());
1169  }
Model for a calendar entry.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
static lookupBookingsForAppointment($a_app_id)
Lookup booked users for appointment type $ilDB.
static formatDate(ilDateTime $date)
Format a date public.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
appointmentList()
Show settings of consultation hours.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
Confirmation screen class.
+ 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.

References confirmRejectBooking().

542  {
543  $this->confirmRejectBooking(false);
544  }
confirmRejectBooking($a_send_notification=true)
Show delete booking confirmation.
+ Here is the call graph for this function:

◆ confirmDeleteGroup()

ilConsultationHoursGUI::confirmDeleteGroup ( )
protected

Confirm delete type $ilCtrl type $ilTabs.

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

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

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  }
global $ilCtrl
Definition: ilias.php:18
$GLOBALS['ct_recipient']
setSubTabs()
Set sub tabs type $ilTabs type $ilCtrl.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
Confirmation screen class.
+ 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.

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

Referenced by confirmDeleteBooking().

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  }
Model for a calendar entry.
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:
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
setSubTabs()
Set sub tabs type $ilTabs type $ilCtrl.
static formatDate(ilDateTime $date)
Format a date public.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
Confirmation screen class.
+ 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.

References ilCalendarCategoryAssignments\addAssignment(), ilCalendarRecurrenceCalculator\calculateDateList(), ilBookingEntry\getId(), getUserId(), ilDateTime\HOUR, IL_CAL_TRANSLATION_SYSTEM, ilCalendarUtil\initDefaultCalendarByType(), ilDateTime\MINUTE, ilCalendarCategory\TYPE_CH, and ilDateList\TYPE_DATETIME.

Referenced by saveSequence().

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 
900  $calc = new ilCalendarRecurrenceCalculator(
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 
916 
917  $entry = new ilCalendarEntry();
918  $entry->setContextId($booking->getId());
919  $entry->setTitle($this->form->getInput('ti'));
920  $entry->setSubtitle("#consultationhour#"); // dynamic, see ilCalendarEntry
921  $entry->setDescription($this->form->getInput('de'));
922  $entry->setLocation($this->form->getInput('lo'));
923  $entry->setStart($app_start);
924  $entry->setEnd($app_end);
925 
926  $entry->setTranslationType(IL_CAL_TRANSLATION_SYSTEM);
927  $entry->save();
928 
929  $cat_assign = new ilCalendarCategoryAssignments($entry->getEntryId());
930  $cat_assign->addAssignment($def_cat->getCategoryID());
931  }
932  }
933  }
Model for a calendar entry.
const IL_CAL_TRANSLATION_SYSTEM
calculateDateList(ilDateTime $a_start, ilDateTime $a_end, $a_limit=-1)
calculate date list
Calculates an ilDateList for a given calendar entry and recurrence rule.
List of dates.
static initDefaultCalendarByType($a_type_id, $a_usr_id, $a_title, $a_create=false)
Init the default calendar for given type and user.
Booking period Used for calculation of recurring events.
+ 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.

References IL_CAL_UNIX, and initFormSequence().

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.
const IL_CAL_UNIX
Date and time handling
+ Here is the call graph for this function:

◆ delete()

ilConsultationHoursGUI::delete ( )

delete multiple entries

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

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

1175  {
1176  if(!isset($_POST['apps']))
1177  {
1178  ilUtil::sendFailure($this->lng->txt('select_one'));
1179  return $this->appointmentList();
1180  }
1181 
1182  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1183  include_once 'Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
1184  foreach($_POST['apps'] as $entry_id)
1185  {
1186  // cancel booking for users
1188  if($booking)
1189  {
1190  foreach($booking->getCurrentBookings($entry_id) as $user_id)
1191  {
1192  include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourUtils.php';
1194  }
1195  }
1196  // remove calendar entries
1197  include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
1198  $entry = new ilCalendarEntry($entry_id);
1199  $entry->delete();
1200 
1202  }
1203 
1205 
1206  ilUtil::sendSuccess($this->lng->txt('cal_deleted_app'), true);
1207  $this->ctrl->redirect($this, 'appointmentList');
1208  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
$_POST['username']
Definition: cron.php:12
static removeObsoleteEntries()
Remove unused booking entries.
static getInstanceByCalendarEntryId($a_id)
Get instance by calendar entry.
static _deleteByAppointmentId($a_app_id)
Delete appointment assignment.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static cancelBooking($a_usr_id, $a_app_id, $a_send_notification=true)
Cancel a booking.
appointmentList()
Show settings of consultation hours.
+ Here is the call graph for this function:

◆ deleteBooking()

ilConsultationHoursGUI::deleteBooking ( )
protected

Delete booking.

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

References rejectBooking().

604  {
605  $this->rejectBooking(false);
606  }
rejectBooking($a_send_notification=true)
+ Here is the call graph for this function:

◆ deleteGroup()

ilConsultationHoursGUI::deleteGroup ( )
protected

Delete groups.

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

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

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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
$GLOBALS['ct_recipient']
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ edit()

ilConsultationHoursGUI::edit ( )

Edit multiple sequence items.

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

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

Referenced by updateMulti().

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

Parameters
ilPropertyFormGUI$form

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

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

Referenced by updateGroup().

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  }
initGroupForm($a_group_id=0)
Init new/update group form.
global $ilCtrl
Definition: ilias.php:18
setSubTabs()
Set sub tabs type $ilTabs type $ilCtrl.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ 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.

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

Referenced by searchUsersForAppointments().

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  }
$cmd
Definition: sahs_server.php:35
global $ilCtrl
Definition: ilias.php:18
GUI class for public user profile presentation.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
global $ilUser
Definition: imgupload.php:15
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
getProfileBackUrl()
Build context-sensitive profile back url.
+ 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 1232 of file class.ilConsultationHoursGUI.php.

References $_GET, and $_REQUEST.

Referenced by executeCommand(), and showProfile().

1233  {
1234  // from repository
1235  if(isset($_REQUEST["ref_id"]))
1236  {
1237  $url = $this->ctrl->getLinkTargetByClass('ilCalendarMonthGUI');
1238  }
1239  // from panel
1240  else if(isset($_GET['panel']))
1241  {
1242  $url = $this->ctrl->getLinkTargetByClass('ilCalendarPresentationGUI');
1243  }
1244  // from appointments
1245  else
1246  {
1247  $url = $this->ctrl->getLinkTarget($this, 'appointmentList');
1248  }
1249  return $url;
1250  }
$_GET["client_id"]
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the caller graph for this function:

◆ getUserId()

ilConsultationHoursGUI::getUserId ( )

Get user id.

Returns

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

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 type $ilToolbar.

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

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

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.
setSubTabs()
Set sub tabs type $ilTabs type $ilCtrl.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ 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.

References $options, ilConsultationHourGroups\getGroupSelectOptions(), getUserId(), IL_CAL_FREQ_DAILY, IL_CAL_FREQ_MONTHLY, IL_CAL_FREQ_WEEKLY, ilYuiUtil\initDomEvent(), ilRecurrenceInputGUI\setEnabledSubForms(), ilFormPropertyGUI\setInfo(), ilSelectInputGUI\setOptions(), ilTextAreaInputGUI\setRows(), ilDurationInputGUI\setShowMinutes(), ilDateTimeInputGUI\setShowTime(), ilTextInputGUI\setSize(), and ilNumberInputGUI\setSize().

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

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  {
692  case self::MODE_CREATE:
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  }
This class represents a duration (typical hh:mm:ss) property in a property form.
const IL_CAL_FREQ_MONTHLY
This class represents a selection list 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...
setShowMinutes($a_showminutes)
Set Show Minutes.
This class represents a date/time property in a property form.
setInfo($a_info)
Set Information Text.
static getGroupSelectOptions($a_user_id)
Get group selection options.
if(!is_array($argv)) $options
This class represents a number property in a property form.
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
setSize($a_size)
Set Size.
This class represents a text property in a property form.
static initDomEvent()
Init YUI DomEvent.
setOptions($a_options)
Set Options.
setSize($a_size)
Set Size.
This class represents a text area property in a property form.
setEnabledSubForms($a_sub_forms)
set enabled subforms
const IL_CAL_FREQ_WEEKLY
setShowTime($a_showtime)
Set Show Time Information.
+ 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.

References $GLOBALS.

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

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  }
This class represents a property form user interface.
$GLOBALS['ct_recipient']
This class represents a number property in a property form.
This class represents a text property in a property form.
+ Here is the caller graph for this function:

◆ initSettingsForm()

ilConsultationHoursGUI::initSettingsForm ( )
protected

build settings form

Returns
object

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

References $ilUser, ilConsultationHourAppointments\getManager(), and ilFormPropertyGUI\setInfo().

Referenced by settings(), and updateSettings().

1271  {
1272  global $ilDB, $ilUser;
1273 
1274  include_once './Services/Form/classes/class.ilPropertyFormGUI.php';
1275 
1276  $form = new ilPropertyFormGUI();
1277  $form->setFormAction($this->ctrl->getFormAction($this));
1278 
1279  $mng = new ilTextInputGUI($this->lng->txt('cal_ch_manager'), 'mng');
1280  $mng->setInfo($this->lng->txt('cal_ch_manager_info'));
1281  $form->addItem($mng);
1282 
1283  $mng->setValue(ilConsultationHourAppointments::getManager(true));
1284 
1285  $form->setTitle($this->lng->txt('settings'));
1286  $form->addCommandButton('updateSettings', $this->lng->txt('save'));
1287  // $form->addCommandButton('appointmentList', $this->lng->txt('cancel'));
1288  return $form;
1289  }
static getManager($a_as_name=false)
Get consultation hour manager for current user.
This class represents a property form user interface.
setInfo($a_info)
Set Information Text.
This class represents a text property in a property form.
global $ilUser
Definition: imgupload.php:15
+ 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.

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

Referenced by deleteBooking().

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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
global $ilCtrl
Definition: ilias.php:18
static cancelBooking($a_usr_id, $a_app_id, $a_send_notification=true)
Cancel a booking.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ 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.

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

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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initGroupForm($a_group_id=0)
Init new/update group form.
$GLOBALS['ct_recipient']
addGroup(ilPropertyFormGUI $form=null)
Show add group form type $ilToolbar type $ilTabs.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
+ 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.

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

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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Booking definition.
createAppointments(ilBookingEntry $booking)
Create calendar appointments.
static getGroupsOfUser($a_user_id)
Get a all groups of an user.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ref_id
Definition: sahs_server.php:39
+ 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.

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

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  }
< 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']
global $ilCtrl
Definition: ilias.php:18
$GLOBALS['ct_recipient']
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ 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.

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

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

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';
192  $users[] = ilObjUser::_lookupFullname($user_id);
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.
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setSubTabs()

ilConsultationHoursGUI::setSubTabs ( )
protected

Set sub tabs type $ilTabs type $ilCtrl.

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

References $ilCtrl, and getUserId().

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

964  {
965  global $ilTabs, $ilCtrl;
966 
967  $ilCtrl->setParameter($this,'user_id',$this->getUserId());
968  $ilTabs->addSubTab('cal_ch_app_list',$this->lng->txt('cal_ch_app_list'),$ilCtrl->getLinkTarget($this,'appointmentList'));
969  $ilTabs->addSubTab('cal_ch_app_grp',$this->lng->txt('cal_ch_app_grp'),$ilCtrl->getLinkTarget($this,'groupList'));
970  $ilTabs->addSubTab('cal_ch_app_bookings',$this->lng->txt('cal_ch_app_bookings'),$ilCtrl->getLinkTarget($this,'bookingList'));
971  }
global $ilCtrl
Definition: ilias.php:18
+ 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 939 of file class.ilConsultationHoursGUI.php.

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

Referenced by executeCommand().

940  {
941  global $ilTabs, $ilUser, $ilCtrl;
942 
943  $ilCtrl->setParameter($this, 'user_id', '');
944  $ilTabs->addTab('consultation_hours_'.$ilUser->getId(), $this->lng->txt('cal_ch_ch'), $this->ctrl->getLinkTarget($this,'appointmentList'));
945 
947  {
948  $ilCtrl->setParameter($this, 'user_id', $user_id);
949  $ilTabs->addTab('consultation_hours_'.$user_id, $this->lng->txt('cal_ch_ch').': '.$login, $this->ctrl->getLinkTarget($this,'appointmentList'));
950  }
951  $ilCtrl->setParameter($this, 'user_id', '');
952 
953  $ilTabs->addTab('ch_settings', $this->lng->txt('settings'), $this->ctrl->getLinkTarget($this,'settings'));
954 
955  $ilTabs->activateTab('consultation_hours_'.$this->getUserId());
956  }
global $ilCtrl
Definition: ilias.php:18
static getManagedUsers()
Get all managed consultation hours users for current users.
global $ilUser
Definition: imgupload.php:15
+ 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 1255 of file class.ilConsultationHoursGUI.php.

References $tpl, and initSettingsForm().

1256  {
1257  global $tpl, $ilTabs, $ilHelp;
1258 
1259  $ilHelp->setScreenId("consultation_hours_settings");
1260  $ilTabs->activateTab('ch_settings');
1261 
1262  $form = $this->initSettingsForm();
1263  $tpl->setContent($form->getHTML());
1264  }
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
+ Here is the call graph for this function:

◆ showProfile()

ilConsultationHoursGUI::showProfile ( )

show public profile of given user

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

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

1214  {
1215  global $tpl, $ilTabs, $ilCtrl;
1216 
1217  $ilTabs->clearTargets();
1218 
1219  $user_id = (int)$_GET['user'];
1220 
1221  include_once 'Services/User/classes/class.ilPublicUserProfileGUI.php';
1222  $profile = new ilPublicUserProfileGUI($user_id);
1223  $profile->setBackUrl($this->getProfileBackUrl());
1224  $tpl->setContent($ilCtrl->getHTML($profile));
1225  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
GUI class for public user profile presentation.
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
getProfileBackUrl()
Build context-sensitive profile back url.
+ Here is the call graph for this function:

◆ updateGroup()

ilConsultationHoursGUI::updateGroup ( )
protected

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

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

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

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  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initGroupForm($a_group_id=0)
Init new/update group form.
global $ilCtrl
Definition: ilias.php:18
$GLOBALS['ct_recipient']
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
editGroup(ilPropertyFormGUI $form=null)
Edit group type $ilCtrl.
if($_REQUEST['ilias_path']) define('ILIAS_HTTP_PATH' $_REQUEST['ilias_path']
Definition: index.php:7
+ Here is the call graph for this function:

◆ updateMulti()

ilConsultationHoursGUI::updateMulti ( )
protected

Update multiple sequence items.

Returns

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

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

1036  {
1037  global $ilObjDataCache;
1038 
1039  $this->initFormSequence(self::MODE_MULTI);
1040 
1041  if($this->form->checkInput())
1042  {
1043  $this->form->setValuesByPost();
1044  $apps = explode(';', $_POST['apps']);
1045 
1046  include_once 'Services/Booking/classes/class.ilBookingEntry.php';
1047  include_once 'Services/Calendar/classes/class.ilCalendarEntry.php';
1048 
1049  // do collision-check if max bookings were reduced
1050  // no collision check
1051  $first = $apps;
1052  $first = array_shift($first);
1054  #if($this->form->getInput('bo') < $entry->getNumberOfBookings())
1055  #{
1056  # $this->edit();
1057  # return;
1058  #}
1059 
1060  // create new context
1061  $booking = new ilBookingEntry();
1062 
1063  $booking->setObjId($this->getUserId());
1064  $booking->setNumberOfBookings($this->form->getInput('bo'));
1065 
1066  $deadline = $this->form->getInput('dead');
1067  $deadline = $deadline['dd']*24+$deadline['hh'];
1068  $booking->setDeadlineHours($deadline);
1069 
1070  $tgt = explode(',',$this->form->getInput('tgt'));
1071  $obj_ids = array();
1072  foreach((array) $tgt as $ref_id)
1073  {
1074  if(!trim($ref_id))
1075  {
1076  continue;
1077  }
1078  $obj_id = $ilObjDataCache->lookupObjId($ref_id);
1079  $type = ilObject::_lookupType($obj_id);
1080  $valid_types = array('crs','grp');
1081  if(!$obj_id or !in_array($type, $valid_types))
1082  {
1083  ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_repository_object'));
1084  $this->edit();
1085  return;
1086  }
1087  $obj_ids[] = $obj_id;
1088  }
1089  $booking->setTargetObjIds($obj_ids);
1090 
1091  include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourGroups.php';
1093  {
1094  $booking->setBookingGroup($this->form->getInput('grp'));
1095  }
1096  $booking->save();
1097 
1098 
1099  // update entries
1100  $title = $this->form->getInput('ti');
1101  $location = $this->form->getInput('lo');
1102  $description = $this->form->getInput('de');
1103 
1104  foreach($apps as $item_id)
1105  {
1106  $entry = new ilCalendarEntry($item_id);
1107  $entry->setContextId($booking->getId());
1108  $entry->setTitle($title);
1109  $entry->setLocation($location);
1110  $entry->setDescription($description);
1111  $entry->update();
1112  }
1113 
1115 
1116  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1117  $this->ctrl->redirect($this,'appointmentList');
1118  }
1119  $this->tpl->setContent($this->form->getHTML());
1120  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Model for a calendar entry.
$_POST['username']
Definition: cron.php:12
$location
Definition: buildRTE.php:44
edit()
Edit multiple sequence items.
static removeObsoleteEntries()
Remove unused booking entries.
Booking definition.
static getInstanceByCalendarEntryId($a_id)
Get instance by calendar entry.
static _lookupType($a_id, $a_reference=false)
lookup object type
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ref_id
Definition: sahs_server.php:39
static getCountGroupsOfUser($a_user_id)
Get number of consultation hour groups type $ilDB.
+ Here is the call graph for this function:

◆ updateSettings()

ilConsultationHoursGUI::updateSettings ( )

save settings

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

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

1295  {
1296  global $ilDB, $ilCtrl, $ilUser, $tpl, $ilTabs;
1297 
1298  $form = $this->initSettingsForm();
1299  if($form->checkInput())
1300  {
1301  $mng = $form->getInput('mng');
1303  {
1304  ilUtil::sendSuccess($this->lng->txt('settings_saved'), true);
1305  $ilCtrl->redirect($this, 'settings');
1306  }
1307  else
1308  {
1309  $ilTabs->activateTab('ch_settings');
1310 
1311  ilUtil::sendFailure($this->lng->txt('cal_ch_unknown_user'));
1312  $field = $form->getItemByPostVar('mng');
1313  $field->setValue($mng);
1314  $tpl->setContent($form->getHTML());
1315  return;
1316  }
1317  }
1318  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static setManager($a_user_name)
Set consultation hour manager for current user.
global $ilCtrl
Definition: ilias.php:18
if(isset($_FILES['img_file']['size']) && $_FILES['img_file']['size'] > 0) $tpl
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
+ 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.

◆ MODE_MULTI

const ilConsultationHoursGUI::MODE_MULTI = 3

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

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