/** * Ajax request to submit data * @param array $request the request * @return array ajax format status */ public function submitFormData($request) { $this->defFields(); // Definisce i campi in base al parametro kind $request = $this->translateFields($request); // Converte i nomi generici della richiesta in nomi specifici (fr, st_cm) if (!R3EcoGisHelper::isValidMunicipality($request['mu_id'])) { die("INVALID MUNICIPALITY [{$request['mu_id']}]"); } // Security trap $errors = $this->checkFormData($request); for ($langId = 1; $langId <= R3AuthInstance::get()->getConfigValue('APPLICATION', 'NUM_LANGUAGES', 1); $langId++) { if ($this->objectExistsByName($langId, $request['mu_id'], $request["{$this->prefix}_name_{$langId}"])) { $errors["popup_name_{$langId}"] = array('CUSTOM_ERROR' => sprintf(_("{$this->lookupName} con nome \"%s\" esiste già"), $request["{$this->prefix}_name_{$langId}"])); } } if (count($errors) > 0) { return $this->getAjaxErrorResult($errors); } else { $id = $this->applyData($request); if ($this->kind == 'fraction') { $jsFunc = 'addFractionDlgDone'; } else { if ($this->kind == 'street') { $jsFunc = 'addStreetDlgDone'; } else { if ($this->kind == 'catmunic') { $jsFunc = 'addCatMunicDlgDone'; } } } R3EcoGisEventNotifier::notifyDataChanged($this, array('data_changed' => true)); return array('status' => R3_AJAX_NO_ERROR, 'js' => "{$jsFunc}({$id})"); } }