1: <?php
2: 3: 4: 5: 6: 7: 8: 9: 10: 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: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40:
41: public function handle($args, $post)
42: {
43:
44: $view = $args['view'];
45:
46:
47: $container = $args['container'];
48:
49:
50: $calendar = $args['calendar'];
51:
52:
53: $count_month = (!empty($args['months']) ? $args['months'] : 1);
54:
55:
56: $max_events = (!empty($args['maxevents']) ? $args['maxevents'] : 0);
57:
58:
59: $count_days = (!empty($args['days']) ? $args['days'] : 7);
60:
61: if (!empty($args['css']) && $args['css'] == 'none') {
62: $nocss = true;
63: }
64:
65:
66: $params = array(
67: 'calendar' => $calendar,
68: 'maxevents' => $max_events,
69: 'months' => $count_month,
70: 'days' => $count_days
71: );
72:
73:
74: $title = $GLOBALS['registry']->call('horde/blockTitle', array('kronolith', $view, $params));
75: $results = $GLOBALS['registry']->call('horde/blockContent', array('kronolith', $view, $params));
76:
77:
78: $js_path = $GLOBALS['registry']->get('jsuri', 'kronolith');
79:
80:
81: $jsurl = Horde::url($js_path . '/embed.js', true);
82:
83:
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:
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:
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:
123: header('Content-Type: text/javascript');
124: echo $html;
125: exit;
126: }
127:
128: }
129: