@@ -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 | ?> |
@@ -19,7 +19,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 |
||
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 />"; |
@@ -36,8 +36,8 @@ |
||
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 |
@@ -457,8 +457,8 @@ |
||
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 |
@@ -500,7 +500,7 @@ |
||
500 | 500 | $html .= '</div>'; |
501 | 501 | $html .= '</div></div>'; |
502 | 502 | } |
503 | - echo $html; |
|
503 | + echo $html; |
|
504 | 504 | } |
505 | 505 | } |
506 | 506 | if (count($forum_list) == 0) { |
@@ -14,7 +14,7 @@ |
||
14 | 14 | api_block_anonymous_users(); |
15 | 15 | |
16 | 16 | if (isset($_REQUEST['userId'])) { |
17 | - $userId = intval($_REQUEST['userId']); |
|
17 | + $userId = intval($_REQUEST['userId']); |
|
18 | 18 | } else { |
19 | 19 | api_not_allowed(); |
20 | 20 | } |
@@ -15,27 +15,27 @@ discard block |
||
15 | 15 | // --------------------------------------------------- |
16 | 16 | if ($_POST['StoreGroupPermissions'] and $setting_visualisation=='checkbox') |
17 | 17 | { |
18 | - $result_message=store_permissions('group', $group_id); |
|
19 | - if ($result_message) |
|
20 | - { |
|
21 | - Display::display_normal_message($result_message); |
|
22 | - } |
|
18 | + $result_message=store_permissions('group', $group_id); |
|
19 | + if ($result_message) |
|
20 | + { |
|
21 | + Display::display_normal_message($result_message); |
|
22 | + } |
|
23 | 23 | } |
24 | 24 | if (isset($_GET['action'])) |
25 | 25 | { |
26 | - if (($_GET['action']=='grant' OR $_GET['action']=='revoke') AND isset($_GET['permission']) AND isset($_GET['tool'])) |
|
27 | - { |
|
28 | - $result_message=store_one_permission('group', $_GET['action'], $group_id, $_GET['tool'], $_GET['permission']); |
|
29 | - } |
|
30 | - if (isset($_GET['role']) AND ($_GET['action']=='grant' OR $_GET['action']=='revoke')) |
|
31 | - { |
|
32 | - $result_message=assign_role('group', $_GET['action'], $group_id, $_GET['role'], $_GET['scope']); |
|
33 | - echo 'hier'; |
|
34 | - } |
|
26 | + if (($_GET['action']=='grant' OR $_GET['action']=='revoke') AND isset($_GET['permission']) AND isset($_GET['tool'])) |
|
27 | + { |
|
28 | + $result_message=store_one_permission('group', $_GET['action'], $group_id, $_GET['tool'], $_GET['permission']); |
|
29 | + } |
|
30 | + if (isset($_GET['role']) AND ($_GET['action']=='grant' OR $_GET['action']=='revoke')) |
|
31 | + { |
|
32 | + $result_message=assign_role('group', $_GET['action'], $group_id, $_GET['role'], $_GET['scope']); |
|
33 | + echo 'hier'; |
|
34 | + } |
|
35 | 35 | } |
36 | 36 | if (isset($result_message)) |
37 | 37 | { |
38 | - Display::display_normal_message($result_message); |
|
38 | + Display::display_normal_message($result_message); |
|
39 | 39 | } |
40 | 40 | |
41 | 41 | // --------------------------------------------------- |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | $inherited_permissions=limited_or_full($inherited_permissions); |
60 | 60 | if (api_get_setting('permissions')=='limited') |
61 | 61 | { |
62 | - $header_array=$rights_limited; |
|
62 | + $header_array=$rights_limited; |
|
63 | 63 | } |
64 | 64 | if (api_get_setting('permissions')=='full') |
65 | 65 | { |
66 | - $header_array=$rights_full; |
|
66 | + $header_array=$rights_full; |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | echo "<form method=\"post\" action=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."\">"; |
@@ -72,12 +72,12 @@ discard block |
||
72 | 72 | // --------------------------------------------------- |
73 | 73 | if (api_get_setting('group_roles')=='true') |
74 | 74 | { |
75 | - // the list of the roles for the user |
|
76 | - echo '<strong>'.get_lang('GroupRoles').'</strong><br />'; |
|
77 | - $current_group_course_roles=get_roles('group',$group_id); |
|
78 | - $current_group_platform_roles=get_roles('group',$group_id, 'platform'); |
|
79 | - display_role_list($current_group_course_roles, $current_group_platform_roles); |
|
80 | - echo '<br />'; |
|
75 | + // the list of the roles for the user |
|
76 | + echo '<strong>'.get_lang('GroupRoles').'</strong><br />'; |
|
77 | + $current_group_course_roles=get_roles('group',$group_id); |
|
78 | + $current_group_platform_roles=get_roles('group',$group_id, 'platform'); |
|
79 | + display_role_list($current_group_course_roles, $current_group_platform_roles); |
|
80 | + echo '<br />'; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | |
@@ -92,47 +92,47 @@ discard block |
||
92 | 92 | echo "\t\t<th>".get_lang('Module')."</th>\n"; |
93 | 93 | foreach ($header_array as $header_key=>$header_value) |
94 | 94 | { |
95 | - echo "\t\t<th>".get_lang($header_value)."</th>\n"; |
|
95 | + echo "\t\t<th>".get_lang($header_value)."</th>\n"; |
|
96 | 96 | } |
97 | 97 | echo "\t</tr>\n"; |
98 | 98 | |
99 | 99 | // the main area with the checkboxes or images |
100 | 100 | foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
101 | 101 | { |
102 | - echo "\t<tr>\n"; |
|
103 | - echo "\t\t<td>\n"; |
|
104 | - echo get_lang($tool); |
|
105 | - echo "\t\t</td>\n"; |
|
102 | + echo "\t<tr>\n"; |
|
103 | + echo "\t\t<td>\n"; |
|
104 | + echo get_lang($tool); |
|
105 | + echo "\t\t</td>\n"; |
|
106 | 106 | |
107 | - foreach ($header_array as $key=>$value) |
|
108 | - { |
|
109 | - echo "\t\t<td align='center'>\n"; |
|
110 | - if (in_array($value,$rights)) |
|
111 | - { |
|
112 | - if ($setting_visualisation=='checkbox') |
|
113 | - { |
|
114 | - //display_checkbox_matrix($current_group_permissions, $tool, $value); |
|
115 | - display_checkbox_matrix($current_group_permissions, $tool, $value, $inherited_permissions,$course_admin); |
|
116 | - } |
|
117 | - if ($setting_visualisation=='image') |
|
118 | - { |
|
119 | - //display_image_matrix($current_group_permissions, $tool, $value); |
|
120 | - display_image_matrix($current_group_permissions, $tool, $value,$inherited_permissions, $course_admin); |
|
121 | - } |
|
122 | - } |
|
123 | - // note: in a later stage this part will be replaced by a function |
|
124 | - // so that we can easily switch between a checkbox approach or an image approach |
|
125 | - // where every click is in fact a change of status. In the checkbox approach you first have to |
|
126 | - // do the changes and then store them by clicking the submit button. |
|
127 | - echo "\t\t</td>\n"; |
|
128 | - } |
|
129 | - echo "\t</tr>\n"; |
|
107 | + foreach ($header_array as $key=>$value) |
|
108 | + { |
|
109 | + echo "\t\t<td align='center'>\n"; |
|
110 | + if (in_array($value,$rights)) |
|
111 | + { |
|
112 | + if ($setting_visualisation=='checkbox') |
|
113 | + { |
|
114 | + //display_checkbox_matrix($current_group_permissions, $tool, $value); |
|
115 | + display_checkbox_matrix($current_group_permissions, $tool, $value, $inherited_permissions,$course_admin); |
|
116 | + } |
|
117 | + if ($setting_visualisation=='image') |
|
118 | + { |
|
119 | + //display_image_matrix($current_group_permissions, $tool, $value); |
|
120 | + display_image_matrix($current_group_permissions, $tool, $value,$inherited_permissions, $course_admin); |
|
121 | + } |
|
122 | + } |
|
123 | + // note: in a later stage this part will be replaced by a function |
|
124 | + // so that we can easily switch between a checkbox approach or an image approach |
|
125 | + // where every click is in fact a change of status. In the checkbox approach you first have to |
|
126 | + // do the changes and then store them by clicking the submit button. |
|
127 | + echo "\t\t</td>\n"; |
|
128 | + } |
|
129 | + echo "\t</tr>\n"; |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | echo "</table>\n"; |
133 | 133 | if ($setting_visualisation=='checkbox') |
134 | 134 | { |
135 | - echo "<input type=\"Submit\" name=\"StoreGroupPermissions\" value=\"".get_lang('StorePermissions')."\">"; |
|
135 | + echo "<input type=\"Submit\" name=\"StoreGroupPermissions\" value=\"".get_lang('StorePermissions')."\">"; |
|
136 | 136 | } |
137 | 137 | echo "</form>"; |
138 | 138 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | WHERE status = '1' AND c_id = '".api_get_course_int_id()."'"; |
50 | 50 | $result = Database::query($sql); |
51 | 51 | while ($user = Database::fetch_assoc($result)) { |
52 | - unset($blog_users[$user['user_id']]); |
|
52 | + unset($blog_users[$user['user_id']]); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | //$user_id=$userIdViewed; |
@@ -84,30 +84,30 @@ discard block |
||
84 | 84 | // RETRIEVING THE PERMISSIONS OF THE ROLES OF THE USER |
85 | 85 | // ------------------------------------------------------------------ |
86 | 86 | if (api_get_setting('user_roles')=='true') { |
87 | - // course roles that are assigned to the user |
|
88 | - $current_user_role_permissions_of_user=get_roles_permissions('user',$user_id); |
|
89 | - $inherited_permissions=permission_array_merge($inherited_permissions,$current_user_role_permissions_of_user); |
|
90 | - // NOTE: deze array moet nog gemerged worden met de $inherited_permissions array |
|
91 | - // (heet momenteel nog $current_group_permissions_of_user omdat voorlopig enkel de |
|
92 | - // groepsge�rfde permissions in beschouwing worden genomen |
|
93 | - // dit moet ook de rol permissies van rollen die toegekend worden aan een gebruiker |
|
94 | - // en de rol permissies van rollen die toegekend worden aan de groepen van een gebruiker |
|
95 | - // omvatten. |
|
96 | - // NOTE: checken als de rollen brol wel degelijk geactiveerd is voordat we dit allemaal |
|
97 | - // ophalen. |
|
98 | - // platform roles that are assigned to the user |
|
99 | - $current_user_role_permissions_of_user=get_roles_permissions('user',$user_id, 'platform'); |
|
100 | - $inherited_permissions=permission_array_merge($inherited_permissions,$current_user_role_permissions_of_user); |
|
87 | + // course roles that are assigned to the user |
|
88 | + $current_user_role_permissions_of_user=get_roles_permissions('user',$user_id); |
|
89 | + $inherited_permissions=permission_array_merge($inherited_permissions,$current_user_role_permissions_of_user); |
|
90 | + // NOTE: deze array moet nog gemerged worden met de $inherited_permissions array |
|
91 | + // (heet momenteel nog $current_group_permissions_of_user omdat voorlopig enkel de |
|
92 | + // groepsge�rfde permissions in beschouwing worden genomen |
|
93 | + // dit moet ook de rol permissies van rollen die toegekend worden aan een gebruiker |
|
94 | + // en de rol permissies van rollen die toegekend worden aan de groepen van een gebruiker |
|
95 | + // omvatten. |
|
96 | + // NOTE: checken als de rollen brol wel degelijk geactiveerd is voordat we dit allemaal |
|
97 | + // ophalen. |
|
98 | + // platform roles that are assigned to the user |
|
99 | + $current_user_role_permissions_of_user=get_roles_permissions('user',$user_id, 'platform'); |
|
100 | + $inherited_permissions=permission_array_merge($inherited_permissions,$current_user_role_permissions_of_user); |
|
101 | 101 | } |
102 | 102 | // ------------------------------------------------------------------ |
103 | 103 | // RETRIEVING THE PERMISSIONS OF THE ROLES OF THE GROUPS OF THE USER |
104 | 104 | // ------------------------------------------------------------------ |
105 | 105 | if (api_get_setting('group_roles')=='true') { |
106 | - // NOTE: DIT MOET NOG VERDER UITGEWERKT WORDEN |
|
107 | - foreach ($groups_of_user as $group) { |
|
108 | - $this_current_group_role_permissions_of_user=get_roles_permissions('user',$user_id); |
|
109 | - //$inherited_permissions[$tool][]=$permission; |
|
110 | - } |
|
106 | + // NOTE: DIT MOET NOG VERDER UITGEWERKT WORDEN |
|
107 | + foreach ($groups_of_user as $group) { |
|
108 | + $this_current_group_role_permissions_of_user=get_roles_permissions('user',$user_id); |
|
109 | + //$inherited_permissions[$tool][]=$permission; |
|
110 | + } |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | echo "<form method=\"post\" action=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."\">"; |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | |
119 | 119 | if (api_get_setting('user_roles')=='true') |
120 | 120 | { |
121 | - // the list of the roles for the user |
|
122 | - echo '<strong>'.get_lang('UserRoles').'</strong><br />'; |
|
123 | - $current_user_course_roles=get_roles('user',$user_id); |
|
124 | - $current_user_platform_roles=get_roles('user',$user_id, 'platform'); |
|
125 | - display_role_list($current_user_course_roles, $current_user_platform_roles); |
|
126 | - echo '<br />'; |
|
121 | + // the list of the roles for the user |
|
122 | + echo '<strong>'.get_lang('UserRoles').'</strong><br />'; |
|
123 | + $current_user_course_roles=get_roles('user',$user_id); |
|
124 | + $current_user_platform_roles=get_roles('user',$user_id, 'platform'); |
|
125 | + display_role_list($current_user_course_roles, $current_user_platform_roles); |
|
126 | + echo '<br />'; |
|
127 | 127 | } |
128 | 128 | |
129 | 129 | // --------------------------------------------------- |
@@ -133,59 +133,59 @@ discard block |
||
133 | 133 | |
134 | 134 | // the header |
135 | 135 | echo "\t<tr>\n"; |
136 | - echo "\t\t<th rowspan=\"2\">".get_lang('Module')."</th>\n"; |
|
137 | - echo "\t\t<th colspan=\"4\">".get_lang('ArticleManager')."</th>\n"; |
|
138 | - echo "\t\t<th colspan=\"3\">".get_lang('CommentManager')."</th>\n"; |
|
139 | - echo "\t\t<th colspan=\"3\">".get_lang('BlogManager')."</th>\n"; |
|
136 | + echo "\t\t<th rowspan=\"2\">".get_lang('Module')."</th>\n"; |
|
137 | + echo "\t\t<th colspan=\"4\">".get_lang('ArticleManager')."</th>\n"; |
|
138 | + echo "\t\t<th colspan=\"3\">".get_lang('CommentManager')."</th>\n"; |
|
139 | + echo "\t\t<th colspan=\"3\">".get_lang('BlogManager')."</th>\n"; |
|
140 | 140 | echo "\t</tr>\n"; |
141 | 141 | |
142 | 142 | // Subheader |
143 | 143 | echo "\t<tr>\n"; |
144 | - echo "\t\t<th align='center'>".get_lang('Add')."</th>\n"; |
|
145 | - echo "\t\t<th align='center'>".get_lang('Delete')."</th>\n"; |
|
146 | - echo "\t\t<th align='center'>".get_lang('Edit')."</th>\n"; |
|
147 | - echo "\t\t<th align='center'>".get_lang('Rate')."</th>\n"; |
|
148 | - echo "\t\t<th align='center'>".get_lang('Add')."</th>\n"; |
|
149 | - echo "\t\t<th align='center'>".get_lang('Delete')."</th>\n"; |
|
150 | - echo "\t\t<th align='center'>".get_lang('Rate')."</th>\n"; |
|
151 | - echo "\t\t<th align='center'>".get_lang('Tasks')."</th>\n"; |
|
152 | - echo "\t\t<th align='center'>".get_lang('Members')."</th>\n"; |
|
153 | - echo "\t\t<th align='center'>".get_lang('Roles')."</th>\n"; |
|
144 | + echo "\t\t<th align='center'>".get_lang('Add')."</th>\n"; |
|
145 | + echo "\t\t<th align='center'>".get_lang('Delete')."</th>\n"; |
|
146 | + echo "\t\t<th align='center'>".get_lang('Edit')."</th>\n"; |
|
147 | + echo "\t\t<th align='center'>".get_lang('Rate')."</th>\n"; |
|
148 | + echo "\t\t<th align='center'>".get_lang('Add')."</th>\n"; |
|
149 | + echo "\t\t<th align='center'>".get_lang('Delete')."</th>\n"; |
|
150 | + echo "\t\t<th align='center'>".get_lang('Rate')."</th>\n"; |
|
151 | + echo "\t\t<th align='center'>".get_lang('Tasks')."</th>\n"; |
|
152 | + echo "\t\t<th align='center'>".get_lang('Members')."</th>\n"; |
|
153 | + echo "\t\t<th align='center'>".get_lang('Roles')."</th>\n"; |
|
154 | 154 | echo "\t</tr>\n"; |
155 | 155 | |
156 | 156 | // the main area with the checkboxes or images |
157 | 157 | foreach ($blog_users as $user_id => $user_name) { // $blog_users contains all the users in this blog |
158 | - // --------------------------------------------------- |
|
159 | - // RETRIEVING THE PERMISSIONS OF THE USER |
|
160 | - // --------------------------------------------------- |
|
161 | - $current_user_permissions = array(); |
|
162 | - $current_user_permissions = get_permissions('user', $user_id); |
|
163 | - |
|
164 | - echo "\t<tr>\n"; |
|
165 | - echo "\t\t<td>\n"; |
|
166 | - echo $user_name; |
|
167 | - echo "\t\t</td>\n"; |
|
168 | - |
|
169 | - foreach ($rights_full as $key => $value) { |
|
170 | - |
|
171 | - echo "\t\t<td align='center'>\n"; |
|
172 | - if (in_array($value,$rights_blog)) { |
|
173 | - display_image_matrix_for_blogs( |
|
174 | - $current_user_permissions, |
|
175 | - $user_id, |
|
176 | - 'BLOG_'.$blog_id, |
|
177 | - $value, |
|
178 | - (isset($inherited_permissions) ? $inherited_permissions : null), |
|
179 | - (isset($course_admin) ? $course_admin : null) |
|
180 | - ); |
|
181 | - } |
|
182 | - // note: in a later stage this part will be replaced by a function |
|
183 | - // so that we can easily switch between a checkbox approach or an image approach |
|
184 | - // where every click is in fact a change of status. In the checkbox approach you first have to |
|
185 | - // do the changes and then store them by clicking the submit button. |
|
186 | - echo "\t\t</td>\n"; |
|
187 | - } |
|
188 | - echo "\t</tr>\n"; |
|
158 | + // --------------------------------------------------- |
|
159 | + // RETRIEVING THE PERMISSIONS OF THE USER |
|
160 | + // --------------------------------------------------- |
|
161 | + $current_user_permissions = array(); |
|
162 | + $current_user_permissions = get_permissions('user', $user_id); |
|
163 | + |
|
164 | + echo "\t<tr>\n"; |
|
165 | + echo "\t\t<td>\n"; |
|
166 | + echo $user_name; |
|
167 | + echo "\t\t</td>\n"; |
|
168 | + |
|
169 | + foreach ($rights_full as $key => $value) { |
|
170 | + |
|
171 | + echo "\t\t<td align='center'>\n"; |
|
172 | + if (in_array($value,$rights_blog)) { |
|
173 | + display_image_matrix_for_blogs( |
|
174 | + $current_user_permissions, |
|
175 | + $user_id, |
|
176 | + 'BLOG_'.$blog_id, |
|
177 | + $value, |
|
178 | + (isset($inherited_permissions) ? $inherited_permissions : null), |
|
179 | + (isset($course_admin) ? $course_admin : null) |
|
180 | + ); |
|
181 | + } |
|
182 | + // note: in a later stage this part will be replaced by a function |
|
183 | + // so that we can easily switch between a checkbox approach or an image approach |
|
184 | + // where every click is in fact a change of status. In the checkbox approach you first have to |
|
185 | + // do the changes and then store them by clicking the submit button. |
|
186 | + echo "\t\t</td>\n"; |
|
187 | + } |
|
188 | + echo "\t</tr>\n"; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | echo "</table>\n"; |
@@ -18,56 +18,56 @@ discard block |
||
18 | 18 | // storing all the permission for a given role when the checkbox approach is used |
19 | 19 | if ($_POST['StoreRolePermissions']) |
20 | 20 | { |
21 | - if (!empty($_POST['role_name'])) |
|
22 | - { |
|
23 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
24 | - $sql="INSERT INTO $table_role (role_name, role_comment, default_role) |
|
21 | + if (!empty($_POST['role_name'])) |
|
22 | + { |
|
23 | + $table_role=Database::get_course_table(TABLE_ROLE); |
|
24 | + $sql="INSERT INTO $table_role (role_name, role_comment, default_role) |
|
25 | 25 | VALUES ('".Database::escape_string($_POST['role_name'])."','".Database::escape_string($_POST['role_comment'])."','".Database::escape_string($_POST['default_role'])."')"; |
26 | - $result=Database::query($sql); |
|
27 | - $role_id=Database::insert_id(); |
|
28 | - $result_message=store_permissions('role', $role_id); |
|
29 | - } |
|
30 | - else |
|
31 | - { |
|
32 | - $result_message=get_lang('ErrorPleaseGiveRoleName'); |
|
33 | - } |
|
26 | + $result=Database::query($sql); |
|
27 | + $role_id=Database::insert_id(); |
|
28 | + $result_message=store_permissions('role', $role_id); |
|
29 | + } |
|
30 | + else |
|
31 | + { |
|
32 | + $result_message=get_lang('ErrorPleaseGiveRoleName'); |
|
33 | + } |
|
34 | 34 | } |
35 | 35 | // storing a permission for a given role when the image approach is used |
36 | 36 | if (isset($_GET['action']) AND isset($_GET['permission']) AND isset($_GET['tool'])) |
37 | 37 | { |
38 | - if ($_GET['action']=='grant' OR $_GET['action']=='revoke') |
|
39 | - { |
|
40 | - $result_message=store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']); |
|
41 | - } |
|
38 | + if ($_GET['action']=='grant' OR $_GET['action']=='revoke') |
|
39 | + { |
|
40 | + $result_message=store_one_permission('role', $_GET['action'], $role_id, $_GET['tool'], $_GET['permission']); |
|
41 | + } |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // deleting a role |
45 | 45 | if (isset($_GET['action']) AND isset($_GET['role_id']) AND $_GET['action']=='delete') { |
46 | - //deleting the assignments fo this role: users |
|
47 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
48 | - $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
49 | - $result=Database::query($sql); |
|
46 | + //deleting the assignments fo this role: users |
|
47 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
48 | + $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
49 | + $result=Database::query($sql); |
|
50 | 50 | |
51 | - // deleting the assignments of this role: groups |
|
52 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
53 | - $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
54 | - $result=Database::query($sql); |
|
51 | + // deleting the assignments of this role: groups |
|
52 | + $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
53 | + $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
54 | + $result=Database::query($sql); |
|
55 | 55 | |
56 | - // deleting the permissions of this role |
|
57 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
58 | - $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
59 | - $result=Database::query($sql); |
|
56 | + // deleting the permissions of this role |
|
57 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
58 | + $sql="DELETE FROM $table WHERE role_id='".intval($_GET['role_id'])."'"; |
|
59 | + $result=Database::query($sql); |
|
60 | 60 | |
61 | - // deleting the role |
|
62 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
63 | - $sql="DELETE FROM $table_role WHERE role_id='".intval($_GET['role_id'])."'"; |
|
64 | - $result=Database::query($sql); |
|
65 | - $result_message=get_lang('RoleDeleted'); |
|
61 | + // deleting the role |
|
62 | + $table_role=Database::get_course_table(TABLE_ROLE); |
|
63 | + $sql="DELETE FROM $table_role WHERE role_id='".intval($_GET['role_id'])."'"; |
|
64 | + $result=Database::query($sql); |
|
65 | + $result_message=get_lang('RoleDeleted'); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | // displaying the return message of the actions |
69 | 69 | if (isset($result_message)) { |
70 | - Display::display_normal_message($result_message); |
|
70 | + Display::display_normal_message($result_message); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | // ADDING A NEW ROLE (FORM AND LINK) |
@@ -75,73 +75,73 @@ discard block |
||
75 | 75 | |
76 | 76 | if ($_GET['action']=='add') |
77 | 77 | { |
78 | - echo "<form method=\"post\" action=\"".api_get_self()."\">"; |
|
79 | - echo "\n<table>"; |
|
80 | - echo "\n\t<tr>"; |
|
81 | - echo "\n\t\t<td>"; |
|
82 | - echo get_lang('RoleName'); |
|
83 | - echo "\n\t\t</td>"; |
|
84 | - echo "\n\t\t<td>"; |
|
85 | - echo "\n\t\t\t<input type='text' name='role_name'>"; |
|
86 | - echo "\n\t\t</td>"; |
|
87 | - echo "\n\t</tr>"; |
|
88 | - echo "\n\t<tr>"; |
|
89 | - echo "\n\t\t<td>"; |
|
90 | - echo get_lang('RoleComment'); |
|
91 | - echo "\n\t\t</td>"; |
|
92 | - echo "\n\t\t<td>"; |
|
93 | - echo "\n\t\t\t<textarea name='role_comment'></textarea>"; |
|
94 | - echo "\n\t\t</td>"; |
|
95 | - echo "\n\t</tr>"; |
|
96 | - echo "\n\t<tr>"; |
|
97 | - echo "\n\t\t<td>"; |
|
98 | - echo get_lang('DefaultRole'); |
|
99 | - echo "\n\t\t</td>"; |
|
100 | - echo "\n\t\t<td>"; |
|
101 | - echo "\n\t\t\t<input type=\"checkbox\" name=\"default_role\" value=\"1\">"; |
|
102 | - echo "\n\t\t</td>"; |
|
103 | - echo "\n\t</tr>"; |
|
104 | - echo "\n</table>"; |
|
105 | - echo "<table class=\"data_table\">\n"; |
|
78 | + echo "<form method=\"post\" action=\"".api_get_self()."\">"; |
|
79 | + echo "\n<table>"; |
|
80 | + echo "\n\t<tr>"; |
|
81 | + echo "\n\t\t<td>"; |
|
82 | + echo get_lang('RoleName'); |
|
83 | + echo "\n\t\t</td>"; |
|
84 | + echo "\n\t\t<td>"; |
|
85 | + echo "\n\t\t\t<input type='text' name='role_name'>"; |
|
86 | + echo "\n\t\t</td>"; |
|
87 | + echo "\n\t</tr>"; |
|
88 | + echo "\n\t<tr>"; |
|
89 | + echo "\n\t\t<td>"; |
|
90 | + echo get_lang('RoleComment'); |
|
91 | + echo "\n\t\t</td>"; |
|
92 | + echo "\n\t\t<td>"; |
|
93 | + echo "\n\t\t\t<textarea name='role_comment'></textarea>"; |
|
94 | + echo "\n\t\t</td>"; |
|
95 | + echo "\n\t</tr>"; |
|
96 | + echo "\n\t<tr>"; |
|
97 | + echo "\n\t\t<td>"; |
|
98 | + echo get_lang('DefaultRole'); |
|
99 | + echo "\n\t\t</td>"; |
|
100 | + echo "\n\t\t<td>"; |
|
101 | + echo "\n\t\t\t<input type=\"checkbox\" name=\"default_role\" value=\"1\">"; |
|
102 | + echo "\n\t\t</td>"; |
|
103 | + echo "\n\t</tr>"; |
|
104 | + echo "\n</table>"; |
|
105 | + echo "<table class=\"data_table\">\n"; |
|
106 | 106 | |
107 | - // the header |
|
108 | - if (api_get_setting('permissions')=='limited') |
|
109 | - { |
|
110 | - $header_array=$rights_limited; |
|
111 | - } |
|
112 | - if (api_get_setting('permissions')=='full') |
|
113 | - { |
|
114 | - $header_array=$rights_full; |
|
115 | - } |
|
116 | - echo "\t<tr>\n"; |
|
117 | - echo "\t\t<th>".get_lang('Module')."</th>\n"; |
|
118 | - foreach ($header_array as $header_key=>$header_value) |
|
119 | - { |
|
120 | - echo "\t\t<th>".get_lang($header_value)."</th>\n"; |
|
121 | - } |
|
122 | - echo "\t</tr>\n"; |
|
107 | + // the header |
|
108 | + if (api_get_setting('permissions')=='limited') |
|
109 | + { |
|
110 | + $header_array=$rights_limited; |
|
111 | + } |
|
112 | + if (api_get_setting('permissions')=='full') |
|
113 | + { |
|
114 | + $header_array=$rights_full; |
|
115 | + } |
|
116 | + echo "\t<tr>\n"; |
|
117 | + echo "\t\t<th>".get_lang('Module')."</th>\n"; |
|
118 | + foreach ($header_array as $header_key=>$header_value) |
|
119 | + { |
|
120 | + echo "\t\t<th>".get_lang($header_value)."</th>\n"; |
|
121 | + } |
|
122 | + echo "\t</tr>\n"; |
|
123 | 123 | |
124 | - // the main area with the checkboxes or images |
|
125 | - foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
126 | - { |
|
127 | - echo "\t<tr>\n"; |
|
128 | - echo "\t\t<td>\n"; |
|
129 | - echo get_lang($tool); |
|
130 | - echo "\t\t</td>\n"; |
|
124 | + // the main area with the checkboxes or images |
|
125 | + foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
126 | + { |
|
127 | + echo "\t<tr>\n"; |
|
128 | + echo "\t\t<td>\n"; |
|
129 | + echo get_lang($tool); |
|
130 | + echo "\t\t</td>\n"; |
|
131 | 131 | |
132 | - foreach ($header_array as $key=>$value) |
|
133 | - { |
|
134 | - echo "\t\t<td align='center'>\n"; |
|
135 | - display_checkbox_matrix(array(), $tool, $value); |
|
136 | - echo "\t\t</td>\n"; |
|
137 | - } |
|
138 | - echo "\t</tr>\n"; |
|
139 | - } |
|
132 | + foreach ($header_array as $key=>$value) |
|
133 | + { |
|
134 | + echo "\t\t<td align='center'>\n"; |
|
135 | + display_checkbox_matrix(array(), $tool, $value); |
|
136 | + echo "\t\t</td>\n"; |
|
137 | + } |
|
138 | + echo "\t</tr>\n"; |
|
139 | + } |
|
140 | 140 | |
141 | - echo "</table>\n"; |
|
141 | + echo "</table>\n"; |
|
142 | 142 | |
143 | - echo "<input type=\"Submit\" name=\"StoreRolePermissions\" value=\"".get_lang('StorePermissions')."\">"; |
|
144 | - echo "</form>"; |
|
143 | + echo "<input type=\"Submit\" name=\"StoreRolePermissions\" value=\"".get_lang('StorePermissions')."\">"; |
|
144 | + echo "</form>"; |
|
145 | 145 | |
146 | 146 | } |
147 | 147 | |
@@ -154,23 +154,23 @@ discard block |
||
154 | 154 | $all_roles=get_all_roles('platform'); |
155 | 155 | foreach ($all_roles as $role) |
156 | 156 | { |
157 | - echo '<div><a href="roles.php?action=view&role_id='.$role['role_id'].'&scope=platform">'.$role['role_name'].'</a></div>'; |
|
158 | - echo '<div>'.$role['role_comment'].'</div><br />'; |
|
159 | - if ($role['role_id']==$_GET['role_id']) |
|
160 | - { |
|
161 | - $current_role_info=$role; |
|
162 | - } |
|
157 | + echo '<div><a href="roles.php?action=view&role_id='.$role['role_id'].'&scope=platform">'.$role['role_name'].'</a></div>'; |
|
158 | + echo '<div>'.$role['role_comment'].'</div><br />'; |
|
159 | + if ($role['role_id']==$_GET['role_id']) |
|
160 | + { |
|
161 | + $current_role_info=$role; |
|
162 | + } |
|
163 | 163 | } |
164 | 164 | // course roles |
165 | 165 | $all_roles=get_all_roles(); |
166 | 166 | foreach ($all_roles as $role) |
167 | 167 | { |
168 | - echo '<div><a href="roles.php?action=view&role_id='.$role['role_id'].'">'.$role['role_name'].'</a><a href="roles.php?action=delete&role_id='.$role['role_id'].'"><img src="../img/delete.gif" /></a></div>'; |
|
169 | - echo '<div>'.$role['role_comment'].'</div><br />'; |
|
170 | - if ($role['role_id']==$_GET['role_id']) |
|
171 | - { |
|
172 | - $current_role_info=$role; |
|
173 | - } |
|
168 | + echo '<div><a href="roles.php?action=view&role_id='.$role['role_id'].'">'.$role['role_name'].'</a><a href="roles.php?action=delete&role_id='.$role['role_id'].'"><img src="../img/delete.gif" /></a></div>'; |
|
169 | + echo '<div>'.$role['role_comment'].'</div><br />'; |
|
170 | + if ($role['role_id']==$_GET['role_id']) |
|
171 | + { |
|
172 | + $current_role_info=$role; |
|
173 | + } |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | // =================================================== |
@@ -178,83 +178,83 @@ discard block |
||
178 | 178 | // =================================================== |
179 | 179 | if ($_GET['role_id']) |
180 | 180 | { |
181 | - $current_role_permissions=get_permissions('role',$_GET['role_id']); |
|
181 | + $current_role_permissions=get_permissions('role',$_GET['role_id']); |
|
182 | 182 | |
183 | - // --------------------------------------------------- |
|
184 | - // LIMITED OR FULL |
|
185 | - // --------------------------------------------------- |
|
186 | - $current_role_permissions=limited_or_full($current_role_permissions); |
|
187 | - if (api_get_setting('permissions')=='limited') |
|
188 | - { |
|
189 | - $header_array=$rights_limited; |
|
190 | - } |
|
191 | - if (api_get_setting('permissions')=='full') |
|
192 | - { |
|
193 | - $header_array=$rights_full; |
|
194 | - } |
|
195 | - // --------------------------------------------------- |
|
196 | - // DISPLAYING THE MATRIX |
|
197 | - // --------------------------------------------------- |
|
198 | - echo "<form method=\"post\" action=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."\">"; |
|
183 | + // --------------------------------------------------- |
|
184 | + // LIMITED OR FULL |
|
185 | + // --------------------------------------------------- |
|
186 | + $current_role_permissions=limited_or_full($current_role_permissions); |
|
187 | + if (api_get_setting('permissions')=='limited') |
|
188 | + { |
|
189 | + $header_array=$rights_limited; |
|
190 | + } |
|
191 | + if (api_get_setting('permissions')=='full') |
|
192 | + { |
|
193 | + $header_array=$rights_full; |
|
194 | + } |
|
195 | + // --------------------------------------------------- |
|
196 | + // DISPLAYING THE MATRIX |
|
197 | + // --------------------------------------------------- |
|
198 | + echo "<form method=\"post\" action=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."\">"; |
|
199 | 199 | |
200 | - // the list of the roles for the user |
|
201 | - echo get_lang('PermissionsOfRole').':'.$current_role_info['role_name'].'<br />'; |
|
202 | - if ($_GET['scope']=='platform') |
|
203 | - { |
|
204 | - echo get_lang('IsPlatformRoleNotEditable').'<br />'; |
|
205 | - } |
|
200 | + // the list of the roles for the user |
|
201 | + echo get_lang('PermissionsOfRole').':'.$current_role_info['role_name'].'<br />'; |
|
202 | + if ($_GET['scope']=='platform') |
|
203 | + { |
|
204 | + echo get_lang('IsPlatformRoleNotEditable').'<br />'; |
|
205 | + } |
|
206 | 206 | |
207 | - echo "<table class=\"data_table\">\n"; |
|
207 | + echo "<table class=\"data_table\">\n"; |
|
208 | 208 | |
209 | - // the header |
|
210 | - echo "\t<tr>\n"; |
|
211 | - echo "\t\t<th>".get_lang('Module')."</th>\n"; |
|
212 | - foreach ($header_array as $header_key=>$header_value) |
|
213 | - { |
|
214 | - echo "\t\t<th>".get_lang($header_value)."</th>\n"; |
|
215 | - } |
|
216 | - echo "\t</tr>\n"; |
|
209 | + // the header |
|
210 | + echo "\t<tr>\n"; |
|
211 | + echo "\t\t<th>".get_lang('Module')."</th>\n"; |
|
212 | + foreach ($header_array as $header_key=>$header_value) |
|
213 | + { |
|
214 | + echo "\t\t<th>".get_lang($header_value)."</th>\n"; |
|
215 | + } |
|
216 | + echo "\t</tr>\n"; |
|
217 | 217 | |
218 | - // the main area with the checkboxes or images |
|
219 | - foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
220 | - { |
|
221 | - echo "\t<tr>\n"; |
|
222 | - echo "\t\t<td>\n"; |
|
223 | - echo get_lang($tool); |
|
224 | - echo "\t\t</td>\n"; |
|
218 | + // the main area with the checkboxes or images |
|
219 | + foreach ($tool_rights as $tool=>$rights) // $tool_rights contains all the possible tools and their rights |
|
220 | + { |
|
221 | + echo "\t<tr>\n"; |
|
222 | + echo "\t\t<td>\n"; |
|
223 | + echo get_lang($tool); |
|
224 | + echo "\t\t</td>\n"; |
|
225 | 225 | |
226 | - foreach ($header_array as $key=>$value) |
|
227 | - { |
|
228 | - echo "\t\t<td align='center'>\n"; |
|
229 | - if (in_array($value,$rights)) |
|
230 | - { |
|
231 | - if ($setting_visualisation=='checkbox') |
|
232 | - { |
|
233 | - display_checkbox_matrix($current_role_permissions, $tool, $value); |
|
234 | - } |
|
235 | - if ($setting_visualisation=='image') |
|
236 | - { |
|
237 | - if ($_GET['scope']=='platform') |
|
238 | - { |
|
239 | - $roles_editable=false; |
|
240 | - } |
|
241 | - else |
|
242 | - { |
|
243 | - $roles_editable=true; |
|
244 | - } |
|
245 | - display_image_matrix($current_role_permissions, $tool, $value, '','',$roles_editable); |
|
246 | - } |
|
247 | - } |
|
248 | - echo "\t\t</td>\n"; |
|
249 | - } |
|
250 | - echo "\t</tr>\n"; |
|
251 | - } |
|
226 | + foreach ($header_array as $key=>$value) |
|
227 | + { |
|
228 | + echo "\t\t<td align='center'>\n"; |
|
229 | + if (in_array($value,$rights)) |
|
230 | + { |
|
231 | + if ($setting_visualisation=='checkbox') |
|
232 | + { |
|
233 | + display_checkbox_matrix($current_role_permissions, $tool, $value); |
|
234 | + } |
|
235 | + if ($setting_visualisation=='image') |
|
236 | + { |
|
237 | + if ($_GET['scope']=='platform') |
|
238 | + { |
|
239 | + $roles_editable=false; |
|
240 | + } |
|
241 | + else |
|
242 | + { |
|
243 | + $roles_editable=true; |
|
244 | + } |
|
245 | + display_image_matrix($current_role_permissions, $tool, $value, '','',$roles_editable); |
|
246 | + } |
|
247 | + } |
|
248 | + echo "\t\t</td>\n"; |
|
249 | + } |
|
250 | + echo "\t</tr>\n"; |
|
251 | + } |
|
252 | 252 | |
253 | - echo "</table>\n"; |
|
254 | - if ($setting_visualisation=='checkbox') |
|
255 | - { |
|
256 | - echo "<input type=\"Submit\" name=\"StoreRolePermissions\" value=\"".get_lang('StorePermissions')."\">"; |
|
257 | - } |
|
258 | - echo "</form>"; |
|
253 | + echo "</table>\n"; |
|
254 | + if ($setting_visualisation=='checkbox') |
|
255 | + { |
|
256 | + echo "<input type=\"Submit\" name=\"StoreRolePermissions\" value=\"".get_lang('StorePermissions')."\">"; |
|
257 | + } |
|
258 | + echo "</form>"; |
|
259 | 259 | } |
260 | 260 | Display::display_footer(); |
261 | 261 | \ No newline at end of file |