ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilCalendarRecurrence Class Reference
+ Inheritance diagram for ilCalendarRecurrence:
+ Collaboration diagram for ilCalendarRecurrence:

Public Member Functions

 __construct ($a_rec_id=0)
 Constructor. More...
 
 toICal ($a_user_id)
 Get ical presentation for calendar recurrence. More...
 
 reset ()
 reset all settings More...
 
 getRecurrenceId ()
 get recurrence id More...
 
 setEntryId ($a_id)
 set cal id More...
 
 getEntryId ()
 Get calendar entry id. More...
 
 setRecurrence ($a_type)
 set type of recurrence More...
 
 isRecurrence ()
 is recurrence More...
 
 setFrequenceType ($a_type)
 set frequence type More...
 
 getFrequenceType ()
 get freq type More...
 
 getFrequenceUntilDate ()
 get until date More...
 
 setFrequenceUntilDate (ilDateTime $a_date=null)
 set freq until date More...
 
 setFrequenceUntilCount ($a_count)
 set frequence count More...
 
 getFrequenceUntilCount ()
 get frequence until count More...
 
 setInterval ($a_interval)
 set interval More...
 
 getInterval ()
 get interval More...
 
 setBYDAY ($a_byday)
 set by day More...
 
 getBYDAY ()
 get BYDAY More...
 
 getBYDAYList ()
 get BYDAY list More...
 
 setBYWEEKNO ($a_byweekno)
 set by day More...
 
 getBYWEEKNOList ()
 get byweekno list More...
 
 getBYWEEKNO ()
 get BYDAY More...
 
 setBYMONTH ($a_by)
 set by day More...
 
 getBYMONTH ()
 get BYDAY More...
 
 getBYMONTHList ()
 get bymonth list More...
 
 setBYMONTHDAY ($a_by)
 set by day More...
 
 getBYMONTHDAY ()
 get BYDAY More...
 
 getBYMONTHDAYList ()
 get BYMONTHDAY list More...
 
 setBYYEARDAY ($a_by)
 set by day More...
 
 getBYYEARDAY ()
 get BYDAY More...
 
 getBYYEARDAYList ()
 get BYYEARDAY list More...
 
 setBYSETPOS ($a_by)
 set by day More...
 
 getBYSETPOS ()
 get BYDAY More...
 
 getBYSETPOSList ()
 get bysetpos list More...
 
 setWeekstart ($a_start)
 set weekstart More...
 
 getWeekstart ()
 get weekstart More...
 
 getTimeZone ()
 get timezone More...
 
 setTimeZone ($a_tz)
 set timezone More...
 
 getExclusionDates ()
 Get exclusion dates. More...
 
 validate ()
 validate More...
 
 save ()
 save More...
 
 update ()
 save More...
 
 delete ()
 delete More...
 
 getFrequenceType ()
 Get Frequence type of recurrence. More...
 
 getTimeZone ()
 Get timezone of recurrence. More...
 
 getFrequenceUntilCount ()
 Get number of recurrences. More...
 
 getFrequenceUntilDate ()
 Get end data of recurrence. More...
 
 getInterval ()
 Get interval of recurrence. More...
 
 getBYMONTHList ()
 Get BYMONTHList. More...
 
 getBYWEEKNOList ()
 Get BYWEEKNOList. More...
 
 getBYYEARDAYList ()
 Get BYYEARDAYLIST. More...
 
 getBYMONTHDAYList ()
 GEt BYMONTHDAY List. More...
 
 getBYDAYList ()
 Get BYDAY List. More...
 
 getBYSETPOSList ()
 Get BYSETPOS List. More...
 
 getExclusionDates ()
 Get exclusion dates. More...
 
 validate ()
 validate recurrence More...
 

Static Public Member Functions

static _delete ($a_cal_id)
 delete More...
 

Data Fields

const REC_RECURRENCE = 0
 
const REC_EXCLUSION = 1
 
const FREQ_DAILY = 'DAILY'
 
const FREQ_WEEKLY = 'WEEKLY'
 
const FREQ_MONTHLY = 'MONTHLY'
 
const FREQ_YEARLY = 'YEARLY'
 

Protected Attributes

 $db
 

Private Member Functions

 read ()
 Read entry. More...
 

Private Attributes

 $recurrence_id
 
 $cal_id
 
 $recurrence_type
 
 $freq_type = ''
 
 $freq_until_type
 
 $freq_until_date = null
 
 $freq_until_count
 
 $interval = 0
 
 $byday = ''
 
 $byweekno = ''
 
 $bymonth = ''
 
 $bymonthday = ''
 
 $byyearday = ''
 
 $bysetpos = ''
 
 $weekstart = ''
 
 $exclusion_dates = array()
 
 $timezone = 'Europe/Berlin'
 

Detailed Description

Definition at line 43 of file class.ilCalendarRecurrence.php.

Constructor & Destructor Documentation

◆ __construct()

ilCalendarRecurrence::__construct (   $a_rec_id = 0)

Constructor.

@access public

Parameters
intrecurrence id

Definition at line 85 of file class.ilCalendarRecurrence.php.

86 {
87 global $DIC;
88
89 $ilDB = $DIC['ilDB'];
90
91 $this->db = $ilDB;
92 $this->recurrence_id = $a_rec_id;
93 if ($a_rec_id) {
94 $this->read();
95 }
96 }
global $ilDB
$DIC
Definition: xapitoken.php:46

References $DIC, $ilDB, and read().

+ Here is the call graph for this function:

Member Function Documentation

◆ _delete()

static ilCalendarRecurrence::_delete (   $a_cal_id)
static

delete

@access public

Parameters
intappointment id
Returns

Definition at line 106 of file class.ilCalendarRecurrence.php.

107 {
108 global $DIC;
109
110 $ilDB = $DIC['ilDB'];
111
112 $query = "DELETE FROM cal_recurrence_rules " .
113 "WHERE cal_id = " . $ilDB->quote($a_cal_id, 'integer') . " ";
114 $res = $ilDB->manipulate($query);
115
117 }
static delete($a_cal_id)
Delete exclusion dates of calendar entry.
$query
foreach($_POST as $key=> $value) $res

References $DIC, $ilDB, $query, $res, and ilCalendarRecurrenceExclusions\delete().

Referenced by ilCalendarEntry\_delete(), and ilCalendarEntry\delete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilCalendarRecurrence::delete ( )

delete

@access public

Reimplemented in ilEventRecurrence, and ilSessionRecurrence.

Definition at line 750 of file class.ilCalendarRecurrence.php.

751 {
752 global $DIC;
753
754 $ilDB = $DIC['ilDB'];
755
756 $query = "DELETE FROM cal_recurrence_rules " .
757 "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer');
758 $res = $ilDB->manipulate($query);
759 return true;
760 }

References $DIC, $ilDB, $query, and $res.

◆ getBYDAY()

ilCalendarRecurrence::getBYDAY ( )

get BYDAY

@access public

Definition at line 368 of file class.ilCalendarRecurrence.php.

References $byday.

Referenced by getBYDAYList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYDAYList()

ilCalendarRecurrence::getBYDAYList ( )

get BYDAY list

@access public

Returns

Implements ilCalendarRecurrenceCalculation.

Definition at line 379 of file class.ilCalendarRecurrence.php.

380 {
381 if (!trim($this->getBYDAY())) {
382 return array();
383 }
384 foreach (explode(',', $this->getBYDAY()) as $byday) {
385 $bydays[] = trim($byday);
386 }
387 return $bydays ? $bydays : array();
388 }

References $byday, and getBYDAY().

+ Here is the call graph for this function:

◆ getBYMONTH()

ilCalendarRecurrence::getBYMONTH ( )

get BYDAY

@access public

Definition at line 449 of file class.ilCalendarRecurrence.php.

References $bymonth.

Referenced by getBYMONTHList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYMONTHDAY()

ilCalendarRecurrence::getBYMONTHDAY ( )

get BYDAY

@access public

Definition at line 489 of file class.ilCalendarRecurrence.php.

References $bymonthday.

Referenced by getBYMONTHDAYList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYMONTHDAYList()

ilCalendarRecurrence::getBYMONTHDAYList ( )

get BYMONTHDAY list

@access public

Implements ilCalendarRecurrenceCalculation.

Definition at line 499 of file class.ilCalendarRecurrence.php.

500 {
501 if (!trim($this->getBYMONTHDAY())) {
502 return array();
503 }
504 foreach (explode(',', $this->getBYMONTHDAY()) as $month_num) {
505 $months[] = (int) $month_num;
506 }
507 return $months ? $months : array();
508 }

References getBYMONTHDAY().

+ Here is the call graph for this function:

◆ getBYMONTHList()

ilCalendarRecurrence::getBYMONTHList ( )

get bymonth list

@access public

Implements ilCalendarRecurrenceCalculation.

Definition at line 460 of file class.ilCalendarRecurrence.php.

461 {
462 if (!trim($this->getBYMONTH())) {
463 return array();
464 }
465 foreach (explode(',', $this->getBYMONTH()) as $month_num) {
466 $months[] = (int) $month_num;
467 }
468 return $months ? $months : array();
469 }

References getBYMONTH().

+ Here is the call graph for this function:

◆ getBYSETPOS()

ilCalendarRecurrence::getBYSETPOS ( )

get BYDAY

@access public

Definition at line 569 of file class.ilCalendarRecurrence.php.

References $bysetpos.

Referenced by getBYSETPOSList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYSETPOSList()

ilCalendarRecurrence::getBYSETPOSList ( )

get bysetpos list

@access public

Implements ilCalendarRecurrenceCalculation.

Definition at line 580 of file class.ilCalendarRecurrence.php.

581 {
582 if (!trim($this->getBYSETPOS())) {
583 return array();
584 }
585 foreach (explode(',', $this->getBYSETPOS()) as $pos) {
586 $positions[] = (int) $pos;
587 }
588 return $positions ? $positions : array();
589 }

References getBYSETPOS().

+ Here is the call graph for this function:

◆ getBYWEEKNO()

ilCalendarRecurrence::getBYWEEKNO ( )

get BYDAY

@access public

Definition at line 426 of file class.ilCalendarRecurrence.php.

References $byweekno.

Referenced by getBYWEEKNOList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYWEEKNOList()

ilCalendarRecurrence::getBYWEEKNOList ( )

get byweekno list

@access public

Implements ilCalendarRecurrenceCalculation.

Definition at line 408 of file class.ilCalendarRecurrence.php.

409 {
410 if (!trim($this->getBYWEEKNO())) {
411 return array();
412 }
413 foreach (explode(',', $this->getBYWEEKNO()) as $week_num) {
414 $weeks[] = (int) $week_num;
415 }
416 return $weeks ? $weeks : array();
417 }

References getBYWEEKNO().

+ Here is the call graph for this function:

◆ getBYYEARDAY()

ilCalendarRecurrence::getBYYEARDAY ( )

get BYDAY

@access public

Definition at line 529 of file class.ilCalendarRecurrence.php.

References $byyearday.

Referenced by getBYYEARDAYList(), save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getBYYEARDAYList()

ilCalendarRecurrence::getBYYEARDAYList ( )

get BYYEARDAY list

@access public

Implements ilCalendarRecurrenceCalculation.

Definition at line 540 of file class.ilCalendarRecurrence.php.

541 {
542 if (!trim($this->getBYYEARDAY())) {
543 return array();
544 }
545 foreach (explode(',', $this->getBYYEARDAY()) as $year_day) {
546 $days[] = (int) $year_day;
547 }
548 return $days ? $days : array();
549 }

References getBYYEARDAY().

+ Here is the call graph for this function:

◆ getEntryId()

ilCalendarRecurrence::getEntryId ( )

Get calendar entry id.

Returns
int

Definition at line 229 of file class.ilCalendarRecurrence.php.

References $cal_id.

Referenced by toICal().

+ Here is the caller graph for this function:

◆ getExclusionDates()

ilCalendarRecurrence::getExclusionDates ( )

Get exclusion dates.

Returns

Implements ilCalendarRecurrenceCalculation.

Definition at line 642 of file class.ilCalendarRecurrence.php.

643 {
644 return (array) $this->exclusion_dates;
645 }

References $exclusion_dates.

◆ getFrequenceType()

ilCalendarRecurrence::getFrequenceType ( )

get freq type

@access public

Implements ilCalendarRecurrenceCalculation.

Definition at line 276 of file class.ilCalendarRecurrence.php.

References $freq_type.

Referenced by save(), toICal(), update(), and validate().

+ Here is the caller graph for this function:

◆ getFrequenceUntilCount()

ilCalendarRecurrence::getFrequenceUntilCount ( )

get frequence until count

@access public

Parameters

Implements ilCalendarRecurrenceCalculation.

Definition at line 322 of file class.ilCalendarRecurrence.php.

References $freq_until_count.

Referenced by save(), toICal(), update(), and validate().

+ Here is the caller graph for this function:

◆ getFrequenceUntilDate()

ilCalendarRecurrence::getFrequenceUntilDate ( )

get until date

@access public

Implements ilCalendarRecurrenceCalculation.

Definition at line 287 of file class.ilCalendarRecurrence.php.

288 {
289 return is_object($this->freq_until_date) ? $this->freq_until_date : null;
290 }

Referenced by save(), toICal(), and update().

+ Here is the caller graph for this function:

◆ getInterval()

ilCalendarRecurrence::getInterval ( )

get interval

@access public

Implements ilCalendarRecurrenceCalculation.

Definition at line 345 of file class.ilCalendarRecurrence.php.

346 {
347 return $this->interval ? $this->interval : 1;
348 }

Referenced by save(), toICal(), update(), and validate().

+ Here is the caller graph for this function:

◆ getRecurrenceId()

ilCalendarRecurrence::getRecurrenceId ( )

get recurrence id

@access public

Returns

Definition at line 207 of file class.ilCalendarRecurrence.php.

References $recurrence_id.

◆ getTimeZone()

ilCalendarRecurrence::getTimeZone ( )

get timezone

@access public

Implements ilCalendarRecurrenceCalculation.

Definition at line 621 of file class.ilCalendarRecurrence.php.

References $timezone.

◆ getWeekstart()

ilCalendarRecurrence::getWeekstart ( )

get weekstart

@access public

Definition at line 610 of file class.ilCalendarRecurrence.php.

References $weekstart.

Referenced by save(), and update().

+ Here is the caller graph for this function:

◆ isRecurrence()

ilCalendarRecurrence::isRecurrence ( )

is recurrence

@access public

Parameters

Definition at line 253 of file class.ilCalendarRecurrence.php.

254 {
255 return $this->recurrence_type == self::REC_RECURRENCE;
256 }

References REC_RECURRENCE.

◆ read()

ilCalendarRecurrence::read ( )
private

Read entry.

@access private

Definition at line 768 of file class.ilCalendarRecurrence.php.

769 {
770 global $DIC;
771
772 $ilDB = $DIC['ilDB'];
773
774 $query = "SELECT * FROM cal_recurrence_rules " .
775 "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer') . " ";
776 $res = $this->db->query($query);
777 while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
778 $this->cal_id = $row->cal_id;
779 $this->recurrence_type = $row->cal_recurrence;
780 $this->freq_type = $row->freq_type;
781
782 if ($row->freq_until_date != null) {
783 $this->freq_until_date = new ilDateTime($row->freq_until_date, IL_CAL_DATETIME, 'UTC');
784 }
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;
794 }
795
796 $this->exclusion_dates = ilCalendarRecurrenceExclusions::getExclusionDates($this->cal_id);
797 }
const IL_CAL_DATETIME
static getExclusionDates($a_cal_id)
Read exclusion dates.
@classDescription Date and time handling

References $DIC, $ilDB, $query, $res, ilDBConstants\FETCHMODE_OBJECT, ilCalendarRecurrenceExclusions\getExclusionDates(), and IL_CAL_DATETIME.

Referenced by __construct().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

ilCalendarRecurrence::reset ( )

reset all settings

@access public

Returns

Definition at line 186 of file class.ilCalendarRecurrence.php.

187 {
188 $this->setBYDAY('');
189 $this->setBYMONTHDAY('');
190 $this->setBYMONTH('');
191 $this->setBYSETPOS('');
192 $this->setBYWEEKNO('');
193 $this->setBYYEARDAY('');
194 $this->setFrequenceType('');
195 $this->setInterval(1);
196 $this->setFrequenceUntilCount(0);
197
198 return true;
199 }
setFrequenceType($a_type)
set frequence type
setBYWEEKNO($a_byweekno)
set by day
setFrequenceUntilCount($a_count)
set frequence count
setInterval($a_interval)
set interval

References setBYDAY(), setBYMONTH(), setBYMONTHDAY(), setBYSETPOS(), setBYWEEKNO(), setBYYEARDAY(), setFrequenceType(), setFrequenceUntilCount(), and setInterval().

+ Here is the call graph for this function:

◆ save()

ilCalendarRecurrence::save ( )

save

@access public

Reimplemented in ilEventRecurrence, and ilSessionRecurrence.

Definition at line 675 of file class.ilCalendarRecurrence.php.

676 {
677 global $DIC;
678
679 $ilDB = $DIC['ilDB'];
680
681 $until_date = is_null($this->getFrequenceUntilDate()) ?
682 null :
683 $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME, '', 'UTC');
684 $next_id = $ilDB->nextId('cal_recurrence_rules');
685
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) " .
688 "VALUES( " .
689 $ilDB->quote($next_id, 'integer') . ", " .
690 $this->db->quote($this->cal_id, 'integer') . ", " .
691 $ilDB->quote(1, 'integer') . ", " .
692 $ilDB->quote((string) $this->getFrequenceType(), 'text') . ", " .
693 $this->db->quote($until_date, 'timestamp') . ", " .
694 $this->db->quote((int) $this->getFrequenceUntilCount(), 'integer') . ", " .
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') . " " .
703 ")";
704 $res = $ilDB->manipulate($query);
705 $this->recurrence_id = $next_id;
706 return true;
707 }
getFrequenceUntilCount()
get frequence until count

References $DIC, $ilDB, $query, $res, getBYDAY(), getBYMONTH(), getBYMONTHDAY(), getBYSETPOS(), getBYWEEKNO(), getBYYEARDAY(), getFrequenceType(), getFrequenceUntilCount(), getFrequenceUntilDate(), getInterval(), getWeekstart(), and IL_CAL_DATETIME.

+ Here is the call graph for this function:

◆ setBYDAY()

ilCalendarRecurrence::setBYDAY (   $a_byday)

set by day

@access public

Parameters
stringbyday rule

Definition at line 357 of file class.ilCalendarRecurrence.php.

358 {
359 $this->byday = $a_byday;
360 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setBYMONTH()

ilCalendarRecurrence::setBYMONTH (   $a_by)

set by day

@access public

Parameters
stringbyday rule

Definition at line 438 of file class.ilCalendarRecurrence.php.

439 {
440 $this->bymonth = $a_by;
441 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setBYMONTHDAY()

ilCalendarRecurrence::setBYMONTHDAY (   $a_by)

set by day

@access public

Parameters
stringbyday rule

Definition at line 478 of file class.ilCalendarRecurrence.php.

479 {
480 $this->bymonthday = $a_by;
481 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setBYSETPOS()

ilCalendarRecurrence::setBYSETPOS (   $a_by)

set by day

@access public

Parameters
stringbyday rule

Definition at line 558 of file class.ilCalendarRecurrence.php.

559 {
560 $this->bysetpos = $a_by;
561 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setBYWEEKNO()

ilCalendarRecurrence::setBYWEEKNO (   $a_byweekno)

set by day

@access public

Parameters
stringbyday rule

Definition at line 397 of file class.ilCalendarRecurrence.php.

398 {
399 $this->byweekno = $a_byweekno;
400 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setBYYEARDAY()

ilCalendarRecurrence::setBYYEARDAY (   $a_by)

set by day

@access public

Parameters
stringbyday rule

Definition at line 518 of file class.ilCalendarRecurrence.php.

519 {
520 $this->byyearday = $a_by;
521 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setEntryId()

ilCalendarRecurrence::setEntryId (   $a_id)

set cal id

@access public

Parameters
intcalendar entry id

Definition at line 220 of file class.ilCalendarRecurrence.php.

221 {
222 $this->cal_id = $a_id;
223 }

◆ setFrequenceType()

ilCalendarRecurrence::setFrequenceType (   $a_type)

set frequence type

@access public

Parameters
intFREQUENCE_TYPE e.g MONTHLY, WEEKLY ...

Definition at line 265 of file class.ilCalendarRecurrence.php.

266 {
267 $this->freq_type = $a_type;
268 }
$a_type
Definition: workflow.php:92

References $a_type.

Referenced by reset().

+ Here is the caller graph for this function:

◆ setFrequenceUntilCount()

ilCalendarRecurrence::setFrequenceUntilCount (   $a_count)

set frequence count

@access public

Parameters
intcount

Definition at line 310 of file class.ilCalendarRecurrence.php.

311 {
312 $this->freq_until_count = $a_count;
313 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setFrequenceUntilDate()

ilCalendarRecurrence::setFrequenceUntilDate ( ilDateTime  $a_date = null)

set freq until date

@access public

Definition at line 298 of file class.ilCalendarRecurrence.php.

299 {
300 $this->freq_until_date = $a_date;
301 }

◆ setInterval()

ilCalendarRecurrence::setInterval (   $a_interval)

set interval

@access public

Parameters
intinterval

Definition at line 334 of file class.ilCalendarRecurrence.php.

335 {
336 $this->interval = $a_interval;
337 }

Referenced by reset().

+ Here is the caller graph for this function:

◆ setRecurrence()

ilCalendarRecurrence::setRecurrence (   $a_type)

set type of recurrence

@access public

Parameters
intREC_RECURRENCE or REC_EXLUSION defines whther the current object is a recurrence an exclusion pattern

Definition at line 241 of file class.ilCalendarRecurrence.php.

242 {
243 $this->recurrence_type = $a_type;
244 }

References $a_type.

◆ setTimeZone()

ilCalendarRecurrence::setTimeZone (   $a_tz)

set timezone

@access public

Parameters
stringtimezone

Definition at line 633 of file class.ilCalendarRecurrence.php.

634 {
635 $this->timezone = $a_tz;
636 }

◆ setWeekstart()

ilCalendarRecurrence::setWeekstart (   $a_start)

set weekstart

@access public

Parameters
stringweekstart

Definition at line 599 of file class.ilCalendarRecurrence.php.

600 {
601 $this->weekstart = $a_start;
602 }

◆ toICal()

ilCalendarRecurrence::toICal (   $a_user_id)

Get ical presentation for calendar recurrence.

Parameters
type$a_user_id
Returns
string

Definition at line 124 of file class.ilCalendarRecurrence.php.

125 {
126 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
127 $entry = new ilCalendarEntry($this->getEntryId());
128
129 $ical = 'RRULE:';
130 $ical .= ('FREQ=' . $this->getFrequenceType());
131
132 if ($this->getInterval()) {
133 $ical .= (';INTERVAL=' . $this->getInterval());
134 }
135 if ($this->getFrequenceUntilCount()) {
136 $ical .= (';COUNT=' . $this->getFrequenceUntilCount());
137 } elseif ($this->getFrequenceUntilDate()) {
138 if ($entry->isFullday()) {
139 $ical .= (';UNTIL=' . $this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE, 'Ymd'));
140 } else {
141 $his = $entry->getStart()->get(IL_CAL_FKT_DATE, 'His');
142 $ical .= (';UNTIL=' . $this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE, 'Ymd') . 'T' . $his);
143 }
144 }
145 if ($this->getBYMONTH()) {
146 $ical .= (';BYMONTH=' . $this->getBYMONTH());
147 }
148 if ($this->getBYWEEKNO()) {
149 $ical .= (';BYWEEKNO=' . $this->getBYWEEKNO());
150 }
151 if ($this->getBYYEARDAY()) {
152 $ical .= (';BYYEARDAY=' . $this->getBYYEARDAY());
153 }
154 if ($this->getBYMONTHDAY()) {
155 $ical .= (';BYMONTHDAY=' . $this->getBYMONTHDAY());
156 }
157 if ($this->getBYDAY()) {
158 $ical .= (';BYDAY=' . $this->getBYDAY());
159 }
160 if ($this->getBYSETPOS()) {
161 $ical .= (';BYSETPOS=' . $this->getBYSETPOS());
162 }
163
164 // Required in outlook
165 if ($this->getBYDAY()) {
166 include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
167 include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
169 if ($us->getWeekStart() == ilCalendarSettings::WEEK_START_MONDAY) {
170 $ical .= (';WKST=MO');
171 } else {
172 $ical .= (';WKST=SU');
173 }
174 }
175
176 return $ical;
177 }
const IL_CAL_FKT_DATE
Model for a calendar entry.
getEntryId()
Get calendar entry id.
static _getInstanceByUserId($a_user_id)
get singleton instance

References ilCalendarUserSettings\_getInstanceByUserId(), getBYDAY(), getBYMONTH(), getBYMONTHDAY(), getBYSETPOS(), getBYWEEKNO(), getBYYEARDAY(), getEntryId(), getFrequenceType(), getFrequenceUntilCount(), getFrequenceUntilDate(), getInterval(), IL_CAL_FKT_DATE, and ilCalendarSettings\WEEK_START_MONDAY.

+ Here is the call graph for this function:

◆ update()

ilCalendarRecurrence::update ( )

save

@access public

Reimplemented in ilEventRecurrence, and ilSessionRecurrence.

Definition at line 715 of file class.ilCalendarRecurrence.php.

716 {
717 global $DIC;
718
719 $ilDB = $DIC['ilDB'];
720
721 $until_date = is_null($this->getFrequenceUntilDate()) ?
722 null :
723 $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME, '', 'UTC');
724
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') . ", " .
730 "freq_until_count = " . $this->db->quote($this->getFrequenceUntilCount(), 'integer') . ", " .
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') . " ";
740 $res = $ilDB->manipulate($query);
741 return true;
742 }

References $DIC, $ilDB, $query, $res, getBYDAY(), getBYMONTH(), getBYMONTHDAY(), getBYSETPOS(), getBYWEEKNO(), getBYYEARDAY(), getFrequenceType(), getFrequenceUntilCount(), getFrequenceUntilDate(), getInterval(), getWeekstart(), and IL_CAL_DATETIME.

+ Here is the call graph for this function:

◆ validate()

ilCalendarRecurrence::validate ( )

validate

@access public

Returns
bool

Implements ilCalendarRecurrenceCalculation.

Definition at line 653 of file class.ilCalendarRecurrence.php.

654 {
656 if (!in_array($this->getFrequenceType(), $valid_frequences)) {
657 return false;
658 }
659 if ($this->getFrequenceUntilCount() < 0) {
660 return false;
661 }
662 if ($this->getInterval() <= 0) {
663 return false;
664 }
665 return true;
666 }
const IL_CAL_FREQ_YEARLY
const IL_CAL_FREQ_MONTHLY
const IL_CAL_FREQ_WEEKLY
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.

References getFrequenceType(), getFrequenceUntilCount(), getInterval(), IL_CAL_FREQ_DAILY, IL_CAL_FREQ_MONTHLY, IL_CAL_FREQ_WEEKLY, and IL_CAL_FREQ_YEARLY.

+ Here is the call graph for this function:

Field Documentation

◆ $byday

ilCalendarRecurrence::$byday = ''
private

Definition at line 66 of file class.ilCalendarRecurrence.php.

Referenced by getBYDAY(), and getBYDAYList().

◆ $bymonth

ilCalendarRecurrence::$bymonth = ''
private

Definition at line 68 of file class.ilCalendarRecurrence.php.

Referenced by getBYMONTH().

◆ $bymonthday

ilCalendarRecurrence::$bymonthday = ''
private

Definition at line 69 of file class.ilCalendarRecurrence.php.

Referenced by getBYMONTHDAY().

◆ $bysetpos

ilCalendarRecurrence::$bysetpos = ''
private

Definition at line 71 of file class.ilCalendarRecurrence.php.

Referenced by getBYSETPOS().

◆ $byweekno

ilCalendarRecurrence::$byweekno = ''
private

Definition at line 67 of file class.ilCalendarRecurrence.php.

Referenced by getBYWEEKNO().

◆ $byyearday

ilCalendarRecurrence::$byyearday = ''
private

Definition at line 70 of file class.ilCalendarRecurrence.php.

Referenced by getBYYEARDAY().

◆ $cal_id

ilCalendarRecurrence::$cal_id
private

Definition at line 57 of file class.ilCalendarRecurrence.php.

Referenced by getEntryId().

◆ $db

ilCalendarRecurrence::$db
protected

Definition at line 54 of file class.ilCalendarRecurrence.php.

◆ $exclusion_dates

ilCalendarRecurrence::$exclusion_dates = array()
private

Definition at line 74 of file class.ilCalendarRecurrence.php.

Referenced by getExclusionDates().

◆ $freq_type

ilCalendarRecurrence::$freq_type = ''
private

Definition at line 60 of file class.ilCalendarRecurrence.php.

Referenced by getFrequenceType().

◆ $freq_until_count

ilCalendarRecurrence::$freq_until_count
private

Definition at line 63 of file class.ilCalendarRecurrence.php.

Referenced by getFrequenceUntilCount().

◆ $freq_until_date

ilCalendarRecurrence::$freq_until_date = null
private

Definition at line 62 of file class.ilCalendarRecurrence.php.

◆ $freq_until_type

ilCalendarRecurrence::$freq_until_type
private

Definition at line 61 of file class.ilCalendarRecurrence.php.

◆ $interval

ilCalendarRecurrence::$interval = 0
private

Definition at line 65 of file class.ilCalendarRecurrence.php.

◆ $recurrence_id

ilCalendarRecurrence::$recurrence_id
private

Definition at line 56 of file class.ilCalendarRecurrence.php.

Referenced by getRecurrenceId().

◆ $recurrence_type

ilCalendarRecurrence::$recurrence_type
private

Definition at line 58 of file class.ilCalendarRecurrence.php.

◆ $timezone

ilCalendarRecurrence::$timezone = 'Europe/Berlin'
private

Definition at line 76 of file class.ilCalendarRecurrence.php.

Referenced by getTimeZone().

◆ $weekstart

ilCalendarRecurrence::$weekstart = ''
private

Definition at line 72 of file class.ilCalendarRecurrence.php.

Referenced by getWeekstart().

◆ FREQ_DAILY

◆ FREQ_MONTHLY

◆ FREQ_WEEKLY

◆ FREQ_YEARLY

◆ REC_EXCLUSION

const ilCalendarRecurrence::REC_EXCLUSION = 1

Definition at line 46 of file class.ilCalendarRecurrence.php.

◆ REC_RECURRENCE

const ilCalendarRecurrence::REC_RECURRENCE = 0

Definition at line 45 of file class.ilCalendarRecurrence.php.

Referenced by isRecurrence().


The documentation for this class was generated from the following file: