Viewing Events

As noted earlier, the content-creation forms for your event types (node/add/type) will now have fields for entering starting and ending dates and times. If the ending time is earlier than the starting time, it is ignored, which is convenient for events where no ending time is specified. If an event spans more than one day, it will show up on all of the intermediary days in the calendar.

When you're viewing an event-enabled node, the start and end times will be shown, and a link to the calendar view will appear at the bottom. Clicking the calendar link will show the calendar with the day of the event highlighted. (The Drupal path to the current events calendar is event.) Figure 4-14 shows an example of a calendar view.

Events

Select euent terms to filter by (all)

Select event type to filter by

vjookjdavjtaNc

«

December 2005 »

^KTT^H

Ll

[2

[3

[6

Ll

la

Is.

Symphony Orchestra

Start! 14! 00 End! 17!30

Symphony Orchestra Start: 14:00 End: 16:30

(Holiday)

Pear! Harbor

Remembrance

Symphony Orchestra

Start: 14:00 End: 16:30

(Rehearsal)

Symphony Orchestra

Symphony Orchestra Start: 18:00

In

ta

U3

Li±

Lis.

ta

Ill

Symphony Orchestra

Start! 15:00

Men's Choir

Start: 18:00

(Rehearsal)

Men's Choir

Men's Choir

Start: 20:00

Lis.

ta

Winter Solstice Start: 00:00

121

122

Christmas Eve

Start: 00:00

124

125.

126.

128

129

ta

Christmas Day

Kwanzaa

Kwanzaa

New Year's Eve

(Holiday) Hanukkah Start! 00 ¡00

(Holiday) Hanukkah all day

(Holiday) Hanukkah all day

(Holiday) Hanukkah all day

(Holiday) Hanukkah End: 23:59

(Holiday) Hanukkah Start! 18:00 End! 23:59

(Holiday) Hanukkah Start: 12:39

Kwanzaa

Start: 12:40

Figure 4-14. The month of December showing rehearsals, concerts, and holidays

The calendar view comes with selection boxes that you can use to filter the events being displayed. This is particularly useful when you're looking at a crowded calendar. The first selection box allows you to filter the calendar by taxonomy category, and the second filters by node type. Figure 4-15 shows an example of filtering by a taxonomy category.

Figure 4-15. The month of December showing only holidays when school is open (a taxonomy category)

All of the parameters governing time range, category, and type of event can be built into the URL. This makes URL manipulation an effective tool for querying a Drupal site for its event information. Here is how event URLs are built:

?q=event/$year/$month/$day/$view_type/$content_type/$taxonomy_terms/$duration

The event URL variables are as follows:

• $month: An integer from 1 to 12 representing the month.

• $day: A two-digit integer representing the day of the month to start from. Leading zeros are required, as in 03.

• $view_type: The type of calendar layout. Values include month, week, day, table, ical for an iCal export, and feed for an RSS feed.

• $content_type: A list of node types, separated by a plus sign (+). Flexinode types require only the integer value of the type. For example, to view story nodes and flexinode type 1, you would use story+1. The value all will show all types.

• $taxonomy_terms: A list of term IDs, separated by a plus sign (+). For example, to view entries assigned to the taxonomy terms with IDs 4 and 9, you would use 4+9. The value all will show all terms.

• $duration: The number of days to display. Currently, only the table view observes this setting.

For example, suppose you wanted to see all of the Men's Choir concerts and rehearsals for the five-day period December 14 to 19. Here's what the URL would look like:

http://domain/?q=event/2005/12/14/table/1+2/10/5

This URL is built as follows:

• $content_type: 1+2, which means Concert and Rehearsal, since these are flexinode 1 and flexinode 2 types

• $taxonomy_terms: 10, the taxonomy term for Men's Choir

The result is a subset of the events shown in a tabular view, as illustrated in Figure 4-16.

Events - Filter: Rehearsal, Concert

Select event terms to filter by

Concert [v]

Select euent type to filter by month I week I day I view all I view all

Events - Filter: Rehearsal, Concert

Select event terms to filter by

Concert [v]

Select euent type to filter by month I week I day I view all I view all

« December 14, 2005 - December 19, 2005

»

112 / 14

(R&hearsai)

Men's Choir

Start: 18:00 more info

"112/15

Men's Choir

more info

Men's Choir

Start: 20:00 more info

112 / 18

112 / 19

Figure 4-16. Men's Choir concerts and rehearsals from December 14 to 19

0 0

Post a comment