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 ,
'integer').
" ";
113 $ical .= (
'FREQ='.$this->getFrequenceType());
117 $ical .= (
';INTERVAL='.$this->getInterval());
121 $ical .= (
';COUNT='.$this->getFrequenceUntilCount());
125 $ical .= (
';BYMONTH='.$this->getBYMONTH());
129 $ical .= (
';BYWEEKNO='.$this->getBYWEEKNO());
133 $ical .= (
';BYYEARDAY='.$this->getBYYEARDAY());
137 $ical .= (
';BYMONTHDAY='.$this->getBYMONTHDAY());
141 $ical .= (
';BYDAY='.$this->getBYDAY());
145 $ical .= (
';BYSETPOS='.$this->getBYSETPOS());
193 $this->cal_id = $a_id;
205 $this->recurrence_type = $a_type;
229 $this->freq_type = $a_type;
251 return is_object($this->freq_until_date) ? $this->freq_until_date : null;
262 $this->freq_until_date = $a_date;
274 $this->freq_until_count = $a_count;
298 $this->interval = $a_interval;
309 return $this->interval ? $this->interval : 1;
321 $this->byday = $a_byday;
349 $bydays[] = trim($byday);
351 return $bydays ? $bydays : array();
363 $this->byweekno = $a_byweekno;
378 foreach(explode(
',',$this->
getBYWEEKNO()) as $week_num)
380 $weeks[] = (int) $week_num;
382 return $weeks ? $weeks : array();
406 $this->bymonth = $a_by;
432 foreach(explode(
',',$this->
getBYMONTH()) as $month_num)
434 $months[] = (int) $month_num;
436 return $months ? $months : array();
448 $this->bymonthday = $a_by;
475 $months[] = (int) $month_num;
477 return $months ? $months : array();
491 $this->byyearday = $a_by;
517 foreach(explode(
',',$this->
getBYYEARDAY()) as $year_day)
519 $days[] = (int) $year_day;
521 return $days ? $days : array();
533 $this->bysetpos = $a_by;
561 $positions[] = (int) $pos;
563 return $positions ? $positions : array();
576 $this->weekstart = $a_start;
610 $this->timezone = $a_tz;
651 $next_id = $ilDB->nextId(
'cal_recurrence_rules');
653 $query =
"INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, ".
654 "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) ".
656 $ilDB->quote($next_id,
'integer').
", ".
657 $this->db->quote($this->cal_id ,
'integer').
", ".
658 $ilDB->quote(1,
'integer').
", ".
660 $this->db->quote($until_date,
'timestamp').
", ".
662 $this->db->quote($this->
getInterval() ,
'integer').
", ".
663 $this->db->quote($this->
getBYDAY() ,
'text').
", ".
664 $this->db->quote($this->
getBYWEEKNO() ,
'text').
", ".
665 $this->db->quote($this->
getBYMONTH() ,
'text').
", ".
668 $this->db->quote($this->
getBYSETPOS() ,
'text').
", ".
672 $this->recurrence_id = $next_id;
690 $query =
"UPDATE cal_recurrence_rules SET ".
691 "cal_id = ".$this->db->quote($this->cal_id ,
'integer').
", ".
692 "cal_recurrence = 1,".
694 "freq_until_date = ".$this->db->quote($until_date ,
'timestamp').
", ".
696 "intervall = ".$this->db->quote($this->
getInterval() ,
'integer').
", ".
697 "byday = ".$this->db->quote($this->
getBYDAY() ,
'text').
", ".
698 "byweekno = ".$this->db->quote($this->
getBYWEEKNO() ,
'text').
", ".
699 "bymonth = ".$this->db->quote($this->
getBYMONTH() ,
'text').
", ".
700 "bymonthday = ".$this->db->quote($this->
getBYMONTHDAY() ,
'text').
", ".
701 "byyearday = ".$this->db->quote($this->
getBYYEARDAY() ,
'text').
", ".
702 "bysetpos = ".$this->db->quote($this->
getBYSETPOS() ,
'text').
", ".
703 "weekstart = ".$this->db->quote($this->
getWeekstart() ,
'text').
" ".
704 "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer').
" ";
715 public function delete()
719 $query =
"DELETE FROM cal_recurrence_rules ".
720 "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer');
735 $query =
"SELECT * FROM cal_recurrence_rules ".
736 "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer').
" ";
740 $this->cal_id =
$row->cal_id;
741 $this->recurrence_type =
$row->cal_recurrence;
742 $this->freq_type =
$row->freq_type;
744 if(
$row->freq_until_date != null)
748 $this->freq_until_count =
$row->freq_until_count;
749 $this->interval =
$row->intervall;
750 $this->byday =
$row->byday;
751 $this->byweekno =
$row->byweekno;
752 $this->bymonth =
$row->bymonth;
753 $this->bymonthday =
$row->bymonthday;
754 $this->byyearday =
$row->byyearday;
755 $this->bysetpos =
$row->bysetpos;
756 $this->weekstart =
$row->week_start;