24 include_once(
'./Services/Calendar/classes/class.ilDate.php');
 
   25 include_once 
'./Services/Calendar/classes/class.ilCalendarRecurrenceExclusions.php';
 
   89                 $this->recurrence_id = $a_rec_id;
 
  108                 $query = 
"DELETE FROM cal_recurrence_rules ".
 
  109                         "WHERE cal_id = ".$ilDB->quote($a_cal_id ,
'integer').
" ";
 
  118                 $ical .= (
'FREQ='.$this->getFrequenceType());
 
  122                         $ical .= (
';INTERVAL='.$this->getInterval());
 
  126                         $ical .= (
';COUNT='.$this->getFrequenceUntilCount());
 
  130                         $ical .= (
';UNTIL='.$this->getFrequenceUntilDate()->get(
IL_CAL_FKT_DATE,
'Ymd'));
 
  134                         $ical .= (
';BYMONTH='.$this->getBYMONTH());
 
  138                         $ical .= (
';BYWEEKNO='.$this->getBYWEEKNO());
 
  142                         $ical .= (
';BYYEARDAY='.$this->getBYYEARDAY());
 
  146                         $ical .= (
';BYMONTHDAY='.$this->getBYMONTHDAY());
 
  150                         $ical .= (
';BYDAY='.$this->getBYDAY());
 
  154                         $ical .= (
';BYSETPOS='.$this->getBYSETPOS());
 
  202                 $this->cal_id = $a_id;
 
  214                 $this->recurrence_type = $a_type;
 
  238                 $this->freq_type = $a_type;
 
  260                 return is_object($this->freq_until_date) ? $this->freq_until_date : null;
 
  271                 $this->freq_until_date = $a_date;
 
  283                 $this->freq_until_count = $a_count;
 
  307                 $this->interval = $a_interval;
 
  318                 return $this->interval ? $this->interval : 1;
 
  330                 $this->byday = $a_byday;
 
  358                         $bydays[] = trim($byday);
 
  360                 return $bydays ? $bydays : array();
 
  372                 $this->byweekno = $a_byweekno;
 
  387                 foreach(explode(
',',$this->
getBYWEEKNO()) as $week_num)
 
  389                         $weeks[] = (int) $week_num;
 
  391                 return $weeks ? $weeks : array();
 
  415                 $this->bymonth = $a_by;
 
  441                 foreach(explode(
',',$this->
getBYMONTH()) as $month_num)
 
  443                         $months[] = (int) $month_num;
 
  445                 return $months ? $months : array();
 
  457                 $this->bymonthday = $a_by;
 
  484                         $months[] = (int) $month_num;
 
  486                 return $months ? $months : array();
 
  500                 $this->byyearday = $a_by;
 
  526                 foreach(explode(
',',$this->
getBYYEARDAY()) as $year_day)
 
  528                         $days[] = (int) $year_day;
 
  530                 return $days ? $days : array();
 
  542                 $this->bysetpos = $a_by;
 
  570                         $positions[] = (int) $pos;
 
  572                 return $positions ? $positions : array();
 
  585                 $this->weekstart = $a_start;
 
  619                 $this->timezone = $a_tz;
 
  669                 $next_id = $ilDB->nextId(
'cal_recurrence_rules');
 
  671                 $query = 
"INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, ".
 
  672                         "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) ".
 
  674                         $ilDB->quote($next_id,
'integer').
", ".
 
  675                         $this->db->quote($this->cal_id ,
'integer').
", ".
 
  676                         $ilDB->quote(1,
'integer').
", ".
 
  678                         $this->db->quote($until_date,
'timestamp').
", ".
 
  680                         $this->db->quote($this->
getInterval() ,
'integer').
", ".
 
  681                         $this->db->quote($this->
getBYDAY() ,
'text').
", ".
 
  682                         $this->db->quote($this->
getBYWEEKNO() ,
'text').
", ".
 
  683                         $this->db->quote($this->
getBYMONTH() ,
'text').
", ".
 
  686                         $this->db->quote($this->
getBYSETPOS() ,
'text').
", ".
 
  690                 $this->recurrence_id = $next_id;
 
  708                 $query = 
"UPDATE cal_recurrence_rules SET ".
 
  709                         "cal_id = ".$this->db->quote($this->cal_id ,
'integer').
", ".
 
  710                         "cal_recurrence = 1,".
 
  712                         "freq_until_date = ".$this->db->quote($until_date ,
'timestamp').
", ".
 
  714                         "intervall = ".$this->db->quote($this->
getInterval() ,
'integer').
", ".
 
  715                         "byday = ".$this->db->quote($this->
getBYDAY() ,
'text').
", ".
 
  716                         "byweekno = ".$this->db->quote($this->
getBYWEEKNO() ,
'text').
", ".
 
  717                         "bymonth = ".$this->db->quote($this->
getBYMONTH() ,
'text').
", ".
 
  718                         "bymonthday = ".$this->db->quote($this->
getBYMONTHDAY() ,
'text').
", ".
 
  719                         "byyearday = ".$this->db->quote($this->
getBYYEARDAY() ,
'text').
", ".
 
  720                         "bysetpos = ".$this->db->quote($this->
getBYSETPOS() ,
'text').
", ".
 
  721                         "weekstart = ".$this->db->quote($this->
getWeekstart() ,
'text').
" ".
 
  722                         "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer').
" ";
 
  733         public function delete()
 
  737                 $query = 
"DELETE FROM cal_recurrence_rules ".
 
  738                         "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer');
 
  753                 $query = 
"SELECT * FROM cal_recurrence_rules ".
 
  754                         "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer').
" ";
 
  758                         $this->cal_id = 
$row->cal_id;
 
  759                         $this->recurrence_type = 
$row->cal_recurrence;
 
  760                         $this->freq_type = 
$row->freq_type;
 
  762                         if(
$row->freq_until_date != null)
 
  766                         $this->freq_until_count = 
$row->freq_until_count;
 
  767                         $this->interval = 
$row->intervall;
 
  768                         $this->byday = 
$row->byday;
 
  769                         $this->byweekno = 
$row->byweekno;
 
  770                         $this->bymonth = 
$row->bymonth;
 
  771                         $this->bymonthday = 
$row->bymonthday;
 
  772                         $this->byyearday = 
$row->byyearday;
 
  773                         $this->bysetpos = 
$row->bysetpos;
 
  774                         $this->weekstart = 
$row->week_start;