Bearsampp 2025.8.29
Loading...
Searching...
No Matches
class.tpl.app.services.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
18{
19 // Constants for action identifiers
20 const ACTION_START = 'startServices';
21 const ACTION_STOP = 'stopServices';
22 const ACTION_RESTART = 'restartServices';
23
31 public static function process()
32 {
33 global $bearsamppLang;
34
35 $tplStart = TplApp::getActionMulti(
36 self::ACTION_START, null,
38 false, get_called_class()
39 );
40
41 $tplStop = TplApp::getActionMulti(
42 self::ACTION_STOP, null,
44 false, get_called_class()
45 );
46
47 $tplRestart = TplApp::getActionMulti(
48 self::ACTION_RESTART, null,
50 false, get_called_class()
51 );
52
53 // Items
54 $items = $tplStart[TplApp::SECTION_CALL] . PHP_EOL .
55 $tplStop[TplApp::SECTION_CALL] . PHP_EOL .
56 $tplRestart[TplApp::SECTION_CALL] . PHP_EOL;
57
58 // Actions
59 $actions = PHP_EOL . $tplStart[TplApp::SECTION_CONTENT] .
60 PHP_EOL . $tplStop[TplApp::SECTION_CONTENT] .
61 PHP_EOL . $tplRestart[TplApp::SECTION_CONTENT];
62
63 return array($items, $actions);
64 }
65
73 public static function getActionStartServices()
74 {
75 global $bearsamppBins;
76 $actions = '';
77
78 foreach ($bearsamppBins->getServices() as $sName => $service) {
79 $actions .= TplService::getActionStart($service->getName()) . PHP_EOL;
80 }
81
82 return $actions;
83 }
84
92 public static function getActionStopServices()
93 {
94 global $bearsamppBins;
95 $actions = '';
96
97 foreach ($bearsamppBins->getServices() as $sName => $service) {
98 $actions .= TplService::getActionStop($service->getName()) . PHP_EOL;
99 }
100
101 return $actions;
102 }
103
109 public static function getActionRestartServices()
110 {
112 }
113}
global $bearsamppBins
global $bearsamppLang
const MENU_RESTART_SERVICES
const MENU_START_SERVICES
const MENU_STOP_SERVICES
const GLYPH_SERVICES_STOP
const GLYPH_SERVICES_RESTART
const GLYPH_SERVICES_START
static getActionMulti($action, $args=array(), $item=array(), $disabled=false, $class=false)
const SECTION_CALL
const SECTION_CONTENT
static getActionStop($sName)
static getActionStart($sName)