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');
 
   92        $this->recurrence_id = $a_rec_id;
 
  112        $query = 
"DELETE FROM cal_recurrence_rules " .
 
  113            "WHERE cal_id = " . 
$ilDB->quote($a_cal_id, 
'integer') . 
" ";
 
  126        include_once 
'./Services/Calendar/classes/class.ilCalendarEntry.php';
 
  138            if ($entry->isFullday()) {
 
  158            $ical .= (
';BYDAY=' . $this->
getBYDAY());
 
  166            include_once 
'./Services/Calendar/classes/class.ilCalendarUserSettings.php';
 
  167            include_once 
'./Services/Calendar/classes/class.ilCalendarSettings.php';
 
  170                $ical .= (
';WKST=MO');
 
  172                $ical .= (
';WKST=SU');
 
  222        $this->cal_id = $a_id;
 
  243        $this->recurrence_type = 
$a_type;
 
  289        return is_object($this->freq_until_date) ? $this->freq_until_date : 
null;
 
  300        $this->freq_until_date = $a_date;
 
  312        $this->freq_until_count = $a_count;
 
  336        $this->interval = $a_interval;
 
  347        return $this->interval ? $this->interval : 1;
 
  359        $this->byday = $a_byday;
 
  387        return $bydays ? $bydays : array();
 
  399        $this->byweekno = $a_byweekno;
 
  413        foreach (explode(
',', $this->
getBYWEEKNO()) as $week_num) {
 
  414            $weeks[] = (int) $week_num;
 
  416        return $weeks ? $weeks : array();
 
  440        $this->bymonth = $a_by;
 
  465        foreach (explode(
',', $this->
getBYMONTH()) as $month_num) {
 
  466            $months[] = (int) $month_num;
 
  468        return $months ? $months : array();
 
  480        $this->bymonthday = $a_by;
 
  504        foreach (explode(
',', $this->
getBYMONTHDAY()) as $month_num) {
 
  505            $months[] = (int) $month_num;
 
  507        return $months ? $months : array();
 
  520        $this->byyearday = $a_by;
 
  545        foreach (explode(
',', $this->
getBYYEARDAY()) as $year_day) {
 
  546            $days[] = (int) $year_day;
 
  548        return $days ? $days : array();
 
  560        $this->bysetpos = $a_by;
 
  585        foreach (explode(
',', $this->
getBYSETPOS()) as $pos) {
 
  586            $positions[] = (int) $pos;
 
  588        return $positions ? $positions : array();
 
  601        $this->weekstart = $a_start;
 
  635        $this->timezone = $a_tz;
 
  684        $next_id = 
$ilDB->nextId(
'cal_recurrence_rules');
 
  686        $query = 
"INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, " .
 
  687            "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) " .
 
  689            $ilDB->quote($next_id, 
'integer') . 
", " .
 
  690            $this->db->quote($this->cal_id, 
'integer') . 
", " .
 
  691            $ilDB->quote(1, 
'integer') . 
", " .
 
  693            $this->db->quote($until_date, 
'timestamp') . 
", " .
 
  695            $this->db->quote((
int) $this->
getInterval(), 
'integer') . 
", " .
 
  696            $this->db->quote((
string) $this->
getBYDAY(), 
'text') . 
", " .
 
  697            $this->db->quote((
string) $this->
getBYWEEKNO(), 
'text') . 
", " .
 
  698            $this->db->quote((
string) $this->
getBYMONTH(), 
'text') . 
", " .
 
  699            $this->db->quote((
string) $this->
getBYMONTHDAY(), 
'text') . 
", " .
 
  700            $this->db->quote((
string) $this->
getBYYEARDAY(), 
'text') . 
", " .
 
  701            $this->db->quote((
string) $this->
getBYSETPOS(), 
'text') . 
", " .
 
  702            $this->db->quote((
string) $this->
getWeekstart(), 
'text') . 
" " .
 
  705        $this->recurrence_id = $next_id;
 
  725        $query = 
"UPDATE cal_recurrence_rules SET " .
 
  726            "cal_id = " . $this->db->quote($this->cal_id, 
'integer') . 
", " .
 
  727            "cal_recurrence = 1," .
 
  728            "freq_type = " . $this->db->quote($this->
getFrequenceType(), 
'text') . 
", " .
 
  729            "freq_until_date = " . $this->db->quote($until_date, 
'timestamp') . 
", " .
 
  731            "intervall = " . $this->db->quote($this->
getInterval(), 
'integer') . 
", " .
 
  732            "byday = " . $this->db->quote($this->
getBYDAY(), 
'text') . 
", " .
 
  733            "byweekno = " . $this->db->quote($this->
getBYWEEKNO(), 
'text') . 
", " .
 
  734            "bymonth = " . $this->db->quote($this->
getBYMONTH(), 
'text') . 
", " .
 
  735            "bymonthday = " . $this->db->quote($this->
getBYMONTHDAY(), 
'text') . 
", " .
 
  736            "byyearday = " . $this->db->quote($this->
getBYYEARDAY(), 
'text') . 
", " .
 
  737            "bysetpos = " . $this->db->quote($this->
getBYSETPOS(), 
'text') . 
", " .
 
  738            "weekstart = " . $this->db->quote($this->
getWeekstart(), 
'text') . 
" " .
 
  739            "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 
'integer') . 
" ";
 
  750    public function delete()
 
  756        $query = 
"DELETE FROM cal_recurrence_rules " .
 
  757            "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 
'integer');
 
  774        $query = 
"SELECT * FROM cal_recurrence_rules " .
 
  775            "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 
'integer') . 
" ";
 
  778            $this->cal_id = $row->cal_id;
 
  779            $this->recurrence_type = $row->cal_recurrence;
 
  780            $this->freq_type = $row->freq_type;
 
  782            if ($row->freq_until_date != 
null) {
 
  785            $this->freq_until_count = $row->freq_until_count;
 
  786            $this->interval = $row->intervall;
 
  787            $this->byday = $row->byday;
 
  788            $this->byweekno = $row->byweekno;
 
  789            $this->bymonth = $row->bymonth;
 
  790            $this->bymonthday = $row->bymonthday;
 
  791            $this->byyearday = $row->byyearday;
 
  792            $this->bysetpos = $row->bysetpos;
 
  793            $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