Needs work
Project:
Bookings API
Version:
6.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Support request
Reporter:
Created:
11 Nov 2009 at 21:26 UTC
Updated:
14 Nov 2010 at 13:38 UTC
Jump to comment: Most recent
this booking module looks quite promising have been playing with both stable and development versions.
was wondering if possible to have a user as sa resource.
the idea is to have 2 user groups e.g 1. teachers_group_users 2. student Group_users
Both users would have to sign up. but the teachers users would each be an individual resource whose time is bokkable say for an appraisal by a student. teacher can not be an admin nor can one teacher see another teachers resource/calendar
thanks in advance
Comments
Comment #1
happy123-1 commentedComment #2
Anonymous (not verified) commentedHmm, at the moment it would not be possible. But - the hooks in 3.x-dev should give you the opportunity to alter the list of resources .. I'll have to change the validation/conflict checking methods (those ignore a couple of need hooks ATM), and then it should definitely be possible. I'll have to look at the views-implementation though, so far this depends on a node-reference-field ...
OTOH you could simply add one node with a user-reference field for each teacher?
--edit: And then you would have to add a view that selects all bookings on a given "user-node" and displays them to the user. Alternatively/Additionally you could use Trigger/Action to automatically inform teachers about bookings in their user-node.
Comment #3
happy123-1 commentedI would like each teacher to be able to only control their own resource time, and not be able to view another teachers' resource times. I'm not sure this could be done with the later method. Or could it??
Comment #4
Anonymous (not verified) commentedWell, so far there is no real permission setting for bookings (actually there are some permissions, but not fine enough).
You could let each user create/own his own node and thus each user could control his own node. Then you could disable all views and add one view viewing the current users nodes records. It's not perfect but it's a way.
For a real control / permission setting you would need an additional module.
Comment #5
Anonymous (not verified) commentedA (minimal) list of hooks in Bookings API 3.x can now be found at http://groups.drupal.org/node/34868
Comment #6
happy123-1 commentedI would also like todo the booking in reverse. currently you select the resource then give it a a date-time and check for conflicts.
what I was looking for, was to search a date-time periods (including repeat) and see which resources where available and then book one or more of them.
the search would probably be an sql-based search but not sure which field. also the conflict checking is probably php code which is not really my area.
any ideas or suggestions
Comment #7
Anonymous (not verified) commentedAt the moment the table {bookingsapi_schedules} contains all bookings and availabilities (TYPE = 1 -> Booking, 2 = Unavailable, 3 = Available), status contains whether the booking is finalized (see bookingsapi.modules for a list). (See the new conflict checking for a start).
I need such a list myself - but it's non-trivial (at least if done with performance-considerations in mind). IF you have view bookings and many views you can cache the whole lot - add another table and e.g. for each resource and day add a field containing an array (serialized) of available time-slots. Of course you would have to alter this each time a booking is made.
Alternatively select a timeframe (should be bookingsapi_timeframe_survey, though I didn't fix this for 3.x yet) which gives you a list of bookings and availabilities for a given resource, then build a list of available slots out of this.
I don't have a nice solution for this yet. If you can wait some month - I am going to develop one. Otherwise you are on your own - sorry.
Comment #8
happy123-1 commentednot sure if my thinking is correct but there might be a simpler way.
Assuming a resource is available by default, could we not use a database search string using NOT matching the columns of current booked dates and their repeat dates. Then give it a command/view to list the array of resources found.
sorry i'm not a programmer so may be over simplfying.
What are your thoughts? thanks!
Comment #9
Anonymous (not verified) commentedActually it's trivial to search (either for all resources or for a single resource) wether said resource is available at any given time (e.g. if your bookings always span for two hours, its trivial to tell whether any resource can be booked at 1800 on Wednesday the 32th).
And of course it's possible to build a list of available times:
Now we have a list of available times for ONE resource - repeat this for every other resource (can of course be done in one step, but thats beside the point). (You can use bookingsapi_timeframe_survey and build some kind of inverse of it). And of course you could take your approach and select all times with no booking.
If you want to fetch this information only seldom - that's not a problem. But: This kind of access is a resource-hugger, so it's problematic as soon as you start doing this more often and/or for longer periods of time. So in that case you would have to cache the results and rebuild the cache if the bookings are changed.
So its not a problem in itself, but performance considerations are hard to get by.
Comment #10
Anonymous (not verified) commentedI am actually working on a table bookings_cache_free which will hold a list of available time-slots .. It's untested, but committed.
Comment #11
matalo commentedI am in a similar situation, I need to be able to book students into tutors individual schedules. I had a look at 3.x but what with only some of the reference data being ported over to a node storage structure and some still in standalone tables I fell back to 1.x.
At the moment my implementation plan is to write a hook_user function which watched for a user with a specific role (instructor) being created, and then create a matching resource record for that user. This will allow me to associate a booking with an instructor.
I would then have to create a table which stored user bookings so that I can associate users with the bookings that they made with the instructor.
Does this sound like a feasible plan?
edit: I should add, I am new to module development. Any advice is appreciated.
Comment #12
Anonymous (not verified) commentedYes, its feasible ;)
But: Why would you need to create an additional table with user bookings? You could save the uid as note/name for the booking or the client and use the normal booking table.
When do you need your module? 3.x would make this much easier (e.g. more and better hooks in Bookings API).
Comment #13
matalo commentedThis is very true, I suppose I could use the booking name or description field to store my uid key. Makes things much simpler :)
This is for a university project due in within 4 months from now. It is built around bookings so I don't think I should be waiting for 3.x to come around :)
Thanks for responding tirsales.
Comment #14
YK85 commentedmatalo - were you able to develop something with your needs? Would you be able to kindly share with the community?