Browse Source

Push de views a formative actions.

Falta algo, falta arreglar activity cobntroller a ver como cataloga los transformative actions.
parent
commit
fb57fc4e75

+ 2
- 1
.gitignore View File

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

+ 5
- 10
app/controllers/ActivitiesController.php View File

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

+ 3
- 3
app/controllers/AuthController.php View File

28
 
28
 
29
 		if (!$validator->fails()) {
29
 		if (!$validator->fails()) {
30
 			//			TODO: Remove this for production environment
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
 			try {
34
 			try {
35
 				// User input
35
 				// User input
36
 				$username = str_replace('@upr.edu', '', Input::get('email'));
36
 				$username = str_replace('@upr.edu', '', Input::get('email'));

+ 30
- 9
app/controllers/TransformativeActionsController.php View File

1229
         break;
1229
         break;
1230
 
1230
 
1231
       case 2:
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
         break;
1234
         break;
1235
       case 3:
1235
       case 3:
1236
         $programs = DB::table('programs')
1236
         $programs = DB::table('programs')
1241
         $schools = DB::table('schools')->where('id', $programs[0]->school_id)->get();
1241
         $schools = DB::table('schools')->where('id', $programs[0]->school_id)->get();
1242
         break;
1242
         break;
1243
     }
1243
     }
1244
+
1244
     return View::make('local.managers.shared.view_formative', compact('title', 'outcomes', 'schools', 'programs', 'semesters'));
1245
     return View::make('local.managers.shared.view_formative', compact('title', 'outcomes', 'schools', 'programs', 'semesters'));
1245
   }
1246
   }
1246
 
1247
 
1285
 
1286
 
1286
 
1287
 
1287
     //each row has objectives, repeated ta, but distinct activity_criterion_id
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
       ->join('transformative_objective as trob', 'trob.objective_id', '=', 'typ_semester_objectives.objective_id')
1290
       ->join('transformative_objective as trob', 'trob.objective_id', '=', 'typ_semester_objectives.objective_id')
1290
       ->join('objectives', 'trob.objective_id', '=', 'objective_id')
1291
       ->join('objectives', 'trob.objective_id', '=', 'objective_id')
1291
       ->join('transformative_actions', 'transformative_actions.id', 'trob.ta_id')
1292
       ->join('transformative_actions', 'transformative_actions.id', 'trob.ta_id')
1295
       ->distinct()
1296
       ->distinct()
1296
       ->get();
1297
       ->get();
1297
 
1298
 
1298
-    $objective_ta = DB::table('typ_semester_objectives')
1299
+     $objective_ta = DB::table('typ_semester_objectives')
1299
       ->join('transformative_objective as trob', 'trob.objective_id', '=', 'typ_semester_objectives.objective_id')
1300
       ->join('transformative_objective as trob', 'trob.objective_id', '=', 'typ_semester_objectives.objective_id')
1300
       ->join('objectives', 'trob.objective_id', '=', 'objective_id')
1301
       ->join('objectives', 'trob.objective_id', '=', 'objective_id')
1301
       ->join('transformative_actions', 'transformative_actions.id', 'trob.ta_id')
1302
       ->join('transformative_actions', 'transformative_actions.id', 'trob.ta_id')
1303
       ->select('transformative_actions.*')
1304
       ->select('transformative_actions.*')
1304
       ->addSelect('objectives.*')
1305
       ->addSelect('objectives.*')
1305
       ->distinct()
1306
       ->distinct()
1306
-      ->lists();
1307
+      ->lists();*/
1307
 
1308
 
1308
 
1309
 
1309
 
1310
 
1315
       ->whereIn('program_id', $programs)
1316
       ->whereIn('program_id', $programs)
1316
       ->whereIn('semester_id', $semesters)
1317
       ->whereIn('semester_id', $semesters)
1317
       ->join('activities', 'activities.course_id', '=', 'courses.id')
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
       ->select('courses.*')
1321
       ->select('courses.*')
1319
       ->groupBy(array('courses.code', 'courses.name', 'courses.semester_id'))
1322
       ->groupBy(array('courses.code', 'courses.name', 'courses.semester_id'))
1320
       ->get();
1323
       ->get();
1328
       $course_name->sections = DB::table('courses')
1331
       $course_name->sections = DB::table('courses')
1329
         ->where('code', $course_name->code)
1332
         ->where('code', $course_name->code)
1330
         ->where('name', $course_name->name)
1333
         ->where('name', $course_name->name)
1331
-        ->where('semester_id', $course_name->semester)
1334
+        ->where('semester_id', $course_name->semester_id)
1332
         ->where('program_id', $course_name->program_id)
1335
         ->where('program_id', $course_name->program_id)
1333
         ->get();
1336
         ->get();
1334
       foreach ($course_name->sections as $section) {
1337
       foreach ($course_name->sections as $section) {
1339
           ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
1342
           ->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
1340
           ->join('transformative_actions', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
1343
           ->join('transformative_actions', 'transformative_activity_criterion.trans_action_id', '=', 'transformative_actions.id')
1341
           ->where('activities.course_id', $section->id)
1344
           ->where('activities.course_id', $section->id)
1345
+          ->where('activities.draft', 0)
1342
           ->where('criterion_objective_outcome.outcome_id', $outcome_id)
1346
           ->where('criterion_objective_outcome.outcome_id', $outcome_id)
1343
           ->select('activities.id as activity_id', 'activities.name')
1347
           ->select('activities.id as activity_id', 'activities.name')
1344
           ->addSelect('transformative_actions.*', 'transformative_activity_criterion.trans_action_id as trans_action_id')
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
           ->get();
1350
           ->get();
1347
         foreach ($section->activities as $activity) {
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
           $activity->objectives = DB::table('transformative_objective')
1359
           $activity->objectives = DB::table('transformative_objective')
1349
             ->join('objectives', 'transformative_objective.objective_id', '=', 'objectives.id')
1360
             ->join('objectives', 'transformative_objective.objective_id', '=', 'objectives.id')
1350
             ->where('ta_id', $activity->trans_action_id)
1361
             ->where('ta_id', $activity->trans_action_id)
1351
             ->get();
1362
             ->get();
1352
           foreach ($activity->objectives as $objective) {
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
             $objective->criterion = DB::table('criterion_objective_outcome')
1374
             $objective->criterion = DB::table('criterion_objective_outcome')
1354
               ->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
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
               ->where('activity_criterion.activity_id', $activity->activity_id)
1377
               ->where('activity_criterion.activity_id', $activity->activity_id)
1357
               ->where('objective_id', $objective->objective_id)
1378
               ->where('objective_id', $objective->objective_id)
1358
               ->select('criteria.*')
1379
               ->select('criteria.*')
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 View File

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

+ 98
- 25
app/views/local/managers/shared/view_formative.blade.php View File

84
         @foreach ($outcomes as $outcome)
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
         @endforeach
89
         @endforeach
90
       </div>
90
       </div>
91
     </div>
91
     </div>
92
 
92
 
93
     <div class="col-md-9">
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
         <div class="panel-heading">
98
         <div class="panel-heading">
96
           <h4 class=" panel-title" style="cursor:auto!important;">
99
           <h4 class=" panel-title" style="cursor:auto!important;">
97
           </h4>
100
           </h4>
106
             {{-- <table id="example" class="table table-striped table-condensed" width="100%"></table> --}}
109
             {{-- <table id="example" class="table table-striped table-condensed" width="100%"></table> --}}
107
           </div>
110
           </div>
108
         </div>
111
         </div>
109
-      </div>
112
+      </div>-->
110
     </div>
113
     </div>
111
 
114
 
112
     <div class="col-md-9">
115
     <div class="col-md-9">
277
         return table;
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
 $(document).ready(function()
376
 $(document).ready(function()
282
 {
377
 {
283
   // --------------------------------------------------------------------------
378
   // --------------------------------------------------------------------------
302
   // When export button is clicked, export all tables as PDF
397
   // When export button is clicked, export all tables as PDF
303
  
398
  
304
   // When list item is clicked, load corresponding info
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
     </script>
402
     </script>
330
 @stop
403
 @stop