This page is archived
We're keeping this page up as a courtesy to folks who may need to refer to old instructions. We don't plan to update this page.
Managing online calendars and event registration can present a huge challenge. Without a dynamic system, the task is nearly impossible. Generating the HTML re- quired to display a calendar and all the various presentation options (day, week, month views, and so on) is unreasonable; and worse, because the events are time-sensitive, remembering to update “next” or “upcoming” event lists can be onerous. Nothing looks worse than having last week’s meeting listed first on your Upcoming Events page.
Even with dynamic systems, you tend to be constrained to certain parameters with fixed options. However, by taking advantage of the flexibility of Drupal and building on the powerful base of Views, you can accommodate nearly any variation on event listings for your site. This series will introduce the following Date, Calendar, and Flag modules to show you how you can build a custom event site quickly and easily. This is part of the O'Reilly Using Drupal book guide, and you can use the Using Drupal, 2nd Edition book to follow along with this series.
The series begins with our case study for the Aurora Book Club, and then walks through creating an event content type, and using the Views module to display our events in several different ways, including a calendar view, list view, and an iCal export. Once we have the main event features in place, we will also take a look at how to use the Flag module to allow members to mark attendance for events. We wrap up by creating a view of the attendees per event, which is added as a tab to each event node.
See our guide Using Drupal Book by O'Reilly Media to access all of our tutorials related to this book. Each series covers a chapter (or appendix).
To kick off this series, we're going to take a look at the needs for our project. Our client is the Aurora Book Club, and they need a way to track events along with who is attending the events. In this lesson, we'll discuss the requirements, and how we'll implement them. We'll also be taking a tour of the finished site so we can see where we're headed. At the end of this lesson you should understand what the target site is that we will be building.
Additional resources
To get things started we need to create a new, basic content type just for events. We just need the event name and description along with an easy way to add the event location. In this lesson, we'll create the content type and set up our permissions.
Additional resources
The main building block for the site is our new Event content type. The information that we need it to provide us with is “where” and “when.” We have taken care of the “where” part in our initial setup, and the Date module helps us answer the “when” question, in an incredibly flexible manner. Our main interest in the Date module is the ability to add a field to our Event content type to indicate date and time. However, looking at the Date module more closely, there are a few extra pieces worth noting. In this lesson we'll get a good overview of what the Date module provides by looking at Submodules, Field Types, Form Elements, and Field Settings.
Additional resources
Now that we have our basic Event content type set up, we'll enhance it by adding a date field, so that members may schedule meetings. In this lesson, we'll add and configure our new date field, and then create a new event to test it all out.
Additional resources
Now that we’ve created our Event content type and started adding content to the site, we need to tackle the Upcoming Events list requirement. This will allow members to quickly see the meetings happening in the coming days or weeks. To achieve this, we will use the Views module to create a block for the sidebar. Our view will show published events where the event’s time field is in the future, and we'll sort it chronologically so the next event is at the top of the list. We'll get to learn more about the Date Views filter to accomplish our task.
Additional resources
Although a simple list of upcoming events is very useful, our site has additional requirements for the display of the event data. As is extremely common for event management websites, this site needs an interactive calendar for browsing through past and future events. We need a classic monthly calendar view, along with a day and week views so people can see the calendar in the format they are used to seeing. We also want people to be able to download the calendar and use it in other calendar applications if they'd like. We're going to implement this feature using the Calendar module in conjunction with Views. In this lesson we'll get an overview of how the Calendar module can help us by taking a look at the Calendar View Type, along with the handy built-in iCal Integration.
Additional resources
We have our Upcoming Events block, but now we need to build out our full calendar. Although this is potentially a daunting task, involving many tables and many variations for the display (week, month, etc.), the Calendar module conveniently comes with a default view that handles most of the difficult bits for us. In this lesson we'll clone the Calendar default view to give us a good starting place, and alter the view to suit our needs.
Additional resources
The Flag module is an incredibly flexible module that allows you to create relationships between users and/or content on your site. After you create a flag, an item can be marked a few different ways, and we can use that information in our views. In this lesson we'll get an overview of Flag by looking at the various flag settings and seeing how flag works in action.
Additional resources
We're almost done with our site, but we still need to have some way for people to indicate if they are coming to an event. In this lesson we'll enable and configure an Attendance flag, adding it to our Event content type. Once we have it all set up we will flag an event to see how it works in action.
Additional resources
We now have events and people can mark if they are going or not, and the final piece to wrap this project up is to get a list of those attendees for an event. We're going to use Views again to handle this for us. In this lesson we're going to create a new View for attendees, and using relationships and contextual filters, we'll make sure it only lists the attendees for a specific event. With that in place, we'll add the view as a tab to the Event nodes so you can quickly and easily see who is attending that event as you navigate through the content.
Additional resources
The site we have built covers all of the needs for the club. Down the road, the members may want to spruce things up a bit. In this lesson we'll look at a few modules that could round out the site even more:
- Full Calendar
- Countdown
- Flag Actions (part of Flag)
- OpenLayers
Additional resources
In this chapter, we have looked at building an event management site for the Aurora Book Club, making use of the Date field, the Calendar plug-in for Views, and the Flag module for handling attendance. The book club now has a handy calendar that is displayed on the site and available in iCal format. They also have an easy-to-find list of all the attendees for each event. The site is simple and easy to use, yet fits all of the club’s needs quite nicely. In this summary we'll take a tour of the Aurora Book Club site to see what we've built, and discuss our implementation points. Then we'll wrap up with a quick review of of modules we talked about in this series.
Additional resources
Drupalize.Me Guide: Using Drupal Book by O'Reilly Media
Up next: Using Drupal Chapter 7: Managing Publishing Workflows