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

Static Public Member Functions

static getActionRefreshGitRepos ()
 
static getActionRefreshGitReposStartup ($scanStartup)
 
static getMenuGit ()
 
static getMenuGitRepos ()
 
static process ()
 

Data Fields

const ACTION_REFRESH_REPOS = 'refreshGitRepos'
 
const ACTION_REFRESH_REPOS_STARTUP = 'refreshGitReposStartup'
 
const MENU = 'git'
 
const MENU_REPOS = 'gitRepos'
 

Detailed Description

Class TplAppGit

This class provides methods to generate and manage Git-related menu items and actions within the Bearsampp application. It includes functionalities for creating Git menus, refreshing repositories, and handling startup actions.

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

Member Function Documentation

◆ getActionRefreshGitRepos()

static TplAppGit::getActionRefreshGitRepos ( )
static

Generates the action to refresh Git repositories.

This method creates the action string for refreshing Git repositories. It includes commands to reload the application after refreshing the repositories.

Returns
string The generated action string for refreshing Git repositories.

Definition at line 135 of file class.tpl.app.git.php.

136 {
139 }
const REFRESH_REPOS
static getActionRun($action, $args=array(), $item=array(), $waitUntilTerminated=true)

References TplAppReload\getActionReload(), TplApp\getActionRun(), ActionRefreshRepos\GIT, and Action\REFRESH_REPOS.

◆ getActionRefreshGitReposStartup()

static TplAppGit::getActionRefreshGitReposStartup ( $scanStartup)
static

Generates the action to refresh Git repositories at startup.

This method creates the action string for setting up repository scanning at startup. It includes commands to reload the application after setting the startup action.

Parameters
int$scanStartupThe flag indicating whether to enable or disable scanning at startup.
Returns
string The generated action string for refreshing Git repositories at startup.

Definition at line 151 of file class.tpl.app.git.php.

152 {
153 return TplApp::getActionRun(Action::REFRESH_REPOS_STARTUP, array(ActionRefreshRepos::GIT, $scanStartup)) . PHP_EOL .
155 }
const REFRESH_REPOS_STARTUP

References TplAppReload\getActionReload(), TplApp\getActionRun(), ActionRefreshRepos\GIT, and Action\REFRESH_REPOS_STARTUP.

◆ getMenuGit()

static TplAppGit::getMenuGit ( )
static

Generates the Git menu with various options.

This method creates the Git menu with options for opening Git console, Git GUI, refreshing repositories, and setting up repository scanning at startup.

@global object $bearsamppLang Provides language support for retrieving language-specific values. @global object $bearsamppTools Provides access to various tools and utilities.

Returns
string The generated Git menu content.

Definition at line 54 of file class.tpl.app.git.php.

55 {
56 global $bearsamppLang, $bearsamppTools;
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, null,
65 false, get_called_class()
66 );
67 $tplRefreshReposStartup = TplApp::getActionMulti(
68 self::ACTION_REFRESH_REPOS_STARTUP, array($isScanStartup ? Config::DISABLED : Config::ENABLED),
69 array($bearsamppLang->getValue(Lang::MENU_SCAN_REPOS_STARTUP), $isScanStartup ? TplAestan::GLYPH_CHECK : ''),
70 false, get_called_class()
71 );
72
73 /* get path for git gui */
74 $gitgui = $bearsamppTools->getGit()->getSymlinkPath() . '/cmd';
75
79 $bearsamppTools->getConsoleZ()->getTabTitleGit()
80 ) . PHP_EOL .
83 $gitgui . '/git-gui',
85 ) . PHP_EOL .
86 TplAestan::getItemSeparator() . PHP_EOL .
87
88 // Items
89 (!$emptyRepos ? $tplRepos[TplApp::SECTION_CALL] . PHP_EOL : '') .
90 $tplRefreshRepos[TplApp::SECTION_CALL] . PHP_EOL .
91 $tplRefreshReposStartup[TplApp::SECTION_CALL] . PHP_EOL .
92
93 // Actions
94 (!$emptyRepos ? $tplRepos[TplApp::SECTION_CONTENT] . PHP_EOL : PHP_EOL) .
95 $tplRefreshRepos[TplApp::SECTION_CONTENT] . PHP_EOL .
96 $tplRefreshReposStartup[TplApp::SECTION_CONTENT];
97 }
global $bearsamppLang
const DISABLED
const GITGUI
const REPOS
const GIT_CONSOLE
const MENU_REFRESH_REPOS
static getItemSeparator()
static getItemConsoleZ($caption, $glyph, $id=null, $title=null, $initDir=null, $command=null)
static getItemExe($caption, $exe, $glyph, $params=null)
static getActionMulti($action, $args=array(), $item=array(), $disabled=false, $class=false)
const SECTION_CALL
const SECTION_CONTENT
static getMenu($caption, $menu, $class)

References $bearsamppLang, Config\DISABLED, Config\ENABLED, TplApp\getActionMulti(), TplAestan\getItemConsoleZ(), TplAestan\getItemExe(), TplAestan\getItemSeparator(), TplApp\getMenu(), Lang\GIT_CONSOLE, Lang\GITGUI, TplAestan\GLYPH_CHECK, TplAestan\GLYPH_GIT, TplAestan\GLYPH_RELOAD, Lang\MENU_REFRESH_REPOS, Lang\MENU_SCAN_REPOS_STARTUP, Lang\REPOS, TplApp\SECTION_CALL, and TplApp\SECTION_CONTENT.

◆ getMenuGitRepos()

static TplAppGit::getMenuGitRepos ( )
static

Generates the Git repositories menu.

This method creates the menu for listing and managing Git repositories found by the application.

@global object $bearsamppTools Provides access to various tools and utilities.

Returns
string The generated Git repositories menu content.

Definition at line 109 of file class.tpl.app.git.php.

110 {
111 global $bearsamppTools;
112 $result = '';
113
114 foreach ($bearsamppTools->getGit()->findRepos() as $repo) {
116 basename($repo),
118 $bearsamppTools->getConsoleZ()->getTabTitleGit(),
119 $bearsamppTools->getConsoleZ()->getTabTitleGit($repo),
120 $repo
121 ) . PHP_EOL;
122 }
123
124 return $result;
125 }
$result

References $result, TplAestan\getItemConsoleZ(), and TplAestan\GLYPH_GIT.

◆ process()

static TplAppGit::process ( )
static

Processes and generates the main Git menu.

This method generates the main Git menu item, which includes options for managing Git repositories and actions related to Git functionalities.

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

Returns
array The generated Git menu item and actions.

Definition at line 36 of file class.tpl.app.git.php.

37 {
38 global $bearsamppLang;
39
40 return TplApp::getMenu($bearsamppLang->getValue(Lang::GIT), self::MENU, get_called_class());
41 }
const GIT

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

Referenced by TplAppTools\getMenuTools().

+ Here is the caller graph for this function:

Field Documentation

◆ ACTION_REFRESH_REPOS

const TplAppGit::ACTION_REFRESH_REPOS = 'refreshGitRepos'

Definition at line 23 of file class.tpl.app.git.php.

◆ ACTION_REFRESH_REPOS_STARTUP

const TplAppGit::ACTION_REFRESH_REPOS_STARTUP = 'refreshGitReposStartup'

Definition at line 24 of file class.tpl.app.git.php.

◆ MENU

const TplAppGit::MENU = 'git'

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

◆ MENU_REPOS

const TplAppGit::MENU_REPOS = 'gitRepos'

Definition at line 21 of file class.tpl.app.git.php.


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