ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilCalendarScheduleFilterExercise Class Reference

Calendar schedule filter for exercises. More...

+ Inheritance diagram for ilCalendarScheduleFilterExercise:
+ Collaboration diagram for ilCalendarScheduleFilterExercise:

Public Member Functions

 __construct ($a_user_id)
 
 getLogger ()
 
 filterCategories (array $a_cats)
 
 modifyEvent (ilCalendarEntry $a_event)
 
 addCustomEvents (ilDate $start, ilDate $end, array $a_categories)
 
 filterCategories (array $a_cats)
 
 modifyEvent (ilCalendarEntry $a_event)
 
 addCustomEvents (ilDate $start, ilDate $end, array $a_categories)
 

Protected Member Functions

 isExerciseCategory ($a_cat_id)
 Check valid exercise calendar category. More...
 

Protected Attributes

 $user_id
 

Static Protected Attributes

static $logger
 

Detailed Description

Calendar schedule filter for exercises.

Author
Jörg Lützenkirchen luetz.nosp@m.enki.nosp@m.rchen.nosp@m.@lei.nosp@m.fos.c.nosp@m.om
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

ilCalendarScheduleFilterExercise::__construct (   $a_user_id)

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

21 {
22 $this->user_id = $a_user_id;
23 $this->logger = ilLoggerFactory::getLogger('exc');
24 }
static getLogger($a_component_id)
Get component logger.

References ilLoggerFactory\getLogger().

+ Here is the call graph for this function:

Member Function Documentation

◆ addCustomEvents()

ilCalendarScheduleFilterExercise::addCustomEvents ( ilDate  $start,
ilDate  $end,
array  $a_categories 
)

Implements ilCalendarScheduleFilter.

Definition at line 70 of file class.ilCalendarScheduleFilterExercise.php.

71 {
72 $all_events = array();
73
74 foreach($a_categories as $cat_id)
75 {
76 $cal_cat = $this->isExerciseCategory($cat_id);
77 if(!$cal_cat)
78 {
79 continue;
80 }
81
82 $exc_obj_id = $cal_cat->getObjId();
83
84 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
85 include_once './Modules/Exercise/classes/class.ilExAssignment.php';
86 foreach(ilExAssignment::getInstancesByExercise($exc_obj_id) as $ass)
87 {
88 $idl = $ass->getPersonalDeadline($this->user_id);
89 if($idl &&
90 $idl != $ass->getDeadline())
91 {
92 $idl = new ilDateTime($idl, IL_CAL_UNIX);
93 if(ilDateTime::_within($idl, $start, $end))
94 {
95 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
96 $app_ids = ilCalendarCategoryAssignments::_getAssignedAppointments(array($cal_cat->getCategoryID()));
97 foreach($app_ids as $app_id)
98 {
99 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
100 $entry = new ilCalendarEntry($app_id);
101 if(!$entry->isAutoGenerated())
102 {
103 continue;
104 }
105
106 if($entry->getContextId() == $ass->getId()."0")
107 {
108 $entry->setStart($idl);
109 $entry->setEnd($idl);
110 $all_events[] = $entry;
111 }
112 }
113 }
114 }
115 }
116 }
117
118 return $all_events;
119 }
const IL_CAL_UNIX
static _getAssignedAppointments($a_cat_id)
Get assigned apointments.
Model for a calendar entry.
isExerciseCategory($a_cat_id)
Check valid exercise calendar category.
@classDescription Date and time handling
static _within(ilDateTime $dt, ilDateTime $start, ilDateTime $end, $a_compare_field='', $a_tz='')
Check whether an date is within a date duration given by start and end.
static getInstancesByExercise($a_exc_id)

References $start, ilCalendarCategoryAssignments\_getAssignedAppointments(), ilDateTime\_within(), ilExAssignment\getInstancesByExercise(), IL_CAL_UNIX, and isExerciseCategory().

+ Here is the call graph for this function:

◆ filterCategories()

ilCalendarScheduleFilterExercise::filterCategories ( array  $a_cats)

Implements ilCalendarScheduleFilter.

Definition at line 31 of file class.ilCalendarScheduleFilterExercise.php.

32 {
33 return $a_cats;
34 }

◆ getLogger()

ilCalendarScheduleFilterExercise::getLogger ( )

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

References $logger.

Referenced by isExerciseCategory().

+ Here is the caller graph for this function:

◆ isExerciseCategory()

ilCalendarScheduleFilterExercise::isExerciseCategory (   $a_cat_id)
protected

Check valid exercise calendar category.

Parameters
int$a_cat_id
Returns
ilCalendarCategory

Definition at line 127 of file class.ilCalendarScheduleFilterExercise.php.

128 {
129 include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
130 $category = ilCalendarCategory::getInstanceByCategoryId($a_cat_id);
131
132 if($category->getType() != ilCalendarCategory::TYPE_OBJ)
133 {
134 $this->getLogger()->debug('Not modifying calendar for non object type');
135 return false;
136 }
137 if($category->getObjType() != 'exc')
138 {
139 $this->getLogger()->debug('Category object type is != folder => category event not modified');
140 return false;
141 }
142
143 return $category;
144 }
static getInstanceByCategoryId($a_cat_id)
Get instance by category id.

References ilCalendarCategory\getInstanceByCategoryId(), getLogger(), and ilCalendarCategory\TYPE_OBJ.

Referenced by addCustomEvents(), and modifyEvent().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ modifyEvent()

ilCalendarScheduleFilterExercise::modifyEvent ( ilCalendarEntry  $a_event)

Implements ilCalendarScheduleFilter.

Definition at line 36 of file class.ilCalendarScheduleFilterExercise.php.

37 {
38 include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
40 if($cal_cat)
41 {
42 $exc_obj_id = $cal_cat->getObjId();
43
44 // see ilExAssignment::handleCalendarEntries()
45 $context_id = $a_event->getContextId();
46 $subtype = (int)substr($context_id, -1);
47 $ass_id = (int)substr($context_id, 0, -1);
48
49 // 1 is peer review deadline
50 if($subtype != 1)
51 {
52 include_once './Modules/Exercise/classes/class.ilExAssignment.php';
53 $ass = new ilExAssignment($ass_id);
54 if($ass->getExerciseId() == $exc_obj_id)
55 {
56 $idl = $ass->getPersonalDeadline($this->user_id);
57 if($idl &&
58 $idl != $ass->getDeadline())
59 {
60 // we have individal deadline (see addCustomEvents());
61 return false;
62 }
63 }
64 }
65 }
66
67 return $a_event;
68 }
static _lookupCategory($a_cal_id)
Lookup category id.
getEntryId()
get entry id
getContextId()
get context id
Exercise assignment.

References ilCalendarCategoryAssignments\_lookupCategory(), ilCalendarEntry\getContextId(), ilCalendarEntry\getEntryId(), and isExerciseCategory().

+ Here is the call graph for this function:

Field Documentation

◆ $logger

ilCalendarScheduleFilterExercise::$logger
staticprotected

Definition at line 18 of file class.ilCalendarScheduleFilterExercise.php.

Referenced by getLogger().

◆ $user_id

ilCalendarScheduleFilterExercise::$user_id
protected

Definition at line 17 of file class.ilCalendarScheduleFilterExercise.php.


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