function save() { $session = \GCore\Libs\Base::getSession(); parent::_settings('chronoforms'); $chronoforms_settings = new \GCore\Libs\Parameter($this->data['Chronoforms']); if ($chronoforms_settings->get('wizard.safe_save', 1)) { $s_form = array(); //parse_str($this->data['serialized_form_data'], $s_form); if (!empty($this->data['serialized_form_data_chunks'])) { $chunks = $this->data['serialized_form_data_chunks']; $this->data['serialized_form_data'] = implode('', $chunks); } $pairs = explode('&', $this->data['serialized_form_data']); $result = array(); foreach ($pairs as $pair) { $dummy = array(); parse_str($pair, $dummy); $path = array(); self::extract_array_path($dummy, $path); $path = implode('.', $path); $new_path = explode('.', $path); //check if the last path item is numeric, then its an array of values if (is_numeric($new_path[count($new_path) - 1])) { $value = \GCore\Libs\Arr::getVal($dummy, $new_path); $last_numeric_index = $new_path[count($new_path) - 1]; unset($new_path[count($new_path) - 1]); $existing_results = (array) \GCore\Libs\Arr::getVal($result, $new_path, array()); if (!in_array($last_numeric_index, array_keys($existing_results))) { $existing_results[$last_numeric_index] = $value; } else { $existing_results[] = $value; } $result = \GCore\Libs\Arr::setVal($result, $new_path, $existing_results); continue; } if (in_array('{N}', $new_path) !== false) { continue; } $result = \GCore\Libs\Arr::setVal($result, $new_path, \GCore\Libs\Arr::getVal($dummy, $new_path)); } $s_form = $result; $this->data = $s_form; } $result = parent::_save(); if ($result) { $this->_limit_forms(); if ($this->Request->get('save_act') == 'apply') { $this->redirect(r_('index.php?ext=chronoforms&act=edit&id=' . $this->Form->id)); } else { $session->setFlash('success', sprintf(l_('CF_FORM_X_HAS_BEEN_UPDATED'), $this->data['Form']['title'])); $this->redirect(r_('index.php?ext=chronoforms')); } } else { $this->edit(); $this->view = 'edit'; $session->setFlash('error', \GCore\Libs\Arr::flatten($this->Form->errors)); } }
function save() { $this->save_model = $this->pmodel; $result = parent::_save(); if ($result) { if ($this->Request->get('save_act') == 'apply') { $this->redirect(r_('index.php?ext=chronoconnectivity&cont=lists&act=edit&ccname=' . $this->connection['Connection']['title'] . '&gcb=' . $this->pmodel->id)); } else { $this->redirect(r_('index.php?ext=chronoconnectivity&cont=lists&act=index&ccname=' . $this->connection['Connection']['title'])); } } else { $this->edit(); $this->view = 'edit'; $session = \GCore\Libs\Base::getSession(); $session->setFlash('error', \GCore\Libs\Arr::flatten($this->pmodel->errors)); } }
function save() { parent::_settings('chronoforms'); $chronoforms_settings = new \GCore\Libs\Parameter($this->data['Chronoforms']); if ($chronoforms_settings->get('wizard.safe_save', 1)) { $s_form = array(); //parse_str($this->data['serialized_form_data'], $s_form); $pairs = explode('&', $this->data['serialized_form_data']); $result = array(); foreach ($pairs as $pair) { $dummy = array(); parse_str($pair, $dummy); $path = array(); self::extract_array_path($dummy, $path); $path = implode('.', $path); $new_path = explode('.', $path); $result = \GCore\Libs\Arr::setVal($result, $new_path, \GCore\Libs\Arr::getVal($dummy, $new_path)); } $s_form = $result; $this->data = $s_form; } $result = parent::_save(); if ($result) { if ($this->Request->get('save_act') == 'apply') { $this->redirect(r_('index.php?ext=chronoforms&act=edit&id=' . $this->Form->id)); } else { $this->redirect(r_('index.php?ext=chronoforms')); } } else { $this->edit(); $this->view = 'edit'; $session = \GCore\Libs\Base::getSession(); $session->setFlash('error', \GCore\Libs\Arr::flatten($this->Form->errors)); } }
function save() { //check the new database connection details if (!empty($this->data['Connection']['extras']['ndb']['enabled'])) { $dbo_config = array('type' => $this->data['Connection']['extras']['ndb']['driver'], 'host' => $this->data['Connection']['extras']['ndb']['host'], 'name' => $this->data['Connection']['extras']['ndb']['database'], 'user' => $this->data['Connection']['extras']['ndb']['user'], 'pass' => $this->data['Connection']['extras']['ndb']['password'], 'prefix' => $this->data['Connection']['extras']['ndb']['prefix']); $tables = \GCore\Libs\Database::getInstance($dbo_config)->getTablesList(); } $result = parent::_save(); if ($result) { if ($this->Request->get('save_act') == 'apply') { $this->redirect(r_('index.php?ext=chronoconnectivity&act=edit&id=' . $this->Connection->id)); } else { $this->redirect(r_('index.php?ext=chronoconnectivity')); } } else { $this->edit(); $this->view = 'edit'; $session = \GCore\Libs\Base::getSession(); $session->setFlash('error', \GCore\Libs\Arr::flatten($this->Connection->errors)); } }