当前位置: 首页>>代码示例>>PHP>>正文


PHP Jaws_Utils::GetLanguagesList方法代码示例

本文整理汇总了PHP中Jaws_Utils::GetLanguagesList方法的典型用法代码示例。如果您正苦于以下问题:PHP Jaws_Utils::GetLanguagesList方法的具体用法?PHP Jaws_Utils::GetLanguagesList怎么用?PHP Jaws_Utils::GetLanguagesList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Jaws_Utils的用法示例。


在下文中一共展示了Jaws_Utils::GetLanguagesList方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Display

 /**
  * Builds the upgader page.
  *
  * @access  public
  * @return  string A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Introduction/templates');
     $tpl->SetBlock('Introduction');
     $tpl->SetVariable('welcome', _t('UPGRADE_INTRO_WELCOME'));
     $tpl->SetVariable('title_info', _t('UPGRADE_INTRO_UPGRADER'));
     $tpl->SetVariable('db_info', _t('UPGRADE_INTRO_DATABASE'));
     $tpl->SetVariable('ftp_info', _t('UPGRADE_INTRO_FTP'));
     $tpl->SetVariable('language', _t('GLOBAL_LANGUAGE'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     if (is_writable(JAWS_PATH . 'data/logs') && is_dir(JAWS_PATH . 'data/logs')) {
         $tpl->SetVariable('log_use', _t('UPGRADE_INTRO_LOG', 'data/logs/upgrade.txt'));
         $tpl->SetBlock('Introduction/logcheckbox');
         $tpl->ParseBlock('Introduction/logcheckbox');
     } else {
         $tpl->SetVariable('log_use', _t('UPGRADE_INTRO_LOG_ERROR', 'data/logs'));
     }
     $langs = Jaws_Utils::GetLanguagesList();
     $selected_lang = isset($_SESSION['upgrade']['language']) ? $_SESSION['upgrade']['language'] : 'en';
     foreach ($langs as $code => $fullname) {
         $tpl->SetBlock('Introduction/lang');
         $tpl->SetVariable('selected', $code == $selected_lang ? 'selected="selected"' : '');
         $tpl->SetVariable('code', $code);
         $tpl->SetVariable('fullname', $fullname);
         $tpl->ParseBlock('Introduction/lang');
     }
     $tpl->ParseBlock('Introduction');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:36,代码来源:Introduction.php

示例2: Display

 /**
  * Builds the installer page.
  *
  * @access  public
  * @return  string      A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $values = $this->_Fields;
     $keys = array_keys($values);
     $request = Jaws_Request::getInstance();
     $post = $request->fetch($keys, 'post');
     foreach ($this->_Fields as $key => $value) {
         if ($post[$key] !== null) {
             $values[$key] = $post[$key];
         }
     }
     $data = array();
     if (isset($_SESSION['install']['data']['Settings'])) {
         $data = $_SESSION['install']['data']['Settings'];
     }
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Settings/templates');
     $tpl->SetBlock('Settings');
     $tpl->setVariable('lbl_info', _t('INSTALL_SETTINGS_INFO'));
     $tpl->setVariable('lbl_site_name', _t('INSTALL_SETTINGS_SITE_NAME'));
     $tpl->setVariable('site_name_info', _t('INSTALL_SETTINGS_SITE_NAME_INFO'));
     $tpl->setVariable('lbl_site_slogan', _t('INSTALL_SETTINGS_SLOGAN'));
     $tpl->setVariable('site_slogan_info', _t('INSTALL_SETTINGS_SLOGAN_INFO'));
     $tpl->setVariable('lbl_site_language', _t('INSTALL_SETTINGS_SITE_LANGUAGE'));
     $tpl->setVariable('site_language_info', _t('INSTALL_SETTINGS_SITE_LANGUAGE_INFO'));
     $tpl->setVariable('lbl_site_sample', _t('INSTALL_SETTINGS_SITE_SAMPLE'));
     $tpl->setVariable('site_sample_info', _t('INSTALL_SETTINGS_SITE_SAMPLE_INFO'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $tpl->SetVariable('site_name', $values['site_name']);
     $tpl->SetVariable('site_slogan', $values['site_slogan']);
     // fill languages combo box
     $languages = Jaws_Utils::GetLanguagesList();
     foreach ($languages as $k => $v) {
         $tpl->SetBlock('Settings/lang');
         $tpl->setVariable('code', $k);
         $tpl->setVariable('title', $v);
         if ($values['site_language'] == $k) {
             $tpl->setVariable('selected', 'selected="selected"');
         } else {
             $tpl->setVariable('selected', '');
         }
         $tpl->ParseBlock('Settings/lang');
     }
     $tpl->ParseBlock('Settings');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:52,代码来源:Settings.php

示例3: Execute

 /**
  * Get user's preferences of this gadget
  *
  * @access  public
  * @return  array   Formatted array for using in Users Preferences action
  */
 function Execute()
 {
     $result = array();
     $languages = Jaws_Utils::GetLanguagesList();
     $objSettings = $this->gadget->model->loadAdmin('Settings');
     $objComponents = Jaws_Gadget::getInstance('Components')->model->load('Gadgets');
     $gadgets = $objComponents->GetGadgetsList(null, true, true, null, true);
     $gadgets = array_column(array_values($gadgets), 'title', 'name');
     array_unshift($gadgets, _t('GLOBAL_NOGADGET'));
     $result['admin_language'] = array('title' => _t('SETTINGS_ADMIN_LANGUAGE'), 'values' => $languages, 'ltr' => true);
     $result['site_language'] = array('title' => _t('SETTINGS_DEFAULT_SITE_LANGUAGE'), 'values' => $languages, 'ltr' => true);
     $result['calendar'] = array('title' => _t('SETTINGS_CALENDAR'), 'values' => $objSettings->GetCalendarList());
     $result['date_format'] = array('title' => _t('SETTINGS_DATE_FORMAT'), 'values' => $objSettings->GetDateFormatList());
     $result['main_gadget'] = array('title' => _t('SETTINGS_MAIN_GADGET'), 'values' => $gadgets);
     $result['editor'] = array('title' => _t('SETTINGS_EDITOR'), 'values' => $objSettings->GetEditorList());
     $result['timezone'] = array('title' => _t('GLOBAL_TIMEZONE'), 'values' => $objSettings->GetTimeZonesList(), 'ltr' => true);
     return $result;
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:24,代码来源:Preferences.php

示例4: Display

 /**
  * Builds the installer page.
  *
  * @access  public
  * @return  string      A block of valid XHTML to display an introduction and form.
  */
 function Display()
 {
     $tpl = new Jaws_Template(false, false);
     $tpl->Load('display.html', 'stages/Introduction/templates');
     $tpl->SetBlock('Introduction');
     $tpl->SetVariable('welcome', _t('INSTALL_INTRO_WELCOME'));
     $tpl->SetVariable('title_info', _t('INSTALL_INTRO_INSTALLER'));
     $tpl->SetVariable('db_info', _t('INSTALL_INTRO_DATABASE'));
     $tpl->SetVariable('ftp_info', _t('INSTALL_INTRO_FTP'));
     $tpl->SetVariable('mail_info', _t('INSTALL_INTRO_MAIL'));
     $tpl->SetVariable('language', _t('GLOBAL_LANGUAGE'));
     $tpl->SetVariable('next', _t('GLOBAL_NEXT'));
     $langs = Jaws_Utils::GetLanguagesList();
     $selected_lang = isset($_SESSION['install']['language']) ? $_SESSION['install']['language'] : 'en';
     foreach ($langs as $code => $fullname) {
         $tpl->SetBlock('Introduction/lang');
         $tpl->SetVariable('selected', $code == $selected_lang ? 'selected="selected"' : '');
         $tpl->SetVariable('code', $code);
         $tpl->SetVariable('fullname', $fullname);
         $tpl->ParseBlock('Introduction/lang');
     }
     $tpl->ParseBlock('Introduction');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:30,代码来源:Introduction.php

示例5: CreateForm

 /**
  * Builds a pre-filled form
  *
  * @access  private
  * @param   string      $title          Page title
  * @param   string      $fast_url       Fast URL
  * @param   string      $meta_keys      Meta keywords
  * @param   string      $meta_desc      Meta description
  * @param   string      $tags           Tags (comma separated)
  * @param   string      $content        Page content
  * @param   bool        $published      Whether 'published' is checked or not
  * @param   bool        $show_title     Whether 'show_title' is checked or not
  * @param   string      $language       Page language
  * @param   int         $id             Page ID
  * @param   int         $gid            Group ID
  * @param   string      $action         The action to perform on page submit
  * @param   string      $mode           The mode we are using (base by default or translation)
  * @return  string      XHTML form
  */
 function CreateForm($title, $fast_url, $meta_keys, $meta_desc, $tags, $content, $published, $show_title, $language, $id, $gid, $action, $mode = 'base')
 {
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('StaticPage.html');
     $tpl->SetBlock('pageform');
     $m_action = jaws()->request->fetch('action', 'get');
     $tpl->SetVariable('menubar', $this->MenuBar($m_action));
     $pageform =& Piwi::CreateWidget('Form', BASE_SCRIPT, 'post');
     $pageform->Add(Piwi::CreateWidget('HiddenEntry', 'gadget', 'StaticPage'));
     $pageform->Add(Piwi::CreateWidget('HiddenEntry', 'action', $action));
     if ($action == 'SaveEditTranslation') {
         $pageform->Add(Piwi::CreateWidget('HiddenEntry', 'trans_id', $id));
     } else {
         $pageform->Add(Piwi::CreateWidget('HiddenEntry', 'page', $id));
     }
     $vBox =& Piwi::CreateWidget('VBox');
     $vBox->SetId('page_options');
     $vBox->SetStyle('display:inline;');
     $titleentry =& Piwi::CreateWidget('Entry', 'title', $title);
     $titleentry->SetTitle(_t('GLOBAL_TITLE'));
     $vBox->Add($titleentry);
     // Group
     if ($mode == 'base') {
         $model = $this->gadget->model->load('Group');
         $groups = $model->GetGroups();
         $combo =& Piwi::CreateWidget('Combo', 'group_id');
         foreach ($groups as $group) {
             if (!$this->gadget->GetPermission('AccessGroup', $group['id'])) {
                 continue;
             }
             $combo->AddOption($group['title'], $group['id']);
         }
         $combo->SetTitle(_t('STATICPAGE_GROUP'));
         $combo->SetDefault($gid);
         $vBox->Add($combo);
     }
     // Status
     $published = $published === true ? 1 : 0;
     $statCombo =& Piwi::CreateWidget('Combo', 'published');
     $statCombo->AddOption(_t('STATICPAGE_DRAFT'), '0');
     $statCombo->AddOption(_t('STATICPAGE_PUBLISHED'), '1');
     $statCombo->SetDefault($published);
     $statCombo->setTitle(_t('STATICPAGE_STATUS'));
     $vBox->Add($statCombo);
     if ($mode == 'base') {
         //show title
         $show_title = $show_title == true ? 1 : 0;
         $titleShowCombo =& Piwi::CreateWidget('Combo', 'show_title');
         $titleShowCombo->AddOption(_t('GLOBAL_YES'), '1');
         $titleShowCombo->AddOption(_t('GLOBAL_NO'), '0');
         $titleShowCombo->SetDefault($show_title);
         $titleShowCombo->setTitle(_t('STATICPAGE_SHOW_TITLE'));
         $vBox->Add($titleShowCombo);
     }
     $language = empty($language) ? $this->gadget->registry->fetch('site_language', 'Settings') : $language;
     $languageCombo =& Piwi::CreateWidget('Combo', 'language');
     //Load the Settings AdminModel to get a list of all available languages
     $languages = Jaws_Utils::GetLanguagesList();
     foreach ($languages as $langCode => $langName) {
         $languageCombo->AddOption($langName, $langCode);
     }
     $languageCombo->SetDefault($language);
     $languageCombo->setTitle(_t('STATICPAGE_PAGE_LANGUAGE'));
     $vBox->Add($languageCombo);
     // Advanced Options
     $btnAdvanced =& Piwi::CreateWidget('Button', 'btn_advanced', _t('STATICPAGE_ADVANCED_OPTIONS'));
     $btnAdvanced->AddEvent(ON_CLICK, "javascript:\$('#advanced_options').show(); \$(this).hide();");
     $advBox =& Piwi::CreateWidget('VBox');
     $advBox->SetId('advanced_options');
     $advBox->SetStyle('display:none;');
     // Fast URL
     if ($mode == 'base') {
         $fasturlentry =& Piwi::CreateWidget('Entry', 'fast_url', $fast_url);
         $fasturlentry->SetTitle(_t('STATICPAGE_FASTURL'));
         $fasturlentry->SetStyle('direction:ltr;');
         $advBox->Add($fasturlentry);
     }
     // Meta Keywords
     $metaKeysEntry =& Piwi::CreateWidget('Entry', 'meta_keys', $meta_keys);
     $metaKeysEntry->SetTitle(_t('GLOBAL_META_KEYWORDS'));
     $advBox->Add($metaKeysEntry);
//.........这里部分代码省略.........
开发者ID:Dulciane,项目名称:jaws,代码行数:101,代码来源:Default.php

示例6: ManagePages

 /**
  * Builds the gadget administration UI
  *
  * @access  public
  * @return  string  XHTML content
  */
 function ManagePages()
 {
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('StaticPage.html');
     $tpl->SetBlock('static_page');
     $tpl->SetVariable('base_script', BASE_SCRIPT);
     $action = jaws()->request->fetch('action', 'get');
     $tpl->SetVariable('menubar', $this->MenuBar($action));
     $tpl->SetVariable('grid', $this->DataGrid());
     $toolBar =& Piwi::CreateWidget('HBox');
     $deleteAll =& Piwi::CreateWidget('Button', 'deleteAllPages', _t('GLOBAL_DELETE'), STOCK_DELETE);
     $deleteAll->AddEvent(ON_CLICK, "javascript:massiveDelete();");
     $toolBar->Add($deleteAll);
     $tpl->SetVariable('tools', $toolBar->Get());
     $tpl->SetVariable('confirmPageDelete', _t('GLOBAL_CONFIRM_DELETE', _t('STATICPAGE_PAGE')));
     $tpl->SetVariable('confirmMassiveDelete', _t('STATICPAGE_CONFIRM_MASIVE_DELETE_PAGE'));
     // Language filter
     $language = '';
     $languageCombo =& Piwi::CreateWidget('Combo', 'language');
     $languageCombo->setId('language');
     $languageCombo->AddOption(' ', '');
     $languages = Jaws_Utils::GetLanguagesList();
     foreach ($languages as $langCode => $langName) {
         $languageCombo->AddOption($langName, $langCode);
     }
     $languageCombo->SetDefault($language);
     $languageCombo->AddEvent(ON_CHANGE, 'javascript:searchPage();');
     $tpl->SetVariable('language', _t('STATICPAGE_PAGE_LANGUAGE'));
     $tpl->SetVariable('language_field', $languageCombo->Get());
     // Group filter
     $model = $this->gadget->model->load('Group');
     $groups = $model->GetGroups();
     $combo =& Piwi::CreateWidget('Combo', 'group');
     $combo->AddOption(' ', 0);
     foreach ($groups as $group) {
         $combo->AddOption($group['title'], $group['id']);
     }
     $combo->AddEvent(ON_CHANGE, 'searchPage();');
     $tpl->SetVariable('group_field', $combo->Get());
     $tpl->SetVariable('group', _t('STATICPAGE_GROUP'));
     //Status filter
     $status = '';
     $statusCombo =& Piwi::CreateWidget('Combo', 'status');
     $statusCombo->setId('status');
     $statusCombo->AddOption(' ', '');
     $statusCombo->AddOption(_t('STATICPAGE_PUBLISHED'), '1');
     $statusCombo->AddOption(_t('STATICPAGE_DRAFT'), '0');
     $statusCombo->SetDefault($status);
     $statusCombo->AddEvent(ON_CHANGE, 'javascript:searchPage();');
     $tpl->SetVariable('status', _t('STATICPAGE_STATUS'));
     $tpl->SetVariable('status_field', $statusCombo->Get());
     //Order by filter
     $status = '';
     $orderCombo =& Piwi::CreateWidget('Combo', 'orderby');
     $orderCombo->setId('orderby');
     $orderCombo->AddOption(_t('GLOBAL_CREATETIME') . ' ↑', 0);
     $orderCombo->AddOption(_t('GLOBAL_CREATETIME') . ' ↓', 1);
     $orderCombo->AddOption(_t('GLOBAL_TITLE') . ' ↑', 2);
     $orderCombo->AddOption(_t('GLOBAL_TITLE') . ' ↓', 3);
     $orderCombo->AddOption(_t('GLOBAL_UPDATETIME') . ' ↑', 4);
     $orderCombo->AddOption(_t('GLOBAL_UPDATETIME') . ' ↓', 5);
     $orderCombo->SetDefault(1);
     $orderCombo->AddEvent(ON_CHANGE, 'javascript:searchPage();');
     $tpl->SetVariable('orderby', _t('STATICPAGE_ORDERBY'));
     $tpl->SetVariable('orderby_field', $orderCombo->Get());
     // Free text search
     $searchButton =& Piwi::CreateWidget('Button', 'searchButton', _t('GLOBAL_SEARCH'), STOCK_SEARCH);
     $searchButton->AddEvent(ON_CLICK, 'javascript:searchPage();');
     $tpl->SetVariable('search', $searchButton->Get());
     $search = '';
     $searchEntry =& Piwi::CreateWidget('Entry', 'search', $search);
     $searchEntry->SetStyle('zwidth: 100%;');
     $tpl->SetVariable('search_field', $searchEntry->Get());
     $tpl->SetVariable('entries', $this->Datagrid());
     $tpl->ParseBlock('static_page');
     return $tpl->Get();
 }
开发者ID:Dulciane,项目名称:jaws,代码行数:83,代码来源:Page.php

示例7: BasicSettings

 /**
  * Displays general/basic settings form
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function BasicSettings()
 {
     $this->gadget->CheckPermission('BasicSettings');
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('Settings.html');
     $tpl->SetBlock('settings');
     $tpl->SetVariable('base_script', BASE_SCRIPT);
     $tpl->SetVariable('sidebar', $this->SideBar('Basic'));
     $tpl->SetVariable('legend', _t('SETTINGS_BASIC_SETTINGS'));
     $saveButton =& Piwi::CreateWidget('Button', 'save', _t('GLOBAL_SAVE'), STOCK_SAVE);
     $saveButton->AddEvent(ON_CLICK, 'javascript:submitBasicForm();');
     $tpl->SetVariable('saveButton', $saveButton->Get());
     // site status
     $site_status =& Piwi::CreateWidget('Combo', 'site_status');
     $site_status->setID('site_status');
     $tpl->SetBlock('settings/item');
     $site_status->AddOption(_t('GLOBAL_DISABLED'), 'disabled');
     $site_status->AddOption(_t('GLOBAL_ENABLED'), 'enabled');
     $site_status->SetDefault($this->gadget->registry->fetch('site_status'));
     $tpl->SetVariable('field-name', 'site_status');
     $tpl->SetVariable('label', _t('SETTINGS_SITE_STATUS'));
     $tpl->SetVariable('field', $site_status->Get());
     $tpl->ParseBlock('settings/item');
     // Site name
     $tpl->SetBlock('settings/item');
     $sitename =& Piwi::CreateWidget('Entry', 'site_name', Jaws_XSS::defilter($this->gadget->registry->fetch('site_name')));
     $sitename->setID('site_name');
     $tpl->SetVariable('field-name', 'site_name');
     $tpl->SetVariable('label', _t('SETTINGS_SITE_NAME'));
     $tpl->SetVariable('field', $sitename->Get());
     $tpl->ParseBlock('settings/item');
     // Site slogan
     $tpl->SetBlock('settings/item');
     $sitedesc =& Piwi::CreateWidget('Entry', 'site_slogan', Jaws_XSS::defilter($this->gadget->registry->fetch('site_slogan')));
     $sitedesc->setID('site_slogan');
     $tpl->SetVariable('field-name', 'site_slogan');
     $tpl->SetVariable('label', _t('SETTINGS_SITE_SLOGAN'));
     $tpl->SetVariable('field', $sitedesc->Get());
     $tpl->ParseBlock('settings/item');
     // site language
     $lang =& Piwi::CreateWidget('Combo', 'site_language');
     $lang->setID('site_language');
     $tpl->SetBlock('settings/item');
     $languages = Jaws_Utils::GetLanguagesList();
     foreach ($languages as $k => $v) {
         $lang->AddOption($v, $k);
     }
     $lang->SetDefault($this->gadget->registry->fetch('site_language'));
     $tpl->SetVariable('field-name', 'site_language');
     $tpl->SetVariable('label', _t('SETTINGS_DEFAULT_SITE_LANGUAGE'));
     $tpl->SetVariable('field', $lang->Get());
     $tpl->ParseBlock('settings/item');
     // admin language
     $lang =& Piwi::CreateWidget('Combo', 'admin_language');
     $lang->setID('admin_language');
     $tpl->SetBlock('settings/item');
     foreach ($languages as $k => $v) {
         $lang->AddOption($v, $k);
     }
     $lang->SetDefault($this->gadget->registry->fetch('admin_language'));
     $tpl->SetVariable('field-name', 'admin_language');
     $tpl->SetVariable('label', _t('SETTINGS_ADMIN_LANGUAGE'));
     $tpl->SetVariable('field', $lang->Get());
     $tpl->ParseBlock('settings/item');
     // Main gadget
     $cmpModel = Jaws_Gadget::getInstance('Components')->model->load('Gadgets');
     $installedgadgets = $cmpModel->GetGadgetsList(null, true, true, true);
     $gdt =& Piwi::CreateWidget('Combo', 'main_gadget');
     $gdt->setID('main_gadget');
     $tpl->SetBlock('settings/item');
     $gdt->AddOption(_t('GLOBAL_NOGADGET'), '');
     foreach ($installedgadgets as $g => $tg) {
         $gdt->AddOption($tg['title'], $g);
     }
     $gdt->SetDefault($this->gadget->registry->fetch('main_gadget'));
     $tpl->SetVariable('field-name', 'main_gadget');
     $tpl->SetVariable('label', _t('SETTINGS_MAIN_GADGET'));
     $tpl->SetVariable('field', $gdt->Get());
     $tpl->ParseBlock('settings/item');
     // Site email
     $tpl->SetBlock('settings/item');
     $siteemail =& Piwi::CreateWidget('Entry', 'site_email', $this->gadget->registry->fetch('site_email'));
     $siteemail->setID('site_email');
     $tpl->SetVariable('field-name', 'site_email');
     $tpl->SetVariable('label', _t('SETTINGS_SITE_EMAIL'));
     $tpl->SetVariable('field', $siteemail->Get());
     $tpl->ParseBlock('settings/item');
     // Site comment
     $tpl->SetBlock('settings/item');
     $sitecomment =& Piwi::CreateWidget('TextArea', 'site_comment', Jaws_XSS::defilter($this->gadget->registry->fetch('site_comment')));
     $sitecomment->SetRows(4);
     $sitecomment->setID('site_comment');
     $tpl->SetVariable('field-name', 'site_comment');
     $tpl->SetVariable('label', _t('SETTINGS_SITE_COMMENT'));
//.........这里部分代码省略.........
开发者ID:Dulciane,项目名称:jaws,代码行数:101,代码来源:Basic.php

示例8: Languages

 /**
  * Calls default action(MainMenu)
  *
  * @access  public
  * @return  string  XHTML template content
  */
 function Languages()
 {
     $this->AjaxMe('script.js');
     $tpl = $this->gadget->template->loadAdmin('Languages.html');
     $tpl->SetBlock('Languages');
     $tpl->SetVariable('language', _t('LANGUAGES_LANGUAGE'));
     $tpl->SetVariable('component', _t('LANGUAGES_COMPONENT'));
     $tpl->SetVariable('settings', _t('LANGUAGES_SETTINGS'));
     $tpl->SetVariable('from', _t('GLOBAL_FROM'));
     $tpl->SetVariable('to', _t('GLOBAL_TO'));
     $tpl->SetVariable('base_script', BASE_SCRIPT);
     $btnExport =& Piwi::CreateWidget('Button', 'btn_export', _t('LANGUAGES_LANGUAGE_EXPORT'), STOCK_DOWN);
     $btnExport->AddEvent(ON_CLICK, 'javascript:export_lang();');
     $tpl->SetVariable('btn_export', $btnExport->Get());
     $tpl->SetBlock('Languages/properties');
     $langId =& Piwi::CreateWidget('Entry', 'lang_code', '');
     $tpl->SetVariable('lang_code', $langId->Get());
     $tpl->SetVariable('lbl_lang_code', _t('LANGUAGES_LANGUAGE_CODE'));
     $langName =& Piwi::CreateWidget('Entry', 'lang_name', '');
     $tpl->SetVariable('lang_name', $langName->Get());
     $tpl->SetVariable('lbl_lang_name', _t('LANGUAGES_LANGUAGE_NAME'));
     if ($this->gadget->GetPermission('ModifyLanguageProperties')) {
         $btnLang =& Piwi::CreateWidget('Button', 'btn_lang', '', STOCK_SAVE);
         $btnLang->AddEvent(ON_CLICK, 'javascript:save_lang();');
         $tpl->SetVariable('btn_lang', $btnLang->Get());
     }
     $tpl->ParseBlock('Languages/properties');
     $tpl->SetVariable('confirmSaveData', _t('LANGUAGES_SAVEDATA'));
     $tpl->SetVariable('add_language_title', _t('LANGUAGES_LANGUAGE_ADD'));
     $tpl->SetVariable('save_language_title', _t('LANGUAGES_LANGUAGE_SAVE'));
     // Langs
     $use_data_lang = $this->gadget->registry->fetch('use_data_lang') == 'true';
     $langs = Jaws_Utils::GetLanguagesList($use_data_lang);
     $tpl->SetBlock('Languages/lang');
     $tpl->SetVariable('selected', '');
     $tpl->SetVariable('code', '');
     $tpl->SetVariable('fullname', _t('LANGUAGES_LANGUAGE_NEW'));
     $tpl->ParseBlock('Languages/lang');
     foreach ($langs as $code => $fullname) {
         $tpl->SetBlock('Languages/lang');
         $tpl->SetVariable('selected', $code == 'en' ? 'selected="selected"' : '');
         $tpl->SetVariable('code', $code);
         $tpl->SetVariable('fullname', $fullname);
         $tpl->ParseBlock('Languages/lang');
     }
     // Global, Install, Upgrade
     $model = $this->gadget->model->loadAdmin('Languages');
     $globals = array(0 => 'Global', 4 => 'Install', 5 => 'Upgrade');
     $tpl->SetBlock('Languages/group');
     $tpl->SetVariable('group', 'Global');
     foreach ($globals as $k => $v) {
         $tpl->SetBlock('Languages/group/item');
         $tpl->SetVariable('key', "{$k}|{$v}");
         $tpl->SetVariable('value', $v);
         $tpl->ParseBlock('Languages/group/item');
     }
     $tpl->ParseBlock('Languages/group');
     // Gadgets
     $tpl->SetBlock('Languages/group');
     $tpl->SetVariable('group', 'Gadgets');
     $gCompModel = Jaws_Gadget::getInstance('Components')->model->load('Gadgets');
     $gadgets = $gCompModel->GetGadgetsList();
     ksort($gadgets);
     foreach ($gadgets as $gadget => $gInfo) {
         $tpl->SetBlock('Languages/group/item');
         $tpl->SetVariable('key', "1|{$gadget}");
         $tpl->SetVariable('value', $gadget);
         $tpl->ParseBlock('Languages/group/item');
     }
     $tpl->ParseBlock('Languages/group');
     // Plugins
     $tpl->SetBlock('Languages/group');
     $tpl->SetVariable('group', 'Plugins');
     $pCompModel = Jaws_Gadget::getInstance('Components')->model->load('Plugins');
     $plugins = $pCompModel->GetPluginsList();
     foreach ($plugins as $plugin => $pInfo) {
         $tpl->SetBlock('Languages/group/item');
         $tpl->SetVariable('key', "2|{$plugin}");
         $tpl->SetVariable('value', $plugin);
         $tpl->ParseBlock('Languages/group/item');
     }
     $tpl->ParseBlock('Languages/group');
     $tpl->SetBlock('Languages/buttons');
     //checkbox_filter
     $check_filter =& Piwi::CreateWidget('CheckButtons', 'checkbox_filter');
     $check_filter->AddEvent(ON_CLICK, 'javascript:filterTranslated();');
     $check_filter->AddOption(_t('LANGUAGES_NOT_SHOW_TRANSLATED'), '', 'checkbox_filter');
     $tpl->SetVariable('checkbox_filter', $check_filter->Get());
     $cancel_btn =& Piwi::CreateWidget('Button', 'btn_cancel', _t('GLOBAL_CANCEL'), STOCK_CANCEL);
     $cancel_btn->AddEvent(ON_CLICK, 'javascript:stopAction();');
     $cancel_btn->SetStyle('visibility: hidden;');
     $tpl->SetVariable('cancel', $cancel_btn->Get());
     $save_btn =& Piwi::CreateWidget('Button', 'btn_save', _t('GLOBAL_SAVE', _t('LANGUAGES_CHANGES')), STOCK_SAVE);
     $save_btn->AddEvent(ON_CLICK, 'javascript:save_lang_data();');
//.........这里部分代码省略.........
开发者ID:Dulciane,项目名称:jaws,代码行数:101,代码来源:Languages.php


注:本文中的Jaws_Utils::GetLanguagesList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。