/** * Apply BYSETPOST rules * * @access protected * @param object ilDateList * @return object ilDateList */ protected function applyBYSETPOSRules(ilDateList $list) { // return unmodified, if no bysetpos rules are available if (!$this->recurrence->getBYSETPOSList()) { return $list; } $pos_list = $this->initDateList(); $list->sort(); $candidates = $list->get(); $candidates_count = count($candidates); foreach ($this->recurrence->getBYSETPOSList() as $position) { if ($position > 0 and $date = $list->getAtPosition($position)) { $pos_list->add($date); } if ($position < 0 and $date = $list->getAtPosition($candidates_count + $position + 1)) { $pos_list->add($date); } } return $pos_list; }