Playlist for a movie theater Options
skjoldby
Posted: Monday, November 17, 2008 3:36:53 PM
Rank: Newbie

Joined: 11/17/2008
Posts: 2
Hello
I'm working on a site for a small movie theater. But I'm stuck and I hope some one can guide me in the right direction.

Each movie is basicly just a page in umbraco with some standard properties like title, story, cast, director etc.

My problem is, that I need a property where I can select which days and times the movie is playing. Each movie will be played serval times.

Also I need to list this in a simple way on the site. I was just thinking something simple like this:

Monday, 17-11-2008 19:00, Quantum of Solace
Thuesday, 18-11-2008 19:00, Quantum of Solace
Wedensday, 19-11-2008 19:00, Burn After Reading
Thursday, 20-11-2008 19:00, Burn After Reading
Etc....

Can anyone tell me how to achieve this?

Thanks
Lars Skjoldby
Dirk
Posted: Monday, November 17, 2008 4:01:36 PM

Rank: Umbracoholic

Joined: 9/27/2007
Posts: 1,123
Location: Belgium
Hi Lars,

Welcome to umbraco.

Simplest solution to your problem:

- Create another doc type 'Event occurrence'. Add a property that allows for date and time selection (Should be available out-of-the-box)
- Allow doc type as child node of 'Movie' doc type.

Create as many child nodes as required and use some xslt to list all 'Event occurrence' child nodes for a specific 'Movie'

I agree that this is not the most elegant solution if a movie is being played 100's of times, in which case you'd have to enter the info 100x.

It would be nice to have such a 'Event schedule' datatype that would allow for a more flexible solution to add date/time patterns.

Hope this helps.

Regards,
/Dirk


level 1 & 2 certified - umbraco MVP 2008/2009 - umbraco blog at netaddicts.be - working on an integrated forum4umbraco
drobar
Posted: Monday, November 17, 2008 4:56:52 PM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,831
Location: MA, USA
Here's another approach. It isn't as flexible as Dirk's, but it might work in your situation.

The limitation is that you have to decide how many days to track, and that's how many properties you add to your docType. I'm going to assume that someone updates the movie listings once a week. Thus, you'll need 7 days of tracking for each movie. Let's do 8 days just to be on the safe side.

Here's what you'd do:

1. On the existing document type you're using for the movie (with cast, director, etc.), add a new tab called 'Show Times'.

2. Add new docType properties to the Show Times tab; one date picker and one textfield. Something like:
- Name: Monday's Date
- Alias: mondayDate
- Type: date picker (no time)

- Name: Monday's Show Times
- Alias: mondayShowTimes
- Type: textfield
- Description: List show times for this date (comma separated list if more than one showing today)

3. Repeat step 2 for Tuesday through Sunday.

4. Repeat step 2 again and add an additional set of fields for 'Following Monday' just in case the usual updates don't happen first thing every Monday morning. This isn't required but might be useful.

Each movie will then have a full week's list of show times and dates.

You'd then create two xslt macros. One would list all the movies playing this week and the other would list all the movie times for a specific movie.

cheers,
doug.



MVP 2007-2009 - Percipient Studios
skjoldby
Posted: Wednesday, November 19, 2008 12:30:03 AM
Rank: Newbie

Joined: 11/17/2008
Posts: 2
Hi both of you
Thanks for your input. I'll try to go with Dirks apporach, it looks most suitable for us.
I guess what you want me to do is a tree like this:
- Movie doctype
--- Occurrence doctype
--- Occurrence doctype

And if we put in some times and days, we will end up with a tree like this:
- Movie 1
--- Monday 13:30
--- Thuesday 13:30
--- Wedensday 13:30

- Movie 2
--- Monday 19:30
--- Thuesday 19:30
--- Wedensday 19:30

- Movie 3
--- Thursday 19:30
--- Friday 19:30

I skipped actual dates to make it more simple. I hope you get the picture anyway. See, some days two movies are playing, and somedays one movie are playing.

I would like it to be listet on the site like this:
Monday 13:30 - Movie 1
Monday 19:30 - Movie 2
Thuesday 13:30 - Movie 1
Thuesday 19:30 - Movie 2
Wedensday 13:30 - Movie 1
Wedensday 19:30 - Movie 2
Thursday 19:30 - Movie 3
Friday 19:30 - Movie 3

So I need to select every time/date in all "Occurrence doctypes", but still get the name (or a propety of) the movie doctype.

For me that is a complicated xslt statement. Can you guys tell if it's even posible?

/Lars








drobar
Posted: Wednesday, November 19, 2008 2:32:41 AM

Rank: Umbracoholic

Joined: 9/8/2006
Posts: 1,831
Location: MA, USA
Sounds like a good approach. And getting the output in xslt is not a problem.

Now, since I don't know the alias names of your docType properties I'm going to make some up. You'll need to modify according to your actual alias names. (I typed this in the forum so there's always a chance of a typo)

Code:
<xsl:template match="/">
    <xsl:for-each select="umbraco.library:GetXmlAll()/node [
                     @nodeTypeAlias='OccuranceDocType'
                     and data[@alias='MovieDate'] &gt;= umbraco.library:GetDateTimeNow()
                     ]">
        <xsl:sort select="data[@alias='MovieDate']"/>
        <xsl:sort select="data[@alias='MovieStartTime']"/>

        <!-- assuming the above selected and then sorted all the movie occurances properly, display them -->
        <xsl:value-of select="data[@alias='MovieDate']"/>
        <xsl:value-of select="data[@alias='MovieStartTime']"/>
        -
        <xsl:value-of select="../@nodeName"/>
    </xsl:for-each>
</xsl:template>


As you can see, there are only a few steps involved, though you can embellish to your heart's content :)

First, we select all the nodes in the content section of the proper docType (that is, @nodeTypeAlias). We further limit the list to only those nodes that are for today or in the future (I'll need to double-check that code, I may have made that function up... but the idea of what you want to do is at least correct).

Second, once we've got all the movie occurances for today and in the future, we sort them by date and then by time.

Third, we print out the result for each of those nodes, taking advantage of the fact that the parent of a MovieOccurance docType is a Movie docType. I've assumed you just use the node name for the movie title but if you've got a separate property on the Movie docType you'd just change the select to <xsl:value-of select="../data[@alias='MovieTitle']"/>

Hope that helps.

cheers,
doug.

By the way... if my xslt code above doesn't work you can start with a simpler version that will and then add to it to narrow down the output:
Code:
<xsl:template match="/">
    <xsl:for-each select="umbraco.library:GetXmlAll()/node [
                     @nodeTypeAlias='OccuranceDocType'
                     ]">

        <!-- assuming the above selected and then sorted all the movie occurances properly, display them -->
        <xsl:value-of select="data[@alias='MovieDate']"/>
        <xsl:value-of select="data[@alias='MovieStartTime']"/>
        -
        <xsl:value-of select="../@nodeName"/>
    </xsl:for-each>
</xsl:template>


MVP 2007-2009 - Percipient Studios
Users browsing this topic
Guest


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.