Преглед на файлове

Push de views a formative actions.

Falta algo, falta arreglar activity cobntroller a ver como cataloga los transformative actions.
Gabriel Santiago Plaza преди 3 години
родител
ревизия
fb57fc4e75

+ 2
- 1
.gitignore Целия файл

@@ -12,4 +12,5 @@ app/config/app.php
12 12
 app/config/database.php
13 13
 node_modules/
14 14
 app/config/
15
-app/controllers/AuthController.php
15
+app/controllers/AuthController.php
16
+app/controllers/AuthController.php

+ 5
- 10
app/controllers/ActivitiesController.php Целия файл

@@ -197,8 +197,7 @@ class ActivitiesController extends \BaseController
197 197
             ->join('rubric_title', 'rubric_title.title_id', '=', 'titles.id')
198 198
             ->where('rubric_title.rubric_id', '=', $rubric->id)
199 199
             ->lists('text');
200
-        Log::info($rubric);
201
-        Log::info($activity);
200
+
202 201
         $rubric_criterion = DB::table('criteria')
203 202
             ->join("rubric_criterion", "rubric_criterion.criterion_id", "=", "criteria.id")
204 203
             ->join("activity_criterion", "criteria.id", '=', 'activity_criterion.criterion_id')
@@ -208,8 +207,7 @@ class ActivitiesController extends \BaseController
208 207
             ->addSelect('activity_criterion.activity_id', 'activity_criterion.weight', 'activity_criterion.id as activity_criterion_id')
209 208
             ->addSelect('rubric_criterion.rubric_id', 'rubric_criterion.id as rubric_criterion_id')
210 209
             ->get();
211
-        Log::info("EN mi cuarto o o o");
212
-        Log::info($rubric_criterion);
210
+
213 211
         foreach ($rubric_criterion as $index => $singleCR) {
214 212
             $singleCR->scales = json_encode(DB::table('scales')
215 213
                 ->join('criterion_scale', 'criterion_scale.scale_id', '=', 'scales.id')
@@ -218,8 +216,7 @@ class ActivitiesController extends \BaseController
218 216
                 ->lists('description'));
219 217
         }
220 218
         $rubric_criterion_ids = DB::table('rubric_criterion')->where('rubric_id', '=', $rubric->id)->lists('id');
221
-        Log::info($rubric);
222
-        Log::info($rubric_criterion);
219
+
223 220
 
224 221
 
225 222
 
@@ -227,12 +224,12 @@ class ActivitiesController extends \BaseController
227 224
 
228 225
         // Get results
229 226
         $activity_criterion_ids = DB::table('activity_criterion')->where("activity_id", '=', $activity->id)->lists('id');
230
-        Log::info($activity_criterion_ids);
227
+
231 228
         $assessments = DB::table('assessments')
232 229
             ->join('students', 'assessments.student_id', '=', 'students.id')
233 230
             ->whereIn('activity_criterion_id', $activity_criterion_ids)
234 231
             ->orderBy('assessments.id', 'asc')->get();
235
-        Log::info($assessments);
232
+
236 233
         // Decode the scores (blade workaround)
237 234
         $scores_array = array();
238 235
 
@@ -242,8 +239,6 @@ class ActivitiesController extends \BaseController
242 239
                 ->where("activity_id", '=', $activity->id)
243 240
                 ->select('comments')->first()->comments;
244 241
         }
245
-        Log::info($assessments);
246
-        Log::info($scores_array);
247 242
 
248 243
 
249 244
         return View::make('local.professors.assessment', compact('activity', 'title', 'students', 'course', 'rubric_criterion', 'assessments', 'scores_array', 'rubric'));

+ 3
- 3
app/controllers/AuthController.php Целия файл

@@ -28,9 +28,9 @@ class AuthController extends \BaseController
28 28
 
29 29
 		if (!$validator->fails()) {
30 30
 			//			TODO: Remove this for production environment
31
-// 			if (App::environment('local', 'staging')) {
32
-// 				return $this->processLogin();
33
-// 			}
31
+			if (App::environment('local', 'staging')) {
32
+				return $this->processLogin();
33
+			}
34 34
 			try {
35 35
 				// User input
36 36
 				$username = str_replace('@upr.edu', '', Input::get('email'));

+ 30
- 9
app/controllers/TransformativeActionsController.php Целия файл

@@ -1229,8 +1229,8 @@ class TransformativeActionsController extends \BaseController
1229 1229
         break;
1230 1230
 
1231 1231
       case 2:
1232
-        $schools = DB::table('schools')->where('id', Auth::user()->school_id)->first();
1233
-        $programs = DB::table('programs')->where('school_id', $schools->id)->get();
1232
+        $schools = DB::table('schools')->where('id', Auth::user()->school_id)->get();
1233
+        $programs = DB::table('programs')->where('school_id', $schools[0]->id)->get();
1234 1234
         break;
1235 1235
       case 3:
1236 1236
         $programs = DB::table('programs')
@@ -1241,6 +1241,7 @@ class TransformativeActionsController extends \BaseController
1241 1241
         $schools = DB::table('schools')->where('id', $programs[0]->school_id)->get();
1242 1242
         break;
1243 1243
     }
1244
+
1244 1245
     return View::make('local.managers.shared.view_formative', compact('title', 'outcomes', 'schools', 'programs', 'semesters'));
1245 1246
   }
1246 1247
 
@@ -1285,7 +1286,7 @@ class TransformativeActionsController extends \BaseController
1285 1286
 
1286 1287
 
1287 1288
     //each row has objectives, repeated ta, but distinct activity_criterion_id
1288
-    $objective_ta = DB::table('typ_semester_objectives')
1289
+    /* $objective_ta = DB::table('typ_semester_objectives')
1289 1290
       ->join('transformative_objective as trob', 'trob.objective_id', '=', 'typ_semester_objectives.objective_id')
1290 1291
       ->join('objectives', 'trob.objective_id', '=', 'objective_id')
1291 1292
       ->join('transformative_actions', 'transformative_actions.id', 'trob.ta_id')
@@ -1295,7 +1296,7 @@ class TransformativeActionsController extends \BaseController
1295 1296
       ->distinct()
1296 1297
       ->get();
1297 1298
 
1298
-    $objective_ta = DB::table('typ_semester_objectives')
1299
+     $objective_ta = DB::table('typ_semester_objectives')
1299 1300
       ->join('transformative_objective as trob', 'trob.objective_id', '=', 'typ_semester_objectives.objective_id')
1300 1301
       ->join('objectives', 'trob.objective_id', '=', 'objective_id')
1301 1302
       ->join('transformative_actions', 'transformative_actions.id', 'trob.ta_id')
@@ -1303,7 +1304,7 @@ class TransformativeActionsController extends \BaseController
1303 1304
       ->select('transformative_actions.*')
1304 1305
       ->addSelect('objectives.*')
1305 1306
       ->distinct()
1306
-      ->lists();
1307
+      ->lists();*/
1307 1308
 
1308 1309
 
1309 1310
 
@@ -1315,6 +1316,8 @@ class TransformativeActionsController extends \BaseController
1315 1316
       ->whereIn('program_id', $programs)
1316 1317
       ->whereIn('semester_id', $semesters)
1317 1318
       ->join('activities', 'activities.course_id', '=', 'courses.id')
1319
+      ->join('activity_criterion', 'activities.id', '=', 'activity_criterion.activity_id')
1320
+      ->join('transformative_activity_criterion as tac', 'tac.activity_criterion_id', '=', 'activity_criterion.id')
1318 1321
       ->select('courses.*')
1319 1322
       ->groupBy(array('courses.code', 'courses.name', 'courses.semester_id'))
1320 1323
       ->get();
@@ -1328,7 +1331,7 @@ class TransformativeActionsController extends \BaseController
1328 1331
       $course_name->sections = DB::table('courses')
1329 1332
         ->where('code', $course_name->code)
1330 1333
         ->where('name', $course_name->name)
1331
-        ->where('semester_id', $course_name->semester)
1334
+        ->where('semester_id', $course_name->semester_id)
1332 1335
         ->where('program_id', $course_name->program_id)
1333 1336
         ->get();
1334 1337
       foreach ($course_name->sections as $section) {
@@ -1339,20 +1342,38 @@ class TransformativeActionsController extends \BaseController
1339 1342
           ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
1340 1343
           ->join('transformative_actions', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
1341 1344
           ->where('activities.course_id', $section->id)
1345
+          ->where('activities.draft', 0)
1342 1346
           ->where('criterion_objective_outcome.outcome_id', $outcome_id)
1343 1347
           ->select('activities.id as activity_id', 'activities.name')
1344 1348
           ->addSelect('transformative_actions.*', 'transformative_activity_criterion.trans_action_id as trans_action_id')
1345
-          ->groupBy('transformative_actions.id_')
1349
+          ->groupBy('transformative_actions.id')
1346 1350
           ->get();
1347 1351
         foreach ($section->activities as $activity) {
1352
+          /*$activity->criterion = DB::table('transformative_activity_criterion')
1353
+          ->join('activity_criterion','activity_criterion.id','=','transformative_activity_criterion.activity_criterion_id')
1354
+          ->join('activities','activities.id','=','activity_criterion.activity_id')
1355
+          ->join('criteria','activity_criterion.criterion_id','=','criteria.id')
1356
+          ->where('activity_id', $activity->id)
1357
+          ->select('criteria')*/
1358
+          Log::info($activity->trans_action_id);
1348 1359
           $activity->objectives = DB::table('transformative_objective')
1349 1360
             ->join('objectives', 'transformative_objective.objective_id', '=', 'objectives.id')
1350 1361
             ->where('ta_id', $activity->trans_action_id)
1351 1362
             ->get();
1352 1363
           foreach ($activity->objectives as $objective) {
1364
+            Log::info($activity->activity_id);
1365
+            Log::info($objective->objective_id);
1366
+            Log::info(DB::table('criterion_objective_outcome')
1367
+              ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
1368
+              ->join('criteria', 'criteria.id', '=', 'activity_criterion.criterion_id')
1369
+              ->where('activity_criterion.activity_id', $activity->activity_id)
1370
+              ->where('objective_id', $objective->objective_id)
1371
+              ->select('criteria.*')
1372
+              ->distinct()
1373
+              ->toSql());
1353 1374
             $objective->criterion = DB::table('criterion_objective_outcome')
1354 1375
               ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
1355
-              ->join('criteria', 'criteria.id', '=', 'activity_criterion.criteria_id')
1376
+              ->join('criteria', 'criteria.id', '=', 'activity_criterion.criterion_id')
1356 1377
               ->where('activity_criterion.activity_id', $activity->activity_id)
1357 1378
               ->where('objective_id', $objective->objective_id)
1358 1379
               ->select('criteria.*')
@@ -1362,6 +1383,6 @@ class TransformativeActionsController extends \BaseController
1362 1383
         }
1363 1384
       }
1364 1385
     }
1365
-    Log::info($grouped_courses);
1386
+    return $grouped_courses;
1366 1387
   }
1367 1388
 }

+ 1
- 0
app/views/local/managers/sCoords/_navigation.blade.php Целия файл

@@ -10,6 +10,7 @@
10 10
         <ul class="dropdown-menu" role="menu">
11 11
           <li>{{ HTML::linkAction('CriteriaController@index', 'Outcomes and Criteria') }}</li>
12 12
           <li>{{ HTML::linkAction('CriteriaController@objectivesIndex', 'Objectives and Criteria') }}</li>
13
+          <li>{{ HTML::linkAction('TransformativeActionsController@viewFormativeActions', 'Tranformative and Formative Actions')}}
13 14
         </ul>
14 15
       </li>
15 16
       <li class="dropdown">

+ 98
- 25
app/views/local/managers/shared/view_formative.blade.php Целия файл

@@ -84,14 +84,17 @@
84 84
         @foreach ($outcomes as $outcome)
85 85
           
86 86
             
87
-              <li data-outcome-id="{{ $outcome->id }}"class="list-group-item">{{ $outcome->name }} </li>
87
+              <li data-outcome-id="{{ $outcome->id }}"class="list-group-item" onclick = "fetchData($(this),$('#semesters'), $('#program') )">{{ $outcome->name }} </li>
88 88
         
89 89
         @endforeach
90 90
       </div>
91 91
     </div>
92 92
 
93 93
     <div class="col-md-9">
94
-      <div id="outcome-display" class="panel panel-default">
94
+      <div id= "transformative-display">
95
+
96
+      </div>
97
+      <!--<div id="outcome-display" class="panel panel-default">
95 98
         <div class="panel-heading">
96 99
           <h4 class=" panel-title" style="cursor:auto!important;">
97 100
           </h4>
@@ -106,7 +109,7 @@
106 109
             {{-- <table id="example" class="table table-striped table-condensed" width="100%"></table> --}}
107 110
           </div>
108 111
         </div>
109
-      </div>
112
+      </div>-->
110 113
     </div>
111 114
 
112 115
     <div class="col-md-9">
@@ -277,7 +280,99 @@ function createDataTable(table1){
277 280
         return table;
278 281
 }
279 282
 
283
+function fetchData(outcome, semester, program){
284
+  //$('.list-group-item').on('click', function()
285
+ // {
286
+    var id = outcome.data('outcome-id');
287
+    var semesters = semester.val();
288
+    var programs = program.val();
289
+
290
+    $.post(
291
+    "{{ URL::action('TransformativeActionsController@fetchCourses') }}",
292
+    { id: id, 
293
+        
294
+        programs:programs,
295
+        semesters:semesters,
296
+
297
+    
298
+    },
299
+    function(data)
300
+    {
301
+        $('#transformative-display').html('');
302
+        var ul = $('<ul/>',{
303
+          'id':'levelTabs',
304
+          'class':'nav nav-tabs',
305
+          'role':'tablist'
306
+        });
307
+        var divContent = $("<div/>",{
308
+          'class':'tab-content'});
309
+
310
+
311
+
312
+        $.each(data, function(index, groupedCourse){
313
+          var li = $('<li/>',{
314
+            'role':'presentation',
315
+            
316
+          
317
+          })
318
+          var a = $('<a/>', {
319
+            'onclick':"$(this).tab('show')",
320
+            "data-toggle":"tab",
321
+            'href':'#'+groupedCourse.code+'-'+groupedCourse.number,
322
+            'aria-controls':groupedCourse.code+'-'+groupedCourse.number,
323
+            'role':'tab'
324
+          }).html( groupedCourse.code+' '+groupedCourse.number);
325
+
326
+          li.append(a);
327
+          ul.append(li);
328
+
329
+          divPanel = $('<div/>', {
330
+            'role':'tabpanel',
331
+            'class':'tab-pane',
332
+            'id':groupedCourse.code+'-'+groupedCourse.number
333
+          });
334
+          $table= $('<table/>',{
335
+               "class": "table table-striped table-condensed datatable",
336
+               //"style": "table-layout: fixed",
337
+               "id": 'allTablesToExport'+index,
338
+          "data-title":groupedCourse.code+'-'+groupedCourse.number});
339
+        $thead = $('<thead/>').html("<tr><th>Formative Actions</th><th>Section</th><th>Criteria</th><th>Activity</th></tr>");
340
+        $tbody = $('<tbody/>');
341
+        $table.append($thead);
342
+        $table.append($tbody);
343
+        divPanel.append($table);
344
+        $table = createDataTable($table);
345
+        
346
+          $.each(groupedCourse.sections, function(index2, sections){
347
+            courseHTML = sections.section;
348
+            $.each(sections.activities, function(index3, activities){
349
+              $table.row.add([
350
+                activities.description,
351
+                courseHTML,
352
+                "test",
353
+                activities.name
354
+              ])
355
+              
356
+            })
357
+            $table.draw();
358
+          }
359
+          );
360
+
361
+          divContent.append(divPanel);
362
+
363
+        })
364
+        $('#transformative-display').append(ul);
365
+        $('#transformative-display').append(divContent);
366
+        $("a[role='tab']").first().tab('show');
367
+        $('.no-outcome').hide();
368
+        
369
+
370
+    }
371
+    );
280 372
 
373
+
374
+  //})
375
+}
281 376
 $(document).ready(function()
282 377
 {
283 378
   // --------------------------------------------------------------------------
@@ -302,29 +397,7 @@ $(document).ready(function()
302 397
   // When export button is clicked, export all tables as PDF
303 398
  
304 399
   // When list item is clicked, load corresponding info
305
-  $('.list-group-item').on('click', function()
306
-  {
307
-    var id = $(this).data('outcome-id');
308
-    var semester = $('#semesters').val();
309
-    var programs = $('#program').val();
310
-
311
-    $.post(
312
-    "{{ URL::action('TransformativeActionsController@fetchCourses') }}",
313
-    { id: id, 
314
-        
315
-        programs:programs,
316
-        semesters:semesters,
317 400
 
318
-    
319
-    },
320
-    function(data)
321
-    {
322
-        
323
-    }
324
-    );
325
-
326
-
327
-  })
328 401
 });
329 402
     </script>
330 403
 @stop