24 include_once(
'./Services/Calendar/classes/class.ilDate.php');
86 $this->recurrence_id = $a_rec_id;
105 $query =
"DELETE FROM cal_recurrence_rules ".
106 "WHERE cal_id = ".$ilDB->quote($a_cal_id).
" ";
107 $res = $ilDB->query($query);
152 $this->cal_id = $a_id;
164 $this->recurrence_type = $a_type;
188 $this->freq_type = $a_type;
210 return is_object($this->freq_until_date) ? $this->freq_until_date : null;
221 $this->freq_until_date = $a_date;
233 $this->freq_until_count = $a_count;
257 $this->interval = $a_interval;
268 return $this->interval ? $this->interval : 1;
280 $this->byday = $a_byday;
308 $bydays[] = trim($byday);
310 return $bydays ? $bydays : array();
322 $this->byweekno = $a_byweekno;
337 foreach(explode(
',',$this->
getBYWEEKNO()) as $week_num)
339 $weeks[] = (int) $week_num;
341 return $weeks ? $weeks : array();
365 $this->bymonth = $a_by;
391 foreach(explode(
',',$this->
getBYMONTH()) as $month_num)
393 $months[] = (int) $month_num;
395 return $months ? $months : array();
407 $this->bymonthday = $a_by;
434 $months[] = (int) $month_num;
436 return $months ? $months : array();
450 $this->byyearday = $a_by;
476 foreach(explode(
',',$this->
getBYYEARDAY()) as $year_day)
478 $days[] = (int) $year_day;
480 return $days ? $days : array();
492 $this->bysetpos = $a_by;
520 $positions[] = (int) $pos;
522 return $positions ? $positions : array();
535 $this->weekstart = $a_start;
569 $this->timezone = $a_tz;
609 $query =
"INSERT INTO cal_recurrence_rules ".
610 "SET cal_id = ".$this->db->quote($this->cal_id).
", ".
611 "cal_recurrence = 1,".
613 "freq_until_date = ".$this->db->quote($until_date).
", ".
615 "intervall = ".$this->db->quote($this->
getInterval()).
", ".
616 "byday = ".$this->db->quote($this->
getBYDAY()).
", ".
617 "byweekno = ".$this->db->quote($this->
getBYWEEKNO()).
", ".
618 "bymonth = ".$this->db->quote($this->
getBYMONTH()).
", ".
619 "bymonthday = ".$this->db->quote($this->
getBYMONTHDAY()).
", ".
620 "byyearday = ".$this->db->quote($this->
getBYYEARDAY()).
", ".
621 "bysetpos = ".$this->db->quote($this->
getBYSETPOS()).
", ".
622 "weekstart = ".$this->db->quote($this->
getWeekstart()).
" ";
623 $res = $this->db->query($query);
624 $this->recurrence_id = $this->db->getLastInsertId();
640 $query =
"UPDATE cal_recurrence_rules SET ".
641 "cal_id = ".$this->db->quote($this->cal_id).
", ".
642 "cal_recurrence = 1,".
644 "freq_until_date = ".$this->db->quote($until_date).
", ".
646 "intervall = ".$this->db->quote($this->
getInterval()).
", ".
647 "byday = ".$this->db->quote($this->
getBYDAY()).
", ".
648 "byweekno = ".$this->db->quote($this->
getBYWEEKNO()).
", ".
649 "bymonth = ".$this->db->quote($this->
getBYMONTH()).
", ".
650 "bymonthday = ".$this->db->quote($this->
getBYMONTHDAY()).
", ".
651 "byyearday = ".$this->db->quote($this->
getBYYEARDAY()).
", ".
652 "bysetpos = ".$this->db->quote($this->
getBYSETPOS()).
", ".
653 "weekstart = ".$this->db->quote($this->
getWeekstart()).
" ".
654 "WHERE rule_id = ".$this->db->quote($this->recurrence_id).
" ";
655 $this->db->query($query);
665 public function delete()
667 $query =
"DELETE FROM cal_recurrence_rules ".
668 "WHERE rule_id = ".$this->db->quote($this->recurrence_id);
669 $this->db->query($query);
681 $query =
"SELECT * FROM cal_recurrence_rules ".
682 "WHERE rule_id = ".$this->db->quote($this->recurrence_id).
" ";
683 $res = $this->db->query($query);
686 $this->cal_id = $row->cal_id;
687 $this->recurrence_type = $row->cal_recurrence;
688 $this->freq_type = $row->freq_type;
690 if($row->freq_until_date !=
'0000-00-00 00:00:00')
694 $this->freq_until_count = $row->freq_until_count;
695 $this->interval = $row->intervall;
696 $this->byday = $row->byday;
697 $this->byweekno = $row->byweekno;
698 $this->bymonth = $row->bymonth;
699 $this->bymonthday = $row->bymonthday;
700 $this->byyearday = $row->byyearday;
701 $this->bysetpos = $row->bysetpos;
702 $this->weekstart = $row->week_start;