Selaa lähdekoodia

Merge branch 'adaptar_a_bd_nueva' into gabriel_branch

Gabriel Santiago Plaza 3 vuotta sitten
vanhempi
commit
bdb822cb33

+ 2
- 0
app/config/app.php Näytä tiedosto

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

+ 1
- 1
app/controllers/ActivitiesController.php Näytä tiedosto

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

+ 273
- 174
app/controllers/AdministratorsController.php Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

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

+ 146
- 23
app/controllers/ProgramsController.php Näytä tiedosto

@@ -6,36 +6,79 @@ 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
-
19
-
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
-    }
38
-
18
+//     $outcomeCount = Outcome::all()->count();
19
+
20
+    $selected_semesters = Semester::find(Session::get('semesters_ids'));
21
+
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();
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
      */
@@ -76,10 +119,15 @@ 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
+
83 131
 public function showReport()
84 132
 {
85 133
 
@@ -171,6 +219,81 @@ public function showReport()
171 219
    return View::make('local.managers.shared.program_report', compact('title','programs_info','selected_divulgaciones','selected_semesters','tables_names'));
172 220
 }
173 221
 
222
+//   public function show($id)
223
+//   {
224
+//
225
+//     $program = Program::find($id);
226
+//     $title= $program->school->name.': '.$program->name;
227
+//     $program_courses = $program->courses;
228
+//     $outcomes = Outcome::orderBy('name', 'asc')->get();
229
+//     $schools = School::all();
230
+//     $outcomeCount = Outcome::all()->count();
231
+//
232
+//
233
+//     $outcomes_achieved = array_fill(1, $outcomeCount, 0);
234
+//     $outcomes_attempted = array_fill(1, $outcomeCount, 0);
235
+//
236
+//     $assessed_courses_count=0;
237
+//     foreach ($program_courses as $course)
238
+//     {
239
+//         if($course->outcomes_achieved!=NULL)
240
+//         {
241
+//             $course_outcomes_achieved =json_decode($course->outcomes_achieved, true);
242
+//             $course_outcomes_attempted =json_decode($course->outcomes_attempted, true);
243
+//             for($i=1; $i<=count($outcomes_attempted); $i++)
244
+//             {
245
+//                 $outcomes_achieved[$i]+=$course_outcomes_achieved[$i];
246
+//                 $outcomes_attempted[$i]+=$course_outcomes_attempted[$i];
247
+//             }
248
+//             $assessed_courses_count+=1;
249
+//         }
250
+//     }
251
+//
252
+//     /**
253
+//      * List of grouped courses (grouped sections)
254
+//      */
255
+//
256
+//     $grouped_courses = Course::
257
+//       select(DB::raw('name, code, number, max(outcomes_attempted) as outcomes_attempted, semester_id, program_id'))
258
+//       ->with('semester')
259
+//       ->with('program')
260
+//       ->where('program_id', $program->id)
261
+//       ->whereIn('semester_id', Session::get('semesters_ids'))
262
+//       ->groupBy(array('code', 'number', 'semester_id'))
263
+//       ->orderBy('code')
264
+//       ->orderBy('number')
265
+//       ->orderBy('semester_id')
266
+//       ->get();
267
+//
268
+//     // Program contact information
269
+//     $users = User::
270
+//         select('users.*')
271
+//         ->leftJoin('program_user', 'users.id', '=', 'program_user.user_id')
272
+//         ->where(function($query) use($program)
273
+//         {
274
+//             $query
275
+//                 ->where('school_id', $program->school_id)
276
+//                 ->where('role', 2);
277
+//         })
278
+//         ->orWhere(function($query) use($program)
279
+//         {
280
+//             $query
281
+//                 ->where('role', 3)
282
+//                 ->where('program_id', $program->id);
283
+//         })
284
+//         ->orWhere(function($query) use($program)
285
+//         {
286
+//             $query
287
+//                 ->where('role', 4)
288
+//                 ->where('program_id', $program->id);
289
+//         })
290
+//         ->get();
291
+//
292
+//     return View::make('local.managers.shared.program', compact('title', 'outcomes', 'outcomes_attempted', 'outcomes_achieved', 'schools', 'program_courses', 'assessed_courses_count', 'grouped_courses', 'program', 'users'));
293
+//
294
+// }
295
+
296
+
174 297
   /**
175 298
    * Info to print a program
176 299
    */

+ 38
- 8
app/controllers/RubricsController.php Näytä tiedosto

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

+ 0
- 43
app/database/migrations/2020_04_22_122910_add_criteria_id_to_assessments_table.php Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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
 }

+ 322
- 0
app/models/Outcome.php Näytä tiedosto

@@ -24,4 +24,326 @@ 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
+//
342
+
343
+	public static function active()
344
+    {
345
+        //TODO: Check when semester doesnt exist or session is empty
346
+        $selected_semester = Semester::find(Session::get('semesters_ids')[0]);
347
+        return Outcome::withTrashed()->where('deactivation_date', '>=', $selected_semester->start)->orWhere('deactivation_date', null)->orderBy('name', 'ASC')->get();
348
+    }
27 349
 }

+ 210
- 0
app/models/Program.php Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -388,6 +388,7 @@ Route::group(array('before' => 'auth|has_access'), function () {
388 388
     Route::group(array('prefix' => 'professor', 'before' => 'prof'), function () {
389 389
         Route::post('program', array('before' => 'csrf', 'uses' => 'ProfessorsController@program'));
390 390
         Route::get('activities/{activity_id}/rubrics', 'RubricsController@newRubric');
391
+        Route::get('activities/{activity_id}/other_method', 'RubricsController@newOtherMethod');
391 392
         Route::get('activities/{activity_id}/rubric', 'RubricsController@show');
392 393
         Route::get('activities/{activity_id}/rubric/{rubric_id}/download', 'RubricsController@download');
393 394
         Route::get('activities/{activity_id}/rubric/{rubric_id}/print', 'RubricsController@printview');

+ 16
- 1
app/views/local/managers/admins/assessment_report.blade.php Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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 Näytä tiedosto

@@ -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",