ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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 $ilDB;
88
89 $this->db = $ilDB;
90 $this->recurrence_id = $a_rec_id;
91 if($a_rec_id)
92 {
93 $this->read();
94 }
95 }
global $ilDB

References $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 105 of file class.ilCalendarRecurrence.php.

106 {
107 global $ilDB;
108
109 $query = "DELETE FROM cal_recurrence_rules ".
110 "WHERE cal_id = ".$ilDB->quote($a_cal_id ,'integer')." ";
111 $res = $ilDB->manipulate($query);
112
114 }
static delete($a_cal_id)
Delete exclusion dates of calendar entry.

References $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 776 of file class.ilCalendarRecurrence.php.

777 {
778 global $ilDB;
779
780 $query = "DELETE FROM cal_recurrence_rules ".
781 "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,'integer');
782 $res = $ilDB->manipulate($query);
783 return true;
784 }

References $ilDB, $query, and $res.

◆ getBYDAY()

ilCalendarRecurrence::getBYDAY ( )

get BYDAY

@access public

Definition at line 382 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 393 of file class.ilCalendarRecurrence.php.

394 {
395 if(!trim($this->getBYDAY()))
396 {
397 return array();
398 }
399 foreach(explode(',',$this->getBYDAY()) as $byday)
400 {
401 $bydays[] = trim($byday);
402 }
403 return $bydays ? $bydays : array();
404 }

References $byday, and getBYDAY().

+ Here is the call graph for this function:

◆ getBYMONTH()

ilCalendarRecurrence::getBYMONTH ( )

get BYDAY

@access public

Definition at line 467 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 509 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 519 of file class.ilCalendarRecurrence.php.

520 {
521 if(!trim($this->getBYMONTHDAY()))
522 {
523 return array();
524 }
525 foreach(explode(',',$this->getBYMONTHDAY()) as $month_num)
526 {
527 $months[] = (int) $month_num;
528 }
529 return $months ? $months : array();
530
531 }

References getBYMONTHDAY().

+ Here is the call graph for this function:

◆ getBYMONTHList()

ilCalendarRecurrence::getBYMONTHList ( )

get bymonth list

@access public

Implements ilCalendarRecurrenceCalculation.

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

479 {
480 if(!trim($this->getBYMONTH()))
481 {
482 return array();
483 }
484 foreach(explode(',',$this->getBYMONTH()) as $month_num)
485 {
486 $months[] = (int) $month_num;
487 }
488 return $months ? $months : array();
489 }

References getBYMONTH().

+ Here is the call graph for this function:

◆ getBYSETPOS()

ilCalendarRecurrence::getBYSETPOS ( )

get BYDAY

@access public

Definition at line 594 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 605 of file class.ilCalendarRecurrence.php.

606 {
607 if(!trim($this->getBYSETPOS()))
608 {
609 return array();
610 }
611 foreach(explode(',',$this->getBYSETPOS()) as $pos)
612 {
613 $positions[] = (int) $pos;
614 }
615 return $positions ? $positions : array();
616 }

References getBYSETPOS().

+ Here is the call graph for this function:

◆ getBYWEEKNO()

ilCalendarRecurrence::getBYWEEKNO ( )

get BYDAY

@access public

Definition at line 444 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 424 of file class.ilCalendarRecurrence.php.

425 {
426 if(!trim($this->getBYWEEKNO()))
427 {
428 return array();
429 }
430 foreach(explode(',',$this->getBYWEEKNO()) as $week_num)
431 {
432 $weeks[] = (int) $week_num;
433 }
434 return $weeks ? $weeks : array();
435 }

References getBYWEEKNO().

+ Here is the call graph for this function:

◆ getBYYEARDAY()

ilCalendarRecurrence::getBYYEARDAY ( )

get BYDAY

@access public

Definition at line 552 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 563 of file class.ilCalendarRecurrence.php.

564 {
565 if(!trim($this->getBYYEARDAY()))
566 {
567 return array();
568 }
569 foreach(explode(',',$this->getBYYEARDAY()) as $year_day)
570 {
571 $days[] = (int) $year_day;
572 }
573 return $days ? $days : array();
574 }

References getBYYEARDAY().

+ Here is the call graph for this function:

◆ getEntryId()

ilCalendarRecurrence::getEntryId ( )

Get calendar entry id.

Returns
int

Definition at line 243 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 669 of file class.ilCalendarRecurrence.php.

670 {
671 return (array) $this->exclusion_dates;
672 }

References $exclusion_dates.

◆ getFrequenceType()

ilCalendarRecurrence::getFrequenceType ( )

get freq type

@access public

Implements ilCalendarRecurrenceCalculation.

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

References $freq_type.

Referenced by save(), 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 336 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 301 of file class.ilCalendarRecurrence.php.

302 {
303 return is_object($this->freq_until_date) ? $this->freq_until_date : null;
304 }

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 359 of file class.ilCalendarRecurrence.php.

360 {
361 return $this->interval ? $this->interval : 1;
362 }

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 221 of file class.ilCalendarRecurrence.php.

References $recurrence_id.

◆ getTimeZone()

ilCalendarRecurrence::getTimeZone ( )

get timezone

@access public

Implements ilCalendarRecurrenceCalculation.

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

References $timezone.

◆ getWeekstart()

ilCalendarRecurrence::getWeekstart ( )

get weekstart

@access public

Definition at line 637 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 267 of file class.ilCalendarRecurrence.php.

268 {
269 return $this->recurrence_type == self::REC_RECURRENCE;
270 }

References REC_RECURRENCE.

◆ read()

ilCalendarRecurrence::read ( )
private

Read entry.

@access private

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

793 {
794 global $ilDB;
795
796 $query = "SELECT * FROM cal_recurrence_rules ".
797 "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,'integer')." ";
798 $res = $this->db->query($query);
799 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
800 {
801 $this->cal_id = $row->cal_id;
802 $this->recurrence_type = $row->cal_recurrence;
803 $this->freq_type = $row->freq_type;
804
805 if($row->freq_until_date != null)
806 {
807 $this->freq_until_date = new ilDateTime($row->freq_until_date,IL_CAL_DATETIME,'UTC');
808 }
809 $this->freq_until_count = $row->freq_until_count;
810 $this->interval = $row->intervall;
811 $this->byday = $row->byday;
812 $this->byweekno = $row->byweekno;
813 $this->bymonth = $row->bymonth;
814 $this->bymonthday = $row->bymonthday;
815 $this->byyearday = $row->byyearday;
816 $this->bysetpos = $row->bysetpos;
817 $this->weekstart = $row->week_start;
818 }
819
820 $this->exclusion_dates = ilCalendarRecurrenceExclusions::getExclusionDates($this->cal_id);
821 }
const DB_FETCHMODE_OBJECT
Definition: class.ilDB.php:11
const IL_CAL_DATETIME
static getExclusionDates($a_cal_id)
Read exclusion dates.
@classDescription Date and time handling

References $ilDB, $query, $res, $row, DB_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 200 of file class.ilCalendarRecurrence.php.

201 {
202 $this->setBYDAY('');
203 $this->setBYMONTHDAY('');
204 $this->setBYMONTH('');
205 $this->setBYSETPOS('');
206 $this->setBYWEEKNO('');
207 $this->setBYYEARDAY('');
208 $this->setFrequenceType('');
209 $this->setInterval(1);
210 $this->setFrequenceUntilCount(0);
211
212 return true;
213 }
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 705 of file class.ilCalendarRecurrence.php.

706 {
707 global $ilDB;
708
709 $until_date = is_null($this->getFrequenceUntilDate()) ?
710 null :
711 $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME,'','UTC');
712 $next_id = $ilDB->nextId('cal_recurrence_rules');
713
714 $query = "INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, ".
715 "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) ".
716 "VALUES( ".
717 $ilDB->quote($next_id,'integer').", ".
718 $this->db->quote($this->cal_id ,'integer').", ".
719 $ilDB->quote(1,'integer').", ".
720 $ilDB->quote((string) $this->getFrequenceType() ,'text').", ".
721 $this->db->quote($until_date,'timestamp').", ".
722 $this->db->quote((int) $this->getFrequenceUntilCount() ,'integer').", ".
723 $this->db->quote((int) $this->getInterval() ,'integer').", ".
724 $this->db->quote((string) $this->getBYDAY() ,'text').", ".
725 $this->db->quote((string) $this->getBYWEEKNO() ,'text').", ".
726 $this->db->quote((string) $this->getBYMONTH() ,'text').", ".
727 $this->db->quote((string) $this->getBYMONTHDAY() ,'text').", ".
728 $this->db->quote((string) $this->getBYYEARDAY() ,'text').", ".
729 $this->db->quote((string) $this->getBYSETPOS() ,'text').", ".
730 $this->db->quote((string) $this->getWeekstart() ,'text')." ".
731 ")";
732 $res = $ilDB->manipulate($query);
733 $this->recurrence_id = $next_id;
734 return true;
735 }
getFrequenceUntilCount()
get frequence until count

References $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 371 of file class.ilCalendarRecurrence.php.

372 {
373 $this->byday = $a_byday;
374 }

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 456 of file class.ilCalendarRecurrence.php.

457 {
458 $this->bymonth = $a_by;
459 }

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 498 of file class.ilCalendarRecurrence.php.

499 {
500 $this->bymonthday = $a_by;
501 }

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 583 of file class.ilCalendarRecurrence.php.

584 {
585 $this->bysetpos = $a_by;
586 }

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 413 of file class.ilCalendarRecurrence.php.

414 {
415 $this->byweekno = $a_byweekno;
416 }

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 541 of file class.ilCalendarRecurrence.php.

542 {
543 $this->byyearday = $a_by;
544 }

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 234 of file class.ilCalendarRecurrence.php.

235 {
236 $this->cal_id = $a_id;
237 }

◆ setFrequenceType()

ilCalendarRecurrence::setFrequenceType (   $a_type)

set frequence type

@access public

Parameters
intFREQUENCE_TYPE e.g MONTHLY, WEEKLY ...

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

280 {
281 $this->freq_type = $a_type;
282 }

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 324 of file class.ilCalendarRecurrence.php.

325 {
326 $this->freq_until_count = $a_count;
327 }

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 312 of file class.ilCalendarRecurrence.php.

313 {
314 $this->freq_until_date = $a_date;
315 }

◆ setInterval()

ilCalendarRecurrence::setInterval (   $a_interval)

set interval

@access public

Parameters
intinterval

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

349 {
350 $this->interval = $a_interval;
351 }

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 255 of file class.ilCalendarRecurrence.php.

256 {
257 $this->recurrence_type = $a_type;
258 }

◆ setTimeZone()

ilCalendarRecurrence::setTimeZone (   $a_tz)

set timezone

@access public

Parameters
stringtimezone

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

661 {
662 $this->timezone = $a_tz;
663 }

◆ setWeekstart()

ilCalendarRecurrence::setWeekstart (   $a_start)

set weekstart

@access public

Parameters
stringweekstart

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

627 {
628 $this->weekstart = $a_start;
629 }

◆ toICal()

ilCalendarRecurrence::toICal (   $a_user_id)

Get ical presentation for calendar recurrence.

Parameters
type$a_user_id
Returns
string

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

122 {
123 include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
124 $entry = new ilCalendarEntry($this->getEntryId());
125
126 $ical = 'RRULE:';
127 $ical .= ('FREQ='.$this->getFrequenceType());
128
129 if($this->getInterval())
130 {
131 $ical .= (';INTERVAL='.$this->getInterval());
132 }
133 if($this->getFrequenceUntilCount())
134 {
135 $ical .= (';COUNT='.$this->getFrequenceUntilCount());
136 }
137 elseif($this->getFrequenceUntilDate())
138 {
139 if($entry->isFullday())
140 {
141 $ical .= (';UNTIL='.$this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE,'Ymd'));
142 }
143 else
144 {
145 $his = $entry->getStart()->get(IL_CAL_FKT_DATE, 'His');
146 $ical .= (';UNTIL='.$this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE,'Ymd').'T'.$his);
147 }
148 }
149 if($this->getBYMONTH())
150 {
151 $ical .= (';BYMONTH='.$this->getBYMONTH());
152 }
153 if($this->getBYWEEKNO())
154 {
155 $ical .= (';BYWEEKNO='.$this->getBYWEEKNO());
156 }
157 if($this->getBYYEARDAY())
158 {
159 $ical .= (';BYYEARDAY='.$this->getBYYEARDAY());
160 }
161 if($this->getBYMONTHDAY())
162 {
163 $ical .= (';BYMONTHDAY='.$this->getBYMONTHDAY());
164 }
165 if($this->getBYDAY())
166 {
167 $ical .= (';BYDAY='.$this->getBYDAY());
168 }
169 if($this->getBYSETPOS())
170 {
171 $ical .= (';BYSETPOS='.$this->getBYSETPOS());
172 }
173
174 // Required in outlook
175 if($this->getBYDAY())
176 {
177 include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
178 include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
180 if($us->getWeekStart() == ilCalendarSettings::WEEK_START_MONDAY)
181 {
182 $ical .= (';WKST=MO');
183 }
184 else
185 {
186 $ical .= (';WKST=SU');
187 }
188 }
189
190 return $ical;
191 }
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(), 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 743 of file class.ilCalendarRecurrence.php.

744 {
745 global $ilDB;
746
747 $until_date = is_null($this->getFrequenceUntilDate()) ?
748 null :
749 $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME,'','UTC');
750
751 $query = "UPDATE cal_recurrence_rules SET ".
752 "cal_id = ".$this->db->quote($this->cal_id ,'integer').", ".
753 "cal_recurrence = 1,".
754 "freq_type = ".$this->db->quote($this->getFrequenceType() ,'text').", ".
755 "freq_until_date = ".$this->db->quote($until_date ,'timestamp').", ".
756 "freq_until_count = ".$this->db->quote($this->getFrequenceUntilCount() ,'integer').", ".
757 "intervall = ".$this->db->quote($this->getInterval() ,'integer').", ".
758 "byday = ".$this->db->quote($this->getBYDAY() ,'text').", ".
759 "byweekno = ".$this->db->quote($this->getBYWEEKNO() ,'text').", ".
760 "bymonth = ".$this->db->quote($this->getBYMONTH() ,'text').", ".
761 "bymonthday = ".$this->db->quote($this->getBYMONTHDAY() ,'text').", ".
762 "byyearday = ".$this->db->quote($this->getBYYEARDAY() ,'text').", ".
763 "bysetpos = ".$this->db->quote($this->getBYSETPOS() ,'text').", ".
764 "weekstart = ".$this->db->quote($this->getWeekstart() ,'text')." ".
765 "WHERE rule_id = ".$this->db->quote($this->recurrence_id ,'integer')." ";
766 $res = $ilDB->manipulate($query);
767 return true;
768 }

References $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 680 of file class.ilCalendarRecurrence.php.

681 {
683 if(!in_array($this->getFrequenceType(),$valid_frequences))
684 {
685 return false;
686 }
687 if($this->getFrequenceUntilCount() < 0)
688 {
689 return false;
690 }
691 if($this->getInterval() <= 0)
692 {
693 return false;
694 }
695 return true;
696 }
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: