/** * SEO form data (use Ajax) * * @param integer $id_area area ID * @return void */ public function seo($id_area) { // load dictionaries $this->dict->get_wordarray(array('form', 'areas', 'themes')); // build the form $fields = array(); $fields[] = array('label' => null, 'type' => 'hidden', 'value' => $id_area, 'name' => 'id_area'); $fields[] = array('label' => null, 'type' => 'html', 'value' => '<div id="accordion">'); // get the current data, // areas data relating to SEO are stored in 'alang' $lang = new Language_model(); $m = $lang->get_seo_data($id_area); $c = 0; // for each enabled language foreach ($m as $i) { $fields[] = array('label' => null, 'type' => 'hidden', 'value' => $i->id, 'name' => 'id_' . $c); $fields[] = array('label' => null, 'type' => 'html', 'value' => '<h4 class="context">' . ucfirst($i->language) . '</h4><div class="section">'); $fields[] = array('label' => _NAME, 'type' => 'text', 'value' => $i->title, 'name' => 'title_' . $c, 'rule' => 'required', 'extra' => 'class="large"'); $fields[] = array('label' => _DESCRIPTION, 'type' => 'textarea', 'value' => $i->description, 'name' => 'description_' . $c); $fields[] = array('label' => _KEYS, 'type' => 'textarea', 'value' => $i->keywords, 'name' => 'keywords_' . $c); $fields[] = array('label' => null, 'type' => 'html', 'value' => '</div>'); $c++; } $fields[] = array('label' => null, 'type' => 'html', 'value' => '</div>'); // if submitted if (X4Route_core::$post) { $e = X4Validation_helper::form($fields, 'editor'); if ($e) { $this->editing_seo_data($id_area, $_POST); } else { $this->notice($fields); } die; } // contents $view = new X4View_core('editor'); $view->title = _SEO_DATA; // form builder $view->form = X4Form_helper::doform('editor', $_SERVER["REQUEST_URI"], $fields, array(_RESET, _SUBMIT, 'buttons'), 'post', '', 'onclick="setForm(\'editor\');"'); $view->js = ' <script> window.addEvent("domready", function() { saccordion("accordion", "#accordion h4", "#accordion .section"); }); </script>'; $view->render(TRUE); }