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] 2 3 4   Go Down
Print
Author Topic: Adding Date to Event page  (Read 2973 times)
0 Members and 1 Guest are viewing this topic.
davidw
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« on: March 06, 2002, 11:02:00 AM »

Thanks to some of your great suggestions, I have added the Time to the Event screen (ver 3.0).  Now I need to add the Date too.  I have tried several variations of the date displays in other sections of code with no luck.  Does anyone have a quick snippet they could share?

Thanks to all you CalendarScript forum supporters!

------------------
David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com

Logged

David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com
davidw
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #1 on: April 30, 2002, 02:06:00 PM »

Well, I've been away for a while and was surprised I didn't have a response yet!  I would really like to know how to add the Date to the Event screen.

David

Logged

David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #2 on: May 01, 2002, 12:41:00 AM »

If all you're worried about is displaying the date of the currently displayed event, you can use $YEAR, $MONTH, $MONTH_NAME, and $DATE to display it, something like this:

Date : <%= $MONTH_NAME %> <%= $DATE %>, <%= $YEAR %>

That would put:

Date : May 1, 2002

On the screen, if you are looking at an event that occurs on May 1, 2002, that is.

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

davidw
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #3 on: May 01, 2002, 11:18:00 AM »

Thanks David.  So simple, yet totally escaped me.

David

------------------
David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com

Logged

David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com
davidw
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #4 on: May 01, 2002, 11:38:00 AM »

David... I just noticed all the dates are displaying with the 1st of the month!  i.e. April 1, 2002.

And I noticed when I use

code:

<%= $EVENT2->{schedule}->{date} %>

(this uses the time display MOD) recurring events show the first date of the event, not the current date.

Help!

[This message has been edited by davidw (edited May 01, 2002).]

Logged

David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #5 on: May 01, 2002, 12:20:00 PM »

Do you have a URL I can look at?

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

davidw
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #6 on: May 01, 2002, 01:21:00 PM »

Take a look at the Calendar at http://du.hillelcolorado.org

Thanks!

David

Logged

David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com
kayleigh
New Member
*

Karma: 0
Offline Offline

Posts: 0

Computer Analyst


WWW
« Reply #7 on: May 01, 2002, 02:10:00 PM »

I've run in to the same problem, almost as if the server is caching whatever the current date is rather than passing the date of the event to the CGI. Weird!

------------------
Stephanie Meemken
Webmaster, Minnesota Jaycees
http://www.mnjaycees.org/

Logged

Stephanie Meemken
Webmaster, Minnesota Jaycees

http://www.mnjaycees.org/
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #8 on: May 01, 2002, 02:55:00 PM »

The link to the event from the main grid view (and probably other details links as well) does not include information about the current date.  To fix this, find the line in the grid view section that looks like this:

<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>

and add the datestring to it, like this:

<A HREF="<%=$CGI_URL_QUERYSTRING%>view=Event&event_id=<%= EVENT FIELD(id) %>&datestring=<%= $DAY->{datestring} %>" CLASS="gridtext"><%= EVENT FIELD(title) %></A><BR>

There may be another one of those in other month or week views, but the all look fairly similar.  Add that, and the script will parse the datestring out into month, month name, day, and year.  Enjoy!

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

kayleigh
New Member
*

Karma: 0
Offline Offline

Posts: 0

Computer Analyst


WWW
« Reply #9 on: May 02, 2002, 02:17:00 PM »

Tried that, too. It's still displaying today's date rather than the event date. I've been trying to do a line of code similar to
code:
<%= &SimpleDateFormat::formatDate($EVENT->{'schedule'}->{'nextoccurrence'}->{'start'},$Config->get("date_format")) %>


but I'm having no luck with that, either. I'm not getting any code passed to the event. HELP!!!!

------------------
Stephanie Meemken
Webmaster, Minnesota Jaycees
http://www.mnjaycees.org/

Logged

Stephanie Meemken
Webmaster, Minnesota Jaycees

http://www.mnjaycees.org/
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #10 on: May 02, 2002, 03:11:00 PM »

Kayleigh: Ok.  I believe I know what your problem is.  The getEvent (notice no s, it's the one called for event view) doesn't return an event object like getEvents does.  It only returns the details.  So $EVENT->{schedule} doesn't exist in Event view.  This means that when formatDate subroutine is called, it calls gmtime with an undefined time, so gmtime returns today.  Now that you know what the problem is, here's how to fix it.  Look at you template.  Near the top you should see a block that looks like this:

code:

elsif ($VIEW eq "Event") {
 $EVENT->{'details'} = &getEvent($in{'event_id'});
 $db = $main: BEvents;
 $fields = &main: BGetFieldsInDisplayOrder($db);
 }

Change it to this:

code:

elsif ($VIEW eq "Event") {
 $EVENT->{'details'} = &getEvent($in{'event_id'});
 $db = $main: BSchedule;
 $schedules = &Event::getEventsInRange($db,timegm(0,0,0,$DATE,$MONTH-1,$YEAR-1900),timegm(0,0,0,$DATE+1,$MONTH-1,$YEAR-1900)-1);
 foreach (@$schedules) {
   if ($_->{event_id} == $EVENT->{details}->{id}) {
     $EVENT->{schedule} = $_;
     last;
     }
   }
 $db = $main: BEvents;
 $fields = &main: BGetFieldsInDisplayOrder($db);
 }

That will make $EVENT->{schedule} exist so you can use it for whatever in the event view.  Enjoy!

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

kayleigh
New Member
*

Karma: 0
Offline Offline

Posts: 0

Computer Analyst


WWW
« Reply #11 on: May 02, 2002, 03:12:00 PM »

I DID IT!!!! I set it up so that any event details link will show the date(s) for an event. The only thing that's missing is a test for recurring events (since they have different start & end dates in the schedule).

OK, Here's the hack (using the Time Display MOD):


  1. Add the following line at the top of default.html (in bold):
    code:
    <!--#include file="styles.pl"-->
    <%
    # Begin the code...
    # -----------------
    sub LZ { my($x)=shift;if(length($x)==1){return "0$x";}return $x; }
    require "SimpleDateFormat.pm";


  2. Place the lines below wherever you'd like to display the event date (inside the Event View code):
    code:

    <% if ($EVENT2->{'schedule'}->{'start'}) {
       print &SimpleDateFormat::formatDate($EVENT2->{'schedule'}->{'start'}, $Config->get(date_format)) } %>
    <% if ($EVENT2->{'schedule'}->{'end'} ne $EVENT2->{'schedule'}->{'start'}) {
       print " - ", &SimpleDateFormat::formatDate($EVENT2->{'schedule'}->{'end'}, $Config->get(date_format)) } %>


    The IF...THEN tests to see if the end date is different than the start date. If they are different, it will show the date span of the event (10/22/02 - 10/25/02). If you don't want that, then take out the second IF...THEN statement.

I hope these details are clear.

PS: I've hacked my calendar to use an event_details.html popup window, so I'm not passing to a different display for default.html.

------------------
Stephanie Meemken
Webmaster, Minnesota Jaycees http://www.mnjaycees.org/

[This message has been edited by kayleigh (edited May 02, 2002).]

[This message has been edited by kayleigh (edited May 02, 2002).]

Logged

Stephanie Meemken
Webmaster, Minnesota Jaycees

http://www.mnjaycees.org/
davidw
New Member
*

Karma: 0
Offline Offline

Posts: 0


WWW
« Reply #12 on: May 02, 2002, 05:43:00 PM »

Kayleigh,

Does your solution, which presents the recurring event's From-To dates, also able to display the date of this event occurance?  i.e. the event recurs daily from 5:00-6:00pm, May 1 - May 5.  From the grid or list view, I click on the event for May 3rd.  Does your solution show May 3, or the entire date range?  For a contiguous event, showing the range is ok.

But what if you are meeting the 3rd Tuesday or each month.  What does your solution show for the date?

I'm not much good at reading this code yet, but I'm learning!

David

Logged

David Wolpo
NextGen Software, Inc.
www.NextGenSoftware.com
davidw@nextgensoftware.com
TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #13 on: May 02, 2002, 05:53:00 PM »

Kayleigh, I assume by the time display mod, you mean the one presented in http://www.calendarscript.com/support/forum/Forum4/HTML/000009.html  .  Is this a correct assumption?  If so, the problem with that solution is that, for recurring events, it shows the date of the first event, not of the one you clicked on (I did notice this problem on your site - the Burger King fundraiser on the 17th displays 05/03/2002 as the date).  You could modify the time display mod to call getEventsInRange as in the example above if you wanted to.  Just be sure to use $Template: ATE, etc. from the main package.

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

TubaDave
New Member
*

Karma: 0
Offline Offline

Posts: 0

Student


WWW
« Reply #14 on: May 02, 2002, 05:56:00 PM »

Note to any one reading this code: a smiley is a : D (colon D) without the space.  While I'm on it, if you see two pipes ('|') anywhere on these bulletin boards, remove the space between them while copying and pasting.

------------------
David Whittaker
http://www.uabcm.com/
http://www.csworkbench.com/

Logged

Pages: [1] 2 3 4   Go Up
Print
Jump to: