A simple booking system with CGCalendar

Do something cool with CMS? Show us ...
This board is for 'Answers', and the discussion of answers... Not for questions.
Locked
Torpedine
Forum Members
Forum Members
Posts: 142
Joined: Thu May 18, 2006 3:53 pm

A simple booking system with CGCalendar

Post by Torpedine »

Recently I built a website for an engineering firm http://www.studiolatrofa.it, with a simple and nice booking system for the meetings.

These where the requests:

1. The user goes to the booking page and checks the calendar for a free time slot;
2. the user logs in or registers himself on the website (SelfRegistration Module) and can book a meeting with the staff - time slots are obviously not allowed to overlap (a simple setting in CGCalendar)
3. to maintain the privacy, only the staff can see the meetings' detail: the simple user can only see a NOT AVAILABLE message, along with the taken time slot.

To do this you only have to modify the "Calendar" template on CGCalendar: it's better if you create another Calendar template, calling it in a way that suits you, and change the lines from 23 to 29, where you can find this code:

Code: Select all

<td {if isset($day.class)}class="{$day.class}"{/if}>
{if isset($day.events.0)}<a href="{$day.url}">{$key}</a>
<ul>
{foreach from=$day.events item=event}
<li><a href="{$event.url}">{$event.event_title}</a></li>
{/foreach}
</ul></a>
With this other lines of code:

Code: Select all

<td {if isset($day.class)}class="{$day.class}"{/if}>
{if isset($day.events.0)}
   {if $ccuser->memberof('Staff') }
      <a href="{$day.url}">{$key}</a>
   {else}
      {$key}
{/if}
<ul>
{foreach from=$day.events item=event}
{if $ccuser->memberof('Staff') }
 <li>{$event.event_date_start|date_format:"%H:%M"}-{$event.event_date_end|date_format:"%H:%M"}: <br/><a href="{$event.url}">{$event.event_title}</a></li>
{else}
<li>{$event.event_date_start|date_format:"%H:%M"}-{$event.event_date_end|date_format:"%H:%M"}: NOT AVAILABLE</li>
{/if}
{/foreach}
</ul>
What we have done?
We have changed the way to CGCalendar module displays the events on the calendar view.

The first "if" statement displays the link to the detail view, put on the date number, only if a "Staff" member in logged in; other users see only a simple date without any link.

The second "if", again, displays the detail only to the Staff, otherwise displays only the timeslot and a "Not available" message.

Note the I created the "Staff" FEU group because the Firm Staff can see all the meetings in the Calendar View, much nicer and organised than the Admin one on the back end.

This was my first tip for CMS Made Simple, I Hope it will be useful.

You can contact me here on the forum or on twitter @gianlucasavini
compufairy
Forum Members
Forum Members
Posts: 183
Joined: Sun Sep 07, 2008 10:47 am

Re: A simple booking system with CGCalendar (tutorial)

Post by compufairy »

Thank you for sharing :-)

- Anne-Mieke
"If you think it's expensive to hire a professional to do the job, wait until you hire an amateur..." (Red Adair)
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

Re: A simple booking system with CGCalendar

Post by blackhawk »

Thank you Torpedine for the post! If you don't mind me asking, what was the module you used to do the actual booking process, along with CGCalendar?
Torpedine
Forum Members
Forum Members
Posts: 142
Joined: Thu May 18, 2006 3:53 pm

Re: A simple booking system with CGCalendar

Post by Torpedine »

No one. All the bookings are for office meetings, so everything is managed in CGCalendar
blackhawk
Power Poster
Power Poster
Posts: 280
Joined: Mon Oct 20, 2008 6:07 pm

Re: A simple booking system with CGCalendar

Post by blackhawk »

wow! That's awesome. I will give this a shot in my current project!

Thanks
Locked

Return to “Tips and Tricks”