public function listAction() { $devType = Request::post('devType', 'int', false); if ($devType === false || !$this->_manager->typeExists($devType)) { Response::jsonError($this->_lang->WRONG_REQUEST . ' undefined devType'); } $connections = $this->_manager->getConnections($devType); $data = array(); if (!empty($connections)) { foreach ($connections as $name => $cfg) { if ($name === 'default') { $system = true; } else { $system = false; } $data[] = array('id' => $name, 'system' => $system, 'devType' => $devType, 'username' => $cfg->get('username'), 'dbname' => $cfg->get('dbname'), 'host' => $cfg->get('host'), 'adapter' => $cfg->get('adapter')); } } Response::jsonSuccess($data); }
/** * Get list of database connections */ public function connectionslistAction() { $manager = new Backend_Orm_Connections_Manager($this->_configMain->get('db_configs')); $list = $manager->getConnections(0); $data = array(); if (!empty($list)) { foreach ($list as $k => $v) { $data[] = array('id' => $k); } } Response::jsonSuccess($data); }