Browse Source

todo hasta 2020-11-18 para adaptar a la nueva estructura de la bd. Falta manejar rubricas y assessment

Jose Quinones 4 years ago
parent
commit
3c621aaf63

+ 2
- 0
app/config/app.php View File

@@ -124,6 +124,7 @@ return array(
124 124
 		'Illuminate\Workbench\WorkbenchServiceProvider',
125 125
 		'Way\Generators\GeneratorsServiceProvider',
126 126
 		'Barryvdh\DomPDF\ServiceProvider',
127
+		'Cornford\Backup\Providers\BackupServiceProvider',
127 128
 		'Zizaco\Entrust\EntrustServiceProvider'
128 129
 
129 130
 	),
@@ -157,6 +158,7 @@ return array(
157 158
 		'App'               => 'Illuminate\Support\Facades\App',
158 159
 		'Artisan'           => 'Illuminate\Support\Facades\Artisan',
159 160
 		'Auth'              => 'Illuminate\Support\Facades\Auth',
161
+		'Backup'	        => 'Cornford\Backup\Facades\Backup',
160 162
 		'Blade'             => 'Illuminate\Support\Facades\Blade',
161 163
 		'Cache'             => 'Illuminate\Support\Facades\Cache',
162 164
 		'ClassLoader'       => 'Illuminate\Support\ClassLoader',

+ 1
- 1
app/controllers/ActivitiesController.php View File

@@ -123,7 +123,7 @@ class ActivitiesController extends \BaseController {
123 123
         $course = Course::where('id', '=', $activity->course_id)->firstOrFail();
124 124
 
125 125
         // If activity does not belong to the requesting user, display 403
126
-        if ($course->user_id != Auth::id())
126
+        if ($course->user_id != Auth::id() and Auth::user()->role==4)
127 127
             App::abort('403', 'Access Forbidden');
128 128
 
129 129
         // Get active semesters

+ 273
- 174
app/controllers/AdministratorsController.php View File

@@ -1,207 +1,306 @@
1 1
 <?php
2 2
 
3 3
 class AdministratorsController extends \BaseController
4
-{
4
+{	
5
+	private function outcomes_semesters($selected_semesters, $level)
6
+	{
7
+		$min_start="9000-01-01 00:00:00";
8
+		$max_end="1000-01-01 00:00:00";
9
+		foreach($selected_semesters as $semester)
10
+		{
11
+			if($min_start>$semester->start)
12
+			{
13
+				$min_start=$semester->start;
14
+			}
15
+			if($max_end<$semester->end)
16
+			{
17
+				$max_end=$semester->end;
18
+			}
19
+		}
20
+		$outcomes = Outcome::where(function($query) use ($min_start)
21
+								   {
22
+										$query->where('deactivation_date', '>=', $min_start)
23
+											  ->orWhere('deactivation_date', null);
24
+								   })
25
+							->where('activation_date', '<=', $max_end)
26
+							->where(function($query2) use ($level)
27
+									{
28
+										$query2->where("level", $level+1)
29
+											   ->orWhere("level",3);
30
+									})
31
+							->orderBy('name', 'ASC')
32
+							->get();
33
+        $outcomeCount = Outcome::where(function($query) use ($min_start)
34
+									   {
35
+											$query->where('deactivation_date', '>=', $min_start)
36
+												  ->orWhere('deactivation_date', null);
37
+										})
38
+							->where('activation_date', '<=', $max_end)
39
+							->where(function($query2) use ($level)
40
+										{
41
+											$query2->where("level",$level+1)
42
+												   ->orWhere("level",3);
43
+										})
44
+								->count();
45
+	
46
+		foreach($outcomes as $outcome)
47
+		{
48
+			
49
+// 		var_dump($outcome->id);
50
+// 		print "<br>";
51
+			$outcomes_attempted[$outcome->id]=$outcome->attempted($selected_semesters, $level);
52
+			$outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semesters, $level);	
53
+		}
54
+
55
+        $uhs_school_id = School::where('name', 'LIKE', '%UHS%')->first()->id;
56
+        $uhs_program_id = Program::where('name', 'LIKE', '%UHS%')->first()->id;
57
+
58
+        foreach ($outcomes as $outcome)
59
+        {
60
+			$achievedProgramsPerOutcome[$outcome->id]=0;         // For each program with courses that do assessment
61
+			$attemptedProgramsPerOutcome[$outcome->id]=0;         // For each program with courses that do assessment
62
+            foreach (Program::with(array('courses' => function($query){
63
+//                 $query->whereNotNull('outcomes_attempted');
64
+                $query->where('code', '!=', 'TEST');
65
+                $query->whereIn('semester_id', Session::get('semesters_ids'));
66
+            }))->where('is_graduate', $level)->where('school_id', '!=', $uhs_school_id)->orderBy('name', 'asc')->get() as $program)
67
+            {
68
+				$achieved_outcomes_per_program[$program->id]=0;
69
+				$attempted_outcomes_per_program[$program->id]=0;
70
+            	$participating_programs[$program->id]=(object)array('id'=>$program->id, 'name'=>$program->name, 'is_graduate'=> $program->is_graduate, 'school_id'=>$program->school_id);
71
+
72
+// 				SELECT ac.id activity_criterion_id, ac.activity_id, ac.expected_student_score, ac.expected_percentage_students_achieving, co.program_id FROM activity_criterion ac, new_criteria c, activities a, objectives o, courses co where co.id=a.course_id and co.semester_id=13 and a.id=ac.activity_id and c.id = ac.criterion_id and o.id=c.objective_id and o.outcome_id = 2 order by program_id
73
+				$program_attempted_outcome=$program->attempted_outcome($outcome->id, $selected_semesters);
74
+				$attempted_outcomes_per_program[$program->id]+=$program_attempted_outcome;
75
+// 				var_dump($program_attempted_outcome);
76
+// 				exit();
77
+				if($program_attempted_outcome)
78
+				{
79
+					$program_achieved_outcome=$program->achieved_outcome($outcome->id, $selected_semesters);
80
+					$achieved_outcomes_per_program[$program->id]+=$program_achieved_outcome;
81
+
82
+                    $attemptedProgramsPerOutcome[$outcome->id]+=$program_attempted_outcome;
83
+//                     $attemptedProgramsPerOutcome[$outcome->id]+=1;
84
+					$achievedProgramsPerOutcome[$outcome->id]+=$program_achieved_outcome;
85
+// 					$achieved_outcomes_per_program[$outcome->id]=$program->achieved_outcome($outcome->id, $selected_semesters);
86
+// 					if($attempted_outcomes_per_program[$outcome->id]!=0 && 100.0*$achieved_outcomes_per_program[$outcome->id]/$attempted_outcomes_per_program[$outcome->id] >= $outcome->expected_outcome)
87
+// 					{
88
+// 						$achievedProgramsPerOutcome[$outcome->id]+=1;
89
+// 						// $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
90
+// 					}
91
+				}
92
+			}
93
+		}
94
+	
95
+		return array('outcomes'=>$outcomes,'outcomes_attempted'=>$outcomes_attempted, 'outcomes_achieved'=>$outcomes_achieved, 'attemptedProgramsPerOutcome'=>$attemptedProgramsPerOutcome, 'achievedProgramsPerOutcome'=>$achievedProgramsPerOutcome,'participating_programs'=>$participating_programs);
96
+	
97
+	
98
+	
99
+	}
5 100
     public function overview()
6 101
     {
102
+    
103
+        $selected_semesters = Semester::find(Session::get('semesters_ids'));
104
+        
105
+		$subgraduado=$this->outcomes_semesters($selected_semesters,0);
106
+        $outcomes_subgrad=$subgraduado['outcomes'];
107
+        $undergrad_outcomes_achieved=$subgraduado['outcomes_achieved']; 
108
+        $undergrad_outcomes_attempted=$subgraduado['outcomes_attempted']; 
109
+        $attemptedUndergradProgramsPerOutcome=$subgraduado['attemptedProgramsPerOutcome']; 
110
+        $achievedUndergradProgramsPerOutcome=$subgraduado['achievedProgramsPerOutcome']; 
111
+        $participating_undergrad_programs=$subgraduado['participating_programs']; 
112
+		
113
+		
114
+		$graduado=$this->outcomes_semesters($selected_semesters,1);
115
+        $outcomes_grad=$graduado['outcomes'];
116
+        $grad_outcomes_achieved=$graduado['outcomes_achieved']; 
117
+        $grad_outcomes_attempted=$graduado['outcomes_attempted']; 
118
+        $attemptedGradProgramsPerOutcome=$graduado['attemptedProgramsPerOutcome']; 
119
+        $achievedGradProgramsPerOutcome=$graduado['achievedProgramsPerOutcome']; 
120
+        $participating_grad_programs=$graduado['participating_programs']; 
121
+		
7 122
         //Total amount of learning outcomes
8
-        $outcomeCount = Outcome::withTrashed()->count();
9
-
123
+//         $outcomeCount = Outcome::withTrashed()->count();
124
+//         $selected_semester = Semester::find(Session::get('semesters_ids')[0]);
125
+//         $outcomes_subgrad = Outcome::where(function($query) use ($selected_semester)
126
+//         								   {
127
+// 												$query->where('deactivation_date', '>=', $selected_semester->start)
128
+// 													  ->orWhere('deactivation_date', null);
129
+//         								   })
130
+//         							->where('activation_date', '<=', $selected_semester->end)
131
+//         							->where(function($query2)
132
+//         								    {
133
+// 												$query2->where("level",1)
134
+// 													   ->orWhere("level",3);
135
+//         									})
136
+//         							->orderBy('name', 'ASC')
137
+//         							->get();
138
+//         $outcomeCount_subgrad = Outcome::where(function($query) use ($selected_semester)
139
+//         									   {
140
+//         									   		$query->where('deactivation_date', '>=', $selected_semester->start)
141
+//         									   			  ->orWhere('deactivation_date', null);
142
+//         									   	})
143
+//            							->where('activation_date', '<=', $selected_semester->end)
144
+//      								->where(function($query2)
145
+//         									    {
146
+//         									    	$query2->where("level",1)
147
+//         									    		   ->orWhere("level",3);
148
+//         									    })
149
+//         								->count();
150
+// 
151
+//         $outcomes_grad = Outcome::where(function($query) use ($selected_semester){$query->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null);})->where(function($query2){$query2->where("level",2)->orWhere("level",3);})->orderBy('name', 'ASC')->get();
152
+//         $outcomeCount_grad = Outcome::where(function($query) use ($selected_semester){$query->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null);})->where(function($query2){$query2->where("level",2)->orWhere("level",3);})->count();
153
+
154
+// 		print($outcomeCount_subgrad);
155
+// 		print($outcomeCount_grad);
10 156
         // Id for excluding UHS from records
11 157
         $uhs_school_id = School::where('name', 'LIKE', '%UHS%')->first()->id;
12
-        $uhs_program_id = Program::where('name', 'LIKE', '%UHS%')->first()->id;
158
+//         $uhs_program_id = Program::where('name', 'LIKE', '%UHS%')->first()->id;
13 159
 
14 160
         $schools = School::where('id', '!=', $uhs_school_id)->orderBy('name', 'asc')->get();
15 161
         $title = 'Campus Overview';
16
-        $outcomes = Outcome::withTrashed()->select('id', 'name', 'expected_outcome')->orderBy('name', 'asc')->get();
17
-
18
-        $undergrad_outcomes_achieved = array_fill(1, $outcomeCount, 0);
19
-        $undergrad_outcomes_attempted = array_fill(1, $outcomeCount, 0);
20
-        $grad_outcomes_achieved = array_fill(1, $outcomeCount, 0);
21
-        $grad_outcomes_attempted = array_fill(1, $outcomeCount, 0);
22
-
162
+        
163
+        
23 164
         /**
24
-         * Calculate campus wide outcome performance
165
+         * Calculate campus wide outcome performance by counting the number of students
166
+         $undergrad_outcomes_attempted will have the number of criteria that was assessed in undergradute courses during the selected semester 
167
+         $undergrad_outcomes_achieved will have the number of criteria that was assessed in undergradute courses  during the selected semester 
168
+            where the percentage of students that obtained a better or equal score than the expected_student_score established in the
169
+            activity_criterion table is greater or equal than the expected_percentage_students_achieving also established in the
170
+            activity_criterion table         
25 171
          */
26 172
 
27
-        // Calculate campus wide outcome performance for undergrad and grad
28
-        foreach (Course::with('program')
29
-            ->where('program_id', '!=', $uhs_program_id)
30
-            ->where('code', '!=', 'TEST')
31
-            ->whereNotNull('outcomes_achieved')
32
-            ->whereIn('semester_id', Session::get('semesters_ids'))->get() as $course)
33
-        {
34
-            if(!$course->program->is_graduate)
35
-            {
36
-                $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
37
-                $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
38
-                for($i=1; $i<=count($undergrad_outcomes_attempted); $i++)
39
-                {
40
-
41
-                    $undergrad_outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
42
-                    $undergrad_outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
43
-                }
44
-            }
45
-            else
46
-            {
47
-                $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
48
-                $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
49
-                for($i=1; $i<=count($grad_outcomes_attempted); $i++)
50
-                {
51
-
52
-                    $grad_outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
53
-                    $grad_outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
54
-                }
55
-            }
56
-
57
-        }
173
+// 		foreach($outcomes_subgrad as $outcome)
174
+// 		{
175
+// 			$undergrad_outcomes_attempted[$outcome->id]=$outcome->attempted($selected_semester->id,0);
176
+// 			$undergrad_outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semester->id,0);	
177
+// 		}
178
+// 		var_dump($undergrad_outcomes_attempted);
179
+// 		print"<br>";
180
+// 		var_dump($undergrad_outcomes_achieved);
181
+// 		print"<br>";
182
+// 		foreach($outcomes_grad as $outcome)
183
+// 		{
184
+// 			$grad_outcomes_attempted[$outcome->id]=$outcome->attempted($selected_semester->id,1);
185
+// 			$grad_outcomes_achieved[$outcome->id]=$outcome->achieved($selected_semester->id,1);			
186
+// 		}
58 187
 
59 188
         /**
60 189
          * Calculate how many programs achieved and attempted each outcome
61 190
          */
62 191
 
63 192
         // Number of programs that achieved a particular learning outcome
64
-        $achievedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
193
+//         $achievedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount_subgrad, 0);
65 194
 
66 195
         // Number of programs that attempted a particular learning outcome
67
-        $attemptedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
196
+//         $attemptedUndergradProgramsPerOutcome = array_fill(1, $outcomeCount_subgrad, 0);
68 197
 
69 198
         // Names of programs doing assessment
70 199
         // Fetch programs with participation
71
-        $participating_undergrad_programs = DB::table('VIEW_participating_programs')
72
-            ->whereIn('semester_id', Session::get('semesters_ids'))
73
-            ->where('is_graduate', 0)
74
-            ->groupBy('id')
75
-            ->orderBy('name', 'asc')
76
-            ->get();
77
-
78
-        $output = array();
79
-
80
-
81
-        // For each outcome
82
-        foreach ($outcomes as $outcome)
83
-        {
84
-            // For each program with courses that do assessment
85
-            foreach (Program::with(array('courses' => function($query){
86
-                $query->whereNotNull('outcomes_attempted');
87
-                $query->where('code', '!=', 'TEST');
88
-                $query->whereIn('semester_id', Session::get('semesters_ids'));
89
-            }))->where('is_graduate', 0)->orderBy('name', 'asc')->get() as $program)
90
-            {
91
-                // To acummulate all criteria for one program
92
-                $achieved_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
93
-                $attempted_outcomes_per_undergrad_program = array_fill(1, $outcomeCount, 0);
94
-
95
-                //Flag for counting programs
96
-                $flag =false;
97
-
98
-                // For each course in the program
99
-                foreach ($program->courses as $course)
100
-                {
101
-                    // If the outcome in question is being evaluated
102
-                    $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
103
-                    $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
104
-                    if(array_key_exists($outcome->id, $course_outcomes_attempted2 )
105
-                        && $course_outcomes_attempted2[$outcome->id]>0)
106
-                    {
107
-                        $achieved_outcomes_per_undergrad_program[$outcome->id]+=$course_outcomes_achieved2[$outcome->id];
108
-                        $attempted_outcomes_per_undergrad_program[$outcome->id]+=$course_outcomes_attempted2[$outcome->id];
109
-
110
-
111
-                        // Add one to the programs assessing, if it wasn't added before
112
-                        if(!$flag)
113
-                        {
114
-                            $attemptedUndergradProgramsPerOutcome[$outcome->id]+=1;
115
-                            $flag= true;
116
-                        }
117
-                    }
118
-
119
-                    // $output[] = 'ACHIEVED: '.$program->name.'-'.json_encode($achieved_outcomes_per_undergrad_program);
120
-                    // $output[] = 'ATTEMPTED: '.$program->name.'-'.json_encode($attempted_outcomes_per_undergrad_program);
121
-
122
-                }
123
-                //If the accumulated achieved criteria for a specific outcome in a program divided by the accumulated attempted criteria for a specific outcome in a program is greated than the expected outcome
124
-                if($attempted_outcomes_per_undergrad_program[$outcome->id]!=0 && (float)$achieved_outcomes_per_undergrad_program[$outcome->id]/$attempted_outcomes_per_undergrad_program[$outcome->id]*100 >= $outcome->expected_outcome)
125
-                {
126
-                    $achievedUndergradProgramsPerOutcome[$outcome->id]+=1;
127
-                    // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedUndergradProgramsPerOutcome);
128
-                }
129
-            }
130
-        }
131
-
200
+//         $participating_undergrad_programs = DB::table('VIEW_participating_programs')
201
+//             ->whereIn('semester_id', Session::get('semesters_ids'))
202
+//             ->where('is_graduate', 0)
203
+//             ->groupBy('id')
204
+//             ->orderBy('name', 'asc')
205
+//             ->get();
206
+//         $output = array();
132 207
 
133 208
         /**
134
-         * Calculate how many programs achieved and attempted each outcome
209
+         * Calculate how many undergrad programs achieved and attempted each outcome
210
+         */
211
+//         foreach ($outcomes_subgrad as $outcome)
212
+//         {
213
+//  			$achieved_outcomes_per_undergrad_program[$outcome->id]=0;
214
+// 			$attempted_outcomes_per_undergrad_program[$outcome->id]=0;
215
+// 			$achievedUndergradProgramsPerOutcome[$outcome->id]=0;         // For each program with courses that do assessment
216
+// 			$attemptedUndergradProgramsPerOutcome[$outcome->id]=0;         // For each program with courses that do assessment
217
+//             foreach (Program::with(array('courses' => function($query){
218
+// //                 $query->whereNotNull('outcomes_attempted');
219
+//                 $query->where('code', '!=', 'TEST');
220
+//                 $query->whereIn('semester_id', Session::get('semesters_ids'));
221
+//             }))->where('is_graduate', 0)->where('school_id', '!=', $uhs_school_id)->orderBy('name', 'asc')->get() as $program)
222
+//             {
223
+//             	$participating_undergrad_programs[$program->id]=(object)array('id'=>$program->id, 'name'=>$program->name, 'is_graduate'=> $program->is_graduate, 'school_id'=>$program->school_id,'semestre_id',$selected_semester);
224
+// 
225
+// // 				SELECT ac.id activity_criterion_id, ac.activity_id, ac.expected_student_score, ac.expected_percentage_students_achieving, co.program_id FROM activity_criterion ac, new_criteria c, activities a, objectives o, courses co where co.id=a.course_id and co.semester_id=13 and a.id=ac.activity_id and c.id = ac.criterion_id and o.id=c.objective_id and o.outcome_id = 2 order by program_id
226
+// 				$program_attempted_outcome=$program->attempted_outcome($outcome->id, $selected_semester->id);
227
+// 				$attempted_outcomes_per_undergrad_program[$outcome->id]+=$program_attempted_outcome;
228
+// // 				var_dump($program_attempted_outcome);
229
+// // 				exit();
230
+// 				if($program_attempted_outcome)
231
+// 				{
232
+//                     $attemptedUndergradProgramsPerOutcome[$outcome->id]+=1;
233
+// 					$achieved_outcomes_per_undergrad_program[$outcome->id]=$program->achieved_outcome($outcome->id, $selected_semester->id);
234
+// 					if($attempted_outcomes_per_undergrad_program[$outcome->id]!=0 && 100.0*$achieved_outcomes_per_undergrad_program[$outcome->id]/$attempted_outcomes_per_undergrad_program[$outcome->id] >= $outcome->expected_outcome)
235
+// 					{
236
+// 						$achievedUndergradProgramsPerOutcome[$outcome->id]+=1;
237
+// 						// $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedUndergradProgramsPerOutcome);
238
+// 					}
239
+// 				}
240
+// 			}
241
+// 		}
242
+// 		var_dump($attempted_outcomes_per_undergrad_program);
243
+// 		print"<br>";
244
+// 		var_dump($achieved_outcomes_per_undergrad_program);
245
+// 		print"<br>";
246
+// 		var_dump($attemptedUndergradProgramsPerOutcome);
247
+// 		print"<br>";
248
+// 		var_dump($achievedUndergradProgramsPerOutcome);
249
+// 		print"<br>";
250
+// 		exit();
251
+        /**
252
+         * Calculate how many grad programs achieved and attempted each outcome
253
+         $grad_outcomes_attempted will have the number of criteria that was assessed in gradute courses during the selected semester 
254
+         $grad_outcomes_achieved will have the number of criteria that was assessed in gradute courses  during the selected semester 
255
+            where the percentage of students that obtained a better or equal score than the expected_student_score established in the
256
+            activity_criterion table is greater or equal than the expected_percentage_students_achieving also established in the
257
+            activity_criterion table         
135 258
          */
136 259
 
137
-        // Number of programs that achieved a particular learning outcome
138
-        $achievedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
139
-
140
-        // Number of programs that attempted a particular learning outcome
141
-        $attemptedGradProgramsPerOutcome = array_fill(1, $outcomeCount, 0);
142 260
 
143 261
         // Names of programs doing assessment
144
-        $participating_grad_programs = DB::table('VIEW_participating_programs')
145
-            ->whereIn('semester_id', Session::get('semesters_ids'))
146
-            ->where('is_graduate', 1)
147
-            ->groupBy('id')
148
-            ->orderBy('name', 'asc')
149
-            ->get();
150
-
151
-        $output = array();
152
-
153
-
154
-        // For each outcome
155
-        foreach ($outcomes as $outcome)
156
-        {
157
-            // For each program with courses that do assessment
158
-            foreach (Program::with(array('courses' => function($query){
159
-                $query->whereNotNull('outcomes_attempted');
160
-                $query->where('code', '!=', 'TEST');
161
-                $query->whereIn('semester_id', Session::get('semesters_ids'));
162
-            }))->where('is_graduate', 1)->orderBy('name', 'asc')->get() as $program)
163
-            {
164
-                // To acummulate all criteria for one program
165
-                $achieved_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
166
-                $attempted_outcomes_per_grad_program = array_fill(1, $outcomeCount, 0);
167
-
168
-                //Flag for counting programs
169
-                $flag =false;
170
-
171
-                // For each course in the program
172
-                foreach ($program->courses as $course)
173
-                {
174
-                    // If the outcome in question is being evaluated
175
-                    $course_outcomes_attempted2 = json_decode($course->outcomes_attempted, true);
176
-                    $course_outcomes_achieved2 = json_decode($course->outcomes_achieved, true);
177
-                    if(array_key_exists($outcome->id, $course_outcomes_attempted2 )
178
-                        && $course_outcomes_attempted2[$outcome->id]>0)
179
-                    {
180
-                        $achieved_outcomes_per_grad_program[$outcome->id]+=$course_outcomes_achieved2[$outcome->id];
181
-                        $attempted_outcomes_per_grad_program[$outcome->id]+=$course_outcomes_attempted2[$outcome->id];
182
-
183
-
184
-                        // Add one to the programs assessing, if it wasn't added before
185
-                        if(!$flag)
186
-                        {
187
-                            $attemptedGradProgramsPerOutcome[$outcome->id]+=1;
188
-                            $flag= true;
189
-                        }
190
-                    }
191
-
192
-                    // $output[] = 'ACHIEVED: '.$program->name.'-'.json_encode($achieved_outcomes_per_grad_program);
193
-                    // $output[] = 'ATTEMPTED: '.$program->name.'-'.json_encode($attempted_outcomes_per_grad_program);
194
-
195
-                }
196
-                //If the accumulated achieved criteria for a specific outcome in a program divided by the accumulated attempted criteria for a specific outcome in a program is greated than the expected outcome
197
-                if($attempted_outcomes_per_grad_program[$outcome->id]!=0 && (float)$achieved_outcomes_per_grad_program[$outcome->id]/$attempted_outcomes_per_grad_program[$outcome->id]*100 >= $outcome->expected_outcome)
198
-                {
199
-                    $achievedGradProgramsPerOutcome[$outcome->id]+=1;
200
-                    // $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedGradProgramsPerOutcome);
201
-                }
202
-            }
203
-        }
204
-
205
-        return View::make('local.managers.admins.overview', compact('title', 'schools', 'outcomes', 'undergrad_outcomes_achieved', 'undergrad_outcomes_attempted', 'grad_outcomes_achieved', 'grad_outcomes_attempted', 'attemptedUndergradProgramsPerOutcome', 'participating_undergrad_programs', 'achievedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'participating_grad_programs', 'achievedGradProgramsPerOutcome'));
262
+//         $participating_grad_programs = DB::table('VIEW_participating_programs')
263
+//             ->whereIn('semester_id', Session::get('semesters_ids'))
264
+//             ->where('is_graduate', 1)
265
+//             ->groupBy('id')
266
+//             ->orderBy('name', 'asc')
267
+//             ->get();
268
+
269
+
270
+//         foreach ($outcomes_grad as $outcome)
271
+//         {
272
+//  			$achieved_outcomes_per_grad_program[$outcome->id]=0;
273
+// 			$attempted_outcomes_per_grad_program[$outcome->id]=0;
274
+// 			$achievedGradProgramsPerOutcome[$outcome->id]=0;         // For each program with courses that do assessment
275
+// 			$attemptedGradProgramsPerOutcome[$outcome->id]=0;         // For each program with courses that do assessment
276
+//             foreach (Program::with(array('courses' => function($query){
277
+//                 $query->whereNotNull('outcomes_attempted');
278
+//                 $query->where('code', '!=', 'TEST');
279
+//                 $query->whereIn('semester_id', Session::get('semesters_ids'));
280
+//             }))->where('is_graduate', 1)->where('school_id', '!=', $uhs_school_id)->orderBy('name', 'asc')->get() as $program)
281
+//             {
282
+//             	$participating_grad_programs[$program->id]=(object)array('id'=>$program->id, 'name'=>$program->name, 'is_graduate'=> $program->is_graduate, 'school_id'=>$program->school_id,'semestre_id',$selected_semester);
283
+// // 				SELECT ac.id activity_criterion_id, ac.activity_id, ac.expected_student_score, ac.expected_percentage_students_achieving, co.program_id FROM activity_criterion ac, new_criteria c, activities a, objectives o, courses co where co.id=a.course_id and co.semester_id=13 and a.id=ac.activity_id and c.id = ac.criterion_id and o.id=c.objective_id and o.outcome_id = 2 order by program_id
284
+// 				$program_attempted_outcome=$program->attempted_outcome($outcome->id, $selected_semester->id);
285
+// 				$attempted_outcomes_per_grad_program[$outcome->id]+=$program_attempted_outcome;
286
+// // 				var_dump($attempted_outcomes_per_undergrad_program);
287
+// // 				exit();
288
+// 				if($program_attempted_outcome)
289
+// 				{
290
+//                     $attemptedGradProgramsPerOutcome[$outcome->id]+=1;
291
+// 					$achieved_outcomes_per_grad_program[$outcome->id]=$program->achieved_outcome($outcome->id, $selected_semester->id);
292
+// 					if($attempted_outcomes_per_grad_program[$outcome->id]!=0 && (float)$achieved_outcomes_per_grad_program[$outcome->id]/$attempted_outcomes_per_grad_program[$outcome->id]*100 >= $outcome->expected_outcome)
293
+// 					{
294
+// 						$achievedGradProgramsPerOutcome[$outcome->id]+=1;
295
+// 						// $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedUndergradProgramsPerOutcome);
296
+// 					}
297
+// 				}
298
+// 			}
299
+// 		}
300
+// 		var_dump($grad_outcomes_attempted);
301
+// 		print("<br>");
302
+// 		var_dump($grad_outcomes_achieved);
303
+// 		exit();
304
+        return View::make('local.managers.admins.overview', compact('title', 'schools', 'outcomes_subgrad', 'outcomes_grad', 'undergrad_outcomes_achieved', 'undergrad_outcomes_attempted', 'grad_outcomes_achieved', 'grad_outcomes_attempted', 'attemptedUndergradProgramsPerOutcome', 'participating_undergrad_programs', 'achievedUndergradProgramsPerOutcome', 'attemptedGradProgramsPerOutcome', 'participating_grad_programs', 'achievedGradProgramsPerOutcome'));
206 305
     }
207 306
 }

+ 76
- 27
app/controllers/CoursesController.php View File

@@ -77,9 +77,25 @@ CoursesController extends \BaseController {
77 77
 		$activities = $course->activities;
78 78
 		$students = $course->students;
79 79
 
80
-		$outcomes = Outcome::orderBy('name', 'asc')->get();
81
-		$outcomes_achieved = json_decode($course->outcomes_achieved, true);
82
-        $outcomes_attempted = json_decode($course->outcomes_attempted, true);
80
+		$level=DB::table('courses')
81
+			->join('programs','programs.id','=','courses.program_id')
82
+			->where('courses.id', $id)
83
+        	->select('programs.is_graduate')
84
+        	->first();
85
+
86
+		$outcomes = Outcome::active_by_semesters(array($course->semester),$level->is_graduate);
87
+// 		$outcomeCount = count((array)$outcomes);
88
+		
89
+		$course = Course::where('id', $id)->first();
90
+		foreach($outcomes as $outcome)
91
+		{
92
+			$outcomes_attempted[$outcome->id]=$outcome->courses_attempted(array($course));
93
+			$outcomes_achieved[$outcome->id]=$outcome->courses_achieved(array($course));
94
+		}
95
+
96
+// 		$outcomes = Outcome::orderBy('name', 'asc')->get();
97
+// 		$outcomes_achieved = json_decode($course->outcomes_achieved, true);
98
+//         $outcomes_attempted = json_decode($course->outcomes_attempted, true);
83 99
 
84 100
         $schools = School::all();
85 101
 
@@ -104,44 +120,77 @@ CoursesController extends \BaseController {
104 120
 	{
105 121
         $title=$code.$number.' ('.$semester_code.')';
106 122
         $semester = Semester::where('code', $semester_code)->first();
123
+//         $selected_semesters = Semester::find(Session::get('semesters_ids'));
107 124
         $role = Auth::user()->role;
108
-
125
+		$level=DB::table('courses')
126
+			->join('programs','programs.id','=','courses.program_id')
127
+			->where('courses.code', $code)
128
+        	->where('courses.number', $number)
129
+        	->where('courses.semester_id', $semester->id)
130
+        	->select('programs.is_graduate')
131
+        	->first();
132
+//         var_dump($level);
133
+//         exit();
109 134
         $grouped_courses = Course::
110 135
         	where('code', $code)
111 136
         	->where('number', $number)
112 137
         	->where('semester_id', $semester->id)
113 138
         	->groupBy(array('code', 'number'))->get();
114 139
 
115
-        $outcomes = Outcome::orderBy('name', 'asc')->get();
116
-        $outcomeCount = Outcome::all()->count();
117
-
140
+//         $outcomes = Outcome::orderBy('name', 'asc')->get();
141
+//         $outcomeCount = Outcome::all()->count();
142
+		$outcomes = Outcome::active_by_semesters(array($semester),$level->is_graduate);
143
+		$outcomeCount = count((array)$outcomes);
144
+		
145
+		foreach($outcomes as $outcome)
146
+		{
147
+			$outcomes_attempted[$outcome->id]=$outcome->courses_attempted($grouped_courses);
148
+			$outcomes_achieved[$outcome->id]=$outcome->courses_achieved($grouped_courses);
149
+		}
150
+		
151
+		var_dump($outcomes_attempted);
152
+		print "<br>";
153
+		var_dump($outcomes_achieved);
154
+		print "<br>";
118 155
         foreach ($grouped_courses as $index => $grouped_course)
119 156
         {
120
-            // Blank outcomes for one course
121
-            $outcomes_achieved = array_fill(1, $outcomeCount, 0);
122
-            $outcomes_attempted = array_fill(1, $outcomeCount, 0);
123
-
124
-            // Find sections for this course
157
+//             // Blank outcomes for one course
158
+//             $outcomes_achieved = array_fill(1, $outcomeCount, 0);
159
+//             $outcomes_attempted = array_fill(1, $outcomeCount, 0);
160
+// 
161
+//             // Find sections for this course
125 162
             $sections = Course::
126 163
             	where('code', $grouped_course->code)
127 164
             	->where('number', $grouped_course->number)
128 165
             	->where('semester_id', $grouped_course->semester_id)
129 166
             	->get();
130
-
131
-            // For each of the sections, add the attempted and achieved criteria per outcome
132
-            foreach ($sections as $section)
133
-            {
134
-                if($section->outcomes_achieved!=NULL)
135
-                {
136
-                    $section_outcomes_achieved =json_decode($section->outcomes_achieved, true);
137
-                    $section_outcomes_attempted =json_decode($section->outcomes_attempted, true);
138
-                    for($i=1; $i<=count($outcomes_attempted); $i++)
139
-                    {
140
-                        $outcomes_achieved[$i]+=$section_outcomes_achieved[$i];
141
-                        $outcomes_attempted[$i]+=$section_outcomes_attempted[$i];
142
-                    }
143
-                }
144
-            }
167
+// 
168
+//             // For each of the sections, add the attempted and achieved criteria per outcome
169
+//             foreach ($sections as $section)
170
+//             {
171
+//                 if($section->outcomes_achieved!=NULL)
172
+//                 {
173
+//                     $section_outcomes_achieved =count($section->outcomes_attempted());
174
+// //                     var_dump($section_outcomes_achieved);
175
+// //                     exit();
176
+//                     $section_outcomes_attempted =count($section->outcomes_achieved());
177
+// //                     $section_outcomes_achieved =json_decode($section->outcomes_achieved, true);
178
+// //                     $section_outcomes_attempted =json_decode($section->outcomes_attempted, true);
179
+// 					foreach($outcomes as $outcome)
180
+// 					{
181
+// 						if(!isset($outcomes_achieved[$outcome->id]))$outcomes_achieved[$outcome->id]=0;
182
+// 						if(!isset($outcomes_attempted[$outcome->id]))$outcomes_attempted[$outcome->id]=0;
183
+//                         $outcomes_achieved[$outcome->id]+=$section_outcomes_achieved[$i];
184
+//                         $outcomes_attempted[$outcome->id]+=$section_outcomes_attempted[$i];					
185
+// 					
186
+// 					}
187
+// //                     for($i=1; $i<=count($outcomes_attempted); $i++)
188
+// //                     {
189
+// //                         $outcomes_achieved[$i]+=$section_outcomes_achieved[$i];
190
+// //                         $outcomes_attempted[$i]+=$section_outcomes_attempted[$i];
191
+// //                     }
192
+//                 }
193
+//             }
145 194
         }
146 195
 
147 196
         $section_ids = Course::

+ 167
- 121
app/controllers/OutcomesController.php View File

@@ -32,132 +32,178 @@ class OutcomesController extends \BaseController {
32 32
 
33 33
     public function show($id)
34 34
     {
35
-        DB::disableQueryLog();
36
-        $outcome = Outcome::find($id);
37
-
35
+    	$outcome = Outcome::find($id);
36
+        $selected_semesters = Semester::find(Session::get('semesters_ids'));
37
+        $programs=$outcome->programs_attempted($selected_semesters);
38
+        
38 39
         $undergradResults=array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
39
-        $gradResults = array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
40
-
41
-        //Calculate performance for this outcome for each undergrad program
42
-        $undergradPrograms = Program::where('is_graduate','=', 0)
43
-            ->where(function($query)
44
-            {
45
-                if(Auth::user()->school_id)
46
-                {
47
-                    $query->where('school_id', Auth::user()->school_id);
48
-                }
49
-            })
50
-            ->with('courses')
51
-            ->orderBy('name', 'asc')->get();
52
-
53
-        foreach($undergradPrograms as $program)
40
+        $gradResults=array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
41
+        foreach($programs as $program_id)
54 42
         {
55
-            $undergradResults["names"][$program->id]=$program->name;
56
-            $undergradResults["schools"][$program->id]=$program->school->name;
57
-            $programAssessed=false;
58
-
59
-            $undergradResults["attempted"][$program->id]=0;
60
-            $undergradResults["achieved"][$program->id]=0;
61
-
62
-            foreach($program->courses as $course)
63
-            {
64
-                $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
65
-                $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
66
-
67
-                $attemptedCriteriaCount=0;
68
-                $achievedCriteriaCount=0;
69
-
70
-                // If this outcome was evaluated
71
-                if(
72
-                    $course_outcomes_attempted
73
-                    && array_key_exists($outcome->id, $course_outcomes_attempted)
74
-                    && $course_outcomes_attempted[$outcome->id]!=0)
75
-                {
76
-                    // Count +1 for attempted and achieved in the program
77
-                    $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
78
-                    $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
79
-                    $programAssessed=true;
80
-
81
-                    if($attemptedCriteriaCount>0  &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
82
-                    {
83
-                        $undergradResults["achieved"][$program->id]+=1;
84
-                    }
85
-                    $undergradResults["attempted"][$program->id]+=1;
86
-                }
87
-            }
88
-
89
-            // Calculate success rate for this program
90
-            if($programAssessed && $undergradResults["attempted"][$program->id]>0)
91
-                $undergradResults["successRate"][$program->id]= round((float)$undergradResults["achieved"][$program->id]/$undergradResults["attempted"][$program->id]*100, 2).'%';
92
-            else
93
-                $undergradResults["successRate"][$program->id]= 'N/M';
43
+ //        	var_dump($program_id);
44
+//         	exit();
45
+        	$program = Program::where('id','=',$program_id->id)->first();
46
+        	$school = School::where('id','=',$program->school_id)->first();
47
+        	if($program->is_graduate)
48
+        	{
49
+        		$gradResults['names'][]=$program->name;
50
+        		$gradResults['schools'][]=$school->name;
51
+        		$attempted=$program->attempted_criteria_by_outcome($id, $selected_semesters);
52
+        		$gradResults['attempted'][]=$attempted;
53
+        		$achieved=$program->achieved_criteria_by_outcome($id, $selected_semesters);
54
+        		$gradResults['achieved'][]=$achieved;
55
+        		$gradResults['successRate'][]=sprintf("%.2f",100*$achieved/$attempted); 		
56
+        		
57
+        	}
58
+        	else
59
+        	{
60
+        		$undergradResults['names'][]=$program->name;
61
+        		$undergradResults['schools'][]=$school->name;
62
+        		$attempted=$program->attempted_criteria_by_outcome($id,$selected_semesters);
63
+        		$undergradResults['attempted'][]=$attempted;
64
+        		$achieved=$program->achieved_criteria_by_outcome($id,$selected_semesters);
65
+        		$undergradResults['achieved'][]=$achieved;
66
+        		$undergradResults['successRate'][]=sprintf("%.2f",100*$achieved/$attempted); 		
67
+        	}
68
+        
94 69
         }
95
-
96
-
97
-        //Calculate performance for this outcome for each grad program
98
-        $gradPrograms = Program::where('is_graduate','=', 1)
99
-            ->where(function($query)
100
-            {
101
-                if(Auth::user()->school_id)
102
-                {
103
-                    $query->where('school_id', Auth::user()->school_id);
104
-                }
105
-            })
106
-            ->with(array('courses'=>function($query)
107
-            {
108
-                $query->whereNotNull('outcomes_attempted');
109
-            }))
110
-            ->orderBy('name', 'asc')->get();
111
-
112
-        foreach($gradPrograms as $program)
113
-        {
114
-            $gradResults["names"][$program->id]=$program->name;
115
-            $gradResults["schools"][$program->id]=$program->school->name;
116
-
117
-            $programAssessed=false;
118
-
119
-            $gradResults["attempted"][$program->id]=0;
120
-            $gradResults["achieved"][$program->id]=0;
121
-
122
-            foreach($program->courses as $course)
123
-            {
124
-                $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
125
-                $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
126
-
127
-                $attemptedCriteriaCount=0;
128
-                $achievedCriteriaCount=0;
129
-
130
-                // If this outcome was evaluated
131
-                if(
132
-                    $course_outcomes_attempted
133
-                    && array_key_exists($outcome->id, $course_outcomes_attempted)
134
-                    && $course_outcomes_attempted[$outcome->id]!=0)
135
-                {
136
-                    // Count +1 for attempted and achieved in the program
137
-                    $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
138
-                    $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
139
-                    $programAssessed=true;
140
-
141
-                    if($attemptedCriteriaCount>0  &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
142
-                    {
143
-                        $gradResults["achieved"][$program->id]+=1;
144
-                    }
145
-                    $gradResults["attempted"][$program->id]+=1;
146
-                }
147
-            }
148
-
149
-            // Calculate success rate for this program
150
-            if($programAssessed && $gradResults["attempted"][$program->id]>0)
151
-                $gradResults["successRate"][$program->id]= round((float)$gradResults["achieved"][$program->id]/$gradResults["attempted"][$program->id]*100, 2).'%';
152
-            else
153
-                $gradResults["successRate"][$program->id]= 'N/M';
154
-        }
155
-
156
-        $title = "Outcome Results: ".$outcome->name;
157
-
158
-        return View::make('local.managers.admins.learning-outcome', compact('title', 'outcome', 'undergradResults', 'gradResults'));
70
+           	
71
+	   	$title = "Outcome Results: ".$outcome->name;
72
+    	
73
+        
74
+//  		$undergradResults["successRate"]
75
+	
76
+        return View::make('local.managers.admins.learning-outcome_new', compact('title', 'outcome', 'undergradResults', 'gradResults'));
159 77
     }
160 78
 
79
+//     public function show($id)
80
+//     {
81
+//         DB::disableQueryLog();
82
+//         $outcome = Outcome::find($id);
83
+// 
84
+//         $undergradResults=array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
85
+//         $gradResults = array("names"=>array(), "schools"=>array(), "achieved"=>array(), "attempted"=>array(), "successRate"=>array());
86
+// 
87
+//         //Calculate performance for this outcome for each undergrad program
88
+//         $undergradPrograms = Program::where('is_graduate','=', 0)
89
+//             ->where(function($query)
90
+//             {
91
+//                 if(Auth::user()->school_id)
92
+//                 {
93
+//                     $query->where('school_id', Auth::user()->school_id);
94
+//                 }
95
+//             })
96
+//             ->with('courses')
97
+//             ->orderBy('name', 'asc')->get();
98
+// 
99
+//         foreach($undergradPrograms as $program)
100
+//         {
101
+//             $undergradResults["names"][$program->id]=$program->name;
102
+//             $undergradResults["schools"][$program->id]=$program->school->name;
103
+//             $programAssessed=false;
104
+// 
105
+//             $undergradResults["attempted"][$program->id]=0;
106
+//             $undergradResults["achieved"][$program->id]=0;
107
+// 
108
+//             foreach($program->courses as $course)
109
+//             {
110
+//                 $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
111
+//                 $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
112
+// 
113
+//                 $attemptedCriteriaCount=0;
114
+//                 $achievedCriteriaCount=0;
115
+// 
116
+//                 // If this outcome was evaluated
117
+//                 if(
118
+//                     $course_outcomes_attempted
119
+//                     && array_key_exists($outcome->id, $course_outcomes_attempted)
120
+//                     && $course_outcomes_attempted[$outcome->id]!=0)
121
+//                 {
122
+//                     // Count +1 for attempted and achieved in the program
123
+//                     $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
124
+//                     $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
125
+//                     $programAssessed=true;
126
+// 
127
+//                     if($attemptedCriteriaCount>0  &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
128
+//                     {
129
+//                         $undergradResults["achieved"][$program->id]+=1;
130
+//                     }
131
+//                     $undergradResults["attempted"][$program->id]+=1;
132
+//                 }
133
+//             }
134
+// 
135
+//             // Calculate success rate for this program
136
+//             if($programAssessed && $undergradResults["attempted"][$program->id]>0)
137
+//                 $undergradResults["successRate"][$program->id]= round((float)$undergradResults["achieved"][$program->id]/$undergradResults["attempted"][$program->id]*100, 2).'%';
138
+//             else
139
+//                 $undergradResults["successRate"][$program->id]= 'N/M';
140
+//         }
141
+// 
142
+// 
143
+//         //Calculate performance for this outcome for each grad program
144
+//         $gradPrograms = Program::where('is_graduate','=', 1)
145
+//             ->where(function($query)
146
+//             {
147
+//                 if(Auth::user()->school_id)
148
+//                 {
149
+//                     $query->where('school_id', Auth::user()->school_id);
150
+//                 }
151
+//             })
152
+//             ->with(array('courses'=>function($query)
153
+//             {
154
+//                 $query->whereNotNull('outcomes_attempted');
155
+//             }))
156
+//             ->orderBy('name', 'asc')->get();
157
+// 
158
+//         foreach($gradPrograms as $program)
159
+//         {
160
+//             $gradResults["names"][$program->id]=$program->name;
161
+//             $gradResults["schools"][$program->id]=$program->school->name;
162
+// 
163
+//             $programAssessed=false;
164
+// 
165
+//             $gradResults["attempted"][$program->id]=0;
166
+//             $gradResults["achieved"][$program->id]=0;
167
+// 
168
+//             foreach($program->courses as $course)
169
+//             {
170
+//                 $course_outcomes_achieved = json_decode($course->outcomes_achieved, true);
171
+//                 $course_outcomes_attempted = json_decode($course->outcomes_attempted, true);
172
+// 
173
+//                 $attemptedCriteriaCount=0;
174
+//                 $achievedCriteriaCount=0;
175
+// 
176
+//                 // If this outcome was evaluated
177
+//                 if(
178
+//                     $course_outcomes_attempted
179
+//                     && array_key_exists($outcome->id, $course_outcomes_attempted)
180
+//                     && $course_outcomes_attempted[$outcome->id]!=0)
181
+//                 {
182
+//                     // Count +1 for attempted and achieved in the program
183
+//                     $attemptedCriteriaCount+=$course_outcomes_attempted[$outcome->id];
184
+//                     $achievedCriteriaCount+=$course_outcomes_achieved[$outcome->id];
185
+//                     $programAssessed=true;
186
+// 
187
+//                     if($attemptedCriteriaCount>0  &&(float)$achievedCriteriaCount/$attemptedCriteriaCount*100 > $outcome->expected_outcome)
188
+//                     {
189
+//                         $gradResults["achieved"][$program->id]+=1;
190
+//                     }
191
+//                     $gradResults["attempted"][$program->id]+=1;
192
+//                 }
193
+//             }
194
+// 
195
+//             // Calculate success rate for this program
196
+//             if($programAssessed && $gradResults["attempted"][$program->id]>0)
197
+//                 $gradResults["successRate"][$program->id]= round((float)$gradResults["achieved"][$program->id]/$gradResults["attempted"][$program->id]*100, 2).'%';
198
+//             else
199
+//                 $gradResults["successRate"][$program->id]= 'N/M';
200
+//         }
201
+// 
202
+//         $title = "Outcome Results: ".$outcome->name;
203
+// 
204
+//         return View::make('local.managers.admins.learning-outcome', compact('title', 'outcome', 'undergradResults', 'gradResults'));
205
+//     }
206
+
161 207
     // TODO: Clean up and verify relationships are correct
162 208
     public function newShow($id)
163 209
     {

+ 142
- 21
app/controllers/ProgramsController.php View File

@@ -6,40 +6,83 @@ class ProgramsController extends \BaseController
6 6
   /**
7 7
    * Shows a particular program
8 8
    */
9
+
9 10
   public function show($id)
10 11
   {
11 12
 
12 13
     $program = Program::find($id);
13 14
     $title= $program->school->name.': '.$program->name;
14 15
     $program_courses = $program->courses;
15
-    $outcomes = Outcome::orderBy('name', 'asc')->get();
16
+//     $outcomes = Outcome::orderBy('name', 'asc')->get();
16 17
     $schools = School::all();
17
-    $outcomeCount = Outcome::all()->count();
18
+//     $outcomeCount = Outcome::all()->count();
18 19
 
20
+    $selected_semesters = Semester::find(Session::get('semesters_ids'));
19 21
 
20
-    $outcomes_achieved = array_fill(1, $outcomeCount, 0);
21
-    $outcomes_attempted = array_fill(1, $outcomeCount, 0);
22
-
23
-    $assessed_courses_count=0;
24
-    foreach ($program_courses as $course)
25
-    {
26
-        if($course->outcomes_achieved!=NULL)
27
-        {
28
-            $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
29
-            $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
30
-            for($i=1; $i<=count($outcomes_attempted); $i++)
31
-            {
32
-                $outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
33
-                $outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
34
-            }
35
-            $assessed_courses_count+=1;
36
-        }
37
-    }
22
+	$level=$program->is_graduate;
23
+	$min_start="9000-01-01 00:00:00";
24
+	$max_end="1000-01-01 00:00:00";
25
+	foreach($selected_semesters as $semester)
26
+	{
27
+		if($min_start>$semester->start)
28
+		{
29
+			$min_start=$semester->start;
30
+		}
31
+		if($max_end<$semester->end)
32
+		{
33
+			$max_end=$semester->end;
34
+		}
35
+	}
36
+	$outcomes = Outcome::where(function($query) use ($min_start)
37
+							   {
38
+									$query->where('deactivation_date', '>=', $min_start)
39
+										  ->orWhere('deactivation_date', null);
40
+							   })
41
+						->where('activation_date', '<=', $max_end)
42
+						->where(function($query2) use ($level)
43
+								{
44
+									$query2->where("level", $level+1)
45
+										   ->orWhere("level",3);
46
+								})
47
+						->orderBy('name', 'ASC')
48
+						->get();
49
+	$outcomeCount = Outcome::where(function($query) use ($min_start)
50
+								   {
51
+										$query->where('deactivation_date', '>=', $min_start)
52
+											  ->orWhere('deactivation_date', null);
53
+									})
54
+						->where('activation_date', '<=', $max_end)
55
+						->where(function($query2) use ($level)
56
+									{
57
+										$query2->where("level",$level+1)
58
+											   ->orWhere("level",3);
59
+									})
60
+							->count();
38 61
 
62
+	foreach($outcomes as $outcome)
63
+	{
64
+		$outcomes_attempted[$outcome->id]=$program->attempted_outcome($outcome->id, $selected_semesters);
65
+		if($outcomes_attempted[$outcome->id])$outcomes_achieved[$outcome->id]=$program->achieved_outcome($outcome->id, $selected_semesters);
66
+	}
67
+	
68
+	foreach($outcomes as $outcome)
69
+	{
70
+		$assessed_courses[$outcome->id]=DB::table('activity_criterion')
71
+	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
72
+	    	->join('courses', 'activities.course_id', '=', 'courses.id')
73
+	    	->join('programs', 'programs.id', '=', 'courses.program_id')
74
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
75
+	    	->where('criterion_objective_outcome.outcome_id','=',$outcome->id)
76
+	    	->where('programs.id','=',$program->id)
77
+	    	->where('courses.semester_id','=',$semester)
78
+	    	->count(DB::raw('DISTINCT courses.id'))
79
+			;	    	
80
+	}
81
+	$assessed_courses_count=array_sum($assessed_courses);
39 82
     /**
40 83
      * List of grouped courses (grouped sections)
41 84
      */
42
-
85
+	
43 86
     $grouped_courses = Course::
44 87
       select(DB::raw('name, code, number, max(outcomes_attempted) as outcomes_attempted, semester_id, program_id'))
45 88
       ->with('semester')
@@ -76,10 +119,88 @@ class ProgramsController extends \BaseController
76 119
         })
77 120
         ->get();
78 121
 
122
+// 	var_dump($outcomes_attempted);
123
+// 	print "<br>";
124
+// 	var_dump($outcomes_achieved);
125
+// 	print "<br>";
79 126
     return View::make('local.managers.shared.program', compact('title', 'outcomes', 'outcomes_attempted', 'outcomes_achieved', 'schools', 'program_courses', 'assessed_courses_count', 'grouped_courses', 'program', 'users'));
80 127
 
81 128
 }
82 129
 
130
+//   public function show($id)
131
+//   {
132
+// 
133
+//     $program = Program::find($id);
134
+//     $title= $program->school->name.': '.$program->name;
135
+//     $program_courses = $program->courses;
136
+//     $outcomes = Outcome::orderBy('name', 'asc')->get();
137
+//     $schools = School::all();
138
+//     $outcomeCount = Outcome::all()->count();
139
+// 
140
+// 
141
+//     $outcomes_achieved = array_fill(1, $outcomeCount, 0);
142
+//     $outcomes_attempted = array_fill(1, $outcomeCount, 0);
143
+// 
144
+//     $assessed_courses_count=0;
145
+//     foreach ($program_courses as $course)
146
+//     {
147
+//         if($course->outcomes_achieved!=NULL)
148
+//         {
149
+//             $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
150
+//             $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
151
+//             for($i=1; $i<=count($outcomes_attempted); $i++)
152
+//             {
153
+//                 $outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
154
+//                 $outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
155
+//             }
156
+//             $assessed_courses_count+=1;
157
+//         }
158
+//     }
159
+// 
160
+//     /**
161
+//      * List of grouped courses (grouped sections)
162
+//      */
163
+// 
164
+//     $grouped_courses = Course::
165
+//       select(DB::raw('name, code, number, max(outcomes_attempted) as outcomes_attempted, semester_id, program_id'))
166
+//       ->with('semester')
167
+//       ->with('program')
168
+//       ->where('program_id', $program->id)
169
+//       ->whereIn('semester_id', Session::get('semesters_ids'))
170
+//       ->groupBy(array('code', 'number', 'semester_id'))
171
+//       ->orderBy('code')
172
+//       ->orderBy('number')
173
+//       ->orderBy('semester_id')
174
+//       ->get();
175
+// 
176
+//     // Program contact information
177
+//     $users = User::
178
+//         select('users.*')
179
+//         ->leftJoin('program_user', 'users.id', '=', 'program_user.user_id')
180
+//         ->where(function($query) use($program)
181
+//         {
182
+//             $query
183
+//                 ->where('school_id', $program->school_id)
184
+//                 ->where('role', 2);
185
+//         })
186
+//         ->orWhere(function($query) use($program)
187
+//         {
188
+//             $query
189
+//                 ->where('role', 3)
190
+//                 ->where('program_id', $program->id);
191
+//         })
192
+//         ->orWhere(function($query) use($program)
193
+//         {
194
+//             $query
195
+//                 ->where('role', 4)
196
+//                 ->where('program_id', $program->id);
197
+//         })
198
+//         ->get();
199
+// 
200
+//     return View::make('local.managers.shared.program', compact('title', 'outcomes', 'outcomes_attempted', 'outcomes_achieved', 'schools', 'program_courses', 'assessed_courses_count', 'grouped_courses', 'program', 'users'));
201
+// 
202
+// }
203
+
83 204
   /**
84 205
    * Info to print a program
85 206
    */

+ 37
- 5
app/controllers/RubricsController.php View File

@@ -38,6 +38,37 @@ class RubricsController extends \BaseController {
38 38
         return View::make('local.professors.rubrics', compact('title', 'templates', 'outcomes', 'criteria', 'rubrics', 'activity', 'rubric'));
39 39
     }
40 40
 
41
+    public function newOtherMethod($activity_id)
42
+    {
43
+        $activity = Activity::find($activity_id);
44
+
45
+        // If activity does not exist, display 404
46
+        if (!$activity)
47
+            App::abort('404');
48
+
49
+        $title = 'Rubric for <em>'.$activity->name.'</em>';
50
+
51
+        // Select templates that belong to everyone or belong to the activity's course's school
52
+        $templates = Template::
53
+        where('is_visible', '=', 1)
54
+        ->where(function($query) use ($activity)
55
+        {
56
+            if(Auth::user()->role != 1){
57
+                $query
58
+                ->where('school_id', $activity->course->program->school->id)
59
+                ->orWhere('school_id', '=', NULL);
60
+            }
61
+        })
62
+        ->orderBy('name', 'ASC')->get();
63
+
64
+        $rubrics = Auth::user()->rubrics;
65
+        $outcomes = Outcome::orderBy('name', 'ASC')->get();
66
+        $criteria = Criterion::orderBy('name', 'ASC')->get();
67
+        $rubric = $activity->rubric;
68
+
69
+        return View::make('local.professors.rubrics', compact('title', 'templates', 'outcomes', 'criteria', 'rubrics', 'activity', 'rubric'));
70
+    }
71
+
41 72
     /**
42 73
      * Save a new rubric
43 74
      *
@@ -63,16 +94,17 @@ class RubricsController extends \BaseController {
63 94
             $rubric->save();
64 95
 
65 96
             // Process activity
66
-            $activity = Activity::find(Input::get('activity_id'));
67
-            $activity->rubric_id = $rubric->id;
68
-            $activity->save();
97
+//             $activity = Activity::find(Input::get('activity_id'));
98
+//             $activity->rubric_id = $rubric->id;
99
+//             $activity->save();
69 100
 
101
+			DB::table('new_rubric_activity')->insert(array('activity_id'=>Input::get('activity_id'),'rubric_id'=> $rubric->id));
70 102
             DB::commit();
71 103
 
72 104
             Session::flash('status', 'success');
73 105
             Session::flash('message', 'Rubric assigned.');
74 106
 
75
-            return action('ActivitiesController@show', array($activity->id));
107
+            return action('ActivitiesController@show', array(Input::get('activity_id')));
76 108
 
77 109
 
78 110
         }
@@ -80,7 +112,7 @@ class RubricsController extends \BaseController {
80 112
         {
81 113
             DB::rollBack();
82 114
             Session::flash('status', 'danger');
83
-            Session::flash('message', 'Error creating Rubric. Try again later.');
115
+            Session::flash('message', 'Error creating Rubric. Try again later.'.$e);
84 116
         }
85 117
     }
86 118
 

+ 0
- 43
app/database/migrations/2020_04_22_122910_add_criteria_id_to_assessments_table.php View File

@@ -1,43 +0,0 @@
1
-<?php
2
-
3
-use Illuminate\Database\Migrations\Migration;
4
-use Illuminate\Database\Schema\Blueprint;
5
-
6
-class AddCriteriaIdToAssessmentsTable extends Migration {
7
-
8
-	/**
9
-	 * Run the migrations.
10
-	 *
11
-	 * @return void
12
-	 */
13
-	public function up()
14
-	{
15
-		Schema::table('assessments', function(Blueprint $table)
16
-		{
17
-			$table->integer('criterion_id')->unsigned();
18
-
19
-			$table
20
-                ->foreign('criterion_id')
21
-                ->references('id')
22
-                ->on('criteria')
23
-                ->onDelete('cascade')
24
-                ->onUpdate('cascade');
25
-		});
26
-	}
27
-
28
-
29
-	/**
30
-	 * Reverse the migrations.
31
-	 *
32
-	 * @return void
33
-	 */
34
-	public function down()
35
-	{
36
-		Schema::table('assessments', function(Blueprint $table)
37
-		{
38
-		    $table->dropForeign('assessments_criterion_id_foreign');
39
-		    $table->dropColumn('criterion_id');
40
-		});
41
-	}
42
-
43
-}

+ 2
- 1
app/models/Activity.php View File

@@ -10,7 +10,8 @@ class Activity extends Eloquent
10 10
 
11 11
   public function rubric()
12 12
   {
13
-    return $this->belongsTo('Rubric');
13
+//     return $this->belongsTo('Rubric');
14
+    return $this->belongsToMany('Rubric','new_rubric_activity');
14 15
   }
15 16
 
16 17
   public function course()

+ 52
- 0
app/models/Course.php View File

@@ -42,6 +42,58 @@ class Course extends Eloquent
42 42
 
43 43
   }
44 44
 
45
+  public function outcomes_attempted()
46
+  {
47
+	return DB::table('courses')
48
+	    	->join('activities', 'activities.course_id', '=', 'courses.id')
49
+	    	->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
50
+	    	->join('new_criteria', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
51
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
52
+	    	->where('courses.id','=',$this->id)
53
+	    	->select('criterion_objective_outcome.outcome_id')
54
+	    	->distinct()
55
+	    	->orderBy('criterion_objective_outcome.outcome_id')
56
+	    	->get();
57
+
58
+//   	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
59
+// 	return $this->id;
60
+  }
61
+
62
+  public function outcomes_achieved()
63
+  {
64
+		 $criteria=DB::table('new_criteria')
65
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
66
+	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
67
+	    	->join('courses', 'activities.course_id', '=', 'courses.id')
68
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
69
+	    	->where('courses.id','=',$this->id)
70
+	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
71
+	    	->distinct()
72
+	    	->get()
73
+			;
74
+
75
+		$conteo=0;
76
+		foreach($criteria as $criterion)
77
+		{	
78
+			$students_attempted=Criterion::students_attempted($criterion->id, $criterion->activity_id);
79
+			$students_achieved=Criterion::students_achieved($criterion->id, $criterion->activity_id);
80
+		
81
+			if($students_attempted)
82
+			{
83
+				$percentage_students_who_achieved=100.0*$students_achieved/$students_attempted;
84
+			}
85
+			else
86
+			{
87
+				$percentage_students_who_achieved=0;
88
+			}
89
+			if($percentage_students_who_achieved>=$criterion->expected_percentage_students_achieving)
90
+			{
91
+				$conteo++;
92
+			}
93
+		}		
94
+		return $conteo;
95
+  }
96
+
45 97
   public function semester()
46 98
   {
47 99
     return $this->belongsTo('Semester');

+ 56
- 0
app/models/Criterion.php View File

@@ -37,9 +37,65 @@ class Criterion extends Eloquent
37 37
 		return $this->belongsTo('Program');
38 38
 	}
39 39
 
40
+// 	public function activities()
41
+// 	{
42
+// 		return $this->hasManyThrough('Activity','activity_criterion');
43
+// 	}
44
+// 
40 45
 	public function subcriteria()
41 46
 	{
42 47
 		return json_decode($this->subcriteria);
43 48
 	}
49
+	
50
+	public static function students_attempted($criterion_id,$activity_id)	
51
+	{
52
+		$students_attempted=0;
53
+// 		var_dump($criterion_id);
54
+// 		var_dump($semester);
55
+// 		exit();
56
+		$activities_criterions=DB::table('activity_criterion')
57
+			->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
58
+			->join('courses', 'activities.course_id', '=', 'courses.id')
59
+			->where('activities.id','=',$activity_id)
60
+			->where('activity_criterion.criterion_id','=',$criterion_id)
61
+			->select('activity_criterion.id')
62
+			->distinct()
63
+			->get();
64
+			
65
+		foreach($activities_criterions as $activity_criterion)
66
+		{
67
+		
68
+			 $students_attempted+=DB::table('new_assessments')
69
+				->join('activity_criterion', 'new_assessments.activity_criterion_id', '=', 'activity_criterion.id')
70
+				->where('activity_criterion.id',$activity_criterion->id)
71
+				->count();
72
+		}
73
+		return $students_attempted;
74
+	}
75
+
76
+	public static function students_achieved($criterion_id,$activity_id)	
77
+	{
78
+		$students_achieved=0;
79
+		$activities_criterions=DB::table('activity_criterion')
80
+			->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
81
+			->join('courses', 'activities.course_id', '=', 'courses.id')
82
+			->where('activities.id','=',$activity_id)
83
+			->where('activity_criterion.criterion_id','=',$criterion_id)
84
+			->select('activity_criterion.id','expected_student_score')
85
+			->distinct()
86
+			->get();
87
+			
88
+		foreach($activities_criterions as $activity_criterion)
89
+		{
90
+		
91
+// 			$expected_student_score=DB::table('new_criteria')->where('id',$criterion_id)->select('expected_student_score')->get();
92
+			 $students_achieved+=DB::table('new_assessments')
93
+				->join('activity_criterion', 'new_assessments.activity_criterion_id', '=', 'activity_criterion.id')
94
+				->where('activity_criterion.id',$activity_criterion->id)
95
+				->where('new_assessments.score','>=',$activity_criterion->expected_student_score)
96
+				->count();
97
+		}
98
+		return $students_achieved;
99
+	}
44 100
 
45 101
 }

+ 315
- 0
app/models/Outcome.php View File

@@ -24,6 +24,321 @@ class Outcome extends Eloquent
24 24
 	    return $this->hasMany('Objective');
25 25
 //		return $this->belongsToMany('Objective', 'objective_outcome');
26 26
 	}
27
+// 	public function attempted($semester, $is_grad)
28
+// 	{	
29
+// 		return DB::table('new_criteria')
30
+// 	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
31
+// 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
32
+// 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
33
+// 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
34
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
35
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
36
+// 	    	->where('programs.is_graduate','=',$is_grad)
37
+// 	    	->where('courses.semester_id','=',$semester)
38
+// 	    	->count(DB::raw('DISTINCT new_criteria.id,activity_criterion.activity_id'))
39
+// 			;	    	
40
+// 	
41
+// 	}
42
+// 	public function attempted($semester, $is_grad)
43
+// 	{	
44
+// 		 $criteria=DB::table('new_criteria')
45
+// 	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
46
+// 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
47
+// 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
48
+// 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
49
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
50
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
51
+// 	    	->where('programs.is_graduate','=',$is_grad)
52
+// 	    	->where('courses.semester_id','=',$semester)
53
+// 	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
54
+// 	    	->distinct()
55
+// 	    	->get()
56
+// 			;
57
+// 		$conteo=0;
58
+// 		foreach($criteria as $criterion)
59
+// 		{	
60
+// 			$students_attempted=Criterion::students_attempted($criterion->id, $criterion->activity_id);
61
+// 			if($students_attempted)
62
+// 			{
63
+// 				$conteo++;
64
+// 			}
65
+// 		}
66
+// 		return $conteo;
67
+// 	}
68
+	public function active_by_semesters($selected_semesters, $level)
69
+	{	
70
+		$min_start="9000-01-01 00:00:00";
71
+		$max_end="1000-01-01 00:00:00";
72
+		foreach($selected_semesters as $semester)
73
+		{
74
+			if($min_start>$semester->start)
75
+			{
76
+				$min_start=$semester->start;
77
+			}
78
+			if($max_end<$semester->end)
79
+			{
80
+				$max_end=$semester->end;
81
+			}
82
+		}
83
+		$outcomes = Outcome::where(function($query) use ($min_start)
84
+								   {
85
+										$query->where('deactivation_date', '>=', $min_start)
86
+											  ->orWhere('deactivation_date', null);
87
+								   })
88
+							->where('activation_date', '<=', $max_end)
89
+							->where(function($query2) use ($level)
90
+									{
91
+										$query2->where("level", $level+1)
92
+											   ->orWhere("level",3);
93
+									})
94
+							->orderBy('name', 'ASC')
95
+							->get();
96
+	
97
+// 		return array('outcomes'=>$outcomes,'outcomes_attempted'=>$outcomes_attempted, 'outcomes_achieved'=>$outcomes_achieved, 'attemptedProgramsPerOutcome'=>$attemptedProgramsPerOutcome, 'achievedProgramsPerOutcome'=>$achievedProgramsPerOutcome,'participating_programs'=>$participating_programs);
98
+		return $outcomes;	
99
+	}
100
+
101
+	public function programs_attempted($semesters)
102
+	{	
103
+		$semesters_array=[];
104
+		foreach($semesters as $semester)
105
+		{
106
+			$semesters_array[]=$semester->id;
107
+		}
108
+		 $programs=DB::table('programs')
109
+	    	->join('courses', 'programs.id', '=', 'courses.program_id')
110
+	    	->join('activities', 'activities.course_id', '=', 'courses.id')
111
+	    	->join('activity_criterion', 'activity_criterion.activity_id', '=', 'activities.id')
112
+	    	->join('new_criteria', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
113
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
114
+	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
115
+	    	->whereIn('courses.semester_id',$semesters_array)
116
+	    	->distinct()
117
+	    	->select('programs.id')
118
+	    	->get()
119
+			;
120
+		
121
+		return $programs;
122
+		
123
+	}
124
+	
125
+	public function attempted($semesters, $is_grad)
126
+	{	
127
+		$semesters_array=[];
128
+		foreach($semesters as $semester)
129
+		{
130
+			$semesters_array[]=$semester->id;
131
+		}
132
+		 $criteria=DB::table('new_criteria')
133
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
134
+	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
135
+	    	->join('courses', 'activities.course_id', '=', 'courses.id')
136
+	    	->join('programs', 'programs.id', '=', 'courses.program_id')
137
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
138
+	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
139
+	    	->where('programs.is_graduate','=',$is_grad)
140
+	    	->whereIn('courses.semester_id',$semesters_array)
141
+	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
142
+	    	->distinct()
143
+	    	->get()
144
+			;
145
+		$conteo=0;
146
+		foreach($criteria as $criterion)
147
+		{	
148
+			$students_attempted=Criterion::students_attempted($criterion->id, $criterion->activity_id);
149
+			if($students_attempted)
150
+			{
151
+				$conteo++;
152
+			}
153
+		}
154
+// 		var_dump($conteo);
155
+// 		exit();
156
+		return $conteo;
157
+	}
158
+	
159
+	public function courses_attempted($courses)
160
+	{	
161
+		$courses_array=[];
162
+		foreach($courses as $course)
163
+		{
164
+// 		var_dump($course);
165
+// 		exit();
166
+			$courses_array[]=$course->id;
167
+		}
168
+		 $criteria=DB::table('new_criteria')
169
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
170
+	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
171
+	    	->join('courses', 'activities.course_id', '=', 'courses.id')
172
+	    	->join('programs', 'programs.id', '=', 'courses.program_id')
173
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
174
+	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
175
+	    	->whereIn('courses.id',$courses_array)
176
+	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
177
+	    	->distinct()
178
+	    	->get()
179
+			;
180
+		$conteo=0;
181
+		foreach($criteria as $criterion)
182
+		{	
183
+			$students_attempted=Criterion::students_attempted($criterion->id, $criterion->activity_id);
184
+			if($students_attempted)
185
+			{
186
+				$conteo++;
187
+			}
188
+		}
189
+// 		var_dump($conteo);
190
+// 		exit();
191
+		return $conteo;
192
+	}
193
+	
194
+	public function courses_achieved($courses)
195
+	{
196
+		$courses_array=[];
197
+		foreach($courses as $course)
198
+		{
199
+			$courses_array[]=$course->id;
200
+		}
201
+
202
+		 $criteria=DB::table('new_criteria')
203
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
204
+	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
205
+	    	->join('courses', 'activities.course_id', '=', 'courses.id')
206
+	    	->join('programs', 'programs.id', '=', 'courses.program_id')
207
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
208
+	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
209
+	    	->whereIn('courses.id',$courses_array)
210
+	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
211
+	    	->distinct()
212
+	    	->get()
213
+			;
214
+	
215
+	
216
+		$conteo=0;
217
+		foreach($criteria as $criterion)
218
+		{	
219
+			$students_attempted=Criterion::students_attempted($criterion->id, $criterion->activity_id);
220
+			$students_achieved=Criterion::students_achieved($criterion->id, $criterion->activity_id);
221
+		
222
+			if($students_attempted)
223
+			{
224
+				$percentage_students_who_achieved=100.0*$students_achieved/$students_attempted;
225
+			}
226
+			else
227
+			{
228
+				$percentage_students_who_achieved=0;
229
+			}
230
+			if($percentage_students_who_achieved>=$criterion->expected_percentage_students_achieving)
231
+			{
232
+				$conteo++;
233
+			}
234
+		}		
235
+		return $conteo;
236
+	}
237
+	
238
+	public function achieved($semesters, $is_grad)
239
+	{	
240
+		$semesters_array=[];
241
+		foreach($semesters as $semester)
242
+		{
243
+			$semesters_array[]=$semester->id;
244
+		}
245
+		
246
+//   DB::enableQueryLog();
247
+		 $criteria=DB::table('new_criteria')
248
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
249
+	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
250
+	    	->join('courses', 'activities.course_id', '=', 'courses.id')
251
+	    	->join('programs', 'programs.id', '=', 'courses.program_id')
252
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
253
+	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
254
+	    	->where('programs.is_graduate','=',$is_grad)
255
+	    	->whereIn('courses.semester_id',$semesters_array)
256
+	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
257
+	    	->distinct()
258
+	    	->get()
259
+			;
260
+// 		dd(DB::getQueryLog());
261
+		 
262
+		$conteo=0;
263
+		foreach($criteria as $criterion)
264
+		{	
265
+			$students_attempted=Criterion::students_attempted($criterion->id, $criterion->activity_id);
266
+			$students_achieved=Criterion::students_achieved($criterion->id, $criterion->activity_id);
267
+		
268
+			if($students_attempted)
269
+			{
270
+				$percentage_students_who_achieved=100.0*$students_achieved/$students_attempted;
271
+			}
272
+			else
273
+			{
274
+				$percentage_students_who_achieved=0;
275
+			}
276
+			if($percentage_students_who_achieved>=$criterion->expected_percentage_students_achieving)
277
+			{
278
+				$conteo++;
279
+			}
280
+		}		
281
+		return $conteo;
282
+	}
283
+	
284
+	
285
+// 	public function achieved($semester, $is_grad)
286
+// 	{	
287
+// 		
288
+// //   DB::enableQueryLog();
289
+// 		 $criteria=DB::table('new_criteria')
290
+// 	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
291
+// 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
292
+// 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
293
+// 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
294
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
295
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$this->id)
296
+// 	    	->where('programs.is_graduate','=',$is_grad)
297
+// 	    	->where('courses.semester_id','=',$semester)
298
+// 	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
299
+// 	    	->distinct()
300
+// 	    	->get()
301
+// 			;
302
+// // 		dd(DB::getQueryLog());
303
+// 		 
304
+// 		$conteo=0;
305
+// 		foreach($criteria as $criterion)
306
+// 		{	
307
+// 			$outcome_performance=DB::table('outcome_performance')
308
+// 				->where('outcome_performance.outcome_id','=',$this->id)
309
+// 				->where('outcome_performance.criterion_id','=',$criterion->id)
310
+// 				->where('outcome_performance.semester_id','=',$semester)
311
+// 				->where('outcome_performance.level','=',$is_grad)
312
+// 				->select('students_attempted','students_achieved')
313
+// 				->first();
314
+// 			if(!empty($outcome_performance) and $outcome_performance->students_attempted)
315
+// 			{
316
+// 				$percentage_students_who_achieved=100.0*$outcome_performance->students_achieved/$outcome_performance->students_attempted;
317
+// 			}
318
+// 			else
319
+// 			{
320
+// 				$students_attempted=Criterion::students_attempted($criterion->id, $criterion->activity_id);
321
+// 				$students_achieved=Criterion::students_achieved($criterion->id, $criterion->activity_id);
322
+// 			
323
+// 				if($students_attempted)
324
+// 				{
325
+// 					$percentage_students_who_achieved=100.0*$students_achieved/$students_attempted;
326
+// 					DB::table('outcome_performance')->insert(array('criterion_id'=>$criterion->id,'outcome_id'=>$this->id,'semester_id'=>$semester,
327
+// 					'students_attempted' => $students_attempted,'students_achieved' => $students_achieved,'level'=>$is_grad));
328
+// 				}
329
+// 				else
330
+// 				{
331
+// 					$percentage_students_who_achieved=0;
332
+// 				}
333
+// 			}
334
+// 			if($percentage_students_who_achieved>=$criterion->expected_percentage_students_achieving)
335
+// 			{
336
+// 				$conteo++;
337
+// 			}
338
+// 		}		
339
+// 		return $conteo;
340
+// 	}
341
+// 	
27 342
 
28 343
 	public static function active()
29 344
     {

+ 210
- 0
app/models/Program.php View File

@@ -102,6 +102,216 @@ class Program extends Eloquent
102 102
 		return $this->hasMany('Criterion');
103 103
 	}
104 104
 
105
+// 	public function attempted_outcome($outcome_id, $semester)
106
+// 	{
107
+// 		$conteo= DB::table('activity_criterion')
108
+// 	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
109
+// 	    	->join('courses', 'activities.course_id', '=', 'courses.id')
110
+// 	    	->join('programs', 'programs.id', '=', 'courses.program_id')
111
+// 	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
112
+// 	    	->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
113
+// 	    	->where('programs.id','=',$this->id)
114
+// 	    	->where('courses.semester_id','=',$semester)
115
+// 	    	->count(DB::raw('DISTINCT criterion_objective_outcome.outcome_id'))
116
+// 			;	    	
117
+// 		return $conteo;		
118
+// 	}
119
+
120
+	public function attempted_criteria_by_outcome($outcome_id, $semesters)
121
+	{
122
+		$semesters_array=[];
123
+		foreach($semesters as $semester)
124
+		{
125
+			$semesters_array[]=$semester->id;
126
+		}
127
+		
128
+		$conteo= DB::table('activity_criterion')
129
+	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
130
+	    	->join('courses', 'activities.course_id', '=', 'courses.id')
131
+	    	->join('programs', 'programs.id', '=', 'courses.program_id')
132
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
133
+	    	->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
134
+	    	->where('programs.id','=',$this->id)
135
+	    	->whereIn('courses.semester_id',$semesters_array)
136
+	    	->count(DB::raw('DISTINCT criterion_objective_outcome.criterion_id'))
137
+			;	    	
138
+		return $conteo;		
139
+	}
140
+
141
+	public function attempted_outcome($outcome_id, $semesters)
142
+	{
143
+		$semesters_array=[];
144
+		foreach($semesters as $semester)
145
+		{
146
+			$semesters_array[]=$semester->id;
147
+		}
148
+		
149
+		$conteo= DB::table('activity_criterion')
150
+	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
151
+	    	->join('courses', 'activities.course_id', '=', 'courses.id')
152
+	    	->join('programs', 'programs.id', '=', 'courses.program_id')
153
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'activity_criterion.criterion_id')
154
+	    	->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
155
+	    	->where('programs.id','=',$this->id)
156
+	    	->whereIn('courses.semester_id',$semesters_array)
157
+	    	->count(DB::raw('DISTINCT criterion_objective_outcome.outcome_id'))
158
+			;	    	
159
+		return $conteo;		
160
+	}
161
+	
162
+	public function achieved_criteria_by_outcome($outcome_id, $semesters)
163
+	{
164
+		$semesters_array=[];
165
+		foreach($semesters as $semester)
166
+		{
167
+			$semesters_array[]=$semester->id;
168
+		}
169
+		
170
+//   DB::enableQueryLog();
171
+// 		dd(DB::getQueryLog());
172
+		 $criteria=DB::table('new_criteria')
173
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
174
+	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
175
+	    	->join('courses', 'activities.course_id', '=', 'courses.id')
176
+	    	->join('programs', 'programs.id', '=', 'courses.program_id')
177
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
178
+	    	->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
179
+	    	->where('programs.id','=',$this->id)
180
+	    	->whereIn('courses.semester_id',$semesters_array)
181
+	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
182
+	    	->distinct()
183
+	    	->get()
184
+			;
185
+// 		dd(DB::getQueryLog());
186
+		 
187
+		$conteo=0;
188
+		$attempted_criteria_per_program_array=[];
189
+// 		$students_attempted=0;
190
+// 		$students_achieved=0;
191
+		foreach($criteria as $criterion)
192
+		{	
193
+			if(!isset($students_attempted[$criterion->id]))$students_attempted[$criterion->id]=0;
194
+			if(!isset($students_achieved[$criterion->id]))$students_achieved[$criterion->id]=0;
195
+			$attempted_criteria_per_program_array[$criterion->id]=1;
196
+			$students_attempted[$criterion->id]+=Criterion::students_attempted($criterion->id, $criterion->activity_id);
197
+			$students_achieved[$criterion->id]+=Criterion::students_achieved($criterion->id, $criterion->activity_id);
198
+		}
199
+// 		var_dump($outcome_id);
200
+// 		var_dump($this->id);
201
+// 		if(isset($students_attempted))var_dump($students_attempted);
202
+// 		else{print "aqui hay algo";}
203
+// 		print "<br>";
204
+// 		if(isset($students_achieved))var_dump($students_achieved);
205
+// 		print "<br>";
206
+// 		print "<br>";
207
+// 			exit();
208
+		if(isset($students_attempted))
209
+		{
210
+			foreach($students_attempted as $criteria_id => $students_attempted_n)
211
+			{
212
+				if($students_attempted_n)
213
+				{
214
+					$percentage_students_who_achieved=100.0*$students_achieved[$criteria_id]/$students_attempted[$criteria_id];
215
+				}
216
+				else
217
+				{
218
+					$percentage_students_who_achieved=0;
219
+				}
220
+				if($percentage_students_who_achieved>=$criterion->expected_percentage_students_achieving)
221
+				{
222
+					$conteo++;
223
+				}
224
+			}		
225
+		}
226
+		$attempted_criteria_per_program=count($attempted_criteria_per_program_array);
227
+		$achievedProgramOutcome=0;
228
+		$outcome=Outcome::where('id',$outcome_id)->select('expected_outcome')->first();
229
+// 		var_dump($outcome->expected_outcome);
230
+// 		exit();
231
+		if($attempted_criteria_per_program!=0 && 100.0*$conteo/$attempted_criteria_per_program >= $outcome->expected_outcome)
232
+		{
233
+			$achievedProgramOutcome=1;
234
+			// $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
235
+		}
236
+		return $conteo;
237
+	}
238
+
239
+	public function achieved_outcome($outcome_id, $semesters)
240
+	{
241
+		$semesters_array=[];
242
+		foreach($semesters as $semester)
243
+		{
244
+			$semesters_array[]=$semester->id;
245
+		}
246
+		
247
+//   DB::enableQueryLog();
248
+// 		dd(DB::getQueryLog());
249
+		 $criteria=DB::table('new_criteria')
250
+	    	->join('activity_criterion', 'activity_criterion.criterion_id', '=', 'new_criteria.id')
251
+	    	->join('activities', 'activity_criterion.activity_id', '=', 'activities.id')
252
+	    	->join('courses', 'activities.course_id', '=', 'courses.id')
253
+	    	->join('programs', 'programs.id', '=', 'courses.program_id')
254
+	    	->join('criterion_objective_outcome', 'criterion_objective_outcome.criterion_id', '=', 'new_criteria.id')
255
+	    	->where('criterion_objective_outcome.outcome_id','=',$outcome_id)
256
+	    	->where('programs.id','=',$this->id)
257
+	    	->whereIn('courses.semester_id',$semesters_array)
258
+	    	->select('new_criteria.id','expected_percentage_students_achieving','activity_criterion.activity_id')
259
+	    	->distinct()
260
+	    	->get()
261
+			;
262
+// 		dd(DB::getQueryLog());
263
+		 
264
+		$conteo=0;
265
+		$attempted_criteria_per_program_array=[];
266
+// 		$students_attempted=0;
267
+// 		$students_achieved=0;
268
+		foreach($criteria as $criterion)
269
+		{	
270
+			if(!isset($students_attempted[$criterion->id]))$students_attempted[$criterion->id]=0;
271
+			if(!isset($students_achieved[$criterion->id]))$students_achieved[$criterion->id]=0;
272
+			$attempted_criteria_per_program_array[$criterion->id]=1;
273
+			$students_attempted[$criterion->id]+=Criterion::students_attempted($criterion->id, $criterion->activity_id);
274
+			$students_achieved[$criterion->id]+=Criterion::students_achieved($criterion->id, $criterion->activity_id);
275
+		}
276
+// 		var_dump($outcome_id);
277
+// 		var_dump($this->id);
278
+// 		if(isset($students_attempted))var_dump($students_attempted);
279
+// 		else{print "aqui hay algo";}
280
+// 		print "<br>";
281
+// 		if(isset($students_achieved))var_dump($students_achieved);
282
+// 		print "<br>";
283
+// 		print "<br>";
284
+// 			exit();
285
+		if(isset($students_attempted))
286
+		{
287
+			foreach($students_attempted as $criteria_id => $students_attempted_n)
288
+			{
289
+				if($students_attempted_n)
290
+				{
291
+					$percentage_students_who_achieved=100.0*$students_achieved[$criteria_id]/$students_attempted[$criteria_id];
292
+				}
293
+				else
294
+				{
295
+					$percentage_students_who_achieved=0;
296
+				}
297
+				if($percentage_students_who_achieved>=$criterion->expected_percentage_students_achieving)
298
+				{
299
+					$conteo++;
300
+				}
301
+			}		
302
+		}
303
+		$attempted_criteria_per_program=count($attempted_criteria_per_program_array);
304
+		$achievedProgramOutcome=0;
305
+		$outcome=Outcome::where('id',$outcome_id)->select('expected_outcome')->first();
306
+// 		var_dump($outcome->expected_outcome);
307
+// 		exit();
308
+		if($attempted_criteria_per_program!=0 && 100.0*$conteo/$attempted_criteria_per_program >= $outcome->expected_outcome)
309
+		{
310
+			$achievedProgramOutcome=1;
311
+			// $output[]= 'END OF PROGRAM: '.$program->name.'-'.json_encode($achievedProgramsPerOutcome);
312
+		}
313
+		return $achievedProgramOutcome;
314
+	}
105 315
 
106 316
 	public static function generalComponentPrograms(){
107 317
 		return self::whereIn('id', array(123,124,125,126,127,128,129))->get();

+ 1
- 0
app/routes.php View File

@@ -368,6 +368,7 @@ Route::group(array('before' => 'auth|has_access'), function()
368 368
     {
369 369
         Route::post('program', array('before' => 'csrf', 'uses'=>'ProfessorsController@program'));
370 370
         Route::get('activities/{activity_id}/rubrics', 'RubricsController@newRubric');
371
+        Route::get('activities/{activity_id}/other_method', 'RubricsController@newOtherMethod');
371 372
         Route::get('activities/{activity_id}/rubric', 'RubricsController@show');
372 373
         Route::get('activities/{activity_id}/rubric/{rubric_id}/download', 'RubricsController@download');
373 374
         Route::get('activities/{activity_id}/rubric/{rubric_id}/print', 'RubricsController@printview');

+ 16
- 1
app/views/local/managers/admins/assessment_report.blade.php View File

@@ -80,8 +80,23 @@
80 80
                                                 @foreach($section->activities as $activity_index => $activity)
81 81
 
82 82
                                                     <!-- If activity has a rubric and the rubric has the outcome being evaluated -->
83
-                                                    @if(array_key_exists($outcome->id, (array)$activity->o_att_array) && $activity->o_att_array[$outcome->id] >=1)
83
+                                                    @if(array_key_exists($outcome->id, (array)$activity->o_att_array) && $activity->o_att_array[$outcome->id] >=1 && isset($section)&& isset($activity->rubric))
84 84
                                                         <h5>Measure {{ $activity_index + 1 }}</h5>
85
+                                                        <?php
86
+                                                        /*
87
+                                                        var_dump($section->code);
88
+                                                        var_dump($section->number);
89
+                                                        var_dump($section->name);
90
+                                                        var_dump($outcome->name);
91
+                                                        var_dump(date('M Y', strtotime($activity->date)));
92
+                                                        var_dump($activity->name);
93
+                                                        var_dump(count($section->students));
94
+                                                        print"<br>";
95
+                                                        print "A rubric was used in the $section->code-$section->number ($section->name) course (". date('M Y', strtotime($activity->date)).") to assess students’ <u>". strtolower($outcome->name) ."</u> in the activity: '<strong>$activity->name </strong>'. N= ". count($section->students);
96
+                                                        exit();
97
+                                                        */
98
+                                                        ?>
99
+
85 100
 
86 101
                                                         <p>A rubric was used in the {{ $section->code }}-{{ $section->number }} ({{ $section->name }}) course ({{ date('M Y', strtotime($activity->date))}}) to assess students’ <u>{{ strtolower($outcome->name) }}</u> in the activity: "<strong>{{ $activity->name }}</strong>". N= {{ count($section->students) }}. </p>
87 102
                                                         

+ 13
- 13
app/views/local/managers/admins/overview.blade.php View File

@@ -50,7 +50,7 @@
50 50
                         <th>Undergraduate Success Rate</th>
51 51
                     </thead>
52 52
                     <tbody>
53
-                        @foreach($outcomes as $outcome)
53
+                        @foreach($outcomes_subgrad as $outcome)
54 54
                             <tr>
55 55
                                 <td>{{ link_to_action('OutcomesController@show', $outcome->name, array($outcome->id), $attributes = array()) }}</td>
56 56
                                 <td>{{{ $attemptedUndergradProgramsPerOutcome[$outcome->id] }}}</td>
@@ -108,7 +108,7 @@
108 108
                         <th>Graduate Success Rate</th>
109 109
                     </thead>
110 110
                     <tbody>
111
-                        @foreach($outcomes as $outcome)
111
+                        @foreach($outcomes_grad as $outcome)
112 112
                             <tr>
113 113
                                 <td>{{ link_to_action('OutcomesController@show', $outcome->name, array($outcome->id), $attributes = array()) }}</td>
114 114
                                 <td>{{{ $attemptedGradProgramsPerOutcome[$outcome->id] }}}</td>
@@ -171,7 +171,7 @@ $(function () {
171 171
             },
172 172
             xAxis: {
173 173
                 categories: [
174
-                    @foreach($outcomes as $outcome)
174
+                    @foreach($outcomes_subgrad as $outcome)
175 175
                         "{{{ $outcome->name }}}",
176 176
                     @endforeach
177 177
                 ],
@@ -227,7 +227,7 @@ $(function () {
227 227
                     y: -1
228 228
                 },
229 229
                 data: [
230
-                    @foreach($outcomes as $index => $outcome)
230
+                    @foreach($outcomes_subgrad as $index => $outcome)
231 231
                         @if(
232 232
                             is_array($undergrad_outcomes_attempted)
233 233
                             && array_key_exists($outcome->id, $undergrad_outcomes_attempted)
@@ -254,7 +254,7 @@ $(function () {
254 254
                     y:-1
255 255
                 },
256 256
                 data:[
257
-                    @foreach($outcomes as $index => $outcome)
257
+                    @foreach($outcomes_subgrad as $index => $outcome)
258 258
                         @if(
259 259
                             is_array($undergrad_outcomes_attempted)
260 260
                             && array_key_exists($outcome->id, $undergrad_outcomes_attempted)
@@ -285,7 +285,7 @@ $(function () {
285 285
             },
286 286
             xAxis: {
287 287
                 categories: [
288
-                    @foreach($outcomes as $outcome)
288
+                    @foreach($outcomes_grad as $outcome)
289 289
                         "{{{ $outcome->name }}}",
290 290
                     @endforeach
291 291
                 ],
@@ -341,7 +341,7 @@ $(function () {
341 341
                     y:-1
342 342
                 },
343 343
                 data: [
344
-                    @foreach($outcomes as $index => $outcome)
344
+                    @foreach($outcomes_grad as $index => $outcome)
345 345
                         @if(
346 346
                             is_array($grad_outcomes_attempted)
347 347
                             && array_key_exists($outcome->id, $grad_outcomes_attempted)
@@ -369,7 +369,7 @@ $(function () {
369 369
                     y:-1
370 370
                 },
371 371
                 data:[
372
-                    @foreach($outcomes as $index => $outcome)
372
+                    @foreach($outcomes_grad as $index => $outcome)
373 373
                         @if(
374 374
                             is_array($grad_outcomes_attempted)
375 375
                             && array_key_exists($outcome->id, $grad_outcomes_attempted)
@@ -397,7 +397,7 @@ $(function () {
397 397
             },
398 398
             xAxis: {
399 399
                 categories: [
400
-                    @foreach($outcomes as $outcome)
400
+                    @foreach($outcomes_subgrad as $outcome)
401 401
                         "{{{ $outcome->name }}}",
402 402
                     @endforeach
403 403
                 ],
@@ -453,7 +453,7 @@ $(function () {
453 453
                     y: -1
454 454
                 },
455 455
                 data: [
456
-                    @foreach($outcomes as $index => $outcome)
456
+                    @foreach($outcomes_subgrad as $index => $outcome)
457 457
                         @if(
458 458
                             is_array($undergrad_outcomes_attempted)
459 459
                             && array_key_exists($outcome->id, $undergrad_outcomes_attempted)
@@ -481,7 +481,7 @@ $(function () {
481 481
                     y:-1
482 482
                 },
483 483
                 data:[
484
-                    @foreach($outcomes as $index => $outcome)
484
+                    @foreach($outcomes_subgrad as $index => $outcome)
485 485
                         @if(
486 486
                             is_array($undergrad_outcomes_attempted)
487 487
                             && array_key_exists($outcome->id, $undergrad_outcomes_attempted)
@@ -506,7 +506,7 @@ $(function () {
506 506
         },
507 507
         xAxis: {
508 508
             categories: [
509
-                @foreach($outcomes as $outcome)
509
+                @foreach($outcomes_subgrad as $outcome)
510 510
                     "{{{ $outcome->name }}}",
511 511
                 @endforeach
512 512
             ],
@@ -540,7 +540,7 @@ $(function () {
540 540
             name: 'Undergraduate',
541 541
             color: '#e70033',
542 542
             data:[
543
-                @foreach($outcomes as $outcome)
543
+                @foreach($outcomes_subgrad as $outcome)
544 544
                     {{{ $attemptedUndergradProgramsPerOutcome[$outcome->id] }}},
545 545
                 @endforeach
546 546
             ],

+ 1
- 0
app/views/local/professors/activity.blade.php View File

@@ -166,6 +166,7 @@
166 166
             <!-- If no rubric is assigned and the semester is active -->
167 167
             @if($activity->rubric == NULL && in_array($course->semester->id, $active_semesters))
168 168
                 {{ HTML::linkAction('RubricsController@newRubric', 'Assign Rubric', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
169
+                {{ HTML::linkAction('RubricsController@newOtherMethod', 'Assign Other Assessment Method', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}
169 170
             @else
170 171
 
171 172
                 {{ HTML::linkAction('RubricsController@show', 'View Rubric', array($activity->id), array('class'=>'btn btn-primary btn-sm btn-block')) }}

+ 3
- 2
composer.json View File

@@ -8,8 +8,9 @@
8 8
 		"laravel/framework": "4.2.*",
9 9
 		"pda/pheanstalk": "~2.0",
10 10
 		"barryvdh/laravel-dompdf": "0.4.*",
11
-		 "zizaco/entrust": "1.2.*@dev"
12
-	},
11
+		 "zizaco/entrust": "1.2.*@dev",
12
+		"cornford/backup": "1.*"
13
+},
13 14
 	"require-dev": {
14 15
 		"way/generators": "~2.0",
15 16
 		"fzaninotto/faker": "1.5.*@dev",