So next step is to get integration between My Book It and phone support. This has to be super smooth and work flawlessly but will form a key part of the site once complete.

As I work through the integration I will post the steps and any issues that I ran into along the way.

The first step is always the planning so this is what I have come up with.

Global Ideas

  • Each student needs to have a unique identifier that allows them to access the calendar without authentication. (i.e. not be guessable)
  • Needs to be disabled when a student is made inactive.
  • It has to be reliable.
  • It needs to work with standards.
  • It needs to be super simple (super simple) to work for the user. (i.e. one click and everything is done)
  • If possible I am trying to avoid having to build an App. This whole experience should just integrate with any user device (iPhone, Android, Windows Phone, add future support here)

Options

  1. Have a script that runs regularly which generates ICS files in a sub directory. – This would be fairly easy to achieve, but very messy as you could be generating a large number of files that never get used. This would make backups difficult and the question comes down to how often is enough to update these files.
  2. Have a script that creates a ICS file and then keeps a record of the files which are accessed and update them regularly. – Similar issues to above.
  3. Have a sub directory that redirects all requests to a single script which provides a dynamic ICS file. – I think this is the best way to go.

Now that I know what I want, it is time to get started. First up is to create the directory structure that will allow all the files to be redirected back to a central file.

To do this I create a sub directory called “Calendar” in the web directory

Within that folder I place a blank index.php file so that the site returns a blank page if anything is missed.

I create a .htaccess file with the following contents (This will redirect everything except calendar.php to calendar.php)

# Turn rewriting on
Options +FollowSymLinks
RewriteEngine On
# Redirect requests to index.php
RewriteCond %{REQUEST_URI} !=/calendar.php
RewriteRule .* calendar.php

And last of all I create the calendar.php file with the following contents to test the setup.

<?php
        echo $_SERVER["REQUEST_URI"];
?>

Once that is done, I need to test it to ensure it is working correctly.

If I browse to anything in that folder the page should return the URI back to me in the browser as below.

thisisatest

That will do for the start. Next step is to start to populate the calendar.php file with the script needed to create the ICS file.