3 declare(strict_types=1);
68 $this->db = $DIC->database();
69 $this->recurrence_id = $a_rec_id;
75 public static function _delete(
int $a_cal_id): void
80 $query =
"DELETE FROM cal_recurrence_rules " .
81 "WHERE cal_id = " .
$ilDB->quote($a_cal_id,
'integer') .
" ";
90 public function toICal(
int $a_user_id): string
107 if ($entry->isFullday()) {
127 $ical .= (
';BYDAY=' . $this->
getBYDAY());
137 $ical .= (
';WKST=MO');
139 $ical .= (
';WKST=SU');
169 $this->cal_id = $a_id;
184 $this->recurrence_type = $a_type;
189 return $this->recurrence_type == self::REC_RECURRENCE;
194 $this->freq_type = $a_type;
204 return is_object($this->freq_until_date) ? $this->freq_until_date : null;
209 $this->freq_until_date = $a_date;
214 $this->freq_until_count = $a_count;
224 $this->interval = $a_interval;
238 $this->byday = $a_byday;
255 foreach (explode(
',', $this->
getBYDAY()) as $byday) {
256 $bydays[] = trim($byday);
263 $this->byweekno = $a_byweekno;
272 foreach (explode(
',', $this->
getBYWEEKNO()) as $week_num) {
273 $weeks[] = (
int) $week_num;
285 $this->bymonth = $a_by;
299 foreach (explode(
',', $this->
getBYMONTH()) as $month_num) {
300 $months[] = (
int) $month_num;
307 $this->bymonthday = $a_by;
321 foreach (explode(
',', $this->
getBYMONTHDAY()) as $month_num) {
322 $month[] = (
int) $month_num;
329 $this->byyearday = $a_by;
343 foreach (explode(
',', $this->
getBYYEARDAY()) as $year_day) {
344 $days[] = (
int) $year_day;
351 $this->bysetpos = $a_by;
365 foreach (explode(
',', $this->
getBYSETPOS()) as $pos) {
366 $positions[] = (
int) $pos;
373 $this->weekstart = $a_start;
388 $this->timezone = $a_tz;
404 $valid_frequences = array(self::FREQ_DAILY,
426 $next_id = $this->db->nextId(
'cal_recurrence_rules');
428 $query =
"INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, " .
429 "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) " .
431 $this->db->quote($next_id,
'integer') .
", " .
432 $this->db->quote($this->cal_id,
'integer') .
", " .
433 $this->db->quote(1,
'integer') .
", " .
435 $this->db->quote($until_date,
'timestamp') .
", " .
437 $this->db->quote($this->
getInterval(),
'integer') .
", " .
438 $this->db->quote($this->
getBYDAY(),
'text') .
", " .
439 $this->db->quote($this->
getBYWEEKNO(),
'text') .
", " .
440 $this->db->quote($this->
getBYMONTH(),
'text') .
", " .
442 $this->db->quote($this->
getBYYEARDAY(),
'text') .
", " .
443 $this->db->quote($this->
getBYSETPOS(),
'text') .
", " .
447 $this->recurrence_id = $next_id;
456 $query =
"UPDATE cal_recurrence_rules SET " .
457 "cal_id = " . $this->db->quote($this->cal_id,
'integer') .
", " .
458 "cal_recurrence = 1," .
459 "freq_type = " . $this->db->quote($this->
getFrequenceType(),
'text') .
", " .
460 "freq_until_date = " . $this->db->quote($until_date,
'timestamp') .
", " .
462 "intervall = " . $this->db->quote($this->
getInterval(),
'integer') .
", " .
463 "byday = " . $this->db->quote($this->
getBYDAY(),
'text') .
", " .
464 "byweekno = " . $this->db->quote($this->
getBYWEEKNO(),
'text') .
", " .
465 "bymonth = " . $this->db->quote($this->
getBYMONTH(),
'text') .
", " .
466 "bymonthday = " . $this->db->quote($this->
getBYMONTHDAY(),
'text') .
", " .
467 "byyearday = " . $this->db->quote($this->
getBYYEARDAY(),
'text') .
", " .
468 "bysetpos = " . $this->db->quote($this->
getBYSETPOS(),
'text') .
", " .
469 "weekstart = " . $this->db->quote($this->
getWeekstart(),
'text') .
" " .
470 "WHERE rule_id = " . $this->db->quote($this->recurrence_id,
'integer') .
" ";
474 public function delete():
void 476 $query =
"DELETE FROM cal_recurrence_rules " .
477 "WHERE rule_id = " . $this->db->quote($this->recurrence_id,
'integer');
483 $query =
"SELECT * FROM cal_recurrence_rules " .
484 "WHERE rule_id = " . $this->db->quote($this->recurrence_id,
'integer') .
" ";
487 $this->cal_id = (
int) $row->cal_id;
488 $this->recurrence_type = (
int) $row->cal_recurrence;
489 $this->freq_type = (string) $row->freq_type;
491 if ($row->freq_until_date != null) {
494 $this->freq_until_count = (
int) $row->freq_until_count;
495 $this->interval = (
int) $row->intervall;
496 $this->byday = (string) $row->byday;
497 $this->byweekno = (
string) $row->byweekno;
498 $this->bymonth = (string) $row->bymonth;
499 $this->bymonthday = (
string) $row->bymonthday;
500 $this->byyearday = (string) $row->byyearday;
501 $this->bysetpos = (
string) $row->bysetpos;
502 $this->weekstart = (string) $row->weekstart;
static delete(int $a_cal_id)
Delete exclusion dates of calendar entry.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setBYDAY(string $a_byday)
3.8.5.3.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
getBYMONTHList()
Get BYMONTHList.
__construct(int $a_rec_id=0)
setFrequenceUntilDate(ilDateTime $a_date=null)
setInterval(int $a_interval)
getBYYEARDAYList()
Get BYYEARDAYLIST.
getBYMONTHDAYList()
Get BYMONTHDAY List.
setFrequenceType(string $a_type)
setRecurrence(int $a_type)
set type of recurrence public
static _getInstanceByUserId(int $a_user_id)
getFrequenceType()
Get Frequence type of recurrence.
getTimeZone()
Get timezone of recurrence.
setBYWEEKNO(string $a_byweekno)
setTimeZone(string $a_tz)
if(!file_exists(getcwd() . '/ilias.ini.php'))
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setFrequenceUntilCount(int $a_count)
getBYSETPOSList()
Get BYSETPOS List.
getBYWEEKNOList()
Get BYWEEKNOList.
setBYYEARDAY(string $a_by)
setBYMONTHDAY(string $a_by)
toICal(int $a_user_id)
Get ical presentation for calendar recurrence.
getFrequenceUntilDate()
Get end data of recurrence.
setWeekstart(string $a_start)
static getExclusionDates($a_cal_id)
Read exclusion dates.
getInterval()
Get interval of recurrence.
getFrequenceUntilCount()
Get number of recurrences.
static _delete(int $a_cal_id)
setBYSETPOS(string $a_by)
reset()
reset all settings