Team:Northwestern/Calendar

From 2010.igem.org

Revision as of 03:00, 25 May 2010 by Cyu286 (Talk | contribs)
Home Team Project Parts Notebook Safety Calendar Protocol

<?php

  1. Google Calendar Extension
  2. Purpose:
  3. Embed a Google Calendar in a MediaWiki page
  4. Tag/Wikitext :
  5. <googlecalendar>docid</googlecalendar>
  6. Example :
  7. from <iframe src="http://www.google.com/calendar/embed?src=umhappyhours%40gmail.com"
  8. style="border: 0" width="800" height="600" frameborder="0" scrolling="no"></iframe>
  9. Instructions :
  10. set $input to the Google Account that owns the calendar you want to embed
  11. set $width & $height to the proportions appropriate for your wiki page
  12. Credits
  13. This code is adapted from Kasper Souren's original extension, sometimes available at
  14. http://wiki.couchsurfing.com/wiki/index.php?title=Google_Calendar_MediaWiki_plugin
  15. License
  16. GNU Public

$wgExtensionFunctions[] = 'wfGoogleCalendar'; $wgExtensionCredits['parserhook'][] = array(

       'name' => 'Google Calendar',
       'description' => 'Display Google Calendar',
       'author' => 'Libby Hemphill',
       'url' => 

);

function wfGoogleCalendar() {

       global $wgParser;
       $wgParser->setHook('googlecalendar', 'renderGoogleCalendar');

}

  1. The callback function for converting the input text to HTML output

function renderGoogleCalendar($input) {

       $input = htmlspecialchars($input);
       //$input = "umhappyhours@gmail.com"
       $width = 425;
       $height = 350;

$output = '<iframe src="http://www.google.com/calendar/embed?src=' . $input; $output .= '" style="border: 0" width="' . $width; $output .= '" height="' . $height . '" frameborder="0" scrolling="no"></iframe>';

       return $output;

} ?>

<googlecalendar>umhappyhours@gmail.com</googlecalendar>

https://www.google.com/calendar/embedhelper

http://www.google.com/calendar/embed?src=jt8b61e40pnap50ddhtfcpoua8%40group.calendar.google.com&ctz=America/Chicago

<googlecalendar>?height=600&wkst=1&bgcolor=%23FFFFFF&src=jt8b61e40pnap50ddhtfcpoua8%40group.calendar.google.com&color=%238C500B&ctz=Pacific%2FApia" style=" border-width:0 " width="800" height="600" frameborder="0" scrolling="no"></googlecalendar>

<iframe src="http://www.google.com/calendar/embed?src=jt8b61e40pnap50ddhtfcpoua8%40group.calendar.google.com&ctz=America/Chicago" style="border: 0" width="800" height="600"

frameborder="0" scrolling="no"></iframe>

http://www.libbyh.com/2007/12/07/google-calendar-mediawiki-plugin/