Jump to:

10928 Posts in 2612 Topics by 1809 members

All other Modules

SilverStripe Forums » All other Modules » [Solved] Event Calendar - show past events

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Page: 1 2
Go to End
Author Topic: 1810 Views
  • borriej
    Avatar
    Community Member
    267 Posts

    [Solved] Event Calendar - show past events Link to this post

    Hello (UncleCheese ;)),

    I stripped down the calendar template:

    <div class="calendar typography">

    <h2>$Title</h2>
    $Content

       <div class="ptop20">
          <table cellspacing="0" cellpadding="0">
           <tr>
             <td valign="top" width=""><p><strong>Datum</strong></p></td>
             <td valign="top"><p><strong>Wedstrijd</strong></p></td>
             <td valign="top"><p><strong>Soort wedstrijd</strong></p></td>
             <td valign="top"><p><strong>Plaats/Land</strong></p></td>
             <td valign="top"><p><strong>Uitslag</strong></p></td>
           </tr>

          <% if Events %>
             <% control Events %>
             
              <tr>
                <td valign="top">
                
                <p>
                $_Dates
                <% if AllDay %>
                   <dt><% _t('ALLDAY','All Day') %></dt>
                <% else %>
                   <% if StartTime %>
                      <dt><% _t('TIME','Time') %>:&nbsp;</dt>
                   <dd>$_Times</dd>
                   <% end_if %>
                <% end_if %>
                            
                <% if OtherDates %>
                <h4><% _t('SEEALSO','See also') %>:</h4>   
                   <% control OtherDates %>
                      <li><a href="$Link" title="$Event.Title">$_Dates</a>
                         <% if StartTime %>
                            <ul>
                               <li>$_Times</li>
                            </ul>
                         <% end_if %>
                      </li>
                   <% end_control %>
                <% end_if %>               
                </p>   
                         
                </td>
                <% control Event %>
                   <td valign="top"><p>$Title </p></td>
                   <td valign="top"><p><% if SoortWedstrijd %>$SoortWedstrijd<% else %>-<% end_if %></p></td>
                   <td valign="top"><p><% if Content %>$Content<% else %>-<% end_if %></p></td>
                   <td valign="top"><p><% if Uitslag %>$Uitslag<% else %>-<% end_if %></p></td>
                <% end_control %>
              </tr>
             
             <% end_control %>
          
          <% else %>
             <% _t('NOEVENTS','There are no events') %>.
          <% end_if %>
          
          </table>
          
          <span class="feed"><a href="$RSSLink"><% _t('SUBSCRIBE','Subscribe to the Calendar') %></a></span>
       </div>
       
    </div>

    Now I only see the upcomming events ofcourse.
    How do i show the past events as well?

    I want to have a simple table (year overview)
    the past events must be visible but grey, so an extra class to the past events would be nice.

    How do i do this?

    thx!

  • UncleCheese
    Avatar
    4085 Posts

    Re: [Solved] Event Calendar - show past events Link to this post

    Did you try <% control RecentEvents %>??

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: [Solved] Event Calendar - show past events Link to this post

    I need something like control children, but this doesn't work.

    I want all events to be shown (past and future) oldest event on top, future events at the bottom. Would like to grey-out the events that have been executed.

    So in short: in need to display the entire list of events on a single page and add a class to past events.

  • UncleCheese
    Avatar
    4085 Posts

    Re: [Solved] Event Calendar - show past events Link to this post

    Well, provided you're not using announcements or recurring events, you could use

    <% control Children %>
    <% control DateTimes %>
    <% if StartDate.InPast %>

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: [Solved] Event Calendar - show past events Link to this post

    this works pretty nice
    How do i highlight the current event?

    need something like: <% if CurrentEvent %>class="highlight"<% end_if %>

    Is there a nice doc where i can find template control on event calendar?

  • UncleCheese
    Avatar
    4085 Posts

    Re: [Solved] Event Calendar - show past events Link to this post

    What do you mean the "current event?"

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: [Solved] Event Calendar - show past events Link to this post

    well, i have an event that is happening today for instance.

    I would like to highlight this item in my table.

    and it would be nice to grey-out the events that have already happened. How do i do this in the template?

    btw:

    <% control Children %>
    <% control DateTimes %>
    <% if StartDate.InPast %>

    is giving the same result as:

    <% control Children %>
    <% control DateTimes %>

    -> this works nice thx for that, i got a nice table with all the events planned.

    Im working on a racing agenda and extended it with a 'result' box, thats why the past events must be shown

  • borriej
    Avatar
    Community Member
    267 Posts

    Re: [Solved] Event Calendar - show past events Link to this post

    If there isn't an event on today (the current date), highlight the first upcomming event.

    1810 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.