From: Michael J. Rubinsky Date: Thu, 10 Sep 2009 14:13:52 +0000 (-0400) Subject: Add a setResources() method similar to setAttendees() for bulk setting X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=1d598770fdcc34eb9af87af62283dcd0519c1443;p=horde.git Add a setResources() method similar to setAttendees() for bulk setting the local resources array --- diff --git a/kronolith/lib/Event.php b/kronolith/lib/Event.php index 0af8f73b9..6ed3a61c3 100644 --- a/kronolith/lib/Event.php +++ b/kronolith/lib/Event.php @@ -1542,7 +1542,7 @@ abstract class Kronolith_Event } /** - * Adds a Kronolith_Resource to this event. + * Adds a single Kronolith_Resource to this event. * No validation or acceptence/denial is done here...it should be done * when saving the Event. * @@ -1560,6 +1560,18 @@ abstract class Kronolith_Event } /** + * Directly set/replace the _resources array. Called from Event::readForm + * to bulk load the resources from $_SESSION + * + * @param $resources + * @return unknown_type + */ + public function setResources($resources) + { + $this->_resources = $resources; + } + + /** * Remove a Kronolith_Resource from this event * * @param Kronolith_Resource $resource The resource to remove @@ -1645,6 +1657,11 @@ abstract class Kronolith_Event $this->setAttendees($_SESSION['kronolith']['attendees']); } + // Resources + if (isset($_SESSION['kronolith']['resources']) && is_array($_SESSION['kronolith']['resources'])) { + $this->setResources($_SESSION['kronolith']['resources']); + } + // strptime() is locale dependent, i.e. %p is not always matching // AM/PM. Set the locale to C to workaround this, but grab the // locale's D_FMT before that.