瀏覽代碼

Added outcome reports

父節點
當前提交
7cfc243864

+ 18
- 10
app/controllers/OutcomesController.php 查看文件

@@ -172,7 +172,9 @@ class OutcomesController extends \BaseController {
172 172
             return $carry->merge(Activity::where('course_id', '=', $course->id)->get());
173 173
         }, new \Illuminate\Database\Eloquent\Collection);
174 174
 
175
-        return View::make('local.managers.admins.new-learning-outcome', compact('title', 'outcome', 'courses', 'activities'));
175
+        $report_link = URL::action('OutcomesController@newReport', ['id' => $outcome->id]);
176
+
177
+        return View::make('local.managers.admins.new-learning-outcome', compact('title', 'outcome', 'courses', 'activities', 'report_link'));
176 178
     }
177 179
     public function newShowAll()
178 180
     {
@@ -196,7 +198,9 @@ class OutcomesController extends \BaseController {
196 198
             return $carry->merge(Activity::where('course_id', '=', $course->id)->get());
197 199
         }, new \Illuminate\Database\Eloquent\Collection);
198 200
 
199
-        return View::make('local.managers.admins.new-learning-outcome', compact('title', 'outcome', 'courses', 'activities'));
201
+        $report_link = URL::action('OutcomesController@newReportAll');
202
+
203
+        return View::make('local.managers.admins.new-learning-outcome', compact('title', 'outcome', 'courses', 'activities', 'report_link'));
200 204
     }
201 205
 
202 206
     public function newReport($id)
@@ -207,15 +211,19 @@ class OutcomesController extends \BaseController {
207 211
         $programs = $objectives->map(function ($objective) { return $objective->program; })
208 212
             ->merge($criteria->map(function ($criteria) { return $criteria->program; }))
209 213
             ->filter(function ($program) { return $program->users->contains(Auth::user()); });
210
-        $title = $outcome->name;
211
-        $courses = $programs->reduce(function ($carry, $program) {
212
-            return $carry->merge($program->courses);
213
-        }, new \Illuminate\Database\Eloquent\Collection);
214
-        $activities = $programs->reduce(function ($carry, $course) {
215
-            return $carry->merge(Activity::where('course_id', '=', $course->id)->get());
216
-        }, new \Illuminate\Database\Eloquent\Collection);
214
+        $title = $outcome->name . ' Report';
215
+
216
+
217
+        return View::make('local.managers.admins.new-report', compact('title', 'outcome', 'objectives'));
218
+
219
+    }
220
+
221
+    public function newReportAll()
222
+    {
223
+        $outcomes = Outcome::with('objectives')->get();
224
+        $title = 'All Outcomes Report';
217 225
 
218
-        return View::make('local.managers.admins.new-learning-outcome', compact('title', 'outcome', 'courses', 'activities'));
226
+        return View::make('local.managers.admins.new-report-all', compact('title', 'outcomes'));
219 227
 
220 228
     }
221 229
 

+ 2
- 0
app/routes.php 查看文件

@@ -356,6 +356,8 @@ Route::group(array('before' => 'auth|has_access'), function()
356 356
         // TODO: Change route name
357 357
         Route::get('learning-outcomes/newshow/{id}', 'OutcomesController@newShow');
358 358
         Route::get('learning-outcomes/newshowall', 'OutcomesController@newShowAll');
359
+        Route::get('new-report/{id}', 'OutcomesController@newReport');
360
+        Route::get('new-report-all', 'OutcomesController@newReportAll');
359 361
 
360 362
     });
361 363
 

+ 1
- 1
app/views/local/managers/admins/new-learning-outcome.blade.php 查看文件

@@ -17,7 +17,7 @@
17 17
             <h3>Courses</h3>
18 18
         </div>
19 19
         <div class="col-md-2">
20
-            <a href="" class="btn btn-lg btn-default" role="button">Report</a>
20
+            <a href="{{ $report_link }}" class="btn btn-lg btn-default" role="button">Report</a>
21 21
         </div>
22 22
     </div>
23 23
     <div class="row">

+ 65
- 0
app/views/local/managers/admins/new-report-all.blade.php 查看文件

@@ -0,0 +1,65 @@
1
+@extends('layouts.master')
2
+
3
+@section('navigation')
4
+    @if(Auth::user()->role==1)
5
+        @include('local.managers.admins._navigation')
6
+    @elseif(Auth::user()->role==2)
7
+        @include('local.managers.sCoords._navigation')
8
+    @elseif(Auth::user()->role==3)
9
+        @include('local.managers.pCoords._navigation')
10
+    @endif
11
+@stop
12
+
13
+@section('main')
14
+    <div class="row">
15
+        <div class="col-md-12">
16
+            <table class="table table-striped table-condensed editable-table">
17
+                <thead><tr class="center-text">
18
+                    <th class="col-md-2">Outcomes</th>
19
+                    <th class="col-md-4">Learning Objectives</th>
20
+                    <th class="col-md-4">Transformative Actions</th>
21
+                    <th class="col-md-2">Expected Metric</th>
22
+                </thead>
23
+                <tbody>
24
+                @foreach ($outcomes as $outcome)
25
+                    @foreach ($outcome->objectives as $i => $objective)
26
+                        <tr data-id="{{$outcome->id}}">
27
+                            @if ($i == 0)
28
+                                <td contenteditable="true" class="name col-md-2" rowspan="{{ $outcome->objectives->count() }}">{{ $outcome->name }}</td>
29
+                            @endif
30
+                            <td contenteditable="true" class="name col-md-4" >{{ $objective->text }}</td>
31
+{{--                             TODO: Use correct data--}}
32
+                            <td contenteditable="true" data-type="textarea" class="definition col-md-6" >{{ 'TODO' }}</td>
33
+                            <td contenteditable="true" class="expected-outcome col-md-1" >{{ $outcome->expected_outcome }}</td>
34
+                        </tr>
35
+                    @endforeach
36
+                @endforeach
37
+
38
+                </tbody>
39
+            </table>
40
+        </div>
41
+    </div>
42
+
43
+@stop
44
+
45
+@section('included-js')
46
+    @include('global._datatables_js')
47
+@stop
48
+
49
+@section('javascript')
50
+
51
+    // ------------------------------------------------------------------------
52
+    // Page Load
53
+    // ------------------------------------------------------------------------
54
+
55
+    // ------------------------------------------------------------------------
56
+    // Events
57
+    // ------------------------------------------------------------------------
58
+
59
+
60
+
61
+    // ------------------------------------------------------------------------
62
+    // Functions
63
+    // ------------------------------------------------------------------------
64
+
65
+@stop

+ 60
- 0
app/views/local/managers/admins/new-report.blade.php 查看文件

@@ -0,0 +1,60 @@
1
+@extends('layouts.master')
2
+
3
+@section('navigation')
4
+    @if(Auth::user()->role==1)
5
+        @include('local.managers.admins._navigation')
6
+    @elseif(Auth::user()->role==2)
7
+        @include('local.managers.sCoords._navigation')
8
+    @elseif(Auth::user()->role==3)
9
+        @include('local.managers.pCoords._navigation')
10
+    @endif
11
+@stop
12
+
13
+@section('main')
14
+    <div class="row">
15
+        <div class="col-md-12">
16
+            <p>Click on the values you want to change. Invalid values will be rejected automatically. To save your changes, click the 'Save' button at the bottom of the page.</p>
17
+            <table class="table table-striped table-condensed editable-table">
18
+                <thead><tr class="center-text">
19
+                    <th class="col-md-4">Learning Objectives</th>
20
+                    <th class="col-md-6">Transformative Actions</th>
21
+                    <th class="col-md-2">Expected Metric</th>
22
+
23
+                </thead>
24
+                <tbody>
25
+                @foreach ($objectives as $objective)
26
+                    <tr data-id="{{ $objective->id }}">
27
+                        <td contenteditable="true" class="name col-md-4" >{{ $objective->text }}</td>
28
+                        {{-- TODO: Use correct data --}}
29
+                        <td contenteditable="true" data-type="textarea" class="definition col-md-6" >{{ 'TODO' }}</td>
30
+                        <td contenteditable="true" class="expected-outcome col-md-1" >{{ $outcome->expected_outcome }}</td>
31
+                    </tr>
32
+                @endforeach
33
+                </tbody>
34
+            </table>
35
+        </div>
36
+    </div>
37
+
38
+@stop
39
+
40
+@section('included-js')
41
+    @include('global._datatables_js')
42
+@stop
43
+
44
+@section('javascript')
45
+
46
+    // ------------------------------------------------------------------------
47
+    // Page Load
48
+    // ------------------------------------------------------------------------
49
+
50
+    // ------------------------------------------------------------------------
51
+    // Events
52
+    // ------------------------------------------------------------------------
53
+
54
+
55
+
56
+    // ------------------------------------------------------------------------
57
+    // Functions
58
+    // ------------------------------------------------------------------------
59
+
60
+@stop

+ 2
- 1
composer.json 查看文件

@@ -12,7 +12,8 @@
12 12
 	},
13 13
 	"require-dev": {
14 14
 		"way/generators": "~2.0",
15
-		"fzaninotto/faker": "1.5.*@dev"
15
+		"fzaninotto/faker": "1.5.*@dev",
16
+		"barryvdh/laravel-ide-helper": "1.11"
16 17
 		},
17 18
 	"autoload": {
18 19
 		"classmap": [