Переглянути джерело

Updated page to make Programs reports

onielm 4 роки тому
джерело
коміт
bdbcaf1262

+ 40
- 4
app/controllers/ProgramsController.php Переглянути файл

@@ -82,13 +82,48 @@ class ProgramsController extends \BaseController
82 82
 
83 83
 public function showReport()
84 84
 {
85
+
86
+
87
+  // create an array with the ID of Semesters selected in the form
88
+  $selected_semesters_id = array();
89
+  $semesters = Semester::all();
90
+  foreach ($semesters as $semester) {
91
+    if ($semester->is_visible){
92
+      if (Input::get('semester'.$semester->id)!=null){
93
+        array_push($selected_semesters_id, $semester->id);
94
+      }
95
+    }
96
+  }
97
+  $selected_semesters = DB::table('semesters')
98
+                        ->wherein('semesters.id',$selected_semesters_id)
99
+                        ->get();
100
+
101
+  // create a srting with the selected metodos de divulgfacion
102
+  $selected_divulgaciones = '';
103
+  $divulgaciones = array('profesores','comiteDepartamental','comiteFacultadEscuela',
104
+                      'pleno','estudiantes','administrativos','senado','comunidadWeb',
105
+                      'otros');
106
+  foreach ($divulgaciones as $divulgacion) {
107
+    if (Input::get($divulgacion)!=null){
108
+      $selected_divulgaciones = $selected_divulgaciones.'\n'.Input::get($divulgacion);
109
+    }
110
+  }
111
+
85 112
   //OUTCOMES Join criteria join program
86 113
   $programs = DB::table('programs')
87
-                        ->select('id')
114
+                        ->select('id','name')
88 115
                         ->orderBy('name', 'asc')
89 116
                         ->get();
90 117
 
91 118
 
119
+
120
+   // $program
121
+   $tables_names = '{';
122
+   foreach ($programs as $program) {
123
+     $tables_names = $tables_names.'"table'.$program->id.'" : "'.$program->name.'",';// code...
124
+   }
125
+   $tables_names = $tables_names.'}';
126
+
92 127
    $title = "Programs Reports";
93 128
    // $title = "Program Report: ".$program->name;
94 129
 
@@ -102,7 +137,7 @@ public function showReport()
102 137
                            ->join('programs','programs.id','=','criteria.program_id')
103 138
                            ->join('courses','courses.program_id','=','programs.id')
104 139
                            ->where('programs.id',$program->id)
105
-                           ->select('outcomes.name')
140
+                           ->select('outcomes.name','outcomes.activation_date')
106 141
                            ->distinct()
107 142
                            ->orderBy('outcomes.name', 'asc')
108 143
                            ->get();
@@ -133,7 +168,7 @@ public function showReport()
133 168
    }
134 169
 
135 170
 
136
-   return View::make('local.managers.shared.program_report', compact('title','programs_info'));
171
+   return View::make('local.managers.shared.program_report', compact('title','programs_info','selected_divulgaciones','selected_semesters','tables_names'));
137 172
 }
138 173
 
139 174
   /**
@@ -197,8 +232,9 @@ public function showReport()
197 232
     $title = "Programs by School";
198 233
     $programs = Program::orderBy('name')->get();
199 234
     $schools = School::all();
235
+    $semesters = Semester::all();
200 236
 
201
-    return View::make('local.managers.shared.programs', compact('programs', 'schools', 'title'));
237
+    return View::make('local.managers.shared.programs', compact('programs', 'schools', 'semesters', 'title'));
202 238
   }
203 239
 
204 240
   /**

+ 1
- 1
app/routes.php Переглянути файл

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

+ 2
- 2
app/views/layouts/master.blade.php Переглянути файл

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

+ 185
- 6
app/views/local/managers/shared/program_report.blade.php
Різницю між файлами не показано, бо вона завелика
Переглянути файл


+ 94
- 1
app/views/local/managers/shared/programs.blade.php Переглянути файл

@@ -11,7 +11,76 @@
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
+  <button class="btn btn-lg btn-primary pull-right" id='show'>Custom Report</button>
15
+  <div class="" id='make_report'>
16
+    <hr>
17
+    <b><h3>Report Options</h3><br></b>
18
+    {{-- For for adding a new outcome --}}
19
+    {{ Form::open(array('action' => 'ProgramsController@showReport')) }}
20
+    <div class="row">
21
+      <div class="col-md-1">
22
+      </div>
23
+      <div class="col-md-5">
24
+      {{ Form::label('name', 'Select which semesters to report on') }}<br>
25
+          @foreach ($semesters as $semester)
26
+            @if ($semester->is_visible)
27
+              <div class="form-group">
28
+                <input type="checkbox" id="semester{{$semester->id}}" name="semester{{$semester->id}}" value="semester{{$semester->id}}">
29
+                <label for="semester{{$semester->id}}">{{$semester->name}}({{$semester->code}})</label>
30
+                {{-- {{ Form::checkbox('semester'.$semester->id, $semester->name, array('class' => 'form-control', 'id'=>$semester->id)) }}
31
+                {{ Form::label('semester'.$semester->id, $semester->name.'('.$semester->code.')') }}<br> --}}
32
+              </div>
33
+            @endif
34
+          @endforeach
35
+      </div>
36
+      <div class="col-md-6">
37
+        {{ Form::label('divulgacion', 'Select metodos de divulgacion') }}<br>
38
+        <div class="form-group">
39
+          <input type="checkbox" id="profesores" name="profesores" value="Profesores (pares)">
40
+          <label for="profesores">Profesores (pares)</label>
41
+        </div>
42
+        <div class="form-group">
43
+          <input type="checkbox" id="comiteDepartamental" name="comiteDepartamental" value="Comites de curriculo departamental">
44
+          <label for="comiteDepartamental">Comites de curriculo departamental</label>
45
+        </div>
46
+        <div class="form-group">
47
+          <input type="checkbox" id="comiteFacultadEscuela" name="comiteFacultadEscuela" value="Comites de curriculo  de Facultad o Escuela">
48
+          <label for="comiteFacultadEscuela">Comites de curriculo  de Facultad o Escuela</label>
49
+        </div>
50
+        <div class="form-group">
51
+          <input type="checkbox" id="pleno" name="pleno" value="Pleno de la Facultad">
52
+          <label for="pleno">Pleno de la Facultad</label>
53
+        </div>
54
+        <div class="form-group">
55
+          <input type="checkbox" id="estudiantes" name="estudiantes" value="Estudiantes">
56
+          <label for="estudiantes">Estudiantes</label>
57
+        </div>
58
+        <div class="form-group">
59
+          <input type="checkbox" id="administrativos" name="administrativos" value="Administrativos">
60
+          <label for="administrativos">Administrativos</label>
61
+        </div>
62
+        <div class="form-group">
63
+          <input type="checkbox" id="senado" name="senado" value="Senado">
64
+          <label for="senado">Senado</label>
65
+        </div>
66
+        <div class="form-group">
67
+          <input type="checkbox" id="comunidadWeb" name="comunidadWeb" value="Comunidad (pagina web)">
68
+          <label for="comunidadWeb">Comunidad (pagina web)</label>
69
+        </div>
70
+        <div class="form-group">
71
+          <input type="checkbox" id="otros" name="otros" value="Otros">
72
+          <label for="otros">Otro- <input type="text" id='otherBox'></label>
73
+        </div>
74
+      </div>
75
+    </div>
76
+    <div class="row">
77
+      <div class=""><button type="submit" id='submit' class="btn btn-lg btn-primary center-block">Create Report</button></div>
78
+    </div>
79
+    {{ Form::close() }}
80
+    <hr>
81
+    <button class="btn btn-lg btn-primary pull-right" id='hide'>Hide Form</button>
82
+  </div>
83
+
15 84
 <div class="row">
16 85
   <div class="col-md-12">
17 86
       <table class="table table-condensed table-stripedd datatable">
@@ -48,3 +117,27 @@
48 117
 @include('global._datatables_js')
49 118
 
50 119
 @stop
120
+
121
+@section('javascript')
122
+
123
+      $('#make_report').hide();
124
+
125
+      //show form
126
+      $('#show').on('click', function(e)
127
+      {
128
+        $('#make_report').show();
129
+        $('#show').hide();
130
+      });
131
+
132
+      //hide form
133
+      $('#hide').on('click', function(e)
134
+      {
135
+        $('#make_report').hide();
136
+        $('#show').show();
137
+      });
138
+
139
+      //on submit, change value of the checkbox input of id 'other'
140
+      $('#submit').click(function(){
141
+        $('#otros').val('Otro- '+$('#otherBox').val());
142
+      });
143
+@stop