Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#577 2010-11-08 12:18:51

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: smd_calendar: complete schedule / event / calendar / diary

Hello Txp users,

The continuation of this story

Objectives:
Have a mini-calendar and display in the same page a list of selected events of the day , sorted by hour. Some events are standard, other multiples.

I could not use <txp:smd_article_event /> because of an error display with “Multi-day events”.

I use a large calendar and I edit the cellform :

<txp:smd_calendar expired="1"  cellform="cellform" eventwraptag="div" maintain="section, calid" firstday="1" dayformat="D,L,M,Me,J,V,S">
		<p><txp:posted format="%H:%M" /> | <txp:custom_field name="Lieu" /> | <txp:permlink><txp:title /></txp:permlink></p>		
</txp:smd_calendar>

cellform :

bc. <txp:smd_if_cal flag="event">
    <a href="?d={day}&amp;m={month}&amp;y={year}">{day}</a>
<txp:else />
    {day}
</txp:smd_if_cal>
<txp:variable name="today" value="{day}.{month}.{year}"/>
<txp:if_variable name="today" value='<txp:smd_cal_now now="?day ?month ?year" format="%e.%m.%Y" />'>
    <txp:variable name="events_today">
        {events}    
    </txp:variable>
</txp:if_variable>

If an event is scheduled that day, {day} is a link, otherwise not.
var today = date of cell.
If the date of the cell corresponds to the date of the url, then displays the corresponding events.
And instead of <txp:smd_article_event /> I used <txp:variable name="events_today" />.
It works. But I still have some problems:

Problem 1:
{day} = 1-2-3-4 .... 28-29-30 (%e) and no 01-02-03 .... 28-29-30 (%d).

When I made the comparison <txp:if_variable name="today" value='<txp:smd_cal_now now="?day ?month ?year" format="%e.%m.%Y" />'>

If today = "28.10.2010" : smd_cal_now = "28.10.2010" no prob
but
if today = "1.11.2010" : smd_cal_now = " 1.11.2010" big prob, %e add a space.

Problem 2:
I want to sort the events by hours, but smd_calendar does not offer any “sort attribute”. is there a possibility to sort standards events and multi-day events?

Problem 3:
If today is *28*-10-2010, the calendar will display this default date, but if you click on the following month (smd_cal_navnext), we come not on the first day (01-11-2010), but the *28*-11-2010.

To be continued…

Offline

#578 2010-11-08 12:46:25

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,399
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

sacripant wrote:

I could not use <txp:smd_article_event /> because of an error display with “Multi-day events”.

If you’re referring to the problem in your above post when you click on, say, ‘07’ and it shows the events as if they lasted a day longer, I think this might be a timezone issue. Can I ask:

  1. What is your server’s timezone and offset (from TXP’s Diagnostics page)
  2. What is your computer’s timezone (though this probaly doesn’t matter, I just want to check something)
  3. What are the start and expiry times of your event1, event2, event3, etc? Do they go from 00:00:00 to 23:59:59? If so — and assuming you are in France — does it help if you shorten it either end by an hour (i.e. by the timezone difference?), e.g. make the event run from 01:01:00 to 22:59:00

If you are trying to use a calendar to display the event list then you are right, you will find that the events are not sortable. This is because a calendar is auto-sorted by day. smd_article_event is the right tool for the job: we just need to get it to perform properly!

{day} = 1-2-3-4 .... 28-29-30 (%e) and no 01-02-03 .... 28-29-30 (%d).

OK, that’s understandable. I suppose I should add the %d option for completeness, thanks for pointing it out. If you’re comfortable editing the plugin code, find the only occurrence of {day}. Beneath that line, add this line of code:

'{fullday}' => strftime("%d", $thistime),

And then use {fullday} instead. I’ll add that to the next version.

I’m not sure about your problem #3. Perhaps it’s to do with the way you’re abusing a calendar as a list of events? If we can get smd_article_event to behave, that would be better. I have a beta version available that I’m currently fixing a few bugs in. If you have no joy using the method I outlined above, I can let you have the beta to play with. It might fix a few things (or, as JanDW found out, it might break some more things *sigh*, although I’ve fixed some of those already with his help).


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#579 2010-11-09 10:08:49

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: smd_calendar: complete schedule / event / calendar / diary

Hello steph,

My computer and the server are GTM +0.

I will repeat my tests with <txp:smd_article_event />.
News soon.

Offline

#580 2010-11-09 10:19:40

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,399
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

sacripant wrote:

My computer and the server are GTM +0.

Thanks. Hmmm, then it should behave ok.

The beta plugin version might help though. The current official release erroneously creates time offsets based on the time now not the time of the actual event, hence if the event was at some future or past time when DST is/is not in effect compared to the time right now, your times will always be an hour out. This can nudge events a day later or earlier depending on what the start/end times are.

Last edited by Bloke (2010-11-09 10:19:59)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#581 2010-11-19 18:41:29

sacripant
Plugin Author
From: Rhône — France
Registered: 2008-06-01
Posts: 479
Website

Re: smd_calendar: complete schedule / event / calendar / diary

Hello TxP users, Hi Block,

I begin my experiments with smd_article_event and Multi-day events. I return to zero. The B.A-ba
The aim is to display the day’s events.

Info:

Time Zone: (0)
I have 3 events in my event section:

  • Event 1
    • posted : 2010 11 19 09:00:00
    • expires : 2010 11 25 18:00:00
  • Event 2
    • posted : 2010 11 23 11:00:00
    • expires : 2010 12 02 15:00:00
  • Event 3
    • posted : 2010 11 30 01:00:00
    • expires : 2010 12 08 23:00:00
         19 20 21 22 23 24 25 26 27 28 29 30 01 02 03 04 05 06 07 08
Event 1   X  X  X  X  X  X  X
Event 2               X  X  X  X  X  X  X  X  X  X
Event 3                                    X  X  X  X  X  X  X  X  X
<txp:smd_article_event wraptag="ul" break="li" allspanned="1" section="event">
	<strong><txp:title /></strong> <small>from <txp:posted /> to <txp:expires /></small>
</txp:smd_article_event>

Tests :

from="19-11-2010"

  • Event 1 from 19 11 2010 – 09:00 to 25 11 2010 – 18:00
  • Event 1 from 20 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 1 from 21 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 1 from 22 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 1 from 23 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 2 from 23 11 2010 – 11:00 to 2 12 2010 – 15:00
  • Event 1 from 24 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 2 from 24 11 2010 – 00:00 to 2 12 2010 – 15:00
  • Event 1 from 25 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 2 from 25 11 2010 – 00:00 to 2 12 2010 – 15:00

It shows in 7 days? and date “posted” changes for each day

from="19-11-2010" to="19-11-2010"

Nada

from="19-11-2010 00:01:00" to="19-11-2010 23:59:00"

  • Event 1 from 19 11 2010 – 09:00 to 25 11 2010 – 18:00

OK

from="20-11-2010 00:01:00" to="20-11-2010 23:59:00"

Nada

from="20-11-2010 00:01:00" to="21-11-2010 00:01:00"

  • Event 1 from 21 11 2010 – 00:00 to 25 11 2010 – 18:00

OK, but why the date of the article is posted at 21-11-2010 – 00:00 and not at 20-11-2010 ?

from="23-11-2010 00:01:00" to="23-11-2010 23:59:00"

  • Event 2 from 23 11 2010 – 11:00 to 2 12 2010 – 15:00

Where is Event 1 ?

from="23-11-2010 15:00:01" to="23-11-2010 23:59:59"

Nada

from="23-11-2010 00:00:01" to="24-11-2010 00:00:01"
  • Event 2 from 23 11 2010 – 11:00 to 2 12 2010 – 15:00
  • Event 1 from 24 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 2 from 24 11 2010 – 00:00 to 2 12 2010 – 15:00

from="23-11-2010 00:00:00" to="24-11-2010 00:00:00"
  • Event 1 from 23 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 2 from 23 11 2010 – 11:00 to 2 12 2010 – 15:00
  • Event 1 from 24 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 2 from 24 11 2010 – 00:00 to 2 12 2010 – 15:00
from="23-11-2010 00:00:00" to="23-11-2010 23:59:59"
  • Event 1 from 23 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 2 from 23 11 2010 – 11:00 to 2 12 2010 – 15:00

YES !

from="23-11-2010 00:00:00" to="23-11-2010 10:59:59"
  • Event 1 from 23 11 2010 – 00:00 to 25 11 2010 – 18:00

YES ! event 2 start at 11:00:00

from="24-11-2010 00:00:00" to="24-11-2010 00:00:01"
  • Event 1 from 24 11 2010 – 00:00 to 25 11 2010 – 18:00
  • Event 2 from 24 11 2010 – 00:00 to 2 12 2010 – 15:00

from="24-11-2010 00:00:01" to="24-11-2010 00:00:02"

NADA

from="30-11-2010 01:00:00" to="30-11-2010 01:00:01"

  • Event 3 from 30 11 2010 – 01:00 to 8 12 2010 – 23:00

from="30-11-2010 01:00:01" to="30-11-2010 01:00:02"

Nada

from="30-11-2010 00:59:00" to="30-11-2010 01:00:00"
  • Event 3 from 30 11 2010 – 01:00 to 8 12 2010 – 23:00

from="08-12-2010 22:59:59" to="30-11-2010 23:00:00"
and
from="08-12-2010 23:00:00" to="30-11-2010 23:00:01"

Nada

Morality

A Multi days event is detected only at the posted time (exactly) the first day (not after).
And at 00:00:00 the following days, even the last day.

Offline

#582 2010-12-20 12:40:59

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 548

Re: smd_calendar: complete schedule / event / calendar / diary

—Edit—

It would help if I had read some of the latest posts instead of skim reading at the beginning of the topic. There’s quite a lot of information for me to digest and experiment with.

Thanks for producing such an amazing plugin Stef

————

Is it possible using this plugin to output a mini calendar with dates that when clicked on displays a list of events happening on that day? Ideally I’d like to achieve something similar to the image below:

Last edited by Algaris (2010-12-22 11:29:34)

Offline

#583 2011-01-11 00:52:27

maxk
Member
Registered: 2010-02-17
Posts: 11

Re: smd_calendar: complete schedule / event / calendar / diary

I have had one problem with the smd_calendar plugin relating to how it outputs the calendar column heads, specifically the days of the week. During the day the column heads are fine, but in the evening they get shifted to the right by one day. I am not sure exactly when they get shifted, between 5 and 7 pm. So, in the daytime, the column heads are Sun, Mon, Tues, Wed, Thurs, Fri, Sat. But in the evening the column heads are Sat, sun, mon, tues, wed, thurs, fri. I have tried adjusting the time zone settings and the gmt setting, to no avail. It seems like this problem is one that falls under the Date Gotchas section in the documentation, but is there a way around this? Can I hard code the column heads?

My site is here: http://www.swimdcrp.org/calendar/
Running textpattern 4.2
PHP version: 5.2.15
time zone set to New York
server time zone is mountain standard time

Offline

#584 2011-01-11 09:22:39

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,399
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

Algaris

Sorry for the delay replying. Yes the calendar can do that. If you want a hand with any parts of it there are some very talented calendarists on this thread alone who have done similar things (mrdale and renobird, among others).

maxk

You’ve hit an unfortunate snag in the timezone implementation of the current (stable) release. Essentially it’s my retarded coding, and for that I’m sorry.

I have a version out there with a couple of folk that seems to have fixed all the current known timezone issues. I’ve not heard back from them on whether it actually works or not, but the fact they’ve gone quiet probably means it’s working :-) I’ll chase and see. If it’s fixed then I’ll release that version as-is and reserve The Big Rewrite for some future version instead.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#585 2011-01-11 12:41:42

towndock
Member
From: Oriental, NC USA
Registered: 2007-04-06
Posts: 329
Website

Re: smd_calendar: complete schedule / event / calendar / diary

Hey Bloke – sorry about being quiet. The “unstable” 0.5 version indeed works. It fixes the time zone issue I was having – and all else seems fine. I have it in operation on two sites with happy customers.

From my experience I’d say release it.

…and Happy New Year!

Keith

Offline

#586 2011-01-11 15:12:49

Algaris
Member
From: England
Registered: 2006-01-27
Posts: 548

Re: smd_calendar: complete schedule / event / calendar / diary

Thanks Stef that’s good to know. I do have a lot of questions I have to admit so if anyone could offer some advice or pointers in the right direction it would be a big help.

One of the first things I’m trying to do is to output a list of articles restricted by the current day on the homepage. I’d like to output them as you would using Article Custom. I’ve been experimenting with <txp:smd_article_event /> I’ve had a look at the month attribute but noticed there is no option to specify a day.

Is it possible to do something along these lines:

<txp:smd_article_event form="events"
from="<txp:php>date('Y');</txp:php>-<txp:php>date('m');</txp:php>-<txp:php>date('d');</txp:php>"
to="<txp:php>date('Y');</txp:php>-<txp:php>date('m');</txp:php>-<txp:php>date('d');</txp:php>" />

Last edited by Algaris (2011-01-11 15:15:50)

Offline

#587 2011-01-11 15:33:15

maxk
Member
Registered: 2010-02-17
Posts: 11

Re: smd_calendar: complete schedule / event / calendar / diary

I would be quite happy to get a version that has this fixed. It has been one of those little problems that I haven’t been able to fix for quite a while. Thanks much.

Offline

#588 2011-01-11 15:38:34

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,399
Website GitHub

Re: smd_calendar: complete schedule / event / calendar / diary

towndock

Thanks for the clarification. Good to know it’s firing on all cylinders!

Algaris

I’ve had a look at the month attribute but noticed there is no option to specify a day.

I believe you can actually specify the day and it should take it into account (untested). Your code probably won’t quite work because you may need to give it the hours between which you want, since it’s all one day

But you can probably simplify your code a little using <txp:smd_cal_now />:

<txp:smd_article_event form="events" from='<txp:smd_cal_now format="?year-?month-?day 00:00:00" />'
to='<txp:smd_cal_now format="?year-?month-?day 23:59:59" />' />

I’ve not tried it, but that should substitute the current date in to the Y-m-d portion and tack on the hours, which should give you a day spread. fwiw, in the next version there is the option to accept time="today" as a convenient shorthand for the above.

maxk

I’ll drop a copy in the post… any feedback greatly appreciated.


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

Board footer

Powered by FluxBB