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

Consultation hour appointments. More...

+ Collaboration diagram for ilConsultationHourAppointments:

Static Public Member Functions

static getAppointmentIds ($a_user_id, $a_context_id=NULL, $a_start=NULL, $a_type=NULL, $a_check_owner=true)
 Get all appointment ids.
static getAppointmentIdsByGroup ($a_user_id, $a_ch_group_id, ilDateTime $start=null)
 Get appointment ids by consultation hour group.
static getAppointments ($a_user_id)
 Get all appointments.
static getManager ($a_as_name=false)
 Get consultation hour manager for current user.
static setManager ($a_user_name)
 Set consultation hour manager for current user.
static getManagedUsers ()
 Get all managed consultation hours users for current users.

Detailed Description

Consultation hour appointments.

Author
Stefan Meyer meyer.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

Definition at line 15 of file class.ilConsultationHourAppointments.php.

Member Function Documentation

static ilConsultationHourAppointments::getAppointmentIds (   $a_user_id,
  $a_context_id = NULL,
  $a_start = NULL,
  $a_type = NULL,
  $a_check_owner = true 
)
static

Get all appointment ids.

Parameters
object$a_user_id
int$a_context_id
string$a_start
int$a_type
Returns

Definition at line 26 of file class.ilConsultationHourAppointments.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, IL_CAL_DATETIME, and ilCalendarCategory\TYPE_CH.

Referenced by ilConsultationHoursGUI\bookingList(), ilConsultationHourUtils\cancelBooking(), ilCalendarAppointmentGUI\cancelConfirmed(), ilCalendarAppointmentPanelGUI\getHTML(), and ilCalendarEntry\parseDynamicTitle().

{
global $ilDB;
if(!$a_type)
{
include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
}
$owner = ' ';
if($a_check_owner)
{
$owner = " AND be.obj_id = ".$ilDB->quote($a_user_id,'integer');
}
$query = "SELECT ce.cal_id FROM cal_entries ce".
" JOIN cal_cat_assignments cca ON ce.cal_id = cca.cal_id".
" JOIN cal_categories cc ON cca.cat_id = cc.cat_id".
" JOIN booking_entry be ON ce.context_id = be.booking_id".
" WHERE cc.obj_id = ".$ilDB->quote($a_user_id,'integer').
$owner.
" AND cc.type = ".$ilDB->quote($a_type,'integer');
if($a_context_id)
{
$query .= " AND ce.context_id = ".$ilDB->quote($a_context_id, 'integer');
}
if($a_start)
{
$query .= " AND ce.starta = ".$ilDB->quote($a_start->get(IL_CAL_DATETIME, '', 'UTC'), 'text');
}
$res = $ilDB->query($query);
$entries = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$entries[] = $row->cal_id;
}
return $entries;
}

+ Here is the caller graph for this function:

static ilConsultationHourAppointments::getAppointmentIdsByGroup (   $a_user_id,
  $a_ch_group_id,
ilDateTime  $start = null 
)
static

Get appointment ids by consultation hour group.

Parameters
type$a_user_id
type$a_ch_group_id
ilDateTime$start

Definition at line 76 of file class.ilConsultationHourAppointments.php.

References $ilDB, $query, $res, $row, DB_FETCHMODE_OBJECT, IL_CAL_DATETIME, and ilCalendarCategory\TYPE_CH.

Referenced by ilConsultationHoursGUI\assignUsersToGroup(), ilBookingEntry\isAppointmentBookableForUser(), and ilConsultationHourGroupTableGUI\parse().

{
global $ilDB;
// @todo check start time
include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
$start_limit = '';
if($start instanceof ilDateTime)
{
$start_limit = 'AND ce.starta >= '.$ilDB->quote($start->get(IL_CAL_DATETIME,'','UTC'),'timestamp');
}
$query = 'SELECT ce.cal_id FROM cal_entries ce '.
'JOIN cal_cat_assignments ca ON ce.cal_id = ca.cal_id '.
'JOIN cal_categories cc ON ca.cat_id = cc.cat_id '.
'JOIN booking_entry be ON ce.context_id = be.booking_id '.
'WHERE cc.obj_id = '.$ilDB->quote($a_user_id,'integer').' '.
'AND cc.type = '.$ilDB->quote($type,'integer').' '.
'AND be.booking_group = '.$ilDB->quote($a_ch_group_id,'integer').' '.
$start_limit.' '.
'ORDER BY ce.starta ';
$res = $ilDB->query($query);
$app_ids = array();
while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
{
$app_ids[] = $row->cal_id;
}
return $app_ids;
}

+ Here is the caller graph for this function:

static ilConsultationHourAppointments::getAppointments (   $a_user_id)
static

Get all appointments.

Returns

Definition at line 113 of file class.ilConsultationHourAppointments.php.

Referenced by ilConsultationHoursTableGUI\parse().

{
$entries = array();
foreach(self::getAppointmentIds($a_user_id) as $app_id)
{
$entries[] = new ilCalendarEntry($app_id);
}
return $entries;
}

+ Here is the caller graph for this function:

static ilConsultationHourAppointments::getManagedUsers ( )
static

Get all managed consultation hours users for current users.

Returns
array

Definition at line 181 of file class.ilConsultationHourAppointments.php.

References $ilDB, $ilUser, $row, and ilObjUser\_lookupLogin().

Referenced by ilConsultationHoursGUI\__construct(), and ilConsultationHoursGUI\setTabs().

{
global $ilDB, $ilUser;
$all = array();
$set = $ilDB->query('SELECT user_id FROM cal_ch_settings'.
' WHERE admin_id = '.$ilDB->quote($ilUser->getId(), 'integer'));
while($row = $ilDB->fetchAssoc($set))
{
$all[$row['user_id']] = ilObjUser::_lookupLogin($row['user_id']);
}
return $all;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilConsultationHourAppointments::getManager (   $a_as_name = false)
static

Get consultation hour manager for current user.

Parameters
string$a_as_name
Returns
int | string

Definition at line 128 of file class.ilConsultationHourAppointments.php.

References $ilDB, $ilUser, $row, and ilObjUser\_lookupLogin().

Referenced by ilConsultationHoursGUI\initSettingsForm().

{
global $ilDB, $ilUser;
$set = $ilDB->query('SELECT admin_id FROM cal_ch_settings'.
' WHERE user_id = '.$ilDB->quote($ilUser->getId(), 'integer'));
$row = $ilDB->fetchAssoc($set);
if($row && $row['admin_id'])
{
if($a_as_name)
{
return ilObjUser::_lookupLogin($row['admin_id']);
}
return (int)$row['admin_id'];
}
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static ilConsultationHourAppointments::setManager (   $a_user_name)
static

Set consultation hour manager for current user.

Parameters
string$a_user_name
Returns
bool

Definition at line 150 of file class.ilConsultationHourAppointments.php.

References $ilDB, $ilUser, and ilObjUser\_loginExists().

Referenced by ilConsultationHoursGUI\updateSettings().

{
global $ilDB, $ilUser;
$user_id = false;
if($a_user_name)
{
$user_id = ilObjUser::_loginExists($a_user_name);
if(!$user_id)
{
return false;
}
}
$ilDB->manipulate('DELETE FROM cal_ch_settings'.
' WHERE user_id = '.$ilDB->quote($ilUser->getId(), 'integer'));
if($user_id && $user_id != $ilUser->getId())
{
$ilDB->manipulate('INSERT INTO cal_ch_settings (user_id, admin_id)'.
' VALUES ('.$ilDB->quote($ilUser->getId(), 'integer').','.
$ilDB->quote($user_id, 'integer').')');
}
return true;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:


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