public function SaveRecord() { $this->setDB(); $this->setCollection(); if ($this->validation($this->db, $this->collection)) { switch (strtolower($this->request->getParam('type'))) { case 'fieldvalue': $a = array_combine($this->request->getParam('fields'), $this->request->getParam('values')); $this->insertRecord($a); break; case 'array': $cryptography = new Cryptography(); $a = $cryptography->stringToArray($this->request->getParam('data')); $this->insertRecord($a); break; case 'json': $response = $this->getModel()->insert($this->db, $this->collection, $this->request->getParam('data'), 'json'); if ($response['ok'] == 1) { $this->message->sucess = I18n::t('R_I'); } else { $this->message->error = I18n::t('I_J'); } break; } } $this->request->redirect(Theme::URL('Collection/Record', array('db' => $this->db, 'collection' => $this->collection))); }