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').
" ";
123 include_once
'./Services/Calendar/classes/class.ilCalendarEntry.php';
127 $ical .= (
'FREQ='.$this->getFrequenceType());
131 $ical .= (
';INTERVAL='.$this->getInterval());
135 $ical .= (
';COUNT='.$this->getFrequenceUntilCount());
139 if($entry->isFullday())
141 $ical .= (
';UNTIL='.$this->getFrequenceUntilDate()->get(
IL_CAL_FKT_DATE,
'Ymd'));
146 $ical .= (
';UNTIL='.$this->getFrequenceUntilDate()->get(
IL_CAL_FKT_DATE,
'Ymd').
'T'.$his);
151 $ical .= (
';BYMONTH='.$this->getBYMONTH());
155 $ical .= (
';BYWEEKNO='.$this->getBYWEEKNO());
159 $ical .= (
';BYYEARDAY='.$this->getBYYEARDAY());
163 $ical .= (
';BYMONTHDAY='.$this->getBYMONTHDAY());
167 $ical .= (
';BYDAY='.$this->getBYDAY());
171 $ical .= (
';BYSETPOS='.$this->getBYSETPOS());
177 include_once
'./Services/Calendar/classes/class.ilCalendarUserSettings.php';
178 include_once
'./Services/Calendar/classes/class.ilCalendarSettings.php';
182 $ical .= (
';WKST=MO');
186 $ical .= (
';WKST=SU');
236 $this->cal_id = $a_id;
257 $this->recurrence_type =
$a_type;
269 return $this->recurrence_type == self::REC_RECURRENCE;
303 return is_object($this->freq_until_date) ? $this->freq_until_date : null;
314 $this->freq_until_date = $a_date;
326 $this->freq_until_count = $a_count;
350 $this->interval = $a_interval;
361 return $this->interval ? $this->interval : 1;
373 $this->byday = $a_byday;
401 $bydays[] = trim($byday);
403 return $bydays ? $bydays :
array();
415 $this->byweekno = $a_byweekno;
430 foreach(explode(
',',$this->
getBYWEEKNO()) as $week_num)
432 $weeks[] = (int) $week_num;
434 return $weeks ? $weeks :
array();
458 $this->bymonth = $a_by;
484 foreach(explode(
',',$this->
getBYMONTH()) as $month_num)
486 $months[] = (int) $month_num;
488 return $months ? $months :
array();
500 $this->bymonthday = $a_by;
527 $months[] = (int) $month_num;
529 return $months ? $months :
array();
543 $this->byyearday = $a_by;
569 foreach(explode(
',',$this->
getBYYEARDAY()) as $year_day)
571 $days[] = (int) $year_day;
573 return $days ? $days :
array();
585 $this->bysetpos = $a_by;
613 $positions[] = (int) $pos;
615 return $positions ? $positions :
array();
628 $this->weekstart = $a_start;
712 $next_id = $ilDB->nextId(
'cal_recurrence_rules');
714 $query =
"INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, ".
715 "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) ".
717 $ilDB->quote($next_id,
'integer').
", ".
718 $this->db->quote($this->cal_id ,
'integer').
", ".
719 $ilDB->quote(1,
'integer').
", ".
721 $this->db->quote($until_date,
'timestamp').
", ".
723 $this->db->quote((
int) $this->
getInterval() ,
'integer').
", ".
724 $this->db->quote((
string) $this->
getBYDAY() ,
'text').
", ".
725 $this->db->quote((
string) $this->
getBYWEEKNO() ,
'text').
", ".
726 $this->db->quote((
string) $this->
getBYMONTH() ,
'text').
", ".
727 $this->db->quote((
string) $this->
getBYMONTHDAY() ,
'text').
", ".
728 $this->db->quote((
string) $this->
getBYYEARDAY() ,
'text').
", ".
729 $this->db->quote((
string) $this->
getBYSETPOS() ,
'text').
", ".
730 $this->db->quote((
string) $this->
getWeekstart() ,
'text').
" ".
733 $this->recurrence_id = $next_id;
751 $query =
"UPDATE cal_recurrence_rules SET ".
752 "cal_id = ".$this->db->quote($this->cal_id ,
'integer').
", ".
753 "cal_recurrence = 1,".
755 "freq_until_date = ".$this->db->quote($until_date ,
'timestamp').
", ".
757 "intervall = ".$this->db->quote($this->
getInterval() ,
'integer').
", ".
758 "byday = ".$this->db->quote($this->
getBYDAY() ,
'text').
", ".
759 "byweekno = ".$this->db->quote($this->
getBYWEEKNO() ,
'text').
", ".
760 "bymonth = ".$this->db->quote($this->
getBYMONTH() ,
'text').
", ".
761 "bymonthday = ".$this->db->quote($this->
getBYMONTHDAY() ,
'text').
", ".
762 "byyearday = ".$this->db->quote($this->
getBYYEARDAY() ,
'text').
", ".
763 "bysetpos = ".$this->db->quote($this->
getBYSETPOS() ,
'text').
", ".
764 "weekstart = ".$this->db->quote($this->
getWeekstart() ,
'text').
" ".
765 "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer').
" ";
776 public function delete()
780 $query =
"DELETE FROM cal_recurrence_rules ".
781 "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer');
796 $query =
"SELECT * FROM cal_recurrence_rules ".
797 "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,
'integer').
" ";
801 $this->cal_id =
$row->cal_id;
802 $this->recurrence_type =
$row->cal_recurrence;
803 $this->freq_type =
$row->freq_type;
805 if(
$row->freq_until_date != null)
809 $this->freq_until_count =
$row->freq_until_count;
810 $this->interval =
$row->intervall;
811 $this->byday =
$row->byday;
812 $this->byweekno =
$row->byweekno;
813 $this->bymonth =
$row->bymonth;
814 $this->bymonthday =
$row->bymonthday;
815 $this->byyearday =
$row->byyearday;
816 $this->bysetpos =
$row->bysetpos;
817 $this->weekstart =
$row->week_start;
getBYDAYList()
get BYDAY list
const IL_CAL_FREQ_MONTHLY
Model for a calendar entry.
getEntryId()
Get calendar entry id.
setBYWEEKNO($a_byweekno)
set by day
setFrequenceUntilCount($a_count)
set frequence count
static _getInstanceByUserId($a_user_id)
get singleton instance
getBYMONTHList()
get bymonth list
setFrequenceUntilDate(ilDateTime $a_date=null)
set freq until date
setBYMONTHDAY($a_by)
set by day
getBYYEARDAYList()
get BYYEARDAY list
setFrequenceType($a_type)
set frequence type
setWeekstart($a_start)
set weekstart
getBYMONTHDAYList()
get BYMONTHDAY list
getExclusionDates()
Get exclusion dates.
getFrequenceType()
get freq type
isRecurrence()
is recurrence
setEntryId($a_id)
set cal id
getTimeZone()
get timezone
toICal($a_user_id)
Get ical presentation for calendar recurrence.
static delete($a_cal_id)
Delete exclusion dates of calendar entry.
setInterval($a_interval)
set interval
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
getBYSETPOSList()
get bysetpos list
getBYWEEKNOList()
get byweekno list
__construct($a_rec_id=0)
Constructor.
getWeekstart()
get weekstart
setBYMONTH($a_by)
set by day
Create styles array
The data for the language used.
static _delete($a_cal_id)
delete
getFrequenceUntilDate()
get until date
getRecurrenceId()
get recurrence id
static getExclusionDates($a_cal_id)
Read exclusion dates.
setRecurrence($a_type)
set type of recurrence
setBYSETPOS($a_by)
set by day
getInterval()
get interval
getFrequenceUntilCount()
get frequence until count
setBYDAY($a_byday)
set by day
setBYYEARDAY($a_by)
set by day
setTimeZone($a_tz)
set timezone
reset()
reset all settings