소스 검색

Created page to generate program reports

onielm 4 년 전
부모
커밋
0d8f7e8010

+ 56
- 0
app/controllers/ProgramsController.php 파일 보기

@@ -80,6 +80,62 @@ class ProgramsController extends \BaseController
80 80
 
81 81
 }
82 82
 
83
+public function showReport()
84
+{
85
+  //OUTCOMES Join criteria join program
86
+  $programs = DB::table('programs')
87
+                        ->select('id')
88
+                        ->orderBy('name', 'asc')
89
+                        ->get();
90
+
91
+
92
+   $title = "Programs Reports";
93
+   // $title = "Program Report: ".$program->name;
94
+
95
+   $programs_info = array();
96
+   //OUTCOMES Join criteria join program
97
+   foreach ($programs as $program) {
98
+     $info_by_id = Program::find($program->id);
99
+
100
+     $domains = DB::table('outcomes')
101
+                           ->join('criteria','criteria.outcome_id','=','outcomes.id')
102
+                           ->join('programs','programs.id','=','criteria.program_id')
103
+                           ->join('courses','courses.program_id','=','programs.id')
104
+                           ->where('programs.id',$program->id)
105
+                           ->select('outcomes.name')
106
+                           ->distinct()
107
+                           ->orderBy('outcomes.name', 'asc')
108
+                           ->get();
109
+
110
+     $courses_used = DB::table('outcomes')
111
+                           ->join('criteria','criteria.outcome_id','=','outcomes.id')
112
+                           ->join('programs','programs.id','=','criteria.program_id')
113
+                           ->join('courses','courses.program_id','=','programs.id')
114
+                           ->where('programs.id',$program->id)
115
+                           ->select('courses.number', 'outcomes.name as domain_name', 'courses.code')
116
+                           ->distinct()
117
+                           ->orderBy('courses.name', 'asc')
118
+                           ->get();
119
+
120
+     $transformative_actions = DB::table('outcomes')
121
+                           ->join('criteria','criteria.outcome_id','=','outcomes.id')
122
+                           ->join('programs','programs.id','=','criteria.program_id')
123
+                           ->join('courses','courses.program_id','=','programs.id')
124
+                           ->join('activities','activities.course_id','=','courses.id')
125
+                           ->join('activity_criterion','activity_criterion.activity_id','=','activities.id')
126
+                           ->where('programs.id',$program->id)
127
+                           ->select('activity_criterion.transformative_actions', 'outcomes.name as domain_name')
128
+                           ->distinct()
129
+                           ->orderBy('activity_criterion.transformative_actions', 'asc')
130
+                           ->get();
131
+     $info = array($info_by_id, $domains, $courses_used, $transformative_actions);
132
+     array_push($programs_info, $info);
133
+   }
134
+
135
+
136
+   return View::make('local.managers.shared.program_report', compact('title','programs_info'));
137
+}
138
+
83 139
   /**
84 140
    * Info to print a program
85 141
    */

+ 1
- 0
app/routes.php 파일 보기

@@ -290,6 +290,7 @@ Route::group(array('before' => 'auth|has_access'), function()
290 290
         Route::get('school-coordinator', 'SchoolCoordinatorsController@overview');
291 291
         Route::get('school/{id}', 'SchoolsController@show');
292 292
         Route::get('program/{id}', 'ProgramsController@show');
293
+        Route::get('programs/report', 'ProgramsController@showReport');
293 294
         Route::get('programs', 'ProgramsController@index');
294 295
         Route::get('template-list', 'TemplatesController@schoolCoordinatorIndex');
295 296
 

+ 2
- 0
app/views/layouts/master.blade.php 파일 보기

@@ -164,6 +164,7 @@
164 164
         /////
165 165
 
166 166
         var table = null;
167
+        var tables = [];
167 168
         $('.datatable').each(function()
168 169
         {
169 170
             table = $(this).DataTable({
@@ -270,6 +271,7 @@
270 271
                     }
271 272
                 ],
272 273
             });
274
+            tables.push(table);
273 275
 
274 276
             // Apply the search
275 277
             table.columns().every( function ()

+ 124
- 0
app/views/local/managers/shared/program_report.blade.php 파일 보기

@@ -0,0 +1,124 @@
1
+@extends('layouts.master')
2
+
3
+{{-- TODO:ver queien tiene acceso a esta pagina y editar los navegations correspondientes --}}
4
+@section('navigation')
5
+    @if(Auth::User()->role==1)
6
+        @include('local.managers.admins._navigation')
7
+    @elseif(Auth::User()->role==2)
8
+        @include('local.managers.sCoords._navigation')
9
+    @elseif(Auth::User()->role==3)
10
+        @include('local.managers.pCoords._navigation')
11
+    @endif
12
+@stop
13
+
14
+@section('main')
15
+  <button class="btn btn-primary pull-right" id="exportAll">Export All (PDF)</button>
16
+
17
+      <div class="row">
18
+          <div class="col-md-12">
19
+            @foreach ($programs_info as $program)
20
+
21
+            <h3 id="{{ $program[0]->id }}" class="outcome">{{ $program[0]->name }}</h3>
22
+              <table id="table{{ $program[0]->id }}" class="table table-condensed table-bordered datatable">
23
+                  <thead>
24
+                    <tr class="center-text">
25
+                        <th>Campus Domains <br>
26
+                          ({{$program[0]->name}})
27
+                         </th>
28
+                        <th>Results based on target (% of students scoring >= target)</th>
29
+                        <th>Courses used to measure and tools</th>
30
+                        <th>Summary of dissemination methods employed</th>
31
+                        <th>Summary of transformative actions or improvement</th>
32
+                    </tr>
33
+                  </thead>
34
+                  <tfoot>
35
+                      <tr class="column-search">
36
+                          <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
37
+                          <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
38
+                          <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
39
+                          <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
40
+                          <th><input class="column-search-bar form-control" type="text" placeholder="Buscar"/></th>
41
+                      </tr>
42
+                  </tfoot>
43
+                  <tbody>
44
+                  @foreach ($program[1] as $domain)
45
+                    <tr>
46
+                        <td>
47
+                          {{$domain->name}}
48
+                        </td>
49
+                        <td>### Measurement <br>
50
+                          (semester) <br>
51
+                          <br>
52
+                          ###% <br>
53
+                          N= ## <br>
54
+                         </td>
55
+                        <td>
56
+                          <b>Courses</b><br>
57
+                          @foreach ($program[2] as $course)
58
+                            @if ($course->domain_name == $domain->name)
59
+                              {{$course->code}} ({{$course->number}}) <br>
60
+                            @endif
61
+                          @endforeach
62
+                          <br>
63
+                          <b>Tools</b><br>
64
+
65
+                          <br>
66
+                        </td>
67
+                        <td>(No esta implementado)</td>
68
+                        <td>
69
+                          @foreach ($program[3] as $action)
70
+                            @if ($action->domain_name == $domain->name)
71
+                              {{$action->transformative_actions}}<br><br>
72
+                            @endif
73
+                          @endforeach
74
+                        </td>
75
+                      </tr>
76
+                @endforeach
77
+              </tbody>
78
+              </table>
79
+            @endforeach
80
+          </div>
81
+      </div>
82
+      <span class="js-vars"
83
+          data-pdf-url="{{ URL::action('OutcomesController@assessmentReport') }}"
84
+      ></span>
85
+
86
+@stop
87
+
88
+@section('included-js')
89
+    @include('global._datatables_js')
90
+@stop
91
+
92
+
93
+@section('javascript')
94
+
95
+$(document).ready(function()
96
+{
97
+  // --------------------------------------------------------------------------
98
+  // Page load
99
+  // --------------------------------------------------------------------------
100
+
101
+  // --------------------------------------------------------------------------
102
+  // Functions
103
+  // --------------------------------------------------------------------------
104
+
105
+  // --------------------------------------------------------------------------
106
+  // Events
107
+  // --------------------------------------------------------------------------
108
+
109
+  // When export button is clicked, export all tables as PDF
110
+  $(document).on('click', '#exportAll', function() {
111
+    var r = confirm("Are you sure you want to download all programs info as separate PDFs? \n It may take a moment to process.");
112
+    if (r == true) {
113
+
114
+      //var 'tables' is defined in master.blade.php
115
+
116
+      $.each(tables, function(index, table)
117
+      {
118
+        table.buttons('0-2').trigger();
119
+      });
120
+
121
+    }
122
+  });
123
+});
124
+@stop

+ 2
- 1
app/views/local/managers/shared/programs.blade.php 파일 보기

@@ -11,6 +11,7 @@
11 11
 @stop
12 12
 
13 13
 @section('main')
14
+  <a href="{{ action('ProgramsController@showReport'); }}" class="btn btn-primary pull-right" alt="print">Report</a>
14 15
 <div class="row">
15 16
   <div class="col-md-12">
16 17
       <table class="table table-condensed table-stripedd datatable">
@@ -46,4 +47,4 @@
46 47
 <!-- Datatables -->
47 48
 @include('global._datatables_js')
48 49
 
49
-@stop
50
+@stop