Overview

Packages

  • Kronolith
  • None

Classes

  • Kronolith
  • Kronolith_Ajax_Application
  • Kronolith_Ajax_Imple_ContactAutoCompleter
  • Kronolith_Ajax_Imple_Embed
  • Kronolith_Ajax_Imple_TagActions
  • Kronolith_Ajax_Imple_TagAutoCompleter
  • Kronolith_Api
  • Kronolith_Calendar
  • Kronolith_Calendar_External
  • Kronolith_Calendar_External_Tasks
  • Kronolith_Calendar_Holiday
  • Kronolith_Calendar_Internal
  • Kronolith_Calendar_Remote
  • Kronolith_Calendar_Resource
  • Kronolith_Calendars_Base
  • Kronolith_Calendars_Default
  • Kronolith_Calendars_Kolab
  • Kronolith_Day
  • Kronolith_Driver
  • Kronolith_Driver_Holidays
  • Kronolith_Driver_Horde
  • Kronolith_Driver_Ical
  • Kronolith_Driver_Kolab
  • Kronolith_Driver_Mock
  • Kronolith_Driver_Resource
  • Kronolith_Driver_Sql
  • Kronolith_Event
  • Kronolith_Event_Holidays
  • Kronolith_Event_Horde
  • Kronolith_Event_Ical
  • Kronolith_Event_Kolab
  • Kronolith_Event_Resource
  • Kronolith_Event_Sql
  • Kronolith_Exception
  • Kronolith_Factory_Calendars
  • Kronolith_Factory_Geo
  • Kronolith_Form_CreateCalendar
  • Kronolith_Form_CreateResource
  • Kronolith_Form_CreateResourceGroup
  • Kronolith_Form_DeleteCalendar
  • Kronolith_Form_DeleteResource
  • Kronolith_Form_DeleteResourceGroup
  • Kronolith_Form_EditCalendar
  • Kronolith_Form_EditRemoteCalendar
  • Kronolith_Form_EditResource
  • Kronolith_Form_EditResourceGroup
  • Kronolith_Form_SubscribeRemoteCalendar
  • Kronolith_Form_UnsubscribeRemoteCalendar
  • Kronolith_FreeBusy
  • Kronolith_FreeBusy_View
  • Kronolith_FreeBusy_View_Day
  • Kronolith_FreeBusy_View_Month
  • Kronolith_FreeBusy_View_Week
  • Kronolith_FreeBusy_View_Workweek
  • Kronolith_Geo_Base
  • Kronolith_Geo_Mysql
  • Kronolith_Geo_Sql
  • Kronolith_LoginTasks_SystemTask_Upgrade
  • Kronolith_LoginTasks_Task_PurgeEvents
  • Kronolith_Notification_Listener_AjaxStatus
  • Kronolith_Resource
  • Kronolith_Resource_Base
  • Kronolith_Resource_Group
  • Kronolith_Resource_Single
  • Kronolith_Storage
  • Kronolith_Storage_Kolab
  • Kronolith_Storage_Sql
  • Kronolith_Tagger
  • Kronolith_Test
  • Kronolith_View_Day
  • Kronolith_View_DeleteEvent
  • Kronolith_View_EditEvent
  • Kronolith_View_Event
  • Kronolith_View_ExportEvent
  • Kronolith_View_Month
  • Kronolith_View_Week
  • Kronolith_View_WorkWeek
  • Kronolith_View_Year
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Kronolith_Ajax_Imple_Embed:: will allow embedding calendar widgets in
  4:  * external websites. Meant to be called via a single script tag, therefore
  5:  * this will always return nothing but valid javascript.
  6:  *
  7:  * Copyright 2008-2012 Horde LLC (http://www.horde.org/)
  8:  *
  9:  * @author  Michael J. Rubinsky <mrubinsk@horde.org>
 10:  * @package Kronolith
 11:  */
 12: class Kronolith_Ajax_Imple_Embed extends Horde_Core_Ajax_Imple
 13: {
 14:     /**
 15:      */
 16:     public function attach()
 17:     {
 18:     }
 19: 
 20:     public function getUrl()
 21:     {
 22:         return $this->_getUrl('Embed', 'kronolith', $this->_params, true);
 23:     }
 24: 
 25:     /**
 26:      * Handles the output of the embedded widget. This must always be valid
 27:      * javascript.
 28:      * <pre>
 29:      * The following arguments are required:
 30:      *   view      => the view (block) we want
 31:      *   container => the DOM node to populate with the widget
 32:      *   calendar  => the share_name for the requested calendar
 33:      *
 34:      * The following are optional (and are not used for all views)
 35:      *   months        => the number of months to include
 36:      *   maxevents     => the maximum number of events to show
 37:      * </pre>
 38:      *
 39:      * @param array $args  Arguments for this view.
 40:      */
 41:     public function handle($args, $post)
 42:     {
 43:         /* First, determine the type of view we are asking for */
 44:         $view = $args['view'];
 45: 
 46:         /* The DOM container to put the HTML in on the remote site */
 47:         $container = $args['container'];
 48: 
 49:         /* The share_name of the calendar to display */
 50:         $calendar = $args['calendar'];
 51: 
 52:         /* Deault to showing only 1 month when we have a choice */
 53:         $count_month = (!empty($args['months']) ? $args['months'] : 1);
 54: 
 55:         /* Default to no limit for the number of events */
 56:         $max_events = (!empty($args['maxevents']) ? $args['maxevents'] : 0);
 57: 
 58:         /* Default to one week */
 59:         $count_days = (!empty($args['days']) ? $args['days'] : 7);
 60: 
 61:         if (!empty($args['css']) && $args['css'] == 'none') {
 62:             $nocss = true;
 63:         }
 64: 
 65:         /* Build the block parameters */
 66:         $params = array(
 67:             'calendar' => $calendar,
 68:             'maxevents' => $max_events,
 69:             'months' => $count_month,
 70:             'days' => $count_days
 71:         );
 72: 
 73:         /* Call the Horde_Block api to get the calendar HTML */
 74:         $title = $GLOBALS['registry']->call('horde/blockTitle', array('kronolith', $view, $params));
 75:         $results = $GLOBALS['registry']->call('horde/blockContent', array('kronolith', $view, $params));
 76: 
 77:         /* Some needed paths */
 78:         $js_path = $GLOBALS['registry']->get('jsuri', 'kronolith');
 79: 
 80:         /* Local js */
 81:         $jsurl = Horde::url($js_path . '/embed.js', true);
 82: 
 83:         /* Horde's js */
 84:         $hjs_path = $GLOBALS['registry']->get('jsuri', 'horde');
 85:         $hjsurl = Horde::url($hjs_path . '/tooltips.js', true);
 86:         $pturl = Horde::url($hjs_path . '/prototype.js', true);
 87: 
 88:         /* CSS */
 89:         if (empty($nocss)) {
 90:             $horde_css = $GLOBALS['injector']->getInstance('Horde_Themes_Css');
 91:             $horde_css->addThemeStylesheet('embed.css');
 92: 
 93:             Horde::startBuffer();
 94:             Horde::includeStylesheetFiles(array('nobase' => true), true);
 95:             $css = Horde::endBuffer();
 96:         } else {
 97:             $css = '';
 98:         }
 99: 
100:         /* Escape the text and put together the javascript to send back */
101:         $results = addslashes('<div class="kronolith_embedded"><div class="title">' . $title . '</div>' . $results . '</div>');
102:         $html = <<<EOT
103:         //<![CDATA[
104:         if (typeof kronolith == 'undefined') {
105:             if (typeof Prototype == 'undefined') {
106:                 document.write('<script type="text/javascript" src="$pturl"></script>');
107:             }
108:             if (typeof Horde_ToolTips == 'undefined') {
109:                 Horde_ToolTips_Autoload = false;
110:                 document.write('<script type="text/javascript" src="$hjsurl"></script>');
111:             }
112:             kronolith = new Object();
113:             kronolithNodes = new Array();
114:             document.write('<script type="text/javascript" src="$jsurl"></script>');
115:             document.write('$css');
116:         }
117:         kronolithNodes[kronolithNodes.length] = '$container';
118:         kronolith['$container'] = "$results";
119:         //]]>
120: EOT;
121: 
122:         /* Send it */
123:         header('Content-Type: text/javascript');
124:         echo $html;
125:         exit;
126:     }
127: 
128: }
129: 
API documentation generated by ApiGen