소스 검색

jfjyfjygkjh

부모
커밋
1d2717f6bf

+ 37
- 4
app/controllers/AnnualPlansController.php 파일 보기

@@ -463,7 +463,34 @@ class AnnualPlansController extends \BaseController
463 463
 
464 464
     $academic_year = (int) explode(",", $academic_year)[0];
465 465
 
466
-    $course_codes = DB::table('typ_semester_courses')
466
+    $course_codes = DB::table('annual_plan_objective as apo')
467
+      ->join('typ_semester_courses as tyc', 'apo.typ_semester_course_id', '=', 'tyc.id')
468
+      ->join('courses', 'tyc.course_id', '=', 'courses.id')
469
+      ->where('annual_plan_id', $annual_plan_id)
470
+      ->select('courses.code', 'courses.number')
471
+      ->distinct()
472
+      ->get();
473
+    Log::info($course_codes);
474
+    $all_courses_info = [];
475
+
476
+    foreach ($course_codes as $index => $course_code) {
477
+      //$all_courses_info['course_code'][] = $course_code->code . '_' . $course_code->number;
478
+      $courses = Course::where(function ($query) use (&$semester_end, &$semester_start) {
479
+        $query->where('semester_id', $semester_end)
480
+          ->orWhere('semester_id', $semester_start);
481
+      })
482
+        ->where('code', $course_code->code)
483
+        ->where('number', $course_code->number)
484
+        ->where('program_id', $program_id)
485
+        ->get();
486
+      Log::info("run number " . $index);
487
+      Log::info($courses);
488
+      foreach ($courses as $course) {
489
+        $all_courses_info[$course_code->code . '_' . $course_code->number][] = $course->getReportObject();
490
+      }
491
+    }
492
+
493
+    /*$course_codes = DB::table('typ_semester_courses')
467 494
       ->join('typ_semester_objectives as tso', 'tso.id', '=', 'typ_semester_courses.typ_semester_objective_id')
468 495
       ->join('courses', 'courses.id', '=', 'typ_semester_courses.course_id')
469 496
       ->join('typ_semester_outcome as typ_out', 'typ_out.id', '=', 'tso.typ_semester_outcome_id')
@@ -475,8 +502,12 @@ class AnnualPlansController extends \BaseController
475 502
       ->where('typ_program.program_id', $program_id)
476 503
       ->select('courses.code', 'courses.number', 'typ_semester_courses.id as typ_sem_cou_id')
477 504
       ->distinct()
478
-      ->get();
479
-    foreach ($course_codes as $course_code) {
505
+      ->get();*/
506
+
507
+
508
+
509
+
510
+    /*foreach ($course_codes as $course_code) {
480 511
 
481 512
       $course_code->sections = DB::table('courses')
482 513
         ->join('activities', 'activities.course_id', '=', 'courses.id')
@@ -490,6 +521,8 @@ class AnnualPlansController extends \BaseController
490 521
         ->toSql();
491 522
 
492 523
       Log::info($course_code->sections);
493
-    }
524
+    }*/
525
+
526
+    return $all_courses_info;
494 527
   }
495 528
 }

+ 3
- 3
app/models/Activity.php 파일 보기

@@ -179,13 +179,13 @@ class Activity extends Eloquent
179 179
 
180 180
     }*/
181 181
 
182
-    $students_attempted =  DB::table('assessments')
182
+    /* $students_attempted =  DB::table('assessments')
183 183
       ->join('activity_criterion', 'assessments.activity_criterion_id', '=', 'activity_criterion.id')
184 184
       ->where('activity_criterion.activity_id', $this->id)
185 185
 
186
-      ->get();
186
+      ->get();*/
187
+
187 188
 
188
-    $student_criteria = [];
189 189
 
190 190
     foreach ($outcomes as $outcome) {
191 191
       $ac_criteria = DB::table('criterion_objective_outcome as cobo')

+ 44
- 0
app/models/Course.php 파일 보기

@@ -80,6 +80,8 @@ class Course extends Eloquent
80 80
     //   	SELECT distinct cr.outcome_id FROM  courses c, activities a, activity_criterion ac, criteria cr WHERE c.id=a.course_id and a.id=ac.activity_id and ac.criterion_id=cr.id and c.id=1
81 81
     // 	return $this->id;
82 82
   }
83
+
84
+
83 85
   public function outcomes_att()
84 86
   {
85 87
     $criteria_attempted = DB::table('courses')
@@ -111,6 +113,48 @@ class Course extends Eloquent
111 113
     return $outcomes_attempted;
112 114
   }
113 115
 
116
+  public function getReportObject()
117
+  {
118
+    $reportObject = new stdClass();
119
+
120
+    $reportObject->criteriaReport = DB::table('courses')
121
+      ->join('activities', 'activities.course_id', '=', 'courses.id')
122
+      ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
123
+      ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
124
+      ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
125
+      ->join('criteria', 'criteria.id', '=', 'activity_criterion.criterion_id')
126
+      ->join('assessments', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
127
+      ->select(DB::raw(
128
+        "count(assessments.score) as assessed,
129
+       count(case when assessments.score >= rubrics.expected_points then 1 else NULL end) as achieved,
130
+       criteria.*"
131
+      ))
132
+      ->where('courses.id', $this->id)
133
+      ->groupBy('criteria.id')
134
+      ->get();
135
+    Log::info($this->id);
136
+    $reportObject->outcomesReport = DB::table('courses')
137
+      ->join('activities', 'activities.course_id', '=', 'courses.id')
138
+      ->join('rubric_activity', 'rubric_activity.activity_id', '=', 'activities.id')
139
+      ->join('rubrics', 'rubrics.id', '=', 'rubric_activity.rubric_id')
140
+      ->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
141
+      ->join('assessments', 'activity_criterion.id', '=', 'assessments.activity_criterion_id')
142
+      ->join('criterion_objective_outcome', 'activity_criterion.criterion_id', '=', 'criterion_objective_outcome.criterion_id')
143
+      ->join('outcomes', 'criterion_objective_outcome.outcome_id', '=', 'outcomes.id')
144
+      ->select(
145
+        DB::raw(
146
+          "student_id, outcomes.name, outcomes.id,
147
+        count(activity_criterion.criterion_id) as attempted,
148
+        count(case when assessments.score >= rubrics.expected_points then 1 else null end) as achieved"
149
+        )
150
+      )
151
+      ->where('courses.id', $this->id)
152
+      ->groupBy(array('outcome_id', 'student_id'))
153
+      ->get();
154
+
155
+    return $reportObject;
156
+  }
157
+
114 158
   public function outcomes_ach()
115 159
   {
116 160
     $criteria = DB::table('criteria')

+ 53
- 0
app/views/local/managers/pCoords/annual_report.blade.php 파일 보기

@@ -12,6 +12,7 @@
12 12
 
13 13
 @section('main')
14 14
     <div class="row">
15
+        <div class="col-md-3">
15 16
             <div class="category" >
16 17
               <label for="annual_plans">Annual Plan</label>
17 18
               <div class="select">
@@ -23,6 +24,17 @@
23 24
                 </select>
24 25
               </div>
25 26
             </div>
27
+        </div>
28
+
29
+        <div class='col-md-9' id='report'>
30
+            <ul id = 'levelTabs' class = "nav nav-tabs" role = "tablist">
31
+ 
32
+
33
+            </ul>
34
+<div id ='allLists' class="tab-content">
35
+</div>
36
+        </div>
37
+        
26 38
 
27 39
     </div>
28 40
 
@@ -48,7 +60,48 @@
48 60
         },
49 61
         function(data)
50 62
         {
63
+            $('#levelTabs').html(' ');
64
+        $.each(data, function(course_code, course_data){
65
+            
66
+            li = $("<li/>", {
67
+                'role':'presentation'
68
+            });
69
+            li.append($('<a/>',{
70
+                'onclick': "$(this).tab('show')",
71
+                'data-toggle':'tab',
72
+                'href':'#'+course_code,
73
+                'role':'tab'
74
+            }).html(course_code.replace('_',' ')));
75
+
76
+            div = $("<div/>",{
77
+                'role':'tabpanel',
78
+                'class':'tab-pane',
79
+                'id':course_code,
80
+            });
81
+
82
+            title = $("<h3/>",{
83
+                'style':'text-align: center'
84
+            }).html('Course: '+course_code.replace('_',' '));
85
+
86
+            criteriaAssessed = $("<h5/>",{
87
+                'style':'display: inline'
88
+            })
51 89
 
90
+            $('#levelTabs').append(li);
91
+            $("#allLists").append(div);
92
+            
93
+
94
+            $.each(course_data, function(index, reports){
95
+
96
+                $.each(reports.criteriaReport, function(index2, criterion){
97
+
98
+                })
99
+            })
100
+            
101
+
102
+        })
103
+
104
+                  
52 105
         }
53 106
         );
54 107
 

+ 3
- 2
app/views/local/managers/pCoords/new_assessment_report.blade.php 파일 보기

@@ -64,6 +64,7 @@
64 64
 
65 65
                             ->where('code', $course->code)->where('number',$course->number)
66 66
                             ->whereIn('semester_id', Session::get('semesters_ids'))
67
+                            ->orderBy('semester_id')
67 68
                             ->get();
68 69
                             
69 70
                             
@@ -76,10 +77,10 @@
76 77
                                         @section('lists')
77 78
                                         <div role = "tabpanel" class = 'tab-pane' id = "{{$course->code}}-{{$course->number}}">
78 79
                                             @foreach($sections_evaluating as $index3 => $section)
79
-                                            <h3 style="text-align: center"> Course: {{$course->code}} {{$course->number}}-{{$section->section}}</h3> 
80
+                                            <h3 style="text-align: center"> Course: {{$course->code}} {{$course->number}}-{{$section->section}} </h3> 
80 81
                                             @foreach($section->publishedActivities as $index4 => $activity)
81 82
 
82
-                                            <h5 style="display: inline;">Activity {{$index4+1}}: </h4>
83
+                                            <h5 style="display: inline;">Activity {{$index4+1}}: </h5>
83 84
                                             <p style="display: inline;">{{$activity->name}} <strong>({{$activity->date}})</strong></p>
84 85
                                             <br>
85 86
                                             <br>