From 8ca17c81951bd645ad2cee613ed72b27a5b2c5f2 Mon Sep 17 00:00:00 2001 From: s-nakajima Date: Sat, 5 May 2018 13:20:33 +0900 Subject: [PATCH] =?UTF-8?q?=E9=80=9F=E5=BA=A6=E6=94=B9=E5=96=84=E3=81=AE?= =?UTF-8?q?=E3=81=9F=E3=82=81=E3=81=AE=E4=BF=AE=E6=AD=A3=20=E3=83=BB?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E3=81=97=E3=81=AA=E3=81=84=E3=82=AB=E3=83=A9?= =?UTF-8?q?=E3=83=A0=E3=81=AF=E5=8F=96=E5=BE=97=E3=81=97=E3=81=AA=E3=81=84?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Component/ControlPanelLayoutComponent.php | 41 ++++++++++++++++--- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/Controller/Component/ControlPanelLayoutComponent.php b/Controller/Component/ControlPanelLayoutComponent.php index 50c9385..de16a83 100644 --- a/Controller/Component/ControlPanelLayoutComponent.php +++ b/Controller/Component/ControlPanelLayoutComponent.php @@ -43,16 +43,45 @@ public function beforeRender(Controller $controller) { $controller->Plugin = ClassRegistry::init('PluginManager.Plugin', true); $controller->PluginsRole = ClassRegistry::init('PluginManager.PluginsRole', true); - $controlPanel = $controller->Plugin->create(array( + $controlPanel[$controller->Plugin->alias] = [ 'key' => 'control_panel', 'name' => __d('control_panel', 'Control Panel Top'), 'default_action' => 'control_panel/index' - )); + ]; - $this->plugins = $controller->PluginsRole->getPlugins( - array(Plugin::PLUGIN_TYPE_FOR_SITE_MANAGER, Plugin::PLUGIN_TYPE_FOR_SYSTEM_MANGER), - Current::read('User.role_key'), 'INNER' - ); + $this->plugins = $controller->Plugin->find('all', array( + 'recursive' => -1, + 'fields' => array( + $controller->Plugin->alias . '.key', + $controller->Plugin->alias . '.name', + //$controller->Plugin->alias . '.weight', + //$controller->Plugin->alias . '.type', + $controller->Plugin->alias . '.default_action', + //$controller->PluginsRole->alias . '.role_key', + ), + 'joins' => array( + array( + 'table' => $controller->PluginsRole->table, + 'alias' => $controller->PluginsRole->alias, + 'type' => 'INNER', + 'conditions' => array( + $controller->Plugin->alias . '.key' . ' = ' . + $controller->PluginsRole->alias . ' .plugin_key', + ), + ), + ), + 'conditions' => array( + $controller->Plugin->alias . '.type' => [ + Plugin::PLUGIN_TYPE_FOR_SITE_MANAGER, Plugin::PLUGIN_TYPE_FOR_SYSTEM_MANGER + ], + $controller->Plugin->alias . '.language_id' => Current::read('Language.id'), + $controller->PluginsRole->alias . '.role_key' => Current::read('User.role_key'), + ), + 'order' => array( + $controller->Plugin->alias . '.weight' => 'asc', + $controller->Plugin->alias . '.id' => 'desc' + ), + )); array_unshift($this->plugins, $controlPanel);