Exemple #1
0
 public function new_lang_pack()
 {
     if ($this->is_back()) {
         return false;
     }
     $url = 'http://forum.epesibim.com/';
     $forum_link = "<a target=\"_blank\" href=\"{$url}\">{$url}</a>";
     $info_msg = __('If you wish to add other language or dialect of existing language, then please contact us via forum: %s', array($forum_link));
     print "<div class=\"important_notice\">{$info_msg}</div>";
     $form = $this->init_module('Libs/QuickForm', __('Creating new langpack...'), 'new_langpack');
     $form->addElement('header', null, __('Create new langpack'));
     $form->addElement('select', 'code', __('Language'), Base_Lang_AdministratorCommon::available_new_languages());
     $form->registerRule('check_if_langpack_exists', 'callback', 'check_if_langpack_exists', $this);
     $form->addRule('code', __('Specified langpack already exists'), 'check_if_langpack_exists');
     $form->addRule('code', __('Field required'), 'required');
     if ($form->validate()) {
         Base_LangCommon::new_langpack($form->exportValue('code'));
         $this->unset_module_variable('action');
         return false;
     }
     Base_ActionBarCommon::add('back', __('Cancel'), $this->create_back_href());
     Base_ActionBarCommon::add('save', __('Save'), $form->get_submit_form_href());
     $form->display();
     return true;
 }