.. contents:: Contents .. section-numbering:: This how-to explains how to integrate public kronolith calendars with your other websites through screen scraping with PHP. There are other methods of embedding kronolith calendars with javascript, but they don't provide the same level of functionality. ------------- Assumptions ------------- 1. Your horde installation is located in **/calendar** 2. You have a file named **calendar.horde.inc.php** in your include path ------- Setup ------- This setup uses two files, one to provide the necessary functions and another that you can put anywhere on your site (or multiple places) where you'd like the calendar displayed. The file used to display the calendars is fairly simple, it includes a link to appropriate stylesheets, the call to the calendar with associated config variables and if necessary header and footer information. This example is designed to go inside the tags on your page. **Place this in the php file where you would like to have the calendar display** :: ", $calendarfile); $calendar_array = explode("", $calendar_array[1]); $calendarfile = $calendar_array[0]; // Convert day/week/month/year links to local links $calendarfile = str_replace('/calendars/kronolith/day.php?', $_SERVER['SCRIPT_URL'] . '?view=day' . $calendars . '&',$calendarfile); $calendarfile = str_replace('/calendars/kronolith/week.php?', $_SERVER['SCRIPT_URL'] . '?view=week' . $calendars . '&',$calendarfile); $calendarfile = str_replace('/calendars/kronolith/workweek.php?', $_SERVER['SCRIPT_URL'] . '?view=workweek' . $calendars . '&',$calendarfile); $calendarfile = str_replace('/calendars/kronolith/month.php?', $_SERVER['SCRIPT_URL'] . '?view=month' . $calendars . '&',$calendarfile); $calendarfile = str_replace('/calendars/kronolith/year.php?', $_SERVER['SCRIPT_URL'] . '?view=year' . $calendars . '&',$calendarfile); $calendarfile = str_replace('/calendars/kronolith/academicyear.php?', $_SERVER['SCRIPT_URL'] . '?view=academicyear' . $calendars . '&',$calendarfile); // Deal with individual events $calendarfile = str_replace('/calendars/kronolith/event.php?', $_SERVER['SCRIPT_URL'] . '?view=event' . '&',$calendarfile); // Cleanup display // Remove the category lines $calendarfile = preg_replace('/.*\s*.*\s*.*\s*.*\s*.*\s*.*\s/', '' ,$calendarfile); // Remove the owner lines $calendarfile = preg_replace('/.*\s*.*\s*.*\s*.*\s*.*\s*/', '' ,$calendarfile); // Remove the status lines $calendarfile = preg_replace('/.*\s*.*\s*.*\s*.*\s*.*/', '' ,$calendarfile); // Remove alarm and created lines $calendarfile = preg_replace('/.*\s*.*\s*.*\s*.*\s*.*\s*.*\s*.*\s*.*\s*.*\s*.*/', '' ,$calendarfile); // Clean up quotes $calendarfile = stripslashes($calendarfile); // Remove titles because the are broken $calendarfile = preg_replace('/(title=")(.*?)(")/e', "", $calendarfile); // Remove script files because they are broken too $calendarfile = str_replace('', '', $calendarfile); $calendarfile = str_replace('', '', $calendarfile); $calendarfile = str_replace('', '', $calendarfile); ?>
getTime($prefs->getValue('date_format')); $print_view = (bool)Util::getFormData('print'); Horde::addScriptFile('tooltip.js', 'horde', true); if (!$print_view) { Horde::addScriptFile('popup.js', 'horde', true); } require KRONOLITH_TEMPLATES . '/common-header.inc'; $user = Auth::getAuth(); if ($user != '') { if ($print_view) { require $registry->get('templates', 'horde') . '/javascript/print.js'; } else { require KRONOLITH_TEMPLATES . '/menu.inc'; } echo '
'; } else { echo '
'; } if (!$print_view) { Kronolith::tabs(); } $view->html(KRONOLITH_TEMPLATES); echo '
'; if ($print_view) { require KRONOLITH_TEMPLATES . '/calendar_titles.inc'; } else { require KRONOLITH_TEMPLATES . '/panel.inc'; } require $registry->get('templates', 'horde') . '/common-footer.inc';