From aa9c091436fa5fac6c184d2f9ce47cf62bc3efd1 Mon Sep 17 00:00:00 2001 From: RyujiAMANO Date: Sun, 15 May 2016 09:14:08 +0900 Subject: [PATCH] =?UTF-8?q?Current=E3=81=A7Space=E3=81=AE=E6=83=85?= =?UTF-8?q?=E5=A0=B1=E5=8F=96=E3=82=8C=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Utility/CurrentPage.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Utility/CurrentPage.php b/Utility/CurrentPage.php index 2f50a5cf..8ea17c03 100644 --- a/Utility/CurrentPage.php +++ b/Utility/CurrentPage.php @@ -44,6 +44,7 @@ public function initialize() { $this->setDefaultRolePermissions(); $this->setRoomRolePermissions(); $this->setPluginsRoom(); + $this->setSpace(); } /** @@ -256,4 +257,24 @@ public function setRoom($roomId) { Current::$current = Hash::merge(Current::$current, $result); } +/** + * set Space + * + * @return void + */ + public function setSpace() { + if (!isset(Current::$current['Room'])) { + return; + } + + $this->Space = ClassRegistry::init('Rooms.Space'); + $conditions = array( + 'Space.id' => Hash::get(Current::$current, 'Room.space_id') + ); + $result = $this->Space->find('first', array( + 'recursive' => 0, + 'conditions' => $conditions, + )); + Current::$current = Hash::merge(Current::$current, $result); + } }