ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilCalendarRecurrences.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
25 {
29  public static function _getRecurrences(int $a_cal_id): array
30  {
31  global $DIC;
32 
33  $ilDB = $DIC['ilDB'];
34  $query = "SELECT rule_id FROM cal_recurrence_rules " .
35  "WHERE cal_id = " . $ilDB->quote($a_cal_id, 'integer') . " ";
36  $res = $ilDB->query($query);
37  $recurrences = [];
38  while ($row = $res->fetchRow(ilDBConstants::FETCHMODE_OBJECT)) {
39  $recurrences[] = new ilCalendarRecurrence((int) $row->rule_id);
40  }
41  return $recurrences;
42  }
43 
44  public static function _getFirstRecurrence($a_cal_id): ilCalendarRecurrence
45  {
46  $recs = self::_getRecurrences($a_cal_id);
47  if (count($recs)) {
48  return $recs[0];
49  }
50  $new_rec = new ilCalendarRecurrence();
51  $new_rec->setEntryId($a_cal_id);
52  return $new_rec;
53  }
54 }
$res
Definition: ltiservices.php:66
static _getRecurrences(int $a_cal_id)
get all recurrences of an appointment
global $DIC
Definition: shib_login.php:26