Skip to content

Instantly share code, notes, and snippets.

@JimMackin
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JimMackin/2790722aa17a6bd20813 to your computer and use it in GitHub Desktop.
Save JimMackin/2790722aa17a6bd20813 to your computer and use it in GitHub Desktop.
View on cal logic hook implementation
<?php
class ViewOnCalHook{
function addButton($focus, $event, $args){
global $timedate;
$date = $timedate->fromUser($focus->date_start);
$year = $date->format('Y');
$month = $date->format('m');
$day = $date->format('d');
$loc = "index.php?action=index&module=Calendar&view=week&&year={$year}&month={$month}&day={$day}&hour=0";
$focus->view_on_cal_button = "<button onclick='document.location = \"{$loc}\"' type='button'>View on calendar</button>";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment