|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of Gitamin. |
|
5
|
|
|
* |
|
6
|
|
|
* Copyright (C) 2015-2016 The Gitamin Team |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Gitamin\Composers; |
|
13
|
|
|
|
|
14
|
|
|
use Gitamin\Models\Issue; |
|
15
|
|
|
use Gitamin\Models\Owner; |
|
16
|
|
|
use Gitamin\Models\Project; |
|
17
|
|
|
use Illuminate\Contracts\View\View; |
|
18
|
|
|
|
|
19
|
|
|
class ExploreComposer |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* Index page view composer. |
|
23
|
|
|
* |
|
24
|
|
|
* @param \Illuminate\Contracts\View\View $view |
|
25
|
|
|
*/ |
|
26
|
|
|
public function compose(View $view) |
|
27
|
|
|
{ |
|
28
|
|
|
// Default data |
|
29
|
|
|
$withData = [ |
|
30
|
|
|
'systemStatus' => 'info', |
|
31
|
|
|
'systemMessage' => trans('gitamin.service.bad'), |
|
32
|
|
|
'favicon' => 'favicon-high-alert', |
|
33
|
|
|
]; |
|
34
|
|
|
|
|
35
|
|
|
if (Project::notVisibilityLevel(1)->count() === 0) { |
|
|
|
|
|
|
36
|
|
|
// If all our projects are ok, do we have any non-fixed issues? |
|
37
|
|
|
$issues = Issue::orderBy('created_at', 'desc')->get(); |
|
38
|
|
|
$issueCount = $issues->count(); |
|
39
|
|
|
|
|
40
|
|
|
if ($issueCount === 0 || ($issueCount >= 1 && (int) $issues->first()->visibility_level === 4)) { |
|
41
|
|
|
$withData = [ |
|
42
|
|
|
'systemStatus' => 'success', |
|
43
|
|
|
'systemMessage' => trans('gitamin.service.good'), |
|
44
|
|
|
'favicon' => 'favicon', |
|
45
|
|
|
]; |
|
46
|
|
|
} |
|
47
|
|
|
} else { |
|
48
|
|
|
if (Project::whereIn('visibility_level', [2, 3])->count() > 0) { |
|
49
|
|
|
$withData['favicon'] = 'favicon-medium-alert'; |
|
50
|
|
|
} |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
// Project & Project Team lists. |
|
54
|
|
|
$usedProjectTeams = Project::where('owner_id', '>', 0)->groupBy('owner_id')->lists('owner_id'); |
|
55
|
|
|
$projectTeams = Owner::whereIn('id', $usedProjectTeams)->get(); |
|
56
|
|
|
$unteamedProjects = Project::where('owner_id', 0)->orderBy('created_at')->get(); |
|
57
|
|
|
|
|
58
|
|
|
$view->with($withData) |
|
|
|
|
|
|
59
|
|
|
->withProjectTeams($projectTeams) |
|
60
|
|
|
->withUnteamedProjects($unteamedProjects); |
|
61
|
|
|
} |
|
62
|
|
|
} |
|
63
|
|
|
|
This check marks calls to methods that do not seem to exist on an object.
This is most likely the result of a method being renamed without all references to it being renamed likewise.