Vineet Sawant Posted April 21, 2013 Share Posted April 21, 2013 Hello, I'm making a simple drama ticket booking system. I need to add drama page where it'll display the name of the theatre(s) where the drama is going to be playing. The requirement is to allow user to book tickets of the show till last 3hrs for the show, after that tickets will only be available at the window. Tickets will be available for 7 days before the show's playing date-time. Dramas can have multiple shows in same city/same theatre but will be playing on a single location at a time. For example, if Macbeth is going to play at Broadway theatre on 1st May & Imperial theatre on 2nd May, the drama page should show both the shows & allow ticket booking for both. But once the 1st May has passed, it should be automatically removed from the list. All I want to know is, while adding the field for theatre name, there should be some way I can add "post expiry date-time" & connect it with theatre's name(page list). Theatre's page should also automatically create schedule based on all the shows added in the system. Thanks for your time. This is a designer trying his hands & some poor programming skills in PW, so please be kind. Link to comment Share on other sites More sharing options...
diogo Posted April 21, 2013 Share Posted April 21, 2013 I think you should do this control in the templates. You can have a page for each drama, and children pages or a repeater for all the shows of that drama. On them you will have a date field with the time of the show. Then on the template you can do this: if (($page->date - time()) < (3 * 60 * 60)) { // 3 hours in unix time // tickets can't be sold anymore } and if (($page->date - time()) > (7 * 24 * 60 * 60)) { // one week in unix time // tickets are available from now on } 2 Link to comment Share on other sites More sharing options...
Wanze Posted April 22, 2013 Share Posted April 22, 2013 One small addition to diogo's solution: You should calculate time() - $page->date, otherwise the first if is always true and the second can't be. if ((time() - $page->date) < (3 * 60 * 60)) { // 3 hours in unix time or take the absolute value of the difference: if (abs($page->date - time()) < (3 * 60 * 60)) { 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now