From: Michael J. Rubinsky Date: Tue, 22 Sep 2009 00:00:00 +0000 (-0400) Subject: Move this to the base class. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=920354079779c9f7cee3035431e1ab3dc26b59d0;p=horde.git Move this to the base class. --- diff --git a/kronolith/lib/Resource/Base.php b/kronolith/lib/Resource/Base.php index 0c8258514..c565a1b10 100644 --- a/kronolith/lib/Resource/Base.php +++ b/kronolith/lib/Resource/Base.php @@ -154,6 +154,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 c9c64380d..eba46528f 100644 --- a/kronolith/lib/Resource/Single.php +++ b/kronolith/lib/Resource/Single.php @@ -118,32 +118,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