Completed
Pull Request — 1.10.x (#1225)
by Angel Fernando Quiroz
139:04 queued 100:40
created
main/mySpace/current_courses.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -34,11 +34,11 @@  discard block
 block discarded – undo
34 34
 		}
35 35
 
36 36
 		$teachers = CourseManager::get_teacher_list_from_course_code($course_code);
37
-		$teacher_list =  array();
37
+		$teacher_list = array();
38 38
 
39 39
 		if (!empty($teachers)) {
40
-			foreach($teachers as $teacher) {
41
-				$teacher_list[]= $teacher['firstname'].' '.$teacher['lastname'];
40
+			foreach ($teachers as $teacher) {
41
+				$teacher_list[] = $teacher['firstname'].' '.$teacher['lastname'];
42 42
 			}
43 43
 		}
44 44
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 			$students[] = $student['user_id'];
55 55
 		}
56 56
 
57
-		$t_lp 	= Database :: get_course_table(TABLE_LP_MAIN);
57
+		$t_lp = Database :: get_course_table(TABLE_LP_MAIN);
58 58
 		$sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp
59 59
 				   WHERE c_id = $course_id AND lp.session_id = 0";
60 60
 		$rs_lp 	= Database::query($sql_lp);
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 		);
68 68
 
69 69
 		$total_tools = 0;
70
-		foreach($total_tools_list as $tool) {
70
+		foreach ($total_tools_list as $tool) {
71 71
 			$total_tools += $tool['count_access_tool'];
72 72
 		}
73 73
 
@@ -93,16 +93,16 @@  discard block
 block discarded – undo
93 93
 				if (!empty($students)) {
94 94
 					foreach ($students  as $student_id) {
95 95
 						$avg_student_progress   = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
96
-						$myavg_temp 			= Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id);
96
+						$myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id);
97 97
 						$avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
98 98
 
99 99
 						if (intval($avg_progress_in_course) == 100) {
100 100
 							$count_students_complete_all_activities++;
101 101
 						}
102 102
 						if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) {
103
-							$count_students_complete_all_activities_at_50 ++;
103
+							$count_students_complete_all_activities_at_50++;
104 104
 						}
105
-						$total_average_progress +=$avg_progress_in_course;
105
+						$total_average_progress += $avg_progress_in_course;
106 106
 
107 107
 						$time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id);
108 108
 						$total_time_spent += $time_spent;
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 						    ORDER BY item_type";
140 140
 				$res_lpi = Database::query($sql_lpi);
141 141
 				while ($row_lpi = Database::fetch_array($res_lpi)) {
142
-					switch($row_lpi['item_type']) {
142
+					switch ($row_lpi['item_type']) {
143 143
 						case 'document':
144 144
 							$array[$i]['learnpath_docs']++;
145 145
 							break;
@@ -171,10 +171,10 @@  discard block
 block discarded – undo
171 171
 
172 172
 				if (!empty($student_count)) {
173 173
 					$array[$i]['count_students_accessing'] = $count_students_accessing;
174
-					$array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0);
174
+					$array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count * 100, 0);
175 175
 					$array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities;
176
-					$array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);;
177
-					$array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2);
176
+					$array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count * 100, 0); ;
177
+					$array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities / $student_count * 100, 2);
178 178
 					$array[$i]['total_time_spent'] = 0;
179 179
 					$array[$i]['average_time_spent_per_student'] = 0;
180 180
 
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 	exit;
242 242
 }
243 243
 
244
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
244
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('MySpace'));
245 245
 
246 246
 Display::display_header(get_lang('CurrentCourses'));
247 247
 
Please login to merge, or discard this patch.
Indentation   +209 added lines, -209 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $filename = 'reporting.xls';
13 13
 
14 14
 if (!api_is_allowed_to_create_course()) {
15
-	api_not_allowed(true);
15
+    api_not_allowed(true);
16 16
 }
17 17
 
18 18
 $user_id = api_get_user_id();
@@ -23,222 +23,222 @@  discard block
 block discarded – undo
23 23
 $session_id = 0;
24 24
 
25 25
 if (!empty($my_courses)) {
26
-	foreach ($my_courses as $course) {
27
-		$course_code = $course['code'];
28
-		$course_id = $course['real_id'];
29
-		$course_info = api_get_course_info($course_code);
30
-
31
-		//Only show open courses
32
-		if ($course_info['visibility'] == 0) {
33
-			continue;
34
-		}
35
-
36
-		$teachers = CourseManager::get_teacher_list_from_course_code($course_code);
37
-		$teacher_list =  array();
38
-
39
-		if (!empty($teachers)) {
40
-			foreach($teachers as $teacher) {
41
-				$teacher_list[]= $teacher['firstname'].' '.$teacher['lastname'];
42
-			}
43
-		}
44
-
45
-		$tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false);
46
-
47
-		//Cleaning students only REAL students
48
-		$students = array();
49
-		foreach ($tmp_students  as $student) {
50
-			$user_info = api_get_user_info($student['user_id']);
51
-			if ($user_info['status'] != STUDENT) {
52
-				continue;
53
-			}
54
-			$students[] = $student['user_id'];
55
-		}
56
-
57
-		$t_lp 	= Database :: get_course_table(TABLE_LP_MAIN);
58
-		$sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp
26
+    foreach ($my_courses as $course) {
27
+        $course_code = $course['code'];
28
+        $course_id = $course['real_id'];
29
+        $course_info = api_get_course_info($course_code);
30
+
31
+        //Only show open courses
32
+        if ($course_info['visibility'] == 0) {
33
+            continue;
34
+        }
35
+
36
+        $teachers = CourseManager::get_teacher_list_from_course_code($course_code);
37
+        $teacher_list =  array();
38
+
39
+        if (!empty($teachers)) {
40
+            foreach($teachers as $teacher) {
41
+                $teacher_list[]= $teacher['firstname'].' '.$teacher['lastname'];
42
+            }
43
+        }
44
+
45
+        $tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false);
46
+
47
+        //Cleaning students only REAL students
48
+        $students = array();
49
+        foreach ($tmp_students  as $student) {
50
+            $user_info = api_get_user_info($student['user_id']);
51
+            if ($user_info['status'] != STUDENT) {
52
+                continue;
53
+            }
54
+            $students[] = $student['user_id'];
55
+        }
56
+
57
+        $t_lp 	= Database :: get_course_table(TABLE_LP_MAIN);
58
+        $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp
59 59
 				   WHERE c_id = $course_id AND lp.session_id = 0";
60
-		$rs_lp 	= Database::query($sql_lp);
61
-		$t_lpi 	= Database :: get_course_table(TABLE_LP_ITEM);
62
-		$t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT);
63
-
64
-		$total_tools_list = Tracking::get_tools_most_used_by_course(
65
-			$course_id,
66
-			$session_id
67
-		);
68
-
69
-		$total_tools = 0;
70
-		foreach($total_tools_list as $tool) {
71
-			$total_tools += $tool['count_access_tool'];
72
-		}
73
-
74
-		if (Database :: num_rows($rs_lp) > 0) {
75
-			while ($learnpath = Database :: fetch_array($rs_lp)) {
76
-				$lp_id = $learnpath['id'];
77
-
78
-				$lp_items =
79
-				$array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$course_code.'&amp;action=view&amp;lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>';
80
-
81
-				$array[$i]['teachers'] = '';
82
-				if (!empty($teacher_list)) {
83
-					$array[$i]['teachers'] = implode(', ', $teacher_list);
84
-				}
85
-
86
-				$array[$i]['course_name'] = $course['title'];
87
-				$count_students_accessing = 0;
88
-				$count_students_complete_all_activities = 0;
89
-				$count_students_complete_all_activities_at_50 = 0;
90
-				$total_time_spent = 0;
91
-				$total_average_progress = 0;
92
-
93
-				if (!empty($students)) {
94
-					foreach ($students  as $student_id) {
95
-						$avg_student_progress   = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
96
-						$myavg_temp 			= Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id);
97
-						$avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
98
-
99
-						if (intval($avg_progress_in_course) == 100) {
100
-							$count_students_complete_all_activities++;
101
-						}
102
-						if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) {
103
-							$count_students_complete_all_activities_at_50 ++;
104
-						}
105
-						$total_average_progress +=$avg_progress_in_course;
106
-
107
-						$time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id);
108
-						$total_time_spent += $time_spent;
109
-						if (!empty($time_spent)) {
110
-							$count_students_accessing++;
111
-						}
112
-					}
113
-					//$total_tools += $nb_assignments +  $messages + $links + $chat_last_connection + $documents;
114
-				}
115
-
116
-				$student_count = count($students);
117
-
118
-				$array[$i]['count_students'] = $student_count;
119
-				$array[$i]['count_students_accessing'] = 0;
120
-				$array[$i]['count_students_accessing_percentage'] = 0;
121
-				$array[$i]['count_students_complete_all_activities_at_50'] = 0;
122
-				$array[$i]['count_students_complete_all_activities'] = 0;
123
-				$array[$i]['average_percentage_activities_completed_per_student'] = 0;
124
-				$array[$i]['total_time_spent'] = 0;
125
-				$array[$i]['average_time_spent_per_student'] = 0;
126
-				$array[$i]['total_time_spent'] = 0;
127
-				$array[$i]['average_time_spent_per_student'] = 0;
128
-				//$array[$i]['tools_used'] = 0;
129
-				$array[$i]['learnpath_docs'] = 0;
130
-				$array[$i]['learnpath_exercises'] = 0;
131
-				$array[$i]['learnpath_links'] = 0;
132
-				$array[$i]['learnpath_forums'] = 0;
133
-				$array[$i]['learnpath_assignments'] = 0;
134
-
135
-				//registering the number of each category of
136
-				//items in learning path
137
-				$sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi
60
+        $rs_lp 	= Database::query($sql_lp);
61
+        $t_lpi 	= Database :: get_course_table(TABLE_LP_ITEM);
62
+        $t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT);
63
+
64
+        $total_tools_list = Tracking::get_tools_most_used_by_course(
65
+            $course_id,
66
+            $session_id
67
+        );
68
+
69
+        $total_tools = 0;
70
+        foreach($total_tools_list as $tool) {
71
+            $total_tools += $tool['count_access_tool'];
72
+        }
73
+
74
+        if (Database :: num_rows($rs_lp) > 0) {
75
+            while ($learnpath = Database :: fetch_array($rs_lp)) {
76
+                $lp_id = $learnpath['id'];
77
+
78
+                $lp_items =
79
+                $array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$course_code.'&amp;action=view&amp;lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>';
80
+
81
+                $array[$i]['teachers'] = '';
82
+                if (!empty($teacher_list)) {
83
+                    $array[$i]['teachers'] = implode(', ', $teacher_list);
84
+                }
85
+
86
+                $array[$i]['course_name'] = $course['title'];
87
+                $count_students_accessing = 0;
88
+                $count_students_complete_all_activities = 0;
89
+                $count_students_complete_all_activities_at_50 = 0;
90
+                $total_time_spent = 0;
91
+                $total_average_progress = 0;
92
+
93
+                if (!empty($students)) {
94
+                    foreach ($students  as $student_id) {
95
+                        $avg_student_progress   = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
96
+                        $myavg_temp 			= Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id);
97
+                        $avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id);
98
+
99
+                        if (intval($avg_progress_in_course) == 100) {
100
+                            $count_students_complete_all_activities++;
101
+                        }
102
+                        if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) {
103
+                            $count_students_complete_all_activities_at_50 ++;
104
+                        }
105
+                        $total_average_progress +=$avg_progress_in_course;
106
+
107
+                        $time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id);
108
+                        $total_time_spent += $time_spent;
109
+                        if (!empty($time_spent)) {
110
+                            $count_students_accessing++;
111
+                        }
112
+                    }
113
+                    //$total_tools += $nb_assignments +  $messages + $links + $chat_last_connection + $documents;
114
+                }
115
+
116
+                $student_count = count($students);
117
+
118
+                $array[$i]['count_students'] = $student_count;
119
+                $array[$i]['count_students_accessing'] = 0;
120
+                $array[$i]['count_students_accessing_percentage'] = 0;
121
+                $array[$i]['count_students_complete_all_activities_at_50'] = 0;
122
+                $array[$i]['count_students_complete_all_activities'] = 0;
123
+                $array[$i]['average_percentage_activities_completed_per_student'] = 0;
124
+                $array[$i]['total_time_spent'] = 0;
125
+                $array[$i]['average_time_spent_per_student'] = 0;
126
+                $array[$i]['total_time_spent'] = 0;
127
+                $array[$i]['average_time_spent_per_student'] = 0;
128
+                //$array[$i]['tools_used'] = 0;
129
+                $array[$i]['learnpath_docs'] = 0;
130
+                $array[$i]['learnpath_exercises'] = 0;
131
+                $array[$i]['learnpath_links'] = 0;
132
+                $array[$i]['learnpath_forums'] = 0;
133
+                $array[$i]['learnpath_assignments'] = 0;
134
+
135
+                //registering the number of each category of
136
+                //items in learning path
137
+                $sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi
138 138
 						    WHERE c_id = $course_id AND lpi.lp_id = $lp_id
139 139
 						    ORDER BY item_type";
140
-				$res_lpi = Database::query($sql_lpi);
141
-				while ($row_lpi = Database::fetch_array($res_lpi)) {
142
-					switch($row_lpi['item_type']) {
143
-						case 'document':
144
-							$array[$i]['learnpath_docs']++;
145
-							break;
146
-						case 'quiz':
147
-							$array[$i]['learnpath_exercises']++;
148
-							break;
149
-						case 'link':
150
-							$array[$i]['learnpath_links']++;
151
-							break;
152
-						case 'forum':
153
-						case 'thread':
154
-							$array[$i]['learnpath_forums']++;
155
-							break;
156
-						case 'student_publication':
157
-							$array[$i]['learnpath_assignments']++;
158
-							break;
159
-					}
160
-				}
161
-				// Count announcements
162
-				$array[$i]['total_announcements'] = 0;
163
-				$sql_news = "SELECT count(id) FROM $t_news WHERE c_id = $course_id ";
164
-				$res_news = Database::query($sql_news);
165
-				while ($row_news = Database::fetch_array($res_news)) {
166
-					$array[$i]['total_announcements'] = $row_news[0];
167
-				}
168
-
169
-				//@todo don't know what means this value
170
-				$count_students_complete_all_activities_at_50 = 0;
171
-
172
-				if (!empty($student_count)) {
173
-					$array[$i]['count_students_accessing'] = $count_students_accessing;
174
-					$array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0);
175
-					$array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities;
176
-					$array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);;
177
-					$array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2);
178
-					$array[$i]['total_time_spent'] = 0;
179
-					$array[$i]['average_time_spent_per_student'] = 0;
180
-
181
-					if (!empty($total_time_spent)) {
182
-						$array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent);
183
-						$array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count);
184
-					}
185
-					//$array[$i]['tools_used'] = $total_tools;
186
-				}
187
-				$i++;
188
-			}
189
-		}
190
-	}
140
+                $res_lpi = Database::query($sql_lpi);
141
+                while ($row_lpi = Database::fetch_array($res_lpi)) {
142
+                    switch($row_lpi['item_type']) {
143
+                        case 'document':
144
+                            $array[$i]['learnpath_docs']++;
145
+                            break;
146
+                        case 'quiz':
147
+                            $array[$i]['learnpath_exercises']++;
148
+                            break;
149
+                        case 'link':
150
+                            $array[$i]['learnpath_links']++;
151
+                            break;
152
+                        case 'forum':
153
+                        case 'thread':
154
+                            $array[$i]['learnpath_forums']++;
155
+                            break;
156
+                        case 'student_publication':
157
+                            $array[$i]['learnpath_assignments']++;
158
+                            break;
159
+                    }
160
+                }
161
+                // Count announcements
162
+                $array[$i]['total_announcements'] = 0;
163
+                $sql_news = "SELECT count(id) FROM $t_news WHERE c_id = $course_id ";
164
+                $res_news = Database::query($sql_news);
165
+                while ($row_news = Database::fetch_array($res_news)) {
166
+                    $array[$i]['total_announcements'] = $row_news[0];
167
+                }
168
+
169
+                //@todo don't know what means this value
170
+                $count_students_complete_all_activities_at_50 = 0;
171
+
172
+                if (!empty($student_count)) {
173
+                    $array[$i]['count_students_accessing'] = $count_students_accessing;
174
+                    $array[$i]['count_students_accessing_percentage'] = round($count_students_accessing / $student_count *100 , 0);
175
+                    $array[$i]['count_students_complete_all_activities_at_50'] = $count_students_complete_all_activities;
176
+                    $array[$i]['count_students_complete_all_activities'] = round($count_students_complete_all_activities / $student_count *100 , 0);;
177
+                    $array[$i]['average_percentage_activities_completed_per_student'] = round($count_students_complete_all_activities/$student_count*100,2);
178
+                    $array[$i]['total_time_spent'] = 0;
179
+                    $array[$i]['average_time_spent_per_student'] = 0;
180
+
181
+                    if (!empty($total_time_spent)) {
182
+                        $array[$i]['total_time_spent'] = api_time_to_hms($total_time_spent);
183
+                        $array[$i]['average_time_spent_per_student'] = api_time_to_hms($total_time_spent / $student_count);
184
+                    }
185
+                    //$array[$i]['tools_used'] = $total_tools;
186
+                }
187
+                $i++;
188
+            }
189
+        }
190
+    }
191 191
 }
192 192
 
193 193
 $headers = array(
194
-	get_lang('LearningPath'),
195
-	get_lang('Teachers'),
196
-	get_lang('Courses'),
197
-	get_lang('NumberOfStudents'),
198
-	get_lang('NumberStudentsAccessingCourse'),
199
-	get_lang('PercentageStudentsAccessingCourse'),
200
-	get_lang('NumberStudentsCompleteAllActivities'),
201
-	get_lang('PercentageStudentsCompleteAllActivities'),
202
-	get_lang('AverageOfActivitiesCompletedPerStudent'),
203
-	get_lang('TotalTimeSpentInTheCourse'),
204
-	get_lang('AverageTimePerStudentInCourse'),
205
-	get_lang('NumberOfDocumentsInLearnpath'),
206
-	get_lang('NumberOfExercisesInLearnpath'),
207
-	get_lang('NumberOfLinksInLearnpath'),
208
-	get_lang('NumberOfForumsInLearnpath'),
209
-	get_lang('NumberOfAssignmentsInLearnpath'),
210
-	get_lang('NumberOfAnnouncementsInCourse'),
194
+    get_lang('LearningPath'),
195
+    get_lang('Teachers'),
196
+    get_lang('Courses'),
197
+    get_lang('NumberOfStudents'),
198
+    get_lang('NumberStudentsAccessingCourse'),
199
+    get_lang('PercentageStudentsAccessingCourse'),
200
+    get_lang('NumberStudentsCompleteAllActivities'),
201
+    get_lang('PercentageStudentsCompleteAllActivities'),
202
+    get_lang('AverageOfActivitiesCompletedPerStudent'),
203
+    get_lang('TotalTimeSpentInTheCourse'),
204
+    get_lang('AverageTimePerStudentInCourse'),
205
+    get_lang('NumberOfDocumentsInLearnpath'),
206
+    get_lang('NumberOfExercisesInLearnpath'),
207
+    get_lang('NumberOfLinksInLearnpath'),
208
+    get_lang('NumberOfForumsInLearnpath'),
209
+    get_lang('NumberOfAssignmentsInLearnpath'),
210
+    get_lang('NumberOfAnnouncementsInCourse'),
211 211
 );
212 212
 
213 213
 if (isset($_GET['export'])) {
214
-	global $charset;
214
+    global $charset;
215 215
     $spreadsheet = new PHPExcel();
216 216
     $spreadsheet->setActiveSheetIndex(0);
217 217
     $worksheet = $spreadsheet->getActiveSheet();
218 218
 
219
-	$line = 0;
220
-	$column = 0; //skip the first column (row titles)
221
-
222
-	foreach ($headers as $header) {
223
-		$worksheet->SetCellValueByColumnAndRow($line, $column, $header);
224
-		$column++;
225
-	}
226
-	$line++;
227
-	foreach ($array as $row) {
228
-		$column = 0;
229
-		foreach ($row as $item) {
230
-			$worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($item)));
231
-			$column++;
232
-		}
233
-		$line++;
234
-	}
235
-	$line++;
219
+    $line = 0;
220
+    $column = 0; //skip the first column (row titles)
221
+
222
+    foreach ($headers as $header) {
223
+        $worksheet->SetCellValueByColumnAndRow($line, $column, $header);
224
+        $column++;
225
+    }
226
+    $line++;
227
+    foreach ($array as $row) {
228
+        $column = 0;
229
+        foreach ($row as $item) {
230
+            $worksheet->SetCellValueByColumnAndRow($line, $column, html_entity_decode(strip_tags($item)));
231
+            $column++;
232
+        }
233
+        $line++;
234
+    }
235
+    $line++;
236 236
 
237 237
     $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename);
238 238
     $writer = new PHPExcel_Writer_Excel2007($spreadsheet);
239 239
     $writer->save($file);
240 240
     DocumentManager::file_send_for_download($file, true, $filename);
241
-	exit;
241
+    exit;
242 242
 }
243 243
 
244 244
 $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
@@ -249,20 +249,20 @@  discard block
 block discarded – undo
249 249
 $row = 0;
250 250
 $column = 0;
251 251
 foreach ($headers as $header) {
252
-	$table->setHeaderContents($row, $column, $header);
253
-	$column++;
252
+    $table->setHeaderContents($row, $column, $header);
253
+    $column++;
254 254
 }
255 255
 $row++;
256 256
 
257 257
 foreach ($array as $row_table) {
258
-	$column = 0;
259
-	foreach ($row_table as $cell) {
260
-		$table->setCellContents($row, $column, $cell);
261
-		//$table->updateCellAttributes($row, $column, 'align="center"');
262
-		$column++;
263
-	}
264
-	$table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
265
-	$row++;
258
+    $column = 0;
259
+    foreach ($row_table as $cell) {
260
+        $table->setCellContents($row, $column, $cell);
261
+        //$table->updateCellAttributes($row, $column, 'align="center"');
262
+        $column++;
263
+    }
264
+    $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
265
+    $row++;
266 266
 }
267 267
 
268 268
 echo '<div class="actions">';
Please login to merge, or discard this patch.
main/mySpace/user_edit.php 2 patches
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -113,23 +113,23 @@  discard block
 block discarded – undo
113 113
 $form->addGroup($html_results_enabled);
114 114
 // Validate form
115 115
 if ($form->validate()) {
116
-	$check = Security::check_token('post');
117
-	if ($check) {
118
-		$user = $form->exportValues();
119
-		$email = $userInfo['email'];
116
+    $check = Security::check_token('post');
117
+    if ($check) {
118
+        $user = $form->exportValues();
119
+        $email = $userInfo['email'];
120 120
         $username = $userInfo['username'];
121
-		$send_mail = intval($user['mail']['send_mail']);
121
+        $send_mail = intval($user['mail']['send_mail']);
122 122
         $auth_source = PLATFORM_AUTH_SOURCE;
123 123
 
124 124
         $resetPassword = $user['password']['password_auto'] == '1' ? 0 : 2;
125 125
 
126
-		if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') {
127
-			//$auth_source = $user['password']['auth_source'];
128
-			//$password = 'PLACEHOLDER';
129
-		} else {
130
-			//$auth_source = PLATFORM_AUTH_SOURCE;
131
-			//$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
132
-		}
126
+        if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') {
127
+            //$auth_source = $user['password']['auth_source'];
128
+            //$password = 'PLACEHOLDER';
129
+        } else {
130
+            //$auth_source = PLATFORM_AUTH_SOURCE;
131
+            //$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
132
+        }
133 133
 
134 134
         $auth_source = $userInfo['auth_source'];
135 135
         $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
             $resetPassword
158 158
         );
159 159
 
160
-		if (!empty($email) && $send_mail) {
161
-			$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
162
-			$portal_url = api_get_path(WEB_PATH);
163
-			if (api_is_multiple_url_enabled()) {
164
-				$access_url_id = api_get_current_access_url_id();
165
-				if ($access_url_id != -1) {
166
-					$url = api_get_access_url($access_url_id);
167
-					$portal_url = $url['url'];
168
-				}
169
-			}
170
-
171
-			$emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n".
160
+        if (!empty($email) && $send_mail) {
161
+            $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
162
+            $portal_url = api_get_path(WEB_PATH);
163
+            if (api_is_multiple_url_enabled()) {
164
+                $access_url_id = api_get_current_access_url_id();
165
+                if ($access_url_id != -1) {
166
+                    $url = api_get_access_url($access_url_id);
167
+                    $portal_url = $url['url'];
168
+                }
169
+            }
170
+
171
+            $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n".
172 172
                 get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".
173 173
                 get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .
174 174
                 get_lang('Address') ." ". api_get_setting('siteName') ." ".
@@ -181,26 +181,26 @@  discard block
 block discarded – undo
181 181
                 api_get_setting('administratorTelephone')."\n" .
182 182
                 get_lang('Email') ." : ".api_get_setting('emailAdministrator');
183 183
 
184
-			api_mail_html(
184
+            api_mail_html(
185 185
                 api_get_person_name($userInfo['firstname'], $userInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS),
186 186
                 $email,
187 187
                 $emailsubject,
188 188
                 $emailbody
189 189
             );
190
-		}
190
+        }
191 191
 
192
-		Security::clear_token();
192
+        Security::clear_token();
193 193
         $tok = Security::get_token();
194 194
         header('Location: '.$url.'&message=1');
195 195
         exit();
196
-	}
196
+    }
197 197
 } else {
198
-	if (isset($_POST['submit'])) {
199
-		Security::clear_token();
200
-	}
201
-	$token = Security::get_token();
202
-	$form->addElement('hidden', 'sec_token');
203
-	$form->setConstants(array('sec_token' => $token));
198
+    if (isset($_POST['submit'])) {
199
+        Security::clear_token();
200
+    }
201
+    $token = Security::get_token();
202
+    $form->addElement('hidden', 'sec_token');
203
+    $form->setConstants(array('sec_token' => $token));
204 204
 }
205 205
 
206 206
 $interbreadcrumb[] = array(
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 Display::display_header($tool_name);
213 213
 
214 214
 if (isset($_REQUEST['message'])) {
215
-	Display::display_normal_message(get_lang('Updated'));
215
+    Display::display_normal_message(get_lang('Updated'));
216 216
 }
217 217
 $form->display();
218 218
 
Please login to merge, or discard this patch.
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
 	$group[] =& $form->createElement('select', 'auth_source', null, $auth_sources);
90 90
 	$group[] =& $form->createElement('static', '', '', '<br />');
91 91
 }*/
92
-$group[] =& $form->createElement('radio', 'password_auto', get_lang('Password'), get_lang('AutoGeneratePassword').'<br />', 1);
93
-$group[] =& $form->createElement('radio', 'password_auto', 'id="radio_user_password"', null, 0);
94
-$group[] =& $form->createElement('password', 'password', null, array('onkeydown' => 'javascript: password_switch_radio_button(document.user_add,"password[password_auto]");'));
92
+$group[] = & $form->createElement('radio', 'password_auto', get_lang('Password'), get_lang('AutoGeneratePassword').'<br />', 1);
93
+$group[] = & $form->createElement('radio', 'password_auto', 'id="radio_user_password"', null, 0);
94
+$group[] = & $form->createElement('password', 'password', null, array('onkeydown' => 'javascript: password_switch_radio_button(document.user_add,"password[password_auto]");'));
95 95
 $form->addGroup($group, 'password', get_lang('Password'), '');
96 96
 
97 97
 // Send email
98 98
 $group = array();
99
-$group[] =& $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
100
-$group[] =& $form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
99
+$group[] = & $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1);
100
+$group[] = & $form->createElement('radio', 'send_mail', null, get_lang('No'), 0);
101 101
 $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), '&nbsp;');
102 102
 
103 103
 // Set default values
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 
109 109
 $form->setDefaults($defaults);
110 110
 // Submit button
111
-$select_level = array ();
111
+$select_level = array();
112 112
 $html_results_enabled[] = $form->addButtonUpdate(get_lang('Update'), 'submit', true);
113 113
 $form->addGroup($html_results_enabled);
114 114
 // Validate form
@@ -169,17 +169,17 @@  discard block
 block discarded – undo
169 169
 			}
170 170
 
171 171
 			$emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n".
172
-                get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".
173
-                get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .
174
-                get_lang('Address') ." ". api_get_setting('siteName') ." ".
175
-                get_lang('Is') ." : ".$portal_url."\n\n".
176
-                get_lang('Problem'). "\n\n".
172
+                get_lang('YouAreReg')." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings')."\n\n".
173
+                get_lang('Username')." : ".$username."\n".get_lang('Pass')." : ".stripslashes($password)."\n\n".
174
+                get_lang('Address')." ".api_get_setting('siteName')." ".
175
+                get_lang('Is')." : ".$portal_url."\n\n".
176
+                get_lang('Problem')."\n\n".
177 177
                 get_lang('SignatureFormula').",\n\n".
178 178
                 api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n".
179
-                get_lang('Manager'). " ".
179
+                get_lang('Manager')." ".
180 180
                 api_get_setting('siteName')."\nT. ".
181
-                api_get_setting('administratorTelephone')."\n" .
182
-                get_lang('Email') ." : ".api_get_setting('emailAdministrator');
181
+                api_get_setting('administratorTelephone')."\n".
182
+                get_lang('Email')." : ".api_get_setting('emailAdministrator');
183 183
 
184 184
 			api_mail_html(
185 185
                 api_get_person_name($userInfo['firstname'], $userInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS),
Please login to merge, or discard this patch.
main/mySpace/company_reports_resumed.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -89,15 +89,15 @@  discard block
 block discarded – undo
89 89
 if (api_is_student_boss()) {
90 90
     $actions .= Display::url(
91 91
         Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
92
-        api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"
92
+        api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
93 93
     );
94 94
     $actions .= Display::url(
95 95
         Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
96
-        api_get_path(WEB_CODE_PATH) . "mySpace/student.php"
96
+        api_get_path(WEB_CODE_PATH)."mySpace/student.php"
97 97
     );
98 98
     $actions .= Display::url(
99 99
         Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM),
100
-        api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php"
100
+        api_get_path(WEB_CODE_PATH)."mySpace/company_reports.php"
101 101
     );
102 102
     $actions .= Display::url(
103 103
         Display::return_icon(
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
             [],
107 107
             ICON_SIZE_MEDIUM
108 108
         ),
109
-        api_get_path(WEB_CODE_PATH) . "gradebook/certificate_report.php"
109
+        api_get_path(WEB_CODE_PATH)."gradebook/certificate_report.php"
110 110
     );
111 111
 }
112 112
 
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 if (!api_is_student_boss()) {
120 120
     $content .= Display::url(
121 121
         get_lang("CompanyReport"),
122
-        api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php",
122
+        api_get_path(WEB_CODE_PATH)."mySpace/company_reports.php",
123 123
         array(
124 124
             'class' => 'btn btn-success'
125 125
         )
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 }
128 128
 
129 129
 $content .= '</div>';
130
-$content .= '<h1 class="page-header">' . get_lang('CompanyReportResumed') . '</h1>';
130
+$content .= '<h1 class="page-header">'.get_lang('CompanyReportResumed').'</h1>';
131 131
 $content .= Display::grid_html('user_course_report');
132 132
 
133 133
 $tpl = new Template($tool_name);
Please login to merge, or discard this patch.
main/mySpace/session.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
 api_block_anonymous_users();
18 18
 $htmlHeadXtra[] = api_get_jqgrid_js();
19
-$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
19
+$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
20 20
 Display::display_header(get_lang('Sessions'));
21 21
 
22 22
 $export_csv = false;
@@ -118,10 +118,10 @@  discard block
 block discarded – undo
118 118
 // Column config
119 119
 $columnModel = array(
120 120
     array('name'=>'name', 'index'=>'name', 'width'=>'255', 'align'=>'left'),
121
-    array('name'=>'date', 'index'=>'date', 'width'=>'150', 'align'=>'left','sortable'=>'false'),
122
-    array('name'=>'course_per_session', 'index'=>'course_per_session', 'width'=>'150','sortable'=>'false'),
123
-    array('name'=>'student_per_session', 'index'=>'student_per_session', 'width'=>'100','sortable'=>'false'),
124
-    array('name'=>'details', 'index'=>'details', 'width'=>'100','sortable'=>'false')
121
+    array('name'=>'date', 'index'=>'date', 'width'=>'150', 'align'=>'left', 'sortable'=>'false'),
122
+    array('name'=>'course_per_session', 'index'=>'course_per_session', 'width'=>'150', 'sortable'=>'false'),
123
+    array('name'=>'student_per_session', 'index'=>'student_per_session', 'width'=>'100', 'sortable'=>'false'),
124
+    array('name'=>'details', 'index'=>'details', 'width'=>'100', 'sortable'=>'false')
125 125
 );
126 126
 
127 127
 $extraParams = array(
Please login to merge, or discard this patch.
main/mySpace/index.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 }
103 103
 
104 104
 if ($is_drh) {
105
-	$view = 'drh';
105
+    $view = 'drh';
106 106
     $menu_items[] = Display::url(Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), '#');
107 107
     $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.php');
108 108
     $menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php');
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         echo "</div><br />";
144 144
     }
145 145
 } else {
146
-	echo Display::url(
146
+    echo Display::url(
147 147
         Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),
148 148
         api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
149 149
     );
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
 
398 398
 // Send the csv file if asked
399 399
 if ($export_csv) {
400
-	ob_end_clean();
401
-	Export :: arrayToCsv($csv_content, 'reporting_index');
402
-	exit;
400
+    ob_end_clean();
401
+    Export :: arrayToCsv($csv_content, 'reporting_index');
402
+    exit;
403 403
 }
404 404
 
405 405
 if (!$export_csv) {
406
-	Display::display_footer();
406
+    Display::display_footer();
407 407
 }
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
 $session_id = isset($_GET['session_id']) ? intval($_GET['session_id']) : 0;
28 28
 
29 29
 $is_coach = api_is_coach($session_id);
30
-$is_platform_admin 	= api_is_platform_admin();
31
-$is_drh 			= api_is_drh();
32
-$is_session_admin 	= api_is_session_admin();
30
+$is_platform_admin = api_is_platform_admin();
31
+$is_drh = api_is_drh();
32
+$is_session_admin = api_is_session_admin();
33 33
 
34
-$count_sessions 	= 0;
35
-$count_courses		= 0;
36
-$title 				= null;
34
+$count_sessions = 0;
35
+$count_courses = 0;
36
+$title = null;
37 37
 
38 38
 // Access control
39 39
 api_block_anonymous_users();
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 echo '</span>';
125 125
 
126 126
 if (!empty($session_id) &&
127
-    !in_array($display, array('accessoverview','lpprogressoverview','progressoverview','exerciseprogress', 'surveyoverview'))
127
+    !in_array($display, array('accessoverview', 'lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview'))
128 128
 ) {
129 129
     echo '<a href="index.php">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
130 130
     if (!api_is_platform_admin()) {
@@ -144,19 +144,19 @@  discard block
 block discarded – undo
144 144
     }
145 145
 } else {
146 146
 	echo Display::url(
147
-        Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),
147
+        Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
148 148
         api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
149 149
     );
150 150
     echo Display::url(
151 151
         Display::return_icon("certificate_list.png", get_lang("GradebookSeeListOfStudentsCertificates"), array(), ICON_SIZE_MEDIUM),
152
-        api_get_path(WEB_CODE_PATH) . "gradebook/certificate_report.php"
152
+        api_get_path(WEB_CODE_PATH)."gradebook/certificate_report.php"
153 153
     );
154 154
 }
155 155
 
156 156
 // Actions menu
157 157
 $nb_menu_items = count($menu_items);
158 158
 if (empty($session_id) ||
159
-    in_array($display, array('accessoverview','lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview'))
159
+    in_array($display, array('accessoverview', 'lpprogressoverview', 'progressoverview', 'exerciseprogress', 'surveyoverview'))
160 160
 ) {
161 161
     if ($nb_menu_items > 1) {
162 162
         foreach ($menu_items as $key => $item) {
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
 
168 168
 echo '</div>';
169 169
 
170
-$userId  = api_get_user_id();
170
+$userId = api_get_user_id();
171 171
 $stats = Tracking::getStats($userId);
172 172
 
173 173
 $students = $stats['students'];
@@ -207,7 +207,7 @@  discard block
 block discarded – undo
207 207
 if (!empty($students)) {
208 208
     // Students
209 209
     $nb_students = count($students);
210
-    $progress  = Tracking::get_avg_student_progress($studentIds);
210
+    $progress = Tracking::get_avg_student_progress($studentIds);
211 211
     $countAssignments = Tracking::count_student_assignments($studentIds);
212 212
     $studentIds = array_values($students);
213 213
     $countHumanResourcesUsers = count($humanResourcesUsers);
Please login to merge, or discard this patch.
main/mySpace/progression.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -16,14 +16,14 @@
 block discarded – undo
16 16
 $this_section = SECTION_TRACKING;
17 17
 
18 18
 api_block_anonymous_users();
19
-$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
19
+$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
20 20
 Display :: display_header($nameTools);
21 21
 
22 22
 // Database Table Definitions
23
-$tbl_course 		= Database :: get_main_table(TABLE_MAIN_COURSE);
24
-$tbl_user 			= Database :: get_main_table(TABLE_MAIN_USER);
23
+$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
24
+$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
25 25
 $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
26
-$tbl_session 		= Database :: get_main_table(TABLE_MAIN_SESSION);
26
+$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
27 27
 $tbl_track_exercice = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
28 28
 
29 29
 /*
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -33,36 +33,36 @@
 block discarded – undo
33 33
 $result_course = Database::query($sql_course);
34 34
 
35 35
 if (Database::num_rows($result_course) > 0) {
36
-	if (isset($_POST['export'])) {
37
-		$export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet.
38
-		Display :: display_error_message($export_result);
39
-	}
40
-	echo '<table class="data_table"><tr><th>'.get_lang('Course').'</th><th>'.get_lang('TempsFrequentation').'</th><th>'.get_lang('Progression').'</th><th>'.get_lang('MoyenneTest').'</th></tr>';
41
-	$header = array(get_lang('Course', ''), get_lang('TempsFrequentation', ''), get_lang('Progression', ''), get_lang('MoyenneTest', ''));
42
-	while ($a_course = Database::fetch_array($result_course)) {
43
-		// TODO: This query is to be checked, there are no HotPotatoes tests results.
44
-		$sql_moy_test = "SELECT exe_result,exe_weighting
36
+    if (isset($_POST['export'])) {
37
+        $export_result = export_csv($header, $data, 'test.csv'); // TODO: There is no data for exporting yet.
38
+        Display :: display_error_message($export_result);
39
+    }
40
+    echo '<table class="data_table"><tr><th>'.get_lang('Course').'</th><th>'.get_lang('TempsFrequentation').'</th><th>'.get_lang('Progression').'</th><th>'.get_lang('MoyenneTest').'</th></tr>';
41
+    $header = array(get_lang('Course', ''), get_lang('TempsFrequentation', ''), get_lang('Progression', ''), get_lang('MoyenneTest', ''));
42
+    while ($a_course = Database::fetch_array($result_course)) {
43
+        // TODO: This query is to be checked, there are no HotPotatoes tests results.
44
+        $sql_moy_test = "SELECT exe_result,exe_weighting
45 45
 			FROM $tbl_track_exercice
46 46
 			WHERE c_id = ".$a_course['id'];
47
-		$result_moy_test = Database::query($sql_moy_test);
48
-		$result = 0;
49
-		$weighting = 0;
50
-		while ($moy_test = Database::fetch_array($result_moy_test)) {
51
-			$result = $result + $moy_test['exe_result'];
52
-			$weighting = $weighting + $moy_test['exe_weighting'];
53
-		}
54
-		if ($weighting != 0) {
55
-			$moyenne_test = round(($result * 100) / $weighting);
56
-		} else {
57
-			$moyenne_test = null;
58
-		}
59
-		echo '<tr><td>'.$a_course['title'].'</td><td> </td><td> </td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td> </tr>';
60
-	}
61
-	echo '</table>';
62
-	echo "<br /><br />";
63
-	echo "<form method='post'><input type='submit' name='export' value='".get_lang('ExportExcel')."'/><form>";
47
+        $result_moy_test = Database::query($sql_moy_test);
48
+        $result = 0;
49
+        $weighting = 0;
50
+        while ($moy_test = Database::fetch_array($result_moy_test)) {
51
+            $result = $result + $moy_test['exe_result'];
52
+            $weighting = $weighting + $moy_test['exe_weighting'];
53
+        }
54
+        if ($weighting != 0) {
55
+            $moyenne_test = round(($result * 100) / $weighting);
56
+        } else {
57
+            $moyenne_test = null;
58
+        }
59
+        echo '<tr><td>'.$a_course['title'].'</td><td> </td><td> </td><td>'.(is_null($moyenne_test) ? '' : $moyenne_test.'%').'</td> </tr>';
60
+    }
61
+    echo '</table>';
62
+    echo "<br /><br />";
63
+    echo "<form method='post'><input type='submit' name='export' value='".get_lang('ExportExcel')."'/><form>";
64 64
 } else {
65
-	echo get_lang('NoCourse');
65
+    echo get_lang('NoCourse');
66 66
 }
67 67
 
68 68
 Display :: display_footer();
Please login to merge, or discard this patch.
main/mySpace/users.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,14 +20,14 @@  discard block
 block discarded – undo
20 20
 
21 21
 $this_section = SECTION_TRACKING;
22 22
 
23
-$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
23
+$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
24 24
 
25 25
 if (isset($_GET["user_id"]) && $_GET["user_id"] != "" && !isset($_GET["type"])) {
26
-    $interbreadcrumb[] = array ("url" => "teachers.php", "name" => get_lang('Teachers'));
26
+    $interbreadcrumb[] = array("url" => "teachers.php", "name" => get_lang('Teachers'));
27 27
 }
28 28
 
29
-if (isset($_GET["user_id"]) && $_GET["user_id"]!="" && isset($_GET["type"]) && $_GET["type"] == "coach") {
30
-    $interbreadcrumb[] = array ("url" => "coaches.php", "name" => get_lang('Tutors'));
29
+if (isset($_GET["user_id"]) && $_GET["user_id"] != "" && isset($_GET["type"]) && $_GET["type"] == "coach") {
30
+    $interbreadcrumb[] = array("url" => "coaches.php", "name" => get_lang('Tutors'));
31 31
 }
32 32
 
33 33
 function get_count_users()
@@ -123,8 +123,8 @@  discard block
 block discarded – undo
123 123
                 $courseId = $courseInfo['real_id'];
124 124
 
125 125
                 if (CourseManager :: is_user_subscribed_in_course($student_id, $course_code, true)) {
126
-                    $avg_time_spent 	+= Tracking :: get_time_spent_on_the_course($student_id, $courseId, $_GET['id_session']);
127
-                    $my_average 		 = Tracking :: get_avg_student_score($student_id, $course_code);
126
+                    $avg_time_spent += Tracking :: get_time_spent_on_the_course($student_id, $courseId, $_GET['id_session']);
127
+                    $my_average = Tracking :: get_avg_student_score($student_id, $course_code);
128 128
                     if (is_numeric($my_average)) {
129 129
                         $avg_student_score += $my_average;
130 130
                     }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
             $detailsLink = '<a href="myStudents.php?student='.$student_id.'&id_coach='.$coach_id.'&id_session='.$_GET['id_session'].'">
164 164
 				            '.Display::return_icon('2rightarrow.png', get_lang('Details')).'</a>';
165 165
         } else {
166
-            $detailsLink =  '<a href="myStudents.php?student='.$student_id.'">
166
+            $detailsLink = '<a href="myStudents.php?student='.$student_id.'">
167 167
 				            '.Display::return_icon('2rightarrow.png', get_lang('Details')).'</a>';
168 168
         }
169 169
         $row[] = $detailsLink;
@@ -183,7 +183,7 @@  discard block
 block discarded – undo
183 183
 
184 184
 if (api_is_drh()) {
185 185
     $menu_items = array(
186
-        Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH)."auth/my_progress.php" ),
186
+        Display::url(Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), api_get_path(WEB_CODE_PATH)."auth/my_progress.php"),
187 187
         Display::url(Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), '#'),
188 188
         Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.php'),
189 189
         Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php'),
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 
201 201
 $actionsRight = Display::url(Display::return_icon('printer.png', get_lang('Print'), array(), ICON_SIZE_MEDIUM), 'javascript: void(0);', array('onclick'=>'javascript: window.print();'));
202 202
 $actionsRight .= Display::url(Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), array(), ICON_SIZE_MEDIUM), api_get_self().'?export=csv&keyword='.$keyword);
203
-$toolbar = Display::toolbarAction('toolbar-user', $content = array( 0 => $actionsLeft, 1 => $actionsRight ));
203
+$toolbar = Display::toolbarAction('toolbar-user', $content = array(0 => $actionsLeft, 1 => $actionsRight));
204 204
 
205 205
 $table = new SortableTable(
206 206
     'tracking_student',
@@ -232,14 +232,14 @@  discard block
 block discarded – undo
232 232
 
233 233
 if ($export_csv) {
234 234
     if ($is_western_name_order) {
235
-        $csv_header[] = array (
235
+        $csv_header[] = array(
236 236
             get_lang('FirstName'),
237 237
             get_lang('LastName'),
238 238
             get_lang('FirstLogin'),
239 239
             get_lang('LastConnexion')
240 240
         );
241 241
     } else {
242
-        $csv_header[] = array (
242
+        $csv_header[] = array(
243 243
             get_lang('LastName'),
244 244
             get_lang('FirstName'),
245 245
             get_lang('FirstLogin'),
Please login to merge, or discard this patch.
main/mySpace/admin_view.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 
6 6
 require_once '../inc/global.inc.php';
7 7
 
8
-$exportCSV  = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
9
-$display 	 = isset($_GET['display']) ? Security::remove_XSS($_GET['display']) : null;
8
+$exportCSV = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false;
9
+$display = isset($_GET['display']) ? Security::remove_XSS($_GET['display']) : null;
10 10
 
11 11
 $htmlHeadXtra[] = api_get_jqgrid_js();
12 12
 // the section (for the tabs)
@@ -15,9 +15,9 @@  discard block
 block discarded – undo
15 15
 $csv_content = array();
16 16
 $nameTools = get_lang('MySpace');
17 17
 
18
-$is_platform_admin 	= api_is_platform_admin();
18
+$is_platform_admin = api_is_platform_admin();
19 19
 $is_drh 			= api_is_drh();
20
-$is_session_admin 	= api_is_session_admin();
20
+$is_session_admin = api_is_session_admin();
21 21
 
22 22
 if ($exportCSV) {
23 23
     if ($display == 'user') {
Please login to merge, or discard this patch.
main/mySpace/company_reports.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
     api_not_allowed(true);
17 17
 }
18 18
 
19
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
19
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('MySpace'));
20 20
 $tool_name = get_lang('Report');
21 21
 
22 22
 $this_section = SECTION_TRACKING;
@@ -42,13 +42,13 @@  discard block
 block discarded – undo
42 42
 
43 43
 //Column config
44 44
 $column_model = array(
45
-    array('name'=>'course',         'index'=>'title',       'width'=>'180', 'align'=>'left', 'wrap_cell' => 'true'),
46
-    array('name'=>'user',           'index'=>'user',        'width'=>'100', 'align'=>'left','sortable'=>'false', 'wrap_cell' => 'true'),
47
-    array('name'=>'email',          'index'=>'email',       'width'=>'100', 'align'=>'left','sortable'=>'false', 'wrap_cell' => 'true'),
48
-    array('name'=>'time',           'index'=>'time',        'width'=>'50',  'align'=>'left','sortable'=>'false'),
49
-    array('name'=>'certificate',    'index'=>'certificate', 'width'=>'50',  'align'=>'left','sortable'=>'false'),
50
-    array('name'=>'progress_100',   'index'=>'progress_100',       'width'=>'50',  'align'=>'left','sortable'=>'false'),
51
-    array('name'=>'progress',       'index'=>'progress',    'width'=>'50',  'align'=>'left','sortable'=>'false')
45
+    array('name'=>'course', 'index'=>'title', 'width'=>'180', 'align'=>'left', 'wrap_cell' => 'true'),
46
+    array('name'=>'user', 'index'=>'user', 'width'=>'100', 'align'=>'left', 'sortable'=>'false', 'wrap_cell' => 'true'),
47
+    array('name'=>'email', 'index'=>'email', 'width'=>'100', 'align'=>'left', 'sortable'=>'false', 'wrap_cell' => 'true'),
48
+    array('name'=>'time', 'index'=>'time', 'width'=>'50', 'align'=>'left', 'sortable'=>'false'),
49
+    array('name'=>'certificate', 'index'=>'certificate', 'width'=>'50', 'align'=>'left', 'sortable'=>'false'),
50
+    array('name'=>'progress_100', 'index'=>'progress_100', 'width'=>'50', 'align'=>'left', 'sortable'=>'false'),
51
+    array('name'=>'progress', 'index'=>'progress', 'width'=>'50', 'align'=>'left', 'sortable'=>'false')
52 52
 );
53 53
 
54 54
 if (!empty($extra_fields)) {
@@ -67,7 +67,7 @@  discard block
 block discarded – undo
67 67
 }
68 68
 
69 69
 if (api_is_student_boss()) {
70
-    $column_model[] = array('name'=>'group', 'index'=>'group', 'width'=>'50', 'align'=>'left','sortable'=>'false');
70
+    $column_model[] = array('name'=>'group', 'index'=>'group', 'width'=>'50', 'align'=>'left', 'sortable'=>'false');
71 71
     $columns[] = get_lang('Group');
72 72
 }
73 73
 
@@ -78,7 +78,7 @@  discard block
 block discarded – undo
78 78
 
79 79
 $htmlHeadXtra[] = '<script>
80 80
 $(function() {
81
-    '.Display::grid_js('user_course_report',  $url, $columns, $column_model, $extra_params, array(), null, true).'
81
+    '.Display::grid_js('user_course_report', $url, $columns, $column_model, $extra_params, array(), null, true).'
82 82
     jQuery("#user_course_report").jqGrid("navGrid","#user_course_report_pager",{
83 83
         view:false,
84 84
         edit:false,
@@ -102,11 +102,11 @@  discard block
 block discarded – undo
102 102
 if (api_is_student_boss()) {
103 103
     $actions .= Display::url(
104 104
         Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
105
-        api_get_path(WEB_CODE_PATH) . "auth/my_progress.php"
105
+        api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
106 106
     );
107 107
     $actions .= Display::url(
108 108
         Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM),
109
-        api_get_path(WEB_CODE_PATH) . "mySpace/student.php"
109
+        api_get_path(WEB_CODE_PATH)."mySpace/student.php"
110 110
     );
111 111
     $actions .= Display::url(
112 112
         Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM),
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
             [],
120 120
             ICON_SIZE_MEDIUM
121 121
         ),
122
-        api_get_path(WEB_CODE_PATH) . "gradebook/certificate_report.php"
122
+        api_get_path(WEB_CODE_PATH)."gradebook/certificate_report.php"
123 123
     );
124 124
 }
125 125
 
@@ -130,13 +130,13 @@  discard block
 block discarded – undo
130 130
 }
131 131
 $content .= Display::url(
132 132
     get_lang("CompanyReportResumed"),
133
-    api_get_path(WEB_CODE_PATH) . "mySpace/company_reports_resumed.php",
133
+    api_get_path(WEB_CODE_PATH)."mySpace/company_reports_resumed.php",
134 134
     array(
135 135
         'class' => 'btn btn-success'
136 136
     )
137 137
 );
138 138
 $content .= '</div>';
139
-$content .= '<h1 class="page-header">' . get_lang('CompanyReport') . '</h1>';
139
+$content .= '<h1 class="page-header">'.get_lang('CompanyReport').'</h1>';
140 140
 $content .= Display::grid_html('user_course_report');
141 141
 
142 142
 $tpl = new Template($tool_name);
Please login to merge, or discard this patch.