Welcome, Guest. Please login or register.
Did you miss your activation email?


Login with username, password and session length

Search

 
Advanced search

8043 Posts in 1856 Topics- by 2099 Members - Latest Member: roi
Pages: [1]   Go Down
Print
Author Topic: Help with changing the List View  (Read 294 times)
0 Members and 1 Guest are viewing this topic.
TommyS
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« on: August 13, 2005, 09:03:00 PM »

I am new to CalendarScript but so far i LOVE it.

I was wondering if someone could help me figure out how to change the list view so that it shows like this:
<**
Sunday, August 7
• 8:15 am :  Chalice Bearer : Lance
            Lector : Debbie, Karen
            Verger : Christy
• 10:30 am : Chalice Bearer : Lance
            Lector : Debbie, Karen
            Verger : Christy

Sunday, August 14
• 8:15 am :  Chalice Bearer : Lance
            Lector : Debbie, Karen
            Verger : Christy
• 10:30 am : Chalice Bearer : Lance
            Lector : Debbie, Karen
            Verger : Christy
**>

So far i've gotten it to do this:
<**
Sunday, August 7
• 8:15 am : Chalice Bearer : Lew Perrigo
• 8:15 am : Lector : Debbie Orr, Karen Lee
• 8:15 am : Verger : Verger
• 10:30 am : Chalice Bearer : Lew Perrigo
• 10:30 am : Lector : Debbie Orr, Karen Lee
• 10:30 am : Verger : Verger
**>

I'm not that familiar with Perl though I can usually figure out what's going on. I'm not quite sure how to get it to group the events by time so that events that occur at the same time will only display the time once. Basically what i'm using this for as you can probably guess is to show the schedule for church volunteers and each service will have several volunteers.

Also what about always having the events displayed in the same order:

Chalice Bearer
Lector
Verger

I input this field via a selectbox in the add event field called position.

Any help would be greatly appreciated!

Tommy

[This message has been edited by TommyS (edited August 13, 2005).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #1 on: August 14, 2005, 05:13:00 PM »

** I'm not quite sure how to get it to group the events by time so that events that occur at the same time will only display the time once. **

It might be able to be done using a conditional. The following is pseudo (not real) code of one way it might be able to be done.

1. Print the time
2. Store the time in variable
3. Compare next time to previously stored time
4. If the same time, skip printing it
5. If different, put the new time into the variable.
6. Go to 1

There might be an easier way but I don't know what it would be off hand.

** Also what about always having the events displayed in the same order: **

You should probably be able to sort the events on any detail in the even record. If each of those records has a field that will allow a sort to keep them in that position...

You can see one example of sorting events in the previous forum message "sort events in a day by time added". you might be able to find other, different examples by searching the forums.

Dan O.

[This message has been edited by DanO (edited August 14, 2005).]

Logged
TommyS
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #2 on: August 14, 2005, 10:16:00 PM »

Whew! Ok after playing with the code for a bit I was able to get it all to work. Thanks DanO for the help.

Here's the code I used in the default.html:

code:

<%-- LIST STYLE DISPLAY --%>
<CENTER><TABLE BORDER="0" WIDTH="90%"><TR><TD ALIGN="left">
<SPAN CLASS="text">
<DL>

<%FOREACH EVENTLIST%>
<%$event_flag=0;%>
<%IF EVENTS EXIST%>
<%$total_events++;%>
<DT><B><A HREF="<%=$CGI_URL_QUERYSTRING%>selected_datestring=<%=$DAY->{'datestring'}%>&datestring=<%=$DAY->{'datestring'}%>&view=Day" CLASS="text"><%=$DAY->{dayname}%>, <%=$DAY->{monthname}%> <%=$DAY->{dd}%></A></B>
<DD>
<% @$EVENTS = sort {$a->{schedule}->{start} <=> $b->{schedule}->{start}  | | ($a->{details}->{position} cmp $b->{details}->{position}) } @$EVENTS; %>
<% $tTime = ""; %>

<table><%FOREACH EVENT%><tr><td>
<% if ($in{filter} eq "All" | | $in{filter} eq $EVENT->{'details'}->{'category'} | | $EVENT->{'details'}->{'category'} eq "" ) { %>
               
<% if ($tTime ne $EVENT->{'schedule'}->{'start_time'}) { %>
<% if ($_SHOW_GRID_EVENT_BULLET) {%>•<%}%>               
<% if ($_SHOW_EVENT_TIMES eq "ALL" | | $_SHOW_EVENT_TIMES eq "START") { %>
               
<% if ($EVENT->{'schedule'}->{'start_time'}) { %><%= SCHEDULE FIELD(start_time) %> <% $tTime = $EVENT->{'schedule'}->{'start_time'}; %> : </td> <% } %>
<% } %>
<% } %>
               
<% if ($_SHOW_EVENT_TIMES eq "ALL") { %>
<% if ($EVENT->{'schedule'}->{'end_time'}) { %>-<%= SCHEDULE FIELD(end_time) %><% } %>
<% } %><td>
               
<% if (($_SHOW_EVENT_TIMES eq "ALL" | | $_SHOW_EVENT_TIMES eq "START") && ($EVENT->{'schedule'}->{'start_time'})) { %> <!--:--><% if ($EVENT->{'details'}->{'position'} ne ""){%>  <b><%= EVENT FIELD(position) %></b> - <% } %><% } %>
               
<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" STYLE="text-decoration:underline;" CLASS="text"><%= EVENT FIELD(title) %></A><BR>
<% } %></td></tr><%/FOREACH%></table><br>
<%/IF%>
<%/FOREACH%>
</DL>
<%unless($total_events){%>
<I><%= $_NO_EVENTS_LABEL %></I>
<% } %>
</SPAN>
</TD></TR></TABLE></CENTER>
<% } %>
<%-- END LIST STYLE DISPLAY --%>



[This message has been edited by TommyS (edited August 14, 2005).]

Logged
DanO
Moderator
Full Member
*****

Karma: 13
Offline Offline

Posts: 230

Please don't PM me. Post in the open forum.


WWW
« Reply #3 on: August 15, 2005, 12:05:00 AM »

Glad to hear you figured it out. Thanks for posting the code for others to see.

     BTW. This forum software adds a space between | | characters which should NOT be there.
If anyone attempts to try the above code, make sure to remove the added spaces.

Dan O.


[This message has been edited by DanO (edited August 15, 2005).]

Logged
Pages: [1]   Go Up
Print
Jump to: