2024.8.23
Loading...
Searching...
No Matches
class.tpl.app.logsVerbose.php
Go to the documentation of this file.
1<?php
2/*
3 * Copyright (c) 2021-2024 Bearsampp
4 * License: GNU General Public License version 3 or later; see LICENSE.txt
5 * Author: bear
6 * Website: https://bearsampp.com
7 * Github: https://github.com/Bearsampp
8 */
9
10/**
11 * Class TplAppLogsVerbose
12 *
13 * This class provides methods to generate and manage the logs verbosity menu and actions
14 * within the Bearsampp application. It includes functionalities for creating the logs verbosity
15 * menu and processing actions to switch the logs verbosity level.
16 */
18{
19 // Constant for the logs verbosity menu identifier
20 const MENU = 'logsVerbose';
21
22 /**
23 * Generates the logs verbosity menu.
24 *
25 * This method creates a menu for selecting the logs verbosity level. It uses the global language
26 * object to retrieve the localized string for the logs verbosity menu.
27 *
28 * @global object $bearsamppLang Provides language support for retrieving language-specific values.
29 *
30 * @return array The generated menu for selecting the logs verbosity level.
31 */
32 public static function process()
33 {
34 global $bearsamppLang;
35
36 return TplApp::getMenu($bearsamppLang->getValue(Lang::LOGS_VERBOSE), self::MENU, get_called_class());
37 }
38
39 /**
40 * Generates the menu items and actions for switching logs verbosity levels.
41 *
42 * This method creates menu items for each verbosity level and defines the actions to be taken
43 * when a verbosity level is selected. It uses the global language object to retrieve the localized
44 * strings for each verbosity level and the global configuration object to get the current verbosity level.
45 *
46 * @global object $bearsamppLang Provides language support for retrieving language-specific values.
47 * @global object $bearsamppConfig Provides access to the application's configuration settings.
48 *
49 * @return string The generated menu items and actions for switching logs verbosity levels.
50 */
51 public static function getMenuLogsVerbose()
52 {
54
55 $items = '';
56 $actions = '';
57
58 $verboses = array(
63 );
64
65 foreach ($verboses as $verbose => $caption) {
66 $tplSwitchLogsVerbose = TplApp::getActionMulti(
67 Action::SWITCH_LOGS_VERBOSE, array($verbose),
68 array($caption, $verbose == $bearsamppConfig->getLogsVerbose() ? TplAestan::GLYPH_CHECK : ''),
69 false, get_called_class()
70 );
71
72 // Item
73 $items .= $tplSwitchLogsVerbose[TplApp::SECTION_CALL] . PHP_EOL;
74
75 // Action
76 $actions .= PHP_EOL . $tplSwitchLogsVerbose[TplApp::SECTION_CONTENT] . PHP_EOL;
77 }
78
79 return $items . $actions;
80 }
81
82 /**
83 * Generates the action to switch the logs verbosity level.
84 *
85 * This method creates the action string for switching the logs verbosity level. It includes commands
86 * to reload the application after changing the verbosity level.
87 *
88 * @param int $verbose The verbosity level to switch to.
89 *
90 * @return string The generated action string for switching the logs verbosity level.
91 */
92 public static function getActionSwitchLogsVerbose($verbose)
93 {
94 return TplApp::getActionRun(Action::SWITCH_LOGS_VERBOSE, array($verbose)) . PHP_EOL .
96 }
97}
global $bearsamppLang
const SWITCH_LOGS_VERBOSE
const VERBOSE_REPORT
const VERBOSE_DEBUG
const VERBOSE_SIMPLE
const VERBOSE_TRACE
const VERBOSE_DEBUG
const VERBOSE_REPORT
const VERBOSE_SIMPLE
const LOGS_VERBOSE
const VERBOSE_TRACE
static getActionSwitchLogsVerbose($verbose)
static getActionMulti($action, $args=array(), $item=array(), $disabled=false, $class=false)
const SECTION_CALL
const SECTION_CONTENT
static getActionRun($action, $args=array(), $item=array(), $waitUntilTerminated=true)
static getMenu($caption, $menu, $class)
global $bearsamppConfig
Definition homepage.php:26