2024.8.23
Loading...
Searching...
No Matches
TplAppLang Class Reference

Static Public Member Functions

static getActionSwitchLang ($lang)
 
static getMenuLang ()
 
static process ()
 

Data Fields

const MENU = 'lang'
 

Detailed Description

Class TplAppLang

This class provides methods to generate and manage language-related menu items and actions within the Bearsampp application. It includes functionalities for creating language switch actions and processing language menus.

Definition at line 17 of file class.tpl.app.lang.php.

Member Function Documentation

◆ getActionSwitchLang()

static TplAppLang::getActionSwitchLang ( $lang)
static

Generates the action to switch the application language.

This method creates the action string for switching the application language. It includes commands to reload the application after the language switch. The action string is used to define what happens when the switch language action is triggered.

Parameters
string$langThe language code to switch to.
Returns
string The generated action string for switching the language.

Definition at line 84 of file class.tpl.app.lang.php.

85 {
86 return TplApp::getActionRun(Action::SWITCH_LANG, array($lang)) . PHP_EOL .
88 }
const SWITCH_LANG
static getActionRun($action, $args=array(), $item=array(), $waitUntilTerminated=true)

References TplAppReload\getActionReload(), TplApp\getActionRun(), and Action\SWITCH_LANG.

◆ getMenuLang()

static TplAppLang::getMenuLang ( )
static

Generates the language menu items and associated actions.

This method creates menu items for each available language and defines the actions to be taken when a language menu item is selected. It uses the global language object to retrieve the list of available languages and the current language.

@global object $bearsamppLang Provides language support for retrieving language-specific values.

Returns
string The generated language menu items and actions.

Definition at line 50 of file class.tpl.app.lang.php.

51 {
52 global $bearsamppLang;
53 $items = '';
54 $actions = '';
55
56 foreach ($bearsamppLang->getList() as $lang) {
57 $tplSwitchLang = TplApp::getActionMulti(
58 Action::SWITCH_LANG, array($lang),
59 array(ucfirst($lang), $lang == $bearsamppLang->getCurrent() ? TplAestan::GLYPH_CHECK : ''),
60 false, get_called_class()
61 );
62
63 // Item
64 $items .= $tplSwitchLang[TplApp::SECTION_CALL] . PHP_EOL;
65
66 // Action
67 $actions .= PHP_EOL . $tplSwitchLang[TplApp::SECTION_CONTENT] . PHP_EOL;
68 }
69
70 return $items . $actions;
71 }
global $bearsamppLang
static getActionMulti($action, $args=array(), $item=array(), $disabled=false, $class=false)
const SECTION_CALL
const SECTION_CONTENT

References $bearsamppLang, TplApp\getActionMulti(), TplAestan\GLYPH_CHECK, TplApp\SECTION_CALL, TplApp\SECTION_CONTENT, and Action\SWITCH_LANG.

◆ process()

static TplAppLang::process ( )
static

Processes and generates the language menu.

This method generates the language menu for the application, including the available languages and the actions to be taken when a language is selected.

@global object $bearsamppLang Provides language support for retrieving language-specific values.

Returns
array The generated language menu and actions.

Definition at line 32 of file class.tpl.app.lang.php.

33 {
34 global $bearsamppLang;
35
36 return TplApp::getMenu($bearsamppLang->getValue(Lang::LANG), self::MENU, get_called_class());
37 }
const LANG
static getMenu($caption, $menu, $class)

References $bearsamppLang, TplApp\getMenu(), and Lang\LANG.

Referenced by TplApp\getSectionMenuRight().

+ Here is the caller graph for this function:

Field Documentation

◆ MENU

const TplAppLang::MENU = 'lang'

Definition at line 20 of file class.tpl.app.lang.php.


The documentation for this class was generated from the following file: