Auto Menu (PHP)

March 19, 2014

More often than not, I get asked to upload and link some files from our teachers to one page or another.  This is part of my job and I’m happy to do it.  But sometimes, I get asked to upload 20 – 30 files in one email.  This gets tedious.  And generally, I’ve no sooner finished than I get another email requesting a couple more in another location.  Complaining about this seems a little childish, but the truth is, it’s boring work that takes time.

How geeks deal with repetitive tasks

How geeks deal with repetitive tasks

I’m a great believer in “Work Smart, not Hard”.

Work smart, not hard

Work smart, not hard – nailed it!

Being a WSNH believer (some would say an evangelist), I wrote this bit of code, which automatically populates a page full of links to the resources inside a folder.  It even takes into account sub-folders.

Script

Hopefully, you can implement this yourselves, but if not, drop me a line.

You can download the script here.  I could have pasted it here, but the formatting was lost and it looked really ugly.


Need a small server capable of hosting databases?

June 16, 2013

In my last post, I talked about using PHP and if you didn’t have access to a server that allowed PHP to run, what could you do?  For the more technically minded out there, you may be surprised that this is even an issue.  The sad truth is that lots of free websites don’t offer PHP and quite a few schools have the servers locked down through official policy and end of argument.

Managed support does not simply allow access to our servers

Use all the memes!

There is hope

A year or two ago, our IT support (not a managed service) started buying QNAP Tera-stations.   Ultra-cool name aside, these network storage devices are great for back-ups.  We use them to hold our photo archives and video project construction files.  Some of you would be amazed* at how frequently I get asked to make a change to a five year-old video.   Keeping the source files makes that a lot easier.

Technology changes all the time, so rather than recommend a specific model, I’ll talk about the features available on even the basic, home model.  In the software section, this is just some of the features they offer:

QNAP TS-21

One of QNAP’s home range

  • iTunes server
  • Music server
  • Photo Station
  • Video Station
  • TV Station
  • FTP
  • Auto-back up
  • Print server
  • Anti-virus

And most importantly, for this post, it can also act as web server with PHP support and MySQL database support along with phpMyAdmin (which is an easy database management system)

While not wanting to endorse a particular product or even model, a quick Amazon search shows that these products are not bank-breaking (we’re talking a couple of hundred pounds here).

Uses

I think these products have been loaded with features to appeal to the geek-at-home.  I’ve quite tempted to get one for myself to house all my media.

When discussing them recently with an ICT teacher from another school, he pointed out it would be a huge benefit in his classroom.  He’d be able to allow his students to program webpages to interact with databases without risking the security of the school’s servers.

At Cramlington, we’re seriously discussing# the possibility of loading up one of these with our interactive webpages and offering it to other schools.  Another school could take the QNAP, plug it into their network, change a couple of settings and be running things like:

  • Drag-and-drop seating plans
  • Custom timetables
  • Class blogs
  • Rewards system
  • Random name selector
  • etc…

 

A nice, simple solution with a huge range of possibilities.   Damn, I should totally get sponsorship before hawking products for free.

 

 

* I suspect those of you in a support role would not be that surprised. :)

# Don’t get too excited just yet.  We’re discussing it properly and going about trials sensibly. Watch this space.


Making a link that will save an appointment in MS Outlook’s calendar

May 15, 2013

OK, so the link is an iCalendar file, but until I started looking for, I had no idea what it was called.

The Problem

In a nut shell, for a while now I’ve known about the existence of Google’s Save Event.  Which is great if you have a Google account and you’re signed in and you don’t have separate work and personal accounts.

At school, we use Outlook for EVERYTHING.   Quite possibly a bit too much.   I do hear: “I haven’t had a chance to read your email” as an excuse quite a bit.

What I wanted was the ability to generate a link, which when clicked on would add an appointment to my calendar as opposed to manually going to calendar, creating a new event, setting the time and date correctly, inviting others to the meeting, adding a room…  I’m boring myself.

The Solution

I eventually found a solution on Stackoverflow’s fourm

<?php

$ical = “BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:” . md5(uniqid(mt_rand(), true)) . “@yourhost.test
DTSTAMP:” . gmdate(‘Ymd’).’T’. gmdate(‘His’) . “Z
DTSTART:20130715T100000Z
DTEND:20130715T110000Z
SUMMARY:Bastille Day Party
END:VEVENT
END:VCALENDAR”;

//set correct content-type-header
header(‘Content-type: text/calendar; charset=utf-8′);
header(‘Content-Disposition: inline; filename=calendar.ics’);
echo $ical;
exit;

?>

Which solves the problem quite nicely.  You need to put this in a PHP page, so you need a server which lets run PHP*.  This page also auto-closes once completed, so you need to link to this page from another.  When you run it the page closes itself.

The example above creates a .ics file which when run, opens up an appointment in MS Outlook for 15th July 2013 from 10 am until 11am and names the event Bastille Day party.  Wow, that will be some party!

I’ve tinkered a bit with the original, to make it easier to adapt.  My Comments are in green, things you can set are in red:

<?php

// If you point to this page from another page, you can add variables to the link: eg:

// calendar.php?startdate=201307015&apptTime=100000&location=My Office

// Start date format needs to be YYYYMMDD

$startdate=$_GET['startdate'];

// Appointment time format needs to be HHMMSS

$apptTime=$_GET['apptTime'];

// Location can be pretty much anything

$location=$_GET['location'];

$ical = “BEGIN:VCALENDAR
VERSION:2.0
PRODID:-//hacksw/handcal//NONSGML v1.0//EN
BEGIN:VEVENT
UID:” . md5(uniqid(mt_rand(), true)) . “@yourhost.test
DTSTAMP:” . gmdate(‘Ymd’).’T’. gmdate(‘His’) . “Z
DTSTART:”.$startdate.”T”.$apptTime.”Z
DTEND:”.$startdate.”T”.$endTime.”Z
LOCATION:$location
SUMMARY;LANGUAGE=en-gb:$details
END:VEVENT
END:VCALENDAR”;
//set correct content-type-header
header(‘Content-type: text/calendar; charset=utf-8′);
header(‘Content-Disposition: inline; filename=IrisAppt.ics’);
echo $ical;
exit;

?>

You can also add ATTENDEES so that it can auto-generate a meeting.  This is a little trickier to work out.  In the end, I created an iCal file from Outlook and opened it in NotePad++.  Each attendee needs their own line and goes just below the LOCATION line:

ATTENDEE;CN=SomeBody;RSVP=TRUE:mailto:SomeBody@youremail.co.uk

And that’s it.   All you have to do is link to a page containing this code and it should do the rest.

Bonus for Iris Connect users/admins

One of my main reasons for wanting to make an automated appointment system is because I, along with two colleagues administrate Iris Connect in the school.  We need to know when the observations are happening and where.  The easiest way for us to do this if I get everyone to invite me to observe them.  I then put the observation in my diary, invite the other two in case I’m not in the office.  When I get the reminder I set the camera up and set the recording going.  It works really well.  But I get fed up making the appointments.

The beauty of the Iris Connect system is that it sends out an automated email.  It’s always the same format.  So I built a form which means I can copy and paste the text of the email, click submit and up pops an appointment.   I had a slow morning. :)

If you would like to make use of this little bonus, you can find the files here

I’ve spoken to the guys at Iris Connect about this already and apparently this level of functionality is in their roadmap.  But why wait.


* I’m going to do another post very soon# which provides a solution for those of you who don’t have access to a server.

# I promise


FIXED: Playing MP3 files in Windows Media Player from IE (instead of Quicktime)

February 18, 2013

Preamble

OK, before I start. I don’t want to hear about Chrome, Firefox, Winamp, iTunes or frankly anything else. It’s taken me an absolute age to find a solution to this on the internet and almost every forum I went on where someone was having this issue, there was someone else suggesting they just change browser or media player.

I can’t. We run RM CC4 at school, which uses Internet Explorer 8/9 and Windows Media Player.

If you’re a fanboy (or fangirl) of another set up, good for you. Glad you’ve got the freedom to do so. Now shush, this article isn’t for you.

The Problem

For the rest of us, there’s a really annoying issue if you have Quicktime installed and you’re using IE8 or IE9.  When you click on a link to an MP3 file, instead of delivering the file, the window gets taken over by thew Quicktime logo , shortly followed by a whole page of white with a tiny play bar in the middle.  Not pretty, not flexible and kinda annoying.

Quicktime

You get this followed by…

The Playbar

…this

The Extended Problem

A lot of people blame Apple for this, but I think the blame lies with Microsoft (when you see the solution).  The issue is that Microsoft have changed the way you control what plays what, but the parallels with the old system are still there, so lots of forums and help sites list the old way, which no longer works.

The Solution

Inside Internet Explorer, do to the following:

  • Click on Tools
  • Internet Options (yeah, Internet Options, not Manage Add-ons)
  • Click on the Programs tab
  • Click Set Programs

At this point, a window for the Control Panel opens up .  It looks like, but is not the Default Programs area of the Control Panel.

Default Programs page

  • Click on the Set program access and computer defaults link
  • Check Custom
  • Click on the down arrows

Set access

  • Scroll down to Choose a default media player :
  • Check Windows Media Player
  • Click OK

And that’s it.  At least it worked for me.   Hopefully it will help you as well.

 

 


Sparkbook

January 28, 2013

Sparkbook is a database driven system I’ve built for school which populates students directly from our MIS (Serco Facility) and allows teachers to quickly mark them against different criteria.

The system is designed to be customisable, so teachers can add their criteria. There is a tiered marking system built in – teachers can choose from 5 (and counting) marking tiers:

  • Expert, Apprentice, Novice
  • Gold, Silver, Bronze
  • etc…

You can set a target and Sparkbook calculates both the current level and ultimate grade.   It’s the sort of thing, I’ve discovered lots of staff had been doing manually in MS Excel for years, spending ages build all their spreadsheets.

Finally, I’ve described it as a mobile device companion markbook, in that it can run from a tablet (resized automatically and linked from our Frog VLE) leaving the user’s computer screen free.   Very handy if you are marking online work, no changing windows.

I’ve only soft launched it so far.  That is, I’ve linked it in, but not drawn everyone’s attention to it.  I prefer to do introduce new systems this way, it gives systems time to settle in.  There are bound to be glitches, change requests and training issues. By simply making the link available without a grand announcement,  it naturally limits the number of teachers who try it without training.

Showing off

I’m aware in writing this post that Sparkbook isn’t actually available for you all.   Sorry about that.  My long-term ambition is to take a lot of the systems built at Cramlington and package them up as a product for other schools.   Delays in MIS product updates have killed that ambition for the moment and even then, I’ll have to investigate just how we’d go about providing a dynamic product such as this; but that’s the goal someday.   For you, it’s either hang on or apply for a job teaching at Cramlington Learning Village.


FIXED: Frog’s Kerboodle widget

December 14, 2012

Kerboodle is an online subscription resource site.  Frog is our VLE.   And Frog’s official Kerboodle widget allows single-sign-on from Frog to Kerboodle.   So no different usernames or passwords to remember.

Kerboodle

Kerboodle’s Frog widget. Big, isn’t it.

Unfortunately, when I downloaded the official widget from Frog, we discovered a really odd issue.  For our students and teachers on Windows XP machines running IE8* the widget doesn’t appear as a button?    The image is there, but that’s it??  My best guess is that some obscure security setting prevents part of the widget code from running.

Boring background bit (and some name checking)

Fortunately, I was at a Microsoft event hosted at the impressive Harton Technology College in South Shields.   Sean O’Shea (@SeanOfTheNorth) from Microsoft had invited me there to have a look at Surface and Office 365 and both are really very cool.   But more about these in future posts.  Frog had a stand there and Frog’s partnership manager Adrian Bantin (@thebantin) was on hand.

Adrian is a really nice guy and when I explained the issue, he sent me the FDP code that sits behind the widget.

Solution

I found a solution.  This might not work for you, but it works for us.  I’ve also sent it to Frog so they can pull it apart and see if they like it.   But in the meantime, this seemed to be the code which caused the issue:

widget.onLoad = function(){

var link = widget.createElement(‘a’,{‘onClick’:’javascript:openKerboodle();’,’style’:’cursor: pointer;’});    

link.setHTML(‘<img src=”http://appstore-misc.frogdev.co.uk/resources/images/uwa/kerboodle/logo.png” /></br>’);  

widget.setBody(link);                

}

Now, I think what’s happening is that this line:

var link = widget.createElement(‘a’,{‘onClick‘:’javascript:openKerboodle();‘,’style’:’cursor: pointer;’});

isn’t rendering in the browser.   But there’s more than one way to skin a cat or in this case call a Javascript function.  Which is what this code is doing.  It’s saying when you click on the image, run the function openKerboodle().

Another way of doing exactly the same thing is:

onClick=”javascript:openKerboodle();“>

This method is more traditional, the code goes inside the body tag instead of inside an onLoad function and most importantly (seems to) work.

Full code

xmlns=”http://www.w3.org/1999/xhtml”      

xmlns:frog=”http://fdp.frogtrade.com/ns/”      

xmlns:widget=”http://www.netvibes.com/ns/“>    

<head>        

<title>Kerboodle</title>        

<meta name=”frogLib” content=”1.1″ />        

// <![CDATA[
src
="
// ]]>https://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js”></script>

    <script>            

 <![CDATA[

                widget.onLoad = function(){                                   

openKerboodle = function(){                        

 UWA.Data.getText('http://www.kerboodle.com', function(data){displayHtml(data);});                    

};               

  }

                displayHtml = function(data){                    

window.open(data);                               

}

 ]]>    

</script>

</head>

<body>

openKerboodle();”> http://appstore-misc.frogdev.co.uk/resources/images/uwa/kerboodle/logo.png /> </a>

</body>

</html>

Here’s a link to the text version, just in case the browser corrupts the code.  Make sure you download the file.  For some reason, the code doesn’t show up in the MediaFire browser.

 

 

*Can’t use other browsers.   Please don’t bore me with how wonderful Chrome and Firefox are.   Don’t care, not my department.  We’re stuck with IE.


Google Forms – passing user details from a VLE

November 27, 2012

The tutorials for how to do this already exist on Google Docs, but whenever I see a survey posted on our VLE, this extra is never included.

Getting started

I’m assuming if you’re reading this you already know how to set up a Google form.  I’m assuming that not because I want to make anyone (including me) an ass, let alone recite a cliché.  No I’m assuming, gentle reader, that you know how to make a form in Google for two reasons:

  1. You want more functionality from your forms
  2. It’s really easy

    Create a form in Google Docs

    This is the current Create button in Google. By the time this post is published I fully expect Google to have changed the design completely

Quick primer

Just in case, I’m going too fast:

  • log into Google Docs
  • click on the Create button
  • click Form

Once your Form is opened you can set about adding questions in all sort of styles, from text entry and paragraphs to multi-choice, scales etc… But let’s be honest, you know all this.

Get to the “fun” bit

Alright, I went as fast as I could.  So, assuming (there I go again) you’re using a similar set up to Cramlington, where surveys are posted as links inside notices and do not require our students to be logged into Google Docs, you will have no idea who the student is who is completing your survey.Easiest solution is to include a username field.   Generally our students are honest and will fill this out, but that’s assuming they spell correctly and include the tutor code part of their username.   It would be so much simpler to just pass those details from our VLE.

Fortunately, we use the Frog VLE which exposes the user’s username in a simple Frog tag: [user_username]

This username can be added to the Google Form address in the following manner:

https://docs.google.com/spreadsheet/viewform?formkey=lots of letters&entry_0=[user_username]&

What does that do?

The actual address of the form is:

https://docs.google.com/spreadsheet/viewform?formkey=lots of letters

There’s a link to the form at the bottom of the edit page.  The rest comprises of:

& tells your browser that the formkey variable has ended.

entry_0 is a new variable and corresponds to the first field in the form.  If you put entry_1 you could set the second variable in the list and so on.

[user_username] is our Frog tag

You can see the example for yourself here:

And that’s it.  Simple.

Now all I have to do is make our 100+ teachers read my blog.


Follow

Get every new post delivered to your Inbox.

Join 294 other followers