Archive for January, 2009

A Calendar Element for CakePHP

Here’s a quick calendar element I whipped up for a CakePHP application I’m writing.  I needed to use the calendar in a number of different places, so creating a view element for it in Cake made the most sense.

<<< March 2009 >>>

Su Mo Tu We Th Fr Sa
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31

Download the source (zipped .ctp file) here: CakePHP Calendar Element

The code is pretty simple.  Pass the element a year and a month when rendering it and it will render that month in a simple table.  It also accepts two additional arguments, a day link and a month link.  The day link allows you to specify what the base URL for each day should be, and similarly, the month link specifies the base URL for traversing months.

Drop the calendar.ctp into your elements directory in your Cake app (usually /app/views/elements) and render it an any view you’d like.  Below is an example of rendering the element with all of its parameters:

<?php
$this->renderElement('calendar', array(
    'year' => 2009,
    'month' => '11',
    'month_link' => '/controller/showmonth/',
    'day_link' => '/controller/showday/'
));
?>

The month link and day link provide the base URLs for linking to additional months and days, allowing you to modify the element for particular controller actions.

Feel free to use this component for anything you’d like, no strings attached.  If you make any improvements or enhancements to it, be sure to share!

Thursday Night Tech Talks

Last quarter (20081), my friend Tom and I started up a program within SSE called Thursday Night Tech Talks. The series gives undergraduate students in computer-related disciplines the chance to share with others some of the new and interesting things they’ve encountered while on co-op and in other activities outside of their department’s traditional curriculum.  Tom and I gave the first presentations, respectively, and we’ve since then experienced a lot of interest from students looking to give presentations of their own.

Now that SSE has [finally] migrated to a new server, I am now able to make available the videos and slides from each of the past talks.  If you haven’t been around to attend any of the presentations, here are some of the topics that have been discussed so far:

- Microformats: Empowering Your Markup
- Adobe Flex
- Cocoa Fundamentals
- Cross-Platform OpenGL
- BlazeDS: Integrating Flex and Java
- Open Source Collaboration with Git and GitHub
- Amazing AJAX
- Don’t Forget to ____! – A Discussion on Configuration Management
- Plan 9 OS

There are at least two more confirmed talks scheduled for this quarter.  This Thursday (9/22) I’ll be giving a presentation on CakePHP, an MVC framework that borrows many ideas from Rails.  After that, Tom will be giving a talk on XForms.

Additionally, the Tech Talk series will be moving back to a bi-weekly schedule at the end of the winter quarter.  We’ve been seeing much bigger turnouts at recent presentations, and we believe this adjustment will help with the budgeting and planning that go into each talk.

I’d like to give my sincere thanks to Northrop Grumman for their very generous donation of $500 towards the program, as well as to everyone who has given a presentation and to everyone who has attended the weekly talks.  The program has grown very rapidly and couldn’t have done so without the support of everyone who has taken such a vested interest in it.