@@ -128,7 +128,7 @@ |
||
128 | 128 | if (isset($friends[$j])) { |
129 | 129 | $friend = $friends[$j]; |
130 | 130 | $user_name = api_xml_http_response_encode($friend['firstName'].' '.$friend['lastName']); |
131 | - $userPicture = UserManager::getUserPicture($friend['friend_user_id']); |
|
131 | + $userPicture = UserManager::getUserPicture($friend['friend_user_id']); |
|
132 | 132 | |
133 | 133 | $friend_html .= ' |
134 | 134 | <div class="col-md-3"> |
@@ -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"; |
@@ -25,38 +25,38 @@ discard block |
||
25 | 25 | function store_permissions($content, $id) { |
26 | 26 | $course_id = api_get_course_int_id(); |
27 | 27 | |
28 | - // Which database are we using (depending on the $content parameter) |
|
29 | - if ($content=='user') |
|
30 | - { |
|
31 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
32 | - $id_field = user_id; |
|
33 | - } |
|
34 | - if ($content=='group') |
|
35 | - { |
|
36 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
37 | - $id_field = group_id; |
|
38 | - } |
|
39 | - if ($content=='role') |
|
40 | - { |
|
41 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
42 | - $id_field = role_id; |
|
43 | - } |
|
44 | - |
|
45 | - // We first delete all the existing permissions for that user/group/role |
|
46 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
47 | - $result=Database::query($sql); |
|
28 | + // Which database are we using (depending on the $content parameter) |
|
29 | + if ($content=='user') |
|
30 | + { |
|
31 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
32 | + $id_field = user_id; |
|
33 | + } |
|
34 | + if ($content=='group') |
|
35 | + { |
|
36 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
37 | + $id_field = group_id; |
|
38 | + } |
|
39 | + if ($content=='role') |
|
40 | + { |
|
41 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
42 | + $id_field = role_id; |
|
43 | + } |
|
48 | 44 | |
49 | - // looping through the post values to find the permission (containing the string permission* ) |
|
50 | - foreach ($_POST as $key => $value) |
|
51 | - { |
|
52 | - if (strstr($key,"permission*")) |
|
53 | - { |
|
54 | - list($brol,$tool,$action)=explode("*",$key); |
|
55 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
56 | - $result=Database::query($sql); |
|
57 | - } |
|
58 | - } |
|
59 | - return get_lang('PermissionsStored'); |
|
45 | + // We first delete all the existing permissions for that user/group/role |
|
46 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."'"; |
|
47 | + $result=Database::query($sql); |
|
48 | + |
|
49 | + // looping through the post values to find the permission (containing the string permission* ) |
|
50 | + foreach ($_POST as $key => $value) |
|
51 | + { |
|
52 | + if (strstr($key,"permission*")) |
|
53 | + { |
|
54 | + list($brol,$tool,$action)=explode("*",$key); |
|
55 | + $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($action)."')"; |
|
56 | + $result=Database::query($sql); |
|
57 | + } |
|
58 | + } |
|
59 | + return get_lang('PermissionsStored'); |
|
60 | 60 | } |
61 | 61 | |
62 | 62 | /** |
@@ -70,50 +70,50 @@ discard block |
||
70 | 70 | * @version 1.0 |
71 | 71 | */ |
72 | 72 | function store_one_permission($content, $action, $id, $tool,$permission) { |
73 | - global $rights_full; |
|
73 | + global $rights_full; |
|
74 | 74 | $course_id = api_get_course_int_id(); |
75 | - // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
|
75 | + // for some reason I don't know, he can't get to the $rights_full array, so commented the following lines out. |
|
76 | 76 | |
77 | - // check |
|
78 | - //if(!in_array($permission, $rights_full)) |
|
79 | - //{ |
|
80 | - // return get_lang('Error'); |
|
81 | - //} |
|
77 | + // check |
|
78 | + //if(!in_array($permission, $rights_full)) |
|
79 | + //{ |
|
80 | + // return get_lang('Error'); |
|
81 | + //} |
|
82 | 82 | |
83 | - // Which database are we using (depending on the $content parameter) |
|
83 | + // Which database are we using (depending on the $content parameter) |
|
84 | 84 | |
85 | - if ($content=='user') { |
|
86 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
87 | - $id_field = user_id; |
|
88 | - } |
|
89 | - if ($content=='group') |
|
90 | - { |
|
91 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
92 | - $id_field = group_id; |
|
93 | - } |
|
94 | - if ($content=='role') |
|
95 | - { |
|
96 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
97 | - $id_field = role_id; |
|
98 | - } |
|
85 | + if ($content=='user') { |
|
86 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
87 | + $id_field = user_id; |
|
88 | + } |
|
89 | + if ($content=='group') |
|
90 | + { |
|
91 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
92 | + $id_field = group_id; |
|
93 | + } |
|
94 | + if ($content=='role') |
|
95 | + { |
|
96 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
97 | + $id_field = role_id; |
|
98 | + } |
|
99 | 99 | |
100 | - // grating a right |
|
101 | - if ($action=='grant') { |
|
102 | - $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
103 | - $result=Database::query($sql); |
|
104 | - if($result) { |
|
105 | - $result_message=get_lang('PermissionGranted'); |
|
106 | - } |
|
107 | - } |
|
108 | - if ($action=='revoke') |
|
109 | - { |
|
110 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
111 | - $result=Database::query($sql); |
|
112 | - if($result) { |
|
113 | - $result_message=get_lang('PermissionRevoked'); |
|
114 | - } |
|
115 | - } |
|
116 | - return $result_message; |
|
100 | + // grating a right |
|
101 | + if ($action=='grant') { |
|
102 | + $sql="INSERT INTO $table (c_id, $id_field,tool,action) VALUES ($course_id, '".Database::escape_string($id)."','".Database::escape_string($tool)."','".Database::escape_string($permission)."')"; |
|
103 | + $result=Database::query($sql); |
|
104 | + if($result) { |
|
105 | + $result_message=get_lang('PermissionGranted'); |
|
106 | + } |
|
107 | + } |
|
108 | + if ($action=='revoke') |
|
109 | + { |
|
110 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND tool='".Database::escape_string($tool)."' AND action='".Database::escape_string($permission)."'"; |
|
111 | + $result=Database::query($sql); |
|
112 | + if($result) { |
|
113 | + $result_message=get_lang('PermissionRevoked'); |
|
114 | + } |
|
115 | + } |
|
116 | + return $result_message; |
|
117 | 117 | } |
118 | 118 | |
119 | 119 | /** |
@@ -125,47 +125,47 @@ discard block |
||
125 | 125 | */ |
126 | 126 | function get_permissions($content, $id) { |
127 | 127 | $course_id = api_get_course_int_id(); |
128 | - $currentpermissions=array(); |
|
129 | - // Which database are we using (depending on the $content parameter) |
|
128 | + $currentpermissions=array(); |
|
129 | + // Which database are we using (depending on the $content parameter) |
|
130 | 130 | $course_id_condition = " c_id = $course_id AND "; |
131 | - if ($content == 'user') |
|
132 | - { |
|
133 | - $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
134 | - $id_field = 'user_id'; |
|
135 | - } |
|
136 | - elseif ($content == 'group') |
|
137 | - { |
|
138 | - $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
139 | - $id_field = 'group_id'; |
|
140 | - } |
|
141 | - elseif ($content == 'role') |
|
142 | - { |
|
143 | - $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
144 | - $id_field = 'role_id'; |
|
145 | - } |
|
146 | - elseif ($content == 'platform_role') |
|
147 | - { |
|
148 | - $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
149 | - $id_field = 'role_id'; |
|
131 | + if ($content == 'user') |
|
132 | + { |
|
133 | + $table=Database::get_course_table(TABLE_PERMISSION_USER); |
|
134 | + $id_field = 'user_id'; |
|
135 | + } |
|
136 | + elseif ($content == 'group') |
|
137 | + { |
|
138 | + $table=Database::get_course_table(TABLE_PERMISSION_GROUP); |
|
139 | + $id_field = 'group_id'; |
|
140 | + } |
|
141 | + elseif ($content == 'role') |
|
142 | + { |
|
143 | + $table=Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
144 | + $id_field = 'role_id'; |
|
145 | + } |
|
146 | + elseif ($content == 'platform_role') |
|
147 | + { |
|
148 | + $table=Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
149 | + $id_field = 'role_id'; |
|
150 | 150 | $course_id_condition = ''; |
151 | - } |
|
152 | - elseif ($content == 'task') |
|
153 | - { |
|
154 | - $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
155 | - $id_field = 'task_id'; |
|
156 | - } |
|
151 | + } |
|
152 | + elseif ($content == 'task') |
|
153 | + { |
|
154 | + $table=Database::get_course_table(TABLE_BLOGS_TASKS_PERMISSIONS); |
|
155 | + $id_field = 'task_id'; |
|
156 | + } |
|
157 | 157 | |
158 | - // finding all the permissions. We store this in a multidimensional array |
|
159 | - // where the first dimension is the tool. |
|
160 | - $sql=" |
|
158 | + // finding all the permissions. We store this in a multidimensional array |
|
159 | + // where the first dimension is the tool. |
|
160 | + $sql=" |
|
161 | 161 | SELECT * FROM " . $table . " |
162 | 162 | WHERE $course_id_condition " . $id_field . "='" . Database::escape_string($id) . "'"; |
163 | - $result = Database::query($sql); |
|
163 | + $result = Database::query($sql); |
|
164 | 164 | |
165 | - while($row = Database::fetch_array($result)) |
|
166 | - $currentpermissions[$row['tool']][] = $row['action']; |
|
165 | + while($row = Database::fetch_array($result)) |
|
166 | + $currentpermissions[$row['tool']][] = $row['action']; |
|
167 | 167 | |
168 | - return $currentpermissions; |
|
168 | + return $currentpermissions; |
|
169 | 169 | } |
170 | 170 | |
171 | 171 | /** |
@@ -179,38 +179,38 @@ discard block |
||
179 | 179 | */ |
180 | 180 | function limited_or_full($current_permissions) |
181 | 181 | { |
182 | - if (api_get_setting('permissions')=='limited') |
|
183 | - { |
|
184 | - foreach ($current_permissions as $tool=>$tool_rights) |
|
185 | - { |
|
186 | - // we loop through the possible permissions of a tool and unset the entry if it is view |
|
187 | - // if it is visibility or move we have to grant the edit right |
|
188 | - foreach ($tool_rights as $key=>$value) |
|
189 | - { |
|
190 | - if ($value=='View') |
|
191 | - { |
|
192 | - unset($current_permissions[$tool][$key]); |
|
193 | - } |
|
194 | - if ($value=='Visibility' OR $value=='Move') |
|
195 | - { |
|
196 | - if (!in_array('Edit',$current_permissions[$tool])) |
|
197 | - { |
|
198 | - $current_permissions[$tool][]='Edit'; |
|
199 | - } |
|
200 | - unset($current_permissions[$tool][$key]); |
|
201 | - } |
|
202 | - //else |
|
203 | - //{ |
|
204 | - // $current_permissions[$tool][]=$value; |
|
205 | - //} |
|
206 | - } |
|
207 | - } |
|
208 | - return $current_permissions; |
|
209 | - } |
|
210 | - if (api_get_setting('permissions')=='full') |
|
211 | - { |
|
212 | - return $current_permissions; |
|
213 | - } |
|
182 | + if (api_get_setting('permissions')=='limited') |
|
183 | + { |
|
184 | + foreach ($current_permissions as $tool=>$tool_rights) |
|
185 | + { |
|
186 | + // we loop through the possible permissions of a tool and unset the entry if it is view |
|
187 | + // if it is visibility or move we have to grant the edit right |
|
188 | + foreach ($tool_rights as $key=>$value) |
|
189 | + { |
|
190 | + if ($value=='View') |
|
191 | + { |
|
192 | + unset($current_permissions[$tool][$key]); |
|
193 | + } |
|
194 | + if ($value=='Visibility' OR $value=='Move') |
|
195 | + { |
|
196 | + if (!in_array('Edit',$current_permissions[$tool])) |
|
197 | + { |
|
198 | + $current_permissions[$tool][]='Edit'; |
|
199 | + } |
|
200 | + unset($current_permissions[$tool][$key]); |
|
201 | + } |
|
202 | + //else |
|
203 | + //{ |
|
204 | + // $current_permissions[$tool][]=$value; |
|
205 | + //} |
|
206 | + } |
|
207 | + } |
|
208 | + return $current_permissions; |
|
209 | + } |
|
210 | + if (api_get_setting('permissions')=='full') |
|
211 | + { |
|
212 | + return $current_permissions; |
|
213 | + } |
|
214 | 214 | } |
215 | 215 | /** |
216 | 216 | * This function displays a checked or unchecked checkbox. The checkbox will be checked if the |
@@ -224,12 +224,12 @@ discard block |
||
224 | 224 | */ |
225 | 225 | function display_checkbox_matrix($permission_array, $tool, $permission, $inherited_permissions=array()) |
226 | 226 | { |
227 | - $checked=""; |
|
228 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
229 | - { |
|
230 | - $checked="checked"; |
|
231 | - } |
|
232 | - echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
|
227 | + $checked=""; |
|
228 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
229 | + { |
|
230 | + $checked="checked"; |
|
231 | + } |
|
232 | + echo "\t\t\t<input type=\"checkbox\" name=\"permission*$tool*$permission\" $checked>\n"; |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | |
@@ -245,62 +245,62 @@ discard block |
||
245 | 245 | */ |
246 | 246 | function display_image_matrix($permission_array, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
247 | 247 | { |
248 | - if ($course_admin) { |
|
249 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
250 | - } else { |
|
251 | - if (in_array($permission,$inherited_permissions[$tool])) { |
|
252 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
253 | - } else { |
|
254 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
255 | - if ($editable) { |
|
256 | - $url=api_get_self(); |
|
257 | - $urlparameters = ''; |
|
258 | - foreach($_GET as $key=>$value) { |
|
259 | - $parameter[$key]=$value; |
|
260 | - } |
|
261 | - $parameter['action']='revoke'; |
|
262 | - $parameter['permission']=$permission; |
|
263 | - $parameter['tool']=$tool; |
|
264 | - foreach ($parameter as $key=>$value) { |
|
265 | - $urlparameters.=$key.'='.$value.'&'; |
|
266 | - } |
|
267 | - $url=$url.'?'.$urlparameters; |
|
268 | - |
|
269 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
270 | - } |
|
271 | - echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/>"; |
|
272 | - if ($editable) { |
|
273 | - echo "</a>"; |
|
274 | - } |
|
275 | - } else { |
|
276 | - if ($editable) |
|
277 | - { |
|
278 | - $url=api_get_self(); |
|
279 | - $urlparameters = ''; |
|
280 | - foreach ($_GET as $key=>$value) |
|
281 | - { |
|
282 | - $parameter[$key]=$value; |
|
283 | - } |
|
284 | - $parameter['action']='grant'; |
|
285 | - $parameter['permission']=$permission; |
|
286 | - $parameter['tool']=$tool; |
|
287 | - foreach ($parameter as $key=>$value) |
|
288 | - { |
|
289 | - $urlparameters.=$key.'='.$value.'&'; |
|
290 | - } |
|
291 | - $url=$url.'?'.$urlparameters; |
|
292 | - |
|
293 | - //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
294 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
295 | - } |
|
296 | - echo "<img src=\"../img/wrong.gif\" border=\"0\"/>"; |
|
297 | - if ($editable) |
|
298 | - { |
|
299 | - echo "</a>"; |
|
300 | - } |
|
301 | - } |
|
302 | - } |
|
303 | - } |
|
248 | + if ($course_admin) { |
|
249 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
250 | + } else { |
|
251 | + if (in_array($permission,$inherited_permissions[$tool])) { |
|
252 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
253 | + } else { |
|
254 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) { |
|
255 | + if ($editable) { |
|
256 | + $url=api_get_self(); |
|
257 | + $urlparameters = ''; |
|
258 | + foreach($_GET as $key=>$value) { |
|
259 | + $parameter[$key]=$value; |
|
260 | + } |
|
261 | + $parameter['action']='revoke'; |
|
262 | + $parameter['permission']=$permission; |
|
263 | + $parameter['tool']=$tool; |
|
264 | + foreach ($parameter as $key=>$value) { |
|
265 | + $urlparameters.=$key.'='.$value.'&'; |
|
266 | + } |
|
267 | + $url=$url.'?'.$urlparameters; |
|
268 | + |
|
269 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
270 | + } |
|
271 | + echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/>"; |
|
272 | + if ($editable) { |
|
273 | + echo "</a>"; |
|
274 | + } |
|
275 | + } else { |
|
276 | + if ($editable) |
|
277 | + { |
|
278 | + $url=api_get_self(); |
|
279 | + $urlparameters = ''; |
|
280 | + foreach ($_GET as $key=>$value) |
|
281 | + { |
|
282 | + $parameter[$key]=$value; |
|
283 | + } |
|
284 | + $parameter['action']='grant'; |
|
285 | + $parameter['permission']=$permission; |
|
286 | + $parameter['tool']=$tool; |
|
287 | + foreach ($parameter as $key=>$value) |
|
288 | + { |
|
289 | + $urlparameters.=$key.'='.$value.'&'; |
|
290 | + } |
|
291 | + $url=$url.'?'.$urlparameters; |
|
292 | + |
|
293 | + //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
294 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
295 | + } |
|
296 | + echo "<img src=\"../img/wrong.gif\" border=\"0\"/>"; |
|
297 | + if ($editable) |
|
298 | + { |
|
299 | + echo "</a>"; |
|
300 | + } |
|
301 | + } |
|
302 | + } |
|
303 | + } |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | |
@@ -318,72 +318,72 @@ discard block |
||
318 | 318 | function display_image_matrix_for_blogs($permission_array, $user_id, $tool, $permission,$inherited_permissions=array(), $course_admin=false, $editable=true) |
319 | 319 | { |
320 | 320 | |
321 | - if ($course_admin) |
|
322 | - { |
|
323 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
324 | - } |
|
325 | - else |
|
326 | - { |
|
327 | - if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
328 | - { |
|
329 | - echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
330 | - } |
|
331 | - else |
|
332 | - { |
|
333 | - if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
334 | - { |
|
335 | - if ($editable) |
|
336 | - { |
|
337 | - $url = api_get_self(); |
|
338 | - $urlparameters = ''; |
|
339 | - foreach($_GET as $key => $value) |
|
340 | - { |
|
341 | - $parameter[$key] = $value; |
|
342 | - } |
|
343 | - $parameter['action']='manage_rights'; |
|
344 | - $parameter['do']='revoke'; |
|
345 | - $parameter['permission']=$permission; |
|
346 | - $parameter['tool']=$tool; |
|
347 | - $parameter['user_id']=$user_id; |
|
348 | - foreach ($parameter as $key=>$value) |
|
349 | - { |
|
350 | - $urlparameters .= $key . '=' . $value . '&'; |
|
351 | - } |
|
352 | - $url = $url . '?' . $urlparameters; |
|
353 | - |
|
354 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
355 | - } |
|
356 | - echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermission')."\">"; |
|
357 | - if ($editable) { |
|
358 | - echo "</a>"; |
|
359 | - } |
|
360 | - } else { |
|
361 | - if ($editable) { |
|
362 | - $url = api_get_self(); |
|
363 | - $urlparameters = ''; |
|
364 | - foreach ($_GET as $key=>$value) { |
|
365 | - $parameter[$key]=$value; |
|
366 | - } |
|
367 | - $parameter['action']='manage_rights'; |
|
368 | - $parameter['do']='grant'; |
|
369 | - $parameter['permission']=$permission; |
|
370 | - $parameter['tool']=$tool; |
|
371 | - $parameter['user_id']=$user_id; |
|
372 | - foreach ($parameter as $key=>$value) { |
|
373 | - $urlparameters .= $key . '=' . $value . '&'; |
|
374 | - } |
|
375 | - $url=$url.'?'.$urlparameters; |
|
376 | - |
|
377 | - //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
378 | - echo "\t\t\t <a href=\"".$url."\">"; |
|
379 | - } |
|
380 | - echo "<img src=\"../img/wrong.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermissionNot')."\">"; |
|
381 | - if ($editable) { |
|
382 | - echo "</a>"; |
|
383 | - } |
|
384 | - } |
|
385 | - } |
|
386 | - } |
|
321 | + if ($course_admin) |
|
322 | + { |
|
323 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
324 | + } |
|
325 | + else |
|
326 | + { |
|
327 | + if (!empty($inherited_permissions) and in_array($permission,$inherited_permissions[$tool])) |
|
328 | + { |
|
329 | + echo "\t\t\t<img src=\"../img/checkbox_on3.gif\" border=\"0\"/ title=\"".get_lang('PermissionGrantedByGroupOrRole')."\">"; |
|
330 | + } |
|
331 | + else |
|
332 | + { |
|
333 | + if (is_array($permission_array[$tool]) AND in_array($permission,$permission_array[$tool])) |
|
334 | + { |
|
335 | + if ($editable) |
|
336 | + { |
|
337 | + $url = api_get_self(); |
|
338 | + $urlparameters = ''; |
|
339 | + foreach($_GET as $key => $value) |
|
340 | + { |
|
341 | + $parameter[$key] = $value; |
|
342 | + } |
|
343 | + $parameter['action']='manage_rights'; |
|
344 | + $parameter['do']='revoke'; |
|
345 | + $parameter['permission']=$permission; |
|
346 | + $parameter['tool']=$tool; |
|
347 | + $parameter['user_id']=$user_id; |
|
348 | + foreach ($parameter as $key=>$value) |
|
349 | + { |
|
350 | + $urlparameters .= $key . '=' . $value . '&'; |
|
351 | + } |
|
352 | + $url = $url . '?' . $urlparameters; |
|
353 | + |
|
354 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
355 | + } |
|
356 | + echo "<img src=\"../img/checkbox_on2.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermission')."\">"; |
|
357 | + if ($editable) { |
|
358 | + echo "</a>"; |
|
359 | + } |
|
360 | + } else { |
|
361 | + if ($editable) { |
|
362 | + $url = api_get_self(); |
|
363 | + $urlparameters = ''; |
|
364 | + foreach ($_GET as $key=>$value) { |
|
365 | + $parameter[$key]=$value; |
|
366 | + } |
|
367 | + $parameter['action']='manage_rights'; |
|
368 | + $parameter['do']='grant'; |
|
369 | + $parameter['permission']=$permission; |
|
370 | + $parameter['tool']=$tool; |
|
371 | + $parameter['user_id']=$user_id; |
|
372 | + foreach ($parameter as $key=>$value) { |
|
373 | + $urlparameters .= $key . '=' . $value . '&'; |
|
374 | + } |
|
375 | + $url=$url.'?'.$urlparameters; |
|
376 | + |
|
377 | + //echo "\t\t\t <a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=grant&permission=$permission&tool=$tool\">"; |
|
378 | + echo "\t\t\t <a href=\"".$url."\">"; |
|
379 | + } |
|
380 | + echo "<img src=\"../img/wrong.gif\" border=\"0\"/ title=\"".get_lang('UserHasPermissionNot')."\">"; |
|
381 | + if ($editable) { |
|
382 | + echo "</a>"; |
|
383 | + } |
|
384 | + } |
|
385 | + } |
|
386 | + } |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | |
@@ -394,11 +394,11 @@ discard block |
||
394 | 394 | */ |
395 | 395 | function display_role_list($current_course_roles, $current_platform_roles) |
396 | 396 | { |
397 | - global $setting_visualisation; |
|
397 | + global $setting_visualisation; |
|
398 | 398 | $course_id = api_get_course_int_id(); |
399 | 399 | |
400 | - $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
401 | - $platform_roles_table=Database::get_main_table(TABLE_ROLE); |
|
400 | + $coures_roles_table=Database::get_course_table(TABLE_ROLE); |
|
401 | + $platform_roles_table=Database::get_main_table(TABLE_ROLE); |
|
402 | 402 | /* |
403 | 403 | // platform roles |
404 | 404 | $sql="SELECT * FROM $platform_roles_table"; |
@@ -429,36 +429,36 @@ discard block |
||
429 | 429 | echo $row['role_comment']."<br />\n"; |
430 | 430 | } |
431 | 431 | */ |
432 | - // course roles |
|
433 | - $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
434 | - $result=Database::query($sql); |
|
435 | - while ($row=Database::fetch_array($result)) |
|
436 | - { |
|
437 | - if (in_array($row['role_id'], $current_course_roles)) |
|
438 | - { |
|
439 | - $checked='checked'; |
|
440 | - $image='checkbox_on2.gif'; |
|
441 | - $action='revoke'; |
|
442 | - } |
|
443 | - else |
|
444 | - { |
|
445 | - $checked=''; |
|
446 | - $image='wrong.gif'; |
|
447 | - $action='grant'; |
|
448 | - } |
|
449 | - if ($setting_visualisation=='checkbox') |
|
450 | - { |
|
451 | - echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
|
452 | - } |
|
453 | - if ($setting_visualisation=='image') |
|
454 | - { |
|
455 | - echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
|
456 | - } |
|
457 | - |
|
458 | - |
|
459 | - echo $row['role_name']." <a href=\"../permissions/roles.php?role_id=".$row['role_id']."&scope=course\"><img src=\"../img/edit.gif\" /></a><br />\n"; |
|
460 | - echo $row['role_comment']."<br />\n"; |
|
461 | - } |
|
432 | + // course roles |
|
433 | + $sql="SELECT * FROM $coures_roles_table WHERE c_id = $course_id "; |
|
434 | + $result=Database::query($sql); |
|
435 | + while ($row=Database::fetch_array($result)) |
|
436 | + { |
|
437 | + if (in_array($row['role_id'], $current_course_roles)) |
|
438 | + { |
|
439 | + $checked='checked'; |
|
440 | + $image='checkbox_on2.gif'; |
|
441 | + $action='revoke'; |
|
442 | + } |
|
443 | + else |
|
444 | + { |
|
445 | + $checked=''; |
|
446 | + $image='wrong.gif'; |
|
447 | + $action='grant'; |
|
448 | + } |
|
449 | + if ($setting_visualisation=='checkbox') |
|
450 | + { |
|
451 | + echo "<input type=\"checkbox\" name=\"role*course*".$row['role_id']."\" $checked>"; |
|
452 | + } |
|
453 | + if ($setting_visualisation=='image') |
|
454 | + { |
|
455 | + echo "<a href=\"".str_replace('&', '&', $_SERVER['REQUEST_URI'])."&action=$action&role=".$row['role_id']."&scope=course\"><img src=\"../img/".$image."\" border=\"0\"/></a>"; |
|
456 | + } |
|
457 | + |
|
458 | + |
|
459 | + echo $row['role_name']." <a href=\"../permissions/roles.php?role_id=".$row['role_id']."&scope=course\"><img src=\"../img/edit.gif\" /></a><br />\n"; |
|
460 | + echo $row['role_comment']."<br />\n"; |
|
461 | + } |
|
462 | 462 | } |
463 | 463 | |
464 | 464 | /** |
@@ -472,24 +472,24 @@ discard block |
||
472 | 472 | */ |
473 | 473 | function get_roles($content,$id, $scope='course') { |
474 | 474 | $course_id = api_get_course_int_id(); |
475 | - if ($content=='user') { |
|
476 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
477 | - $id_field = user_id; |
|
478 | - } |
|
479 | - if ($content=='group') { |
|
480 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
481 | - $id_field = 'group_id'; |
|
482 | - } |
|
483 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
484 | - |
|
485 | - $current_roles=array(); |
|
486 | - //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
|
487 | - $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
488 | - $result=Database::query($sql); |
|
489 | - while ($row=Database::fetch_array($result)) { |
|
490 | - $current_roles[]=$row['role_id']; |
|
491 | - } |
|
492 | - return $current_roles; |
|
475 | + if ($content=='user') { |
|
476 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
477 | + $id_field = user_id; |
|
478 | + } |
|
479 | + if ($content=='group') { |
|
480 | + $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
481 | + $id_field = 'group_id'; |
|
482 | + } |
|
483 | + $table_role=Database::get_course_table(TABLE_ROLE); |
|
484 | + |
|
485 | + $current_roles=array(); |
|
486 | + //$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'";$sql="SELECT role.role_id FROM $table role_group_user, $table_role role WHERE role_group_user.$id_field = '$id' AND role_group_user.role_id=role.role_id AND role_group_user.scope='".$scope."'"; |
|
487 | + $sql="SELECT role_id FROM $table WHERE c_id = $course_id AND $id_field = '$id' AND scope='".$scope."'"; |
|
488 | + $result=Database::query($sql); |
|
489 | + while ($row=Database::fetch_array($result)) { |
|
490 | + $current_roles[]=$row['role_id']; |
|
491 | + } |
|
492 | + return $current_roles; |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | /** |
@@ -502,25 +502,25 @@ discard block |
||
502 | 502 | $course_id = api_get_course_int_id(); |
503 | 503 | $course_id_condition = " WHERE c_id = $course_id "; |
504 | 504 | |
505 | - if ($content=='course') |
|
506 | - { |
|
507 | - $table_role=Database::get_course_table(TABLE_ROLE); |
|
508 | - } |
|
509 | - if ($content=='platform') |
|
510 | - { |
|
511 | - $table_role=Database::get_main_table(TABLE_ROLE); |
|
512 | - $course_id_condition = ''; |
|
513 | - } |
|
505 | + if ($content=='course') |
|
506 | + { |
|
507 | + $table_role=Database::get_course_table(TABLE_ROLE); |
|
508 | + } |
|
509 | + if ($content=='platform') |
|
510 | + { |
|
511 | + $table_role=Database::get_main_table(TABLE_ROLE); |
|
512 | + $course_id_condition = ''; |
|
513 | + } |
|
514 | 514 | |
515 | - $current_roles=array(); |
|
516 | - $sql="SELECT * FROM $table_role $course_id_condition "; |
|
517 | - $result=Database::query($sql); |
|
518 | - while ($row=Database::fetch_array($result)) |
|
519 | - { |
|
520 | - $roles[]=$row; |
|
521 | - } |
|
515 | + $current_roles=array(); |
|
516 | + $sql="SELECT * FROM $table_role $course_id_condition "; |
|
517 | + $result=Database::query($sql); |
|
518 | + while ($row=Database::fetch_array($result)) |
|
519 | + { |
|
520 | + $roles[]=$row; |
|
521 | + } |
|
522 | 522 | |
523 | - return $roles; |
|
523 | + return $roles; |
|
524 | 524 | } |
525 | 525 | |
526 | 526 | |
@@ -536,34 +536,34 @@ discard block |
||
536 | 536 | */ |
537 | 537 | function get_roles_permissions($content,$id, $scope='course') { |
538 | 538 | $course_id = api_get_course_int_id(); |
539 | - if ($content == 'user') { |
|
540 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
541 | - $id_field = 'user_id'; |
|
542 | - } |
|
539 | + if ($content == 'user') { |
|
540 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
541 | + $id_field = 'user_id'; |
|
542 | + } |
|
543 | 543 | |
544 | - if ($content == 'group') { |
|
545 | - $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
546 | - $id_field = 'group_id'; |
|
547 | - } |
|
544 | + if ($content == 'group') { |
|
545 | + $table = Database::get_course_table(TABLE_ROLE_GROUP); |
|
546 | + $id_field = 'group_id'; |
|
547 | + } |
|
548 | 548 | |
549 | - // course roles or platform roles |
|
550 | - $scope = 'course'; |
|
551 | - if ($scope == 'course') { |
|
552 | - $table_role = Database::get_course_table(TABLE_ROLE); |
|
553 | - $table_role_permissions = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
549 | + // course roles or platform roles |
|
550 | + $scope = 'course'; |
|
551 | + if ($scope == 'course') { |
|
552 | + $table_role = Database::get_course_table(TABLE_ROLE); |
|
553 | + $table_role_permissions = Database::get_course_table(TABLE_ROLE_PERMISSION); |
|
554 | 554 | |
555 | 555 | $role_condition = " role.c_id = $course_id AND role_permissions.c_id = $course_id AND "; |
556 | - } |
|
556 | + } |
|
557 | 557 | |
558 | - if ($scope == 'platform') { |
|
559 | - $table_role = Database::get_main_table(TABLE_ROLE); |
|
560 | - $table_role_permissions = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
558 | + if ($scope == 'platform') { |
|
559 | + $table_role = Database::get_main_table(TABLE_ROLE); |
|
560 | + $table_role_permissions = Database::get_main_table(TABLE_ROLE_PERMISSION); |
|
561 | 561 | $role_condition = ''; |
562 | - } |
|
562 | + } |
|
563 | 563 | |
564 | - $current_roles = array(); |
|
564 | + $current_roles = array(); |
|
565 | 565 | |
566 | - $sql = " |
|
566 | + $sql = " |
|
567 | 567 | SELECT * |
568 | 568 | FROM |
569 | 569 | " . $table . " role_group_user, |
@@ -577,12 +577,12 @@ discard block |
||
577 | 577 | role_group_user.role_id = role.role_id AND |
578 | 578 | role.role_id = role_permissions.role_id"; |
579 | 579 | |
580 | - $result = Database::query($sql); |
|
580 | + $result = Database::query($sql); |
|
581 | 581 | $current_role_permissions = array(); |
582 | - while ($row=Database::fetch_array($result)) { |
|
583 | - $current_role_permissions[$row['tool']][]=$row['action']; |
|
582 | + while ($row=Database::fetch_array($result)) { |
|
583 | + $current_role_permissions[$row['tool']][]=$row['action']; |
|
584 | 584 | } |
585 | - return $current_role_permissions; |
|
585 | + return $current_role_permissions; |
|
586 | 586 | } |
587 | 587 | |
588 | 588 | /** |
@@ -596,34 +596,34 @@ discard block |
||
596 | 596 | |
597 | 597 | function assign_role($content, $action, $id, $role_id, $scope='course') { |
598 | 598 | $course_id = api_get_course_int_id(); |
599 | - // Which database are we using (depending on the $content parameter) |
|
600 | - if ($content=='user') { |
|
601 | - $table=Database::get_course_table(TABLE_ROLE_USER); |
|
602 | - $id_field = 'user_id'; |
|
603 | - } elseif($content=='group') { |
|
604 | - $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
605 | - $id_field = 'group_id'; |
|
606 | - } else { |
|
607 | - return get_lang('Error'); |
|
608 | - } |
|
599 | + // Which database are we using (depending on the $content parameter) |
|
600 | + if ($content=='user') { |
|
601 | + $table=Database::get_course_table(TABLE_ROLE_USER); |
|
602 | + $id_field = 'user_id'; |
|
603 | + } elseif($content=='group') { |
|
604 | + $table=Database::get_course_table(TABLE_ROLE_GROUP); |
|
605 | + $id_field = 'group_id'; |
|
606 | + } else { |
|
607 | + return get_lang('Error'); |
|
608 | + } |
|
609 | 609 | |
610 | - // grating a right |
|
611 | - if ($action=='grant') { |
|
612 | - $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
613 | - $result=Database::query($sql); |
|
614 | - if ($result) { |
|
615 | - $result_message=get_lang('RoleGranted'); |
|
616 | - } |
|
617 | - } |
|
610 | + // grating a right |
|
611 | + if ($action=='grant') { |
|
612 | + $sql="INSERT INTO $table (c_id, role_id, scope, $id_field) VALUES ($course_id, '".Database::escape_string($role_id)."','".Database::escape_string($scope)."','".Database::escape_string($id)."')"; |
|
613 | + $result=Database::query($sql); |
|
614 | + if ($result) { |
|
615 | + $result_message=get_lang('RoleGranted'); |
|
616 | + } |
|
617 | + } |
|
618 | 618 | |
619 | - if ($action=='revoke') { |
|
620 | - $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
621 | - $result=Database::query($sql); |
|
622 | - if ($result) { |
|
623 | - $result_message=get_lang('RoleRevoked'); |
|
624 | - } |
|
625 | - } |
|
626 | - return $result_message; |
|
619 | + if ($action=='revoke') { |
|
620 | + $sql="DELETE FROM $table WHERE c_id = $course_id AND $id_field = '".Database::escape_string($id)."' AND role_id='".Database::escape_string($role_id)."'"; |
|
621 | + $result=Database::query($sql); |
|
622 | + if ($result) { |
|
623 | + $result_message=get_lang('RoleRevoked'); |
|
624 | + } |
|
625 | + } |
|
626 | + return $result_message; |
|
627 | 627 | } |
628 | 628 | |
629 | 629 | |
@@ -633,21 +633,21 @@ discard block |
||
633 | 633 | */ |
634 | 634 | function permission_array_merge($array1, $array2) |
635 | 635 | { |
636 | - foreach ($array2 as $tool=>$permissions) |
|
637 | - { |
|
638 | - foreach ($permissions as $permissionkey=>$permissionvalue) |
|
639 | - { |
|
640 | - $array1[$tool][]=$permissionvalue; |
|
641 | - } |
|
642 | - } |
|
643 | - return $array1; |
|
636 | + foreach ($array2 as $tool=>$permissions) |
|
637 | + { |
|
638 | + foreach ($permissions as $permissionkey=>$permissionvalue) |
|
639 | + { |
|
640 | + $array1[$tool][]=$permissionvalue; |
|
641 | + } |
|
642 | + } |
|
643 | + return $array1; |
|
644 | 644 | } |
645 | 645 | |
646 | 646 | |
647 | 647 | function my_print_r($array) |
648 | 648 | { |
649 | - echo '<pre>'; |
|
650 | - print_r($array); |
|
651 | - echo '</pre>'; |
|
649 | + echo '<pre>'; |
|
650 | + print_r($array); |
|
651 | + echo '</pre>'; |
|
652 | 652 | } |
653 | 653 | ?> |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | /** |
4 | - * Controller for REST request |
|
5 | - * @author Angel Fernando Quiroz Campos <[email protected]> |
|
6 | - * @package chamilo.webservices |
|
7 | - */ |
|
4 | + * Controller for REST request |
|
5 | + * @author Angel Fernando Quiroz Campos <[email protected]> |
|
6 | + * @package chamilo.webservices |
|
7 | + */ |
|
8 | 8 | /* Require libs and classes */ |
9 | 9 | require_once '../inc/global.inc.php'; |
10 | 10 |
@@ -4930,9 +4930,9 @@ |
||
4930 | 4930 | 'This service unsubscribe a user from a course' // documentation |
4931 | 4931 | ); |
4932 | 4932 | /** |
4933 | - * @param array $params |
|
4934 | - * @return array|null|soap_fault |
|
4935 | - */ |
|
4933 | + * @param array $params |
|
4934 | + * @return array|null|soap_fault |
|
4935 | + */ |
|
4936 | 4936 | function WSUnSubscribeUserFromCourseSimple($params) |
4937 | 4937 | { |
4938 | 4938 | global $debug; |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | global $charset; |
97 | 97 | if ($this->verifyUserPass($username, $password) == "valid") { |
98 | - $user_id = UserManager::get_user_id_from_username($username); |
|
98 | + $user_id = UserManager::get_user_id_from_username($username); |
|
99 | 99 | $message_title = get_lang('Invitation'); |
100 | 100 | $count_is_true = SocialManager::send_invitation_friend($user_id,$userfriend_id, $message_title, $content_message); |
101 | 101 | |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | |
136 | 136 | |
137 | 137 | /** |
138 | - * Get a list of users of which the given conditions match with a LIKE '%cond%' |
|
139 | - * @param array $conditions a list of condition (exemple : status=>STUDENT) |
|
140 | - * @param array $order_by a list of fields on which sort |
|
141 | - * @return array An array with all users of the platform. |
|
142 | - * @todo optional course code parameter, optional sorting parameters... |
|
138 | + * Get a list of users of which the given conditions match with a LIKE '%cond%' |
|
139 | + * @param array $conditions a list of condition (exemple : status=>STUDENT) |
|
140 | + * @param array $order_by a list of fields on which sort |
|
141 | + * @return array An array with all users of the platform. |
|
142 | + * @todo optional course code parameter, optional sorting parameters... |
|
143 | 143 | *@todo Use the UserManager class |
144 | 144 | * @todo security filter order by |
145 | - */ |
|
145 | + */ |
|
146 | 146 | private static function get_user_list_like_start($conditions = array(), $order_by = array()) |
147 | 147 | { |
148 | 148 | $user_table = Database :: get_main_table(TABLE_MAIN_USER); |
@@ -581,7 +581,7 @@ |
||
581 | 581 | /*$sessionIdName = isset($params['session_id_name']) ? $params['session_id_name'] : null; |
582 | 582 | $sessionIdValue = isset($params['session_id_value']) ? $params['session_id_value'] : null;*/ |
583 | 583 | |
584 | - $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
|
584 | + $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
|
585 | 585 | $courseIdValue, |
586 | 586 | $courseIdName |
587 | 587 | ); |
@@ -9,255 +9,255 @@ discard block |
||
9 | 9 | $s = WSCMSoapServer::singleton(); |
10 | 10 | |
11 | 11 | $s->wsdl->addComplexType( |
12 | - 'course_id', |
|
13 | - 'complexType', |
|
14 | - 'struct', |
|
15 | - 'all', |
|
16 | - '', |
|
17 | - array( |
|
18 | - 'course_id_field_name' => array('name' => 'course_id_field_name', 'type' => 'xsd:string'), |
|
19 | - 'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string') |
|
20 | - ) |
|
12 | + 'course_id', |
|
13 | + 'complexType', |
|
14 | + 'struct', |
|
15 | + 'all', |
|
16 | + '', |
|
17 | + array( |
|
18 | + 'course_id_field_name' => array('name' => 'course_id_field_name', 'type' => 'xsd:string'), |
|
19 | + 'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string') |
|
20 | + ) |
|
21 | 21 | ); |
22 | 22 | |
23 | 23 | $s->wsdl->addComplexType( |
24 | - 'course_result', |
|
25 | - 'complexType', |
|
26 | - 'struct', |
|
27 | - 'all', |
|
28 | - '', |
|
29 | - array( |
|
30 | - 'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'), |
|
31 | - 'result' => array('name' => 'result', 'type' => 'tns:result') |
|
32 | - ) |
|
24 | + 'course_result', |
|
25 | + 'complexType', |
|
26 | + 'struct', |
|
27 | + 'all', |
|
28 | + '', |
|
29 | + array( |
|
30 | + 'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'), |
|
31 | + 'result' => array('name' => 'result', 'type' => 'tns:result') |
|
32 | + ) |
|
33 | 33 | ); |
34 | 34 | |
35 | 35 | $s->wsdl->addComplexType( |
36 | - 'course_result_array', |
|
37 | - 'complexType', |
|
38 | - 'array', |
|
39 | - '', |
|
40 | - 'SOAP-ENC:Array', |
|
41 | - array(), |
|
42 | - array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_result[]')), |
|
43 | - 'tns:course_result' |
|
36 | + 'course_result_array', |
|
37 | + 'complexType', |
|
38 | + 'array', |
|
39 | + '', |
|
40 | + 'SOAP-ENC:Array', |
|
41 | + array(), |
|
42 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_result[]')), |
|
43 | + 'tns:course_result' |
|
44 | 44 | ); |
45 | 45 | |
46 | 46 | $s->register( |
47 | - 'WSCMCourse.DeleteCourse', |
|
48 | - array('secret_key' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string') |
|
47 | + 'WSCMCourse.DeleteCourse', |
|
48 | + array('secret_key' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string') |
|
49 | 49 | ); |
50 | 50 | |
51 | 51 | $s->register( |
52 | - 'WSCMCourse.DeleteCourses', |
|
53 | - array('secret_key' => 'xsd:string', 'courses' => 'tns:course_id[]'), |
|
54 | - array('return' => 'tns:course_result_array') |
|
52 | + 'WSCMCourse.DeleteCourses', |
|
53 | + array('secret_key' => 'xsd:string', 'courses' => 'tns:course_id[]'), |
|
54 | + array('return' => 'tns:course_result_array') |
|
55 | 55 | ); |
56 | 56 | |
57 | 57 | $s->register( |
58 | - 'WSCMCourse.CreateCourse', |
|
59 | - array( |
|
60 | - 'secret_key' => 'xsd:string', |
|
61 | - 'title' => 'xsd:string', |
|
62 | - 'category_code' => 'xsd:string', |
|
63 | - 'wanted_code' => 'xsd:string', |
|
64 | - 'tutor_name' => 'xsd:string', |
|
65 | - 'course_admin_user_id_field_name' => 'xsd:string', |
|
66 | - 'course_admin_user_id_value' => 'xsd:string', |
|
67 | - 'language' => 'xsd:string', |
|
68 | - 'course_id_field_name' => 'xsd:string', |
|
69 | - 'course_id_value' => 'xsd:string', |
|
70 | - 'extras' => 'tns:extra_field[]' |
|
71 | - ), |
|
72 | - array('return' => 'xsd:int') |
|
58 | + 'WSCMCourse.CreateCourse', |
|
59 | + array( |
|
60 | + 'secret_key' => 'xsd:string', |
|
61 | + 'title' => 'xsd:string', |
|
62 | + 'category_code' => 'xsd:string', |
|
63 | + 'wanted_code' => 'xsd:string', |
|
64 | + 'tutor_name' => 'xsd:string', |
|
65 | + 'course_admin_user_id_field_name' => 'xsd:string', |
|
66 | + 'course_admin_user_id_value' => 'xsd:string', |
|
67 | + 'language' => 'xsd:string', |
|
68 | + 'course_id_field_name' => 'xsd:string', |
|
69 | + 'course_id_value' => 'xsd:string', |
|
70 | + 'extras' => 'tns:extra_field[]' |
|
71 | + ), |
|
72 | + array('return' => 'xsd:int') |
|
73 | 73 | ); |
74 | 74 | |
75 | 75 | $s->wsdl->addComplexType( |
76 | - 'course_create', |
|
77 | - 'complexType', |
|
78 | - 'struct', |
|
79 | - 'all', |
|
80 | - '', |
|
81 | - array( |
|
82 | - 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
83 | - 'category_code' => array('name' => 'category_code', 'type' => 'xsd:string'), |
|
84 | - 'wanted_code' => array('name' => 'wanted_code', 'type' => 'xsd:int'), |
|
85 | - 'tutor_name' => array('name' => 'tutor_name', 'type' => 'xsd:string'), |
|
86 | - 'course_admin_user_id_field_name' => array('name' => 'course_admin_user_id_field_name', 'type' => 'xsd:string'), |
|
87 | - 'course_admin_user_id_value' => array('name' => 'course_admin_user_id_value', 'type' => 'xsd:string'), |
|
88 | - 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
|
89 | - 'course_id_field_name' => array('name' => 'course_id_field_name', 'type' => 'xsd:string'), |
|
90 | - 'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'), |
|
91 | - 'extras' => array('name' => 'extras', 'type' => 'tns:extra_field[]') |
|
92 | - ) |
|
76 | + 'course_create', |
|
77 | + 'complexType', |
|
78 | + 'struct', |
|
79 | + 'all', |
|
80 | + '', |
|
81 | + array( |
|
82 | + 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
83 | + 'category_code' => array('name' => 'category_code', 'type' => 'xsd:string'), |
|
84 | + 'wanted_code' => array('name' => 'wanted_code', 'type' => 'xsd:int'), |
|
85 | + 'tutor_name' => array('name' => 'tutor_name', 'type' => 'xsd:string'), |
|
86 | + 'course_admin_user_id_field_name' => array('name' => 'course_admin_user_id_field_name', 'type' => 'xsd:string'), |
|
87 | + 'course_admin_user_id_value' => array('name' => 'course_admin_user_id_value', 'type' => 'xsd:string'), |
|
88 | + 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
|
89 | + 'course_id_field_name' => array('name' => 'course_id_field_name', 'type' => 'xsd:string'), |
|
90 | + 'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'), |
|
91 | + 'extras' => array('name' => 'extras', 'type' => 'tns:extra_field[]') |
|
92 | + ) |
|
93 | 93 | ); |
94 | 94 | |
95 | 95 | $s->wsdl->addComplexType( |
96 | - 'course_create_result', |
|
97 | - 'complexType', |
|
98 | - 'struct', |
|
99 | - 'all', |
|
100 | - '', |
|
101 | - array( |
|
102 | - 'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'), |
|
103 | - 'course_id_generated' => array('name' => 'course_id_generated', 'type' => 'xsd:int'), |
|
104 | - 'result' => array('name' => 'result', 'type' => 'tns:result') |
|
105 | - ) |
|
96 | + 'course_create_result', |
|
97 | + 'complexType', |
|
98 | + 'struct', |
|
99 | + 'all', |
|
100 | + '', |
|
101 | + array( |
|
102 | + 'course_id_value' => array('name' => 'course_id_value', 'type' => 'xsd:string'), |
|
103 | + 'course_id_generated' => array('name' => 'course_id_generated', 'type' => 'xsd:int'), |
|
104 | + 'result' => array('name' => 'result', 'type' => 'tns:result') |
|
105 | + ) |
|
106 | 106 | ); |
107 | 107 | |
108 | 108 | $s->wsdl->addComplexType( |
109 | - 'course_create_result_array', |
|
110 | - 'complexType', |
|
111 | - 'array', |
|
112 | - '', |
|
113 | - 'SOAP-ENC:Array', |
|
114 | - array(), |
|
115 | - array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_create_result[]')), |
|
116 | - 'tns:course_create_result' |
|
109 | + 'course_create_result_array', |
|
110 | + 'complexType', |
|
111 | + 'array', |
|
112 | + '', |
|
113 | + 'SOAP-ENC:Array', |
|
114 | + array(), |
|
115 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_create_result[]')), |
|
116 | + 'tns:course_create_result' |
|
117 | 117 | ); |
118 | 118 | |
119 | 119 | $s->register( |
120 | - 'WSCMCourse.CreateCourses', |
|
121 | - array( |
|
122 | - 'secret_key' => 'xsd:string', |
|
123 | - 'courses' => 'tns:course_create[]' |
|
124 | - ), |
|
125 | - array('return' => 'tns:course_create_result_array') |
|
120 | + 'WSCMCourse.CreateCourses', |
|
121 | + array( |
|
122 | + 'secret_key' => 'xsd:string', |
|
123 | + 'courses' => 'tns:course_create[]' |
|
124 | + ), |
|
125 | + array('return' => 'tns:course_create_result_array') |
|
126 | 126 | ); |
127 | 127 | |
128 | 128 | $s->register( |
129 | - 'WSCMCourse.EditCourse', |
|
130 | - array( |
|
131 | - 'secret_key' => 'xsd:string', |
|
132 | - 'course_id_field_name' => 'xsd:string', |
|
133 | - 'course_id_value' => 'xsd:string', |
|
134 | - 'title' => 'xsd:string', |
|
135 | - 'category_code' => 'xsd:string', |
|
136 | - 'department_name' => 'xsd:string', |
|
137 | - 'department_url' => 'xsd:string', |
|
138 | - 'language' => 'xsd:string', |
|
139 | - 'visibility' => 'xsd:int', |
|
140 | - 'subscribe' => 'xsd:int', |
|
141 | - 'unsubscribe' => 'xsd:int', |
|
142 | - 'visual_code' => 'xsd:string', |
|
143 | - 'extras' => 'tns:extra_field[]' |
|
144 | - ) |
|
129 | + 'WSCMCourse.EditCourse', |
|
130 | + array( |
|
131 | + 'secret_key' => 'xsd:string', |
|
132 | + 'course_id_field_name' => 'xsd:string', |
|
133 | + 'course_id_value' => 'xsd:string', |
|
134 | + 'title' => 'xsd:string', |
|
135 | + 'category_code' => 'xsd:string', |
|
136 | + 'department_name' => 'xsd:string', |
|
137 | + 'department_url' => 'xsd:string', |
|
138 | + 'language' => 'xsd:string', |
|
139 | + 'visibility' => 'xsd:int', |
|
140 | + 'subscribe' => 'xsd:int', |
|
141 | + 'unsubscribe' => 'xsd:int', |
|
142 | + 'visual_code' => 'xsd:string', |
|
143 | + 'extras' => 'tns:extra_field[]' |
|
144 | + ) |
|
145 | 145 | ); |
146 | 146 | |
147 | 147 | $s->wsdl->addComplexType( |
148 | - 'course', |
|
149 | - 'complexType', |
|
150 | - 'struct', |
|
151 | - 'all', |
|
152 | - '', |
|
153 | - array( |
|
154 | - 'id' => array('name' => 'id', 'type' => 'xsd:int'), |
|
155 | - 'code' => array('name' => 'code', 'type' => 'xsd:string'), |
|
156 | - 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
157 | - 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
|
158 | - 'visibility' => array('name' => 'visibility', 'type' => 'xsd:int'), |
|
159 | - 'category_name' => array('name' => 'category_name', 'type' => 'xsd:string'), |
|
160 | - 'number_students' => array('name' => 'number_students', 'type' => 'xsd:int'), |
|
161 | - 'external_course_id' => array('name' => 'external_course_id', 'type' => 'xsd:string'), |
|
162 | - ) |
|
148 | + 'course', |
|
149 | + 'complexType', |
|
150 | + 'struct', |
|
151 | + 'all', |
|
152 | + '', |
|
153 | + array( |
|
154 | + 'id' => array('name' => 'id', 'type' => 'xsd:int'), |
|
155 | + 'code' => array('name' => 'code', 'type' => 'xsd:string'), |
|
156 | + 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
157 | + 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
|
158 | + 'visibility' => array('name' => 'visibility', 'type' => 'xsd:int'), |
|
159 | + 'category_name' => array('name' => 'category_name', 'type' => 'xsd:string'), |
|
160 | + 'number_students' => array('name' => 'number_students', 'type' => 'xsd:int'), |
|
161 | + 'external_course_id' => array('name' => 'external_course_id', 'type' => 'xsd:string'), |
|
162 | + ) |
|
163 | 163 | ); |
164 | 164 | |
165 | 165 | $s->wsdl->addComplexType( |
166 | - 'course_array', |
|
167 | - 'complexType', |
|
168 | - 'array', |
|
169 | - '', |
|
170 | - 'SOAP-ENC:Array', |
|
171 | - array(), |
|
172 | - array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course[]')), |
|
173 | - 'tns:course' |
|
166 | + 'course_array', |
|
167 | + 'complexType', |
|
168 | + 'array', |
|
169 | + '', |
|
170 | + 'SOAP-ENC:Array', |
|
171 | + array(), |
|
172 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course[]')), |
|
173 | + 'tns:course' |
|
174 | 174 | ); |
175 | 175 | |
176 | 176 | $s->register( |
177 | - 'WSCMCourse.ListCourses', |
|
178 | - array( |
|
179 | - 'secret_key' => 'xsd:string', |
|
180 | - 'course_id_field_name' => 'xsd:string' |
|
181 | - ), |
|
182 | - array('return' => 'tns:course_array') |
|
177 | + 'WSCMCourse.ListCourses', |
|
178 | + array( |
|
179 | + 'secret_key' => 'xsd:string', |
|
180 | + 'course_id_field_name' => 'xsd:string' |
|
181 | + ), |
|
182 | + array('return' => 'tns:course_array') |
|
183 | 183 | ); |
184 | 184 | |
185 | 185 | $s->register( |
186 | - 'WSCMCourse.SubscribeUserToCourse', |
|
187 | - array( |
|
188 | - 'secret_key' => 'xsd:string', |
|
189 | - 'course_id_field_name' => 'xsd:string', |
|
190 | - 'course_id_value' => 'xsd:string', |
|
191 | - 'user_id_field_name' => 'xsd:string', |
|
192 | - 'user_id_value' => 'xsd:string', |
|
193 | - 'status' => 'xsd:int' |
|
194 | - ) |
|
186 | + 'WSCMCourse.SubscribeUserToCourse', |
|
187 | + array( |
|
188 | + 'secret_key' => 'xsd:string', |
|
189 | + 'course_id_field_name' => 'xsd:string', |
|
190 | + 'course_id_value' => 'xsd:string', |
|
191 | + 'user_id_field_name' => 'xsd:string', |
|
192 | + 'user_id_value' => 'xsd:string', |
|
193 | + 'status' => 'xsd:int' |
|
194 | + ) |
|
195 | 195 | ); |
196 | 196 | |
197 | 197 | $s->register( |
198 | - 'WSCMCourse.UnsubscribeUserFromCourse', |
|
199 | - array( |
|
200 | - 'secret_key' => 'xsd:string', |
|
201 | - 'course_id_field_name' => 'xsd:string', |
|
202 | - 'course_id_value' => 'xsd:string', |
|
203 | - 'user_id_field_name' => 'xsd:string', |
|
204 | - 'user_id_value' => 'xsd:string' |
|
205 | - ) |
|
198 | + 'WSCMCourse.UnsubscribeUserFromCourse', |
|
199 | + array( |
|
200 | + 'secret_key' => 'xsd:string', |
|
201 | + 'course_id_field_name' => 'xsd:string', |
|
202 | + 'course_id_value' => 'xsd:string', |
|
203 | + 'user_id_field_name' => 'xsd:string', |
|
204 | + 'user_id_value' => 'xsd:string' |
|
205 | + ) |
|
206 | 206 | ); |
207 | 207 | |
208 | 208 | $s->wsdl->addComplexType( |
209 | - 'course_description', |
|
210 | - 'complexType', |
|
211 | - 'struct', |
|
212 | - 'all', |
|
213 | - '', |
|
214 | - array( |
|
215 | - 'course_desc_id' => array('name' => 'course_desc_id', 'type' => 'xsd:int'), |
|
216 | - 'course_desc_title' => array('name' => 'course_desc_title', 'type' => 'xsd:string'), |
|
217 | - 'course_desc_content' => array('name' => 'course_desc_content', 'type' => 'xsd:string') |
|
218 | - ) |
|
209 | + 'course_description', |
|
210 | + 'complexType', |
|
211 | + 'struct', |
|
212 | + 'all', |
|
213 | + '', |
|
214 | + array( |
|
215 | + 'course_desc_id' => array('name' => 'course_desc_id', 'type' => 'xsd:int'), |
|
216 | + 'course_desc_title' => array('name' => 'course_desc_title', 'type' => 'xsd:string'), |
|
217 | + 'course_desc_content' => array('name' => 'course_desc_content', 'type' => 'xsd:string') |
|
218 | + ) |
|
219 | 219 | ); |
220 | 220 | |
221 | 221 | $s->wsdl->addComplexType( |
222 | - 'course_description_array', |
|
223 | - 'complexType', |
|
224 | - 'array', |
|
225 | - '', |
|
226 | - 'SOAP-ENC:Array', |
|
227 | - array(), |
|
228 | - array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_description[]')), |
|
229 | - 'tns:course_description' |
|
222 | + 'course_description_array', |
|
223 | + 'complexType', |
|
224 | + 'array', |
|
225 | + '', |
|
226 | + 'SOAP-ENC:Array', |
|
227 | + array(), |
|
228 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:course_description[]')), |
|
229 | + 'tns:course_description' |
|
230 | 230 | ); |
231 | 231 | |
232 | 232 | $s->register( |
233 | - 'WSCMCourse.GetCourseDescriptions', |
|
234 | - array( |
|
235 | - 'secret_key' => 'xsd:string', |
|
236 | - 'course_id_field_name' => 'xsd:string', |
|
237 | - 'course_id_value' => 'xsd:string' |
|
238 | - ), |
|
239 | - array('return' => 'tns:course_description_array') |
|
233 | + 'WSCMCourse.GetCourseDescriptions', |
|
234 | + array( |
|
235 | + 'secret_key' => 'xsd:string', |
|
236 | + 'course_id_field_name' => 'xsd:string', |
|
237 | + 'course_id_value' => 'xsd:string' |
|
238 | + ), |
|
239 | + array('return' => 'tns:course_description_array') |
|
240 | 240 | ); |
241 | 241 | |
242 | 242 | $s->register( |
243 | - 'WSCMCourse.EditCourseDescription', |
|
244 | - array( |
|
245 | - 'secret_key' => 'xsd:string', |
|
246 | - 'course_id_field_name' => 'xsd:string', |
|
247 | - 'course_id_value' => 'xsd:string', |
|
248 | - 'course_desc_id' => 'xsd:int', |
|
249 | - 'course_desc_title' => 'xsd:string', |
|
250 | - 'course_desc_content' => 'xsd:string' |
|
251 | - ) |
|
243 | + 'WSCMCourse.EditCourseDescription', |
|
244 | + array( |
|
245 | + 'secret_key' => 'xsd:string', |
|
246 | + 'course_id_field_name' => 'xsd:string', |
|
247 | + 'course_id_value' => 'xsd:string', |
|
248 | + 'course_desc_id' => 'xsd:int', |
|
249 | + 'course_desc_title' => 'xsd:string', |
|
250 | + 'course_desc_content' => 'xsd:string' |
|
251 | + ) |
|
252 | 252 | ); |
253 | 253 | |
254 | 254 | $s->register( |
255 | - 'WSCMCourse.unreadMessage', |
|
256 | - array( |
|
257 | - 'username' => 'xsd:string', |
|
258 | - 'password' => 'xsd:string', |
|
259 | - ), |
|
260 | - array('return' => 'xsd:string'), |
|
255 | + 'WSCMCourse.unreadMessage', |
|
256 | + array( |
|
257 | + 'username' => 'xsd:string', |
|
258 | + 'password' => 'xsd:string', |
|
259 | + ), |
|
260 | + array('return' => 'xsd:string'), |
|
261 | 261 | 'urn:WSCMService', |
262 | 262 | '', |
263 | 263 | '', |
@@ -268,12 +268,12 @@ discard block |
||
268 | 268 | |
269 | 269 | |
270 | 270 | $s->register( |
271 | - 'WSCMCourse.getIdMessage', |
|
272 | - array( |
|
273 | - 'username' => 'xsd:string', |
|
274 | - 'password' => 'xsd:string', |
|
275 | - ), |
|
276 | - array('return' => 'xsd:string'), |
|
271 | + 'WSCMCourse.getIdMessage', |
|
272 | + array( |
|
273 | + 'username' => 'xsd:string', |
|
274 | + 'password' => 'xsd:string', |
|
275 | + ), |
|
276 | + array('return' => 'xsd:string'), |
|
277 | 277 | 'urn:WSCMService', |
278 | 278 | '', |
279 | 279 | '', |