24include_once(
'./Services/Calendar/classes/class.ilDate.php');
 
   25include_once 
'./Services/Calendar/classes/class.ilCalendarRecurrenceExclusions.php';
 
   26include_once 
'./Services/Calendar/interfaces/interface.ilCalendarRecurrenceCalculation.php';
 
   38define(
'IL_CAL_FREQ_DAILY', 
'DAILY');
 
   39define(
'IL_CAL_FREQ_WEEKLY', 
'WEEKLY');
 
   40define(
'IL_CAL_FREQ_MONTHLY', 
'MONTHLY');
 
   41define(
'IL_CAL_FREQ_YEARLY', 
'YEARLY');
 
   90        $this->recurrence_id = $a_rec_id;
 
  108        $query = 
"DELETE FROM cal_recurrence_rules " .
 
  109            "WHERE cal_id = " . 
$ilDB->quote($a_cal_id, 
'integer') . 
" ";
 
  122        include_once 
'./Services/Calendar/classes/class.ilCalendarEntry.php';
 
  134            if ($entry->isFullday()) {
 
  154            $ical .= (
';BYDAY=' . $this->
getBYDAY());
 
  162            include_once 
'./Services/Calendar/classes/class.ilCalendarUserSettings.php';
 
  163            include_once 
'./Services/Calendar/classes/class.ilCalendarSettings.php';
 
  166                $ical .= (
';WKST=MO');
 
  168                $ical .= (
';WKST=SU');
 
  218        $this->cal_id = $a_id;
 
  239        $this->recurrence_type = 
$a_type;
 
  285        return is_object($this->freq_until_date) ? $this->freq_until_date : 
null;
 
  296        $this->freq_until_date = $a_date;
 
  308        $this->freq_until_count = $a_count;
 
  332        $this->interval = $a_interval;
 
  343        return $this->interval ? $this->interval : 1;
 
  355        $this->byday = $a_byday;
 
  383        return $bydays ? $bydays : array();
 
  395        $this->byweekno = $a_byweekno;
 
  409        foreach (explode(
',', $this->
getBYWEEKNO()) as $week_num) {
 
  410            $weeks[] = (int) $week_num;
 
  412        return $weeks ? $weeks : array();
 
  436        $this->bymonth = $a_by;
 
  461        foreach (explode(
',', $this->
getBYMONTH()) as $month_num) {
 
  462            $months[] = (int) $month_num;
 
  464        return $months ? $months : array();
 
  476        $this->bymonthday = $a_by;
 
  500        foreach (explode(
',', $this->
getBYMONTHDAY()) as $month_num) {
 
  501            $months[] = (int) $month_num;
 
  503        return $months ? $months : array();
 
  516        $this->byyearday = $a_by;
 
  541        foreach (explode(
',', $this->
getBYYEARDAY()) as $year_day) {
 
  542            $days[] = (int) $year_day;
 
  544        return $days ? $days : array();
 
  556        $this->bysetpos = $a_by;
 
  581        foreach (explode(
',', $this->
getBYSETPOS()) as $pos) {
 
  582            $positions[] = (int) $pos;
 
  584        return $positions ? $positions : array();
 
  597        $this->weekstart = $a_start;
 
  631        $this->timezone = $a_tz;
 
  678        $next_id = 
$ilDB->nextId(
'cal_recurrence_rules');
 
  680        $query = 
"INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, " .
 
  681            "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) " .
 
  683            $ilDB->quote($next_id, 
'integer') . 
", " .
 
  684            $this->db->quote($this->cal_id, 
'integer') . 
", " .
 
  685            $ilDB->quote(1, 
'integer') . 
", " .
 
  687            $this->db->quote($until_date, 
'timestamp') . 
", " .
 
  689            $this->db->quote((
int) $this->
getInterval(), 
'integer') . 
", " .
 
  690            $this->db->quote((
string) $this->
getBYDAY(), 
'text') . 
", " .
 
  691            $this->db->quote((
string) $this->
getBYWEEKNO(), 
'text') . 
", " .
 
  692            $this->db->quote((
string) $this->
getBYMONTH(), 
'text') . 
", " .
 
  693            $this->db->quote((
string) $this->
getBYMONTHDAY(), 
'text') . 
", " .
 
  694            $this->db->quote((
string) $this->
getBYYEARDAY(), 
'text') . 
", " .
 
  695            $this->db->quote((
string) $this->
getBYSETPOS(), 
'text') . 
", " .
 
  696            $this->db->quote((
string) $this->
getWeekstart(), 
'text') . 
" " .
 
  699        $this->recurrence_id = $next_id;
 
  717        $query = 
"UPDATE cal_recurrence_rules SET " .
 
  718            "cal_id = " . $this->db->quote($this->cal_id, 
'integer') . 
", " .
 
  719            "cal_recurrence = 1," .
 
  720            "freq_type = " . $this->db->quote($this->
getFrequenceType(), 
'text') . 
", " .
 
  721            "freq_until_date = " . $this->db->quote($until_date, 
'timestamp') . 
", " .
 
  723            "intervall = " . $this->db->quote($this->
getInterval(), 
'integer') . 
", " .
 
  724            "byday = " . $this->db->quote($this->
getBYDAY(), 
'text') . 
", " .
 
  725            "byweekno = " . $this->db->quote($this->
getBYWEEKNO(), 
'text') . 
", " .
 
  726            "bymonth = " . $this->db->quote($this->
getBYMONTH(), 
'text') . 
", " .
 
  727            "bymonthday = " . $this->db->quote($this->
getBYMONTHDAY(), 
'text') . 
", " .
 
  728            "byyearday = " . $this->db->quote($this->
getBYYEARDAY(), 
'text') . 
", " .
 
  729            "bysetpos = " . $this->db->quote($this->
getBYSETPOS(), 
'text') . 
", " .
 
  730            "weekstart = " . $this->db->quote($this->
getWeekstart(), 
'text') . 
" " .
 
  731            "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 
'integer') . 
" ";
 
  742    public function delete()
 
  746        $query = 
"DELETE FROM cal_recurrence_rules " .
 
  747            "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 
'integer');
 
  762        $query = 
"SELECT * FROM cal_recurrence_rules " .
 
  763            "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 
'integer') . 
" ";
 
  766            $this->cal_id = 
$row->cal_id;
 
  767            $this->recurrence_type = 
$row->cal_recurrence;
 
  768            $this->freq_type = 
$row->freq_type;
 
  770            if (
$row->freq_until_date != 
null) {
 
  773            $this->freq_until_count = 
$row->freq_until_count;
 
  774            $this->interval = 
$row->intervall;
 
  775            $this->byday = 
$row->byday;
 
  776            $this->byweekno = 
$row->byweekno;
 
  777            $this->bymonth = 
$row->bymonth;
 
  778            $this->bymonthday = 
$row->bymonthday;
 
  779            $this->byyearday = 
$row->byyearday;
 
  780            $this->bysetpos = 
$row->bysetpos;
 
  781            $this->weekstart = 
$row->week_start;
 
An exception for terminatinating execution or to throw for unit testing.
const IL_CAL_FREQ_MONTHLY
Model for a calendar entry.
static delete($a_cal_id)
Delete exclusion dates of calendar entry.
static getExclusionDates($a_cal_id)
Read exclusion dates.
getBYSETPOSList()
get bysetpos list
setRecurrence($a_type)
set type of recurrence
getFrequenceType()
get freq type
getTimeZone()
get timezone
setFrequenceType($a_type)
set frequence type
toICal($a_user_id)
Get ical presentation for calendar recurrence.
setTimeZone($a_tz)
set timezone
setBYWEEKNO($a_byweekno)
set by day
reset()
reset all settings
getRecurrenceId()
get recurrence id
getFrequenceUntilCount()
get frequence until count
getExclusionDates()
Get exclusion dates.
setFrequenceUntilCount($a_count)
set frequence count
getWeekstart()
get weekstart
getInterval()
get interval
getBYDAYList()
get BYDAY list
setBYYEARDAY($a_by)
set by day
getBYMONTHDAYList()
get BYMONTHDAY list
setBYMONTH($a_by)
set by day
setBYMONTHDAY($a_by)
set by day
getBYWEEKNOList()
get byweekno list
getEntryId()
Get calendar entry id.
setInterval($a_interval)
set interval
getFrequenceUntilDate()
get until date
getBYMONTHList()
get bymonth list
static _delete($a_cal_id)
delete
setWeekstart($a_start)
set weekstart
setFrequenceUntilDate(ilDateTime $a_date=null)
set freq until date
__construct($a_rec_id=0)
Constructor.
setBYSETPOS($a_by)
set by day
isRecurrence()
is recurrence
setBYDAY($a_byday)
set by day
setEntryId($a_id)
set cal id
getBYYEARDAYList()
get BYYEARDAY list
static _getInstanceByUserId($a_user_id)
get singleton instance
@classDescription Date and time handling
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
foreach($_POST as $key=> $value) $res