|
@@ -1237,19 +1237,23 @@ function getCalendar()
|
|
|
switch (trim(strtolower(getCalenderRepeat($repeat)))) {
|
|
switch (trim(strtolower(getCalenderRepeat($repeat)))) {
|
|
|
case 'daily':
|
|
case 'daily':
|
|
|
$repeat = $totalDays;
|
|
$repeat = $totalDays;
|
|
|
- $term = 'day';
|
|
|
|
|
|
|
+ $term = 'days';
|
|
|
break;
|
|
break;
|
|
|
case 'weekly':
|
|
case 'weekly':
|
|
|
$repeat = round($totalDays / 7);
|
|
$repeat = round($totalDays / 7);
|
|
|
- $term = 'week';
|
|
|
|
|
|
|
+ $term = 'weeks';
|
|
|
break;
|
|
break;
|
|
|
case 'monthly':
|
|
case 'monthly':
|
|
|
$repeat = round($totalDays / 30);
|
|
$repeat = round($totalDays / 30);
|
|
|
- $term = 'month';
|
|
|
|
|
|
|
+ $term = 'months';
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'yearly':
|
|
|
|
|
+ $repeat = round($totalDays / 365);
|
|
|
|
|
+ $term = 'years';
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
$repeat = $totalDays;
|
|
$repeat = $totalDays;
|
|
|
- $term = 'day';
|
|
|
|
|
|
|
+ $term = 'days';
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
@@ -1294,6 +1298,13 @@ function getCalendar()
|
|
|
if (!calendarDaysCheck($calendarStartDiff->format('%R') . $calendarStartDiff->days, $calendarEndDiff->format('%R') . $calendarEndDiff->days)) {
|
|
if (!calendarDaysCheck($calendarStartDiff->format('%R') . $calendarStartDiff->days, $calendarEndDiff->format('%R') . $calendarEndDiff->days)) {
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
|
|
+ if (getCalenderRepeatUntil(trim($repeat))) {
|
|
|
|
|
+ $untilDate = new DateTime (getCalenderRepeatUntil(trim($repeat)));
|
|
|
|
|
+ $untilDiff = date_diff($currentDate, $untilDate);
|
|
|
|
|
+ if ($untilDiff->days > 0) {
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
$icalEvents[] = array(
|
|
$icalEvents[] = array(
|
|
|
'title' => $eventName,
|
|
'title' => $eventName,
|
|
|
'imagetype' => 'calendar-o text-warning text-custom-calendar ' . $extraClass,
|
|
'imagetype' => 'calendar-o text-warning text-custom-calendar ' . $extraClass,
|
|
@@ -1343,6 +1354,16 @@ function getCalenderRepeat($value)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+function getCalenderRepeatUntil($value)
|
|
|
|
|
+{
|
|
|
|
|
+ $first = explode('UNTIL=', $value);
|
|
|
|
|
+ if (count($first) > 1) {
|
|
|
|
|
+ return $first[1];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
function getSonarrCalendar($array, $number)
|
|
function getSonarrCalendar($array, $number)
|
|
|
{
|
|
{
|
|
|
$array = json_decode($array, true);
|
|
$array = json_decode($array, true);
|