Passed
Push — 1.10.x ( 5654d2...115d5a )
by Yannick
263:14 queued 212:07
created
main/mySpace/current_courses.php 1 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/progression.php 1 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/cron/document/index_all_docs.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -1,16 +1,16 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Script to find a document with a specific title or path in all courses
4
- */
3
+     * Script to find a document with a specific title or path in all courses
4
+     */
5 5
 /**
6
- * Code init - comment die() call to enable
7
- */
6
+     * Code init - comment die() call to enable
7
+     */
8 8
 die();
9 9
 require '../../inc/global.inc.php';
10 10
 if (empty($_GET['doc'])) {
11
-  echo "To add a document name to search, add ?doc=abc to the URL\n";
11
+    echo "To add a document name to search, add ?doc=abc to the URL\n";
12 12
 } else {
13
-  echo "Received param ".$_GET['doc']."<br />\n";
13
+    echo "Received param ".$_GET['doc']."<br />\n";
14 14
 }
15 15
 $allowed_mime_types = DocumentManager::file_get_mime_type(true);
16 16
 $allowed_extensions = array(
@@ -40,30 +40,30 @@  discard block
 block discarded – undo
40 40
 $specific_fields = get_specific_field_list();
41 41
 $specific_fields_values = array();
42 42
 foreach ($specific_fields as $sf) {
43
-	$specific_fields_values[$sf['code']] = '';
43
+    $specific_fields_values[$sf['code']] = '';
44 44
 }
45 45
 $td = Database::get_course_table(TABLE_DOCUMENT);
46 46
 
47 47
 foreach ($courses_list as $course) {
48
-  $course_dir = $course['directory'].'/document';
49
-  $title = Database::escape_string($_GET['doc']);
50
-  $sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'";
51
-  $res = Database::query($sql);
52
-  if (Database::num_rows($res)>0) {
48
+    $course_dir = $course['directory'].'/document';
49
+    $title = Database::escape_string($_GET['doc']);
50
+    $sql = "SELECT id, path, session_id FROM $td WHERE c_id = ".$course['id']." AND path LIKE '%$title%' or title LIKE '%$title%'";
51
+    $res = Database::query($sql);
52
+    if (Database::num_rows($res)>0) {
53 53
     while ($row = Database::fetch_array($res)) {
54
-      $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path'];
55
-      $extensions = preg_split("/[\/\\.]/", $doc_path);
56
-      $doc_ext = strtolower($extensions[count($extensions) - 1]);
57
-      if (in_array($doc_ext, $allowed_extensions) && !is_dir($doc_path)) {
54
+        $doc_path = api_get_path(SYS_COURSE_PATH).$course_dir.$row['path'];
55
+        $extensions = preg_split("/[\/\\.]/", $doc_path);
56
+        $doc_ext = strtolower($extensions[count($extensions) - 1]);
57
+        if (in_array($doc_ext, $allowed_extensions) && !is_dir($doc_path)) {
58 58
         $doc_mime = mime_content_type($doc_path);
59 59
         echo "Indexing doc ".$row['id']." (".$row['path'].") in course ".$course['code']."\n";
60 60
         $residx = DocumentManager::index_document($row['id'], $course['code'], $row['session_id'], $course['course_language'], $specific_fields_values);
61 61
         if ($residx) {
62
-        	echo "Success\n";
62
+            echo "Success\n";
63 63
         } else {
64
-        	echo "Failure\n";
64
+            echo "Failure\n";
65 65
         }
66
-      }
66
+        }
67
+    }
67 68
     }
68
-  }
69 69
 }
Please login to merge, or discard this patch.
main/cron/notification.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /* For licensing terms, see /license.txt */
3 3
 /**
4
- * @package chamilo.notification
5
- * @author Julio Montoya <[email protected]>
6
- */
4
+     * @package chamilo.notification
5
+     * @author Julio Montoya <[email protected]>
6
+     */
7 7
 /**
8
- * Initialization
9
- */
8
+     * Initialization
9
+     */
10 10
 if (PHP_SAPI!='cli') {
11 11
     die('Run this script through the command line or comment this line in the code');
12 12
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/LoggerFilter.php 1 patch
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Licensed to the Apache Software Foundation (ASF) under one or more
4
- * contributor license agreements. See the NOTICE file distributed with
5
- * this work for additional information regarding copyright ownership.
6
- * The ASF licenses this file to You under the Apache License, Version 2.0
7
- * (the "License"); you may not use this file except in compliance with
8
- * the License. You may obtain a copy of the License at
9
- *
10
- *	   http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * @package log4php
19
- */
3
+     * Licensed to the Apache Software Foundation (ASF) under one or more
4
+     * contributor license agreements. See the NOTICE file distributed with
5
+     * this work for additional information regarding copyright ownership.
6
+     * The ASF licenses this file to You under the Apache License, Version 2.0
7
+     * (the "License"); you may not use this file except in compliance with
8
+     * the License. You may obtain a copy of the License at
9
+     *
10
+     *	   http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     *
18
+     * @package log4php
19
+     */
20 20
 
21 21
 /**
22 22
  * Users should extend this class to implement customized logging
@@ -55,72 +55,72 @@  discard block
 block discarded – undo
55 55
  */
56 56
 abstract class LoggerFilter {
57 57
 
58
-	/**
59
-	 * The log event must be logged immediately without consulting with
60
-	 * the remaining filters, if any, in the chain.	 
61
-	 */
62
-	const ACCEPT = 1;
58
+    /**
59
+     * The log event must be logged immediately without consulting with
60
+     * the remaining filters, if any, in the chain.	 
61
+     */
62
+    const ACCEPT = 1;
63 63
 	
64
-	/**
65
-	 * This filter is neutral with respect to the log event. The
66
-	 * remaining filters, if any, should be consulted for a final decision.
67
-	 */
68
-	const NEUTRAL = 0;
64
+    /**
65
+     * This filter is neutral with respect to the log event. The
66
+     * remaining filters, if any, should be consulted for a final decision.
67
+     */
68
+    const NEUTRAL = 0;
69 69
 	
70
-	/**
71
-	 * The log event must be dropped immediately without consulting
72
-	 * with the remaining filters, if any, in the chain.  
73
-	 */
74
-	const DENY = -1;
70
+    /**
71
+     * The log event must be dropped immediately without consulting
72
+     * with the remaining filters, if any, in the chain.  
73
+     */
74
+    const DENY = -1;
75 75
 
76
-	/**
77
-	 * @var LoggerFilter Points to the next {@link LoggerFilter} in the filter chain.
78
-	 */
79
-	protected $next;
76
+    /**
77
+     * @var LoggerFilter Points to the next {@link LoggerFilter} in the filter chain.
78
+     */
79
+    protected $next;
80 80
 
81
-	/**
82
-	 * Usually filters options become active when set. We provide a
83
-	 * default do-nothing implementation for convenience.
84
-	*/
85
-	public function activateOptions() {
86
-	}
81
+    /**
82
+     * Usually filters options become active when set. We provide a
83
+     * default do-nothing implementation for convenience.
84
+     */
85
+    public function activateOptions() {
86
+    }
87 87
 
88
-	/**	  
89
-	 * Decide what to do.  
90
-	 * <p>If the decision is {@link LoggerFilter::DENY}, then the event will be
91
-	 * dropped. If the decision is {@link LoggerFilter::NEUTRAL}, then the next
92
-	 * filter, if any, will be invoked. If the decision is {@link LoggerFilter::ACCEPT} then
93
-	 * the event will be logged without consulting with other filters in
94
-	 * the chain.
95
-	 *
96
-	 * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to decide upon.
97
-	 * @return integer {@link LoggerFilter::NEUTRAL} or {@link LoggerFilter::DENY}|{@link LoggerFilter::ACCEPT}
98
-	 */
99
-	public function decide(LoggerLoggingEvent $event) {
100
-		return self::NEUTRAL;
101
-	}
88
+    /**	  
89
+     * Decide what to do.  
90
+     * <p>If the decision is {@link LoggerFilter::DENY}, then the event will be
91
+     * dropped. If the decision is {@link LoggerFilter::NEUTRAL}, then the next
92
+     * filter, if any, will be invoked. If the decision is {@link LoggerFilter::ACCEPT} then
93
+     * the event will be logged without consulting with other filters in
94
+     * the chain.
95
+     *
96
+     * @param LoggerLoggingEvent $event The {@link LoggerLoggingEvent} to decide upon.
97
+     * @return integer {@link LoggerFilter::NEUTRAL} or {@link LoggerFilter::DENY}|{@link LoggerFilter::ACCEPT}
98
+     */
99
+    public function decide(LoggerLoggingEvent $event) {
100
+        return self::NEUTRAL;
101
+    }
102 102
 
103
-	/**
104
-	 * Adds a new filter to the filter chain this filter is a part of.
105
-	 * If this filter has already and follow up filter, the param filter
106
-	 * is passed on until it is the last filter in chain.
107
-	 * 
108
-	 * @param $filter - the filter to add to this chain
109
-	 */
110
-	public function addNext($filter) {
111
-		if($this->next !== null) {
112
-		    $this->next->addNext($filter);
113
-		} else {
114
-		    $this->next = $filter;
115
-		}
116
-	}
103
+    /**
104
+     * Adds a new filter to the filter chain this filter is a part of.
105
+     * If this filter has already and follow up filter, the param filter
106
+     * is passed on until it is the last filter in chain.
107
+     * 
108
+     * @param $filter - the filter to add to this chain
109
+     */
110
+    public function addNext($filter) {
111
+        if($this->next !== null) {
112
+            $this->next->addNext($filter);
113
+        } else {
114
+            $this->next = $filter;
115
+        }
116
+    }
117 117
 	
118
-	/**
119
-	 * Returns the next filter in this chain
120
-	 * @return the next filter
121
-	 */
122
-	public function getNext() {
123
-		return $this->next;
124
-	}
118
+    /**
119
+     * Returns the next filter in this chain
120
+     * @return the next filter
121
+     */
122
+    public function getNext() {
123
+        return $this->next;
124
+    }
125 125
 
126 126
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/configurators/LoggerConfiguratorIni.php 1 patch
Indentation   +376 added lines, -376 removed lines patch added patch discarded remove patch
@@ -63,401 +63,401 @@
 block discarded – undo
63 63
  * @since 0.5
64 64
  */
65 65
 class LoggerConfiguratorIni implements LoggerConfigurator {
66
- 	const CATEGORY_PREFIX = "log4php.category.";
67
- 	const LOGGER_PREFIX = "log4php.logger.";
68
-	const FACTORY_PREFIX = "log4php.factory";
69
-	const ADDITIVITY_PREFIX = "log4php.additivity.";
70
-	const ROOT_CATEGORY_PREFIX = "log4php.rootCategory";
71
-	const ROOT_LOGGER_PREFIX = "log4php.rootLogger";
72
-	const APPENDER_PREFIX = "log4php.appender.";
73
-	const RENDERER_PREFIX = "log4php.renderer.";
74
-	const THRESHOLD_PREFIX = "log4php.threshold";
66
+        const CATEGORY_PREFIX = "log4php.category.";
67
+        const LOGGER_PREFIX = "log4php.logger.";
68
+    const FACTORY_PREFIX = "log4php.factory";
69
+    const ADDITIVITY_PREFIX = "log4php.additivity.";
70
+    const ROOT_CATEGORY_PREFIX = "log4php.rootCategory";
71
+    const ROOT_LOGGER_PREFIX = "log4php.rootLogger";
72
+    const APPENDER_PREFIX = "log4php.appender.";
73
+    const RENDERER_PREFIX = "log4php.renderer.";
74
+    const THRESHOLD_PREFIX = "log4php.threshold";
75 75
 	
76
-	/** 
77
-	 * Key for specifying the {@link LoggerFactory}.  
78
-	 */
79
-	const LOGGER_FACTORY_KEY = "log4php.loggerFactory";
80
-	const LOGGER_DEBUG_KEY = "log4php.debug";
81
-	const INTERNAL_ROOT_NAME = "root";
76
+    /** 
77
+     * Key for specifying the {@link LoggerFactory}.  
78
+     */
79
+    const LOGGER_FACTORY_KEY = "log4php.loggerFactory";
80
+    const LOGGER_DEBUG_KEY = "log4php.debug";
81
+    const INTERNAL_ROOT_NAME = "root";
82 82
 	
83
-	/**
84
-	 * Constructor
85
-	 */
86
-	public function __construct() {
87
-	}
83
+    /**
84
+     * Constructor
85
+     */
86
+    public function __construct() {
87
+    }
88 88
 
89
-	/**
90
-	 * Read configuration from a file.
91
-	 *
92
-	 * <p>The function {@link PHP_MANUAL#parse_ini_file} is used to read the
93
-	 * file.</p>
94
-	 *
95
-	 * <b>The existing configuration is not cleared nor reset.</b> 
96
-	 * If you require a different behavior, then call 
97
-	 * {@link  Logger::resetConfiguration()} 
98
-	 * method before calling {@link doConfigure()}.
99
-	 * 
100
-	 * <p>The configuration file consists of statements in the format
101
-	 * <b>key=value</b>. The syntax of different configuration
102
-	 * elements are discussed below.
103
-	 * 
104
-	 * <p><b>Repository-wide threshold</b></p>
105
-	 * 
106
-	 * <p>The repository-wide threshold filters logging requests by level
107
-	 * regardless of logger. The syntax is:
108
-	 * 
109
-	 * <pre>
110
-	 * log4php.threshold=[level]
111
-	 * </pre>
112
-	 * 
113
-	 * <p>The level value can consist of the string values OFF, FATAL,
114
-	 * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
115
-	 * custom level value can be specified in the form
116
-	 * <samp>level#classname</samp>. By default the repository-wide threshold is set
117
-	 * to the lowest possible value, namely the level <b>ALL</b>.
118
-	 * </p>
119
-	 * 
120
-	 * 
121
-	 * <p><b>Appender configuration</b></p>
122
-	 * 
123
-	 * <p>Appender configuration syntax is:</p>
124
-	 * <pre>
125
-	 * ; For appender named <i>appenderName</i>, set its class.
126
-	 * ; Note: The appender name can contain dots.
127
-	 * log4php.appender.appenderName=name_of_appender_class
128
-	 * 
129
-	 * ; Set appender specific options.
130
-	 * 
131
-	 * log4php.appender.appenderName.option1=value1
132
-	 * log4php.appender.appenderName.optionN=valueN
133
-	 * </pre>
134
-	 * 
135
-	 * For each named appender you can configure its {@link LoggerLayout}. The
136
-	 * syntax for configuring an appender's layout is:
137
-	 * <pre>
138
-	 * log4php.appender.appenderName.layout=name_of_layout_class
139
-	 * log4php.appender.appenderName.layout.option1=value1
140
-	 *	....
141
-	 * log4php.appender.appenderName.layout.optionN=valueN
142
-	 * </pre>
143
-	 * 
144
-	 * <p><b>Configuring loggers</b></p>
145
-	 * 
146
-	 * <p>The syntax for configuring the root logger is:
147
-	 * <pre>
148
-	 * log4php.rootLogger=[level], appenderName, appenderName, ...
149
-	 * </pre>
150
-	 * 
151
-	 * <p>This syntax means that an optional <i>level</i> can be
152
-	 * supplied followed by appender names separated by commas.
153
-	 * 
154
-	 * <p>The level value can consist of the string values OFF, FATAL,
155
-	 * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
156
-	 * custom level value can be specified in the form</p>
157
-	 *
158
-	 * <pre>level#classname</pre>
159
-	 * 
160
-	 * <p>If a level value is specified, then the root level is set
161
-	 * to the corresponding level.	If no level value is specified,
162
-	 * then the root level remains untouched.
163
-	 * 
164
-	 * <p>The root logger can be assigned multiple appenders.
165
-	 * 
166
-	 * <p>Each <i>appenderName</i> (separated by commas) will be added to
167
-	 * the root logger. The named appender is defined using the
168
-	 * appender syntax defined above.
169
-	 * 
170
-	 * <p>For non-root categories the syntax is almost the same:
171
-	 * <pre>
172
-	 * log4php.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName, ...
173
-	 * </pre>
174
-	 * 
175
-	 * <p>The meaning of the optional level value is discussed above
176
-	 * in relation to the root logger. In addition however, the value
177
-	 * INHERITED can be specified meaning that the named logger should
178
-	 * inherit its level from the logger hierarchy.</p>
179
-	 * 
180
-	 * <p>If no level value is supplied, then the level of the
181
-	 * named logger remains untouched.</p>
182
-	 * 
183
-	 * <p>By default categories inherit their level from the
184
-	 * hierarchy. However, if you set the level of a logger and later
185
-	 * decide that that logger should inherit its level, then you should
186
-	 * specify INHERITED as the value for the level value. NULL is a
187
-	 * synonym for INHERITED.</p>
188
-	 * 
189
-	 * <p>Similar to the root logger syntax, each <i>appenderName</i>
190
-	 * (separated by commas) will be attached to the named logger.</p>
191
-	 * 
192
-	 * <p>See the <i>appender additivity rule</i> in the user manual for 
193
-	 * the meaning of the <b>additivity</b> flag.
194
-	 * 
195
-	 * <p><b>ObjectRenderers</b></p>
196
-	 * 
197
-	 * <p>You can customize the way message objects of a given type are
198
-	 * converted to String before being logged. This is done by
199
-	 * specifying a {@link LoggerRendererObject}
200
-	 * for the object type would like to customize.</p>
201
-	 * 
202
-	 * <p>The syntax is:
203
-	 * 
204
-	 * <pre>
205
-	 * log4php.renderer.name_of_rendered_class=name_of_rendering.class
206
-	 * </pre>
207
-	 * 
208
-	 * As in,
209
-	 * <pre>
210
-	 * log4php.renderer.myFruit=myFruitRenderer
211
-	 * </pre>
212
-	 * 
213
-	 * <p><b>Logger Factories</b></p>
214
-	 * 
215
-	 * The usage of custom logger factories is discouraged and no longer
216
-	 * documented.
217
-	 * 
218
-	 * <p><b>Example</b></p>
219
-	 * 
220
-	 * <p>An example configuration is given below. Other configuration
221
-	 * file examples are given in the <b>tests</b> folder.
222
-	 * 
223
-	 * <pre>
224
-	 * ; Set options for appender named "A1".
225
-	 * ; Appender "A1" will be a LoggerAppenderSyslog
226
-	 * log4php.appender.A1=LoggerAppenderSyslog
227
-	 * 
228
-	 * ; The syslog daemon resides on www.abc.net
229
-	 * log4php.appender.A1.ident=log4php-test
230
-	 * 
231
-	 * ; A1's layout is a LoggerPatternLayout, using the conversion pattern
232
-	 * ; <b>%r %-5p %c{2} %M.%L %x - %m%n</b>. Thus, the log output will
233
-	 * ; include the relative time since the start of the application in
234
-	 * ; milliseconds, followed by the level of the log request,
235
-	 * ; followed by the two rightmost components of the logger name,
236
-	 * ; followed by the callers method name, followed by the line number,
237
-	 * ; the nested disgnostic context and finally the message itself.
238
-	 * ; Refer to the documentation of LoggerPatternLayout} for further information
239
-	 * ; on the syntax of the ConversionPattern key.
240
-	 * log4php.appender.A1.layout=LoggerPatternLayout
241
-	 * log4php.appender.A1.layout.ConversionPattern="%-4r %-5p %c{2} %M.%L %x - %m%n"
242
-	 * 
243
-	 * ; Set options for appender named "A2"
244
-	 * ; A2 should be a LoggerAppenderRollingFile, with maximum file size of 10 MB
245
-	 * ; using at most one backup file. A2's layout is TTCC, using the
246
-	 * ; ISO8061 date format with context printing enabled.
247
-	 * log4php.appender.A2=LoggerAppenderRollingFile
248
-	 * log4php.appender.A2.MaxFileSize=10MB
249
-	 * log4php.appender.A2.MaxBackupIndex=1
250
-	 * log4php.appender.A2.layout=LoggerLayoutTTCC
251
-	 * log4php.appender.A2.layout.ContextPrinting="true"
252
-	 * log4php.appender.A2.layout.DateFormat="%c"
253
-	 * 
254
-	 * ; Root logger set to DEBUG using the A2 appender defined above.
255
-	 * log4php.rootLogger=DEBUG, A2
256
-	 * 
257
-	 * ; Logger definitions:
258
-	 * ; The SECURITY logger inherits is level from root. However, it's output
259
-	 * ; will go to A1 appender defined above. It's additivity is non-cumulative.
260
-	 * log4php.logger.SECURITY=INHERIT, A1
261
-	 * log4php.additivity.SECURITY=false
262
-	 * 
263
-	 * ; Only warnings or above will be logged for the logger "SECURITY.access".
264
-	 * ; Output will go to A1.
265
-	 * log4php.logger.SECURITY.access=WARN
266
-	 * 
267
-	 * 
268
-	 * ; The logger "class.of.the.day" inherits its level from the
269
-	 * ; logger hierarchy.	Output will go to the appender's of the root
270
-	 * ; logger, A2 in this case.
271
-	 * log4php.logger.class.of.the.day=INHERIT
272
-	 * </pre>
273
-	 * 
274
-	 * <p>Refer to the <b>setOption</b> method in each Appender and
275
-	 * Layout for class specific options.</p>
276
-	 * 
277
-	 * <p>Use the <b>&quot;;&quot;</b> character at the
278
-	 * beginning of a line for comments.</p>
279
-	 * 
280
-	 * @param string $url The name of the configuration file where the
281
-	 *					  configuration information is stored.
282
-	 * @param LoggerHierarchy $repository the repository to apply the configuration
283
-	 */
284
-	public function configure(LoggerHierarchy $hierarchy, $url = '') {
285
-		$properties = @parse_ini_file($url);
286
-		if ($properties === false || count($properties) == 0) {
287
-			$error = error_get_last();
288
-		    throw new LoggerException("LoggerConfiguratorIni: ".$error['message']);
289
-		}
290
-		return $this->doConfigureProperties($properties, $hierarchy);
291
-	}
89
+    /**
90
+     * Read configuration from a file.
91
+     *
92
+     * <p>The function {@link PHP_MANUAL#parse_ini_file} is used to read the
93
+     * file.</p>
94
+     *
95
+     * <b>The existing configuration is not cleared nor reset.</b> 
96
+     * If you require a different behavior, then call 
97
+     * {@link  Logger::resetConfiguration()} 
98
+     * method before calling {@link doConfigure()}.
99
+     * 
100
+     * <p>The configuration file consists of statements in the format
101
+     * <b>key=value</b>. The syntax of different configuration
102
+     * elements are discussed below.
103
+     * 
104
+     * <p><b>Repository-wide threshold</b></p>
105
+     * 
106
+     * <p>The repository-wide threshold filters logging requests by level
107
+     * regardless of logger. The syntax is:
108
+     * 
109
+     * <pre>
110
+     * log4php.threshold=[level]
111
+     * </pre>
112
+     * 
113
+     * <p>The level value can consist of the string values OFF, FATAL,
114
+     * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
115
+     * custom level value can be specified in the form
116
+     * <samp>level#classname</samp>. By default the repository-wide threshold is set
117
+     * to the lowest possible value, namely the level <b>ALL</b>.
118
+     * </p>
119
+     * 
120
+     * 
121
+     * <p><b>Appender configuration</b></p>
122
+     * 
123
+     * <p>Appender configuration syntax is:</p>
124
+     * <pre>
125
+     * ; For appender named <i>appenderName</i>, set its class.
126
+     * ; Note: The appender name can contain dots.
127
+     * log4php.appender.appenderName=name_of_appender_class
128
+     * 
129
+     * ; Set appender specific options.
130
+     * 
131
+     * log4php.appender.appenderName.option1=value1
132
+     * log4php.appender.appenderName.optionN=valueN
133
+     * </pre>
134
+     * 
135
+     * For each named appender you can configure its {@link LoggerLayout}. The
136
+     * syntax for configuring an appender's layout is:
137
+     * <pre>
138
+     * log4php.appender.appenderName.layout=name_of_layout_class
139
+     * log4php.appender.appenderName.layout.option1=value1
140
+     *	....
141
+     * log4php.appender.appenderName.layout.optionN=valueN
142
+     * </pre>
143
+     * 
144
+     * <p><b>Configuring loggers</b></p>
145
+     * 
146
+     * <p>The syntax for configuring the root logger is:
147
+     * <pre>
148
+     * log4php.rootLogger=[level], appenderName, appenderName, ...
149
+     * </pre>
150
+     * 
151
+     * <p>This syntax means that an optional <i>level</i> can be
152
+     * supplied followed by appender names separated by commas.
153
+     * 
154
+     * <p>The level value can consist of the string values OFF, FATAL,
155
+     * ERROR, WARN, INFO, DEBUG, ALL or a <i>custom level</i> value. A
156
+     * custom level value can be specified in the form</p>
157
+     *
158
+     * <pre>level#classname</pre>
159
+     * 
160
+     * <p>If a level value is specified, then the root level is set
161
+     * to the corresponding level.	If no level value is specified,
162
+     * then the root level remains untouched.
163
+     * 
164
+     * <p>The root logger can be assigned multiple appenders.
165
+     * 
166
+     * <p>Each <i>appenderName</i> (separated by commas) will be added to
167
+     * the root logger. The named appender is defined using the
168
+     * appender syntax defined above.
169
+     * 
170
+     * <p>For non-root categories the syntax is almost the same:
171
+     * <pre>
172
+     * log4php.logger.logger_name=[level|INHERITED|NULL], appenderName, appenderName, ...
173
+     * </pre>
174
+     * 
175
+     * <p>The meaning of the optional level value is discussed above
176
+     * in relation to the root logger. In addition however, the value
177
+     * INHERITED can be specified meaning that the named logger should
178
+     * inherit its level from the logger hierarchy.</p>
179
+     * 
180
+     * <p>If no level value is supplied, then the level of the
181
+     * named logger remains untouched.</p>
182
+     * 
183
+     * <p>By default categories inherit their level from the
184
+     * hierarchy. However, if you set the level of a logger and later
185
+     * decide that that logger should inherit its level, then you should
186
+     * specify INHERITED as the value for the level value. NULL is a
187
+     * synonym for INHERITED.</p>
188
+     * 
189
+     * <p>Similar to the root logger syntax, each <i>appenderName</i>
190
+     * (separated by commas) will be attached to the named logger.</p>
191
+     * 
192
+     * <p>See the <i>appender additivity rule</i> in the user manual for 
193
+     * the meaning of the <b>additivity</b> flag.
194
+     * 
195
+     * <p><b>ObjectRenderers</b></p>
196
+     * 
197
+     * <p>You can customize the way message objects of a given type are
198
+     * converted to String before being logged. This is done by
199
+     * specifying a {@link LoggerRendererObject}
200
+     * for the object type would like to customize.</p>
201
+     * 
202
+     * <p>The syntax is:
203
+     * 
204
+     * <pre>
205
+     * log4php.renderer.name_of_rendered_class=name_of_rendering.class
206
+     * </pre>
207
+     * 
208
+     * As in,
209
+     * <pre>
210
+     * log4php.renderer.myFruit=myFruitRenderer
211
+     * </pre>
212
+     * 
213
+     * <p><b>Logger Factories</b></p>
214
+     * 
215
+     * The usage of custom logger factories is discouraged and no longer
216
+     * documented.
217
+     * 
218
+     * <p><b>Example</b></p>
219
+     * 
220
+     * <p>An example configuration is given below. Other configuration
221
+     * file examples are given in the <b>tests</b> folder.
222
+     * 
223
+     * <pre>
224
+     * ; Set options for appender named "A1".
225
+     * ; Appender "A1" will be a LoggerAppenderSyslog
226
+     * log4php.appender.A1=LoggerAppenderSyslog
227
+     * 
228
+     * ; The syslog daemon resides on www.abc.net
229
+     * log4php.appender.A1.ident=log4php-test
230
+     * 
231
+     * ; A1's layout is a LoggerPatternLayout, using the conversion pattern
232
+     * ; <b>%r %-5p %c{2} %M.%L %x - %m%n</b>. Thus, the log output will
233
+     * ; include the relative time since the start of the application in
234
+     * ; milliseconds, followed by the level of the log request,
235
+     * ; followed by the two rightmost components of the logger name,
236
+     * ; followed by the callers method name, followed by the line number,
237
+     * ; the nested disgnostic context and finally the message itself.
238
+     * ; Refer to the documentation of LoggerPatternLayout} for further information
239
+     * ; on the syntax of the ConversionPattern key.
240
+     * log4php.appender.A1.layout=LoggerPatternLayout
241
+     * log4php.appender.A1.layout.ConversionPattern="%-4r %-5p %c{2} %M.%L %x - %m%n"
242
+     * 
243
+     * ; Set options for appender named "A2"
244
+     * ; A2 should be a LoggerAppenderRollingFile, with maximum file size of 10 MB
245
+     * ; using at most one backup file. A2's layout is TTCC, using the
246
+     * ; ISO8061 date format with context printing enabled.
247
+     * log4php.appender.A2=LoggerAppenderRollingFile
248
+     * log4php.appender.A2.MaxFileSize=10MB
249
+     * log4php.appender.A2.MaxBackupIndex=1
250
+     * log4php.appender.A2.layout=LoggerLayoutTTCC
251
+     * log4php.appender.A2.layout.ContextPrinting="true"
252
+     * log4php.appender.A2.layout.DateFormat="%c"
253
+     * 
254
+     * ; Root logger set to DEBUG using the A2 appender defined above.
255
+     * log4php.rootLogger=DEBUG, A2
256
+     * 
257
+     * ; Logger definitions:
258
+     * ; The SECURITY logger inherits is level from root. However, it's output
259
+     * ; will go to A1 appender defined above. It's additivity is non-cumulative.
260
+     * log4php.logger.SECURITY=INHERIT, A1
261
+     * log4php.additivity.SECURITY=false
262
+     * 
263
+     * ; Only warnings or above will be logged for the logger "SECURITY.access".
264
+     * ; Output will go to A1.
265
+     * log4php.logger.SECURITY.access=WARN
266
+     * 
267
+     * 
268
+     * ; The logger "class.of.the.day" inherits its level from the
269
+     * ; logger hierarchy.	Output will go to the appender's of the root
270
+     * ; logger, A2 in this case.
271
+     * log4php.logger.class.of.the.day=INHERIT
272
+     * </pre>
273
+     * 
274
+     * <p>Refer to the <b>setOption</b> method in each Appender and
275
+     * Layout for class specific options.</p>
276
+     * 
277
+     * <p>Use the <b>&quot;;&quot;</b> character at the
278
+     * beginning of a line for comments.</p>
279
+     * 
280
+     * @param string $url The name of the configuration file where the
281
+     *					  configuration information is stored.
282
+     * @param LoggerHierarchy $repository the repository to apply the configuration
283
+     */
284
+    public function configure(LoggerHierarchy $hierarchy, $url = '') {
285
+        $properties = @parse_ini_file($url);
286
+        if ($properties === false || count($properties) == 0) {
287
+            $error = error_get_last();
288
+            throw new LoggerException("LoggerConfiguratorIni: ".$error['message']);
289
+        }
290
+        return $this->doConfigureProperties($properties, $hierarchy);
291
+    }
292 292
 
293
-	/**
294
-	 * Read configuration options from <b>properties</b>.
295
-	 *
296
-	 * @see doConfigure().
297
-	 * @param array $properties
298
-	 * @param LoggerHierarchy $hierarchy
299
-	 */
300
-	private function doConfigureProperties($properties, LoggerHierarchy $hierarchy) {
301
-		$thresholdStr = @$properties[self::THRESHOLD_PREFIX];
302
-		$hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, LoggerLevel::getLevelAll()));
303
-		$this->configureRootCategory($properties, $hierarchy);
304
-		$this->parseCatsAndRenderers($properties, $hierarchy);
305
-		return true;
306
-	}
293
+    /**
294
+     * Read configuration options from <b>properties</b>.
295
+     *
296
+     * @see doConfigure().
297
+     * @param array $properties
298
+     * @param LoggerHierarchy $hierarchy
299
+     */
300
+    private function doConfigureProperties($properties, LoggerHierarchy $hierarchy) {
301
+        $thresholdStr = @$properties[self::THRESHOLD_PREFIX];
302
+        $hierarchy->setThreshold(LoggerOptionConverter::toLevel($thresholdStr, LoggerLevel::getLevelAll()));
303
+        $this->configureRootCategory($properties, $hierarchy);
304
+        $this->parseCatsAndRenderers($properties, $hierarchy);
305
+        return true;
306
+    }
307 307
 
308
-	/**
309
-	 * @param array $props array of properties
310
-	 * @param LoggerHierarchy $hierarchy
311
-	 */
312
-	private function configureRootCategory($props, LoggerHierarchy $hierarchy) {
313
-		$effectivePrefix = self::ROOT_LOGGER_PREFIX;
314
-		$value = @$props[self::ROOT_LOGGER_PREFIX];
308
+    /**
309
+     * @param array $props array of properties
310
+     * @param LoggerHierarchy $hierarchy
311
+     */
312
+    private function configureRootCategory($props, LoggerHierarchy $hierarchy) {
313
+        $effectivePrefix = self::ROOT_LOGGER_PREFIX;
314
+        $value = @$props[self::ROOT_LOGGER_PREFIX];
315 315
 
316
-		if(empty($value)) {
317
-			$value = @$props[self::ROOT_CATEGORY_PREFIX];
318
-			$effectivePrefix = self::ROOT_CATEGORY_PREFIX;
319
-		}
316
+        if(empty($value)) {
317
+            $value = @$props[self::ROOT_CATEGORY_PREFIX];
318
+            $effectivePrefix = self::ROOT_CATEGORY_PREFIX;
319
+        }
320 320
 
321
-		if(empty($value)) {
322
-			// TODO "Could not find root logger information. Is this OK?"
323
-		} else {
324
-			$root = $hierarchy->getRootLogger();
325
-			$this->parseCategory($props, $root, $effectivePrefix, self::INTERNAL_ROOT_NAME,	$value);
326
-		}
327
-	}
321
+        if(empty($value)) {
322
+            // TODO "Could not find root logger information. Is this OK?"
323
+        } else {
324
+            $root = $hierarchy->getRootLogger();
325
+            $this->parseCategory($props, $root, $effectivePrefix, self::INTERNAL_ROOT_NAME,	$value);
326
+        }
327
+    }
328 328
 
329
-	/**
330
-	 * Parse non-root elements, such non-root categories and renderers.
331
-	 *
332
-	 * @param array $props array of properties
333
-	 * @param LoggerHierarchy $hierarchy
334
-	 */
335
-	private function parseCatsAndRenderers($props, LoggerHierarchy $hierarchy) {
336
-		while(list($key,$value) = each($props)) {
337
-			if(strpos($key, self::CATEGORY_PREFIX) === 0 or 
338
-				strpos($key, self::LOGGER_PREFIX) === 0) {
339
-				if(strpos($key, self::CATEGORY_PREFIX) === 0) {
340
-					$loggerName = substr($key, strlen(self::CATEGORY_PREFIX));
341
-				} else if(strpos($key, self::LOGGER_PREFIX) === 0) {
342
-					$loggerName = substr($key, strlen(self::LOGGER_PREFIX));
343
-				}
329
+    /**
330
+     * Parse non-root elements, such non-root categories and renderers.
331
+     *
332
+     * @param array $props array of properties
333
+     * @param LoggerHierarchy $hierarchy
334
+     */
335
+    private function parseCatsAndRenderers($props, LoggerHierarchy $hierarchy) {
336
+        while(list($key,$value) = each($props)) {
337
+            if(strpos($key, self::CATEGORY_PREFIX) === 0 or 
338
+                strpos($key, self::LOGGER_PREFIX) === 0) {
339
+                if(strpos($key, self::CATEGORY_PREFIX) === 0) {
340
+                    $loggerName = substr($key, strlen(self::CATEGORY_PREFIX));
341
+                } else if(strpos($key, self::LOGGER_PREFIX) === 0) {
342
+                    $loggerName = substr($key, strlen(self::LOGGER_PREFIX));
343
+                }
344 344
 				
345
-				$logger = $hierarchy->getLogger($loggerName);
346
-				$this->parseCategory($props, $logger, $key, $loggerName, $value);
347
-				$this->parseAdditivityForLogger($props, $logger, $loggerName);
348
-			} else if(strpos($key, self::RENDERER_PREFIX) === 0) {
349
-				$renderedClass = substr($key, strlen(self::RENDERER_PREFIX));
350
-				$renderingClass = $value;
351
-				$hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClass);
352
-			}
353
-		}
354
-	}
345
+                $logger = $hierarchy->getLogger($loggerName);
346
+                $this->parseCategory($props, $logger, $key, $loggerName, $value);
347
+                $this->parseAdditivityForLogger($props, $logger, $loggerName);
348
+            } else if(strpos($key, self::RENDERER_PREFIX) === 0) {
349
+                $renderedClass = substr($key, strlen(self::RENDERER_PREFIX));
350
+                $renderingClass = $value;
351
+                $hierarchy->getRendererMap()->addRenderer($renderedClass, $renderingClass);
352
+            }
353
+        }
354
+    }
355 355
 
356
-	/**
357
-	 * Parse the additivity option for a non-root category.
358
-	 *
359
-	 * @param array $props array of properties
360
-	 * @param Logger $cat
361
-	 * @param string $loggerName
362
-	 */
363
-	private function parseAdditivityForLogger($props, Logger $cat, $loggerName) {
364
-		$value = LoggerOptionConverter::findAndSubst(self::ADDITIVITY_PREFIX . $loggerName, $props);
356
+    /**
357
+     * Parse the additivity option for a non-root category.
358
+     *
359
+     * @param array $props array of properties
360
+     * @param Logger $cat
361
+     * @param string $loggerName
362
+     */
363
+    private function parseAdditivityForLogger($props, Logger $cat, $loggerName) {
364
+        $value = LoggerOptionConverter::findAndSubst(self::ADDITIVITY_PREFIX . $loggerName, $props);
365 365
 		
366
-		// touch additivity only if necessary
367
-		if(!empty($value)) {
368
-			$additivity = LoggerOptionConverter::toBoolean($value, true);
369
-			$cat->setAdditivity($additivity);
370
-		}
371
-	}
366
+        // touch additivity only if necessary
367
+        if(!empty($value)) {
368
+            $additivity = LoggerOptionConverter::toBoolean($value, true);
369
+            $cat->setAdditivity($additivity);
370
+        }
371
+    }
372 372
 
373
-	/**
374
-	 * This method must work for the root category as well.
375
-	 *
376
-	 * @param array $props array of properties
377
-	 * @param Logger $logger
378
-	 * @param string $optionKey
379
-	 * @param string $loggerName
380
-	 * @param string $value
381
-	 * @return Logger
382
-	 */
383
-	private function parseCategory($props, Logger $logger, $optionKey, $loggerName, $value) {
384
-		// We must skip over ',' but not white space
385
-		$st = explode(',', $value);
373
+    /**
374
+     * This method must work for the root category as well.
375
+     *
376
+     * @param array $props array of properties
377
+     * @param Logger $logger
378
+     * @param string $optionKey
379
+     * @param string $loggerName
380
+     * @param string $value
381
+     * @return Logger
382
+     */
383
+    private function parseCategory($props, Logger $logger, $optionKey, $loggerName, $value) {
384
+        // We must skip over ',' but not white space
385
+        $st = explode(',', $value);
386 386
 
387
-		// If value is not in the form ", appender.." or "", then we should set
388
-		// the level of the loggeregory.
387
+        // If value is not in the form ", appender.." or "", then we should set
388
+        // the level of the loggeregory.
389 389
 
390
-		if(!(empty($value) || @$value[0] == ',')) {
391
-			// just to be on the safe side...
392
-			if(count($st) == 0) {
393
-				return;
394
-			}
395
-			$levelStr = current($st);
390
+        if(!(empty($value) || @$value[0] == ',')) {
391
+            // just to be on the safe side...
392
+            if(count($st) == 0) {
393
+                return;
394
+            }
395
+            $levelStr = current($st);
396 396
 			
397
-			// If the level value is inherited, set category level value to
398
-			// null. We also check that the user has not specified inherited for the
399
-			// root category.
400
-			if('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) {
401
-				if($loggerName == self::INTERNAL_ROOT_NAME) {
402
-					// TODO: throw exception?	"The root logger cannot be set to null."
403
-				} else {
404
-					$logger->setLevel(null);
405
-				}
406
-			} else {
407
-				$logger->setLevel(LoggerOptionConverter::toLevel($levelStr, LoggerLevel::getLevelDebug()));
408
-			}
409
-		}
397
+            // If the level value is inherited, set category level value to
398
+            // null. We also check that the user has not specified inherited for the
399
+            // root category.
400
+            if('INHERITED' == strtoupper($levelStr) || 'NULL' == strtoupper($levelStr)) {
401
+                if($loggerName == self::INTERNAL_ROOT_NAME) {
402
+                    // TODO: throw exception?	"The root logger cannot be set to null."
403
+                } else {
404
+                    $logger->setLevel(null);
405
+                }
406
+            } else {
407
+                $logger->setLevel(LoggerOptionConverter::toLevel($levelStr, LoggerLevel::getLevelDebug()));
408
+            }
409
+        }
410 410
 
411
-		// TODO: removing should be done by the logger, if necessary and wanted 
412
-		// $logger->removeAllAppenders();
413
-		while($appenderName = next($st)) {
414
-			$appenderName = trim($appenderName);
415
-			if(empty($appenderName)) {
416
-				continue;
417
-			}
411
+        // TODO: removing should be done by the logger, if necessary and wanted 
412
+        // $logger->removeAllAppenders();
413
+        while($appenderName = next($st)) {
414
+            $appenderName = trim($appenderName);
415
+            if(empty($appenderName)) {
416
+                continue;
417
+            }
418 418
 			
419
-			$appender = $this->parseAppender($props, $appenderName);
420
-			if($appender !== null) {
421
-					$logger->addAppender($appender);
422
-			}
423
-		}
424
-	}
419
+            $appender = $this->parseAppender($props, $appenderName);
420
+            if($appender !== null) {
421
+                    $logger->addAppender($appender);
422
+            }
423
+        }
424
+    }
425 425
 
426
-	/**
427
-	 * @param array $props array of properties
428
-	 * @param string $appenderName
429
-	 * @return LoggerAppender
430
-	 */
431
-	private function parseAppender($props, $appenderName) {
432
-		$appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
433
-		$prefix = self::APPENDER_PREFIX . $appenderName;
434
-		if($appender === null) {
435
-			// Appender was not previously initialized.
436
-			$appenderClass = @$props[$prefix];
437
-			$appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderClass);
438
-			if($appender === null) {
439
-				return null;
440
-			}
441
-		}
426
+    /**
427
+     * @param array $props array of properties
428
+     * @param string $appenderName
429
+     * @return LoggerAppender
430
+     */
431
+    private function parseAppender($props, $appenderName) {
432
+        $appender = LoggerAppenderPool::getAppenderFromPool($appenderName);
433
+        $prefix = self::APPENDER_PREFIX . $appenderName;
434
+        if($appender === null) {
435
+            // Appender was not previously initialized.
436
+            $appenderClass = @$props[$prefix];
437
+            $appender = LoggerAppenderPool::getAppenderFromPool($appenderName, $appenderClass);
438
+            if($appender === null) {
439
+                return null;
440
+            }
441
+        }
442 442
 		
443
-		if($appender->requiresLayout() ) {
444
-			$layoutPrefix = $prefix . ".layout";
445
-			$layoutClass = @$props[$layoutPrefix];
446
-			$layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
447
-			if(empty($layoutClass)) {
448
-				$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
449
-			} else {
450
-				$layout = LoggerReflectionUtils::createObject($layoutClass);
451
-				if($layout === null) {
452
-					$layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
453
-				}
454
-			}
443
+        if($appender->requiresLayout() ) {
444
+            $layoutPrefix = $prefix . ".layout";
445
+            $layoutClass = @$props[$layoutPrefix];
446
+            $layoutClass = LoggerOptionConverter::substVars($layoutClass, $props);
447
+            if(empty($layoutClass)) {
448
+                $layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
449
+            } else {
450
+                $layout = LoggerReflectionUtils::createObject($layoutClass);
451
+                if($layout === null) {
452
+                    $layout = LoggerReflectionUtils::createObject('LoggerLayoutSimple');
453
+                }
454
+            }
455 455
 			
456
-			LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix . ".");				  
457
-			$appender->setLayout($layout);
456
+            LoggerReflectionUtils::setPropertiesByObject($layout, $props, $layoutPrefix . ".");				  
457
+            $appender->setLayout($layout);
458 458
 			
459
-		}
460
-		LoggerReflectionUtils::setPropertiesByObject($appender, $props, $prefix . ".");
461
-		return $appender;		 
462
-	}
459
+        }
460
+        LoggerReflectionUtils::setPropertiesByObject($appender, $props, $prefix . ".");
461
+        return $appender;		 
462
+    }
463 463
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/LoggerMDC.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -55,62 +55,62 @@
 block discarded – undo
55 55
  * @package log4php
56 56
  */
57 57
 class LoggerMDC {
58
-	/**
59
-	 * Put a context value as identified with the key parameter into the current thread's
60
-	 *	context map.
61
-	 *
62
-	 * <p>If the current thread does not have a context map it is
63
-	 *	created as a side effect.</p>
64
-	 *
65
-	 * <p>Note that you cannot put more than {@link self::HT_SIZE} keys.</p>
66
-	 *
67
-	 * @param string $key the key
68
-	 * @param string $value the value
69
-	 * @static
70
-	 */
71
-	public static function put($key, $value) {
72
-		$GLOBALS['log4php.LoggerMDC.ht'][$key] = $value;
73
-	}
58
+    /**
59
+     * Put a context value as identified with the key parameter into the current thread's
60
+     *	context map.
61
+     *
62
+     * <p>If the current thread does not have a context map it is
63
+     *	created as a side effect.</p>
64
+     *
65
+     * <p>Note that you cannot put more than {@link self::HT_SIZE} keys.</p>
66
+     *
67
+     * @param string $key the key
68
+     * @param string $value the value
69
+     * @static
70
+     */
71
+    public static function put($key, $value) {
72
+        $GLOBALS['log4php.LoggerMDC.ht'][$key] = $value;
73
+    }
74 74
   
75
-	/**
76
-	 * Get the context identified by the key parameter.
77
-	 *
78
-	 * <p>You can use special key identifiers to map values in 
79
-	 * PHP $_SERVER and $_ENV vars. Just put a 'server.' or 'env.'
80
-	 * followed by the var name you want to refer.</p>
81
-	 *
82
-	 * <p>This method has no side effects.</p>
83
-	 *
84
-	 * @param string $key
85
-	 * @return string
86
-	 * @static
87
-	 */
88
-	public static function get($key) {
89
-		if(!empty($key)) {
90
-			if(strpos($key, 'server.') === 0) {
91
-				$varName = substr($key, 7);
92
-				return @$_SERVER[$varName];
93
-			} else if(strpos($key, 'env.') === 0) {
94
-				$varName = substr($key, 4);
95
-				return @$_ENV[$varName];
96
-			} else if (isset($GLOBALS['log4php.LoggerMDC.ht'][$key])) {
97
-				return $GLOBALS['log4php.LoggerMDC.ht'][$key];
98
-			}
99
-		}
100
-		return '';
101
-	}
75
+    /**
76
+     * Get the context identified by the key parameter.
77
+     *
78
+     * <p>You can use special key identifiers to map values in 
79
+     * PHP $_SERVER and $_ENV vars. Just put a 'server.' or 'env.'
80
+     * followed by the var name you want to refer.</p>
81
+     *
82
+     * <p>This method has no side effects.</p>
83
+     *
84
+     * @param string $key
85
+     * @return string
86
+     * @static
87
+     */
88
+    public static function get($key) {
89
+        if(!empty($key)) {
90
+            if(strpos($key, 'server.') === 0) {
91
+                $varName = substr($key, 7);
92
+                return @$_SERVER[$varName];
93
+            } else if(strpos($key, 'env.') === 0) {
94
+                $varName = substr($key, 4);
95
+                return @$_ENV[$varName];
96
+            } else if (isset($GLOBALS['log4php.LoggerMDC.ht'][$key])) {
97
+                return $GLOBALS['log4php.LoggerMDC.ht'][$key];
98
+            }
99
+        }
100
+        return '';
101
+    }
102 102
 
103
-	/**
104
-	 * Remove the the context identified by the key parameter. 
105
-	 *
106
-	 * It only affects user mappings.
107
-	 *
108
-	 * @param string $key
109
-	 * @return string
110
-	 * @static
111
-	 */
112
-	public static function remove($key) {
113
-		unset($GLOBALS['log4php.LoggerMDC.ht'][$key]);
114
-	}
103
+    /**
104
+     * Remove the the context identified by the key parameter. 
105
+     *
106
+     * It only affects user mappings.
107
+     *
108
+     * @param string $key
109
+     * @return string
110
+     * @static
111
+     */
112
+    public static function remove($key) {
113
+        unset($GLOBALS['log4php.LoggerMDC.ht'][$key]);
114
+    }
115 115
 
116 116
 }
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/layouts/LoggerLayoutSimple.php 1 patch
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Licensed to the Apache Software Foundation (ASF) under one or more
4
- * contributor license agreements.  See the NOTICE file distributed with
5
- * this work for additional information regarding copyright ownership.
6
- * The ASF licenses this file to You under the Apache License, Version 2.0
7
- * (the "License"); you may not use this file except in compliance with
8
- * the License.  You may obtain a copy of the License at
9
- *
10
- *     http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * @package log4php
19
- */
3
+     * Licensed to the Apache Software Foundation (ASF) under one or more
4
+     * contributor license agreements.  See the NOTICE file distributed with
5
+     * this work for additional information regarding copyright ownership.
6
+     * The ASF licenses this file to You under the Apache License, Version 2.0
7
+     * (the "License"); you may not use this file except in compliance with
8
+     * the License.  You may obtain a copy of the License at
9
+     *
10
+     *     http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     *
18
+     * @package log4php
19
+     */
20 20
 
21 21
 /**
22 22
  * A simple layout.
Please login to merge, or discard this patch.
main/inc/lib/phpdocx/lib/log4php/layouts/LoggerLayoutHtml.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,22 +1,22 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Licensed to the Apache Software Foundation (ASF) under one or more
4
- * contributor license agreements.  See the NOTICE file distributed with
5
- * this work for additional information regarding copyright ownership.
6
- * The ASF licenses this file to You under the Apache License, Version 2.0
7
- * (the "License"); you may not use this file except in compliance with
8
- * the License.  You may obtain a copy of the License at
9
- *
10
- *     http://www.apache.org/licenses/LICENSE-2.0
11
- *
12
- * Unless required by applicable law or agreed to in writing, software
13
- * distributed under the License is distributed on an "AS IS" BASIS,
14
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- * See the License for the specific language governing permissions and
16
- * limitations under the License.
17
- *
18
- * @package log4php
19
- */
3
+     * Licensed to the Apache Software Foundation (ASF) under one or more
4
+     * contributor license agreements.  See the NOTICE file distributed with
5
+     * this work for additional information regarding copyright ownership.
6
+     * The ASF licenses this file to You under the Apache License, Version 2.0
7
+     * (the "License"); you may not use this file except in compliance with
8
+     * the License.  You may obtain a copy of the License at
9
+     *
10
+     *     http://www.apache.org/licenses/LICENSE-2.0
11
+     *
12
+     * Unless required by applicable law or agreed to in writing, software
13
+     * distributed under the License is distributed on an "AS IS" BASIS,
14
+     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+     * See the License for the specific language governing permissions and
16
+     * limitations under the License.
17
+     *
18
+     * @package log4php
19
+     */
20 20
 
21 21
 /**
22 22
  * This layout outputs events in a HTML table.
@@ -145,15 +145,15 @@  discard block
 block discarded – undo
145 145
         $level = $event->getLevel();
146 146
         
147 147
         if ($level->equals(LoggerLevel::getLevelDebug())) {
148
-          $sbuf .= "<font color=\"#339933\">";
149
-          $sbuf .= $level->toString();
150
-          $sbuf .= "</font>";
148
+            $sbuf .= "<font color=\"#339933\">";
149
+            $sbuf .= $level->toString();
150
+            $sbuf .= "</font>";
151 151
         } else if ($level->equals(LoggerLevel::getLevelWarn())) {
152
-          $sbuf .= "<font color=\"#993300\"><strong>";
153
-          $sbuf .= $level->toString();
154
-          $sbuf .= "</strong></font>";
152
+            $sbuf .= "<font color=\"#993300\"><strong>";
153
+            $sbuf .= $level->toString();
154
+            $sbuf .= "</strong></font>";
155 155
         } else {
156
-          $sbuf .= $level->toString();
156
+            $sbuf .= $level->toString();
157 157
         }
158 158
         $sbuf .= "</td>" . PHP_EOL;
159 159
     
Please login to merge, or discard this patch.