Page 1 of 1

Any additional Google Calendar template samples?

Posted: Tue Jan 13, 2009 10:56 pm
by teleute
I'm going to start working on some additional templates for Google Calendar.  Does anyone have any more samples other than the one that comes with the module?

Thanks!

Re: Any additional Google Calendar template samples?

Posted: Wed Jan 14, 2009 12:09 am
by teleute
Here's what I've got so far - just a couple of very basic changes (which still took me like an hour to figure out, since I've never touched Smarty before...):

Code: Select all

{php}
$all_tpl_vars = $this->get_template_vars('actionparams');
$range = ($all_tpl_vars['days']);

$future = mktime(0,0,0,date("m"),date("d")+$range,date("Y"));
$future = date("Y/m/d", $future);
$this->assign('future', $future);
{/php}
<h3>Events from {$smarty.now|date_format:"%Y-%m-%d"} to {$future|date_format:"%Y-%m-%d"} </h3>

<div id="thisweek">
<dl>
{foreach from=$events item=event}
{if $event.first_of_day}
	<dt>{$event.start|date_format:"%A %e %B"}</dt>
{/if}
{if $event.all_day}
	<dd class="allday">{$event.title}</dd>
{else}
	<dd>{$event.start|date_format:"%l.%M%P"} - {$event.end|date_format:"%l.%M%P"}<br>{$event.title}</dd>
{/if}
{/foreach}
</dl>
</div>
Main difference is the line at the top that shows the date range (figured from the current date and the number of days you specify as a parameter).  Also just added the end time in the event listing itself.

I'd like to do quite a bit more, but we'll see how it goes.  Ideally I'd like to have it closer to the actual Google Calendar in functionality - being able to display more like a calendar, choose date ranges, etc... but that may not be a great idea given how much time it'll take.  Might just embed a google calendar, or switch to the regular calendar module so CMSms users can add/modify events.  We'll see.  :-)  But I figured I'd share this code, anyway, in case people find it helpful.

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 8:46 pm
by tmar89
I tried this template and the top PHP part doesn't show the future date correctly.  It is always the current date to current date.  And I made sure that the days parameter is set and verified it worked by noticing events spanning multiple days in the listing.

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 8:48 pm
by teleute
*shrug*  I don't know - it worked for me no problem.  If you echo $future in the php code, what does it give you?

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 8:53 pm
by tmar89
echo $future  -> 2009/01/30
echo $range -> nothing

my page content is:
{cms_module module="GoogleCalendar" days=30}

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 8:56 pm
by teleute
Hmmm....well, if it's not getting the range, that would explain it.  Can you echo $all_tpl_vars?

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 8:59 pm
by tmar89
Also, {$event.title} returns 'Object id #xxx' where xxx is some number

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 9:01 pm
by tmar89
teleute wrote: Hmmm....well, if it's not getting the range, that would explain it.  Can you echo $all_tpl_vars?
That is empty as well

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 9:04 pm
by teleute
What version of Google Calendar are you using?

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 9:11 pm
by tmar89
teleute wrote: What version of Google Calendar are you using?
http://calendar.google.com&nbsp; I don't see any version.

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 9:17 pm
by teleute
I mean of the module.  Should be in your admin under Extensions > Modules.

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 9:22 pm
by tmar89
teleute wrote: I mean of the module.  Should be in your admin under Extensions > Modules.
0.1.1

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 9:27 pm
by teleute
I'm sorry - I don't know why those variables would be blank, then.  I really don't have any more time to try to check this out today, since it worked for me and I don't have the module installed anymore.  If I get more time later I'll try to look at it again.

Re: Any additional Google Calendar template samples?

Posted: Fri Jan 30, 2009 9:28 pm
by tmar89
Ok thanks. 

Re: Any additional Google Calendar template samples?

Posted: Tue Feb 10, 2009 4:43 pm
by brocki
I'll bump this because I'm looking for the same. No php experience so I'm kind of relying on the expertise of others here. I'd like to have the ability to do a smaller version of something that really looks like a calendar as well as having the listed events (like the tiny calendar on wordpress sites) as well as have some alternate text when there are not upcoming events, rather than having a big blank space in the sidebar.

And thank you, teleute, I was able to add some of your modifications and better figure out how everything works at the same time. Would you happen to have any idea why my times might be offset by an hour though? The timezone is correct in my config.php (correcting that fixed the time displayed by current_time tag so I know that was part of the problem) but my events still show up an hour too early. Everything looks good in my actual google calendar, though.

Edit====

In my search, I came across this: http://code.google.com/apis/gdata/articles/calvis.html but I don't know exactly what I'm looking at. :) What I think I'm seeing is a framework for displaying the Google Calendar visually without that ugly surrounding chrome you have with a full embed. Can this visual framework work with the GoogleCalendar module, and if so, how exactly would I go about it? I see with this CalVis code the CSS ids are defined... are those universal (therefore you can apply the CSS there and modify the calendar that way) or is this all just something else altogether?