Completed
Push — master ( 565c08...93d030 )
by José
125:33 queued 71:22
created
main/reports/templates/courseArticulate.reports.php 1 patch
Indentation   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $reports_template['CourseArticulate'] = array(
4
-	'description' => 'CourseArticulate',
5
-	'getSQL' => 'reports_template_CourseArticulate_getSQL',
6
-	'wizard' =>
4
+    'description' => 'CourseArticulate',
5
+    'getSQL' => 'reports_template_CourseArticulate_getSQL',
6
+    'wizard' =>
7 7
 '
8 8
 <span id="CourseArticulate" class="step">
9 9
 	<span class="font_normal_07em_black">This report does not need any particular settings</span><br />
@@ -12,113 +12,113 @@  discard block
 block discarded – undo
12 12
 ');
13 13
 
14 14
 function reports_template_CourseArticulate_getSQL() {
15
-	// settings
15
+    // settings
16 16
 
17 17
 
18
-	// Nom, prenom
19
-	$query = 'select u.lastname as "Last name", u.firstname as "First name" ';
20
-	$query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
21
-	$query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
22
-	$query .= ' order by u.user_id ';
23
-	$queries[0] = $query;
24
-	$extraFieldType = \Chamilo\CoreBundle\Entity\ExtraField::USER_FIELD_TYPE;
25
-	// Custom Field
26
-	foreach (array("tags" => "tags") as $k => $v) { // FIXME
27
-		$query = 'select ufv.value  as "'.$v.'" ';
28
-		$query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
29
-		$query .= 'left join'.Database::get_main_table(TABLE_EXTRA_FIELD).' uf ';
30
-		$query .= ' on uf.variable ="'.$k.'" ';
31
-		$query .= 'left outer join '.Database::get_main_table(TABLE_EXTRA_FIELD_VALUES).' ufv ';
32
-		$query .= ' on ufv.item_id = u.user_id and ufv.field_id = uf.id ';
33
-		$query .= 'where ufv.extra_field_type = '.$extraFieldType.' AND u.user_id in ('.reports_getVisibilitySQL().') ';
34
-		$query .= ' order by u.user_id ';
35
-		$queries[] = $query;
36
-	}
18
+    // Nom, prenom
19
+    $query = 'select u.lastname as "Last name", u.firstname as "First name" ';
20
+    $query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
21
+    $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
22
+    $query .= ' order by u.user_id ';
23
+    $queries[0] = $query;
24
+    $extraFieldType = \Chamilo\CoreBundle\Entity\ExtraField::USER_FIELD_TYPE;
25
+    // Custom Field
26
+    foreach (array("tags" => "tags") as $k => $v) { // FIXME
27
+        $query = 'select ufv.value  as "'.$v.'" ';
28
+        $query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
29
+        $query .= 'left join'.Database::get_main_table(TABLE_EXTRA_FIELD).' uf ';
30
+        $query .= ' on uf.variable ="'.$k.'" ';
31
+        $query .= 'left outer join '.Database::get_main_table(TABLE_EXTRA_FIELD_VALUES).' ufv ';
32
+        $query .= ' on ufv.item_id = u.user_id and ufv.field_id = uf.id ';
33
+        $query .= 'where ufv.extra_field_type = '.$extraFieldType.' AND u.user_id in ('.reports_getVisibilitySQL().') ';
34
+        $query .= ' order by u.user_id ';
35
+        $queries[] = $query;
36
+    }
37 37
 
38 38
 
39
-	// Stored Value
40
-	$sv = array();
41
-	foreach ($sv as $k => $v) {
39
+    // Stored Value
40
+    $sv = array();
41
+    foreach ($sv as $k => $v) {
42 42
         if (!isset($v['sql']))
43 43
                 $v['sql'] = 'FIELD';
44 44
         $sqlField = str_replace('FIELD', 'sv.sv_value', $v['sql']);
45 45
         $query = 'select '.$sqlField.' as "'.$v['title'].'" ';
46 46
 //		$query = 'select sec_to_time(sv.sv_value) as "'.$v.'" ';
47
-		$query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
48
-		$query .= ' left outer join '.Database::get_main_table(TABLE_TRACK_STORED_VALUES).' sv ';
49
-		$query .= 'on sv.user_id = u.user_id and sv_key = "'.$k.'" ';
50
-		$query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
51
-		$query .= ' group by u.user_id ';
52
-		$query .= ' order by u.user_id ';
53
-		$queries[] = $query;
54
-	}
47
+        $query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
48
+        $query .= ' left outer join '.Database::get_main_table(TABLE_TRACK_STORED_VALUES).' sv ';
49
+        $query .= 'on sv.user_id = u.user_id and sv_key = "'.$k.'" ';
50
+        $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
51
+        $query .= ' group by u.user_id ';
52
+        $query .= ' order by u.user_id ';
53
+        $queries[] = $query;
54
+    }
55 55
 
56
-	// first and last connection
57
-	$query = 'select min(tel.login_date) as "First connection", max(tel.logout_date) as "Latest connection"  ';
58
-	$query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
59
-	$query .= 'left outer join '.Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN).' tel ';
60
-	$query .= ' on tel.login_user_id = u.user_id ';
61
-	$query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
62
-	$query .= ' group by u.user_id ';
63
-	$query .= ' order by u.user_id ';
64
-	$queries[] = $query;
56
+    // first and last connection
57
+    $query = 'select min(tel.login_date) as "First connection", max(tel.logout_date) as "Latest connection"  ';
58
+    $query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
59
+    $query .= 'left outer join '.Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN).' tel ';
60
+    $query .= ' on tel.login_user_id = u.user_id ';
61
+    $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
62
+    $query .= ' group by u.user_id ';
63
+    $query .= ' order by u.user_id ';
64
+    $queries[] = $query;
65 65
 
66
-	// SCORM Data
67
-	$scormData = array();
66
+    // SCORM Data
67
+    $scormData = array();
68 68
     $course_list = CourseManager::get_courses_list();
69
-	foreach ($course_list as $code => $details) {
70
-		$courseId = $details['id'];
71
-		$list = Database::query('SELECT l.id as lid, l.name as lname, li.id as liid, li.title as lititle '.
72
-					' FROM '.Database::get_course_table(TABLE_LP_MAIN).' l, '.Database::get_course_table(TABLE_LP_ITEM).' li '.
73
-					' WHERE l.c_id = '.$courseId.' AND li.c_id = '.$courseId.' AND l.id = li.lp_id');
74
-		while ($lpItem = Database::fetch_assoc($list)) {
75
-			$scormData[] = array(
76
-						//'coursedb' => $details['db_name'],
77
-						'lid' => $lpItem['lid'],
78
-						'liid' => $lpItem['liid'],
79
-						'target_view_count' => 1,
80
-						'target_indicator' => 'score',
81
-						'title' => $details['title'].'/'.$lpItem['lname'].'/'.$lpItem['lititle'].'/1/score',
82
-						'sql' => 'FIELD');
83
-			$scormData[] = array(
84
-						//'coursedb' => $details['db_name'],
85
-						'lid' => $lpItem['lid'],
86
-						'liid' => $lpItem['liid'],
87
-						'target_view_count' => 2,
88
-						'target_indicator' => 'score',
89
-						'title' => $details['title'].'/'.$lpItem['lname'].'/'.$lpItem['lititle'].'/2/score',
90
-						'sql' => 'FIELD');
91
-			$scormData[] = array(
92
-						//'coursedb' => $details['db_name'],
93
-						'lid' => $lpItem['lid'],
94
-						'liid' => $lpItem['liid'],
95
-						'target_view_count' => null,
96
-						'target_indicator' => 'score',
97
-						'title' => $details['title'].'/'.$lpItem['lname'].'/'.$lpItem['lititle'].'/all/score',
98
-						'sql' => 'avg(FIELD)');
99
-		}
100
-	}
69
+    foreach ($course_list as $code => $details) {
70
+        $courseId = $details['id'];
71
+        $list = Database::query('SELECT l.id as lid, l.name as lname, li.id as liid, li.title as lititle '.
72
+                    ' FROM '.Database::get_course_table(TABLE_LP_MAIN).' l, '.Database::get_course_table(TABLE_LP_ITEM).' li '.
73
+                    ' WHERE l.c_id = '.$courseId.' AND li.c_id = '.$courseId.' AND l.id = li.lp_id');
74
+        while ($lpItem = Database::fetch_assoc($list)) {
75
+            $scormData[] = array(
76
+                        //'coursedb' => $details['db_name'],
77
+                        'lid' => $lpItem['lid'],
78
+                        'liid' => $lpItem['liid'],
79
+                        'target_view_count' => 1,
80
+                        'target_indicator' => 'score',
81
+                        'title' => $details['title'].'/'.$lpItem['lname'].'/'.$lpItem['lititle'].'/1/score',
82
+                        'sql' => 'FIELD');
83
+            $scormData[] = array(
84
+                        //'coursedb' => $details['db_name'],
85
+                        'lid' => $lpItem['lid'],
86
+                        'liid' => $lpItem['liid'],
87
+                        'target_view_count' => 2,
88
+                        'target_indicator' => 'score',
89
+                        'title' => $details['title'].'/'.$lpItem['lname'].'/'.$lpItem['lititle'].'/2/score',
90
+                        'sql' => 'FIELD');
91
+            $scormData[] = array(
92
+                        //'coursedb' => $details['db_name'],
93
+                        'lid' => $lpItem['lid'],
94
+                        'liid' => $lpItem['liid'],
95
+                        'target_view_count' => null,
96
+                        'target_indicator' => 'score',
97
+                        'title' => $details['title'].'/'.$lpItem['lname'].'/'.$lpItem['lititle'].'/all/score',
98
+                        'sql' => 'avg(FIELD)');
99
+        }
100
+    }
101 101
 
102
-	foreach ($scormData as $v) {
102
+    foreach ($scormData as $v) {
103 103
         if (!isset($v['sql'])) {
104 104
             $v['sql'] = 'FIELD';
105 105
         }
106 106
         $sqlField = str_replace('FIELD', $v['target_indicator'], $v['sql']);
107 107
         $query = 'select '.$sqlField.' as "'.$v['title'].'" ';
108 108
         $query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
109
-		$query .= 'left outer join '.Database::get_course_table(TABLE_LP_VIEW).' lv ';
110
-		$query .= ' on u.user_id = lv.user_id and lv.lp_id = '.$v['lid'];
111
-		$query .= ' left outer join '.Database::get_course_table(TABLE_LP_ITEM_VIEW).' liv ';
112
-		$query .= ' on lv.id = liv.lp_view_id ';
113
-		if ($v['target_view_count'])
114
-			$query .= ' and liv.view_count = '.$v['target_view_count'];
115
-		$query .= ' and liv.lp_item_id = '.$v['liid'].' ';
116
-		$query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
117
-		$query .= ' group by u.user_id ';
118
-		$query .= ' order by u.user_id ';
119
-		$queries[] = $query;
120
-	}
109
+        $query .= 'left outer join '.Database::get_course_table(TABLE_LP_VIEW).' lv ';
110
+        $query .= ' on u.user_id = lv.user_id and lv.lp_id = '.$v['lid'];
111
+        $query .= ' left outer join '.Database::get_course_table(TABLE_LP_ITEM_VIEW).' liv ';
112
+        $query .= ' on lv.id = liv.lp_view_id ';
113
+        if ($v['target_view_count'])
114
+            $query .= ' and liv.view_count = '.$v['target_view_count'];
115
+        $query .= ' and liv.lp_item_id = '.$v['liid'].' ';
116
+        $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
117
+        $query .= ' group by u.user_id ';
118
+        $query .= ' order by u.user_id ';
119
+        $queries[] = $query;
120
+    }
121 121
 
122
-	return $queries;
122
+    return $queries;
123 123
 }
124 124
 
Please login to merge, or discard this patch.
main/reports/templates/generic.reports.php 1 patch
Indentation   +47 added lines, -47 removed lines patch added patch discarded remove patch
@@ -1,9 +1,9 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 $reports_template['Generic'] = array(
4
-	'description' => 'Generic',
5
-	'getSQL' => 'reports_template_Generic_getSQL',
6
-	'wizard' =>
4
+    'description' => 'Generic',
5
+    'getSQL' => 'reports_template_Generic_getSQL',
6
+    'wizard' =>
7 7
 '
8 8
 <span id="Generic" class="step">
9 9
 	<span class="font_normal_07em_black">This report does not need any particular settings</span><br />
@@ -12,49 +12,49 @@  discard block
 block discarded – undo
12 12
 ');
13 13
 
14 14
 function reports_template_Generic_getSQL() {
15
-	// settings
16
-
17
-
18
-	// Nom, prenom
19
-	$query = 'select u.lastname as "Last name", u.firstname as "First name" ';
20
-	$query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
21
-	$query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
22
-	$query .= ' order by u.user_id ';
23
-	$queries[0] = $query;
24
-
25
-	// Custom Field
26
-	foreach (array(10 => "description") as $k => $v) {
27
-		$query = 'select ufv.value  as "'.$v.'" ';
28
-		$query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
29
-		$query .= 'left outer join '.Database::get_main_table(TABLE_EXTRA_FIELD_VALUES).' ufv ';
30
-		$query .= ' on ufv.item_id = u.user_id and ufv.field_id = '.$k;
31
-		$query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
32
-		$query .= ' order by u.user_id ';
33
-		$queries[] = $query;
34
-	}
35
-
36
-	// Stored Value
37
-	$sv = array();
38
-	foreach ($sv as $k => $v) {
39
-		$query = 'select sec_to_time(sv.sv_value) as "'.$v.'" ';
40
-		$query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
41
-		$query .= ' left outer join '.Database::get_main_table(TABLE_TRACK_STORED_VALUES).' sv ';
42
-		$query .= 'on sv.user_id = u.user_id and sv_key = "'.$k.'" ';
43
-		$query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
44
-		$query .= ' order by u.user_id ';
45
-		$queries[] = $query;
46
-	}
47
-
48
-	// premiere connexion
49
-	$query = 'select min(tel.login_date) as "First connection", max(tel.logout_date) as "Latest connection"  ';
50
-	$query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
51
-	$query .= 'left outer join '.Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN).' tel ';
52
-	$query .= ' on tel.login_user_id = u.user_id ';
53
-	$query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
54
-	$query .= ' group by u.user_id ';
55
-	$query .= ' order by u.user_id ';
56
-	$queries[] = $query;
57
-
58
-	return $queries;
15
+    // settings
16
+
17
+
18
+    // Nom, prenom
19
+    $query = 'select u.lastname as "Last name", u.firstname as "First name" ';
20
+    $query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
21
+    $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
22
+    $query .= ' order by u.user_id ';
23
+    $queries[0] = $query;
24
+
25
+    // Custom Field
26
+    foreach (array(10 => "description") as $k => $v) {
27
+        $query = 'select ufv.value  as "'.$v.'" ';
28
+        $query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
29
+        $query .= 'left outer join '.Database::get_main_table(TABLE_EXTRA_FIELD_VALUES).' ufv ';
30
+        $query .= ' on ufv.item_id = u.user_id and ufv.field_id = '.$k;
31
+        $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
32
+        $query .= ' order by u.user_id ';
33
+        $queries[] = $query;
34
+    }
35
+
36
+    // Stored Value
37
+    $sv = array();
38
+    foreach ($sv as $k => $v) {
39
+        $query = 'select sec_to_time(sv.sv_value) as "'.$v.'" ';
40
+        $query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
41
+        $query .= ' left outer join '.Database::get_main_table(TABLE_TRACK_STORED_VALUES).' sv ';
42
+        $query .= 'on sv.user_id = u.user_id and sv_key = "'.$k.'" ';
43
+        $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
44
+        $query .= ' order by u.user_id ';
45
+        $queries[] = $query;
46
+    }
47
+
48
+    // premiere connexion
49
+    $query = 'select min(tel.login_date) as "First connection", max(tel.logout_date) as "Latest connection"  ';
50
+    $query .= 'from '.Database::get_main_table(TABLE_MAIN_USER).' u ';
51
+    $query .= 'left outer join '.Database::get_main_table(TABLE_STATISTIC_TRACK_E_LOGIN).' tel ';
52
+    $query .= ' on tel.login_user_id = u.user_id ';
53
+    $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') ';
54
+    $query .= ' group by u.user_id ';
55
+    $query .= ' order by u.user_id ';
56
+    $queries[] = $query;
57
+
58
+    return $queries;
59 59
 }
60 60
 
Please login to merge, or discard this patch.
main/reports/templates/courseTime.reports.php 1 patch
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.
main/reports/reports.cli.php 1 patch
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.
main/mySpace/user_edit.php 1 patch
Indentation   +35 added lines, -35 removed lines patch added patch discarded remove patch
@@ -113,23 +113,23 @@  discard block
 block discarded – undo
113 113
 $form->addGroup($html_results_enabled);
114 114
 // Validate form
115 115
 if ($form->validate()) {
116
-	$check = Security::check_token('post');
117
-	if ($check) {
118
-		$user = $form->exportValues();
119
-		$email = $userInfo['email'];
116
+    $check = Security::check_token('post');
117
+    if ($check) {
118
+        $user = $form->exportValues();
119
+        $email = $userInfo['email'];
120 120
         $username = $userInfo['username'];
121
-		$send_mail = intval($user['mail']['send_mail']);
121
+        $send_mail = intval($user['mail']['send_mail']);
122 122
         $auth_source = PLATFORM_AUTH_SOURCE;
123 123
 
124 124
         $resetPassword = $user['password']['password_auto'] == '1' ? 0 : 2;
125 125
 
126
-		if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') {
127
-			//$auth_source = $user['password']['auth_source'];
128
-			//$password = 'PLACEHOLDER';
129
-		} else {
130
-			//$auth_source = PLATFORM_AUTH_SOURCE;
131
-			//$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
132
-		}
126
+        if (count($extAuthSource) > 0 && $user['password']['password_auto'] == '2') {
127
+            //$auth_source = $user['password']['auth_source'];
128
+            //$password = 'PLACEHOLDER';
129
+        } else {
130
+            //$auth_source = PLATFORM_AUTH_SOURCE;
131
+            //$password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
132
+        }
133 133
 
134 134
         $auth_source = $userInfo['auth_source'];
135 135
         $password = $user['password']['password_auto'] == '1' ? api_generate_password() : $user['password']['password'];
@@ -157,18 +157,18 @@  discard block
 block discarded – undo
157 157
             $resetPassword
158 158
         );
159 159
 
160
-		if (!empty($email) && $send_mail) {
161
-			$emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
162
-			$portal_url = api_get_path(WEB_PATH);
163
-			if (api_is_multiple_url_enabled()) {
164
-				$access_url_id = api_get_current_access_url_id();
165
-				if ($access_url_id != -1) {
166
-					$url = api_get_access_url($access_url_id);
167
-					$portal_url = $url['url'];
168
-				}
169
-			}
170
-
171
-			$emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n".
160
+        if (!empty($email) && $send_mail) {
161
+            $emailsubject = '['.api_get_setting('siteName').'] '.get_lang('YourReg').' '.api_get_setting('siteName');
162
+            $portal_url = api_get_path(WEB_PATH);
163
+            if (api_is_multiple_url_enabled()) {
164
+                $access_url_id = api_get_current_access_url_id();
165
+                if ($access_url_id != -1) {
166
+                    $url = api_get_access_url($access_url_id);
167
+                    $portal_url = $url['url'];
168
+                }
169
+            }
170
+
171
+            $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n".
172 172
                 get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n".
173 173
                 get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" .
174 174
                 get_lang('Address') ." ". api_get_setting('siteName') ." ".
@@ -181,26 +181,26 @@  discard block
 block discarded – undo
181 181
                 api_get_setting('administratorTelephone')."\n" .
182 182
                 get_lang('Email') ." : ".api_get_setting('emailAdministrator');
183 183
 
184
-			api_mail_html(
184
+            api_mail_html(
185 185
                 api_get_person_name($userInfo['firstname'], $userInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS),
186 186
                 $email,
187 187
                 $emailsubject,
188 188
                 $emailbody
189 189
             );
190
-		}
190
+        }
191 191
 
192
-		Security::clear_token();
192
+        Security::clear_token();
193 193
         $tok = Security::get_token();
194 194
         header('Location: '.$url.'&message=1');
195 195
         exit();
196
-	}
196
+    }
197 197
 } else {
198
-	if (isset($_POST['submit'])) {
199
-		Security::clear_token();
200
-	}
201
-	$token = Security::get_token();
202
-	$form->addElement('hidden', 'sec_token');
203
-	$form->setConstants(array('sec_token' => $token));
198
+    if (isset($_POST['submit'])) {
199
+        Security::clear_token();
200
+    }
201
+    $token = Security::get_token();
202
+    $form->addElement('hidden', 'sec_token');
203
+    $form->setConstants(array('sec_token' => $token));
204 204
 }
205 205
 
206 206
 $interbreadcrumb[] = array(
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 Display::display_header($tool_name);
213 213
 
214 214
 if (isset($_REQUEST['message'])) {
215
-	Display::display_normal_message(get_lang('Updated'));
215
+    Display::display_normal_message(get_lang('Updated'));
216 216
 }
217 217
 $form->display();
218 218
 
Please login to merge, or discard this patch.
main/mySpace/index.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 }
103 103
 
104 104
 if ($is_drh) {
105
-	$view = 'drh';
105
+    $view = 'drh';
106 106
     $menu_items[] = Display::url(Display::return_icon('user_na.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), '#');
107 107
     $menu_items[] = Display::url(Display::return_icon('teacher.png', get_lang('Trainers'), array(), ICON_SIZE_MEDIUM), 'teachers.php');
108 108
     $menu_items[] = Display::url(Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_MEDIUM), 'course.php');
@@ -143,7 +143,7 @@  discard block
 block discarded – undo
143 143
         echo "</div><br />";
144 144
     }
145 145
 } else {
146
-	echo Display::url(
146
+    echo Display::url(
147 147
         Display::return_icon('stats.png', get_lang('MyStats'),'',ICON_SIZE_MEDIUM),
148 148
         api_get_path(WEB_CODE_PATH)."auth/my_progress.php"
149 149
     );
@@ -397,11 +397,11 @@  discard block
 block discarded – undo
397 397
 
398 398
 // Send the csv file if asked
399 399
 if ($export_csv) {
400
-	ob_end_clean();
401
-	Export :: arrayToCsv($csv_content, 'reporting_index');
402
-	exit;
400
+    ob_end_clean();
401
+    Export :: arrayToCsv($csv_content, 'reporting_index');
402
+    exit;
403 403
 }
404 404
 
405 405
 if (!$export_csv) {
406
-	Display::display_footer();
406
+    Display::display_footer();
407 407
 }
Please login to merge, or discard this patch.
main/mySpace/coaches.php 1 patch
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.
main/mySpace/course.php 1 patch
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.
main/forum/viewthread_threaded.inc.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -457,8 +457,8 @@
 block discarded – undo
457 457
 
458 458
 // The post has been displayed => it can be removed from the what's new array
459 459
 if (isset($whatsnew_post_info[$forumId][$threadId][$row['post_id']])) {
460
-  unset($whatsnew_post_info[$forumId][$threadId][$row['post_id']]);
461
-  unset($_SESSION['whatsnew_post_info'][$forumId][$threadId][$row['post_id']]);
460
+    unset($whatsnew_post_info[$forumId][$threadId][$row['post_id']]);
461
+    unset($_SESSION['whatsnew_post_info'][$forumId][$threadId][$row['post_id']]);
462 462
 }
463 463
 echo "</table>";
464 464
 
Please login to merge, or discard this patch.