Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

All other Modules /

Discuss all other Modules here.

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

[Solved] Event Calendar - show past events


Go to End


13 Posts   2866 Views

Avatar
borriej

Community Member, 267 Posts

20 February 2011 at 7:56am

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!

Avatar
UncleCheese

Forum Moderator, 4102 Posts

26 February 2011 at 3:49am

Edited: 26/02/2011 3:49am

Did you try <% control RecentEvents %>??

Avatar
borriej

Community Member, 267 Posts

26 February 2011 at 4:10am

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.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

1 March 2011 at 3:47am

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

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

Avatar
borriej

Community Member, 267 Posts

1 March 2011 at 10:32am

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?

Avatar
UncleCheese

Forum Moderator, 4102 Posts

1 March 2011 at 11:03am

What do you mean the "current event?"

Avatar
borriej

Community Member, 267 Posts

1 March 2011 at 11:13am

Edited: 01/03/2011 11:14am

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

Avatar
borriej

Community Member, 267 Posts

1 March 2011 at 11:16am

Edited: 01/03/2011 11:16am

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

Go to Top