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;
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;
251 return $this->recurrence_type == self::REC_RECURRENCE;
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;
381 $bydays[] = trim($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;
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;
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.
foreach($_POST as $key=> $value) $res
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