@@ -1,9 +1,9 @@ discard block |
||
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 |
||
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 |
@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | // Stored Value |
40 | 40 | $sv = array(); |
41 | 41 | foreach ($sv as $k => $v) { |
42 | - if (!isset($v['sql'])) |
|
43 | - $v['sql'] = 'FIELD'; |
|
42 | + if (!isset($v['sql'])) { |
|
43 | + $v['sql'] = 'FIELD'; |
|
44 | + } |
|
44 | 45 | $sqlField = str_replace('FIELD', 'sv.sv_value', $v['sql']); |
45 | 46 | $query = 'select '.$sqlField.' as "'.$v['title'].'" '; |
46 | 47 | // $query = 'select sec_to_time(sv.sv_value) as "'.$v.'" '; |
@@ -110,8 +111,9 @@ discard block |
||
110 | 111 | $query .= ' on u.user_id = lv.user_id and lv.lp_id = '.$v['lid']; |
111 | 112 | $query .= ' left outer join '.Database::get_course_table(TABLE_LP_ITEM_VIEW).' liv '; |
112 | 113 | $query .= ' on lv.id = liv.lp_view_id '; |
113 | - if ($v['target_view_count']) |
|
114 | - $query .= ' and liv.view_count = '.$v['target_view_count']; |
|
114 | + if ($v['target_view_count']) { |
|
115 | + $query .= ' and liv.view_count = '.$v['target_view_count']; |
|
116 | + } |
|
115 | 117 | $query .= ' and liv.lp_item_id = '.$v['liid'].' '; |
116 | 118 | $query .= ' where u.user_id in ('.reports_getVisibilitySQL().') '; |
117 | 119 | $query .= ' group by u.user_id '; |
@@ -1,9 +1,9 @@ discard block |
||
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 |
||
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 |
@@ -12,30 +12,30 @@ |
||
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 | } |
@@ -21,21 +21,25 @@ |
||
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 | } |
@@ -4,55 +4,55 @@ |
||
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 | ?> |
@@ -32,9 +32,9 @@ discard block |
||
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 |
||
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 | ?> |
@@ -34,21 +34,21 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | ?> |
@@ -24,7 +24,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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; |
@@ -37,16 +37,18 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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); |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | $this_section = SECTION_COURSES; |
18 | 18 | } |
19 | 19 | |
20 | -$session_id = isset($_REQUEST['id_session']) && !empty($_REQUEST['id_session']) ? intval($_REQUEST['id_session']) : api_get_session_id(); |
|
20 | +$session_id = isset($_REQUEST['id_session']) && !empty($_REQUEST['id_session']) ? intval($_REQUEST['id_session']) : api_get_session_id(); |
|
21 | 21 | $export_csv = isset($_GET['export']) && $_GET['export'] == 'csv' ? true : false; |
22 | 22 | $user_id = isset($_GET['student_id']) ? intval($_GET['student_id']) : api_get_user_id(); |
23 | 23 | $courseCode = isset($_GET['course']) ? Security::remove_XSS($_GET['course']) : api_get_course_id(); |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | } |
40 | 40 | |
41 | 41 | if ($origin == 'user_course') { |
42 | - $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']); |
|
43 | - $interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$courseCode, "name" => get_lang("Users")); |
|
44 | -} else if($origin == 'tracking_course') { |
|
45 | - $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$courseCode.'&id_session='.$session_id, "name" => get_lang("Tracking")); |
|
42 | + $interbreadcrumb[] = array("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']); |
|
43 | + $interbreadcrumb[] = array("url" => "../user/user.php?cidReq=".$courseCode, "name" => get_lang("Users")); |
|
44 | +} else if ($origin == 'tracking_course') { |
|
45 | + $interbreadcrumb[] = array("url" => "../tracking/courseLog.php?cidReq=".$courseCode.'&id_session='.$session_id, "name" => get_lang("Tracking")); |
|
46 | 46 | } else { |
47 | - $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace')); |
|
48 | - $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents")); |
|
49 | - $interbreadcrumb[] = array ("url" => "myStudents.php?student=".$user_id, "name" => get_lang("StudentDetails")); |
|
50 | - $nameTools=get_lang("DetailsStudentInCourse"); |
|
47 | + $interbreadcrumb[] = array("url" => "index.php", "name" => get_lang('MySpace')); |
|
48 | + $interbreadcrumb[] = array("url" => "student.php", "name" => get_lang("MyStudents")); |
|
49 | + $interbreadcrumb[] = array("url" => "myStudents.php?student=".$user_id, "name" => get_lang("StudentDetails")); |
|
50 | + $nameTools = get_lang("DetailsStudentInCourse"); |
|
51 | 51 | } |
52 | 52 | |
53 | -$interbreadcrumb[] = array("url" => "myStudents.php?student=".$user_id."&course=".$courseCode."&details=true&origin=".$origin , "name" => get_lang("DetailsStudentInCourse")); |
|
53 | +$interbreadcrumb[] = array("url" => "myStudents.php?student=".$user_id."&course=".$courseCode."&details=true&origin=".$origin, "name" => get_lang("DetailsStudentInCourse")); |
|
54 | 54 | $nameTools = get_lang('LearningPathDetails'); |
55 | 55 | $sql = 'SELECT name FROM '.Database::get_course_table(TABLE_LP_MAIN).' WHERE c_id = '.$course_info['real_id'].' AND id='.$lp_id; |
56 | 56 | $rs = Database::query($sql); |
@@ -62,15 +62,15 @@ discard block |
||
62 | 62 | |
63 | 63 | Display :: display_header($nameTools); |
64 | 64 | echo '<div class ="actions">'; |
65 | -echo '<a href="javascript:history.back();">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
65 | +echo '<a href="javascript:history.back();">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
66 | 66 | echo '<a href="javascript: void(0);" onclick="javascript: window.print();"> |
67 | - '.Display::return_icon('printer.png',get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
67 | + '.Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
68 | 68 | echo '<a href="'.api_get_self().'?export=csv&'.Security::remove_XSS($_SERVER['QUERY_STRING']).'"> |
69 | - '.Display::return_icon('export_csv.png',get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
69 | + '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
70 | 70 | echo '</div>'; |
71 | 71 | echo '<div class="clear"></div>'; |
72 | 72 | $session_name = api_get_session_name($session_id); |
73 | -$table_title = ($session_name? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':' '). |
|
73 | +$table_title = ($session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ' : ' '). |
|
74 | 74 | Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$course_info['name'].' '. |
75 | 75 | Display::return_icon('user.png', get_lang('User'), array(), ICON_SIZE_SMALL).' '.$name; |
76 | 76 | echo Display::page_header($table_title); |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | $from_myspace = false; |
12 | 12 | $from_link = ''; |
13 | 13 | if (isset($_GET['from']) && $_GET['from'] == 'myspace') { |
14 | - $from_link = '&from=myspace'; |
|
15 | - $this_section = SECTION_TRACKING; |
|
14 | + $from_link = '&from=myspace'; |
|
15 | + $this_section = SECTION_TRACKING; |
|
16 | 16 | } else { |
17 | - $this_section = SECTION_COURSES; |
|
17 | + $this_section = SECTION_COURSES; |
|
18 | 18 | } |
19 | 19 | |
20 | 20 | $session_id = isset($_REQUEST['id_session']) && !empty($_REQUEST['id_session']) ? intval($_REQUEST['id_session']) : api_get_session_id(); |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | if (!api_is_platform_admin(true) && |
36 | 36 | !CourseManager :: is_course_teacher(api_get_user_id(), $courseCode) && |
37 | 37 | !Tracking :: is_allowed_to_coach_student(api_get_user_id(), $user_id) && !api_is_drh() && !api_is_course_tutor()) { |
38 | - api_not_allowed(); |
|
38 | + api_not_allowed(); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | if ($origin == 'user_course') { |
42 | - $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']); |
|
43 | - $interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$courseCode, "name" => get_lang("Users")); |
|
42 | + $interbreadcrumb[] = array ("url" => api_get_path(WEB_COURSE_PATH).$course_info['directory'], 'name' => $course_info['name']); |
|
43 | + $interbreadcrumb[] = array ("url" => "../user/user.php?cidReq=".$courseCode, "name" => get_lang("Users")); |
|
44 | 44 | } else if($origin == 'tracking_course') { |
45 | - $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$courseCode.'&id_session='.$session_id, "name" => get_lang("Tracking")); |
|
45 | + $interbreadcrumb[] = array ("url" => "../tracking/courseLog.php?cidReq=".$courseCode.'&id_session='.$session_id, "name" => get_lang("Tracking")); |
|
46 | 46 | } else { |
47 | - $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace')); |
|
48 | - $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents")); |
|
49 | - $interbreadcrumb[] = array ("url" => "myStudents.php?student=".$user_id, "name" => get_lang("StudentDetails")); |
|
50 | - $nameTools=get_lang("DetailsStudentInCourse"); |
|
47 | + $interbreadcrumb[] = array ("url" => "index.php", "name" => get_lang('MySpace')); |
|
48 | + $interbreadcrumb[] = array ("url" => "student.php", "name" => get_lang("MyStudents")); |
|
49 | + $interbreadcrumb[] = array ("url" => "myStudents.php?student=".$user_id, "name" => get_lang("StudentDetails")); |
|
50 | + $nameTools=get_lang("DetailsStudentInCourse"); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | $interbreadcrumb[] = array("url" => "myStudents.php?student=".$user_id."&course=".$courseCode."&details=true&origin=".$origin , "name" => get_lang("DetailsStudentInCourse")); |
@@ -34,11 +34,11 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | $filename = 'reporting.xls'; |
13 | 13 | |
14 | 14 | if (!api_is_allowed_to_create_course()) { |
15 | - api_not_allowed(true); |
|
15 | + api_not_allowed(true); |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | $user_id = api_get_user_id(); |
@@ -23,222 +23,222 @@ discard block |
||
23 | 23 | $session_id = 0; |
24 | 24 | |
25 | 25 | if (!empty($my_courses)) { |
26 | - foreach ($my_courses as $course) { |
|
27 | - $course_code = $course['code']; |
|
28 | - $course_id = $course['real_id']; |
|
29 | - $course_info = api_get_course_info($course_code); |
|
30 | - |
|
31 | - //Only show open courses |
|
32 | - if ($course_info['visibility'] == 0) { |
|
33 | - continue; |
|
34 | - } |
|
35 | - |
|
36 | - $teachers = CourseManager::get_teacher_list_from_course_code($course_code); |
|
37 | - $teacher_list = array(); |
|
38 | - |
|
39 | - if (!empty($teachers)) { |
|
40 | - foreach($teachers as $teacher) { |
|
41 | - $teacher_list[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
42 | - } |
|
43 | - } |
|
44 | - |
|
45 | - $tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false); |
|
46 | - |
|
47 | - //Cleaning students only REAL students |
|
48 | - $students = array(); |
|
49 | - foreach ($tmp_students as $student) { |
|
50 | - $user_info = api_get_user_info($student['user_id']); |
|
51 | - if ($user_info['status'] != STUDENT) { |
|
52 | - continue; |
|
53 | - } |
|
54 | - $students[] = $student['user_id']; |
|
55 | - } |
|
56 | - |
|
57 | - $t_lp = Database :: get_course_table(TABLE_LP_MAIN); |
|
58 | - $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp |
|
26 | + foreach ($my_courses as $course) { |
|
27 | + $course_code = $course['code']; |
|
28 | + $course_id = $course['real_id']; |
|
29 | + $course_info = api_get_course_info($course_code); |
|
30 | + |
|
31 | + //Only show open courses |
|
32 | + if ($course_info['visibility'] == 0) { |
|
33 | + continue; |
|
34 | + } |
|
35 | + |
|
36 | + $teachers = CourseManager::get_teacher_list_from_course_code($course_code); |
|
37 | + $teacher_list = array(); |
|
38 | + |
|
39 | + if (!empty($teachers)) { |
|
40 | + foreach($teachers as $teacher) { |
|
41 | + $teacher_list[]= $teacher['firstname'].' '.$teacher['lastname']; |
|
42 | + } |
|
43 | + } |
|
44 | + |
|
45 | + $tmp_students = CourseManager :: get_student_list_from_course_code($course_code, false); |
|
46 | + |
|
47 | + //Cleaning students only REAL students |
|
48 | + $students = array(); |
|
49 | + foreach ($tmp_students as $student) { |
|
50 | + $user_info = api_get_user_info($student['user_id']); |
|
51 | + if ($user_info['status'] != STUDENT) { |
|
52 | + continue; |
|
53 | + } |
|
54 | + $students[] = $student['user_id']; |
|
55 | + } |
|
56 | + |
|
57 | + $t_lp = Database :: get_course_table(TABLE_LP_MAIN); |
|
58 | + $sql_lp = "SELECT lp.name, lp.id FROM $t_lp lp |
|
59 | 59 | WHERE c_id = $course_id AND lp.session_id = 0"; |
60 | - $rs_lp = Database::query($sql_lp); |
|
61 | - $t_lpi = Database :: get_course_table(TABLE_LP_ITEM); |
|
62 | - $t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT); |
|
63 | - |
|
64 | - $total_tools_list = Tracking::get_tools_most_used_by_course( |
|
65 | - $course_id, |
|
66 | - $session_id |
|
67 | - ); |
|
68 | - |
|
69 | - $total_tools = 0; |
|
70 | - foreach($total_tools_list as $tool) { |
|
71 | - $total_tools += $tool['count_access_tool']; |
|
72 | - } |
|
73 | - |
|
74 | - if (Database :: num_rows($rs_lp) > 0) { |
|
75 | - while ($learnpath = Database :: fetch_array($rs_lp)) { |
|
76 | - $lp_id = $learnpath['id']; |
|
77 | - |
|
78 | - $lp_items = |
|
79 | - $array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$course_code.'&action=view&lp_id='.$lp_id.'" target="_blank">'.$learnpath['name'].'</a>'; |
|
80 | - |
|
81 | - $array[$i]['teachers'] = ''; |
|
82 | - if (!empty($teacher_list)) { |
|
83 | - $array[$i]['teachers'] = implode(', ', $teacher_list); |
|
84 | - } |
|
85 | - |
|
86 | - $array[$i]['course_name'] = $course['title']; |
|
87 | - $count_students_accessing = 0; |
|
88 | - $count_students_complete_all_activities = 0; |
|
89 | - $count_students_complete_all_activities_at_50 = 0; |
|
90 | - $total_time_spent = 0; |
|
91 | - $total_average_progress = 0; |
|
92 | - |
|
93 | - if (!empty($students)) { |
|
94 | - foreach ($students as $student_id) { |
|
95 | - $avg_student_progress = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
96 | - $myavg_temp = Tracking::get_avg_student_score($student_id, $course_code, array($lp_id), $session_id); |
|
97 | - $avg_progress_in_course = Tracking::get_avg_student_progress($student_id, $course_code, array($lp_id), $session_id); |
|
98 | - |
|
99 | - if (intval($avg_progress_in_course) == 100) { |
|
100 | - $count_students_complete_all_activities++; |
|
101 | - } |
|
102 | - if (intval($avg_progress_in_course) > 0 && intval($avg_progress_in_course) <= 50) { |
|
103 | - $count_students_complete_all_activities_at_50 ++; |
|
104 | - } |
|
105 | - $total_average_progress +=$avg_progress_in_course; |
|
106 | - |
|
107 | - $time_spent = Tracking::get_time_spent_on_the_course($student_id, $course_id, $session_id); |
|
108 | - $total_time_spent += $time_spent; |
|
109 | - if (!empty($time_spent)) { |
|
110 | - $count_students_accessing++; |
|
111 | - } |
|
112 | - } |
|
113 | - //$total_tools += $nb_assignments + $messages + $links + $chat_last_connection + $documents; |
|
114 | - } |
|
115 | - |
|
116 | - $student_count = count($students); |
|
117 | - |
|
118 | - $array[$i]['count_students'] = $student_count; |
|
119 | - $array[$i]['count_students_accessing'] = 0; |
|
120 | - $array[$i]['count_students_accessing_percentage'] = 0; |
|
121 | - $array[$i]['count_students_complete_all_activities_at_50'] = 0; |
|
122 | - $array[$i]['count_students_complete_all_activities'] = 0; |
|
123 | - $array[$i]['average_percentage_activities_completed_per_student'] = 0; |
|
124 | - $array[$i]['total_time_spent'] = 0; |
|
125 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
126 | - $array[$i]['total_time_spent'] = 0; |
|
127 | - $array[$i]['average_time_spent_per_student'] = 0; |
|
128 | - //$array[$i]['tools_used'] = 0; |
|
129 | - $array[$i]['learnpath_docs'] = 0; |
|
130 | - $array[$i]['learnpath_exercises'] = 0; |
|
131 | - $array[$i]['learnpath_links'] = 0; |
|
132 | - $array[$i]['learnpath_forums'] = 0; |
|
133 | - $array[$i]['learnpath_assignments'] = 0; |
|
134 | - |
|
135 | - //registering the number of each category of |
|
136 | - //items in learning path |
|
137 | - $sql_lpi = "SELECT lpi.item_type FROM $t_lpi lpi |
|
60 | + $rs_lp = Database::query($sql_lp); |
|
61 | + $t_lpi = Database :: get_course_table(TABLE_LP_ITEM); |
|
62 | + $t_news = Database :: get_course_table(TABLE_ANNOUNCEMENT); |
|
63 | + |
|
64 | + $total_tools_list = Tracking::get_tools_most_used_by_course( |
|
65 | + $course_id, |
|
66 | + $session_id |
|
67 | + ); |
|
68 | + |
|
69 | + $total_tools = 0; |
|
70 | + foreach($total_tools_list as $tool) { |
|
71 | + $total_tools += $tool['count_access_tool']; |
|
72 | + } |
|
73 | + |
|
74 | + if (Database :: num_rows($rs_lp) > 0) { |
|
75 | + while ($learnpath = Database :: fetch_array($rs_lp)) { |
|
76 | + $lp_id = $learnpath['id']; |
|
77 | + |
|
78 | + $lp_items = |
|
79 | + $array[$i]['lp'] = '<a href="'.api_get_path(WEB_CODE_PATH).'newscorm/lp_controller.php?cidReq='.$course_code.'&action=view&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) { |
|
230 | - $worksheet->setCellValueByColumnAndRow($column, $line, html_entity_decode(strip_tags($item))); |
|
231 | - $column++; |
|
232 | - } |
|
233 | - $line++; |
|
234 | - } |
|
235 | - $line++; |
|
219 | + $line = 0; |
|
220 | + $column = 0; //skip the first column (row titles) |
|
221 | + |
|
222 | + foreach ($headers as $header) { |
|
223 | + $worksheet->setCellValueByColumnAndRow($column, $line, $header); |
|
224 | + $column++; |
|
225 | + } |
|
226 | + $line++; |
|
227 | + foreach ($array as $row) { |
|
228 | + $column = 0; |
|
229 | + foreach ($row as $item) { |
|
230 | + $worksheet->setCellValueByColumnAndRow($column, $line, html_entity_decode(strip_tags($item))); |
|
231 | + $column++; |
|
232 | + } |
|
233 | + $line++; |
|
234 | + } |
|
235 | + $line++; |
|
236 | 236 | |
237 | 237 | $file = api_get_path(SYS_ARCHIVE_PATH).api_replace_dangerous_char($filename); |
238 | 238 | $writer = new PHPExcel_Writer_Excel2007($spreadsheet); |
239 | 239 | $writer->save($file); |
240 | 240 | DocumentManager::file_send_for_download($file, true, $filename); |
241 | - exit; |
|
241 | + exit; |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | $interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('MySpace')); |
@@ -249,20 +249,20 @@ discard block |
||
249 | 249 | $row = 0; |
250 | 250 | $column = 0; |
251 | 251 | foreach ($headers as $header) { |
252 | - $table->setHeaderContents($row, $column, $header); |
|
253 | - $column++; |
|
252 | + $table->setHeaderContents($row, $column, $header); |
|
253 | + $column++; |
|
254 | 254 | } |
255 | 255 | $row++; |
256 | 256 | |
257 | 257 | foreach ($array as $row_table) { |
258 | - $column = 0; |
|
259 | - foreach ($row_table as $cell) { |
|
260 | - $table->setCellContents($row, $column, $cell); |
|
261 | - //$table->updateCellAttributes($row, $column, 'align="center"'); |
|
262 | - $column++; |
|
263 | - } |
|
264 | - $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
265 | - $row++; |
|
258 | + $column = 0; |
|
259 | + foreach ($row_table as $cell) { |
|
260 | + $table->setCellContents($row, $column, $cell); |
|
261 | + //$table->updateCellAttributes($row, $column, 'align="center"'); |
|
262 | + $column++; |
|
263 | + } |
|
264 | + $table->updateRowAttributes($row, $row % 2 ? 'class="row_even"' : 'class="row_odd"', true); |
|
265 | + $row++; |
|
266 | 266 | } |
267 | 267 | |
268 | 268 | echo '<div class="actions">'; |
@@ -113,23 +113,23 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | $group[] =& $form->createElement('select', 'auth_source', null, $auth_sources); |
90 | 90 | $group[] =& $form->createElement('static', '', '', '<br />'); |
91 | 91 | }*/ |
92 | -$group[] =& $form->createElement('radio', 'password_auto', get_lang('Password'), get_lang('AutoGeneratePassword').'<br />', 1); |
|
93 | -$group[] =& $form->createElement('radio', 'password_auto', 'id="radio_user_password"', null, 0); |
|
94 | -$group[] =& $form->createElement('password', 'password', null, array('onkeydown' => 'javascript: password_switch_radio_button(document.user_add,"password[password_auto]");')); |
|
92 | +$group[] = & $form->createElement('radio', 'password_auto', get_lang('Password'), get_lang('AutoGeneratePassword').'<br />', 1); |
|
93 | +$group[] = & $form->createElement('radio', 'password_auto', 'id="radio_user_password"', null, 0); |
|
94 | +$group[] = & $form->createElement('password', 'password', null, array('onkeydown' => 'javascript: password_switch_radio_button(document.user_add,"password[password_auto]");')); |
|
95 | 95 | $form->addGroup($group, 'password', get_lang('Password'), ''); |
96 | 96 | |
97 | 97 | // Send email |
98 | 98 | $group = array(); |
99 | -$group[] =& $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1); |
|
100 | -$group[] =& $form->createElement('radio', 'send_mail', null, get_lang('No'), 0); |
|
99 | +$group[] = & $form->createElement('radio', 'send_mail', null, get_lang('Yes'), 1); |
|
100 | +$group[] = & $form->createElement('radio', 'send_mail', null, get_lang('No'), 0); |
|
101 | 101 | $form->addGroup($group, 'mail', get_lang('SendMailToNewUser'), ' '); |
102 | 102 | |
103 | 103 | // Set default values |
@@ -108,7 +108,7 @@ discard block |
||
108 | 108 | |
109 | 109 | $form->setDefaults($defaults); |
110 | 110 | // Submit button |
111 | -$select_level = array (); |
|
111 | +$select_level = array(); |
|
112 | 112 | $html_results_enabled[] = $form->addButtonUpdate(get_lang('Update'), 'submit', true); |
113 | 113 | $form->addGroup($html_results_enabled); |
114 | 114 | // Validate form |
@@ -169,17 +169,17 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | $emailbody = get_lang('Dear')." ".stripslashes(api_get_person_name($userInfo['firstname'], $userInfo['lastname'])).",\n\n". |
172 | - get_lang('YouAreReg')." ". api_get_setting('siteName') ." ".get_lang('WithTheFollowingSettings')."\n\n". |
|
173 | - get_lang('Username')." : ". $username ."\n". get_lang('Pass')." : ".stripslashes($password)."\n\n" . |
|
174 | - get_lang('Address') ." ". api_get_setting('siteName') ." ". |
|
175 | - get_lang('Is') ." : ".$portal_url."\n\n". |
|
176 | - get_lang('Problem'). "\n\n". |
|
172 | + get_lang('YouAreReg')." ".api_get_setting('siteName')." ".get_lang('WithTheFollowingSettings')."\n\n". |
|
173 | + get_lang('Username')." : ".$username."\n".get_lang('Pass')." : ".stripslashes($password)."\n\n". |
|
174 | + get_lang('Address')." ".api_get_setting('siteName')." ". |
|
175 | + get_lang('Is')." : ".$portal_url."\n\n". |
|
176 | + get_lang('Problem')."\n\n". |
|
177 | 177 | get_lang('SignatureFormula').",\n\n". |
178 | 178 | api_get_person_name(api_get_setting('administratorName'), api_get_setting('administratorSurname'))."\n". |
179 | - get_lang('Manager'). " ". |
|
179 | + get_lang('Manager')." ". |
|
180 | 180 | api_get_setting('siteName')."\nT. ". |
181 | - api_get_setting('administratorTelephone')."\n" . |
|
182 | - get_lang('Email') ." : ".api_get_setting('emailAdministrator'); |
|
181 | + api_get_setting('administratorTelephone')."\n". |
|
182 | + get_lang('Email')." : ".api_get_setting('emailAdministrator'); |
|
183 | 183 | |
184 | 184 | api_mail_html( |
185 | 185 | api_get_person_name($userInfo['firstname'], $userInfo['lastname'], null, PERSON_NAME_EMAIL_ADDRESS), |
@@ -89,15 +89,15 @@ discard block |
||
89 | 89 | if (api_is_student_boss()) { |
90 | 90 | $actions .= Display::url( |
91 | 91 | Display::return_icon('stats.png', get_lang('MyStats'), '', ICON_SIZE_MEDIUM), |
92 | - api_get_path(WEB_CODE_PATH) . "auth/my_progress.php" |
|
92 | + api_get_path(WEB_CODE_PATH)."auth/my_progress.php" |
|
93 | 93 | ); |
94 | 94 | $actions .= Display::url( |
95 | 95 | Display::return_icon('user.png', get_lang('Students'), array(), ICON_SIZE_MEDIUM), |
96 | - api_get_path(WEB_CODE_PATH) . "mySpace/student.php" |
|
96 | + api_get_path(WEB_CODE_PATH)."mySpace/student.php" |
|
97 | 97 | ); |
98 | 98 | $actions .= Display::url( |
99 | 99 | Display::return_icon("statistics.png", get_lang("CompanyReport"), array(), ICON_SIZE_MEDIUM), |
100 | - api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php" |
|
100 | + api_get_path(WEB_CODE_PATH)."mySpace/company_reports.php" |
|
101 | 101 | ); |
102 | 102 | $actions .= Display::url( |
103 | 103 | Display::return_icon( |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | [], |
107 | 107 | ICON_SIZE_MEDIUM |
108 | 108 | ), |
109 | - api_get_path(WEB_CODE_PATH) . "gradebook/certificate_report.php" |
|
109 | + api_get_path(WEB_CODE_PATH)."gradebook/certificate_report.php" |
|
110 | 110 | ); |
111 | 111 | } |
112 | 112 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | if (!api_is_student_boss()) { |
120 | 120 | $content .= Display::url( |
121 | 121 | get_lang("CompanyReport"), |
122 | - api_get_path(WEB_CODE_PATH) . "mySpace/company_reports.php", |
|
122 | + api_get_path(WEB_CODE_PATH)."mySpace/company_reports.php", |
|
123 | 123 | array( |
124 | 124 | 'class' => 'btn btn-success' |
125 | 125 | ) |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | } |
128 | 128 | |
129 | 129 | $content .= '</div>'; |
130 | -$content .= '<h1 class="page-header">' . get_lang('CompanyReportResumed') . '</h1>'; |
|
130 | +$content .= '<h1 class="page-header">'.get_lang('CompanyReportResumed').'</h1>'; |
|
131 | 131 | $content .= Display::grid_html('user_course_report'); |
132 | 132 | |
133 | 133 | $tpl = new Template($tool_name); |