Handles events (create,update,delete) for autmatic generated calendar events from course, groups, ...
More...
|
static | handleEvent ($a_component, $a_event, $a_parameter) |
| Handle events like create, update, delete. More...
|
|
static | createCategory ($a_obj, $a_check_existing=false) |
| Create a category for a new object (crs,grp, ...) More...
|
|
static | updateCategory ($a_obj) |
| Create a category for a new object (crs,grp, ...) More...
|
|
static | createAppointments ($a_obj, $a_appointments) |
| Create appointments. More...
|
|
static | deleteAppointments ($a_obj_id, array $a_context_ids=null) |
| Delete automatic generated appointments. More...
|
|
static | deleteCategory ($a_obj_id) |
| delete category More...
|
|
Handles events (create,update,delete) for autmatic generated calendar events from course, groups, ...
- Author
- Stefan Meyer smeye.nosp@m.r.il.nosp@m.ias@g.nosp@m.mx.d.nosp@m.e
- Version
- $Id$
Definition at line 35 of file class.ilCalendarAppEventListener.php.
◆ createAppointments()
static ilCalendarAppEventListener::createAppointments |
( |
|
$a_obj, |
|
|
|
$a_appointments |
|
) |
| |
|
static |
Create appointments.
public
- Parameters
-
Definition at line 185 of file class.ilCalendarAppEventListener.php.
References $ilLog, ilCalendarCategories\_lookupCategoryIdByObjId(), and ilCalendarCategoryAssignments\addAssignment().
189 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
190 include_once(
'./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php');
191 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
194 $ilLog->write(__METHOD__ .
': Cannot find calendar category for obj_id ' . $a_obj->getId());
195 $cat_id = self::createCategory($a_obj);
198 foreach ($a_appointments as $app_templ) {
200 $app->setContextId($app_templ->getContextId());
201 $app->setTitle($app_templ->getTitle());
202 $app->setSubtitle($app_templ->getSubtitle());
203 $app->setDescription($app_templ->getDescription());
204 $app->setFurtherInformations($app_templ->getInformation());
205 $app->setLocation($app_templ->getLocation());
206 $app->setStart($app_templ->getStart());
207 $app->setEnd($app_templ->getEnd());
208 $app->setFullday($app_templ->isFullday());
209 $app->setAutoGenerated(
true);
210 $app->setTranslationType($app_templ->getTranslationType());
Model for a calendar entry.
static _lookupCategoryIdByObjId($a_obj_id)
lookup category by obj_id
addAssignment($a_cal_cat_id)
add assignment
◆ createCategory()
static ilCalendarAppEventListener::createCategory |
( |
|
$a_obj, |
|
|
|
$a_check_existing = false |
|
) |
| |
|
static |
Create a category for a new object (crs,grp, ...)
public
- Parameters
-
object | ilias object ('crs','grp',...) |
Definition at line 137 of file class.ilCalendarAppEventListener.php.
References $lng, ilCalendarCategory\_getInstanceByObjId(), ilCalendarAppointmentColors\_getRandomColorByType(), and ilCalendarCategory\TYPE_OBJ.
141 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
142 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentColors.php');
145 if ($a_check_existing &&
147 return self::updateCategory($a_obj);
151 $cat->setTitle($a_obj->getTitle() ? $a_obj->getTitle() : $lng->txt(
'obj_' . $a_obj->getType()));
154 $cat->setObjId($a_obj->getId());
Stores calendar categories.
static _getInstanceByObjId($a_obj_id)
get instance by obj_id
static _getRandomColorByType($a_type)
get random color entry for type
◆ deleteAppointments()
static ilCalendarAppEventListener::deleteAppointments |
( |
|
$a_obj_id, |
|
|
array |
$a_context_ids = null |
|
) |
| |
|
static |
◆ deleteCategory()
static ilCalendarAppEventListener::deleteCategory |
( |
|
$a_obj_id | ) |
|
|
static |
◆ handleEvent()
static ilCalendarAppEventListener::handleEvent |
( |
|
$a_component, |
|
|
|
$a_event, |
|
|
|
$a_parameter |
|
) |
| |
|
static |
Handle events like create, update, delete.
public
- Parameters
-
string | $a_component | component, e.g. "Modules/Forum" or "Services/User" |
string | $a_event | event e.g. "createUser", "updateUser", "deleteUser", ... |
array | $a_parameter | parameter array (assoc), array("name" => ..., "phone_office" => ...) * |
Implements ilAppEventListener.
Definition at line 46 of file class.ilCalendarAppEventListener.php.
References $ilLog, $ilUser, ilCalendarCategories\deletePDItemsCache(), and ilCalendarCategories\deleteRepositoryCache().
50 $delete_cache =
false;
52 switch ($a_component) {
53 case 'Modules/Session':
55 case 'Modules/Course':
58 $ilLog->write(__METHOD__ .
': Handling create event');
59 self::createCategory($a_parameter[
'object']);
60 self::createAppointments($a_parameter[
'object'], $a_parameter[
'appointments']);
65 $ilLog->write(__METHOD__ .
': Handling update event');
66 self::updateCategory($a_parameter[
'object']);
67 self::deleteAppointments($a_parameter[
'obj_id']);
68 self::createAppointments($a_parameter[
'object'], $a_parameter[
'appointments']);
73 $ilLog->write(__METHOD__ .
': Handling delete event');
74 self::deleteCategory($a_parameter[
'obj_id']);
80 case 'Services/Booking':
91 case 'Modules/Exercise':
93 case 'createAssignment':
94 $ilLog->write(__METHOD__ .
': Handling create event (exercise assignment)');
95 self::createCategory($a_parameter[
'object'],
true);
96 self::createAppointments($a_parameter[
'object'], $a_parameter[
'appointments']);
100 case 'updateAssignment':
101 $ilLog->write(__METHOD__ .
': Handling update event (exercise assignment)');
102 self::createCategory($a_parameter[
'object'],
true);
103 self::deleteAppointments($a_parameter[
'obj_id'], $a_parameter[
'context_ids']);
104 self::createAppointments($a_parameter[
'object'], $a_parameter[
'appointments']);
105 $delete_cache =
true;
108 case 'deleteAssignment':
109 $ilLog->write(__METHOD__ .
': Handling delete event (exercise assignment)');
110 self::deleteAppointments($a_parameter[
'obj_id'], $a_parameter[
'context_ids']);
111 $delete_cache =
true;
115 $ilLog->write(__METHOD__ .
': Handling delete event');
116 self::deleteCategory($a_parameter[
'obj_id']);
117 $delete_cache =
true;
124 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
static deletePDItemsCache($a_usr_id)
Delete cache (add remove desktop item)
static deleteRepositoryCache($a_usr_id)
Delete cache.
◆ updateCategory()
static ilCalendarAppEventListener::updateCategory |
( |
|
$a_obj | ) |
|
|
static |
Create a category for a new object (crs,grp, ...)
public
- Parameters
-
object | ilias object ('crs','grp',...) |
Definition at line 165 of file class.ilCalendarAppEventListener.php.
References ilCalendarCategory\_getInstanceByObjId().
167 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
168 include_once(
'./Services/Calendar/classes/class.ilCalendarAppointmentColors.php');
171 $cat->setTitle($a_obj->getTitle());
static _getInstanceByObjId($a_obj_id)
get instance by obj_id
The documentation for this class was generated from the following file: