@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | $objSkill = new Skill(); |
23 | 23 | $skill = $objSkill->get($skillId); |
24 | 24 | |
25 | -$htmlHeadXtra[] = '<link href="'. api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/media/css/core.css" rel="stylesheet">'; |
|
25 | +$htmlHeadXtra[] = '<link href="'.api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/css/core.css" rel="stylesheet">'; |
|
26 | 26 | |
27 | 27 | // Add badge studio paths |
28 | 28 | |
29 | 29 | $badgeStudio = [ |
30 | - 'core' => api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/', |
|
31 | - 'media' => api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/media/', |
|
32 | - 'templates' => api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/media/images/templates/', |
|
33 | - 'masks' => api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/media/images/masks/', |
|
34 | - 'script_js' => '<script src="'. api_get_path(WEB_LIBRARY_JS_PATH) .'badge-studio/media/js/studio.js?"></script>' |
|
30 | + 'core' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/', |
|
31 | + 'media' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/', |
|
32 | + 'templates' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/images/templates/', |
|
33 | + 'masks' => api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/images/masks/', |
|
34 | + 'script_js' => '<script src="'.api_get_path(WEB_LIBRARY_JS_PATH).'badge-studio/media/js/studio.js?"></script>' |
|
35 | 35 | ]; |
36 | 36 | |
37 | 37 | |
@@ -59,10 +59,10 @@ discard block |
||
59 | 59 | if ($existsBadgesDirectory) { |
60 | 60 | |
61 | 61 | if (!empty($skill['icon'])) { |
62 | - $iconFileAbsolutePath = $badgePath . $skill['icon']; |
|
62 | + $iconFileAbsolutePath = $badgePath.$skill['icon']; |
|
63 | 63 | |
64 | 64 | if (Security::check_abs_path($iconFileAbsolutePath, $badgePath)) { |
65 | - unlink($badgePath . $skill['icon']); |
|
65 | + unlink($badgePath.$skill['icon']); |
|
66 | 66 | } |
67 | 67 | } |
68 | 68 | |
@@ -85,24 +85,24 @@ discard block |
||
85 | 85 | |
86 | 86 | $objSkill->update($params); |
87 | 87 | |
88 | - header('Location: ' . api_get_path(WEB_CODE_PATH) . 'admin/skill_badge_list.php'); |
|
88 | + header('Location: '.api_get_path(WEB_CODE_PATH).'admin/skill_badge_list.php'); |
|
89 | 89 | exit; |
90 | 90 | } |
91 | 91 | |
92 | 92 | $interbreadcrumb = array( |
93 | 93 | array( |
94 | - 'url' => api_get_path(WEB_CODE_PATH) . 'admin/index.php', |
|
94 | + 'url' => api_get_path(WEB_CODE_PATH).'admin/index.php', |
|
95 | 95 | 'name' => get_lang('Administration') |
96 | 96 | ), |
97 | 97 | array( |
98 | - 'url' => api_get_path(WEB_CODE_PATH) . 'admin/skill_badge.php', |
|
98 | + 'url' => api_get_path(WEB_CODE_PATH).'admin/skill_badge.php', |
|
99 | 99 | 'name' => get_lang('Badges') |
100 | 100 | ) |
101 | 101 | ); |
102 | 102 | |
103 | 103 | $toolbar = Display::toolbarButton( |
104 | 104 | get_lang('ManageSkills'), |
105 | - api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php', |
|
105 | + api_get_path(WEB_CODE_PATH).'admin/skill_list.php', |
|
106 | 106 | 'list', |
107 | 107 | 'primary', |
108 | 108 | ['title' => get_lang('ManageSkills')] |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | * Deletes a file or a directory |
40 | 40 | * |
41 | 41 | * @author - Hugues Peeters |
42 | - * @param $file (String) - the path of file or directory to delete |
|
43 | - * @return boolean - true if the delete succeed, false otherwise. |
|
42 | + * @param string $file (String) - the path of file or directory to delete |
|
43 | + * @return boolean|null - true if the delete succeed, false otherwise. |
|
44 | 44 | * @see - delete() uses check_name_exist() and removeDir() functions |
45 | 45 | */ |
46 | 46 | function my_delete($file) |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | * @author Hugues Peeters <[email protected]> |
128 | 128 | * @param string $file_path complete path of the file or the directory |
129 | 129 | * @param string $new_file_name new name for the file or the directory |
130 | - * @return boolean true if succeed, false otherwise |
|
130 | + * @return string|false true if succeed, false otherwise |
|
131 | 131 | * @see rename() uses the check_name_exist() and php2phps() functions |
132 | 132 | */ |
133 | 133 | function my_rename($file_path, $new_file_name) { |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @param string $target the path of the new area |
175 | 175 | * @param bool $forceMove Whether to force a move or to make a copy (safer but slower) and then delete the original |
176 | 176 | * @param bool $moveContent In some cases (including migrations), we need to move the *content* and not the folder itself |
177 | - * @return bool true if the move succeed, false otherwise. |
|
177 | + * @return boolean|null true if the move succeed, false otherwise. |
|
178 | 178 | * @see move() uses check_name_exist() and copyDirTo() functions |
179 | 179 | */ |
180 | 180 | function move($source, $target, $forceMove = false, $moveContent = false) |
@@ -132,38 +132,38 @@ discard block |
||
132 | 132 | */ |
133 | 133 | function my_rename($file_path, $new_file_name) { |
134 | 134 | |
135 | - $save_dir = getcwd(); |
|
136 | - $path = dirname($file_path); |
|
137 | - $old_file_name = basename($file_path); |
|
138 | - $new_file_name = api_replace_dangerous_char($new_file_name); |
|
135 | + $save_dir = getcwd(); |
|
136 | + $path = dirname($file_path); |
|
137 | + $old_file_name = basename($file_path); |
|
138 | + $new_file_name = api_replace_dangerous_char($new_file_name); |
|
139 | 139 | |
140 | - // If no extension, take the old one |
|
141 | - if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
142 | - $new_file_name .= substr($old_file_name, $dotpos); |
|
143 | - } |
|
140 | + // If no extension, take the old one |
|
141 | + if ((strpos($new_file_name, '.') === false) && ($dotpos = strrpos($old_file_name, '.'))) { |
|
142 | + $new_file_name .= substr($old_file_name, $dotpos); |
|
143 | + } |
|
144 | 144 | |
145 | - // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
146 | - // This is useful for folder names, where otherwise '.' would be sticky |
|
145 | + // Note: still possible: 'xx.yy' -rename-> '.yy' -rename-> 'zz' |
|
146 | + // This is useful for folder names, where otherwise '.' would be sticky |
|
147 | 147 | |
148 | - // Extension PHP is not allowed, change to PHPS |
|
149 | - $new_file_name = php2phps($new_file_name); |
|
148 | + // Extension PHP is not allowed, change to PHPS |
|
149 | + $new_file_name = php2phps($new_file_name); |
|
150 | 150 | |
151 | - if ($new_file_name == $old_file_name) { |
|
152 | - return $old_file_name; |
|
153 | - } |
|
151 | + if ($new_file_name == $old_file_name) { |
|
152 | + return $old_file_name; |
|
153 | + } |
|
154 | 154 | |
155 | - if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
156 | - return false; |
|
157 | - } |
|
158 | - // On a Windows server, it would be better not to do the above check |
|
159 | - // because it succeeds for some new names resembling the old name. |
|
160 | - // But on Unix/Linux the check must be done because rename overwrites. |
|
155 | + if (strtolower($new_file_name) != strtolower($old_file_name) && check_name_exist($path.'/'.$new_file_name)) { |
|
156 | + return false; |
|
157 | + } |
|
158 | + // On a Windows server, it would be better not to do the above check |
|
159 | + // because it succeeds for some new names resembling the old name. |
|
160 | + // But on Unix/Linux the check must be done because rename overwrites. |
|
161 | 161 | |
162 | - chdir($path); |
|
163 | - $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
164 | - chdir($save_dir); |
|
162 | + chdir($path); |
|
163 | + $res = rename($old_file_name, $new_file_name) ? $new_file_name : false; |
|
164 | + chdir($save_dir); |
|
165 | 165 | |
166 | - return $res; |
|
166 | + return $res; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $file_name = basename($source); |
186 | 186 | // move onto self illegal: mv a/b/c a/b/c or mv a/b/c a/b |
187 | 187 | if (strcasecmp($target, dirname($source)) === 0) { |
188 | - return false; |
|
188 | + return false; |
|
189 | 189 | } |
190 | 190 | $isWindowsOS = api_is_windows_os(); |
191 | 191 | $canExec = function_exists('exec'); |
@@ -265,8 +265,8 @@ discard block |
||
265 | 265 | */ |
266 | 266 | function getextension($filename) |
267 | 267 | { |
268 | - $bouts = explode('.', $filename); |
|
269 | - return array(array_pop($bouts), implode('.', $bouts)); |
|
268 | + $bouts = explode('.', $filename); |
|
269 | + return array(array_pop($bouts), implode('.', $bouts)); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -277,17 +277,17 @@ discard block |
||
277 | 277 | * @param boolean $recursive if true , include subdirectory in total |
278 | 278 | */ |
279 | 279 | function dirsize($root, $recursive = true) { |
280 | - $dir = @opendir($root); |
|
281 | - $size = 0; |
|
282 | - while ($file = @readdir($dir)) { |
|
283 | - if (!in_array($file, array('.', '..'))) { |
|
284 | - if (is_dir($root.'/'.$file)) { |
|
285 | - $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
286 | - } else { |
|
287 | - $size += @filesize($root.'/'.$file); |
|
288 | - } |
|
289 | - } |
|
290 | - } |
|
291 | - @closedir($dir); |
|
292 | - return $size; |
|
280 | + $dir = @opendir($root); |
|
281 | + $size = 0; |
|
282 | + while ($file = @readdir($dir)) { |
|
283 | + if (!in_array($file, array('.', '..'))) { |
|
284 | + if (is_dir($root.'/'.$file)) { |
|
285 | + $size += $recursive ? dirsize($root.'/'.$file) : 0; |
|
286 | + } else { |
|
287 | + $size += @filesize($root.'/'.$file); |
|
288 | + } |
|
289 | + } |
|
290 | + } |
|
291 | + @closedir($dir); |
|
292 | + return $size; |
|
293 | 293 | } |
@@ -193,9 +193,9 @@ |
||
193 | 193 | /* File case */ |
194 | 194 | if (is_file($source)) { |
195 | 195 | if ($forceMove && !$isWindowsOS && $canExec) { |
196 | - exec('mv ' . $source . ' ' . $target . '/' . $file_name); |
|
196 | + exec('mv '.$source.' '.$target.'/'.$file_name); |
|
197 | 197 | } else { |
198 | - copy($source, $target . '/' . $file_name); |
|
198 | + copy($source, $target.'/'.$file_name); |
|
199 | 199 | unlink($source); |
200 | 200 | } |
201 | 201 | return true; |
@@ -86,31 +86,31 @@ discard block |
||
86 | 86 | |
87 | 87 | </script>'; |
88 | 88 | |
89 | -$allowed_views = array('mygroups','newest','pop'); |
|
89 | +$allowed_views = array('mygroups', 'newest', 'pop'); |
|
90 | 90 | $content = null; |
91 | 91 | |
92 | -if (isset($_GET['view']) && in_array($_GET['view'],$allowed_views)) { |
|
92 | +if (isset($_GET['view']) && in_array($_GET['view'], $allowed_views)) { |
|
93 | 93 | if ($_GET['view'] == 'mygroups') { |
94 | - $interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups')); |
|
95 | - $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('MyGroups')); |
|
96 | - } else if ( $_GET['view'] == 'newest') { |
|
97 | - $interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups')); |
|
98 | - $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Newest')); |
|
99 | - } else { |
|
100 | - $interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups')); |
|
101 | - $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Popular')); |
|
94 | + $interbreadcrumb[] = array('url' =>'groups.php', 'name' => get_lang('Groups')); |
|
95 | + $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('MyGroups')); |
|
96 | + } else if ($_GET['view'] == 'newest') { |
|
97 | + $interbreadcrumb[] = array('url' =>'groups.php', 'name' => get_lang('Groups')); |
|
98 | + $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('Newest')); |
|
99 | + } else { |
|
100 | + $interbreadcrumb[] = array('url' =>'groups.php', 'name' => get_lang('Groups')); |
|
101 | + $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('Popular')); |
|
102 | 102 | } |
103 | 103 | } else { |
104 | - $interbreadcrumb[]= array ('url' =>'groups.php','name' => get_lang('Groups')); |
|
104 | + $interbreadcrumb[] = array('url' =>'groups.php', 'name' => get_lang('Groups')); |
|
105 | 105 | if (!isset($_GET['id'])) { |
106 | - $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('GroupList')); |
|
106 | + $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('GroupList')); |
|
107 | 107 | } else { |
108 | 108 | //$interbreadcrumb[]= array ('url' =>'#','name' => get_lang('Group')); |
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | 112 | // getting group information |
113 | -$group_id = isset($_GET['id']) ? intval($_GET['id']) : null; |
|
113 | +$group_id = isset($_GET['id']) ? intval($_GET['id']) : null; |
|
114 | 114 | $relation_group_title = ''; |
115 | 115 | $role = 0; |
116 | 116 | |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | $group_info = $usergroup->get($group_id); |
121 | 121 | |
122 | 122 | |
123 | - $interbreadcrumb[]= array ('url' =>'#','name' => $group_info['name']); |
|
123 | + $interbreadcrumb[] = array('url' =>'#', 'name' => $group_info['name']); |
|
124 | 124 | |
125 | - if (isset($_GET['action']) && $_GET['action']=='leave') { |
|
125 | + if (isset($_GET['action']) && $_GET['action'] == 'leave') { |
|
126 | 126 | $user_leaved = intval($_GET['u']); |
127 | 127 | // I can "leave me myself" |
128 | 128 | if (api_get_user_id() == $user_leaved) { |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | } |
137 | 137 | |
138 | 138 | // add a user to a group if its open |
139 | - if (isset($_GET['action']) && $_GET['action']=='join') { |
|
139 | + if (isset($_GET['action']) && $_GET['action'] == 'join') { |
|
140 | 140 | // we add a user only if is a open group |
141 | 141 | $user_join = intval($_GET['u']); |
142 | 142 | if (api_get_user_id() == $user_join && !empty($group_id)) { |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $group_info = $usergroup->get($group_id); |
166 | 166 | |
167 | 167 | //Loading group information |
168 | -if (isset($_GET['status']) && $_GET['status']=='sent') { |
|
168 | +if (isset($_GET['status']) && $_GET['status'] == 'sent') { |
|
169 | 169 | $social_right_content .= Display::return_message(get_lang('MessageHasBeenSent'), 'confirmation', false); |
170 | 170 | } |
171 | 171 | |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | |
175 | 175 | if (!$is_group_member && $group_info['visibility'] == GROUP_PERMISSION_CLOSED) { |
176 | 176 | if ($role == GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER) { |
177 | - $social_right_content .= Display::return_message(get_lang('YouAlreadySentAnInvitation')); |
|
177 | + $social_right_content .= Display::return_message(get_lang('YouAlreadySentAnInvitation')); |
|
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
@@ -185,19 +185,19 @@ discard block |
||
185 | 185 | ) { |
186 | 186 | $social_right_content .= '<div class="group-tool">'; |
187 | 187 | $social_right_content .= '<div class="pull-right">'; |
188 | - $social_right_content .= '<a class="btn btn-default btn-sm" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'. |
|
188 | + $social_right_content .= '<a class="btn btn-default btn-sm" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'. |
|
189 | 189 | get_lang('JoinGroup').'</a>'; |
190 | - $social_right_content .= '</div>'; |
|
191 | - $social_right_content .= '</div>'; |
|
190 | + $social_right_content .= '</div>'; |
|
191 | + $social_right_content .= '</div>'; |
|
192 | 192 | } elseif ($role == GROUP_USER_PERMISSION_PENDING_INVITATION) { |
193 | 193 | $social_right_content .= '<div class="group-tool">'; |
194 | 194 | $social_right_content .= '<div class="pull-right">'; |
195 | - $social_right_content .= '<a class="btn btn-default btn-sm" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'. |
|
195 | + $social_right_content .= '<a class="btn btn-default btn-sm" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'. |
|
196 | 196 | Display::returnFontAwesomeIcon('envelope').' '. |
197 | 197 | get_lang('YouHaveBeenInvitedJoinNow').'</a>'; |
198 | 198 | } |
199 | - $social_right_content .= '</div>'; |
|
200 | - $social_right_content .= '</div>'; |
|
199 | + $social_right_content .= '</div>'; |
|
200 | + $social_right_content .= '</div>'; |
|
201 | 201 | } |
202 | 202 | $content = MessageManager::display_messages_for_group($group_id); |
203 | 203 | if ($is_group_member) { |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | 'action' => 'add_message_group' |
212 | 212 | ]); |
213 | 213 | $create_thread_link = Display::url( |
214 | - Display::returnFontAwesomeIcon('commenting') . ' ' . |
|
214 | + Display::returnFontAwesomeIcon('commenting').' '. |
|
215 | 215 | get_lang('YouShouldCreateATopic'), |
216 | 216 | $createThreadUrl, |
217 | 217 | [ |
@@ -231,7 +231,7 @@ discard block |
||
231 | 231 | 'action' => 'add_message_group', |
232 | 232 | ]); |
233 | 233 | $create_thread_link = Display::url( |
234 | - Display::returnFontAwesomeIcon('commenting') . ' ' . |
|
234 | + Display::returnFontAwesomeIcon('commenting').' '. |
|
235 | 235 | get_lang('NewTopic'), |
236 | 236 | $createThreadUrl, |
237 | 237 | [ |
@@ -271,21 +271,21 @@ discard block |
||
271 | 271 | foreach ($members as $member) { |
272 | 272 | // if is a member |
273 | 273 | if (in_array($member['relation_type'], |
274 | - array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER,GROUP_USER_PERMISSION_MODERATOR)) |
|
274 | + array(GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_MODERATOR)) |
|
275 | 275 | ) { |
276 | 276 | //add icons |
277 | 277 | if ($member['relation_type'] == GROUP_USER_PERMISSION_ADMIN) { |
278 | - $icon= Display::return_icon('social_group_admin.png', get_lang('Admin')); |
|
278 | + $icon = Display::return_icon('social_group_admin.png', get_lang('Admin')); |
|
279 | 279 | } elseif ($member['relation_type'] == GROUP_USER_PERMISSION_MODERATOR) { |
280 | - $icon= Display::return_icon('social_group_moderator.png', get_lang('Moderator')); |
|
280 | + $icon = Display::return_icon('social_group_moderator.png', get_lang('Moderator')); |
|
281 | 281 | } else { |
282 | - $icon= ''; |
|
282 | + $icon = ''; |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | $userPicture = UserManager::getUserPicture($member['id']); |
286 | 286 | $member_content .= '<div class="col-md-3">'; |
287 | 287 | $member_content .= '<div class="items-user">'; |
288 | - $member_name = Display::url(api_get_person_name(cut($member['user_info']['firstname'],15),cut($member['user_info']['lastname'],15)).' '.$icon, $member['user_info']['profile_url']); |
|
288 | + $member_name = Display::url(api_get_person_name(cut($member['user_info']['firstname'], 15), cut($member['user_info']['lastname'], 15)).' '.$icon, $member['user_info']['profile_url']); |
|
289 | 289 | $member_content .= Display::div('<img class="img-circle" src="'.$userPicture.'"/>', array('class' => 'avatar')); |
290 | 290 | $member_content .= Display::div($member_name, array('class' => 'name')); |
291 | 291 | $member_content .= '</div>'; |
@@ -297,10 +297,10 @@ discard block |
||
297 | 297 | } |
298 | 298 | |
299 | 299 | if (!empty($create_thread_link)) { |
300 | - $create_thread_link = Display::div($create_thread_link, array('class'=>'pull-right')); |
|
300 | + $create_thread_link = Display::div($create_thread_link, array('class'=>'pull-right')); |
|
301 | 301 | } |
302 | 302 | $headers = array(get_lang('Discussions'), get_lang('Members')); |
303 | - $socialForum = Display::tabs($headers, array($content, $member_content),'tabs'); |
|
303 | + $socialForum = Display::tabs($headers, array($content, $member_content), 'tabs'); |
|
304 | 304 | |
305 | 305 | } else { |
306 | 306 | // if I already sent an invitation message |
@@ -312,9 +312,9 @@ discard block |
||
312 | 312 | ) |
313 | 313 | ) |
314 | 314 | ) { |
315 | - $social_right_content .= '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a>'; |
|
315 | + $social_right_content .= '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('JoinGroup').'</a>'; |
|
316 | 316 | } elseif ($role == GROUP_USER_PERMISSION_PENDING_INVITATION) { |
317 | - $social_right_content .= '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('YouHaveBeenInvitedJoinNow').'</a>'; |
|
317 | + $social_right_content .= '<a class="btn" href="group_view.php?id='.$group_id.'&action=join&u='.api_get_user_id().'">'.get_lang('YouHaveBeenInvitedJoinNow').'</a>'; |
|
318 | 318 | } |
319 | 319 | } |
320 | 320 |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | // Database Table Definitions |
20 | 20 | $tbl_user = Database::get_main_table(TABLE_MAIN_USER); |
21 | -$tbl_group_rel_user = Database::get_main_table(TABLE_USERGROUP_REL_USER); |
|
21 | +$tbl_group_rel_user = Database::get_main_table(TABLE_USERGROUP_REL_USER); |
|
22 | 22 | |
23 | 23 | // setting the name of the tool |
24 | 24 | $tool_name = get_lang('SubscribeUsersToGroup'); |
@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | } |
41 | 41 | } |
42 | 42 | |
43 | -$interbreadcrumb[] = array('url' =>'groups.php','name' => get_lang('Groups')); |
|
43 | +$interbreadcrumb[] = array('url' =>'groups.php', 'name' => get_lang('Groups')); |
|
44 | 44 | $interbreadcrumb[] = array('url' => 'group_view.php?id='.$group_id, 'name' => $group_info['name']); |
45 | 45 | $interbreadcrumb[] = array('url' =>'#', 'name' => get_lang('SubscribeUsersToGroup')); |
46 | 46 | |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | if (is_array($user_list) && count($user_list) > 0) { |
76 | 76 | //send invitation message |
77 | - foreach ($user_list as $user_id){ |
|
77 | + foreach ($user_list as $user_id) { |
|
78 | 78 | $result = MessageManager::send_message( |
79 | 79 | $user_id, |
80 | 80 | $title, |
@@ -110,8 +110,8 @@ discard block |
||
110 | 110 | |
111 | 111 | if (!isset($group_friend_list[$group_id]) || |
112 | 112 | isset($group_friend_list[$group_id]) && |
113 | - $group_friend_list[$group_id]['relation_type'] == '' ) { |
|
114 | - $Users[$friend['friend_user_id']]= array( |
|
113 | + $group_friend_list[$group_id]['relation_type'] == '') { |
|
114 | + $Users[$friend['friend_user_id']] = array( |
|
115 | 115 | 'user_id' => $friend['friend_user_id'], |
116 | 116 | 'firstname' => $friend['firstName'], |
117 | 117 | 'lastname' => $friend['lastName'], |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | ); |
121 | 121 | } |
122 | 122 | } else { |
123 | - $Users[$friend['friend_user_id']]= array( |
|
123 | + $Users[$friend['friend_user_id']] = array( |
|
124 | 124 | 'user_id' => $friend['friend_user_id'], |
125 | 125 | 'firstname' =>$friend['firstName'], |
126 | 126 | 'lastname' => $friend['lastName'], |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | -if (is_array($Users) && count($Users) > 0 ) { |
|
134 | +if (is_array($Users) && count($Users) > 0) { |
|
135 | 135 | foreach ($Users as $user) { |
136 | 136 | if ($user['group_id'] != $group_id) { |
137 | 137 | $nosessionUsersList[$user['user_id']] = api_get_person_name( |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | } |
144 | 144 | |
145 | 145 | $social_left_content = SocialManager::show_social_menu('invite_friends', $group_id); |
146 | -$social_right_content = '<h3 class="group-title">'.Security::remove_XSS($group_info['name'], STUDENT, true).'</h3>'; |
|
146 | +$social_right_content = '<h3 class="group-title">'.Security::remove_XSS($group_info['name'], STUDENT, true).'</h3>'; |
|
147 | 147 | |
148 | 148 | if (count($nosessionUsersList) == 0) { |
149 | 149 | $friends = SocialManager::get_friends(api_get_user_id()); |
@@ -179,7 +179,7 @@ discard block |
||
179 | 179 | array(GROUP_USER_PERMISSION_PENDING_INVITATION) |
180 | 180 | ); |
181 | 181 | |
182 | -if (is_array($members) && count($members)>0) { |
|
182 | +if (is_array($members) && count($members) > 0) { |
|
183 | 183 | foreach ($members as &$member) { |
184 | 184 | $image = UserManager::getUserPicture($member['id']); |
185 | 185 | $member['image'] = '<img class="img-circle" src="'.$image.'" width="50px" height="50px" />'; |
@@ -306,7 +306,7 @@ |
||
306 | 306 | * @param int Whether the announcement should be visible to anonymous users (1) or not (0) |
307 | 307 | * @param string The language for which the announvement should be shown. Leave null for all langages |
308 | 308 | * @param int Whether to send an e-mail to all users (1) or not (0) |
309 | - * @return mixed insert_id on success, false on failure |
|
309 | + * @return false|string insert_id on success, false on failure |
|
310 | 310 | */ |
311 | 311 | public static function add_announcement( |
312 | 312 | $title, |
@@ -22,14 +22,14 @@ discard block |
||
22 | 22 | $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS); |
23 | 23 | $userGroup = new UserGroup(); |
24 | 24 | |
25 | - $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0); |
|
25 | + $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0); |
|
26 | 26 | $groups = array(); |
27 | 27 | foreach ($temp_user_groups as $user_group) { |
28 | 28 | $groups = array_merge($groups, array($user_group['id'])); |
29 | 29 | $groups = array_merge($groups, $userGroup->get_parent_groups($user_group['id'])); |
30 | 30 | } |
31 | 31 | |
32 | - $groups_string = '('.implode($groups,',').')'; |
|
32 | + $groups_string = '('.implode($groups, ',').')'; |
|
33 | 33 | $now = api_get_utc_datetime(); |
34 | 34 | $sql = "SELECT *, DATE_FORMAT(date_start,'%d-%m-%Y %h:%i:%s') AS display_date |
35 | 35 | FROM $db_table |
@@ -104,13 +104,13 @@ discard block |
||
104 | 104 | * @param string $user_id |
105 | 105 | * @return string |
106 | 106 | */ |
107 | - public static function display_all_announcements($visible, $id = -1, $start = 0,$user_id='') |
|
107 | + public static function display_all_announcements($visible, $id = -1, $start = 0, $user_id = '') |
|
108 | 108 | { |
109 | 109 | $user_selected_language = api_get_interface_language(); |
110 | - $start = intval($start); |
|
110 | + $start = intval($start); |
|
111 | 111 | $userGroup = new UserGroup(); |
112 | 112 | $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS); |
113 | - $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(),0); |
|
113 | + $temp_user_groups = $userGroup->get_groups_by_user(api_get_user_id(), 0); |
|
114 | 114 | $groups = array(); |
115 | 115 | foreach ($temp_user_groups as $user_group) { |
116 | 116 | $groups = array_merge($groups, array($user_group['id'])); |
@@ -118,10 +118,10 @@ discard block |
||
118 | 118 | } |
119 | 119 | |
120 | 120 | // Checks if tables exists to not break platform not updated |
121 | - $groups_string = '('.implode($groups,',').')'; |
|
121 | + $groups_string = '('.implode($groups, ',').')'; |
|
122 | 122 | |
123 | 123 | $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
124 | - $now = api_get_utc_datetime(); |
|
124 | + $now = api_get_utc_datetime(); |
|
125 | 125 | |
126 | 126 | $sql = "SELECT * FROM ".$db_table." |
127 | 127 | WHERE |
@@ -152,10 +152,10 @@ discard block |
||
152 | 152 | $sql .= " AND access_url_id IN ('1', '$current_access_url_id')"; |
153 | 153 | } |
154 | 154 | |
155 | - if(!isset($_GET['start']) || $_GET['start'] == 0) { |
|
155 | + if (!isset($_GET['start']) || $_GET['start'] == 0) { |
|
156 | 156 | $sql .= " ORDER BY date_start DESC LIMIT ".$start.",20"; |
157 | 157 | } else { |
158 | - $sql .= " ORDER BY date_start DESC LIMIT ".($start+1).",20"; |
|
158 | + $sql .= " ORDER BY date_start DESC LIMIT ".($start + 1).",20"; |
|
159 | 159 | } |
160 | 160 | $announcements = Database::query($sql); |
161 | 161 | $content = ''; |
@@ -204,10 +204,10 @@ discard block |
||
204 | 204 | */ |
205 | 205 | public static function display_arrow($user_id) |
206 | 206 | { |
207 | - $start = (int)$_GET['start']; |
|
207 | + $start = (int) $_GET['start']; |
|
208 | 208 | $nb_announcement = SystemAnnouncementManager :: count_nb_announcement($start, $user_id); |
209 | - $next = ((int)$_GET['start']+19); |
|
210 | - $prev = ((int)$_GET['start']-19); |
|
209 | + $next = ((int) $_GET['start'] + 19); |
|
210 | + $prev = ((int) $_GET['start'] - 19); |
|
211 | 211 | $content = ''; |
212 | 212 | if (!isset($_GET['start']) || $_GET['start'] == 0) { |
213 | 213 | if ($nb_announcement > 20) { |
@@ -564,7 +564,7 @@ discard block |
||
564 | 564 | $sendEmailTest |
565 | 565 | ); |
566 | 566 | } else { |
567 | - if ($send_mail==1) { |
|
567 | + if ($send_mail == 1) { |
|
568 | 568 | SystemAnnouncementManager::send_system_announcement_by_email( |
569 | 569 | $title, |
570 | 570 | $content, |
@@ -675,7 +675,7 @@ discard block |
||
675 | 675 | $language = null, |
676 | 676 | $sendEmailTest = false |
677 | 677 | ) { |
678 | - $content = str_replace(array('\r\n', '\n', '\r'),'', $content); |
|
678 | + $content = str_replace(array('\r\n', '\n', '\r'), '', $content); |
|
679 | 679 | $now = api_get_utc_datetime(); |
680 | 680 | |
681 | 681 | if ($sendEmailTest) { |
@@ -701,7 +701,7 @@ discard block |
||
701 | 701 | WHERE status = '5' "; |
702 | 702 | } |
703 | 703 | |
704 | - if ($teacher<> 0 && $student <> 0) { |
|
704 | + if ($teacher <> 0 && $student <> 0) { |
|
705 | 705 | $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
706 | 706 | WHERE 1 = 1 "; |
707 | 707 | } |
@@ -734,7 +734,7 @@ discard block |
||
734 | 734 | |
735 | 735 | $message_sent = false; |
736 | 736 | |
737 | - while ($row = Database::fetch_array($result,'ASSOC')) { |
|
737 | + while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
738 | 738 | MessageManager::send_message_simple($row['user_id'], $title, $content); |
739 | 739 | $message_sent = true; |
740 | 740 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | $cut_size = 500; |
756 | 756 | $now = api_get_utc_datetime(); |
757 | 757 | |
758 | - $sql = "SELECT * FROM " . $table . " |
|
758 | + $sql = "SELECT * FROM ".$table." |
|
759 | 759 | WHERE |
760 | 760 | (lang = '$user_selected_language' OR lang = '') AND |
761 | 761 | ('$now' >= date_start AND '$now' <= date_end) "; |
@@ -10,12 +10,12 @@ discard block |
||
10 | 10 | const VISIBLE_STUDENT = 2; |
11 | 11 | const VISIBLE_TEACHER = 3; |
12 | 12 | |
13 | - /** |
|
14 | - * Displays all announcements |
|
15 | - * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER |
|
16 | - * @param int $id The identifier of the announcement to display |
|
17 | - */ |
|
18 | - public static function display_announcements($visible, $id = -1) |
|
13 | + /** |
|
14 | + * Displays all announcements |
|
15 | + * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER |
|
16 | + * @param int $id The identifier of the announcement to display |
|
17 | + */ |
|
18 | + public static function display_announcements($visible, $id = -1) |
|
19 | 19 | { |
20 | 20 | $user_selected_language = api_get_interface_language(); |
21 | 21 | $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
@@ -423,10 +423,10 @@ discard block |
||
423 | 423 | } |
424 | 424 | |
425 | 425 | /** |
426 | - * Makes the announcement id visible only for groups in groups_array |
|
427 | - * @param int $announcement_id |
|
428 | - * @param array $group_array array of group id |
|
429 | - **/ |
|
426 | + * Makes the announcement id visible only for groups in groups_array |
|
427 | + * @param int $announcement_id |
|
428 | + * @param array $group_array array of group id |
|
429 | + **/ |
|
430 | 430 | public static function announcement_for_groups($announcement_id, $group_array) |
431 | 431 | { |
432 | 432 | $tbl_announcement_group = Database:: get_main_table( |
@@ -459,10 +459,10 @@ discard block |
||
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
462 | - * Gets the groups of this announce |
|
463 | - * @param int announcement id |
|
464 | - * @return array array of group id |
|
465 | - **/ |
|
462 | + * Gets the groups of this announce |
|
463 | + * @param int announcement id |
|
464 | + * @return array array of group id |
|
465 | + **/ |
|
466 | 466 | public static function get_announcement_groups($announcement_id) |
467 | 467 | { |
468 | 468 | $tbl_announcement_group = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS_GROUPS); |
@@ -482,15 +482,15 @@ discard block |
||
482 | 482 | return $groups; |
483 | 483 | } |
484 | 484 | |
485 | - /** |
|
486 | - * Updates an announcement to the database |
|
487 | - * @param integer $id : id of the announcement |
|
488 | - * @param string $title : title of the announcement |
|
489 | - * @param string $content : content of the announcement |
|
490 | - * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
491 | - * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
492 | - * @return bool True on success, false on failure |
|
493 | - */ |
|
485 | + /** |
|
486 | + * Updates an announcement to the database |
|
487 | + * @param integer $id : id of the announcement |
|
488 | + * @param string $title : title of the announcement |
|
489 | + * @param string $content : content of the announcement |
|
490 | + * @param array $date_start: start date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
491 | + * @param array $date_end : end date of announcement (0 => day ; 1 => month ; 2 => year ; 3 => hour ; 4 => minute) |
|
492 | + * @return bool True on success, false on failure |
|
493 | + */ |
|
494 | 494 | public static function update_announcement( |
495 | 495 | $id, |
496 | 496 | $title, |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | $sendEmailTest = false |
506 | 506 | ) { |
507 | 507 | $em = Database::getManager(); |
508 | - $announcement = $em->find('ChamiloCoreBundle:SysAnnouncement', $id); |
|
508 | + $announcement = $em->find('ChamiloCoreBundle:SysAnnouncement', $id); |
|
509 | 509 | |
510 | 510 | if (!$announcement) { |
511 | 511 | return false; |
@@ -529,28 +529,28 @@ discard block |
||
529 | 529 | return false; |
530 | 530 | } |
531 | 531 | |
532 | - if (($date_end_to_compare[1] || |
|
532 | + if (($date_end_to_compare[1] || |
|
533 | 533 | $date_end_to_compare[2] || |
534 | 534 | $date_end_to_compare[0]) && |
535 | 535 | !checkdate($date_end_to_compare[1], $date_end_to_compare[2], $date_end_to_compare[0]) |
536 | 536 | ) { |
537 | - Display :: display_normal_message(get_lang('InvalidEndDate')); |
|
537 | + Display :: display_normal_message(get_lang('InvalidEndDate')); |
|
538 | 538 | |
539 | - return false; |
|
540 | - } |
|
539 | + return false; |
|
540 | + } |
|
541 | 541 | |
542 | - if (strlen(trim($title)) == 0) { |
|
543 | - Display::display_normal_message(get_lang('InvalidTitle')); |
|
542 | + if (strlen(trim($title)) == 0) { |
|
543 | + Display::display_normal_message(get_lang('InvalidTitle')); |
|
544 | 544 | |
545 | - return false; |
|
546 | - } |
|
545 | + return false; |
|
546 | + } |
|
547 | 547 | |
548 | 548 | $start = api_get_utc_datetime($date_start); |
549 | 549 | $end = api_get_utc_datetime($date_end); |
550 | 550 | |
551 | - //Fixing urls that are sent by email |
|
552 | - //$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content); |
|
553 | - //$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content); |
|
551 | + //Fixing urls that are sent by email |
|
552 | + //$content = str_replace('src=\"/home/', 'src=\"'.api_get_path(WEB_PATH).'home/', $content); |
|
553 | + //$content = str_replace('file=/home/', 'file='.api_get_path(WEB_PATH).'home/', $content); |
|
554 | 554 | $content = str_replace('src=\"'.api_get_path(REL_HOME_PATH), 'src=\"'.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content); |
555 | 555 | $content = str_replace('file='.api_get_path(REL_HOME_PATH), 'file='.api_get_path(WEB_PATH).api_get_path(REL_HOME_PATH), $content); |
556 | 556 | |
@@ -592,81 +592,81 @@ discard block |
||
592 | 592 | $em->merge($announcement); |
593 | 593 | $em->flush(); |
594 | 594 | |
595 | - return true; |
|
596 | - } |
|
595 | + return true; |
|
596 | + } |
|
597 | 597 | |
598 | - /** |
|
599 | - * Deletes an announcement |
|
600 | - * @param int $id The identifier of the announcement that should be |
|
601 | - * @return bool True on success, false on failure |
|
602 | - */ |
|
603 | - public static function delete_announcement($id) |
|
598 | + /** |
|
599 | + * Deletes an announcement |
|
600 | + * @param int $id The identifier of the announcement that should be |
|
601 | + * @return bool True on success, false on failure |
|
602 | + */ |
|
603 | + public static function delete_announcement($id) |
|
604 | 604 | { |
605 | - $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
606 | - $id = intval($id); |
|
607 | - $sql = "DELETE FROM ".$db_table." WHERE id =".$id; |
|
608 | - $res = Database::query($sql); |
|
605 | + $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
606 | + $id = intval($id); |
|
607 | + $sql = "DELETE FROM ".$db_table." WHERE id =".$id; |
|
608 | + $res = Database::query($sql); |
|
609 | 609 | if ($res === false) { |
610 | - return false; |
|
611 | - } |
|
612 | - return true; |
|
613 | - } |
|
614 | - |
|
615 | - /** |
|
616 | - * Gets an announcement |
|
617 | - * @param int $id The identifier of the announcement that should be |
|
618 | - * @return object Object of class StdClass or the required class, containing the query result row |
|
619 | - */ |
|
620 | - public static function get_announcement($id) |
|
610 | + return false; |
|
611 | + } |
|
612 | + return true; |
|
613 | + } |
|
614 | + |
|
615 | + /** |
|
616 | + * Gets an announcement |
|
617 | + * @param int $id The identifier of the announcement that should be |
|
618 | + * @return object Object of class StdClass or the required class, containing the query result row |
|
619 | + */ |
|
620 | + public static function get_announcement($id) |
|
621 | 621 | { |
622 | - $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
623 | - $id = intval($id); |
|
624 | - $sql = "SELECT * FROM ".$db_table." WHERE id = ".$id; |
|
625 | - $announcement = Database::fetch_object(Database::query($sql)); |
|
626 | - |
|
627 | - return $announcement; |
|
628 | - } |
|
629 | - |
|
630 | - /** |
|
631 | - * Change the visibility of an announcement |
|
632 | - * @param int $announcement_id |
|
633 | - * @param int $user For who should the visibility be changed |
|
622 | + $db_table = Database :: get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
623 | + $id = intval($id); |
|
624 | + $sql = "SELECT * FROM ".$db_table." WHERE id = ".$id; |
|
625 | + $announcement = Database::fetch_object(Database::query($sql)); |
|
626 | + |
|
627 | + return $announcement; |
|
628 | + } |
|
629 | + |
|
630 | + /** |
|
631 | + * Change the visibility of an announcement |
|
632 | + * @param int $announcement_id |
|
633 | + * @param int $user For who should the visibility be changed |
|
634 | 634 | * (possible values are VISIBLE_TEACHER, VISIBLE_STUDENT, VISIBLE_GUEST) |
635 | - * @return bool True on success, false on failure |
|
636 | - */ |
|
637 | - public static function set_visibility($announcement_id, $user, $visible) |
|
635 | + * @return bool True on success, false on failure |
|
636 | + */ |
|
637 | + public static function set_visibility($announcement_id, $user, $visible) |
|
638 | 638 | { |
639 | - $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
640 | - $visible = intval($visible); |
|
641 | - $announcement_id = intval($announcement_id); |
|
639 | + $db_table = Database::get_main_table(TABLE_MAIN_SYSTEM_ANNOUNCEMENTS); |
|
640 | + $visible = intval($visible); |
|
641 | + $announcement_id = intval($announcement_id); |
|
642 | 642 | |
643 | 643 | if (!in_array($user, array(self::VISIBLE_GUEST, self::VISIBLE_STUDENT, self::VISIBLE_TEACHER))) { |
644 | 644 | return false; |
645 | 645 | } |
646 | 646 | |
647 | - $field = ($user == self::VISIBLE_TEACHER ? 'visible_teacher' : ($user == self::VISIBLE_STUDENT ? 'visible_student' : 'visible_guest')); |
|
647 | + $field = ($user == self::VISIBLE_TEACHER ? 'visible_teacher' : ($user == self::VISIBLE_STUDENT ? 'visible_student' : 'visible_guest')); |
|
648 | 648 | |
649 | - $sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."' |
|
649 | + $sql = "UPDATE ".$db_table." SET ".$field." = '".$visible."' |
|
650 | 650 | WHERE id='".$announcement_id."'"; |
651 | - $res = Database::query($sql); |
|
652 | - |
|
653 | - if ($res === false) { |
|
654 | - return false; |
|
655 | - } |
|
656 | - |
|
657 | - return true; |
|
658 | - } |
|
659 | - |
|
660 | - /** |
|
661 | - * Send a system announcement by e-mail to all teachers/students depending on parameters |
|
662 | - * @param string $title |
|
663 | - * @param string $content |
|
664 | - * @param int $teacher Whether to send to all teachers (1) or not (0) |
|
665 | - * @param int $student Whether to send to all students (1) or not (0) |
|
666 | - * @param string $language Language (optional, considered for all languages if left empty) |
|
651 | + $res = Database::query($sql); |
|
652 | + |
|
653 | + if ($res === false) { |
|
654 | + return false; |
|
655 | + } |
|
656 | + |
|
657 | + return true; |
|
658 | + } |
|
659 | + |
|
660 | + /** |
|
661 | + * Send a system announcement by e-mail to all teachers/students depending on parameters |
|
662 | + * @param string $title |
|
663 | + * @param string $content |
|
664 | + * @param int $teacher Whether to send to all teachers (1) or not (0) |
|
665 | + * @param int $student Whether to send to all students (1) or not (0) |
|
666 | + * @param string $language Language (optional, considered for all languages if left empty) |
|
667 | 667 | * @param bool $sendEmailTest |
668 | 668 | * @return bool True if the message was sent or there was no destination matching. False on database or e-mail sending error. |
669 | - */ |
|
669 | + */ |
|
670 | 670 | public static function send_system_announcement_by_email( |
671 | 671 | $title, |
672 | 672 | $content, |
@@ -692,26 +692,26 @@ discard block |
||
692 | 692 | } |
693 | 693 | |
694 | 694 | if ($teacher <> 0 && $student == 0) { |
695 | - $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
695 | + $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
696 | 696 | WHERE status = '1' "; |
697 | - } |
|
697 | + } |
|
698 | 698 | |
699 | - if ($teacher == 0 && $student <> 0) { |
|
700 | - $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
699 | + if ($teacher == 0 && $student <> 0) { |
|
700 | + $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
701 | 701 | WHERE status = '5' "; |
702 | - } |
|
702 | + } |
|
703 | 703 | |
704 | - if ($teacher<> 0 && $student <> 0) { |
|
705 | - $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
704 | + if ($teacher<> 0 && $student <> 0) { |
|
705 | + $sql = "SELECT DISTINCT u.user_id FROM $user_table u $url_condition |
|
706 | 706 | WHERE 1 = 1 "; |
707 | - } |
|
707 | + } |
|
708 | 708 | |
709 | - if (!empty($language)) { |
|
710 | - //special condition because language was already treated for SQL insert before |
|
711 | - $sql .= " AND language = '".Database::escape_string($language)."' "; |
|
712 | - } |
|
709 | + if (!empty($language)) { |
|
710 | + //special condition because language was already treated for SQL insert before |
|
711 | + $sql .= " AND language = '".Database::escape_string($language)."' "; |
|
712 | + } |
|
713 | 713 | |
714 | - if (api_is_multiple_url_enabled()) { |
|
714 | + if (api_is_multiple_url_enabled()) { |
|
715 | 715 | $sql .= " AND access_url_id = '".$current_access_url_id."' "; |
716 | 716 | } |
717 | 717 | |
@@ -721,36 +721,36 @@ discard block |
||
721 | 721 | // Expiration date |
722 | 722 | $sql .= " AND (expiration_date = '' OR expiration_date IS NULL OR expiration_date > '$now') "; |
723 | 723 | |
724 | - if ((empty($teacher) || $teacher == '0') && (empty($student) || $student == '0')) { |
|
724 | + if ((empty($teacher) || $teacher == '0') && (empty($student) || $student == '0')) { |
|
725 | 725 | |
726 | - return true; |
|
727 | - } |
|
726 | + return true; |
|
727 | + } |
|
728 | 728 | |
729 | - $result = Database::query($sql); |
|
730 | - if ($result === false) { |
|
729 | + $result = Database::query($sql); |
|
730 | + if ($result === false) { |
|
731 | 731 | |
732 | - return false; |
|
733 | - } |
|
732 | + return false; |
|
733 | + } |
|
734 | 734 | |
735 | 735 | $message_sent = false; |
736 | 736 | |
737 | - while ($row = Database::fetch_array($result,'ASSOC')) { |
|
737 | + while ($row = Database::fetch_array($result,'ASSOC')) { |
|
738 | 738 | MessageManager::send_message_simple($row['user_id'], $title, $content); |
739 | 739 | $message_sent = true; |
740 | - } |
|
740 | + } |
|
741 | 741 | |
742 | - // Minor validation to clean up the attachment files in the announcement |
|
743 | - if (!empty($_FILES)) { |
|
744 | - $attachments = $_FILES; |
|
745 | - foreach ($attachments as $attachment) { |
|
746 | - unlink($attachment['tmp_name']); |
|
747 | - } |
|
748 | - } |
|
749 | - |
|
750 | - return $message_sent; //true if at least one e-mail was sent |
|
751 | - } |
|
752 | - |
|
753 | - /** |
|
742 | + // Minor validation to clean up the attachment files in the announcement |
|
743 | + if (!empty($_FILES)) { |
|
744 | + $attachments = $_FILES; |
|
745 | + foreach ($attachments as $attachment) { |
|
746 | + unlink($attachment['tmp_name']); |
|
747 | + } |
|
748 | + } |
|
749 | + |
|
750 | + return $message_sent; //true if at least one e-mail was sent |
|
751 | + } |
|
752 | + |
|
753 | + /** |
|
754 | 754 | * Displays announcements as an slideshow |
755 | 755 | * @param int $visible VISIBLE_GUEST, VISIBLE_STUDENT or VISIBLE_TEACHER |
756 | 756 | * @param int $id The identifier of the announcement to display |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | 'thematic_advance_delete' |
47 | 47 | ); |
48 | 48 | |
49 | -$action = 'thematic_details'; |
|
49 | +$action = 'thematic_details'; |
|
50 | 50 | if (isset($_REQUEST['action']) && in_array($_REQUEST['action'], $actions)) { |
51 | 51 | $action = $_REQUEST['action']; |
52 | 52 | } |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | $thematicControl = Session::read('thematic_control'); |
185 | 185 | |
186 | 186 | if ($action == 'thematic_list') { |
187 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl')); |
|
187 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicControl')); |
|
188 | 188 | } |
189 | 189 | if ($action == 'thematic_add') { |
190 | 190 | $interbreadcrumb[] = array( |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | 'url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, |
199 | 199 | 'name' => get_lang('ThematicControl') |
200 | 200 | ); |
201 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection')); |
|
201 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('EditThematicSection')); |
|
202 | 202 | } |
203 | 203 | if ($action == 'thematic_details') { |
204 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl')); |
|
204 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicControl')); |
|
205 | 205 | } |
206 | 206 | if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') { |
207 | 207 | $interbreadcrumb[] = array( |
@@ -216,22 +216,22 @@ discard block |
||
216 | 216 | } |
217 | 217 | } |
218 | 218 | if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') { |
219 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
220 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')'); |
|
219 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
220 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicPlan').' ('.$thematic_data['title'].')'); |
|
221 | 221 | if ($description_type >= ADD_THEMATIC_PLAN) { |
222 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc')); |
|
222 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewBloc')); |
|
223 | 223 | } else { |
224 | - $interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]); |
|
224 | + $interbreadcrumb[] = array('url' => '#', 'name' => $default_thematic_plan_title[$description_type]); |
|
225 | 225 | } |
226 | 226 | } |
227 | 227 | if ($action == 'thematic_advance_list' || $action == 'thematic_advance_delete') { |
228 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
229 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')'); |
|
228 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
229 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')'); |
|
230 | 230 | } |
231 | 231 | if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { |
232 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
233 | - $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')'); |
|
234 | - $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicAdvance')); |
|
232 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action='.$thematicControl, 'name' => get_lang('ThematicControl')); |
|
233 | + $interbreadcrumb[] = array('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => get_lang('ThematicAdvance').' ('.$thematic_data['title'].')'); |
|
234 | + $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('NewThematicAdvance')); |
|
235 | 235 | } |
236 | 236 | |
237 | 237 | // Distpacher actions to controller |
@@ -14,6 +14,9 @@ discard block |
||
14 | 14 | class Session implements \ArrayAccess |
15 | 15 | { |
16 | 16 | |
17 | + /** |
|
18 | + * @param string $variable |
|
19 | + */ |
|
17 | 20 | static function read($variable, $default = null) |
18 | 21 | { |
19 | 22 | return isset($_SESSION[$variable]) ? $_SESSION[$variable] : $default; |
@@ -39,7 +42,7 @@ discard block |
||
39 | 42 | * Returns true if session has variable set up, false otherwise. |
40 | 43 | * |
41 | 44 | * @param string $variable |
42 | - * @return mixed value |
|
45 | + * @return boolean value |
|
43 | 46 | */ |
44 | 47 | static function has($variable) |
45 | 48 | { |
@@ -253,12 +253,12 @@ discard block |
||
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
256 | - * update user info about certificate |
|
257 | - * @param int $cat_id category id |
|
258 | - * @param int $user_id user id |
|
259 | - * @param string $path_certificate the path name of the certificate |
|
260 | - * @return void |
|
261 | - */ |
|
256 | + * update user info about certificate |
|
257 | + * @param int $cat_id category id |
|
258 | + * @param int $user_id user id |
|
259 | + * @param string $path_certificate the path name of the certificate |
|
260 | + * @return void |
|
261 | + */ |
|
262 | 262 | public function update_user_info_about_certificate( |
263 | 263 | $cat_id, |
264 | 264 | $user_id, |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
421 | - * Shows the student's certificate (HTML file) |
|
422 | - */ |
|
421 | + * Shows the student's certificate (HTML file) |
|
422 | + */ |
|
423 | 423 | public function show() |
424 | 424 | { |
425 | 425 | header('Content-Type: text/html; charset='. api_get_system_encoding()); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | // Creating new name |
205 | 205 | $name = md5($this->user_id.$this->certificate_data['cat_id']).'.html'; |
206 | 206 | $my_path_certificate = $this->certification_user_path.$name; |
207 | - $path_certificate ='/'.$name; |
|
207 | + $path_certificate = '/'.$name; |
|
208 | 208 | |
209 | 209 | //Getting QR filename |
210 | 210 | $file_info = pathinfo($path_certificate); |
@@ -350,11 +350,11 @@ discard block |
||
350 | 350 | $final_content['gradebook_institution'].' - '. |
351 | 351 | $final_content['gradebook_sitename'].' - '. |
352 | 352 | get_lang('Certification').$break_space. |
353 | - get_lang('Student'). ': '.$final_content['user_firstname'].' '.$final_content['user_lastname'].$break_space. |
|
354 | - get_lang('Teacher'). ': '.$final_content['teacher_firstname'].' '.$final_content['teacher_lastname'].$break_space. |
|
355 | - get_lang('Date'). ': '.$final_content['date_certificate'].$break_space. |
|
356 | - get_lang('Score'). ': '.$final_content['gradebook_grade'].$break_space. |
|
357 | - 'URL'. ': '.$final_content['certificate_link']; |
|
353 | + get_lang('Student').': '.$final_content['user_firstname'].' '.$final_content['user_lastname'].$break_space. |
|
354 | + get_lang('Teacher').': '.$final_content['teacher_firstname'].' '.$final_content['teacher_lastname'].$break_space. |
|
355 | + get_lang('Date').': '.$final_content['date_certificate'].$break_space. |
|
356 | + get_lang('Score').': '.$final_content['gradebook_grade'].$break_space. |
|
357 | + 'URL'.': '.$final_content['certificate_link']; |
|
358 | 358 | |
359 | 359 | return $text; |
360 | 360 | } |
@@ -407,7 +407,7 @@ discard block |
||
407 | 407 | return false; |
408 | 408 | } |
409 | 409 | |
410 | - $user_certificate = $this->certification_user_path . basename($this->certificate_data['path_certificate']); |
|
410 | + $user_certificate = $this->certification_user_path.basename($this->certificate_data['path_certificate']); |
|
411 | 411 | |
412 | 412 | if (!file_exists($user_certificate)) { |
413 | 413 | return false; |
@@ -421,9 +421,9 @@ discard block |
||
421 | 421 | */ |
422 | 422 | public function show() |
423 | 423 | { |
424 | - header('Content-Type: text/html; charset='. api_get_system_encoding()); |
|
424 | + header('Content-Type: text/html; charset='.api_get_system_encoding()); |
|
425 | 425 | |
426 | - $user_certificate = $this->certification_user_path . basename($this->certificate_data['path_certificate']); |
|
426 | + $user_certificate = $this->certification_user_path.basename($this->certificate_data['path_certificate']); |
|
427 | 427 | $certificateContent = file_get_contents($user_certificate); |
428 | 428 | |
429 | 429 | $certificate = new DOMDocument(); |
@@ -949,7 +949,6 @@ |
||
949 | 949 | /** |
950 | 950 | * Processes an IMS/QTI manifest file: store links to new files to be able to transform them into questions text |
951 | 951 | * @param string $filePath The absolute filepath |
952 | - * @param array $links List of filepaths changes |
|
953 | 952 | * @return bool |
954 | 953 | */ |
955 | 954 | function qtiProcessManifest($filePath) |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | global $questionTempDir; |
60 | 60 | global $resourcesLinks; |
61 | 61 | |
62 | - $baseWorkDir = api_get_path(SYS_ARCHIVE_PATH) . 'qti2'; |
|
62 | + $baseWorkDir = api_get_path(SYS_ARCHIVE_PATH).'qti2'; |
|
63 | 63 | |
64 | 64 | if (!is_dir($baseWorkDir)) { |
65 | 65 | mkdir($baseWorkDir, api_get_permissions_for_new_directories(), true); |
@@ -103,35 +103,35 @@ discard block |
||
103 | 103 | // The assets-related code is a bit fragile as it has to deal with files renamed by Chamilo and it only works if |
104 | 104 | // the imsmanifest.xml file is read. |
105 | 105 | while (false !== ($file = readdir($exerciseHandle))) { |
106 | - if (is_dir($baseWorkDir . '/' . $file) && $file != "." && $file != "..") { |
|
106 | + if (is_dir($baseWorkDir.'/'.$file) && $file != "." && $file != "..") { |
|
107 | 107 | // Find each manifest for each question repository found |
108 | - $questionHandle = opendir($baseWorkDir . '/' . $file); |
|
108 | + $questionHandle = opendir($baseWorkDir.'/'.$file); |
|
109 | 109 | // Only analyse one level of subdirectory - no recursivity here |
110 | 110 | while (false !== ($questionFile = readdir($questionHandle))) { |
111 | 111 | if (preg_match('/.xml$/i', $questionFile)) { |
112 | - $isQti = isQtiQuestionBank($baseWorkDir . '/' . $file . '/' . $questionFile); |
|
112 | + $isQti = isQtiQuestionBank($baseWorkDir.'/'.$file.'/'.$questionFile); |
|
113 | 113 | if ($isQti) { |
114 | 114 | $result = qti_parse_file($baseWorkDir, $file, $questionFile); |
115 | - $filePath = $baseWorkDir . $file; |
|
115 | + $filePath = $baseWorkDir.$file; |
|
116 | 116 | $file_found = true; |
117 | 117 | } else { |
118 | - $isManifest = isQtiManifest($baseWorkDir . '/' . $file . '/' . $questionFile); |
|
118 | + $isManifest = isQtiManifest($baseWorkDir.'/'.$file.'/'.$questionFile); |
|
119 | 119 | if ($isManifest) { |
120 | - $resourcesLinks = qtiProcessManifest($baseWorkDir . '/' . $file . '/' . $questionFile); |
|
120 | + $resourcesLinks = qtiProcessManifest($baseWorkDir.'/'.$file.'/'.$questionFile); |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
124 | 124 | } |
125 | 125 | } elseif (preg_match('/.xml$/i', $file)) { |
126 | - $isQti = isQtiQuestionBank($baseWorkDir . '/' . $file); |
|
126 | + $isQti = isQtiQuestionBank($baseWorkDir.'/'.$file); |
|
127 | 127 | if ($isQti) { |
128 | 128 | $result = qti_parse_file($baseWorkDir, '', $file); |
129 | - $filePath = $baseWorkDir . '/' . $file; |
|
129 | + $filePath = $baseWorkDir.'/'.$file; |
|
130 | 130 | $file_found = true; |
131 | 131 | } else { |
132 | - $isManifest = isQtiManifest($baseWorkDir . '/' . $file); |
|
132 | + $isManifest = isQtiManifest($baseWorkDir.'/'.$file); |
|
133 | 133 | if ($isManifest) { |
134 | - $resourcesLinks = qtiProcessManifest($baseWorkDir . '/' . $file); |
|
134 | + $resourcesLinks = qtiProcessManifest($baseWorkDir.'/'.$file); |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | $question->type = $question_array['type']; |
166 | 166 | $question->setAnswer(); |
167 | 167 | if (strlen($question_array['title']) < 50) { |
168 | - $question->updateTitle(formatText(strip_tags($question_array['title'])) . '...'); |
|
168 | + $question->updateTitle(formatText(strip_tags($question_array['title'])).'...'); |
|
169 | 169 | } else { |
170 | 170 | $question->updateTitle(formatText(substr(strip_tags($question_array['title']), 0, 50))); |
171 | 171 | $question->updateDescription($question_array['title']); |
@@ -211,7 +211,7 @@ discard block |
||
211 | 211 | } |
212 | 212 | |
213 | 213 | // delete the temp dir where the exercise was unzipped |
214 | - my_delete($baseWorkDir . $uploadPath); |
|
214 | + my_delete($baseWorkDir.$uploadPath); |
|
215 | 215 | return $last_exercise_id; |
216 | 216 | } |
217 | 217 | |
@@ -239,8 +239,8 @@ discard block |
||
239 | 239 | global $record_item_body; |
240 | 240 | global $questionTempDir; |
241 | 241 | |
242 | - $questionTempDir = $exercisePath . '/' . $file . '/'; |
|
243 | - $questionFilePath = $questionTempDir . $questionFile; |
|
242 | + $questionTempDir = $exercisePath.'/'.$file.'/'; |
|
243 | + $questionFilePath = $questionTempDir.$questionFile; |
|
244 | 244 | |
245 | 245 | if (!($fp = fopen($questionFilePath, 'r'))) { |
246 | 246 | Display::addFlash(Display::return_message(get_lang('Error opening question\'s XML file'), 'error')); |
@@ -295,7 +295,7 @@ discard block |
||
295 | 295 | $error = xml_get_error_code(); |
296 | 296 | Display::addFlash( |
297 | 297 | Display::return_message( |
298 | - get_lang('Error reading XML file') . sprintf('[%d:%d]', xml_get_current_line_number($xml_parser), xml_get_current_column_number($xml_parser)), |
|
298 | + get_lang('Error reading XML file').sprintf('[%d:%d]', xml_get_current_line_number($xml_parser), xml_get_current_column_number($xml_parser)), |
|
299 | 299 | 'error' |
300 | 300 | ) |
301 | 301 | ); |
@@ -361,9 +361,9 @@ discard block |
||
361 | 361 | if ($record_item_body) { |
362 | 362 | |
363 | 363 | if ((!in_array($current_element, $non_HTML_tag_to_avoid))) { |
364 | - $current_question_item_body .= "<" . $name; |
|
364 | + $current_question_item_body .= "<".$name; |
|
365 | 365 | foreach ($attributes as $attribute_name => $attribute_value) { |
366 | - $current_question_item_body .= " " . $attribute_name . "=\"" . $attribute_value . "\""; |
|
366 | + $current_question_item_body .= " ".$attribute_name."=\"".$attribute_value."\""; |
|
367 | 367 | } |
368 | 368 | $current_question_item_body .= ">"; |
369 | 369 | } else { |
@@ -371,11 +371,11 @@ discard block |
||
371 | 371 | //we first save with claroline tags ,then when the answer will be parsed, the claroline tags will be replaced |
372 | 372 | |
373 | 373 | if ($current_element == 'INLINECHOICEINTERACTION') { |
374 | - $current_question_item_body .= "**claroline_start**" . $attributes['RESPONSEIDENTIFIER'] . "**claroline_end**"; |
|
374 | + $current_question_item_body .= "**claroline_start**".$attributes['RESPONSEIDENTIFIER']."**claroline_end**"; |
|
375 | 375 | } |
376 | 376 | if ($current_element == 'TEXTENTRYINTERACTION') { |
377 | 377 | $correct_answer_value = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id]; |
378 | - $current_question_item_body .= "[" . $correct_answer_value . "]"; |
|
378 | + $current_question_item_body .= "[".$correct_answer_value."]"; |
|
379 | 379 | |
380 | 380 | } |
381 | 381 | if ($current_element == 'BR') { |
@@ -492,7 +492,7 @@ discard block |
||
492 | 492 | //treat the record of the full content of itembody tag : |
493 | 493 | |
494 | 494 | if ($record_item_body && (!in_array($current_element, $non_HTML_tag_to_avoid))) { |
495 | - $current_question_item_body .= "</" . $name . ">"; |
|
495 | + $current_question_item_body .= "</".$name.">"; |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | switch ($name) { |
@@ -550,14 +550,14 @@ discard block |
||
550 | 550 | if (!isset ($exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'])) { |
551 | 551 | $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] = trim($data); |
552 | 552 | } else { |
553 | - $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] .= '' . trim($data); |
|
553 | + $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['value'] .= ''.trim($data); |
|
554 | 554 | } |
555 | 555 | break; |
556 | 556 | case 'FEEDBACKINLINE': |
557 | 557 | if (!isset ($exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'])) { |
558 | 558 | $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] = trim($data); |
559 | 559 | } else { |
560 | - $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] .= ' ' . trim($data); |
|
560 | + $exercise_info['question'][$current_question_ident]['answer'][$current_answer_id]['feedback'] .= ' '.trim($data); |
|
561 | 561 | } |
562 | 562 | break; |
563 | 563 | case 'SIMPLEASSOCIABLECHOICE': |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | // $resourcesLinks is only defined by qtiProcessManifest() |
578 | 578 | if (isset($resourcesLinks) && isset($resourcesLinks['manifest']) && isset($resourcesLinks['web'])) { |
579 | 579 | foreach ($resourcesLinks['manifest'] as $key => $value) { |
580 | - $data = preg_replace('|' . $value . '|', $resourcesLinks['web'][$key], $data); |
|
580 | + $data = preg_replace('|'.$value.'|', $resourcesLinks['web'][$key], $data); |
|
581 | 581 | } |
582 | 582 | } |
583 | 583 | $current_question_item_body .= $data; |
@@ -587,8 +587,8 @@ discard block |
||
587 | 587 | $answer_identifier = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id]; |
588 | 588 | if ($current_inlinechoice_id == $answer_identifier) { |
589 | 589 | $current_question_item_body = str_replace( |
590 | - "**claroline_start**" . $current_answer_id . "**claroline_end**", |
|
591 | - "[" . $data . "]", |
|
590 | + "**claroline_start**".$current_answer_id."**claroline_end**", |
|
591 | + "[".$data."]", |
|
592 | 592 | $current_question_item_body |
593 | 593 | ); |
594 | 594 | } else { |
@@ -647,9 +647,9 @@ discard block |
||
647 | 647 | if ($record_item_body) { |
648 | 648 | |
649 | 649 | if ((!in_array($current_element, $non_HTML_tag_to_avoid))) { |
650 | - $current_question_item_body .= "<" . $name; |
|
650 | + $current_question_item_body .= "<".$name; |
|
651 | 651 | foreach ($attributes as $attribute_name => $attribute_value) { |
652 | - $current_question_item_body .= " " . $attribute_name . "=\"" . $attribute_value . "\""; |
|
652 | + $current_question_item_body .= " ".$attribute_name."=\"".$attribute_value."\""; |
|
653 | 653 | } |
654 | 654 | $current_question_item_body .= ">"; |
655 | 655 | } else { |
@@ -657,11 +657,11 @@ discard block |
||
657 | 657 | //we first save with claroline tags ,then when the answer will be parsed, the claroline tags will be replaced |
658 | 658 | |
659 | 659 | if ($current_element == 'INLINECHOICEINTERACTION') { |
660 | - $current_question_item_body .= "**claroline_start**" . $attributes['RESPONSEIDENTIFIER'] . "**claroline_end**"; |
|
660 | + $current_question_item_body .= "**claroline_start**".$attributes['RESPONSEIDENTIFIER']."**claroline_end**"; |
|
661 | 661 | } |
662 | 662 | if ($current_element == 'TEXTENTRYINTERACTION') { |
663 | 663 | $correct_answer_value = $exercise_info['question'][$current_question_ident]['correct_answers'][$current_answer_id]; |
664 | - $current_question_item_body .= "[" . $correct_answer_value . "]"; |
|
664 | + $current_question_item_body .= "[".$correct_answer_value."]"; |
|
665 | 665 | |
666 | 666 | } |
667 | 667 | if ($current_element == 'BR') { |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | //treat the record of the full content of itembody tag : |
781 | 781 | |
782 | 782 | if ($record_item_body && (!in_array($current_element, $non_HTML_tag_to_avoid))) { |
783 | - $current_question_item_body .= "</" . $name . ">"; |
|
783 | + $current_question_item_body .= "</".$name.">"; |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | switch ($name) { |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | // $resourcesLinks is only defined by qtiProcessManifest() |
898 | 898 | if (isset($resourcesLinks) && isset($resourcesLinks['manifest']) && isset($resourcesLinks['web'])) { |
899 | 899 | foreach ($resourcesLinks['manifest'] as $key=>$value) { |
900 | - $data = preg_replace('|' . $value . '|', $resourcesLinks['web'][$key], $data); |
|
900 | + $data = preg_replace('|'.$value.'|', $resourcesLinks['web'][$key], $data); |
|
901 | 901 | } |
902 | 902 | } |
903 | 903 | if (!empty($current_question_item_body)) { |
@@ -971,9 +971,9 @@ discard block |
||
971 | 971 | $sessionId = api_get_session_id(); |
972 | 972 | $courseDir = $course['path']; |
973 | 973 | $sysPath = api_get_path(SYS_COURSE_PATH); |
974 | - $exercisesSysPath = $sysPath . $courseDir . '/document/'; |
|
974 | + $exercisesSysPath = $sysPath.$courseDir.'/document/'; |
|
975 | 975 | $webPath = api_get_path(WEB_CODE_PATH); |
976 | - $exercisesWebPath = $webPath . 'document/document.php?' . api_get_cidreq() . '&action=download&id='; |
|
976 | + $exercisesWebPath = $webPath.'document/document.php?'.api_get_cidreq().'&action=download&id='; |
|
977 | 977 | $links = array( |
978 | 978 | 'manifest' => array(), |
979 | 979 | 'system' => array(), |
@@ -981,7 +981,7 @@ discard block |
||
981 | 981 | ); |
982 | 982 | $tableDocuments = Database::get_course_table(TABLE_DOCUMENT); |
983 | 983 | $countResources = count($xml->resources->resource->file); |
984 | - for ($i=0; $i < $countResources; $i++) { |
|
984 | + for ($i = 0; $i < $countResources; $i++) { |
|
985 | 985 | $file = $xml->resources->resource->file[$i]; |
986 | 986 | $href = ''; |
987 | 987 | foreach ($file->attributes() as $key => $value) { |
@@ -993,17 +993,17 @@ discard block |
||
993 | 993 | } |
994 | 994 | if (!empty($href)) { |
995 | 995 | $links['manifest'][] = (string) $href; |
996 | - $links['system'][] = $exercisesSysPath . strtolower($href); |
|
996 | + $links['system'][] = $exercisesSysPath.strtolower($href); |
|
997 | 997 | $specialHref = Database::escape_string(preg_replace('/_/', '-', strtolower($href))); |
998 | 998 | $specialHref = preg_replace('/(-){2,8}/', '-', $specialHref); |
999 | 999 | |
1000 | - $sql = "SELECT iid FROM " . $tableDocuments . " WHERE c_id = " . $course['real_id'] . " AND session_id = $sessionId AND path = '/" . $specialHref . "'"; |
|
1000 | + $sql = "SELECT iid FROM ".$tableDocuments." WHERE c_id = ".$course['real_id']." AND session_id = $sessionId AND path = '/".$specialHref."'"; |
|
1001 | 1001 | $result = Database::query($sql); |
1002 | 1002 | $documentId = 0; |
1003 | 1003 | while ($row = Database::fetch_assoc($result)) { |
1004 | 1004 | $documentId = $row['iid']; |
1005 | 1005 | } |
1006 | - $links['web'][] = $exercisesWebPath . $documentId; |
|
1006 | + $links['web'][] = $exercisesWebPath.$documentId; |
|
1007 | 1007 | } |
1008 | 1008 | } |
1009 | 1009 | return $links; |