From c909aaf0df76dd84894d68eadcd3bb68480e335d Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Mon, 21 Sep 2009 20:00:00 -0400 Subject: [PATCH] Move this to the base class. --- kronolith/lib/Resource/Base.php | 26 ++++++++++++++++++++++++++ kronolith/lib/Resource/Single.php | 26 -------------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/kronolith/lib/Resource/Base.php b/kronolith/lib/Resource/Base.php index a9c1db06f..405eace86 100644 --- a/kronolith/lib/Resource/Base.php +++ b/kronolith/lib/Resource/Base.php @@ -128,6 +128,32 @@ abstract class Kronolith_Resource_Base } /** + * Check availability and return an appropriate Kronolith response code. + * + * @param Kronolith_Event $event The event to check on + * + * @return integer Kronolith::RESPONSE* constant + */ + public function getResponse($event) + { + switch($this->getResponseType()) { + case Kronolith_Resource::RESPONSETYPE_ALWAYS_ACCEPT: + return Kronolith::RESPONSE_ACCEPTED; + case Kronolith_Resource::RESPONSETYPE_AUTO: + if ($this->isFree($event)) { + return Kronolith::RESPONSE_ACCEPTED; + } else { + return Kronolith::RESPONSE_DECLINED; + } + case Kronolith_Resource::RESPONSETYPE_ALWAYS_DECLINE: + return Kronolith::RESPONSE_DECLINED; + case Kronolith_Resource::RESPONSETYPE_NONE: + case Kronolith_Resource::RESPONSETYPE_MANUAL: + return Kronolith::RESPONSE_NONE; + } + } + + /** * Determine if event is free for specified time * * @param $startTime diff --git a/kronolith/lib/Resource/Single.php b/kronolith/lib/Resource/Single.php index 5b5c9024f..82f4bdffc 100644 --- a/kronolith/lib/Resource/Single.php +++ b/kronolith/lib/Resource/Single.php @@ -119,32 +119,6 @@ class Kronolith_Resource_Single extends Kronolith_Resource_Base } /** - * Check availability and return an appropriate Kronolith response code. - * - * @param Kronolith_Event $event The event to check on - * - * @return integer Kronolith::RESPONSE* constant - */ - function getResponse($event) - { - switch($this->getResponseType()) { - case Kronolith_Resource::RESPONSETYPE_ALWAYS_ACCEPT: - return Kronolith::RESPONSE_ACCEPTED; - case Kronolith_Resource::RESPONSETYPE_AUTO: - if ($this->isFree($event)) { - return Kronolith::RESPONSE_ACCEPTED; - } else { - return Kronolith::RESPONSE_DECLINED; - } - case Kronolith_Resource::RESPONSETYPE_ALWAYS_DECLINE: - return Kronolith::RESPONSE_DECLINED; - case Kronolith_Resource::RESPONSETYPE_NONE: - case Kronolith_Resource::RESPONSETYPE_MANUAL: - return Kronolith::RESPONSE_NONE; - } - } - - /** * Obtain the freebusy information for this resource. * * @return unknown_type -- 2.11.0