/** * Import DB fields into the form object */ public function importdbfieldsAction() { $connection = Request::post('connection', 'string', false); $table = Request::post('table', 'string', false); $conType = Request::post('type', 'integer', false); $importFields = Request::post('importfields', 'array', array()); if ($connection === false || !$table || empty($importFields) || $conType === false) { Response::jsonError($this->_lang->WRONG_REQUEST); } $conManager = new Backend_Orm_Connections_Manager($this->_configMain->get('db_configs')); $cfg = $conManager->getConnection($conType, $connection); if (!$cfg) { Response::jsonError($this->_lang->WRONG_REQUEST); } $cfg = $cfg->__toArray(); $tableFields = Backend_Designer_Import::getTableFields($cfg, $table); if ($tableFields === false) { Response::jsonError($this->_lang->CANT_CONNECT); } foreach ($importFields as $name) { if (isset($tableFields[$name]) && !empty($tableFields[$name])) { $this->_importDbField($name, $tableFields[$name]); } } $this->_storeProject(); Response::jsonSuccess(); }