Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
freebsd
GitHub Repository: freebsd/phabricator
Path: blob/master/src/applications/guides/module/PhabricatorGuideQuickStartModule.php
12242 views
1
<?php
2
3
final class PhabricatorGuideQuickStartModule extends PhabricatorGuideModule {
4
5
public function getModuleKey() {
6
return 'quickstart';
7
}
8
9
public function getModuleName() {
10
return pht('Quick Start');
11
}
12
13
public function getModulePosition() {
14
return 30;
15
}
16
17
public function getIsModuleEnabled() {
18
return true;
19
}
20
21
public function renderModuleStatus(AphrontRequest $request) {
22
$viewer = $request->getViewer();
23
$instance = PhabricatorEnv::getEnvConfig('cluster.instance');
24
25
$guide_items = new PhabricatorGuideListView();
26
27
$title = pht('Create a Repository');
28
$repository_check = id(new PhabricatorRepositoryQuery())
29
->setViewer($viewer)
30
->execute();
31
$href = PhabricatorEnv::getURI('/diffusion/');
32
if ($repository_check) {
33
$icon = 'fa-check';
34
$icon_bg = 'bg-green';
35
$description = pht(
36
"You've created at least one repository.");
37
} else {
38
$icon = 'fa-code';
39
$icon_bg = 'bg-sky';
40
$description =
41
pht('If you are here for code review, let\'s set up your first '.
42
'repository.');
43
}
44
45
$item = id(new PhabricatorGuideItemView())
46
->setTitle($title)
47
->setHref($href)
48
->setIcon($icon)
49
->setIconBackground($icon_bg)
50
->setDescription($description);
51
$guide_items->addItem($item);
52
53
54
$title = pht('Create a Project');
55
$project_check = id(new PhabricatorProjectQuery())
56
->setViewer($viewer)
57
->execute();
58
$href = PhabricatorEnv::getURI('/project/');
59
if ($project_check) {
60
$icon = 'fa-check';
61
$icon_bg = 'bg-green';
62
$description = pht(
63
"You've created at least one project.");
64
} else {
65
$icon = 'fa-briefcase';
66
$icon_bg = 'bg-sky';
67
$description =
68
pht('Project tags define everything. Create them for teams, tags, '.
69
'or actual projects.');
70
}
71
72
$item = id(new PhabricatorGuideItemView())
73
->setTitle($title)
74
->setHref($href)
75
->setIcon($icon)
76
->setIconBackground($icon_bg)
77
->setDescription($description);
78
$guide_items->addItem($item);
79
80
81
$title = pht('Create a Task');
82
$task_check = id(new ManiphestTaskQuery())
83
->setViewer($viewer)
84
->execute();
85
$href = PhabricatorEnv::getURI('/maniphest/');
86
if ($task_check) {
87
$icon = 'fa-check';
88
$icon_bg = 'bg-green';
89
$description = pht(
90
"You've created at least one task.");
91
} else {
92
$icon = 'fa-anchor';
93
$icon_bg = 'bg-sky';
94
$description =
95
pht('Create some work for the interns in Maniphest.');
96
}
97
98
$item = id(new PhabricatorGuideItemView())
99
->setTitle($title)
100
->setHref($href)
101
->setIcon($icon)
102
->setIconBackground($icon_bg)
103
->setDescription($description);
104
$guide_items->addItem($item);
105
106
$title = pht('Personalize your Install');
107
$wordmark = PhabricatorEnv::getEnvConfig('ui.logo');
108
$href = PhabricatorEnv::getURI('/config/edit/ui.logo/');
109
if ($wordmark) {
110
$icon = 'fa-check';
111
$icon_bg = 'bg-green';
112
$description = pht(
113
'It looks amazing, good work. Home Sweet Home.');
114
} else {
115
$icon = 'fa-home';
116
$icon_bg = 'bg-sky';
117
$description =
118
pht('Change the name and add your company logo, just to give it a '.
119
'little extra polish.');
120
}
121
122
$item = id(new PhabricatorGuideItemView())
123
->setTitle($title)
124
->setHref($href)
125
->setIcon($icon)
126
->setIconBackground($icon_bg)
127
->setDescription($description);
128
$guide_items->addItem($item);
129
130
$title = pht('Explore Applications');
131
$href = PhabricatorEnv::getURI('/applications/');
132
$icon = 'fa-globe';
133
$icon_bg = 'bg-sky';
134
$description =
135
pht('See all available applications.');
136
137
$item = id(new PhabricatorGuideItemView())
138
->setTitle($title)
139
->setHref($href)
140
->setIcon($icon)
141
->setIconBackground($icon_bg)
142
->setDescription($description);
143
$guide_items->addItem($item);
144
145
if (!$instance) {
146
$title = pht('Invite Collaborators');
147
$people_check = id(new PhabricatorPeopleQuery())
148
->setViewer($viewer)
149
->execute();
150
$people = count($people_check);
151
$href = PhabricatorEnv::getURI('/people/invite/send/');
152
if ($people > 1) {
153
$icon = 'fa-check';
154
$icon_bg = 'bg-green';
155
$description = pht(
156
'Your invitations have been accepted. You will not be alone on '.
157
'this journey.');
158
} else {
159
$icon = 'fa-group';
160
$icon_bg = 'bg-sky';
161
$description =
162
pht('Invite the rest of your team to get started.');
163
}
164
165
$item = id(new PhabricatorGuideItemView())
166
->setTitle($title)
167
->setHref($href)
168
->setIcon($icon)
169
->setIconBackground($icon_bg)
170
->setDescription($description);
171
$guide_items->addItem($item);
172
}
173
174
$intro = pht(
175
'If you\'re new to this software, these optional steps can help you '.
176
'learn the basics. Feel free to set things up for how you work best '.
177
'and explore these features at your own pace.');
178
179
$intro = new PHUIRemarkupView($viewer, $intro);
180
$intro = id(new PHUIDocumentView())
181
->appendChild($intro);
182
183
return array($intro, $guide_items);
184
185
}
186
187
}
188
189