ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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)
 

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.

References ilLoggerFactory\getLogger().

21  {
22  $this->user_id = $a_user_id;
23  $this->logger = ilLoggerFactory::getLogger('exc');
24  }
static getLogger($a_component_id)
Get component logger.
+ 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 66 of file class.ilCalendarScheduleFilterExercise.php.

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

67  {
68  $all_events = array();
69 
70  foreach ($a_categories as $cat_id) {
71  $cal_cat = $this->isExerciseCategory($cat_id);
72  if (!$cal_cat) {
73  continue;
74  }
75 
76  $exc_obj_id = $cal_cat->getObjId();
77 
78  include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php';
79  include_once './Modules/Exercise/classes/class.ilExAssignment.php';
80  foreach (ilExAssignment::getInstancesByExercise($exc_obj_id) as $ass) {
81  $idl = $ass->getPersonalDeadline($this->user_id);
82  if ($idl &&
83  $idl != $ass->getDeadline()) {
84  $idl = new ilDateTime($idl, IL_CAL_UNIX);
85  if (ilDateTime::_within($idl, $start, $end)) {
86  include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
87  $app_ids = ilCalendarCategoryAssignments::_getAssignedAppointments(array($cal_cat->getCategoryID()));
88  foreach ($app_ids as $app_id) {
89  include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
90  $entry = new ilCalendarEntry($app_id);
91  if (!$entry->isAutoGenerated()) {
92  continue;
93  }
94 
95  if ($entry->getContextId() == $ass->getId() . "0") {
96  $entry->setStart($idl);
97  $entry->setEnd($idl);
98  $all_events[] = $entry;
99  }
100  }
101  }
102  }
103  }
104  }
105 
106  return $all_events;
107  }
Model for a calendar entry.
const IL_CAL_UNIX
static getInstancesByExercise($a_exc_id)
Date and time handling
isExerciseCategory($a_cat_id)
Check valid exercise calendar category.
Create styles array
The data for the language used.
static _getAssignedAppointments($a_cat_id)
Get assigned apointments.
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.
+ 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 ( )

◆ isExerciseCategory()

ilCalendarScheduleFilterExercise::isExerciseCategory (   $a_cat_id)
protected

Check valid exercise calendar category.

Parameters
int$a_cat_id
Returns
ilCalendarCategory

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

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

Referenced by addCustomEvents(), and modifyEvent().

116  {
117  include_once './Services/Calendar/classes/class.ilCalendarCategory.php';
118  $category = ilCalendarCategory::getInstanceByCategoryId($a_cat_id);
119 
120  if ($category->getType() != ilCalendarCategory::TYPE_OBJ) {
121  //$this->getLogger()->debug('Not modifying calendar for non object type');
122  return false;
123  }
124  if ($category->getObjType() != 'exc') {
125  //$this->getLogger()->debug('Category object type is != folder => category event not modified');
126  return false;
127  }
128 
129  return $category;
130  }
static getInstanceByCategoryId($a_cat_id)
Get instance by category id.
+ 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.

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

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