diff --git a/application/Calendar/CalendarModel.php b/application/Calendar/CalendarModel.php index c795d1923..0b8fcb4d9 100644 --- a/application/Calendar/CalendarModel.php +++ b/application/Calendar/CalendarModel.php @@ -62,15 +62,19 @@ class CalendarModel { $dbcal = self::dbKalender(); $termstring = trim($r->term); + $calendars = $r->calendars; $termExplode = explode(" ", $termstring); $where = ""; foreach ($termExplode as $term) { $where .= " AND (name LIKE '%" . $term . "%' OR location LIKE '%" . $term . "%') "; } + $where .= " AND calendar_id IN (" . implode(",",$calendars) . ")"; + + $res = $dbcal->select("cal_events", "id, uuid, calendar_id, user_id, start_time, end_time, timezone, all_day_event, name, description, location, repeat_end_time, reminder, ctime, mtime, muser_id, busy, status, resource_event_id, private, rrule, background, files_folder_id, read_only, category_id, exception_for_event_id, recurrence_id, is_organizer,event_type", "1=1 $where ORDER BY name"); - + $rows=array(); while ($data = $dbcal->fetch_array($res)) { if ($data['location']) { $searchName = $data['name'] . " @" . $data['location']; diff --git a/public/js/pages/Calendar/View.js b/public/js/pages/Calendar/View.js index d6891ebf2..04b427161 100644 --- a/public/js/pages/Calendar/View.js +++ b/public/js/pages/Calendar/View.js @@ -1328,6 +1328,21 @@ $(document).ready(function () { language: "de", ajax: { url: requestEventSearchURL, + data: function (params) { + let checkbox = $(".calendar-check"); + let visibleCalendars = []; + visibleCalendars.push(0); + checkbox.each(function () { + if ($(this).prop('checked')) { + visibleCalendars.push($(this).data('calendar_id')); + } + }); + return { + q: params.term, // Der Suchbegriff + term: params.term, // Der Suchbegriff + calendars: visibleCalendars // Die dynamische Variable, die du hinzufügen möchtest + }; + }, dataType: 'json', delay: 250, processResults: function (data) {