ILIAS  release_7 Revision v7.30-3-g800a261c036
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...
 

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.

public

Parameters
intrecurrence id

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

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

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 $DIC
Definition: goto.php:24
global $ilDB
+ Here is the call graph for this function:

Member Function Documentation

◆ _delete()

static ilCalendarRecurrence::_delete (   $a_cal_id)
static

delete

public

Parameters
intappointment id
Returns

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

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

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

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  }
foreach($_POST as $key=> $value) $res
static delete($a_cal_id)
Delete exclusion dates of calendar entry.
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ delete()

ilCalendarRecurrence::delete ( )

delete

public

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

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

755  {
756  global $DIC;
757 
758  $ilDB = $DIC['ilDB'];
759 
760  $query = "DELETE FROM cal_recurrence_rules " .
761  "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer');
762  $res = $ilDB->manipulate($query);
763  return true;
764  }
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB

◆ getBYDAY()

ilCalendarRecurrence::getBYDAY ( )

get BYDAY

public

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

References $byday.

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

373  {
374  return $this->byday;
375  }
+ Here is the caller graph for this function:

◆ getBYDAYList()

ilCalendarRecurrence::getBYDAYList ( )

get BYDAY list

public

Returns

Implements ilCalendarRecurrenceCalculation.

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

References $byday, and getBYDAY().

384  {
385  if (!trim($this->getBYDAY())) {
386  return array();
387  }
388  foreach (explode(',', $this->getBYDAY()) as $byday) {
389  $bydays[] = trim($byday);
390  }
391  return $bydays ? $bydays : array();
392  }
+ Here is the call graph for this function:

◆ getBYMONTH()

ilCalendarRecurrence::getBYMONTH ( )

get BYDAY

public

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

References $bymonth.

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

454  {
455  return $this->bymonth;
456  }
+ Here is the caller graph for this function:

◆ getBYMONTHDAY()

ilCalendarRecurrence::getBYMONTHDAY ( )

get BYDAY

public

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

References $bymonthday.

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

494  {
495  return $this->bymonthday;
496  }
+ Here is the caller graph for this function:

◆ getBYMONTHDAYList()

ilCalendarRecurrence::getBYMONTHDAYList ( )

get BYMONTHDAY list

public

Implements ilCalendarRecurrenceCalculation.

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

References getBYMONTHDAY().

504  {
505  if (!trim($this->getBYMONTHDAY())) {
506  return array();
507  }
508  foreach (explode(',', $this->getBYMONTHDAY()) as $month_num) {
509  $months[] = (int) $month_num;
510  }
511  return $months ? $months : array();
512  }
+ Here is the call graph for this function:

◆ getBYMONTHList()

ilCalendarRecurrence::getBYMONTHList ( )

get bymonth list

public

Implements ilCalendarRecurrenceCalculation.

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

References getBYMONTH().

465  {
466  if (!trim($this->getBYMONTH())) {
467  return array();
468  }
469  foreach (explode(',', $this->getBYMONTH()) as $month_num) {
470  $months[] = (int) $month_num;
471  }
472  return $months ? $months : array();
473  }
+ Here is the call graph for this function:

◆ getBYSETPOS()

ilCalendarRecurrence::getBYSETPOS ( )

get BYDAY

public

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

References $bysetpos.

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

574  {
575  return $this->bysetpos;
576  }
+ Here is the caller graph for this function:

◆ getBYSETPOSList()

ilCalendarRecurrence::getBYSETPOSList ( )

get bysetpos list

public

Implements ilCalendarRecurrenceCalculation.

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

References getBYSETPOS().

585  {
586  if (!trim($this->getBYSETPOS())) {
587  return array();
588  }
589  foreach (explode(',', $this->getBYSETPOS()) as $pos) {
590  $positions[] = (int) $pos;
591  }
592  return $positions ? $positions : array();
593  }
+ Here is the call graph for this function:

◆ getBYWEEKNO()

ilCalendarRecurrence::getBYWEEKNO ( )

get BYDAY

public

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

References $byweekno.

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

431  {
432  return $this->byweekno;
433  }
+ Here is the caller graph for this function:

◆ getBYWEEKNOList()

ilCalendarRecurrence::getBYWEEKNOList ( )

get byweekno list

public

Implements ilCalendarRecurrenceCalculation.

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

References getBYWEEKNO().

413  {
414  if (!trim($this->getBYWEEKNO())) {
415  return array();
416  }
417  foreach (explode(',', $this->getBYWEEKNO()) as $week_num) {
418  $weeks[] = (int) $week_num;
419  }
420  return $weeks ? $weeks : array();
421  }
+ Here is the call graph for this function:

◆ getBYYEARDAY()

ilCalendarRecurrence::getBYYEARDAY ( )

get BYDAY

public

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

References $byyearday.

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

534  {
535  return $this->byyearday;
536  }
+ Here is the caller graph for this function:

◆ getBYYEARDAYList()

ilCalendarRecurrence::getBYYEARDAYList ( )

get BYYEARDAY list

public

Implements ilCalendarRecurrenceCalculation.

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

References getBYYEARDAY().

545  {
546  if (!trim($this->getBYYEARDAY())) {
547  return array();
548  }
549  foreach (explode(',', $this->getBYYEARDAY()) as $year_day) {
550  $days[] = (int) $year_day;
551  }
552  return $days ? $days : array();
553  }
+ Here is the call graph for this function:

◆ getEntryId()

ilCalendarRecurrence::getEntryId ( )

Get calendar entry id.

Returns
int

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

References $cal_id.

Referenced by toICal().

234  {
235  return $this->cal_id;
236  }
+ Here is the caller graph for this function:

◆ getExclusionDates()

ilCalendarRecurrence::getExclusionDates ( )

Get exclusion dates.

Returns

Implements ilCalendarRecurrenceCalculation.

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

References $exclusion_dates.

647  {
648  return (array) $this->exclusion_dates;
649  }

◆ getFrequenceType()

ilCalendarRecurrence::getFrequenceType ( )

get freq type

public

Implements ilCalendarRecurrenceCalculation.

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

References $freq_type.

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

281  {
282  return $this->freq_type;
283  }
+ Here is the caller graph for this function:

◆ getFrequenceUntilCount()

ilCalendarRecurrence::getFrequenceUntilCount ( )

get frequence until count

public

Parameters

Implements ilCalendarRecurrenceCalculation.

Definition at line 326 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

public

Implements ilCalendarRecurrenceCalculation.

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

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

292  {
293  return is_object($this->freq_until_date) ? $this->freq_until_date : null;
294  }
+ Here is the caller graph for this function:

◆ getInterval()

ilCalendarRecurrence::getInterval ( )

get interval

public

Implements ilCalendarRecurrenceCalculation.

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

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

350  {
351  return $this->interval ? $this->interval : 1;
352  }
+ Here is the caller graph for this function:

◆ getRecurrenceId()

ilCalendarRecurrence::getRecurrenceId ( )

get recurrence id

public

Returns

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

References $recurrence_id.

◆ getTimeZone()

ilCalendarRecurrence::getTimeZone ( )

get timezone

public

Implements ilCalendarRecurrenceCalculation.

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

References $timezone.

626  {
627  return $this->timezone;
628  }

◆ getWeekstart()

ilCalendarRecurrence::getWeekstart ( )

get weekstart

public

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

References $weekstart.

Referenced by save(), and update().

615  {
616  return $this->weekstart;
617  }
+ Here is the caller graph for this function:

◆ isRecurrence()

ilCalendarRecurrence::isRecurrence ( )

is recurrence

public

Parameters

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

258  {
259  return $this->recurrence_type == self::REC_RECURRENCE;
260  }

◆ read()

ilCalendarRecurrence::read ( )
private

Read entry.

private

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

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

Referenced by __construct().

773  {
774  global $DIC;
775 
776  $ilDB = $DIC['ilDB'];
777 
778  $query = "SELECT * FROM cal_recurrence_rules " .
779  "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer') . " ";
780  $res = $this->db->query($query);
781  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
782  $this->cal_id = $row->cal_id;
783  $this->recurrence_type = $row->cal_recurrence;
784  $this->freq_type = $row->freq_type;
785 
786  if ($row->freq_until_date != null) {
787  $this->freq_until_date = new ilDateTime($row->freq_until_date, IL_CAL_DATETIME, 'UTC');
788  }
789  $this->freq_until_count = $row->freq_until_count;
790  $this->interval = $row->intervall;
791  $this->byday = $row->byday;
792  $this->byweekno = $row->byweekno;
793  $this->bymonth = $row->bymonth;
794  $this->bymonthday = $row->bymonthday;
795  $this->byyearday = $row->byyearday;
796  $this->bysetpos = $row->bysetpos;
797  $this->weekstart = $row->week_start;
798  }
799 
800  $this->exclusion_dates = ilCalendarRecurrenceExclusions::getExclusionDates($this->cal_id);
801  }
const IL_CAL_DATETIME
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
static getExclusionDates($a_cal_id)
Read exclusion dates.
global $ilDB
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ reset()

ilCalendarRecurrence::reset ( )

reset all settings

public

Returns

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

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

191  {
192  $this->setBYDAY('');
193  $this->setBYMONTHDAY('');
194  $this->setBYMONTH('');
195  $this->setBYSETPOS('');
196  $this->setBYWEEKNO('');
197  $this->setBYYEARDAY('');
198  $this->setFrequenceType('');
199  $this->setInterval(1);
200  $this->setFrequenceUntilCount(0);
201 
202  return true;
203  }
setBYWEEKNO($a_byweekno)
set by day
setFrequenceUntilCount($a_count)
set frequence count
setFrequenceType($a_type)
set frequence type
setInterval($a_interval)
set interval
+ Here is the call graph for this function:

◆ save()

ilCalendarRecurrence::save ( )

save

public

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

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

680  {
681  global $DIC;
682 
683  $ilDB = $DIC['ilDB'];
684 
685  $until_date = is_null($this->getFrequenceUntilDate()) ?
686  null :
687  $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME, '', 'UTC');
688  $next_id = $ilDB->nextId('cal_recurrence_rules');
689 
690  $query = "INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, " .
691  "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) " .
692  "VALUES( " .
693  $ilDB->quote($next_id, 'integer') . ", " .
694  $this->db->quote($this->cal_id, 'integer') . ", " .
695  $ilDB->quote(1, 'integer') . ", " .
696  $ilDB->quote((string) $this->getFrequenceType(), 'text') . ", " .
697  $this->db->quote($until_date, 'timestamp') . ", " .
698  $this->db->quote((int) $this->getFrequenceUntilCount(), 'integer') . ", " .
699  $this->db->quote((int) $this->getInterval(), 'integer') . ", " .
700  $this->db->quote((string) $this->getBYDAY(), 'text') . ", " .
701  $this->db->quote((string) $this->getBYWEEKNO(), 'text') . ", " .
702  $this->db->quote((string) $this->getBYMONTH(), 'text') . ", " .
703  $this->db->quote((string) $this->getBYMONTHDAY(), 'text') . ", " .
704  $this->db->quote((string) $this->getBYYEARDAY(), 'text') . ", " .
705  $this->db->quote((string) $this->getBYSETPOS(), 'text') . ", " .
706  $this->db->quote((string) $this->getWeekstart(), 'text') . " " .
707  ")";
708  $res = $ilDB->manipulate($query);
709  $this->recurrence_id = $next_id;
710  return true;
711  }
const IL_CAL_DATETIME
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
getFrequenceUntilCount()
get frequence until count
+ Here is the call graph for this function:

◆ setBYDAY()

ilCalendarRecurrence::setBYDAY (   $a_byday)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

362  {
363  $this->byday = $a_byday;
364  }
+ Here is the caller graph for this function:

◆ setBYMONTH()

ilCalendarRecurrence::setBYMONTH (   $a_by)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

443  {
444  $this->bymonth = $a_by;
445  }
+ Here is the caller graph for this function:

◆ setBYMONTHDAY()

ilCalendarRecurrence::setBYMONTHDAY (   $a_by)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

483  {
484  $this->bymonthday = $a_by;
485  }
+ Here is the caller graph for this function:

◆ setBYSETPOS()

ilCalendarRecurrence::setBYSETPOS (   $a_by)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

563  {
564  $this->bysetpos = $a_by;
565  }
+ Here is the caller graph for this function:

◆ setBYWEEKNO()

ilCalendarRecurrence::setBYWEEKNO (   $a_byweekno)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

402  {
403  $this->byweekno = $a_byweekno;
404  }
+ Here is the caller graph for this function:

◆ setBYYEARDAY()

ilCalendarRecurrence::setBYYEARDAY (   $a_by)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

523  {
524  $this->byyearday = $a_by;
525  }
+ Here is the caller graph for this function:

◆ setEntryId()

ilCalendarRecurrence::setEntryId (   $a_id)

set cal id

public

Parameters
intcalendar entry id

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

225  {
226  $this->cal_id = $a_id;
227  }

◆ setFrequenceType()

ilCalendarRecurrence::setFrequenceType (   $a_type)

set frequence type

public

Parameters
intFREQUENCE_TYPE e.g MONTHLY, WEEKLY ...

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

Referenced by reset().

270  {
271  $this->freq_type = $a_type;
272  }
+ Here is the caller graph for this function:

◆ setFrequenceUntilCount()

ilCalendarRecurrence::setFrequenceUntilCount (   $a_count)

set frequence count

public

Parameters
intcount

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

Referenced by reset().

315  {
316  $this->freq_until_count = $a_count;
317  }
+ Here is the caller graph for this function:

◆ setFrequenceUntilDate()

ilCalendarRecurrence::setFrequenceUntilDate ( ilDateTime  $a_date = null)

set freq until date

public

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

303  {
304  $this->freq_until_date = $a_date;
305  }

◆ setInterval()

ilCalendarRecurrence::setInterval (   $a_interval)

set interval

public

Parameters
intinterval

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

Referenced by reset().

339  {
340  $this->interval = $a_interval;
341  }
+ Here is the caller graph for this function:

◆ setRecurrence()

ilCalendarRecurrence::setRecurrence (   $a_type)

set type of recurrence

public

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

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

246  {
247  $this->recurrence_type = $a_type;
248  }

◆ setTimeZone()

ilCalendarRecurrence::setTimeZone (   $a_tz)

set timezone

public

Parameters
stringtimezone

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

638  {
639  $this->timezone = $a_tz;
640  }

◆ setWeekstart()

ilCalendarRecurrence::setWeekstart (   $a_start)

set weekstart

public

Parameters
stringweekstart

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

604  {
605  $this->weekstart = $a_start;
606  }

◆ toICal()

ilCalendarRecurrence::toICal (   $a_user_id)

Get ical presentation for calendar recurrence.

Parameters
int$a_user_id
Returns
string

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

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

125  {
126  include_once './Services/Calendar/classes/class.ilCalendarEntry.php';
127  $entry = new ilCalendarEntry($this->getEntryId());
128 
129  if (!$this->getFrequenceType()) {
130  return '';
131  }
132 
133  $ical = 'RRULE:';
134  $ical .= ('FREQ=' . $this->getFrequenceType());
135 
136  if ($this->getInterval()) {
137  $ical .= (';INTERVAL=' . $this->getInterval());
138  }
139  if ($this->getFrequenceUntilCount()) {
140  $ical .= (';COUNT=' . $this->getFrequenceUntilCount());
141  } elseif ($this->getFrequenceUntilDate()) {
142  if ($entry->isFullday()) {
143  $ical .= (';UNTIL=' . $this->getFrequenceUntilDate()->get(IL_CAL_FKT_DATE, 'Ymd'));
144  } else {
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  $ical .= (';BYMONTH=' . $this->getBYMONTH());
151  }
152  if ($this->getBYWEEKNO()) {
153  $ical .= (';BYWEEKNO=' . $this->getBYWEEKNO());
154  }
155  if ($this->getBYYEARDAY()) {
156  $ical .= (';BYYEARDAY=' . $this->getBYYEARDAY());
157  }
158  if ($this->getBYMONTHDAY()) {
159  $ical .= (';BYMONTHDAY=' . $this->getBYMONTHDAY());
160  }
161  if ($this->getBYDAY()) {
162  $ical .= (';BYDAY=' . $this->getBYDAY());
163  }
164  if ($this->getBYSETPOS()) {
165  $ical .= (';BYSETPOS=' . $this->getBYSETPOS());
166  }
167 
168  // Required in outlook
169  if ($this->getBYDAY()) {
170  include_once './Services/Calendar/classes/class.ilCalendarUserSettings.php';
171  include_once './Services/Calendar/classes/class.ilCalendarSettings.php';
173  if ($us->getWeekStart() == ilCalendarSettings::WEEK_START_MONDAY) {
174  $ical .= (';WKST=MO');
175  } else {
176  $ical .= (';WKST=SU');
177  }
178  }
179 
180  return $ical;
181  }
Model for a calendar entry.
getEntryId()
Get calendar entry id.
static _getInstanceByUserId($a_user_id)
get singleton instance
const IL_CAL_FKT_DATE
getFrequenceUntilCount()
get frequence until count
+ Here is the call graph for this function:

◆ update()

ilCalendarRecurrence::update ( )

save

public

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

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

720  {
721  global $DIC;
722 
723  $ilDB = $DIC['ilDB'];
724 
725  $until_date = is_null($this->getFrequenceUntilDate()) ?
726  null :
727  $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME, '', 'UTC');
728 
729  $query = "UPDATE cal_recurrence_rules SET " .
730  "cal_id = " . $this->db->quote($this->cal_id, 'integer') . ", " .
731  "cal_recurrence = 1," .
732  "freq_type = " . $this->db->quote($this->getFrequenceType(), 'text') . ", " .
733  "freq_until_date = " . $this->db->quote($until_date, 'timestamp') . ", " .
734  "freq_until_count = " . $this->db->quote($this->getFrequenceUntilCount(), 'integer') . ", " .
735  "intervall = " . $this->db->quote($this->getInterval(), 'integer') . ", " .
736  "byday = " . $this->db->quote($this->getBYDAY(), 'text') . ", " .
737  "byweekno = " . $this->db->quote($this->getBYWEEKNO(), 'text') . ", " .
738  "bymonth = " . $this->db->quote($this->getBYMONTH(), 'text') . ", " .
739  "bymonthday = " . $this->db->quote($this->getBYMONTHDAY(), 'text') . ", " .
740  "byyearday = " . $this->db->quote($this->getBYYEARDAY(), 'text') . ", " .
741  "bysetpos = " . $this->db->quote($this->getBYSETPOS(), 'text') . ", " .
742  "weekstart = " . $this->db->quote($this->getWeekstart(), 'text') . " " .
743  "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer') . " ";
744  $res = $ilDB->manipulate($query);
745  return true;
746  }
const IL_CAL_DATETIME
foreach($_POST as $key=> $value) $res
global $DIC
Definition: goto.php:24
$query
global $ilDB
getFrequenceUntilCount()
get frequence until count
+ Here is the call graph for this function:

◆ validate()

ilCalendarRecurrence::validate ( )

validate

public

Returns
bool

Implements ilCalendarRecurrenceCalculation.

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

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

658  {
660  if (!in_array($this->getFrequenceType(), $valid_frequences)) {
661  return false;
662  }
663  if ($this->getFrequenceUntilCount() < 0) {
664  return false;
665  }
666  if ($this->getInterval() <= 0) {
667  return false;
668  }
669  return true;
670  }
const IL_CAL_FREQ_MONTHLY
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
const IL_CAL_FREQ_YEARLY
getFrequenceUntilCount()
get frequence until count
const IL_CAL_FREQ_WEEKLY
+ 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.


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