Any additional Google Calendar template samples?

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
teleute
Forum Members
Forum Members
Posts: 26
Joined: Tue Jan 13, 2009 7:03 am

Any additional Google Calendar template samples?

Post 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!
teleute
Forum Members
Forum Members
Posts: 26
Joined: Tue Jan 13, 2009 7:03 am

Re: Any additional Google Calendar template samples?

Post 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.
tmar89
Forum Members
Forum Members
Posts: 32
Joined: Fri Jan 30, 2009 8:44 pm

Re: Any additional Google Calendar template samples?

Post 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.
teleute
Forum Members
Forum Members
Posts: 26
Joined: Tue Jan 13, 2009 7:03 am

Re: Any additional Google Calendar template samples?

Post 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?
tmar89
Forum Members
Forum Members
Posts: 32
Joined: Fri Jan 30, 2009 8:44 pm

Re: Any additional Google Calendar template samples?

Post by tmar89 »

echo $future  -> 2009/01/30
echo $range -> nothing

my page content is:
{cms_module module="GoogleCalendar" days=30}
teleute
Forum Members
Forum Members
Posts: 26
Joined: Tue Jan 13, 2009 7:03 am

Re: Any additional Google Calendar template samples?

Post by teleute »

Hmmm....well, if it's not getting the range, that would explain it.  Can you echo $all_tpl_vars?
tmar89
Forum Members
Forum Members
Posts: 32
Joined: Fri Jan 30, 2009 8:44 pm

Re: Any additional Google Calendar template samples?

Post by tmar89 »

Also, {$event.title} returns 'Object id #xxx' where xxx is some number
tmar89
Forum Members
Forum Members
Posts: 32
Joined: Fri Jan 30, 2009 8:44 pm

Re: Any additional Google Calendar template samples?

Post 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
teleute
Forum Members
Forum Members
Posts: 26
Joined: Tue Jan 13, 2009 7:03 am

Re: Any additional Google Calendar template samples?

Post by teleute »

What version of Google Calendar are you using?
tmar89
Forum Members
Forum Members
Posts: 32
Joined: Fri Jan 30, 2009 8:44 pm

Re: Any additional Google Calendar template samples?

Post by tmar89 »

teleute wrote: What version of Google Calendar are you using?
http://calendar.google.com&nbsp; I don't see any version.
teleute
Forum Members
Forum Members
Posts: 26
Joined: Tue Jan 13, 2009 7:03 am

Re: Any additional Google Calendar template samples?

Post by teleute »

I mean of the module.  Should be in your admin under Extensions > Modules.
tmar89
Forum Members
Forum Members
Posts: 32
Joined: Fri Jan 30, 2009 8:44 pm

Re: Any additional Google Calendar template samples?

Post by tmar89 »

teleute wrote: I mean of the module.  Should be in your admin under Extensions > Modules.
0.1.1
teleute
Forum Members
Forum Members
Posts: 26
Joined: Tue Jan 13, 2009 7:03 am

Re: Any additional Google Calendar template samples?

Post 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.
tmar89
Forum Members
Forum Members
Posts: 32
Joined: Fri Jan 30, 2009 8:44 pm

Re: Any additional Google Calendar template samples?

Post by tmar89 »

Ok thanks. 
brocki
New Member
New Member
Posts: 3
Joined: Wed Jan 28, 2009 7:37 pm

Re: Any additional Google Calendar template samples?

Post 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?
Last edited by brocki on Wed Mar 11, 2009 5:59 am, edited 1 time in total.
Post Reply

Return to “Modules/Add-Ons”