コード例 #1
0
 /**
  * Page selector form (use Ajax)
  *
  * @param   integer $id_area Area ID
  * @param   string  $lang language code
  * @return  void
  */
 public function by_page($id_area, $lang)
 {
     // load dictionaries
     $this->dict->get_wordarray(array('form', 'articles'));
     // build form
     $fields = array();
     $fields[] = array('label' => null, 'type' => 'hidden', 'value' => $_SERVER["HTTP_REFERER"], 'name' => 'from');
     $fields[] = array('label' => null, 'type' => 'hidden', 'value' => $id_area, 'name' => 'id_area');
     $fields[] = array('label' => null, 'type' => 'hidden', 'value' => $lang, 'name' => 'lang');
     $mod = new Article_model();
     $fields[] = array('label' => ucfirst(_PAGE), 'type' => 'select', 'value' => '', 'name' => 'id_page', 'options' => array($mod->get_pages($id_area, $lang), 'id', 'name'), 'extra' => 'class="large"');
     // if submitted
     if (X4Route_core::$post) {
         $this->search_list(BASE_URL . 'articles/index/' . $_POST['id_area'] . '/' . $_POST['lang'] . '/by_page/' . $_POST['id_page']);
         die;
     }
     // contents
     $view = new X4View_core('editor');
     $view->title = _BY_PAGE;
     // form builder
     $view->form = X4Form_helper::doform('editor', $_SERVER["REQUEST_URI"], $fields, array(_RESET, _SEARCH, 'buttons'), 'post', '', 'onclick="setForm(\'editor\');"');
     $view->render(TRUE);
 }