0

thank you for the great addition!

tell me, is it possible to deduce some indication that the day is filled with events?

is it possible to get an array of free hours and hours are already employed for a specific day?

M Sazanof
  • 1
  • 2
  • can give some indication of your end goals? i.e. why do you need to do this? perhaps there are different ways to achieve your final result. – ADyson Apr 25 '17 at 12:19
  • I need to make for example a red color cell, a time interval in which full. This is necessary for users to be able intuitively to reserve a time for photography – M Sazanof Apr 25 '17 at 14:24
  • event **dayClick** would like to make the output time slots that are occupied and which are free. Fullcalendar is it possible to somehow not allow to choose an already occupied time interval? – M Sazanof Apr 25 '17 at 14:27
  • "I need to make for example a red color cell, a time interval in which full". If there's an event there in that time period, then it's full, yes? Or are you allowing multiple events in a single time slot? Either way, if an event is shown, then it takes up the space in that time slot, so you can't really overlay any other colour onto it - it wouldn't be visible. – ADyson Apr 25 '17 at 15:11
  • https://fullcalendar.io/docs/selection/selectOverlap/ - this option allows you prevent the user from selecting a time period already occupied by an event. – ADyson Apr 25 '17 at 15:13
  • https://fullcalendar.io/docs/event_ui/eventOverlap/ and this one, if you're doing dragging/dropping/resizing of events. – ADyson Apr 25 '17 at 15:41
  • Oh, thanks... i'll try this and tell you :) – M Sazanof Apr 25 '17 at 15:43
  • Ok. If you have a problem with your code please edit the question to include it here and maybe we can fix it. – ADyson Apr 25 '17 at 15:44
  • " If there's an event there in that time period, then it's full, yes? Or are you allowing multiple events in a single time slot?" There is multiple events with different date ranges – M Sazanof Apr 25 '17 at 15:45
  • In that case, what is the rule which says how many overlapping events are allowed? Is it always a fixed number, or is there some possibility of variation? Must they overlap exactly (i.e. same start and end times for each event), or can there be a partial overlap? – ADyson Apr 25 '17 at 15:46
  • See, my bad english... so, we hane mintime & maxtime ex 8:00 & 22:00. each slot can contain a different number of events. depends on what time interval booked. that is, there can be 2 events from 8 to 20 and from 20 until 22:00. and can be from 8 to 9, 9 to 10.. and so on. and if free time left-need to paint a cell, for example in red color.. – M Sazanof Apr 25 '17 at 15:56
  • there is a time range in the calendar settings. and filled need to catch this band at the time or not, and to paint the cell. to the user looking at the calendar, once you understand that book certain days, as busy all the time – M Sazanof Apr 25 '17 at 15:59
  • sorry, I don't know if I definitely understand or not. Please tell me if the following is a correct understanding: 1) minTime is 08:00, maxTime is 22:00. 2) One "slot" is an hour. e.g. the first slot is 08:00-09:00, the second slot is 09:00-10:00 etc until the last slot is 21:00-22:00. 3) Each "slot" can contain maximum 2 events. – ADyson Apr 25 '17 at 16:05
  • 1) yes......... – M Sazanof Apr 25 '17 at 18:05
  • 2) 1 slot is one hour, for example. from 8:00 to 22:00 = 14 slots (time intervals). But this does not mean that there will be 14 events for an hour. Rental time can be any of: 1)8 to 22 (all 14 hours), 2)or from 8 to 15, from 15 to 18, from 18 to 22. The user can, for example, to rent not only one hour, and within space. Like a calendar, rental photo studios - photographers book their required number of hours (1,2,3,7), and other photographers this watch is no longer available for rent. – M Sazanof Apr 25 '17 at 18:06
  • And when all time intervals over (8-22), the cell turns red, all the clocks are busy, a reservation for this date impossible – M Sazanof Apr 25 '17 at 18:06
  • ideally, I would like to implement something like that (functionaly) http://vanilla.studio/index.php?option=com_quix&view=page&id=43 Thank you for your help? master =) – M Sazanof Apr 25 '17 at 18:11
  • I see. So in the "month" view, you want to turn the background-colour of the day cell red if all the possible time slots (as defined by you) are red. I actually answered a very similar question a few days ago: http://stackoverflow.com/questions/43583993/fullcalendar-is-there-a-way-to-call-dayrender-only-after-i-load-my-events-via-e/43586910#43586910 - in that example, the data to determine the cell colour was included in the "events" feed - so the calculation about if the slots are full happened on the server, and then just sent a signal to the calendar. Let me know if that example helps. – ADyson Apr 26 '17 at 08:11
  • No, unfortunately it is not quite that. How to track the busy time (which is no free time between 8:00 and 22:00), callback some... it May be possible for them to add class .fc-busy-day to get something like this: https://yadi.sk/i/vIS5MThM3HN2cg – M Sazanof Apr 26 '17 at 09:00
  • I think it's very similar though. How are events being added to the calendar? It is at that moment, when an event has been accepted, that we should calculate the remaining free time. It could either be client-side or server-side but it depends how you have already implemented. Can you post some code showing how events are added to the calendar, please? – ADyson Apr 26 '17 at 11:16
  • JS `$.ajax({ type: "POST", url: "/assets/modules/modxplaning/inc/ajax.inc.php", data: { cal_id: event_cal_id.val(), cat_id: event_cat.val(), event_start: event_start.val(), event_end: event_end.val(), title: event_type.val(), description: event_text.val(), alarm_start:alarm_start.val(), ev_rep:ev_rep.val(), status:0, op: "add" }, success: function(err){ if (err) { result.html(err); } else { calendar.fullCalendar("refetchEvents"); form.dialog("close"); result.html(""); emptyForm(); } } });` – M Sazanof Apr 26 '17 at 12:16
  • add in php https://pastebin.com/MajtCvpF – M Sazanof Apr 26 '17 at 12:19
  • get events - https://pastebin.com/nA3ZxFmc – M Sazanof Apr 26 '17 at 12:21
  • main js - https://pastebin.com/PdSY4z0C – M Sazanof Apr 26 '17 at 12:22
  • In future please edit the question itself with relevant code - code in comments and external links is generally not liked by the SO community. As this is your first question I will forgive you :-). – ADyson Apr 26 '17 at 12:52
  • Anyway, your case is actually very similar to that example I gave. What you could is: modify the response sent by the `getJsonEvents` PHP so that it sends two objects in the response - one is the array of events for the specified time period, and the other is an object whose properties are all the days within the specified time period, with a "true/false" flag against each day to say whether it's "full" or not. I assume you already have some PHP logic to determine this, in order to validate whether an "add" request is acceptable or not? You could re-use that logic. – ADyson Apr 26 '17 at 12:55
  • ...then on the client-side you can just amend your fullCalendar "events" callback to process both sets of data, similar to that link I gave. Then it will use the second (new) set of results to highlight in red the days that have all the slots filled. – ADyson Apr 26 '17 at 12:56
  • Oh! thank you! ill check this – M Sazanof Apr 26 '17 at 14:22

0 Answers0