ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 $ilDB, and read().

86  {
87  global $ilDB;
88 
89  $this->db = $ilDB;
90  $this->recurrence_id = $a_rec_id;
91  if ($a_rec_id) {
92  $this->read();
93  }
94  }
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 104 of file class.ilCalendarRecurrence.php.

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

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

105  {
106  global $ilDB;
107 
108  $query = "DELETE FROM cal_recurrence_rules " .
109  "WHERE cal_id = " . $ilDB->quote($a_cal_id, 'integer') . " ";
110  $res = $ilDB->manipulate($query);
111 
113  }
foreach($_POST as $key=> $value) $res
static delete($a_cal_id)
Delete exclusion dates of calendar entry.
$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 742 of file class.ilCalendarRecurrence.php.

References $ilDB, $query, and $res.

743  {
744  global $ilDB;
745 
746  $query = "DELETE FROM cal_recurrence_rules " .
747  "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer');
748  $res = $ilDB->manipulate($query);
749  return true;
750  }
foreach($_POST as $key=> $value) $res
$query
global $ilDB

◆ getBYDAY()

ilCalendarRecurrence::getBYDAY ( )

get BYDAY

public

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

References $byday.

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

365  {
366  return $this->byday;
367  }
+ Here is the caller graph for this function:

◆ getBYDAYList()

ilCalendarRecurrence::getBYDAYList ( )

get BYDAY list

public

Returns

Implements ilCalendarRecurrenceCalculation.

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

References $byday, array, and getBYDAY().

376  {
377  if (!trim($this->getBYDAY())) {
378  return array();
379  }
380  foreach (explode(',', $this->getBYDAY()) as $byday) {
381  $bydays[] = trim($byday);
382  }
383  return $bydays ? $bydays : array();
384  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getBYMONTH()

ilCalendarRecurrence::getBYMONTH ( )

get BYDAY

public

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

References $bymonth.

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

446  {
447  return $this->bymonth;
448  }
+ Here is the caller graph for this function:

◆ getBYMONTHDAY()

ilCalendarRecurrence::getBYMONTHDAY ( )

get BYDAY

public

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

References $bymonthday.

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

486  {
487  return $this->bymonthday;
488  }
+ Here is the caller graph for this function:

◆ getBYMONTHDAYList()

ilCalendarRecurrence::getBYMONTHDAYList ( )

get BYMONTHDAY list

public

Implements ilCalendarRecurrenceCalculation.

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

References array, and getBYMONTHDAY().

496  {
497  if (!trim($this->getBYMONTHDAY())) {
498  return array();
499  }
500  foreach (explode(',', $this->getBYMONTHDAY()) as $month_num) {
501  $months[] = (int) $month_num;
502  }
503  return $months ? $months : array();
504  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getBYMONTHList()

ilCalendarRecurrence::getBYMONTHList ( )

get bymonth list

public

Implements ilCalendarRecurrenceCalculation.

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

References array, and getBYMONTH().

457  {
458  if (!trim($this->getBYMONTH())) {
459  return array();
460  }
461  foreach (explode(',', $this->getBYMONTH()) as $month_num) {
462  $months[] = (int) $month_num;
463  }
464  return $months ? $months : array();
465  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getBYSETPOS()

ilCalendarRecurrence::getBYSETPOS ( )

get BYDAY

public

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

References $bysetpos.

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

566  {
567  return $this->bysetpos;
568  }
+ Here is the caller graph for this function:

◆ getBYSETPOSList()

ilCalendarRecurrence::getBYSETPOSList ( )

get bysetpos list

public

Implements ilCalendarRecurrenceCalculation.

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

References array, and getBYSETPOS().

577  {
578  if (!trim($this->getBYSETPOS())) {
579  return array();
580  }
581  foreach (explode(',', $this->getBYSETPOS()) as $pos) {
582  $positions[] = (int) $pos;
583  }
584  return $positions ? $positions : array();
585  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getBYWEEKNO()

ilCalendarRecurrence::getBYWEEKNO ( )

get BYDAY

public

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

References $byweekno.

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

423  {
424  return $this->byweekno;
425  }
+ Here is the caller graph for this function:

◆ getBYWEEKNOList()

ilCalendarRecurrence::getBYWEEKNOList ( )

get byweekno list

public

Implements ilCalendarRecurrenceCalculation.

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

References array, and getBYWEEKNO().

405  {
406  if (!trim($this->getBYWEEKNO())) {
407  return array();
408  }
409  foreach (explode(',', $this->getBYWEEKNO()) as $week_num) {
410  $weeks[] = (int) $week_num;
411  }
412  return $weeks ? $weeks : array();
413  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getBYYEARDAY()

ilCalendarRecurrence::getBYYEARDAY ( )

get BYDAY

public

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

References $byyearday.

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

526  {
527  return $this->byyearday;
528  }
+ Here is the caller graph for this function:

◆ getBYYEARDAYList()

ilCalendarRecurrence::getBYYEARDAYList ( )

get BYYEARDAY list

public

Implements ilCalendarRecurrenceCalculation.

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

References array, and getBYYEARDAY().

537  {
538  if (!trim($this->getBYYEARDAY())) {
539  return array();
540  }
541  foreach (explode(',', $this->getBYYEARDAY()) as $year_day) {
542  $days[] = (int) $year_day;
543  }
544  return $days ? $days : array();
545  }
Create styles array
The data for the language used.
+ Here is the call graph for this function:

◆ getEntryId()

ilCalendarRecurrence::getEntryId ( )

Get calendar entry id.

Returns
int

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

References $cal_id.

Referenced by toICal().

226  {
227  return $this->cal_id;
228  }
+ Here is the caller graph for this function:

◆ getExclusionDates()

ilCalendarRecurrence::getExclusionDates ( )

Get exclusion dates.

Returns

Implements ilCalendarRecurrenceCalculation.

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

References $exclusion_dates, and array.

639  {
640  return (array) $this->exclusion_dates;
641  }
Create styles array
The data for the language used.

◆ getFrequenceType()

ilCalendarRecurrence::getFrequenceType ( )

get freq type

public

Implements ilCalendarRecurrenceCalculation.

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

References $freq_type.

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

273  {
274  return $this->freq_type;
275  }
+ Here is the caller graph for this function:

◆ getFrequenceUntilCount()

ilCalendarRecurrence::getFrequenceUntilCount ( )

get frequence until count

public

Parameters

Implements ilCalendarRecurrenceCalculation.

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

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

284  {
285  return is_object($this->freq_until_date) ? $this->freq_until_date : null;
286  }
+ Here is the caller graph for this function:

◆ getInterval()

ilCalendarRecurrence::getInterval ( )

get interval

public

Implements ilCalendarRecurrenceCalculation.

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

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

342  {
343  return $this->interval ? $this->interval : 1;
344  }
+ Here is the caller graph for this function:

◆ getRecurrenceId()

ilCalendarRecurrence::getRecurrenceId ( )

get recurrence id

public

Returns

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

References $recurrence_id.

◆ getTimeZone()

ilCalendarRecurrence::getTimeZone ( )

get timezone

public

Implements ilCalendarRecurrenceCalculation.

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

References $timezone.

618  {
619  return $this->timezone;
620  }

◆ getWeekstart()

ilCalendarRecurrence::getWeekstart ( )

get weekstart

public

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

References $weekstart.

Referenced by save(), and update().

607  {
608  return $this->weekstart;
609  }
+ Here is the caller graph for this function:

◆ isRecurrence()

ilCalendarRecurrence::isRecurrence ( )

is recurrence

public

Parameters

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

250  {
251  return $this->recurrence_type == self::REC_RECURRENCE;
252  }

◆ read()

ilCalendarRecurrence::read ( )
private

Read entry.

private

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

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

Referenced by __construct().

759  {
760  global $ilDB;
761 
762  $query = "SELECT * FROM cal_recurrence_rules " .
763  "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer') . " ";
764  $res = $this->db->query($query);
765  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
766  $this->cal_id = $row->cal_id;
767  $this->recurrence_type = $row->cal_recurrence;
768  $this->freq_type = $row->freq_type;
769 
770  if ($row->freq_until_date != null) {
771  $this->freq_until_date = new ilDateTime($row->freq_until_date, IL_CAL_DATETIME, 'UTC');
772  }
773  $this->freq_until_count = $row->freq_until_count;
774  $this->interval = $row->intervall;
775  $this->byday = $row->byday;
776  $this->byweekno = $row->byweekno;
777  $this->bymonth = $row->bymonth;
778  $this->bymonthday = $row->bymonthday;
779  $this->byyearday = $row->byyearday;
780  $this->bysetpos = $row->bysetpos;
781  $this->weekstart = $row->week_start;
782  }
783 
784  $this->exclusion_dates = ilCalendarRecurrenceExclusions::getExclusionDates($this->cal_id);
785  }
const IL_CAL_DATETIME
foreach($_POST as $key=> $value) $res
Date and time handling
$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 182 of file class.ilCalendarRecurrence.php.

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

183  {
184  $this->setBYDAY('');
185  $this->setBYMONTHDAY('');
186  $this->setBYMONTH('');
187  $this->setBYSETPOS('');
188  $this->setBYWEEKNO('');
189  $this->setBYYEARDAY('');
190  $this->setFrequenceType('');
191  $this->setInterval(1);
192  $this->setFrequenceUntilCount(0);
193 
194  return true;
195  }
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 671 of file class.ilCalendarRecurrence.php.

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

672  {
673  global $ilDB;
674 
675  $until_date = is_null($this->getFrequenceUntilDate()) ?
676  null :
677  $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME, '', 'UTC');
678  $next_id = $ilDB->nextId('cal_recurrence_rules');
679 
680  $query = "INSERT INTO cal_recurrence_rules (rule_id,cal_id,cal_recurrence,freq_type,freq_until_date,freq_until_count,intervall, " .
681  "byday,byweekno,bymonth,bymonthday,byyearday,bysetpos,weekstart) " .
682  "VALUES( " .
683  $ilDB->quote($next_id, 'integer') . ", " .
684  $this->db->quote($this->cal_id, 'integer') . ", " .
685  $ilDB->quote(1, 'integer') . ", " .
686  $ilDB->quote((string) $this->getFrequenceType(), 'text') . ", " .
687  $this->db->quote($until_date, 'timestamp') . ", " .
688  $this->db->quote((int) $this->getFrequenceUntilCount(), 'integer') . ", " .
689  $this->db->quote((int) $this->getInterval(), 'integer') . ", " .
690  $this->db->quote((string) $this->getBYDAY(), 'text') . ", " .
691  $this->db->quote((string) $this->getBYWEEKNO(), 'text') . ", " .
692  $this->db->quote((string) $this->getBYMONTH(), 'text') . ", " .
693  $this->db->quote((string) $this->getBYMONTHDAY(), 'text') . ", " .
694  $this->db->quote((string) $this->getBYYEARDAY(), 'text') . ", " .
695  $this->db->quote((string) $this->getBYSETPOS(), 'text') . ", " .
696  $this->db->quote((string) $this->getWeekstart(), 'text') . " " .
697  ")";
698  $res = $ilDB->manipulate($query);
699  $this->recurrence_id = $next_id;
700  return true;
701  }
const IL_CAL_DATETIME
foreach($_POST as $key=> $value) $res
$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 353 of file class.ilCalendarRecurrence.php.

Referenced by reset().

354  {
355  $this->byday = $a_byday;
356  }
+ Here is the caller graph for this function:

◆ setBYMONTH()

ilCalendarRecurrence::setBYMONTH (   $a_by)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

435  {
436  $this->bymonth = $a_by;
437  }
+ Here is the caller graph for this function:

◆ setBYMONTHDAY()

ilCalendarRecurrence::setBYMONTHDAY (   $a_by)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

475  {
476  $this->bymonthday = $a_by;
477  }
+ Here is the caller graph for this function:

◆ setBYSETPOS()

ilCalendarRecurrence::setBYSETPOS (   $a_by)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

555  {
556  $this->bysetpos = $a_by;
557  }
+ Here is the caller graph for this function:

◆ setBYWEEKNO()

ilCalendarRecurrence::setBYWEEKNO (   $a_byweekno)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

394  {
395  $this->byweekno = $a_byweekno;
396  }
+ Here is the caller graph for this function:

◆ setBYYEARDAY()

ilCalendarRecurrence::setBYYEARDAY (   $a_by)

set by day

public

Parameters
stringbyday rule

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

Referenced by reset().

515  {
516  $this->byyearday = $a_by;
517  }
+ Here is the caller graph for this function:

◆ setEntryId()

ilCalendarRecurrence::setEntryId (   $a_id)

set cal id

public

Parameters
intcalendar entry id

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

217  {
218  $this->cal_id = $a_id;
219  }

◆ setFrequenceType()

ilCalendarRecurrence::setFrequenceType (   $a_type)

set frequence type

public

Parameters
intFREQUENCE_TYPE e.g MONTHLY, WEEKLY ...

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

References $a_type.

Referenced by reset().

262  {
263  $this->freq_type = $a_type;
264  }
$a_type
Definition: workflow.php:92
+ Here is the caller graph for this function:

◆ setFrequenceUntilCount()

ilCalendarRecurrence::setFrequenceUntilCount (   $a_count)

set frequence count

public

Parameters
intcount

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

Referenced by reset().

307  {
308  $this->freq_until_count = $a_count;
309  }
+ Here is the caller graph for this function:

◆ setFrequenceUntilDate()

ilCalendarRecurrence::setFrequenceUntilDate ( ilDateTime  $a_date = null)

set freq until date

public

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

295  {
296  $this->freq_until_date = $a_date;
297  }

◆ setInterval()

ilCalendarRecurrence::setInterval (   $a_interval)

set interval

public

Parameters
intinterval

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

Referenced by reset().

331  {
332  $this->interval = $a_interval;
333  }
+ 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 237 of file class.ilCalendarRecurrence.php.

References $a_type.

238  {
239  $this->recurrence_type = $a_type;
240  }
$a_type
Definition: workflow.php:92

◆ setTimeZone()

ilCalendarRecurrence::setTimeZone (   $a_tz)

set timezone

public

Parameters
stringtimezone

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

References timezone.

630  {
631  $this->timezone = $a_tz;
632  }
Set timezone

◆ setWeekstart()

ilCalendarRecurrence::setWeekstart (   $a_start)

set weekstart

public

Parameters
stringweekstart

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

596  {
597  $this->weekstart = $a_start;
598  }

◆ toICal()

ilCalendarRecurrence::toICal (   $a_user_id)

Get ical presentation for calendar recurrence.

Parameters
type$a_user_id
Returns
string

Definition at line 120 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.

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

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

710  {
711  global $ilDB;
712 
713  $until_date = is_null($this->getFrequenceUntilDate()) ?
714  null :
715  $this->getFrequenceUntilDate()->get(IL_CAL_DATETIME, '', 'UTC');
716 
717  $query = "UPDATE cal_recurrence_rules SET " .
718  "cal_id = " . $this->db->quote($this->cal_id, 'integer') . ", " .
719  "cal_recurrence = 1," .
720  "freq_type = " . $this->db->quote($this->getFrequenceType(), 'text') . ", " .
721  "freq_until_date = " . $this->db->quote($until_date, 'timestamp') . ", " .
722  "freq_until_count = " . $this->db->quote($this->getFrequenceUntilCount(), 'integer') . ", " .
723  "intervall = " . $this->db->quote($this->getInterval(), 'integer') . ", " .
724  "byday = " . $this->db->quote($this->getBYDAY(), 'text') . ", " .
725  "byweekno = " . $this->db->quote($this->getBYWEEKNO(), 'text') . ", " .
726  "bymonth = " . $this->db->quote($this->getBYMONTH(), 'text') . ", " .
727  "bymonthday = " . $this->db->quote($this->getBYMONTHDAY(), 'text') . ", " .
728  "byyearday = " . $this->db->quote($this->getBYYEARDAY(), 'text') . ", " .
729  "bysetpos = " . $this->db->quote($this->getBYSETPOS(), 'text') . ", " .
730  "weekstart = " . $this->db->quote($this->getWeekstart(), 'text') . " " .
731  "WHERE rule_id = " . $this->db->quote($this->recurrence_id, 'integer') . " ";
732  $res = $ilDB->manipulate($query);
733  return true;
734  }
const IL_CAL_DATETIME
foreach($_POST as $key=> $value) $res
$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 649 of file class.ilCalendarRecurrence.php.

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

650  {
652  if (!in_array($this->getFrequenceType(), $valid_frequences)) {
653  return false;
654  }
655  if ($this->getFrequenceUntilCount() < 0) {
656  return false;
657  }
658  if ($this->getInterval() <= 0) {
659  return false;
660  }
661  return true;
662  }
const IL_CAL_FREQ_MONTHLY
const IL_CAL_FREQ_DAILY
Model of calendar entry recurrcences.
const IL_CAL_FREQ_YEARLY
Create styles array
The data for the language used.
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: