Passed
Branch dev (6ac00b)
by John
04:53
created

AdminController::settingsReturn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace App\Http\Controllers\Group;
4
5
use App\Models\GroupModel;
6
use App\Models\ContestModel;
7
use App\Exports\GroupAnalysisExport;
8
use App\Http\Controllers\Controller;
9
use Illuminate\Http\Request;
10
use Excel;
11
use Auth;
12
use Redirect;
13
14
15
class AdminController extends Controller
16
{
17
    /**
18
     * Redirect to the Group Settings General Section.
19
     *
20
     * @return Response
0 ignored issues
show
Bug introduced by
The type App\Http\Controllers\Group\Response was not found. Did you mean Response? If so, make sure to prefix the type with \.
Loading history...
21
     */
22
    public function settings($gcode)
23
    {
24
        return Redirect::route('group.settings.general', ['gcode' => $gcode]);;
0 ignored issues
show
Bug Best Practice introduced by
The expression return Redirect::route('...ray('gcode' => $gcode)) returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type App\Http\Controllers\Group\Response.
Loading history...
25
    }
26
27
    /**
28
     * Redirect to the Group Detail Page.
29
     *
30
     * @return Response
31
     */
32
    public function settingsReturn($gcode)
33
    {
34
        return Redirect::route('group.detail', ['gcode' => $gcode]);;
0 ignored issues
show
Bug Best Practice introduced by
The expression return Redirect::route('...ray('gcode' => $gcode)) returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type App\Http\Controllers\Group\Response.
Loading history...
35
    }
36
37
    /**
38
     * Show the Group Settings General Section.
39
     *
40
     * @return Response
41
     */
42
    public function settingsGeneral($gcode)
43
    {
44
        $groupModel=new GroupModel();
45
        $basic_info=$groupModel->details($gcode);
46
        if(empty($basic_info)) return Redirect::route('group.index');
0 ignored issues
show
Bug Best Practice introduced by
The expression return Redirect::route('group.index') returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type App\Http\Controllers\Group\Response.
Loading history...
47
        $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
48
        $member_list=$groupModel->userList($basic_info["gid"]);
49
        return view('group.settings.general', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('group.setti...arance' => $clearance)) returns the type Illuminate\View\View which is incompatible with the documented return type App\Http\Controllers\Group\Response.
Loading history...
50
            'page_title'=>"Group Setting General",
51
            'site_title'=>config("app.name"),
52
            'navigation'=>"Group",
53
            "basic_info"=>$basic_info,
54
            'member_list'=>$member_list,
55
            'group_clearance'=>$clearance
56
        ]);
57
    }
58
59
    /*
60
     * Show the Group's Problems in Practice Contest or other Contest.
61
     *
62
     * @return Response
63
     */
64
    public function problems($gcode){
65
        $groupModel = new GroupModel();
66
        $group_info = $groupModel->details($gcode);
67
        $problems = $groupModel->problems($group_info['gid']);
68
        $basic_info=$groupModel->details($gcode);
69
        return view('group.settings.problems', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('group.setti...roblems' => $problems)) returns the type Illuminate\View\View which is incompatible with the documented return type App\Http\Controllers\Group\Response.
Loading history...
70
            'page_title'=>"Group Problems",
71
            'site_title'=>"NOJ",
72
            'navigation'=>"Group",
73
            'basic_info'=>$basic_info,
74
            'group_info'=>$group_info,
75
            'problems'=>$problems,
76
        ]);
77
    }
78
79
    /**
80
     * Show the Group Settings General Section.
81
     *
82
     * @return Response
83
     */
84
    public function settingsDanger($gcode)
85
    {
86
        $groupModel=new GroupModel();
87
        $basic_info=$groupModel->details($gcode);
88
        if(empty($basic_info)) return Redirect::route('group.index');
0 ignored issues
show
Bug Best Practice introduced by
The expression return Redirect::route('group.index') returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type App\Http\Controllers\Group\Response.
Loading history...
89
        return view('group.settings.danger', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('group.setti..._info' => $basic_info)) returns the type Illuminate\View\View which is incompatible with the documented return type App\Http\Controllers\Group\Response.
Loading history...
90
            'page_title'=>"Group Setting danger",
91
            'site_title'=>config("app.name"),
92
            'navigation'=>"Group",
93
            "basic_info"=>$basic_info,
94
            ]);
95
    }
96
97
    /**
98
     * Show the Group Settings General Section.
99
     *
100
     * @return Response
101
     */
102
    public function settingsMember($gcode)
103
    {
104
        $groupModel=new GroupModel();
105
        $contestModel=new ContestModel();
0 ignored issues
show
Unused Code introduced by
The assignment to $contestModel is dead and can be removed.
Loading history...
106
        $basic_info=$groupModel->details($gcode);
107
        if(empty($basic_info)) return Redirect::route('group.index');
0 ignored issues
show
Bug Best Practice introduced by
The expression return Redirect::route('group.index') returns the type Illuminate\Http\RedirectResponse which is incompatible with the documented return type App\Http\Controllers\Group\Response.
Loading history...
108
        $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
109
        $member_list=$groupModel->userList($basic_info["gid"]);
110
        $group_notice=$groupModel->detailNotice($gcode);
111
        return view('group.settings.member', [
0 ignored issues
show
Bug Best Practice introduced by
The expression return view('group.setti...ice' => $group_notice)) returns the type Illuminate\View\View which is incompatible with the documented return type App\Http\Controllers\Group\Response.
Loading history...
112
            'page_title'=>"Group Setting Member",
113
            'site_title'=>config("app.name"),
114
            'navigation'=>"Group",
115
            "basic_info"=>$basic_info,
116
            'member_list'=>$member_list,
117
            'group_clearance'=>$clearance,
118
            'group_notice'=>$group_notice,
119
        ]);
120
    }
121
122
    public function settingsContest($gcode)
123
    {
124
        $groupModel=new GroupModel();
125
        $contestModel=new ContestModel();
126
        $basic_info=$groupModel->details($gcode);
127
        if(empty($basic_info)) return Redirect::route('group.index');
128
        $clearance=$groupModel->judgeClearance($basic_info["gid"], Auth::user()->id);
129
        $contest_list=$contestModel->listForSetting($basic_info["gid"]);
130
        $member_list=$groupModel->userList($basic_info["gid"]);
131
        return view('group.settings.contest', [
132
            'page_title'=>"Group Setting Contest",
133
            'site_title'=>config("app.name"),
134
            'navigation'=>"Group",
135
            "basic_info"=>$basic_info,
136
            'contest_list'=>$contest_list,
137
            'group_clearance'=>$clearance,
138
            'member_list'=>$member_list,
139
        ]);
140
    }
141
}
142