66use VCS \Mercurial ;
77use VCS \Subversion ;
88
9+ $ projects = [];
910foreach (Project::getRepositories () as $ repo ) {
1011
1112 // Get the right locale for this repo
@@ -243,45 +244,7 @@ function ($entity) use ($path) {
243244 }
244245}
245246
246- // Get stats
247- $ stats = Health::getStats ($ projects );
248- $ translated = $ stats ['translated ' ];
249- $ reference = $ stats ['total ' ];
250-
251- $ completion = round (($ translated / $ reference ) * 100 , 2 );
252- $ completion = $ completion > 100 ? 100 : $ completion ;
253-
254- // Get color from completion value
255- $ color = Utils::redYellowGreen ($ completion );
256-
257- // Get active projects
258- $ active_projects = '<h4>Active projects:</h4><ul> ' ;
259- if (isset ($ projects ['release ' ]['repos ' ])) {
260- $ active_projects .= '<li><b>Desktop:</b> ' ;
261- foreach (array_keys ($ projects ['release ' ]['repos ' ]) as $ repo ) {
262- if (in_array ($ repo , array_keys (Project::$ components_names ))) {
263- $ active_projects .= Project::$ components_names [$ repo ] . ', ' ;
264- }
265- }
266- $ active_projects .= '</li> ' ;
267- }
268-
269- if (isset ($ projects ['gaia ' ])) {
270- $ active_projects .= '<li><b>Gaia:</b> ' ;
271- foreach (array_keys ($ projects ['gaia ' ]) as $ repo ) {
272- $ active_projects .= Project::getRepositoriesNames ()[$ repo ] . ', ' ;
273- }
274- $ active_projects .= '</li> ' ;
275- }
276-
277- if (isset ($ projects ['others ' ])) {
278- $ active_projects .= '<li><b>Others:</b> ' ;
279- foreach (array_keys ($ projects ['others ' ]) as $ repo ) {
280- $ active_projects .= Project::getRepositoriesNames ()[$ repo ] . ', ' ;
281- }
282- $ active_projects .= '</li> ' ;
283- }
284- $ active_projects .= '</ul> ' ;
247+ $ active_projects = '' ;
285248
286249// Build locales select
287250$ target_locales_list = '' ;
@@ -292,3 +255,45 @@ function ($entity) use ($path) {
292255 $ ch = ($ loc == $ locale ) ? ' selected ' : '' ;
293256 $ target_locales_list .= "\t<option {$ ch } value= {$ loc }> {$ loc }</option> \n" ;
294257}
258+
259+ // Get stats
260+ if (! empty ($ projects )) {
261+ $ stats = Health::getStats ($ projects );
262+ $ translated = $ stats ['translated ' ];
263+ $ reference = $ stats ['total ' ];
264+ $ completion = round (($ translated / $ reference ) * 100 , 2 );
265+ $ completion = $ completion > 100 ? 100 : $ completion ;
266+
267+ // Get color from completion value
268+ $ color = Utils::redYellowGreen ($ completion );
269+
270+ // Get active projects
271+ if (isset ($ projects ['release ' ]['repos ' ])) {
272+ $ active_projects .= '<li><b>Desktop:</b> ' ;
273+ $ tmp_projects = [];
274+ foreach (array_keys ($ projects ['release ' ]['repos ' ]) as $ repo ) {
275+ if (in_array ($ repo , array_keys (Project::$ components_names ))) {
276+ $ tmp_projects [] = Project::$ components_names [$ repo ];
277+ }
278+ }
279+ $ active_projects .= implode (', ' , $ tmp_projects ) . '</li> ' ;
280+ }
281+
282+ if (isset ($ projects ['gaia ' ])) {
283+ $ active_projects .= '<li><b>Gaia:</b> ' ;
284+ $ tmp_projects = [];
285+ foreach (array_keys ($ projects ['gaia ' ]) as $ repo ) {
286+ $ tmp_projects [] = Project::getRepositoriesNames ()[$ repo ];
287+ }
288+ $ active_projects .= implode (', ' , $ tmp_projects ) . '</li> ' ;
289+ }
290+
291+ if (isset ($ projects ['others ' ])) {
292+ $ active_projects .= '<li><b>Others:</b> ' ;
293+ $ tmp_projects = [];
294+ foreach (array_keys ($ projects ['others ' ]) as $ repo ) {
295+ $ tmp_projects [] = Project::getRepositoriesNames ()[$ repo ];
296+ }
297+ $ active_projects .= implode (', ' , $ tmp_projects ) . '</li> ' ;
298+ }
299+ }
0 commit comments