From 1d598770fdcc34eb9af87af62283dcd0519c1443 Mon Sep 17 00:00:00 2001 From: "Michael J. Rubinsky" Date: Thu, 10 Sep 2009 10:13:52 -0400 Subject: [PATCH] Add a setResources() method similar to setAttendees() for bulk setting the local resources array --- kronolith/lib/Event.php | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) 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. -- 2.11.0