24 include_once(
'./Services/Calendar/classes/class.ilDate.php');
 
   25 include_once 
'./Services/Calendar/classes/class.ilCalendarRecurrenceExclusions.php';
 
   26 include_once 
'./Services/Calendar/interfaces/interface.ilCalendarRecurrenceCalculation.php';
 
   38 define(
'IL_CAL_FREQ_DAILY',
'DAILY');
 
   39 define(
'IL_CAL_FREQ_WEEKLY',
'WEEKLY');
 
   40 define(
'IL_CAL_FREQ_MONTHLY',
'MONTHLY');
 
   41 define(
'IL_CAL_FREQ_YEARLY',
'YEARLY');
 
   90                 $this->recurrence_id = $a_rec_id;
 
  109                 $query = 
"DELETE FROM cal_recurrence_rules ".
 
  110                         "WHERE cal_id = ".$ilDB->quote($a_cal_id ,
'integer').
" ";
 
  119                 $ical .= (
'FREQ='.$this->getFrequenceType());
 
  123                         $ical .= (
';INTERVAL='.$this->getInterval());
 
  127                         $ical .= (
';COUNT='.$this->getFrequenceUntilCount());
 
  131                         $ical .= (
';UNTIL='.$this->getFrequenceUntilDate()->get(
IL_CAL_FKT_DATE,
'Ymd'));
 
  135                         $ical .= (
';BYMONTH='.$this->getBYMONTH());
 
  139                         $ical .= (
';BYWEEKNO='.$this->getBYWEEKNO());
 
  143                         $ical .= (
';BYYEARDAY='.$this->getBYYEARDAY());
 
  147                         $ical .= (
';BYMONTHDAY='.$this->getBYMONTHDAY());
 
  151                         $ical .= (
';BYDAY='.$this->getBYDAY());
 
  155                         $ical .= (
';BYSETPOS='.$this->getBYSETPOS());
 
  161                         include_once 
'./Services/Calendar/classes/class.ilCalendarUserSettings.php';
 
  162                         include_once 
'./Services/Calendar/classes/class.ilCalendarSettings.php';
 
  166                                 $ical .= (
';WKST=MO');
 
  170                                 $ical .= (
';WKST=SU');
 
  220                 $this->cal_id = $a_id;
 
  232                 $this->recurrence_type = $a_type;
 
  256                 $this->freq_type = $a_type;
 
  278                 return is_object($this->freq_until_date) ? $this->freq_until_date : null;
 
  289                 $this->freq_until_date = $a_date;
 
  301                 $this->freq_until_count = $a_count;
 
  325                 $this->interval = $a_interval;
 
  336                 return $this->interval ? $this->interval : 1;
 
  348                 $this->byday = $a_byday;
 
  376                         $bydays[] = trim($byday);
 
  378                 return $bydays ? $bydays : array();
 
  390                 $this->byweekno = $a_byweekno;
 
  405                 foreach(explode(
',',$this->
getBYWEEKNO()) as $week_num)
 
  407                         $weeks[] = (int) $week_num;
 
  409                 return $weeks ? $weeks : array();
 
  433                 $this->bymonth = $a_by;
 
  459                 foreach(explode(
',',$this->
getBYMONTH()) as $month_num)
 
  461                         $months[] = (int) $month_num;
 
  463                 return $months ? $months : array();
 
  475                 $this->bymonthday = $a_by;
 
  502                         $months[] = (int) $month_num;
 
  504                 return $months ? $months : array();
 
  518                 $this->byyearday = $a_by;
 
  544                 foreach(explode(
',',$this->
getBYYEARDAY()) as $year_day)
 
  546                         $days[] = (int) $year_day;
 
  548                 return $days ? $days : array();
 
  560                 $this->bysetpos = $a_by;
 
  588                         $positions[] = (int) $pos;
 
  590                 return $positions ? $positions : array();
 
  603                 $this->weekstart = $a_start;
 
  637                 $this->timezone = $a_tz;
 
  687                 $next_id = $ilDB->nextId(
'cal_recurrence_rules');
 
  689                 $query = 
"INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, ".
 
  690                         "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) ".
 
  692                         $ilDB->quote($next_id,
'integer').
", ".
 
  693                         $this->db->quote($this->cal_id ,
'integer').
", ".
 
  694                         $ilDB->quote(1,
'integer').
", ".
 
  696                         $this->db->quote($until_date,
'timestamp').
", ".
 
  698                         $this->db->quote((
int) $this->
getInterval() ,
'integer').
", ".
 
  699                         $this->db->quote((
string) $this->
getBYDAY() ,
'text').
", ".
 
  700                         $this->db->quote((
string) $this->
getBYWEEKNO() ,
'text').
", ".
 
  701                         $this->db->quote((
string) $this->
getBYMONTH() ,
'text').
", ".
 
  702                         $this->db->quote((
string) $this->
getBYMONTHDAY() ,
'text').
", ".
 
  703                         $this->db->quote((
string) $this->
getBYYEARDAY() ,
'text').
", ".
 
  704                         $this->db->quote((
string) $this->
getBYSETPOS() ,
'text').
", ".
 
  705                         $this->db->quote((
string) $this->
getWeekstart() ,
'text').
" ".
 
  708                 $this->recurrence_id = $next_id;
 
  726                 $query = 
"UPDATE cal_recurrence_rules SET ".
 
  727                         "cal_id = ".$this->db->quote($this->cal_id ,
'integer').
", ".
 
  728                         "cal_recurrence = 1,".
 
  730                         "freq_until_date = ".$this->db->quote($until_date ,
'timestamp').
", ".
 
  732                         "intervall = ".$this->db->quote($this->
getInterval() ,
'integer').
", ".
 
  733                         "byday = ".$this->db->quote($this->
getBYDAY() ,
'text').
", ".
 
  734                         "byweekno = ".$this->db->quote($this->
getBYWEEKNO() ,
'text').
", ".
 
  735                         "bymonth = ".$this->db->quote($this->
getBYMONTH() ,
'text').
", ".
 
  736                         "bymonthday = ".$this->db->quote($this->
getBYMONTHDAY() ,
'text').
", ".
 
  737                         "byyearday = ".$this->db->quote($this->
getBYYEARDAY() ,
'text').
", ".
 
  738                         "bysetpos = ".$this->db->quote($this->
getBYSETPOS() ,
'text').
", ".
 
  739                         "weekstart = ".$this->db->quote($this->
getWeekstart() ,
'text').
" ".
 
  740                         "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer').
" ";
 
  751         public function delete()
 
  755                 $query = 
"DELETE FROM cal_recurrence_rules ".
 
  756                         "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer');
 
  771                 $query = 
"SELECT * FROM cal_recurrence_rules ".
 
  772                         "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer').
" ";
 
  776                         $this->cal_id = 
$row->cal_id;
 
  777                         $this->recurrence_type = 
$row->cal_recurrence;
 
  778                         $this->freq_type = 
$row->freq_type;
 
  780                         if(
$row->freq_until_date != null)
 
  784                         $this->freq_until_count = 
$row->freq_until_count;
 
  785                         $this->interval = 
$row->intervall;
 
  786                         $this->byday = 
$row->byday;
 
  787                         $this->byweekno = 
$row->byweekno;
 
  788                         $this->bymonth = 
$row->bymonth;
 
  789                         $this->bymonthday = 
$row->bymonthday;
 
  790                         $this->byyearday = 
$row->byyearday;
 
  791                         $this->bysetpos = 
$row->bysetpos;
 
  792                         $this->weekstart = 
$row->week_start;