Created
August 13, 2012 20:33
-
-
Save 1stevengrant/3343918 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{day1_workshop_selection} | |
{if "{embed:workshopTime}" == "{day1_workshop_selection_time}"} | |
{!-- so this sql is looking to see who has registered for day 1 workshops and gives us a variable of {workshop_count} --} | |
{exp:query sql="SELECT count(cd.entry_id) AS workshop_count | |
FROM exp_channel_data cd INNER JOIN exp_channel_titles ct ON cd.entry_id=ct.entry_id WHERE cd.channel_id = '8' AND cd.field_id_126 LIKE '%{embed:workshopTime}%%{day1_workshop_selection_title}%' AND cd.field_id_131 = '{structure:page:uri}' AND ct.status = 'open'"} | |
{!-- then our math to check if the workshop count is greater than the capacity, we disable that selection --} | |
{if workshop_count >= '{day1_workshop_selection_capacity}'} | |
<option value="" disabled="disabled">FULLY BOOKED - {day1_workshop_selection_title}</option> | |
{if:else} | |
<option value="{day1_workshop_date format="%d.%m.%y"} @ {embed:workshopTime} - {day1_workshop_selection_title}">{day1_workshop_selection_title}</option> | |
{/if}<!-- query if --> | |
{/exp:query} | |
{/if} | |
{/day1_workshop_selection} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment