Tag Archives: vlad tracker

Launching rdocalendar.com

Due to recent legal matters I had to take down nypdcalendar.com. I promised to launch rdocalendar.com (Same thing, different name) but wanted to wait a bit so that I would release a better version.

Upon seeing my friend recently he reminded me that calendar services are still needed regardless of it being a new version or not. So without further ado I announce rdocalendar.com! Currently it’s the exact same thing, but to borrow a con ed slogan: “we’re on it!” Hopefully the slogan isn’t trademarked. I had enough with that as it is.

nypdcalendar.com

These past few days I’ve been working on version 2 of Vlad Tracker. Although it may be a bit premature but I’m proud to announce the launch of nypdcalendar.com. It’s basically Vlad Tracker but adjustable so can be used by other members of the force. The default is set at his schedule but can be easily changed via the link on the bottom.

My next order of things will be branding & styling. After that I think I’ll write mobile browser friendly CSS and perhaps make the whole thing a facebook app.

PHP Calendar Month Function

I decided to start working on a follow-up project to my previous Vlad Tracker. The first version of it is pretty simple. It just lists all of his days off vertically. Next step of course is to display everything in a calendar view. The first version also focused on simplicity, including all of the scripts & styles inline so that it could be just saved on the hard drive without any messy additional files. This time it is in PHP because of the convenient date manipulation functions.

I needed a function that would generate a calendar month. After a bit of searching on google, I didn’t find any code that did what I wanted. Everything already generated html with calendar-type widgets. So I wrote my own.

PHP function getCalendarArray takes 2 arguments; a date and a number representing day of the week. The date can be either a string representing a date (as accepted by DateTime object) or a DateTime object itself. The second parameter is an integer 0-6 representing the first day of the week. 0 for Sunday, 1 for Monday … 6 for Saturday. The function returns an array where each element is an array representing a date. It’s meant to fit in a square so the first and last few days will be of the previous and next month respectively. The outer array is numerically indexed, the outer array contains the following string indexes: day, month, year, specified. Specified is a boolean representing the specific date that is passed in the first argument.

Function prototype:

function getCalendarArray([$date [, $dao_adj]])

Sample abridged return value:

array
  0 => 
    array
      'day' => int 28
      'month' => int 8
      'year' => int 2011
      'specified' => boolean false
  1 => 
    array
      'day' => int 29
      'month' => int 8
      'year' => int 2011
      'specified' => boolean false
  2 => 
    array
      'day' => int 30
      'month' => int 8
      'year' => int 2011
      'specified' => boolean false
  3 => 
    array
      'day' => int 31
      'month' => int 8
      'year' => int 2011
      'specified' => boolean false
  4 => 
    array
      'day' => int 1
      'month' => int 9
      'year' => int 2011
      'specified' => boolean false
  5 => 
    array
      'day' => int 2
      'month' => int 9
      'year' => int 2011
      'specified' => boolean false
  6 => 
    array
      'day' => int 3
      'month' => int 9
      'year' => int 2011
      'specified' => boolean false

Basically this functions provides data on how to render the calendar but doesn’t have any of the rendering code. Making it perfect for integration into custom calendar projects. Feel free to use it however you want!

View the full source, with comments and license.