Bearsampp
2026.9.23
Toggle main menu visibility
Loading...
Searching...
No Matches
class.tpl.app.git.php
Go to the documentation of this file.
1
<?php
2
/*
3
* Copyright (c) 2021-2026 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
17
class
TplAppGit
18
{
19
// Constants for menu and action identifiers
20
const
MENU
=
'git'
;
21
const
MENU_REPOS
=
'gitRepos'
;
22
23
const
ACTION_REFRESH_REPOS
=
'refreshGitRepos'
;
24
const
ACTION_REFRESH_REPOS_STARTUP
=
'refreshGitReposStartup'
;
25
36
public
static
function
process
()
37
{
38
global
$bearsamppLang
;
39
40
return
TplApp::getMenu
(
$bearsamppLang
->getValue(
Lang::GIT
), self::MENU, get_called_class());
41
}
42
54
public
static
function
getMenuGit
()
55
{
56
global
$bearsamppLang
, $bearsamppTools,
$bearsamppRoot
;
57
58
$tplRepos =
TplApp::getMenu
(
$bearsamppLang
->getValue(
Lang::REPOS
), self::MENU_REPOS, get_called_class());
59
$emptyRepos = count(explode(PHP_EOL, $tplRepos[
TplApp::SECTION_CONTENT
])) == 2;
60
$isScanStartup = $bearsamppTools->getGit()->isScanStartup();
61
62
$tplRefreshRepos =
TplApp::getActionMulti
(
63
self::ACTION_REFRESH_REPOS,
64
null
,
65
array(
$bearsamppLang
->getValue(
Lang::MENU_REFRESH_REPOS
),
TplAestan::GLYPH_RELOAD
),
66
false
,
67
get_called_class()
68
);
69
$tplRefreshReposStartup =
TplApp::getActionMulti
(
70
self::ACTION_REFRESH_REPOS_STARTUP,
71
array($isScanStartup ?
Config::DISABLED
:
Config::ENABLED
),
72
array(
$bearsamppLang
->getValue(
Lang::MENU_SCAN_REPOS_STARTUP
), $isScanStartup ?
TplAestan::GLYPH_CHECK
:
''
),
73
false
,
74
get_called_class()
75
);
76
77
/* get path for git gui */
78
$gitgui =
Path::getModuleSymlinkPath
($bearsamppTools->getGit()) .
'/cmd'
;
79
80
return
TplAestan::getItemPowerShell
(
81
$bearsamppLang
->getValue(
Lang::GIT_CONSOLE
),
82
TplAestan::GLYPH_GIT
,
83
null
,
84
$bearsamppTools->getPowerShell()->getTabTitleGit(),
85
Path::getWwwPath
(),
86
null
87
) . PHP_EOL .
88
TplAestan::getItemExe
(
89
$bearsamppLang
->getValue(
Lang::GITGUI
),
90
$gitgui .
'/git-gui'
,
91
TplAestan::GLYPH_GIT
92
) . PHP_EOL .
93
TplAestan::getItemSeparator
() . PHP_EOL .
94
95
// Items
96
(!$emptyRepos ? $tplRepos[
TplApp::SECTION_CALL
] . PHP_EOL :
''
) .
97
$tplRefreshRepos[
TplApp::SECTION_CALL
] . PHP_EOL .
98
$tplRefreshReposStartup[
TplApp::SECTION_CALL
] . PHP_EOL .
99
100
// Actions
101
(!$emptyRepos ? $tplRepos[
TplApp::SECTION_CONTENT
] . PHP_EOL : PHP_EOL) .
102
$tplRefreshRepos[
TplApp::SECTION_CONTENT
] . PHP_EOL .
103
$tplRefreshReposStartup[
TplApp::SECTION_CONTENT
];
104
}
105
116
public
static
function
getMenuGitRepos
()
117
{
118
global $bearsamppTools;
119
$result
=
''
;
120
121
foreach
($bearsamppTools->getGit()->findRepos() as $repo) {
122
$result
.=
TplAestan::getItemPowerShell
(
123
basename($repo),
124
TplAestan::GLYPH_GIT
,
125
null
,
126
$bearsamppTools->getPowerShell()->getTabTitleGit($repo),
127
$repo,
128
null
129
) . PHP_EOL;
130
}
131
132
return
$result
;
133
}
134
143
public
static
function
getActionRefreshGitRepos
()
144
{
145
return
TplApp::getActionRun
(
Action::REFRESH_REPOS
, array(
ActionRefreshRepos::GIT
)) . PHP_EOL .
146
TplAppReload::getActionReload
() . PHP_EOL;
147
}
148
159
public
static
function
getActionRefreshGitReposStartup
($scanStartup)
160
{
161
return
TplApp::getActionRun
(
Action::REFRESH_REPOS_STARTUP
, array(
ActionRefreshRepos::GIT
, $scanStartup)) . PHP_EOL .
162
TplAppReload::getActionReload
() . PHP_EOL;
163
}
164
}
$result
$result
Definition
ajax.apache.php:19
$bearsamppLang
global $bearsamppLang
Definition
ajax.apache.php:16
$bearsamppRoot
global $bearsamppRoot
Definition
ajax.apache.php:16
Action\REFRESH_REPOS
const REFRESH_REPOS
Definition
class.action.php:41
Action\REFRESH_REPOS_STARTUP
const REFRESH_REPOS_STARTUP
Definition
class.action.php:42
ActionRefreshRepos\GIT
const GIT
Definition
class.action.refreshRepos.php:20
Config\DISABLED
const DISABLED
Definition
class.config.php:36
Config\ENABLED
const ENABLED
Definition
class.config.php:35
Lang\MENU_SCAN_REPOS_STARTUP
const MENU_SCAN_REPOS_STARTUP
Definition
class.lang.php:113
Lang\REPOS
const REPOS
Definition
class.lang.php:64
Lang\GITGUI
const GITGUI
Definition
class.lang.php:47
Lang\GIT_CONSOLE
const GIT_CONSOLE
Definition
class.lang.php:46
Lang\GIT
const GIT
Definition
class.lang.php:147
Lang\MENU_REFRESH_REPOS
const MENU_REFRESH_REPOS
Definition
class.lang.php:108
Path\getWwwPath
static getWwwPath($aetrayPath=false)
Definition
class.path.php:1254
Path\getModuleSymlinkPath
static getModuleSymlinkPath($module)
Definition
class.path.php:57
TplAestan\getItemPowerShell
static getItemPowerShell($caption, $glyph, $id=null, $title=null, $initDir=null, $command=null)
Definition
class.tpl.aestan.php:143
TplAestan\getItemExe
static getItemExe($caption, $exe, $glyph, $params=null)
Definition
class.tpl.aestan.php:237
TplAestan\GLYPH_CHECK
const GLYPH_CHECK
Definition
class.tpl.aestan.php:61
TplAestan\GLYPH_GIT
const GLYPH_GIT
Definition
class.tpl.aestan.php:72
TplAestan\GLYPH_RELOAD
const GLYPH_RELOAD
Definition
class.tpl.aestan.php:60
TplAestan\getItemSeparator
static getItemSeparator()
Definition
class.tpl.aestan.php:126
TplAppGit
Definition
class.tpl.app.git.php:18
TplAppGit\ACTION_REFRESH_REPOS_STARTUP
const ACTION_REFRESH_REPOS_STARTUP
Definition
class.tpl.app.git.php:24
TplAppGit\getActionRefreshGitRepos
static getActionRefreshGitRepos()
Definition
class.tpl.app.git.php:143
TplAppGit\MENU
const MENU
Definition
class.tpl.app.git.php:20
TplAppGit\process
static process()
Definition
class.tpl.app.git.php:36
TplAppGit\MENU_REPOS
const MENU_REPOS
Definition
class.tpl.app.git.php:21
TplAppGit\ACTION_REFRESH_REPOS
const ACTION_REFRESH_REPOS
Definition
class.tpl.app.git.php:23
TplAppGit\getActionRefreshGitReposStartup
static getActionRefreshGitReposStartup($scanStartup)
Definition
class.tpl.app.git.php:159
TplAppGit\getMenuGit
static getMenuGit()
Definition
class.tpl.app.git.php:54
TplAppGit\getMenuGitRepos
static getMenuGitRepos()
Definition
class.tpl.app.git.php:116
TplApp\getActionMulti
static getActionMulti($action, $args=array(), $item=array(), $disabled=false, $class=false)
Definition
class.tpl.app.php:153
TplApp\getMenu
static getMenu($caption, $menu, $class)
Definition
class.tpl.app.php:191
TplApp\getActionRun
static getActionRun($action, $args=array(), $item=array(), $waitUntilTerminated=true)
Definition
class.tpl.app.php:116
TplApp\SECTION_CALL
const SECTION_CALL
Definition
class.tpl.app.php:23
TplApp\SECTION_CONTENT
const SECTION_CONTENT
Definition
class.tpl.app.php:24
TplAppReload\getActionReload
static getActionReload()
Definition
class.tpl.app.reload.php:47
sandbox
core
classes
tpls
app
class.tpl.app.git.php
Generated by
1.17.0