Forum

Thread tagged as: Question, Problem, Runway

Timetable/Schedule with grouped entries

I’m trying to build a time table where for each time slot, I have to be able to enter two sessions, which are groups of talks.

Time | Room 1 | Room 2

10 - 11 | Session 1 | Session 2

11 - 12 | Session 3 | blank

13 - 14 | Session 4 | Session 5

Each session includes multiple talks, each with a speaker.

Because the time table isn’t finished yet and there are over 50 talks with more than 30 speakers (some with multiple talks), I have to achieve this with the ability to re-arrange if needed without having to copy and paste all the content. I first tried to have multiple collections, connecting them via relationships. Because nested relationships aren’t possible, I switched to having a repeater in each session for the talks. Apart from the fact that I cannot pull in the repeater information from within a relationship, I cannot use relationships to connect speakers to each talk, so I have to repeat their content as well, which is a huge source of error for my content editors, especially if new information for the speakers is added and has to be filled into every one of the talks. To illustrate this nesting:

  • Slot 1

** Session for Room 1

*** Talk 1

**** Speaker info

*** Talk 2

**** Speaker info

*** Talk 5

**** Speaker info

** Session for Room 2

*** Talk 3

**** Speaker info

*** Talk 6

**** Speaker info

  • Slot 1

** Session for Room 1

*** Talk 7

**** Speaker info

*** Talk 8

**** Speaker info

*** Talk 9

**** Speaker info

** Session for Room 2

*** Talk 10

**** Speaker info

*** Talk 11

**** Speaker info

How can I achieve this without repeating myself over and over again? Outside of the templates, I have to use a lot of PHP to get this done, which seems wrong just to get a basic nested hierarchy like this displayed.

program.php:

            <table class="timeslots">
            <thead class="timeslots__header">
              <tr>
                <td>Time</td>
                <td>Room 1 (simultaneous translation)</td>
                <td>Room 2 (simultaneous translation)</td>
                <td>Workshops</td>
              </tr>
            </thead>
              <?php
                perch_collection('Timeslots', [
                  'template' => 'collections/timeslots.html',
                  'filter' => 'timeslotsDay',
                  'match'  => 'eq',
                  'value'  => 'Saturday 04. November',
                ]);
              ?>
            </table>

timeslots.html:

<tr class="timeslots__row">
    <td class="timeslots__cell timeslots__cell01">
        <perch:if different="timeslotsDay">
            <h3 class="timeslots__date"><perch:content id="timeslotsDay" type="select" label="Kongresstag" options="Thursday 02. November, Friday 03. November, Saturday 04. November" allowempty="false" required="true" suppress="true" title="true" /></h3>
        </perch:if>
        <p class="timeslots__time"><perch:content id="timeslotTime" type="text" label="Timeslot Time" title="true" /></p>
    </td>

    <td class="timeslots__cell timeslots__cell02">
        <perch:related id="timeslotRoomOne" collection="Sessions" label="Session in Raum 1" max="1">
            <h3><span class="timeslots__room">Room 1: </span><perch:content id="sessionName" /></h3>
            <div class="timeslots__sessionDetails">
                <perch:content id="sessionDetails" />
            </div>
        </perch:related>
    </td>

    <td class="timeslots__cell timeslots__cell03">
        <perch:related id="timeslotRoomTwo" collection="Sessions" label="Session in Raum 2" max="1">
            <h3><span class="timeslots__room">Room 2: </span><perch:content id="sessionName" /></h3>
            <div class="timeslots__sessionDetails">
                <perch:content id="sessionDetails" />
            </div>
        </perch:related>
    </td>

    <td class="timeslots__cell timeslots__cell04">
        …
    </td>
</tr>

sessions.html:

<perch:content id="sessionName" type="text" title="true" label="Name der Session" />
<perch:content id="sessionDetails" type="textarea" editor="redactor" html="true" label="Session Details" />

<perch:repeater id="sessionTalks" label="Talks">
    <perch:content id="talkName" type="text" label="Name des Talks" />
    <perch:related id="talkSpeaker" collection="Speakers" label="Speaker">
        <p class="talk-speaker">
        <perch:if exists="speakerImage">
            <img class="speaker-image speaker-image--small" src="<perch:content id="speakerImage" height="32" width="32" type="image" />" alt="">
        <perch:else />
            <img class="speaker-image speaker-image--small" src="/build/img/photos/users-color_circle-08.png" alt="">
        </perch:if>
        <span class="speaker-name"><perch:content id="speakerName" /></span>
        <perch:if exists="speakerCity OR speakerCountry"> <span class="speaker-location">(<perch:if exists="speakerCity"><perch:content id="speakerCity" />, </perch:if><perch:content id="speakerCountry" />)</span></perch:if>
        </p>
    </perch:related>
</perch:repeater>

Cheers, Jannis

Jannis Borgers

Jannis Borgers 0 points

  • 4 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

I think this is probably too broad a question for us to be able to help with under free support, but I'll leave it here in case anyone else wants to chip in.