public function getForm() { $langid = Common::getPostString('langid', GWF_Language::getEnglish()->getID()); require_once GWF_CORE_PATH . 'module/Category/GWF_CategorySelect.php'; //key => array(TYPE, default, text, classname) // GWF_Language::setShowSupported(true); $data = array('langid' => array(GWF_Form::SELECT, GWF_LangSelect::single(GWF_Language::SUPPORTED, 'langid', $langid), $this->module->lang('th_langid')), 'catid' => array(GWF_Form::SELECT, GWF_CategorySelect::single('catid', Common::getPostString('catid', '1'), 0), $this->module->lang('th_category')), 'title' => array(GWF_Form::STRING, '', $this->module->lang('th_title')), 'message' => array(GWF_Form::MESSAGE, '', $this->module->lang('th_message')), 'div1' => array(GWF_Form::DIVIDER), 'div2' => array(GWF_Form::DIVIDER), 'preview' => array(GWF_Form::SUBMIT, $this->module->lang('btn_preview'), ''), 'add' => array(GWF_Form::SUBMIT, $this->module->lang('btn_add'), '')); return new GWF_Form($this, $data); }
private function formAdd() { $mod_cat = GWF_Module::loadModuleDB('Category', true, true); $data = array(); $data['url'] = array(GWF_Form::STRING, '', $this->module->lang('th_url')); $data['type'] = array(GWF_Form::SELECT, GWF_PageType::select($this->module), $this->module->lang('th_type')); $data['lang'] = array(GWF_Form::SELECT, GWF_LangSelect::single(1, 'lang'), $this->module->lang('th_lang')); $data['groups'] = array(GWF_Form::SELECT_A, GWF_GroupSelect::multi('groups', true, true, true), $this->module->lang('th_groups')); $data['noguests'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_noguests')); if ($this->is_author) { $data['index'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_index')); $data['follow'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_follow')); $data['sitemap'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_in_sitemap')); } $data['title'] = array(GWF_Form::STRING, '', $this->module->lang('th_title')); if ($mod_cat !== false) { $data['cat'] = array(GWF_Form::SELECT, GWF_CategorySelect::single('cat', Common::getPostString('cat')), $this->module->lang('th_cat')); } $data['descr'] = array(GWF_Form::STRING, '', $this->module->lang('th_descr')); $data['tags'] = array(GWF_Form::STRING, '', $this->module->lang('th_tags')); $data['show_author'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_author')); $data['show_similar'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_similar')); $data['show_modified'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_modified')); $data['show_trans'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_trans')); $data['show_comments'] = array(GWF_Form::CHECKBOX, true, $this->module->lang('th_show_comments')); if ($this->is_author) { $data['home_page'] = array(GWF_Form::CHECKBOX, false, $this->module->lang('th_home_page')); } $data['file'] = array(GWF_Form::FILE_OPT, '', $this->module->lang('th_file')); $data['upload'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_upload')); if ($this->is_author) { $data['inline_css'] = array(GWF_Form::MESSAGE_NOBB, '', $this->module->lang('th_inline_css')); } $data['content'] = array(GWF_Form::MESSAGE_NOBB, '', $this->module->lang('th_content')); $buttons = array('preview' => $this->module->lang('btn_preview'), 'add' => $this->module->lang('btn_add')); $data['buttons'] = array(GWF_Form::SUBMITS, $buttons); return new GWF_Form($this, $data); }
private function formEdit() { $mod_cat = GWF_Module::loadModuleDB('Category', true, true); $page = $this->page; $user = $this->user; $data = array(); $data['url'] = array(GWF_Form::STRING, $page->getVar('page_url'), $this->module->lang('th_url')); // if ($this->is_author) // { $data['type'] = array(GWF_Form::SELECT, GWF_PageType::select($this->module, $page->getMode()), $this->module->lang('th_type')); // } if ($this->is_oowner) { $data['groups'] = array(GWF_Form::SELECT_A, GWF_GroupSelect::multi('groups', $this->getSelectedGroups($page), true, true), $this->module->lang('th_groups')); } $data['noguests'] = array(GWF_Form::CHECKBOX, $page->isLoginRequired(), $this->module->lang('th_noguests')); if ($this->is_author) { $data['index'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::INDEXED), $this->module->lang('th_index')); $data['follow'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::FOLLOW), $this->module->lang('th_follow')); $data['sitemap'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::IN_SITEMAP), $this->module->lang('th_in_sitemap')); } $data['enabled'] = array(GWF_Form::CHECKBOX, $page->isEnabled(), $this->module->lang('th_enabled')); $data['title'] = array(GWF_Form::STRING, $page->getVar('page_title'), $this->module->lang('th_title')); if ($mod_cat !== false) { $data['cat'] = array(GWF_Form::SELECT, GWF_CategorySelect::single('cat', Common::getPostString('cat')), $this->module->lang('th_cat')); } $data['descr'] = array(GWF_Form::STRING, $page->getVar('page_meta_desc'), $this->module->lang('th_descr')); $data['tags'] = array(GWF_Form::STRING, trim($page->getVar('page_meta_tags'), ','), $this->module->lang('th_tags')); $data['show_author'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_AUTHOR), $this->module->lang('th_show_author')); $data['show_similar'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_SIMILAR), $this->module->lang('th_show_similar')); $data['show_modified'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_MODIFIED), $this->module->lang('th_show_modified')); $data['show_trans'] = array(GWF_Form::CHECKBOX, $page->isOptionEnabled(GWF_Page::SHOW_TRANS), $this->module->lang('th_show_trans')); $data['show_comments'] = array(GWF_Form::CHECKBOX, $page->wantComments(), $this->module->lang('th_show_comments')); if ($this->is_author) { $data['home_page'] = array(GWF_Form::CHECKBOX, $this->module->cfgHomePage() === $page->getOtherID(), $this->module->lang('th_home_page')); } $data['file'] = array(GWF_Form::FILE_OPT, '', $this->module->lang('th_file')); $data['upload'] = array(GWF_Form::SUBMIT, $this->module->lang('btn_upload')); if ($this->is_author) { $data['inline_css'] = array(GWF_Form::MESSAGE_NOBB, $page->getVar('page_inline_css'), $this->module->lang('th_inline_css')); } if ($page->getMode() === GWF_Page::BBCODE) { $data['content'] = array(GWF_Form::MESSAGE, $page->getVar('page_content'), $this->module->lang('th_content')); } else { $data['content'] = array(GWF_Form::MESSAGE_NOBB, $page->getVar('page_content'), $this->module->lang('th_content')); } $buttons = array('edit' => $this->module->lang('btn_edit'), 'translate' => $this->module->lang('btn_translate')); if ($this->is_author && $page->isLocked()) { $buttons['unlock'] = $this->module->lang('btn_unlock'); } $buttons['delete'] = $this->module->lang('btn_delete'); $data['buttons'] = array(GWF_Form::SUBMITS, $buttons); return new GWF_Form($this, $data); }