ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilConsultationHourUtils Class Reference

Description of class. More...

+ Collaboration diagram for ilConsultationHourUtils:

Static Public Member Functions

static bookAppointment ($a_usr_id, $a_app_id)
 Book an appointment.
static cancelBooking ($a_usr_id, $a_app_id, $a_send_notification=true)
 Cancel a booking.
static lookupManagedUsers ($a_usr_id)
 Lookup managed users.

Detailed Description

Description of class.

Author
Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e

Definition at line 10 of file class.ilConsultationHourUtils.php.

Member Function Documentation

static ilConsultationHourUtils::bookAppointment (   $a_usr_id,
  $a_app_id 
)
static

Book an appointment.

All checks (assignment possible, max booking) must be done before

Parameters
type$a_usr_id
type$a_app_id
Returns
bool

Definition at line 20 of file class.ilConsultationHourUtils.php.

References $lng, ilLanguageFactory\_getLanguage(), ilCalendarCategoryAssignments\addAssignment(), ilBookingEntry\book(), ilCalendarUtil\initDefaultCalendarByType(), and ilCalendarCategory\TYPE_CH.

Referenced by ilConsultationHoursGUI\assignUsersToAppointment(), ilConsultationHoursGUI\assignUsersToGroup(), and ilCalendarAppointmentGUI\bookconfirmed().

{
global $lng;
// Create new default consultation hour calendar
include_once './Services/Language/classes/class.ilLanguageFactory.php';
$cal_lang = ilLanguageFactory::_getLanguage($lng->getDefaultLanguage());
$cal_lang->loadLanguageModule('dateplaner');
include_once './Services/Calendar/classes/class.ilCalendarUtil.php';
include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
$a_usr_id,
$cal_lang->txt('cal_ch_personal_ch'),
true
);
// duplicate appointment
include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
$app = new ilCalendarEntry($a_app_id);
$personal_app = clone $app;
$personal_app->save();
// assign appointment to category
include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
$assignment = new ilCalendarCategoryAssignments($personal_app->getEntryId());
$assignment->addAssignment($ch->getCategoryID());
// book appointment
include_once './Services/Booking/classes/class.ilBookingEntry.php';
$booking = new ilBookingEntry($app->getContextId());
$booking->book($app->getEntryId(),$a_usr_id);
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilConsultationHourUtils::cancelBooking (   $a_usr_id,
  $a_app_id,
  $a_send_notification = true 
)
static

Cancel a booking.

Parameters
type$a_usr_id
type$a_app_id
Returns
bool

Definition at line 62 of file class.ilConsultationHourUtils.php.

References ilCalendarCategoryAssignments\_deleteByAppointmentId(), ilBookingEntry\cancelBooking(), ilConsultationHourAppointments\getAppointmentIds(), and ilCalendarCategory\TYPE_CH.

Referenced by ilConsultationHoursGUI\delete(), and ilConsultationHoursGUI\rejectBooking().

{
// Delete personal copy of appointment
include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
$app = new ilCalendarEntry($a_app_id);
include_once './Services/Calendar/classes/ConsultationHours/class.ilConsultationHourAppointments.php';
$a_usr_id,
$app->getContextId(),
$app->getStart(),
false
);
foreach($user_apps as $uapp_id)
{
$uapp = new ilCalendarEntry($uapp_id);
$uapp->delete();
include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
break;
}
// Delete booking entries
// Send notification
$booking = new ilBookingEntry($app->getContextId());
if($a_send_notification)
{
$booking->cancelBooking($a_app_id,$a_usr_id);
}
else
{
$booking->deleteBooking($a_app_id, $a_usr_id);
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilConsultationHourUtils::lookupManagedUsers (   $a_usr_id)
static

Lookup managed users.

Parameters
type$a_usr_id

Definition at line 105 of file class.ilConsultationHourUtils.php.

References $ilDB, $query, $res, $row, and DB_FETCHMODE_OBJECT.

Referenced by ilBookingEntry\lookupManagedBookingsForObject().

{
global $ilDB;
$query = 'SELECT user_id FROM cal_ch_settings '.
'WHERE admin_id = '.$ilDB->quote($a_usr_id,'integer');
$res = $ilDB->query($query);
$users = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$users[] = $row->user_id;
}
return $users;
}

+ Here is the caller graph for this function:


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