/** * Import all dictionary words from another area (use Ajax) * * @param string $lang Language code * @param string $area Area name * @return void */ public function import($lang, $area) { // load dictionaries $this->dict->get_wordarray(array('form', 'dictionary')); // build the form $fields = array(); $fields[] = array('label' => null, 'type' => 'hidden', 'value' => $lang, 'name' => 'lang'); $fields[] = array('label' => null, 'type' => 'hidden', 'value' => $area, 'name' => 'area', 'extra' => 'class="large"'); $fields[] = array('label' => null, 'type' => 'html', 'value' => '<h4>' . _IMPORT_INTO . ' ' . $lang . '/' . $area . '</h4>' . _IMPORT_INTO_MSG); $dict = new Dictionary_model(); $fields[] = array('label' => _SECTION, 'type' => 'select', 'value' => '', 'name' => 'what', 'options' => array($dict->get_section_options(), 'value', 'option'), 'rule' => 'required', 'extra' => 'class="large"'); // if submitted if (X4Route_core::$post) { $e = X4Validation_helper::form($fields, 'import'); if ($e) { $this->importing($_POST); } else { $this->notice($fields); } die; } // contents $view = new X4View_core('editor'); $view->title = _IMPORT_KEYS; // form builder $view->form = X4Form_helper::doform('import', $_SERVER["REQUEST_URI"], $fields, array(_RESET, _SUBMIT, 'buttons'), 'post', '', 'onclick="setForm(\'import\');"'); $view->render(TRUE); }