Completed
Pull Request — 1.11.x (#1622)
by José
95:13 queued 68:43
created
main/reports/templates/courseTime.reports.php 2 patches
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -12,30 +12,30 @@
 block discarded – undo
12 12
 ');*/
13 13
 
14 14
 function reports_template_courseTime_getSQL() {
15
-	// fetch columns
16
-	$result = array();
17
-	$query = 'select r.id as kid, c.title as course '.
18
-		'from '.
19
-		Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '.
20
-		Database::get_main_table(TABLE_MAIN_COURSE).' c '.
21
-		'where r.course_id=c.id and r.tool_id is null and r.child_id is null'.
22
-		' order by c.title';
23
-	$columns = Database::query($query);
24
-	if (Database::num_rows($columns) == 0)
25
-		die('<b>'.get_lang('no data found: '.$query).'</b>');
26
-	$columns = Database::store_result($columns);
15
+    // fetch columns
16
+    $result = array();
17
+    $query = 'select r.id as kid, c.title as course '.
18
+        'from '.
19
+        Database::get_main_table(TABLE_MAIN_REPORTS_KEYS).' r, '.
20
+        Database::get_main_table(TABLE_MAIN_COURSE).' c '.
21
+        'where r.course_id=c.id and r.tool_id is null and r.child_id is null'.
22
+        ' order by c.title';
23
+    $columns = Database::query($query);
24
+    if (Database::num_rows($columns) == 0)
25
+        die('<b>'.get_lang('no data found: '.$query).'</b>');
26
+    $columns = Database::store_result($columns);
27 27
 
28
-	// fetch data
29
-	$query = 'select u.lastname Name, u.firstname Firstname';
30
-	foreach ($columns as $key => $column)
31
-		$query .= ', sec_to_time(k'.$key.'.report_time) as `'.
32
-				$column['course'].'` '; 
33
-	$query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
34
-	foreach ($columns as $key => $column) // fixme sessions
35
-		$query .= 'left outer join '.
36
-			Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
37
-			' k'.$key.
38
-			' on k'.$key.'.key_id = '.$column['kid'].
39
-				' and k'.$key.'.user_id = u.user_id ';
40
-	return $query;
28
+    // fetch data
29
+    $query = 'select u.lastname Name, u.firstname Firstname';
30
+    foreach ($columns as $key => $column)
31
+        $query .= ', sec_to_time(k'.$key.'.report_time) as `'.
32
+                $column['course'].'` '; 
33
+    $query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
34
+    foreach ($columns as $key => $column) // fixme sessions
35
+        $query .= 'left outer join '.
36
+            Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
37
+            ' k'.$key.
38
+            ' on k'.$key.'.key_id = '.$column['kid'].
39
+                ' and k'.$key.'.user_id = u.user_id ';
40
+    return $query;
41 41
 }
Please login to merge, or discard this patch.
Braces   +10 added lines, -6 removed lines patch added patch discarded remove patch
@@ -21,21 +21,25 @@
 block discarded – undo
21 21
 		'where r.course_id=c.id and r.tool_id is null and r.child_id is null'.
22 22
 		' order by c.title';
23 23
 	$columns = Database::query($query);
24
-	if (Database::num_rows($columns) == 0)
25
-		die('<b>'.get_lang('no data found: '.$query).'</b>');
24
+	if (Database::num_rows($columns) == 0) {
25
+			die('<b>'.get_lang('no data found: '.$query).'</b>');
26
+	}
26 27
 	$columns = Database::store_result($columns);
27 28
 
28 29
 	// fetch data
29 30
 	$query = 'select u.lastname Name, u.firstname Firstname';
30
-	foreach ($columns as $key => $column)
31
-		$query .= ', sec_to_time(k'.$key.'.report_time) as `'.
32
-				$column['course'].'` '; 
31
+	foreach ($columns as $key => $column) {
32
+			$query .= ', sec_to_time(k'.$key.'.report_time) as `'.
33
+				$column['course'].'` ';
34
+	}
33 35
 	$query .= ' from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
34
-	foreach ($columns as $key => $column) // fixme sessions
36
+	foreach ($columns as $key => $column) {
37
+	    // fixme sessions
35 38
 		$query .= 'left outer join '.
36 39
 			Database::get_main_table(TABLE_MAIN_REPORTS_VALUES).
37 40
 			' k'.$key.
38 41
 			' on k'.$key.'.key_id = '.$column['kid'].
39 42
 				' and k'.$key.'.user_id = u.user_id ';
43
+	}
40 44
 	return $query;
41 45
 }
Please login to merge, or discard this patch.
main/reports/reports.cli.php 2 patches
Indentation   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -4,55 +4,55 @@
 block discarded – undo
4 4
 require_once 'reports.lib.php';
5 5
 
6 6
 $longopts = array(
7
-	'course:',
8
-	'tool:',
9
-	'ci:',
10
-	'cn:',
11
-	'sci:',
12
-	'scn:',
13
-	'ssci:',
14
-	'sscn:',
15
-	'link:',
16
-	'addValue',
17
-	'addKey',
18
-	'help',
19
-	'clearAll',
20
-	'score:',
21
-	'progress:',
22
-	'time:',
23
-	'attempt:',
24
-	'session:',
25
-	'attempt:',
26
-	'uid:',
27
-	'key:',
28
-	'addDBKeys',
29
-	'build');
7
+    'course:',
8
+    'tool:',
9
+    'ci:',
10
+    'cn:',
11
+    'sci:',
12
+    'scn:',
13
+    'ssci:',
14
+    'sscn:',
15
+    'link:',
16
+    'addValue',
17
+    'addKey',
18
+    'help',
19
+    'clearAll',
20
+    'score:',
21
+    'progress:',
22
+    'time:',
23
+    'attempt:',
24
+    'session:',
25
+    'attempt:',
26
+    'uid:',
27
+    'key:',
28
+    'addDBKeys',
29
+    'build');
30 30
 
31 31
 $options = getopt("", $longopts);
32 32
 
33 33
 echo "\n\n";
34 34
 
35 35
 if (array_key_exists('help', $options))
36
-	echo "help message\n";
36
+    echo "help message\n";
37 37
 else if (array_key_exists('clearAll', $options)) {
38
-	reports_clearAll();
38
+    reports_clearAll();
39 39
 } else if (array_key_exists('build', $options)) {
40
-	reports_build();
40
+    reports_build();
41 41
 } else if (array_key_exists('addDBKeys', $options)) {
42
-	reports_addDBKeys();
42
+    reports_addDBKeys();
43 43
 } else if (array_key_exists('addValue', $options)) {
44
-	reports_addValue($options['key'], $options['session'], $options['uid'],
45
-			$options['attempt'], $options['score'],
46
-			$options['progress'], $options['time']);
44
+    reports_addValue($options['key'], $options['session'], $options['uid'],
45
+            $options['attempt'], $options['score'],
46
+            $options['progress'], $options['time']);
47 47
 } else if (array_key_exists('addKey', $options)) {
48
-	echo reports_addKey($options['course'], $options['tool'],
49
-			$options['ci'], $options['cn'],
50
-			$options['sci'], $options['scn'],
51
-			$options['ssci'], $options['sscn'],
52
-			$options['link']);
53
-	echo "\n";
48
+    echo reports_addKey($options['course'], $options['tool'],
49
+            $options['ci'], $options['cn'],
50
+            $options['sci'], $options['scn'],
51
+            $options['ssci'], $options['sscn'],
52
+            $options['link']);
53
+    echo "\n";
54 54
 } else
55
-	echo "action not found\n";
55
+    echo "action not found\n";
56 56
 
57 57
 echo "\n";
58 58
 ?>
Please login to merge, or discard this patch.
Braces   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@  discard block
 block discarded – undo
32 32
 
33 33
 echo "\n\n";
34 34
 
35
-if (array_key_exists('help', $options))
35
+if (array_key_exists('help', $options)) {
36 36
 	echo "help message\n";
37
-else if (array_key_exists('clearAll', $options)) {
37
+} else if (array_key_exists('clearAll', $options)) {
38 38
 	reports_clearAll();
39 39
 } else if (array_key_exists('build', $options)) {
40 40
 	reports_build();
@@ -51,8 +51,9 @@  discard block
 block discarded – undo
51 51
 			$options['ssci'], $options['sscn'],
52 52
 			$options['link']);
53 53
 	echo "\n";
54
-} else
54
+} else {
55 55
 	echo "action not found\n";
56
+}
56 57
 
57 58
 echo "\n";
58 59
 ?>
Please login to merge, or discard this patch.
main/reports/reports.php 3 patches
Indentation   +120 added lines, -120 removed lines patch added patch discarded remove patch
@@ -34,21 +34,21 @@  discard block
 block discarded – undo
34 34
 
35 35
 // "Link" type
36 36
 if ($_REQUEST['format'] == 'link') {
37
-	// converting post vars to get uri
38
-	$params = '';
39
-	$kv = array();
40
-	foreach ($_POST as $key => $value)
41
-		if ($key != 'format')
42
-			$kv[] = $key.'='.urlencode($value);
43
-	$query_string = join("&", $kv);
44
-	die('<a href="reports.php?format=directlink&'.$query_string.'">'.get_lang('ReportTypeLink').'</a>');
37
+    // converting post vars to get uri
38
+    $params = '';
39
+    $kv = array();
40
+    foreach ($_POST as $key => $value)
41
+        if ($key != 'format')
42
+            $kv[] = $key.'='.urlencode($value);
43
+    $query_string = join("&", $kv);
44
+    die('<a href="reports.php?format=directlink&'.$query_string.'">'.get_lang('ReportTypeLink').'</a>');
45 45
 }
46 46
 
47 47
 if ($_REQUEST['format'] == 'directlink') {
48
-	foreach (array('jquery.dataTables.min.js') as $js)
49
-		$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n";
48
+    foreach (array('jquery.dataTables.min.js') as $js)
49
+        $htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n";
50 50
 
51
-	$htmlCSSXtra[] = 'dataTable.css';
51
+    $htmlCSSXtra[] = 'dataTable.css';
52 52
 
53 53
 ?>
54 54
     <script type="text/javascript">
@@ -63,62 +63,62 @@  discard block
 block discarded – undo
63 63
 		}
64 64
     </script>
65 65
 <?php
66
-	Display::display_header($tool_name);
67
-	echo '<div id="result" class="result">';
66
+    Display::display_header($tool_name);
67
+    echo '<div id="result" class="result">';
68 68
 }
69 69
 
70 70
 // outputing a link to csv file instead of outputing csv data directly
71 71
 if ($_REQUEST['format'] == 'csv')  {
72
-	// converting post vars to get uri
73
-	$params = '';
74
-	$kv = array();
75
-	foreach ($_POST as $key => $value)
76
-		if ($key != 'format')
77
-			$kv[] = $key.'='.urlencode($value);
78
-	$query_string = join("&", $kv);
79
-	die('<a href="reports.php?format=downloadcsv&'.$query_string.'">'.get_lang('DownloadFile').'</a>');
72
+    // converting post vars to get uri
73
+    $params = '';
74
+    $kv = array();
75
+    foreach ($_POST as $key => $value)
76
+        if ($key != 'format')
77
+            $kv[] = $key.'='.urlencode($value);
78
+    $query_string = join("&", $kv);
79
+    die('<a href="reports.php?format=downloadcsv&'.$query_string.'">'.get_lang('DownloadFile').'</a>');
80 80
 } else if ($_REQUEST['format'] == 'downloadcsv') {
81
-	if ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) && (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') == false)) {
82
-		header("Pragma: must-revalidate");
83
-		header("Cache-Control: must-revalidate");
84
-		header("Content-type: application/vnd.ms-excel");
85
-	}
86
-	else {
87
-		header("Content-type: text/csv");
88
-	}
89
-	$date = date("Y-m-d");
90
-	$filename = "reporting-$date.csv";
91
-	header("Content-Disposition: attachment; filename=$filename");
92
-	$_REQUEST['format'] = 'csv';
81
+    if ((strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) && (strpos($_SERVER['HTTP_USER_AGENT'], 'Opera') == false)) {
82
+        header("Pragma: must-revalidate");
83
+        header("Cache-Control: must-revalidate");
84
+        header("Content-type: application/vnd.ms-excel");
85
+    }
86
+    else {
87
+        header("Content-type: text/csv");
88
+    }
89
+    $date = date("Y-m-d");
90
+    $filename = "reporting-$date.csv";
91
+    header("Content-Disposition: attachment; filename=$filename");
92
+    $_REQUEST['format'] = 'csv';
93 93
 }
94 94
 
95 95
 
96 96
 
97 97
 if (is_array($reports_template[$_REQUEST['type']])) {
98
-	$query = $reports_template[$_REQUEST['type']]['getSQL']();
99
-	if (! is_array($query))
100
-		$query = array($query);
101
-	if ($_REQUEST['format'] == 'sql')
102
-		die(var_export($query, true));
98
+    $query = $reports_template[$_REQUEST['type']]['getSQL']();
99
+    if (! is_array($query))
100
+        $query = array($query);
101
+    if ($_REQUEST['format'] == 'sql')
102
+        die(var_export($query, true));
103 103
 
104
-	$result = multiquery_query($query);
104
+    $result = multiquery_query($query);
105 105
 
106 106
 
107
-	// check number of result
108
-	$numberOfResult = multiquery_num_rows($result);
109
-	if ($numberOfResult == 0) {
110
-		// This case should be taken care of by the display template itself, we should let the script run
111
-		//die(get_lang('NoDataAvailable'));
112
-	}
107
+    // check number of result
108
+    $numberOfResult = multiquery_num_rows($result);
109
+    if ($numberOfResult == 0) {
110
+        // This case should be taken care of by the display template itself, we should let the script run
111
+        //die(get_lang('NoDataAvailable'));
112
+    }
113 113
 } else {
114
-	die('<b>'.get_lang('ErrorWhileBuildingReport').'</b>');
114
+    die('<b>'.get_lang('ErrorWhileBuildingReport').'</b>');
115 115
 }
116 116
 
117 117
 if ($_REQUEST['format'] == 'html' || $_REQUEST['format'] == 'directlink') {
118
-	if (isset($reports_template[$_REQUEST['type']]['html_header'])) {
119
-		echo $reports_template[$_REQUEST['type']]['html_header'];
120
-	}
121
-	echo '<script type="text/javascript" charset="utf-8">
118
+    if (isset($reports_template[$_REQUEST['type']]['html_header'])) {
119
+        echo $reports_template[$_REQUEST['type']]['html_header'];
120
+    }
121
+    echo '<script type="text/javascript" charset="utf-8">
122 122
 			$(document).ready(function() {
123 123
 
124 124
 				$("#reportsData'.$idsuffix.'").dataTable({
@@ -143,50 +143,50 @@  discard block
 block discarded – undo
143 143
 				});
144 144
 			} );
145 145
 		</script>';
146
-	echo '<table id="reportsData'.$idsuffix.'" class="display">'; // FIXME style
147
-
148
-	// counting fields
149
-	$nfields = multiquery_num_fields($result);
150
-	$columns = array();
151
-	$columns_islink = array();
152
-	echo '<thead><tr>';
153
-	for ($i=0; $i < $nfields; $i++)	{
154
-		$columns[$i] = multiquery_field_name($result, $i);
155
-		if (substr($columns[$i], -5, 5) != '_link') {
156
-			$column_islink[$i] = false;
157
-			echo '<th>'.$columns[$i].'</th>';
158
-		} else
159
-			$columns_islink[$i] = true;
160
-	}
161
-
162
-	// checking resolving link column id
163
-	$columns_flip = array_flip($columns);
164
-	$columns_link = array();
165
-	for ($i=0; $i < $nfields; $i++)
166
-		if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip))
167
-			$columns_link[$i] = $columns_flip[$columns[$i].'_link'];
168
-		else
169
-			$columns_link[$i] = '';
170
-	echo '</tr></thead><tbody>';
171
-	while ($row = multiquery_fetch_row($result)) {
172
-		echo '<tr>';
173
-		for ($i = 0; $i<$nfields; $i++)
174
-			if (!$columns_islink[$i]){ // ignore links
175
-				if ($columns_link[$i] != '') // link is defined
176
-					if (substr($columns_link[$i],0,10) == 'javascript') {
177
-						echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
178
-					}
179
-					else {
180
-						echo '<td><a href="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
181
-					}
182
-				else
183
-					echo '<td>'.$row[$i].'</td>';
184
-			}
185
-		echo "</tr>\n";
186
-	}
187
-	echo '</tbody></table>';
188
-	if ($_REQUEST['format'] == 'directlink') {
189
-		echo '</div>
146
+    echo '<table id="reportsData'.$idsuffix.'" class="display">'; // FIXME style
147
+
148
+    // counting fields
149
+    $nfields = multiquery_num_fields($result);
150
+    $columns = array();
151
+    $columns_islink = array();
152
+    echo '<thead><tr>';
153
+    for ($i=0; $i < $nfields; $i++)	{
154
+        $columns[$i] = multiquery_field_name($result, $i);
155
+        if (substr($columns[$i], -5, 5) != '_link') {
156
+            $column_islink[$i] = false;
157
+            echo '<th>'.$columns[$i].'</th>';
158
+        } else
159
+            $columns_islink[$i] = true;
160
+    }
161
+
162
+    // checking resolving link column id
163
+    $columns_flip = array_flip($columns);
164
+    $columns_link = array();
165
+    for ($i=0; $i < $nfields; $i++)
166
+        if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip))
167
+            $columns_link[$i] = $columns_flip[$columns[$i].'_link'];
168
+        else
169
+            $columns_link[$i] = '';
170
+    echo '</tr></thead><tbody>';
171
+    while ($row = multiquery_fetch_row($result)) {
172
+        echo '<tr>';
173
+        for ($i = 0; $i<$nfields; $i++)
174
+            if (!$columns_islink[$i]){ // ignore links
175
+                if ($columns_link[$i] != '') // link is defined
176
+                    if (substr($columns_link[$i],0,10) == 'javascript') {
177
+                        echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
178
+                    }
179
+                    else {
180
+                        echo '<td><a href="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
181
+                    }
182
+                else
183
+                    echo '<td>'.$row[$i].'</td>';
184
+            }
185
+        echo "</tr>\n";
186
+    }
187
+    echo '</tbody></table>';
188
+    if ($_REQUEST['format'] == 'directlink') {
189
+        echo '</div>
190 190
 		<div id="result2" class="result" style="margin: 50px;">
191 191
 		</div>
192 192
 		<div id="result3" class="result" style="margin: 100px;">
@@ -194,36 +194,36 @@  discard block
 block discarded – undo
194 194
 		<div id="result4" class="result" style="margin: 150px;">
195 195
 		</div>';
196 196
 
197
-		Display::display_footer();
197
+        Display::display_footer();
198 198
 
199
-	}
199
+    }
200 200
 } else if ($_REQUEST['format'] == 'csv') {
201
-	$nfields = multiquery_num_fields($result);
202
-	$columns = array();
203
-	$columns_islink = array();
204
-	for ($i=0; $i < $nfields; $i++)	{
205
-		$columns[$i] = multiquery_field_name($result, $i);
206
-		if (substr($columns[$i], -5, 5) != '_link') {
207
-			$column_islink[$i] = false;
208
-			echo csv_escaping($columns[$i]).',';
209
-		} else
210
-			$columns_islink[$i] = true;
211
-	}
212
-
213
-	echo "\n";
214
-	while ($row = multiquery_fetch_row($result)) {
215
-		for ($i = 0; $i<$nfields; $i++)
216
-			if (!$columns_islink[$i]) // ignore links
217
-				echo csv_escaping($row[$i]).',';  // fixme
218
-		echo "\n";
219
-	}
201
+    $nfields = multiquery_num_fields($result);
202
+    $columns = array();
203
+    $columns_islink = array();
204
+    for ($i=0; $i < $nfields; $i++)	{
205
+        $columns[$i] = multiquery_field_name($result, $i);
206
+        if (substr($columns[$i], -5, 5) != '_link') {
207
+            $column_islink[$i] = false;
208
+            echo csv_escaping($columns[$i]).',';
209
+        } else
210
+            $columns_islink[$i] = true;
211
+    }
212
+
213
+    echo "\n";
214
+    while ($row = multiquery_fetch_row($result)) {
215
+        for ($i = 0; $i<$nfields; $i++)
216
+            if (!$columns_islink[$i]) // ignore links
217
+                echo csv_escaping($row[$i]).',';  // fixme
218
+        echo "\n";
219
+    }
220 220
 } else die(get_lang('UnknownFormat'));
221 221
 
222 222
 function csv_escaping($value, $csv_separator = ',') {
223
-	$value = str_replace('"','""',$value);
224
-	if (strpos($value, '""') or strpos($value, $csv_separator) or $value != trim($value) ) {
225
-		$value = '"'.$value.'"';
226
-	}
227
-	return $value;
223
+    $value = str_replace('"','""',$value);
224
+    if (strpos($value, '""') or strpos($value, $csv_separator) or $value != trim($value) ) {
225
+        $value = '"'.$value.'"';
226
+    }
227
+    return $value;
228 228
 }
229 229
 ?>
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 $this_section = SECTION_REPORTS;
25 25
 
26 26
 // setting the name of the tool
27
-$tool_name=get_lang('Reports');
27
+$tool_name = get_lang('Reports');
28 28
 
29 29
 // loading templates
30 30
 reports_loadTemplates();
@@ -68,7 +68,7 @@  discard block
 block discarded – undo
68 68
 }
69 69
 
70 70
 // outputing a link to csv file instead of outputing csv data directly
71
-if ($_REQUEST['format'] == 'csv')  {
71
+if ($_REQUEST['format'] == 'csv') {
72 72
 	// converting post vars to get uri
73 73
 	$params = '';
74 74
 	$kv = array();
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 
97 97
 if (is_array($reports_template[$_REQUEST['type']])) {
98 98
 	$query = $reports_template[$_REQUEST['type']]['getSQL']();
99
-	if (! is_array($query))
99
+	if (!is_array($query))
100 100
 		$query = array($query);
101 101
 	if ($_REQUEST['format'] == 'sql')
102 102
 		die(var_export($query, true));
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
 	$columns = array();
151 151
 	$columns_islink = array();
152 152
 	echo '<thead><tr>';
153
-	for ($i=0; $i < $nfields; $i++)	{
153
+	for ($i = 0; $i < $nfields; $i++) {
154 154
 		$columns[$i] = multiquery_field_name($result, $i);
155 155
 		if (substr($columns[$i], -5, 5) != '_link') {
156 156
 			$column_islink[$i] = false;
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
 	// checking resolving link column id
163 163
 	$columns_flip = array_flip($columns);
164 164
 	$columns_link = array();
165
-	for ($i=0; $i < $nfields; $i++)
165
+	for ($i = 0; $i < $nfields; $i++)
166 166
 		if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip))
167 167
 			$columns_link[$i] = $columns_flip[$columns[$i].'_link'];
168 168
 		else
@@ -170,10 +170,10 @@  discard block
 block discarded – undo
170 170
 	echo '</tr></thead><tbody>';
171 171
 	while ($row = multiquery_fetch_row($result)) {
172 172
 		echo '<tr>';
173
-		for ($i = 0; $i<$nfields; $i++)
174
-			if (!$columns_islink[$i]){ // ignore links
173
+		for ($i = 0; $i < $nfields; $i++)
174
+			if (!$columns_islink[$i]) { // ignore links
175 175
 				if ($columns_link[$i] != '') // link is defined
176
-					if (substr($columns_link[$i],0,10) == 'javascript') {
176
+					if (substr($columns_link[$i], 0, 10) == 'javascript') {
177 177
 						echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
178 178
 					}
179 179
 					else {
@@ -201,7 +201,7 @@  discard block
 block discarded – undo
201 201
 	$nfields = multiquery_num_fields($result);
202 202
 	$columns = array();
203 203
 	$columns_islink = array();
204
-	for ($i=0; $i < $nfields; $i++)	{
204
+	for ($i = 0; $i < $nfields; $i++) {
205 205
 		$columns[$i] = multiquery_field_name($result, $i);
206 206
 		if (substr($columns[$i], -5, 5) != '_link') {
207 207
 			$column_islink[$i] = false;
@@ -212,16 +212,16 @@  discard block
 block discarded – undo
212 212
 
213 213
 	echo "\n";
214 214
 	while ($row = multiquery_fetch_row($result)) {
215
-		for ($i = 0; $i<$nfields; $i++)
215
+		for ($i = 0; $i < $nfields; $i++)
216 216
 			if (!$columns_islink[$i]) // ignore links
217
-				echo csv_escaping($row[$i]).',';  // fixme
217
+				echo csv_escaping($row[$i]).','; // fixme
218 218
 		echo "\n";
219 219
 	}
220 220
 } else die(get_lang('UnknownFormat'));
221 221
 
222 222
 function csv_escaping($value, $csv_separator = ',') {
223
-	$value = str_replace('"','""',$value);
224
-	if (strpos($value, '""') or strpos($value, $csv_separator) or $value != trim($value) ) {
223
+	$value = str_replace('"', '""', $value);
224
+	if (strpos($value, '""') or strpos($value, $csv_separator) or $value != trim($value)) {
225 225
 		$value = '"'.$value.'"';
226 226
 	}
227 227
 	return $value;
Please login to merge, or discard this patch.
Braces   +43 added lines, -31 removed lines patch added patch discarded remove patch
@@ -37,16 +37,18 @@  discard block
 block discarded – undo
37 37
 	// converting post vars to get uri
38 38
 	$params = '';
39 39
 	$kv = array();
40
-	foreach ($_POST as $key => $value)
41
-		if ($key != 'format')
40
+	foreach ($_POST as $key => $value) {
41
+			if ($key != 'format')
42 42
 			$kv[] = $key.'='.urlencode($value);
43
+	}
43 44
 	$query_string = join("&", $kv);
44 45
 	die('<a href="reports.php?format=directlink&'.$query_string.'">'.get_lang('ReportTypeLink').'</a>');
45 46
 }
46 47
 
47 48
 if ($_REQUEST['format'] == 'directlink') {
48
-	foreach (array('jquery.dataTables.min.js') as $js)
49
-		$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n";
49
+	foreach (array('jquery.dataTables.min.js') as $js) {
50
+			$htmlHeadXtra[] = '<script src="'.api_get_path(WEB_LIBRARY_PATH).'javascript/'.$js.'" type="text/javascript" language="javascript"></script>'."\n";
51
+	}
50 52
 
51 53
 	$htmlCSSXtra[] = 'dataTable.css';
52 54
 
@@ -72,9 +74,10 @@  discard block
 block discarded – undo
72 74
 	// converting post vars to get uri
73 75
 	$params = '';
74 76
 	$kv = array();
75
-	foreach ($_POST as $key => $value)
76
-		if ($key != 'format')
77
+	foreach ($_POST as $key => $value) {
78
+			if ($key != 'format')
77 79
 			$kv[] = $key.'='.urlencode($value);
80
+	}
78 81
 	$query_string = join("&", $kv);
79 82
 	die('<a href="reports.php?format=downloadcsv&'.$query_string.'">'.get_lang('DownloadFile').'</a>');
80 83
 } else if ($_REQUEST['format'] == 'downloadcsv') {
@@ -82,8 +85,7 @@  discard block
 block discarded – undo
82 85
 		header("Pragma: must-revalidate");
83 86
 		header("Cache-Control: must-revalidate");
84 87
 		header("Content-type: application/vnd.ms-excel");
85
-	}
86
-	else {
88
+	} else {
87 89
 		header("Content-type: text/csv");
88 90
 	}
89 91
 	$date = date("Y-m-d");
@@ -96,10 +98,12 @@  discard block
 block discarded – undo
96 98
 
97 99
 if (is_array($reports_template[$_REQUEST['type']])) {
98 100
 	$query = $reports_template[$_REQUEST['type']]['getSQL']();
99
-	if (! is_array($query))
100
-		$query = array($query);
101
-	if ($_REQUEST['format'] == 'sql')
102
-		die(var_export($query, true));
101
+	if (! is_array($query)) {
102
+			$query = array($query);
103
+	}
104
+	if ($_REQUEST['format'] == 'sql') {
105
+			die(var_export($query, true));
106
+	}
103 107
 
104 108
 	$result = multiquery_query($query);
105 109
 
@@ -155,32 +159,35 @@  discard block
 block discarded – undo
155 159
 		if (substr($columns[$i], -5, 5) != '_link') {
156 160
 			$column_islink[$i] = false;
157 161
 			echo '<th>'.$columns[$i].'</th>';
158
-		} else
159
-			$columns_islink[$i] = true;
162
+		} else {
163
+					$columns_islink[$i] = true;
164
+		}
160 165
 	}
161 166
 
162 167
 	// checking resolving link column id
163 168
 	$columns_flip = array_flip($columns);
164 169
 	$columns_link = array();
165
-	for ($i=0; $i < $nfields; $i++)
166
-		if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip))
170
+	for ($i=0; $i < $nfields; $i++) {
171
+			if ($column_islink[$i] == false && array_key_exists($columns[$i].'_link', $columns_flip))
167 172
 			$columns_link[$i] = $columns_flip[$columns[$i].'_link'];
168
-		else
169
-			$columns_link[$i] = '';
173
+	}
174
+		else {
175
+					$columns_link[$i] = '';
176
+		}
170 177
 	echo '</tr></thead><tbody>';
171 178
 	while ($row = multiquery_fetch_row($result)) {
172 179
 		echo '<tr>';
173
-		for ($i = 0; $i<$nfields; $i++)
174
-			if (!$columns_islink[$i]){ // ignore links
180
+		for ($i = 0; $i<$nfields; $i++) {
181
+					if (!$columns_islink[$i]){ // ignore links
175 182
 				if ($columns_link[$i] != '') // link is defined
176 183
 					if (substr($columns_link[$i],0,10) == 'javascript') {
177 184
 						echo '<td><a href="#" onclick="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
178
-					}
179
-					else {
185
+		}
186
+					} else {
180 187
 						echo '<td><a href="'.$row[$columns_link[$i]].'">'.$row[$i].'</a></td>';
181
-					}
182
-				else
183
-					echo '<td>'.$row[$i].'</td>';
188
+					} else {
189
+									echo '<td>'.$row[$i].'</td>';
190
+				}
184 191
 			}
185 192
 		echo "</tr>\n";
186 193
 	}
@@ -206,18 +213,23 @@  discard block
 block discarded – undo
206 213
 		if (substr($columns[$i], -5, 5) != '_link') {
207 214
 			$column_islink[$i] = false;
208 215
 			echo csv_escaping($columns[$i]).',';
209
-		} else
210
-			$columns_islink[$i] = true;
216
+		} else {
217
+					$columns_islink[$i] = true;
218
+		}
211 219
 	}
212 220
 
213 221
 	echo "\n";
214 222
 	while ($row = multiquery_fetch_row($result)) {
215
-		for ($i = 0; $i<$nfields; $i++)
216
-			if (!$columns_islink[$i]) // ignore links
217
-				echo csv_escaping($row[$i]).',';  // fixme
223
+		for ($i = 0; $i<$nfields; $i++) {
224
+					if (!$columns_islink[$i]) // ignore links
225
+				echo csv_escaping($row[$i]).',';
226
+		}
227
+		// fixme
218 228
 		echo "\n";
219 229
 	}
220
-} else die(get_lang('UnknownFormat'));
230
+} else {
231
+    die(get_lang('UnknownFormat'));
232
+}
221 233
 
222 234
 function csv_escaping($value, $csv_separator = ',') {
223 235
 	$value = str_replace('"','""',$value);
Please login to merge, or discard this patch.
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   +208 added lines, -208 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
 $filename = 'reporting.xlsx';
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,226 +23,226 @@  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).'lp/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).'lp/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($column, $line, $header);
224
-		$column++;
225
-	}
226
-	$line++;
227
-	foreach ($array as $row) {
228
-		$column = 0;
229
-		foreach ($row as $item) {
219
+    $line = 0;
220
+    $column = 0; //skip the first column (row titles)
221
+
222
+    foreach ($headers as $header) {
223
+        $worksheet->setCellValueByColumnAndRow($column, $line, $header);
224
+        $column++;
225
+    }
226
+    $line++;
227
+    foreach ($array as $row) {
228
+        $column = 0;
229
+        foreach ($row as $item) {
230 230
             $worksheet->setCellValueByColumnAndRow(
231 231
                 $column,
232 232
                 $line,
233 233
                 html_entity_decode(strip_tags($item))
234 234
             );
235
-			$column++;
236
-		}
237
-		$line++;
238
-	}
239
-	$line++;
235
+            $column++;
236
+        }
237
+        $line++;
238
+    }
239
+    $line++;
240 240
 
241 241
     $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename);
242 242
     $writer = new PHPExcel_Writer_Excel2007($spreadsheet);
243 243
     $writer->save($file);
244 244
     DocumentManager::file_send_for_download($file, true, $filename);
245
-	exit;
245
+    exit;
246 246
 }
247 247
 
248 248
 $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
@@ -253,20 +253,20 @@  discard block
 block discarded – undo
253 253
 $row = 0;
254 254
 $column = 0;
255 255
 foreach ($headers as $header) {
256
-	$table->setHeaderContents($row, $column, $header);
257
-	$column++;
256
+    $table->setHeaderContents($row, $column, $header);
257
+    $column++;
258 258
 }
259 259
 $row++;
260 260
 
261 261
 foreach ($array as $row_table) {
262
-	$column = 0;
263
-	foreach ($row_table as $cell) {
264
-		$table->setCellContents($row, $column, $cell);
265
-		//$table->updateCellAttributes($row, $column, 'align="center"');
266
-		$column++;
267
-	}
268
-	$table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
269
-	$row++;
262
+    $column = 0;
263
+    foreach ($row_table as $cell) {
264
+        $table->setCellContents($row, $column, $cell);
265
+        //$table->updateCellAttributes($row, $column, 'align="center"');
266
+        $column++;
267
+    }
268
+    $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true);
269
+    $row++;
270 270
 }
271 271
 
272 272
 echo '<div class="actions">';
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/coaches.php 2 patches
Indentation   +77 added lines, -77 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
20 20
 
21 21
 if (isset($_GET["id_student"])) {
22
-	$interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang('Students'));
22
+    $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang('Students'));
23 23
 }
24 24
 
25 25
 Display :: display_header($nameTools);
@@ -41,26 +41,26 @@  discard block
 block discarded – undo
41 41
  */
42 42
 
43 43
 if (isset($_POST['export'])) {
44
-	$order_clause = api_is_western_name_order(PERSON_NAME_DATA_EXPORT) ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
44
+    $order_clause = api_is_western_name_order(PERSON_NAME_DATA_EXPORT) ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
45 45
 } else {
46
-	$order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
46
+    $order_clause = api_sort_by_first_name() ? ' ORDER BY firstname, lastname' : ' ORDER BY lastname, firstname';
47 47
 }
48 48
 
49 49
 if (isset($_GET["id_student"])) {
50
-	$id_student = intval($_GET["id_student"]);
51
-	$sql_coachs = "SELECT DISTINCT srcru.user_id as id_coach
50
+    $id_student = intval($_GET["id_student"]);
51
+    $sql_coachs = "SELECT DISTINCT srcru.user_id as id_coach
52 52
 		FROM $tbl_session_rel_course_rel_user as srcru
53 53
 		WHERE srcru.user_id='$id_student' AND srcru.status=2";
54 54
 } else {
55
-	if (api_is_platform_admin()) {
56
-		$sql_coachs = "SELECT DISTINCT
55
+    if (api_is_platform_admin()) {
56
+        $sql_coachs = "SELECT DISTINCT
57 57
 			srcru.user_id as id_coach, user_id, lastname, firstname
58 58
 			FROM $tbl_user, $tbl_session_rel_course_rel_user srcru
59 59
 			WHERE
60 60
 			 	srcru.user_id=user_id AND
61 61
 			 	srcru.status=2 ".$order_clause;
62
-	} else {
63
-		$sql_coachs = "SELECT DISTINCT user_id as id_coach, user.user_id, lastname, firstname
62
+    } else {
63
+        $sql_coachs = "SELECT DISTINCT user_id as id_coach, user.user_id, lastname, firstname
64 64
 			FROM
65 65
 			$tbl_user as user,
66 66
 			$tbl_session_rel_course_user as srcu,
@@ -74,13 +74,13 @@  discard block
 block discarded – undo
74 74
 				srcu.user_id = user.user_id AND
75 75
 				srcu.status = 2
76 76
 				".$order_clause;
77
-	}
77
+    }
78 78
 }
79 79
 
80 80
 $result_coachs = Database::query($sql_coachs);
81 81
 
82 82
 if (api_is_western_name_order()) {
83
-	echo '<table class="data_table">
83
+    echo '<table class="data_table">
84 84
 	    <tr>
85 85
             <th>'.get_lang('FirstName').'</th>
86 86
             <th>'.get_lang('LastName').'</th>
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
             <th>'.get_lang('Students').'</th>
90 90
         </tr>';
91 91
 } else {
92
-	echo '<table class="data_table">
92
+    echo '<table class="data_table">
93 93
 	        <tr>
94 94
                 <th>'.get_lang('LastName').'</th>
95 95
                 <th>'.get_lang('FirstName').'</th>
@@ -100,79 +100,79 @@  discard block
 block discarded – undo
100 100
 }
101 101
 
102 102
 if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) {
103
-	$header[] = get_lang('FirstName', '');
104
-	$header[] = get_lang('LastName', '');
103
+    $header[] = get_lang('FirstName', '');
104
+    $header[] = get_lang('LastName', '');
105 105
 } else {
106
-	$header[] = get_lang('LastName', '');
107
-	$header[] = get_lang('FirstName', '');
106
+    $header[] = get_lang('LastName', '');
107
+    $header[] = get_lang('FirstName', '');
108 108
 }
109 109
 $header[] = get_lang('ConnectionTime', '');
110 110
 
111 111
 if (Database::num_rows($result_coachs) > 0) {
112
-	while ($coachs = Database::fetch_array($result_coachs)) {
113
-		$id_coach = $coachs["id_coach"];
112
+    while ($coachs = Database::fetch_array($result_coachs)) {
113
+        $id_coach = $coachs["id_coach"];
114 114
 
115
-		if (isset($_GET["id_student"])) {
116
-			$sql_infos_coach = "SELECT lastname, firstname
115
+        if (isset($_GET["id_student"])) {
116
+            $sql_infos_coach = "SELECT lastname, firstname
117 117
             FROM $tbl_user
118 118
             WHERE user_id='$id_coach'";
119
-			$result_coachs_infos = Database::query($sql_infos_coach);
120
-			$lastname = Database::result($result_coachs_infos, 0, "lastname");
121
-			$firstname = Database::result($result_coachs_infos, 0, "firstname");
122
-		} else {
123
-			$lastname = $coachs["lastname"];
124
-			$firstname = $coachs["firstname"];
125
-		}
126
-
127
-		$sql_connection_time = "SELECT login_date, logout_date
119
+            $result_coachs_infos = Database::query($sql_infos_coach);
120
+            $lastname = Database::result($result_coachs_infos, 0, "lastname");
121
+            $firstname = Database::result($result_coachs_infos, 0, "firstname");
122
+        } else {
123
+            $lastname = $coachs["lastname"];
124
+            $firstname = $coachs["firstname"];
125
+        }
126
+
127
+        $sql_connection_time = "SELECT login_date, logout_date
128 128
         FROM $tbl_track_login
129 129
         WHERE login_user_id ='$id_coach' AND logout_date <> 'null'";
130
-		$result_connection_time = Database::query($sql_connection_time);
131
-
132
-		$nb_seconds = 0;
133
-		while ($connections = Database::fetch_array($result_connection_time)) {
134
-			$login_date = $connections["login_date"];
135
-			$logout_date = $connections["logout_date"];
136
-			$timestamp_login_date = strtotime($login_date);
137
-			$timestamp_logout_date = strtotime($logout_date);
138
-			$nb_seconds += ($timestamp_logout_date - $timestamp_login_date);
139
-		}
140
-
141
-		if ($nb_seconds == 0) {
142
-			$s_connection_time = '';
143
-		} else {
144
-			$s_connection_time = api_time_to_hms($nb_seconds);
145
-		}
146
-
147
-		if ($i % 2 == 0) {
148
-			$css_class = "row_odd";
149
-			if ($i % 20 == 0 && $i != 0) {
150
-				if (api_is_western_name_order()) {
151
-					echo '<tr>
130
+        $result_connection_time = Database::query($sql_connection_time);
131
+
132
+        $nb_seconds = 0;
133
+        while ($connections = Database::fetch_array($result_connection_time)) {
134
+            $login_date = $connections["login_date"];
135
+            $logout_date = $connections["logout_date"];
136
+            $timestamp_login_date = strtotime($login_date);
137
+            $timestamp_logout_date = strtotime($logout_date);
138
+            $nb_seconds += ($timestamp_logout_date - $timestamp_login_date);
139
+        }
140
+
141
+        if ($nb_seconds == 0) {
142
+            $s_connection_time = '';
143
+        } else {
144
+            $s_connection_time = api_time_to_hms($nb_seconds);
145
+        }
146
+
147
+        if ($i % 2 == 0) {
148
+            $css_class = "row_odd";
149
+            if ($i % 20 == 0 && $i != 0) {
150
+                if (api_is_western_name_order()) {
151
+                    echo '<tr>
152 152
 					    <th>'.get_lang('FirstName').'</th>
153 153
                         <th>'.get_lang('LastName').'</th>
154 154
                         <th>'.get_lang('ConnectionTime').'</th>
155 155
                         <th>'.get_lang('AdminCourses').'</th>
156 156
                         <th>'.get_lang('Students').'</th>
157 157
 					</tr>';
158
-				} else {
159
-					echo '<tr>
158
+                } else {
159
+                    echo '<tr>
160 160
 					    <th>'.get_lang('LastName').'</th>
161 161
                         <th>'.get_lang('FirstName').'</th>
162 162
                         <th>'.get_lang('ConnectionTime').'</th>
163 163
                         <th>'.get_lang('AdminCourses').'</th>
164 164
                         <th>'.get_lang('Students').'</th>
165 165
 					</tr>';
166
-				}
167
-			}
168
-		} else {
169
-			$css_class = "row_even";
170
-		}
166
+                }
167
+            }
168
+        } else {
169
+            $css_class = "row_even";
170
+        }
171 171
 
172
-		$i++;
172
+        $i++;
173 173
 
174
-		if (api_is_western_name_order()) {
175
-			echo '<tr class="'.$css_class.'">
174
+        if (api_is_western_name_order()) {
175
+            echo '<tr class="'.$css_class.'">
176 176
 			        <td>'.$firstname.'</td><td>'.$lastname.'</td><td>'.$s_connection_time.'</td>
177 177
 			        <td>
178 178
 			            <a href="course.php?type=coach&user_id='.$id_coach.'">
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 			            </a>
186 186
 			            </td>
187 187
                     </tr>';
188
-		} else {
189
-			echo '<tr class="'.$css_class.'">
188
+        } else {
189
+            echo '<tr class="'.$css_class.'">
190 190
 			        <td>'.$lastname.'</td><td>'.$firstname.'</td>
191 191
 			        <td>'.$s_connection_time.'</td>
192 192
 			        <td>
@@ -197,25 +197,25 @@  discard block
 block discarded – undo
197 197
                         '.Display::return_icon('2rightarrow.png', get_lang('Details')).'</a>
198 198
                     </td>
199 199
                     </tr>';
200
-		}
201
-
202
-		if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) {
203
-			$data[$id_coach]["firstname"] = $firstname;
204
-			$data[$id_coach]["lastname"] = $lastname;
205
-		} else {
206
-			$data[$id_coach]["lastname"] = $lastname;
207
-			$data[$id_coach]["firstname"] = $firstname;
208
-		}
209
-		$data[$id_coach]["connection_time"] = $s_connection_time;
210
-	}
200
+        }
201
+
202
+        if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) {
203
+            $data[$id_coach]["firstname"] = $firstname;
204
+            $data[$id_coach]["lastname"] = $lastname;
205
+        } else {
206
+            $data[$id_coach]["lastname"] = $lastname;
207
+            $data[$id_coach]["firstname"] = $firstname;
208
+        }
209
+        $data[$id_coach]["connection_time"] = $s_connection_time;
210
+    }
211 211
 } else {
212
-	// No results
213
-	echo '<tr><td colspan="5">'.get_lang("NoResult").'</td></tr>';
212
+    // No results
213
+    echo '<tr><td colspan="5">'.get_lang("NoResult").'</td></tr>';
214 214
 }
215 215
 echo '</table>';
216 216
 
217 217
 if (isset($_POST['export'])){
218
-	export_csv($header, $data, 'coaches.csv');
218
+    export_csv($header, $data, 'coaches.csv');
219 219
 }
220 220
 
221 221
 echo "<br /><br />";
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,10 +16,10 @@  discard block
 block discarded – undo
16 16
 $nameTools = get_lang('Tutors');
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
 
21 21
 if (isset($_GET["id_student"])) {
22
-	$interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang('Students'));
22
+	$interbreadcrumb[] = array("url" => "student.php", "name" => get_lang('Students'));
23 23
 }
24 24
 
25 25
 Display :: display_header($nameTools);
@@ -27,14 +27,14 @@  discard block
 block discarded – undo
27 27
 api_display_tool_title($nameTools);
28 28
 
29 29
 // Database Table Definitions
30
-$tbl_course 						= Database :: get_main_table(TABLE_MAIN_COURSE);
31
-$tbl_course_user 					= Database :: get_main_table(TABLE_MAIN_COURSE_USER);
32
-$tbl_user 							= Database :: get_main_table(TABLE_MAIN_USER);
33
-$tbl_session 						= Database :: get_main_table(TABLE_MAIN_SESSION);
34
-$tbl_session_rel_course 			= Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
35
-$tbl_session_rel_course_rel_user 	= Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
36
-$tbl_session_rel_user 				= Database :: get_main_table(TABLE_MAIN_SESSION_USER);
37
-$tbl_track_login 					= Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
30
+$tbl_course = Database :: get_main_table(TABLE_MAIN_COURSE);
31
+$tbl_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
32
+$tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
33
+$tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
34
+$tbl_session_rel_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
35
+$tbl_session_rel_course_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
36
+$tbl_session_rel_user = Database :: get_main_table(TABLE_MAIN_SESSION_USER);
37
+$tbl_track_login = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN);
38 38
 
39 39
 /**
40 40
  * MAIN PART
@@ -214,7 +214,7 @@  discard block
 block discarded – undo
214 214
 }
215 215
 echo '</table>';
216 216
 
217
-if (isset($_POST['export'])){
217
+if (isset($_POST['export'])) {
218 218
 	export_csv($header, $data, 'coaches.csv');
219 219
 }
220 220
 
@@ -222,8 +222,8 @@  discard block
 block discarded – undo
222 222
 echo "
223 223
     <br /><br />
224 224
     <form method='post' action='coaches.php'>
225
-        <button type='submit' class='save' name='export' value='" . get_lang('ExportExcel') . "'>
226
-            " . get_lang('ExportExcel') . "
225
+        <button type='submit' class='save' name='export' value='" . get_lang('ExportExcel')."'>
226
+            " . get_lang('ExportExcel')."
227 227
         </button>
228 228
     <form>
229 229
 ";
Please login to merge, or discard this patch.
main/mySpace/user_import.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -15,12 +15,12 @@  discard block
 block discarded – undo
15 15
 $tool_name = get_lang('ImportUserListXMLCSV');
16 16
 api_block_anonymous_users();
17 17
 
18
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
18
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('MySpace'));
19 19
 $id_session = '';
20 20
 if (isset($_GET['id_session']) && $_GET['id_session'] != '') {
21 21
  	$id_session = intval($_GET['id_session']);
22
-	$interbreadcrumb[] = array ('url' => 'session.php', 'name' => get_lang('Sessions'));
23
-	$interbreadcrumb[] = array ('url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course'));
22
+	$interbreadcrumb[] = array('url' => 'session.php', 'name' => get_lang('Sessions'));
23
+	$interbreadcrumb[] = array('url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course'));
24 24
 }
25 25
 
26 26
 // Set this option to true to enforce strict purification for usenames.
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
 
63 63
         if (count($errors) == 0) {
64 64
             if (!empty($id_session)) {
65
-                $tbl_session_rel_course	= Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
65
+                $tbl_session_rel_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
66 66
                 // Selecting all the courses from the session id requested.
67 67
                 $sql = "SELECT c_id FROM $tbl_session_rel_course WHERE session_id ='$id_session'";
68 68
                 $result = Database::query($sql);
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 
104 104
 $form = new FormValidator('user_import');
105 105
 $form->addElement('hidden', 'formSent');
106
-$form->addElement('hidden', 'id_session',$id_session);
106
+$form->addElement('hidden', 'id_session', $id_session);
107 107
 $form->addElement('file', 'import_file', get_lang('ImportFileLocation'));
108 108
 $form->addRule('import_file', get_lang('ThisFieldIsRequired'), 'required');
109
-$allowed_file_types = array ('xml', 'csv');
109
+$allowed_file_types = array('xml', 'csv');
110 110
 $form->addRule('import_file', get_lang('InvalidExtension').' ('.implode(',', $allowed_file_types).')', 'filetype', $allowed_file_types);
111 111
 $form->addElement('radio', 'file_type', get_lang('FileType'), 'XML (<a href="../admin/example.xml" target="_blank">'.get_lang('ExampleXMLFile').'</a>)', 'xml');
112 112
 $form->addElement('radio', 'file_type', null, 'CSV (<a href="../admin/example.csv" target="_blank">'.get_lang('ExampleCSVFile').'</a>)', 'csv');
Please login to merge, or discard this patch.
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace'));
19 19
 $id_session = '';
20 20
 if (isset($_GET['id_session']) && $_GET['id_session'] != '') {
21
- 	$id_session = intval($_GET['id_session']);
22
-	$interbreadcrumb[] = array ('url' => 'session.php', 'name' => get_lang('Sessions'));
23
-	$interbreadcrumb[] = array ('url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course'));
21
+        $id_session = intval($_GET['id_session']);
22
+    $interbreadcrumb[] = array ('url' => 'session.php', 'name' => get_lang('Sessions'));
23
+    $interbreadcrumb[] = array ('url' => 'course.php?id_session='.$id_session.'', 'name' => get_lang('Course'));
24 24
 }
25 25
 
26 26
 // Set this option to true to enforce strict purification for usenames.
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
 Display :: display_header($tool_name);
90 90
 
91 91
 if ($_FILES['import_file']['size'] == 0 && $_POST) {
92
-	Display::display_error_message(get_lang('ThisFieldIsRequired'));
92
+    Display::display_error_message(get_lang('ThisFieldIsRequired'));
93 93
 }
94 94
 
95 95
 if (count($errors) != 0) {
Please login to merge, or discard this patch.
main/mySpace/course.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -36,8 +36,8 @@
 block discarded – undo
36 36
 
37 37
 function count_courses()
38 38
 {
39
-	global $nb_courses;
40
-	return $nb_courses;
39
+    global $nb_courses;
40
+    return $nb_courses;
41 41
 }
42 42
 
43 43
 //checking if the current coach is the admin coach
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 $sessionId = isset($_GET['session_id']) ? intval($_GET['session_id']) : null;
16 16
 
17 17
 api_block_anonymous_users();
18
-$interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace'));
18
+$interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace'));
19 19
 
20 20
 if (isset($_GET["id_session"]) && $_GET["id_session"] != "") {
21 21
     $interbreadcrumb[] = array("url" => "session.php", "name" => get_lang('Sessions'));
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             $user_id = intval($_GET['user_id']);
67 67
             $user_info = api_get_user_info($user_id);
68 68
             $title = get_lang('AssignedCoursesTo').' '.api_get_person_name($user_info['firstname'], $user_info['lastname']);
69
-            $courses  = CourseManager::get_course_list_of_user_as_course_admin($user_id);
69
+            $courses = CourseManager::get_course_list_of_user_as_course_admin($user_id);
70 70
         } else {
71 71
             $title = get_lang('YourCourseList');
72 72
             $courses = CourseManager::get_courses_followed_by_drh(api_get_user_id());
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     if (!api_is_session_admin()) {
83 83
         $menu_items[] = Display::url(
84
-            Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),
84
+            Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM),
85 85
             api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
86 86
         );
87 87
         $menu_items[] = Display::url(
Please login to merge, or discard this patch.
main/mySpace/admin.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -35,13 +35,13 @@  discard block
 block discarded – undo
35 35
 }
36 36
 $sql = "SELECT user.user_id,lastname,firstname,email
37 37
         FROM $tbl_user as user, $tbl_admin as admin
38
-        WHERE admin.user_id=user.user_id" . $order_clause;
38
+        WHERE admin.user_id=user.user_id".$order_clause;
39 39
 $result_admins = Database::query($sql);
40 40
 
41 41
 if (api_is_western_name_order()) {
42
-    echo '<table class="data_table"><tr><th>' . get_lang('FirstName') . '</th><th>' . get_lang('LastName') . '</th><th>' . get_lang('Email') . '</th></tr>';
42
+    echo '<table class="data_table"><tr><th>'.get_lang('FirstName').'</th><th>'.get_lang('LastName').'</th><th>'.get_lang('Email').'</th></tr>';
43 43
 } else {
44
-    echo '<table class="data_table"><tr><th>' . get_lang('LastName') . '</th><th>' . get_lang('FirstName') . '</th><th>' . get_lang('Email') . '</th></tr>';
44
+    echo '<table class="data_table"><tr><th>'.get_lang('LastName').'</th><th>'.get_lang('FirstName').'</th><th>'.get_lang('Email').'</th></tr>';
45 45
 }
46 46
 
47 47
 if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) {
@@ -65,9 +65,9 @@  discard block
 block discarded – undo
65 65
             $css_class = "row_odd";
66 66
             if ($i % 20 == 0 && $i != 0) {
67 67
                 if (api_is_western_name_order()) {
68
-                    echo '<tr><th>' . get_lang('FirstName') . '</th><th>' . get_lang('LastName') . '</th><th>' . get_lang('Email') . '</th></tr>';
68
+                    echo '<tr><th>'.get_lang('FirstName').'</th><th>'.get_lang('LastName').'</th><th>'.get_lang('Email').'</th></tr>';
69 69
                 } else {
70
-                    echo '<tr><th>' . get_lang('LastName') . '</th><th>' . get_lang('FirstName') . '</th><th>' . get_lang('Email') . '</th></tr>';
70
+                    echo '<tr><th>'.get_lang('LastName').'</th><th>'.get_lang('FirstName').'</th><th>'.get_lang('Email').'</th></tr>';
71 71
                 }
72 72
             }
73 73
         } else {
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
         $i++;
78 78
 
79 79
         if (api_is_western_name_order()) {
80
-            echo "<tr class=" . $css_class . "><td>$firstname</td><td>$lastname</td><td><a href='mailto:" . $email . "'>$email</a></td></tr>";
80
+            echo "<tr class=".$css_class."><td>$firstname</td><td>$lastname</td><td><a href='mailto:".$email."'>$email</a></td></tr>";
81 81
         } else {
82
-            echo "<tr class=" . $css_class . "><td>$lastname</td><td>$firstname</td><td><a href='mailto:" . $email . "'>$email</a></td></tr>";
82
+            echo "<tr class=".$css_class."><td>$lastname</td><td>$firstname</td><td><a href='mailto:".$email."'>$email</a></td></tr>";
83 83
         }
84 84
 
85 85
         if (api_is_western_name_order(PERSON_NAME_DATA_EXPORT)) {
@@ -93,7 +93,7 @@  discard block
 block discarded – undo
93 93
     }
94 94
 } else {
95 95
     // No results
96
-    echo '<tr><td colspan="3">' . get_lang('NoResults') . '</td></tr>';
96
+    echo '<tr><td colspan="3">'.get_lang('NoResults').'</td></tr>';
97 97
 }
98 98
 echo '</table>';
99 99
 
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 echo "
105 105
     <br /><br />
106 106
     <form method='post' action='admin.php'>
107
-        <button type='submit' class='save' name='export' value='" . get_lang('ExportExcel') . "'>
108
-            " . get_lang('ExportExcel') . "
107
+        <button type='submit' class='save' name='export' value='" . get_lang('ExportExcel')."'>
108
+            " . get_lang('ExportExcel')."
109 109
         </button>
110 110
     <form>
111 111
 ";
Please login to merge, or discard this patch.