/** * Handle a "when" step. * * @param array &$world Joined "world" of variables. * @param string $action The description of the step. * @param array $arguments Additional arguments to the step. * * @return mixed The outcome of the step. */ public function runWhen(&$world, $action, $arguments) { switch ($action) { case 'adding an event to a folder': $world['result']['add_event'][] = $this->addEvent($arguments[0], $arguments[1]); break; case 'triggering the folder': include_once 'Horde/Kolab/FreeBusy.php'; $_GET['folder'] = $arguments[0]; $_GET['extended'] = '1'; $fb = new Horde_Kolab_FreeBusy(); $world['result']['trigger'] = $fb->trigger(); break; case 'fetching the free/busy information for': include_once 'Horde/Kolab/FreeBusy.php'; $_GET['uid'] = $arguments[0]; $_GET['extended'] = '1'; $fb = new Horde_Kolab_FreeBusy(); $world['result']['fetch'] = $fb->fetch(); break; default: return parent::runWhen($world, $action, $arguments); } }
/** * Test triggering the folder of another user. * * @return NULL */ public function testForeignTrigger() { $start = time(); $this->_addEvent($start); $this->assertTrue($this->auth->authenticate('*****@*****.**', array('password' => 'test'))); $_GET['folder'] = 'wrobel@example.org/Calendar'; $_GET['extended'] = '1'; $fb = new Horde_Kolab_FreeBusy(); $view = $fb->trigger(); $this->assertEquals('Horde_Kolab_FreeBusy_View_vfb', get_class($view)); $vcal = $view->_data['fb']; $vfb = $vcal->findComponent('VFREEBUSY'); $p = $vfb->getBusyPeriods(); $this->assertTrue($p[$start] == $start + 120); }
<?php /** * A script for triggering an update of the Kolab Free/Busy information. * * This script generates partial free/busy information based on a * single calendar folder on the Kolab groupware server. The partial * information is cached and later assembled for display by the * freebusy.php script. * * Copyright 2004-2009 Klarälvdalens Datakonsult AB * * @author Steffen Hansen <*****@*****.**> * @author Gunnar Wrobel <*****@*****.**> * @author Thomas Arendsen Hein <*****@*****.**> * @package Kolab_FreeBusy */ /** Load the required free/busy library */ require_once 'Horde/Kolab/FreeBusy.php'; /** Load the configuration */ require_once 'config.php'; $fb = new Horde_Kolab_FreeBusy(); $view = $fb->trigger(); $view->render();