@@ -216,7 +216,7 @@ discard block |
||
216 | 216 | |
217 | 217 | foreach ($sub_options as $sub_option) { |
218 | 218 | if (!empty($sub_option)) { |
219 | - $new_params = array( |
|
219 | + $new_params = array( |
|
220 | 220 | 'field_id' => $field_id, |
221 | 221 | 'option_value' => $sub_id, |
222 | 222 | 'display_text' => $sub_option, |
@@ -660,7 +660,7 @@ discard block |
||
660 | 660 | $form->addElement('hidden', 'field_id', $this->field_id); |
661 | 661 | |
662 | 662 | if ($action == 'edit') { |
663 | - $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([ |
|
663 | + $translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([ |
|
664 | 664 | 'extra_field_option' => $id |
665 | 665 | ]); |
666 | 666 | $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link'); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | // Now that there is an association created, move on |
65 | 65 | // to request authentication from the IdP |
66 | 66 | $identity = (!empty($services[0]['delegate'])) ? $services[0]['delegate'] : $claimed_id; |
67 | - if (isset($services[0]['types']) && is_array($services[0]['types']) && in_array(OPENID_NS_2_0 . '/server', $services[0]['types'])) { |
|
67 | + if (isset($services[0]['types']) && is_array($services[0]['types']) && in_array(OPENID_NS_2_0.'/server', $services[0]['types'])) { |
|
68 | 68 | $identity = 'http://openid.net/identifier_select/2.0'; |
69 | 69 | } |
70 | 70 | $authn_request = openid_authentication_request($claimed_id, $identity, $return_to, $assoc_handle, $services[0]['version']); |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | $xrds_url = $claimed_id; |
121 | 121 | if (_openid_is_xri($claimed_id)) { |
122 | - $xrds_url = 'http://xri.net/' . $claimed_id; |
|
122 | + $xrds_url = 'http://xri.net/'.$claimed_id; |
|
123 | 123 | } |
124 | 124 | $url = @parse_url($xrds_url); |
125 | 125 | if ($url['scheme'] == 'http' || $url['scheme'] == 'https') { |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | //@todo Remove Old Associations: |
183 | 183 | $openid_association = Database::get_main_table(TABLE_MAIN_OPENID_ASSOCIATION); |
184 | 184 | $sql = "DELETE FROM $openid_association |
185 | - WHERE created + expires_in < '" . api_get_utc_datetime() . "'"; |
|
185 | + WHERE created + expires_in < '".api_get_utc_datetime()."'"; |
|
186 | 186 | Database::query($sql); |
187 | 187 | |
188 | 188 | // Check to see if we have an association for this IdP already |
@@ -339,17 +339,17 @@ discard block |
||
339 | 339 | switch ($uri['scheme']) { |
340 | 340 | case 'http': |
341 | 341 | $port = isset($uri['port']) ? $uri['port'] : 80; |
342 | - $host = $uri['host'] . ($port != 80 ? ':' . $port : ''); |
|
342 | + $host = $uri['host'].($port != 80 ? ':'.$port : ''); |
|
343 | 343 | $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15); |
344 | 344 | break; |
345 | 345 | case 'https': |
346 | 346 | // Note: Only works for PHP 4.3 compiled with OpenSSL. |
347 | 347 | $port = isset($uri['port']) ? $uri['port'] : 443; |
348 | - $host = $uri['host'] . ($port != 443 ? ':' . $port : ''); |
|
349 | - $fp = @fsockopen('ssl://' . $uri['host'], $port, $errno, $errstr, 20); |
|
348 | + $host = $uri['host'].($port != 443 ? ':'.$port : ''); |
|
349 | + $fp = @fsockopen('ssl://'.$uri['host'], $port, $errno, $errstr, 20); |
|
350 | 350 | break; |
351 | 351 | default: |
352 | - $result->error = 'invalid schema ' . $uri['scheme']; |
|
352 | + $result->error = 'invalid schema '.$uri['scheme']; |
|
353 | 353 | return $result; |
354 | 354 | } |
355 | 355 | |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | // Construct the path to act on. |
366 | 366 | $path = isset($uri['path']) ? $uri['path'] : '/'; |
367 | 367 | if (isset($uri['query'])) { |
368 | - $path .= '?' . $uri['query']; |
|
368 | + $path .= '?'.$uri['query']; |
|
369 | 369 | } |
370 | 370 | |
371 | 371 | // Create HTTP request. |
@@ -375,23 +375,23 @@ discard block |
||
375 | 375 | // host that do not take into account the port number. |
376 | 376 | 'Host' => "Host: $host", |
377 | 377 | 'User-Agent' => 'User-Agent: Chamilo (+http://www.chamilo.org/)', |
378 | - 'Content-Length' => 'Content-Length: ' . strlen($data) |
|
378 | + 'Content-Length' => 'Content-Length: '.strlen($data) |
|
379 | 379 | ); |
380 | 380 | |
381 | 381 | // If the server url has a user then attempt to use basic authentication |
382 | 382 | if (isset($uri['user'])) { |
383 | - $defaults['Authorization'] = 'Authorization: Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : '')); |
|
383 | + $defaults['Authorization'] = 'Authorization: Basic '.base64_encode($uri['user'].(!empty($uri['pass']) ? ":".$uri['pass'] : '')); |
|
384 | 384 | } |
385 | 385 | |
386 | 386 | foreach ($headers as $header => $value) { |
387 | - $defaults[$header] = $header . ': ' . $value; |
|
387 | + $defaults[$header] = $header.': '.$value; |
|
388 | 388 | } |
389 | 389 | |
390 | - $request = $method . ' ' . $path . " HTTP/1.0\r\n"; |
|
390 | + $request = $method.' '.$path." HTTP/1.0\r\n"; |
|
391 | 391 | $request .= implode("\r\n", $defaults); |
392 | 392 | $request .= "\r\n\r\n"; |
393 | 393 | if ($data) { |
394 | - $request .= $data . "\r\n"; |
|
394 | + $request .= $data."\r\n"; |
|
395 | 395 | } |
396 | 396 | $result->request = $request; |
397 | 397 | |
@@ -417,7 +417,7 @@ discard block |
||
417 | 417 | if (isset($result->headers[$header]) && $header == 'Set-Cookie') { |
418 | 418 | // RFC 2109: the Set-Cookie response header comprises the token Set- |
419 | 419 | // Cookie:, followed by a comma-separated list of one or more cookies. |
420 | - $result->headers[$header] .= ',' . trim($value); |
|
420 | + $result->headers[$header] .= ','.trim($value); |
|
421 | 421 | } else { |
422 | 422 | $result->headers[$header] = trim($value); |
423 | 423 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | */ |
20 | 20 | protected function deleteCourseHelper($course_id_field_name, $course_id_value) { |
21 | 21 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
22 | - if($course_id instanceof WSCMError) { |
|
22 | + if ($course_id instanceof WSCMError) { |
|
23 | 23 | return $course_id; |
24 | 24 | } else { |
25 | 25 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -37,11 +37,11 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function DeleteCourse($secret_key, $course_id_field_name, $course_id_value) { |
39 | 39 | $verifKey = $this->verifyKey($secret_key); |
40 | - if($verifKey instanceof WSError) { |
|
40 | + if ($verifKey instanceof WSError) { |
|
41 | 41 | $this->handleError($verifKey); |
42 | 42 | } else { |
43 | 43 | $result = $this->deleteCourseHelper($course_id_field_name, $course_id_value); |
44 | - if($result instanceof WSError) { |
|
44 | + if ($result instanceof WSError) { |
|
45 | 45 | $this->handleError($result); |
46 | 46 | } |
47 | 47 | } |
@@ -57,15 +57,15 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function DeleteCourses($secret_key, $courses) { |
59 | 59 | $verifKey = $this->verifyKey($secret_key); |
60 | - if($verifKey instanceof WSError) { |
|
60 | + if ($verifKey instanceof WSError) { |
|
61 | 61 | $this->handleError($verifKey); |
62 | 62 | } else { |
63 | 63 | $results = array(); |
64 | - foreach($courses as $course) { |
|
64 | + foreach ($courses as $course) { |
|
65 | 65 | $result_tmp = array(); |
66 | 66 | $result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']); |
67 | 67 | $result_tmp['course_id_value'] = $course['course_id_value']; |
68 | - if($result_op instanceof WSCMError) { |
|
68 | + if ($result_op instanceof WSCMError) { |
|
69 | 69 | // Return the error in the results |
70 | 70 | $result_tmp['result'] = $result_op->toArray(); |
71 | 71 | } else { |
@@ -95,17 +95,17 @@ discard block |
||
95 | 95 | protected function createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) { |
96 | 96 | // Add the original course id field name and value to the extra fields if needed |
97 | 97 | $extras_associative = array(); |
98 | - if($course_id_field_name != "chamilo_course_id") { |
|
98 | + if ($course_id_field_name != "chamilo_course_id") { |
|
99 | 99 | $extras_associative[$course_id_field_name] = $course_id_value; |
100 | 100 | } |
101 | - foreach($extras as $extra) { |
|
101 | + foreach ($extras as $extra) { |
|
102 | 102 | $extras_associative[$extra['field_name']] = $extra['field_value']; |
103 | 103 | } |
104 | 104 | $course_admin_id = $this->getUserId($course_admin_user_id_field_name, $course_admin_user_id_value); |
105 | - if($course_admin_id instanceof WSError) { |
|
105 | + if ($course_admin_id instanceof WSError) { |
|
106 | 106 | return $course_admin_id; |
107 | 107 | } |
108 | - if($wanted_code == '') { |
|
108 | + if ($wanted_code == '') { |
|
109 | 109 | $wanted_code = CourseManager::generate_course_code($title); |
110 | 110 | } |
111 | 111 | $result = create_course($wanted_code, $title, $tutor_name, $category_code, $language, $course_admin_id, $this->_configuration['db_prefix'], 0); |
@@ -113,7 +113,7 @@ discard block |
||
113 | 113 | return new WSError(202, 'There was an error creating the course'); |
114 | 114 | } else { |
115 | 115 | // Update extra fields |
116 | - foreach($extras_associative as $fname => $fvalue) { |
|
116 | + foreach ($extras_associative as $fname => $fvalue) { |
|
117 | 117 | CourseManager::update_course_extra_field_value($result, $fname, $fvalue); |
118 | 118 | } |
119 | 119 | // Get course id |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | public function CreateCourse($secret_key, $title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) { |
142 | 142 | // First, verify the secret key |
143 | 143 | $verifKey = $this->verifyKey($secret_key); |
144 | - if($verifKey instanceof WSError) { |
|
144 | + if ($verifKey instanceof WSError) { |
|
145 | 145 | $this->handleError($verifKey); |
146 | 146 | } else { |
147 | 147 | $result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras); |
148 | - if($result instanceof WSError) { |
|
148 | + if ($result instanceof WSError) { |
|
149 | 149 | $this->handleError($result); |
150 | 150 | } else { |
151 | 151 | return $result; |
@@ -163,17 +163,17 @@ discard block |
||
163 | 163 | public function CreateCourses($secret_key, $courses) { |
164 | 164 | // First, verify the secret key |
165 | 165 | $verifKey = $this->verifyKey($secret_key); |
166 | - if($verifKey instanceof WSCMError) { |
|
166 | + if ($verifKey instanceof WSCMError) { |
|
167 | 167 | $this->handleError($verifKey); |
168 | 168 | } else { |
169 | 169 | $results = array(); |
170 | - foreach($courses as $course) { |
|
170 | + foreach ($courses as $course) { |
|
171 | 171 | $result_tmp = array(); |
172 | 172 | //reinitialize variables just in case |
173 | 173 | $title = $category_code = $wanted_code = $tutor_name = $course_admin_user_id_field_name = $course_admin_user_id_value = $language = $course_id_field_name = $course_id_value = $extras = null; |
174 | 174 | extract($course); |
175 | 175 | $result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras); |
176 | - if($result instanceof WSCMError) { |
|
176 | + if ($result instanceof WSCMError) { |
|
177 | 177 | $result_tmp['result'] = $result->toArray(); |
178 | 178 | $result_tmp['course_id_value'] = $course_id_value; |
179 | 179 | $result_tmp['course_id_generated'] = 0; |
@@ -207,47 +207,47 @@ discard block |
||
207 | 207 | */ |
208 | 208 | protected function editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) { |
209 | 209 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
210 | - if($course_id instanceof WSCMError) { |
|
210 | + if ($course_id instanceof WSCMError) { |
|
211 | 211 | return $course_id; |
212 | 212 | } else { |
213 | 213 | $attributes = array(); |
214 | - if(!empty($title)) { |
|
214 | + if (!empty($title)) { |
|
215 | 215 | $attributes['title'] = $title; |
216 | 216 | } |
217 | - if(!empty($category_code)) { |
|
217 | + if (!empty($category_code)) { |
|
218 | 218 | $attributes['category_code'] = $category_code; |
219 | 219 | } |
220 | - if(!empty($department_name)) { |
|
220 | + if (!empty($department_name)) { |
|
221 | 221 | $attributes['department_name'] = $department_name; |
222 | 222 | } |
223 | - if(!empty($department_url)) { |
|
223 | + if (!empty($department_url)) { |
|
224 | 224 | $attributes['department_url'] = $department_url; |
225 | 225 | } |
226 | - if(!empty($language)) { |
|
226 | + if (!empty($language)) { |
|
227 | 227 | $attributes['course_language'] = $language; |
228 | 228 | } |
229 | - if($visibility != '') { |
|
230 | - $attributes['visibility'] = (int)$visibility; |
|
229 | + if ($visibility != '') { |
|
230 | + $attributes['visibility'] = (int) $visibility; |
|
231 | 231 | } |
232 | - if($subscribe != '') { |
|
233 | - $attributes['subscribe'] = (int)$subscribe; |
|
232 | + if ($subscribe != '') { |
|
233 | + $attributes['subscribe'] = (int) $subscribe; |
|
234 | 234 | } |
235 | - if($unsubscribe != '') { |
|
236 | - $attributes['unsubscribe'] = (int)$unsubscribe; |
|
235 | + if ($unsubscribe != '') { |
|
236 | + $attributes['unsubscribe'] = (int) $unsubscribe; |
|
237 | 237 | } |
238 | - if(!empty($visual_code)) { |
|
238 | + if (!empty($visual_code)) { |
|
239 | 239 | $attributes['visual_code'] = $visual_code; |
240 | 240 | } |
241 | - if(!empty($attributes)) { |
|
241 | + if (!empty($attributes)) { |
|
242 | 242 | CourseManager::update_attributes($course_id, $attributes); |
243 | 243 | } |
244 | - if(!empty($extras)) { |
|
244 | + if (!empty($extras)) { |
|
245 | 245 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
246 | 246 | $extras_associative = array(); |
247 | - foreach($extras as $extra) { |
|
247 | + foreach ($extras as $extra) { |
|
248 | 248 | $extras_associative[$extra['field_name']] = $extra['field_value']; |
249 | 249 | } |
250 | - foreach($extras_associative as $fname => $fvalue) { |
|
250 | + foreach ($extras_associative as $fname => $fvalue) { |
|
251 | 251 | CourseManager::update_extra_field_value($course_code, $fname, $fvalue); |
252 | 252 | } |
253 | 253 | } |
@@ -274,11 +274,11 @@ discard block |
||
274 | 274 | */ |
275 | 275 | public function EditCourse($secret_key, $course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) { |
276 | 276 | $verifKey = $this->verifyKey($secret_key); |
277 | - if($verifKey instanceof WSCMError) { |
|
277 | + if ($verifKey instanceof WSCMError) { |
|
278 | 278 | $this->handleError($verifKey); |
279 | 279 | } else { |
280 | 280 | $result = $this->editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras); |
281 | - if($result instanceof WSCMError) { |
|
281 | + if ($result instanceof WSCMError) { |
|
282 | 282 | $this->handleError($result); |
283 | 283 | } |
284 | 284 | } |
@@ -294,14 +294,14 @@ discard block |
||
294 | 294 | */ |
295 | 295 | public function ListCourses($secret_key, $course_id_field_name) { |
296 | 296 | $verifKey = $this->verifyKey($secret_key); |
297 | - if($verifKey instanceof WSError) { |
|
297 | + if ($verifKey instanceof WSError) { |
|
298 | 298 | $this->handleError($verifKey); |
299 | 299 | } else { |
300 | 300 | $courses_result = array(); |
301 | 301 | $category_names = array(); |
302 | 302 | |
303 | 303 | $courses = CourseManager::get_courses_list(); |
304 | - foreach($courses as $course) { |
|
304 | + foreach ($courses as $course) { |
|
305 | 305 | $course_tmp = array(); |
306 | 306 | $course_tmp['id'] = $course['id']; |
307 | 307 | $course_tmp['code'] = $course['code']; |
@@ -310,7 +310,7 @@ discard block |
||
310 | 310 | $course_tmp['visibility'] = $course['visibility']; |
311 | 311 | |
312 | 312 | // Determining category name |
313 | - if($category_names[$course['category_code']]) { |
|
313 | + if ($category_names[$course['category_code']]) { |
|
314 | 314 | $course_tmp['category_name'] = $category_names[$course['category_code']]; |
315 | 315 | } else { |
316 | 316 | $category = CourseManager::get_course_category($course['category_code']); |
@@ -346,21 +346,21 @@ discard block |
||
346 | 346 | */ |
347 | 347 | protected function changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $state, $status = STUDENT) { |
348 | 348 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
349 | - if($course_id instanceof WSError) { |
|
349 | + if ($course_id instanceof WSError) { |
|
350 | 350 | return $course_id; |
351 | 351 | } else { |
352 | 352 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
353 | - if($user_id instanceof WSError) { |
|
353 | + if ($user_id instanceof WSError) { |
|
354 | 354 | return $user_id; |
355 | 355 | } else { |
356 | 356 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
357 | - if($state == 0) { |
|
357 | + if ($state == 0) { |
|
358 | 358 | // Unsubscribe user |
359 | 359 | CourseManager::unsubscribe_user($user_id, $course_code); |
360 | 360 | return true; |
361 | 361 | } else { |
362 | 362 | // Subscribe user |
363 | - if(CourseManager::subscribe_user($user_id, $course_code, $status)) { |
|
363 | + if (CourseManager::subscribe_user($user_id, $course_code, $status)) { |
|
364 | 364 | return true; |
365 | 365 | } else { |
366 | 366 | return new WSError(203, 'An error occured subscribing to this course'); |
@@ -382,11 +382,11 @@ discard block |
||
382 | 382 | */ |
383 | 383 | public function SubscribeUserToCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $status) { |
384 | 384 | $verifKey = $this->verifyKey($secret_key); |
385 | - if($verifKey instanceof WSError) { |
|
385 | + if ($verifKey instanceof WSError) { |
|
386 | 386 | $this->handleError($verifKey); |
387 | 387 | } else { |
388 | 388 | $result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 1, $status); |
389 | - if($result instanceof WSError) { |
|
389 | + if ($result instanceof WSError) { |
|
390 | 390 | $this->handleError($result); |
391 | 391 | } |
392 | 392 | } |
@@ -403,11 +403,11 @@ discard block |
||
403 | 403 | */ |
404 | 404 | public function UnsubscribeUserFromCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value) { |
405 | 405 | $verifKey = $this->verifyKey($secret_key); |
406 | - if($verifKey instanceof WSError) { |
|
406 | + if ($verifKey instanceof WSError) { |
|
407 | 407 | $this->handleError($verifKey); |
408 | 408 | } else { |
409 | 409 | $result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 0); |
410 | - if($result instanceof WSError) { |
|
410 | + if ($result instanceof WSError) { |
|
411 | 411 | $this->handleError($result); |
412 | 412 | } |
413 | 413 | } |
@@ -423,17 +423,17 @@ discard block |
||
423 | 423 | */ |
424 | 424 | public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) { |
425 | 425 | $verifKey = $this->verifyKey($secret_key); |
426 | - if($verifKey instanceof WSError) { |
|
426 | + if ($verifKey instanceof WSError) { |
|
427 | 427 | $this->handleError($verifKey); |
428 | 428 | } else { |
429 | 429 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
430 | - if($course_id instanceof WSError) { |
|
430 | + if ($course_id instanceof WSError) { |
|
431 | 431 | return $course_id; |
432 | 432 | } else { |
433 | 433 | // Course exists, get its descriptions |
434 | 434 | $descriptions = CourseDescription::get_descriptions($course_id); |
435 | 435 | $results = array(); |
436 | - foreach($descriptions as $description) { |
|
436 | + foreach ($descriptions as $description) { |
|
437 | 437 | $results[] = array('course_desc_id' => $description->get_description_type(), |
438 | 438 | 'course_desc_title' => $description->get_title(), |
439 | 439 | 'course_desc_content' => $description->get_content()); |
@@ -456,11 +456,11 @@ discard block |
||
456 | 456 | */ |
457 | 457 | public function EditCourseDescription($secret_key, $course_id_field_name, $course_id_value, $course_desc_id, $course_desc_title, $course_desc_content) { |
458 | 458 | $verifKey = $this->verifyKey($secret_key); |
459 | - if($verifKey instanceof WSError) { |
|
459 | + if ($verifKey instanceof WSError) { |
|
460 | 460 | $this->handleError($verifKey); |
461 | 461 | } else { |
462 | 462 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
463 | - if($course_id instanceof WSError) { |
|
463 | + if ($course_id instanceof WSError) { |
|
464 | 464 | return $course_id; |
465 | 465 | } else { |
466 | 466 | // Create the new course description |
@@ -477,8 +477,8 @@ discard block |
||
477 | 477 | // Check if this course description exists |
478 | 478 | $descriptions = CourseDescription::get_descriptions($course_id); |
479 | 479 | $exists = false; |
480 | - foreach($descriptions as $description) { |
|
481 | - if($description->get_description_type() == $course_desc_id) { |
|
480 | + foreach ($descriptions as $description) { |
|
481 | + if ($description->get_description_type() == $course_desc_id) { |
|
482 | 482 | $exists = true; |
483 | 483 | } |
484 | 484 | } |
@@ -494,7 +494,7 @@ discard block |
||
494 | 494 | } |
495 | 495 | public function unreadMessage($username, $password) |
496 | 496 | { |
497 | - if($this->verifyUserPass($username, $password) == "valid") |
|
497 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
498 | 498 | { |
499 | 499 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
500 | 500 | $user_id = UserManager::get_user_id_from_username($username); |
@@ -511,7 +511,7 @@ discard block |
||
511 | 511 | |
512 | 512 | public function get_message_data($username, $password) |
513 | 513 | { |
514 | - if($this->verifyUserPass($username, $password) == "valid") |
|
514 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
515 | 515 | { |
516 | 516 | $user_id = get_user_id_from_username($username); |
517 | 517 | |
@@ -521,7 +521,7 @@ discard block |
||
521 | 521 | |
522 | 522 | public function nada($username, $password) |
523 | 523 | { |
524 | - if($this->verifyUserPass($username, $password) == "valid") |
|
524 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
525 | 525 | return $username.$password; |
526 | 526 | return $username; |
527 | 527 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | */ |
22 | 22 | protected function deleteCourseHelper($course_id_field_name, $course_id_value) { |
23 | 23 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
24 | - if($course_id instanceof WSError) { |
|
24 | + if ($course_id instanceof WSError) { |
|
25 | 25 | return $course_id; |
26 | 26 | } else { |
27 | 27 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -39,11 +39,11 @@ discard block |
||
39 | 39 | */ |
40 | 40 | public function DeleteCourse($secret_key, $course_id_field_name, $course_id_value) { |
41 | 41 | $verifKey = $this->verifyKey($secret_key); |
42 | - if($verifKey instanceof WSError) { |
|
42 | + if ($verifKey instanceof WSError) { |
|
43 | 43 | $this->handleError($verifKey); |
44 | 44 | } else { |
45 | 45 | $result = $this->deleteCourseHelper($course_id_field_name, $course_id_value); |
46 | - if($result instanceof WSError) { |
|
46 | + if ($result instanceof WSError) { |
|
47 | 47 | $this->handleError($result); |
48 | 48 | } |
49 | 49 | } |
@@ -59,15 +59,15 @@ discard block |
||
59 | 59 | */ |
60 | 60 | public function DeleteCourses($secret_key, $courses) { |
61 | 61 | $verifKey = $this->verifyKey($secret_key); |
62 | - if($verifKey instanceof WSError) { |
|
62 | + if ($verifKey instanceof WSError) { |
|
63 | 63 | $this->handleError($verifKey); |
64 | 64 | } else { |
65 | 65 | $results = array(); |
66 | - foreach($courses as $course) { |
|
66 | + foreach ($courses as $course) { |
|
67 | 67 | $result_tmp = array(); |
68 | 68 | $result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']); |
69 | 69 | $result_tmp['course_id_value'] = $course['course_id_value']; |
70 | - if($result_op instanceof WSError) { |
|
70 | + if ($result_op instanceof WSError) { |
|
71 | 71 | // Return the error in the results |
72 | 72 | $result_tmp['result'] = $result_op->toArray(); |
73 | 73 | } else { |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | protected function createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) { |
98 | 98 | // Add the original course id field name and value to the extra fields if needed |
99 | 99 | $extras_associative = array(); |
100 | - if($course_id_field_name != "chamilo_course_id") { |
|
100 | + if ($course_id_field_name != "chamilo_course_id") { |
|
101 | 101 | $extras_associative[$course_id_field_name] = $course_id_value; |
102 | 102 | } |
103 | - foreach($extras as $extra) { |
|
103 | + foreach ($extras as $extra) { |
|
104 | 104 | $extras_associative[$extra['field_name']] = $extra['field_value']; |
105 | 105 | } |
106 | 106 | $course_admin_id = $this->getUserId($course_admin_user_id_field_name, $course_admin_user_id_value); |
107 | - if($course_admin_id instanceof WSError) { |
|
107 | + if ($course_admin_id instanceof WSError) { |
|
108 | 108 | return $course_admin_id; |
109 | 109 | } |
110 | - if($wanted_code == '') { |
|
110 | + if ($wanted_code == '') { |
|
111 | 111 | $wanted_code = CourseManager::generate_course_code($title); |
112 | 112 | } |
113 | 113 | $result = create_course($wanted_code, $title, $tutor_name, $category_code, $language, $course_admin_id, $this->_configuration['db_prefix'], 0); |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | return new WSError(202, 'There was an error creating the course'); |
116 | 116 | } else { |
117 | 117 | // Update extra fields |
118 | - foreach($extras_associative as $fname => $fvalue) { |
|
118 | + foreach ($extras_associative as $fname => $fvalue) { |
|
119 | 119 | CourseManager::update_course_extra_field_value($result, $fname, $fvalue); |
120 | 120 | } |
121 | 121 | // Get course id |
@@ -143,11 +143,11 @@ discard block |
||
143 | 143 | public function CreateCourse($secret_key, $title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) { |
144 | 144 | // First, verify the secret key |
145 | 145 | $verifKey = $this->verifyKey($secret_key); |
146 | - if($verifKey instanceof WSError) { |
|
146 | + if ($verifKey instanceof WSError) { |
|
147 | 147 | $this->handleError($verifKey); |
148 | 148 | } else { |
149 | 149 | $result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras); |
150 | - if($result instanceof WSError) { |
|
150 | + if ($result instanceof WSError) { |
|
151 | 151 | $this->handleError($result); |
152 | 152 | } else { |
153 | 153 | return $result; |
@@ -165,17 +165,17 @@ discard block |
||
165 | 165 | public function CreateCourses($secret_key, $courses) { |
166 | 166 | // First, verify the secret key |
167 | 167 | $verifKey = $this->verifyKey($secret_key); |
168 | - if($verifKey instanceof WSError) { |
|
168 | + if ($verifKey instanceof WSError) { |
|
169 | 169 | $this->handleError($verifKey); |
170 | 170 | } else { |
171 | 171 | $results = array(); |
172 | - foreach($courses as $course) { |
|
172 | + foreach ($courses as $course) { |
|
173 | 173 | $result_tmp = array(); |
174 | 174 | // re-initialize variables just in case |
175 | 175 | $title = $category_code = $wanted_code = $tutor_name = $course_admin_user_id_field_name = $course_admin_user_id_value = $language = $course_id_field_name = $course_id_value = $extras = 0; |
176 | 176 | extract($course); |
177 | 177 | $result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras); |
178 | - if($result instanceof WSError) { |
|
178 | + if ($result instanceof WSError) { |
|
179 | 179 | $result_tmp['result'] = $result->toArray(); |
180 | 180 | $result_tmp['course_id_value'] = $course_id_value; |
181 | 181 | $result_tmp['course_id_generated'] = 0; |
@@ -209,47 +209,47 @@ discard block |
||
209 | 209 | */ |
210 | 210 | protected function editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) { |
211 | 211 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
212 | - if($course_id instanceof WSError) { |
|
212 | + if ($course_id instanceof WSError) { |
|
213 | 213 | return $course_id; |
214 | 214 | } else { |
215 | 215 | $attributes = array(); |
216 | - if(!empty($title)) { |
|
216 | + if (!empty($title)) { |
|
217 | 217 | $attributes['title'] = $title; |
218 | 218 | } |
219 | - if(!empty($category_code)) { |
|
219 | + if (!empty($category_code)) { |
|
220 | 220 | $attributes['category_code'] = $category_code; |
221 | 221 | } |
222 | - if(!empty($department_name)) { |
|
222 | + if (!empty($department_name)) { |
|
223 | 223 | $attributes['department_name'] = $department_name; |
224 | 224 | } |
225 | - if(!empty($department_url)) { |
|
225 | + if (!empty($department_url)) { |
|
226 | 226 | $attributes['department_url'] = $department_url; |
227 | 227 | } |
228 | - if(!empty($language)) { |
|
228 | + if (!empty($language)) { |
|
229 | 229 | $attributes['course_language'] = $language; |
230 | 230 | } |
231 | - if($visibility != '') { |
|
232 | - $attributes['visibility'] = (int)$visibility; |
|
231 | + if ($visibility != '') { |
|
232 | + $attributes['visibility'] = (int) $visibility; |
|
233 | 233 | } |
234 | - if($subscribe != '') { |
|
235 | - $attributes['subscribe'] = (int)$subscribe; |
|
234 | + if ($subscribe != '') { |
|
235 | + $attributes['subscribe'] = (int) $subscribe; |
|
236 | 236 | } |
237 | - if($unsubscribe != '') { |
|
238 | - $attributes['unsubscribe'] = (int)$unsubscribe; |
|
237 | + if ($unsubscribe != '') { |
|
238 | + $attributes['unsubscribe'] = (int) $unsubscribe; |
|
239 | 239 | } |
240 | - if(!empty($visual_code)) { |
|
240 | + if (!empty($visual_code)) { |
|
241 | 241 | $attributes['visual_code'] = $visual_code; |
242 | 242 | } |
243 | - if(!empty($attributes)) { |
|
243 | + if (!empty($attributes)) { |
|
244 | 244 | CourseManager::update_attributes($course_id, $attributes); |
245 | 245 | } |
246 | - if(!empty($extras)) { |
|
246 | + if (!empty($extras)) { |
|
247 | 247 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
248 | 248 | $extras_associative = array(); |
249 | - foreach($extras as $extra) { |
|
249 | + foreach ($extras as $extra) { |
|
250 | 250 | $extras_associative[$extra['field_name']] = $extra['field_value']; |
251 | 251 | } |
252 | - foreach($extras_associative as $fname => $fvalue) { |
|
252 | + foreach ($extras_associative as $fname => $fvalue) { |
|
253 | 253 | CourseManager::update_extra_field_value($course_code, $fname, $fvalue); |
254 | 254 | } |
255 | 255 | } |
@@ -276,11 +276,11 @@ discard block |
||
276 | 276 | */ |
277 | 277 | public function EditCourse($secret_key, $course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) { |
278 | 278 | $verifKey = $this->verifyKey($secret_key); |
279 | - if($verifKey instanceof WSError) { |
|
279 | + if ($verifKey instanceof WSError) { |
|
280 | 280 | $this->handleError($verifKey); |
281 | 281 | } else { |
282 | 282 | $result = $this->editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras); |
283 | - if($result instanceof WSError) { |
|
283 | + if ($result instanceof WSError) { |
|
284 | 284 | $this->handleError($result); |
285 | 285 | } |
286 | 286 | } |
@@ -296,10 +296,10 @@ discard block |
||
296 | 296 | */ |
297 | 297 | public function ListCourses($secret_key, $visibility = 'public,public-registered,private,closed') { |
298 | 298 | $verifKey = $this->verifyKey($secret_key); |
299 | - if($verifKey instanceof WSError) { |
|
299 | + if ($verifKey instanceof WSError) { |
|
300 | 300 | $this->handleError($verifKey); |
301 | 301 | } else { |
302 | - $visibilities = split(',',$visibility); |
|
302 | + $visibilities = split(',', $visibility); |
|
303 | 303 | $vis = array('public' => '3', 'public-registered' => '2', 'private' => '1', 'closed' => '0'); |
304 | 304 | foreach ($visibilities as $p => $visibility) { |
305 | 305 | $visibilities[$p] = $vis[$visibility]; |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | $category_names = array(); |
309 | 309 | |
310 | 310 | $courses = CourseManager::get_courses_list(); |
311 | - foreach($courses as $course) { |
|
311 | + foreach ($courses as $course) { |
|
312 | 312 | //skip elements that do not match required visibility |
313 | - if (!in_array($course['visibility'],$visibilities)) { continue; } |
|
313 | + if (!in_array($course['visibility'], $visibilities)) { continue; } |
|
314 | 314 | $course_tmp = array(); |
315 | 315 | $course_tmp['id'] = $course['id']; |
316 | 316 | $course_tmp['code'] = $course['code']; |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $course_tmp['visibility'] = $course['visibility']; |
320 | 320 | |
321 | 321 | // Determining category name |
322 | - if($category_names[$course['category_code']]) { |
|
322 | + if ($category_names[$course['category_code']]) { |
|
323 | 323 | $course_tmp['category_name'] = $category_names[$course['category_code']]; |
324 | 324 | } else { |
325 | 325 | $category = CourseManager::get_course_category($course['category_code']); |
@@ -355,21 +355,21 @@ discard block |
||
355 | 355 | */ |
356 | 356 | protected function changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $state, $status = STUDENT) { |
357 | 357 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
358 | - if($course_id instanceof WSError) { |
|
358 | + if ($course_id instanceof WSError) { |
|
359 | 359 | return $course_id; |
360 | 360 | } else { |
361 | 361 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
362 | - if($user_id instanceof WSError) { |
|
362 | + if ($user_id instanceof WSError) { |
|
363 | 363 | return $user_id; |
364 | 364 | } else { |
365 | 365 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
366 | - if($state == 0) { |
|
366 | + if ($state == 0) { |
|
367 | 367 | // Unsubscribe user |
368 | 368 | CourseManager::unsubscribe_user($user_id, $course_code); |
369 | 369 | return true; |
370 | 370 | } else { |
371 | 371 | // Subscribe user |
372 | - if(CourseManager::subscribe_user($user_id, $course_code, $status)) { |
|
372 | + if (CourseManager::subscribe_user($user_id, $course_code, $status)) { |
|
373 | 373 | return true; |
374 | 374 | } else { |
375 | 375 | return new WSError(203, 'An error occured subscribing to this course'); |
@@ -391,11 +391,11 @@ discard block |
||
391 | 391 | */ |
392 | 392 | public function SubscribeUserToCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $status) { |
393 | 393 | $verifKey = $this->verifyKey($secret_key); |
394 | - if($verifKey instanceof WSError) { |
|
394 | + if ($verifKey instanceof WSError) { |
|
395 | 395 | $this->handleError($verifKey); |
396 | 396 | } else { |
397 | 397 | $result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 1, $status); |
398 | - if($result instanceof WSError) { |
|
398 | + if ($result instanceof WSError) { |
|
399 | 399 | $this->handleError($result); |
400 | 400 | } |
401 | 401 | } |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | */ |
413 | 413 | public function UnsubscribeUserFromCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value) { |
414 | 414 | $verifKey = $this->verifyKey($secret_key); |
415 | - if($verifKey instanceof WSError) { |
|
415 | + if ($verifKey instanceof WSError) { |
|
416 | 416 | $this->handleError($verifKey); |
417 | 417 | } else { |
418 | 418 | $result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 0); |
419 | - if($result instanceof WSError) { |
|
419 | + if ($result instanceof WSError) { |
|
420 | 420 | $this->handleError($result); |
421 | 421 | } |
422 | 422 | } |
@@ -432,17 +432,17 @@ discard block |
||
432 | 432 | */ |
433 | 433 | public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) { |
434 | 434 | $verifKey = $this->verifyKey($secret_key); |
435 | - if($verifKey instanceof WSError) { |
|
435 | + if ($verifKey instanceof WSError) { |
|
436 | 436 | $this->handleError($verifKey); |
437 | 437 | } else { |
438 | 438 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
439 | - if($course_id instanceof WSError) { |
|
439 | + if ($course_id instanceof WSError) { |
|
440 | 440 | return $course_id; |
441 | 441 | } else { |
442 | 442 | // Course exists, get its descriptions |
443 | 443 | $descriptions = CourseDescription::get_descriptions($course_id); |
444 | 444 | $results = array(); |
445 | - foreach($descriptions as $description) { |
|
445 | + foreach ($descriptions as $description) { |
|
446 | 446 | $results[] = array('course_desc_id' => $description->get_description_type(), |
447 | 447 | 'course_desc_title' => $description->get_title(), |
448 | 448 | 'course_desc_content' => $description->get_content()); |
@@ -465,11 +465,11 @@ discard block |
||
465 | 465 | */ |
466 | 466 | public function EditCourseDescription($secret_key, $course_id_field_name, $course_id_value, $course_desc_id, $course_desc_title, $course_desc_content) { |
467 | 467 | $verifKey = $this->verifyKey($secret_key); |
468 | - if($verifKey instanceof WSError) { |
|
468 | + if ($verifKey instanceof WSError) { |
|
469 | 469 | $this->handleError($verifKey); |
470 | 470 | } else { |
471 | 471 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
472 | - if($course_id instanceof WSError) { |
|
472 | + if ($course_id instanceof WSError) { |
|
473 | 473 | return $course_id; |
474 | 474 | } else { |
475 | 475 | // Create the new course description |
@@ -484,8 +484,8 @@ discard block |
||
484 | 484 | // Check if this course description exists |
485 | 485 | $descriptions = CourseDescription::get_descriptions($course_id); |
486 | 486 | $exists = false; |
487 | - foreach($descriptions as $description) { |
|
488 | - if($description->get_description_type() == $course_desc_id) { |
|
487 | + foreach ($descriptions as $description) { |
|
488 | + if ($description->get_description_type() == $course_desc_id) { |
|
489 | 489 | $exists = true; |
490 | 490 | } |
491 | 491 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $form = TicketManager::getCategoryForm($url, $projectId); |
64 | 64 | $formToString = $form->returnForm(); |
65 | 65 | if ($form->validate()) { |
66 | - $values =$form->getSubmitValues(); |
|
66 | + $values = $form->getSubmitValues(); |
|
67 | 67 | |
68 | 68 | $params = [ |
69 | 69 | 'name' => $values['name'], |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | $form->setDefaults($cat); |
96 | 96 | $formToString = $form->returnForm(); |
97 | 97 | if ($form->validate()) { |
98 | - $values =$form->getSubmitValues(); |
|
98 | + $values = $form->getSubmitValues(); |
|
99 | 99 | |
100 | 100 | $params = [ |
101 | 101 | 'name' => $values['name'], |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | /* Header */ |
32 | 32 | $tool_name = get_lang('AddUsersToACourse'); |
33 | -$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
33 | +$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin')); |
|
34 | 34 | |
35 | 35 | $htmlHeadXtra[] = '<script> |
36 | 36 | function validate_filter() { |
@@ -142,12 +142,12 @@ discard block |
||
142 | 142 | if (isset($_POST[$varname]) && $_POST[$varname] != '0') { |
143 | 143 | $use_extra_fields = true; |
144 | 144 | if ($fieldtype == ExtraField::FIELD_TYPE_TAG) { |
145 | - $extra_field_result[]= UserManager::get_extra_user_data_by_tags( |
|
145 | + $extra_field_result[] = UserManager::get_extra_user_data_by_tags( |
|
146 | 146 | intval($_POST['field_id']), |
147 | 147 | $_POST[$varname] |
148 | 148 | ); |
149 | 149 | } else { |
150 | - $extra_field_result[]= UserManager::get_extra_user_data_by_value( |
|
150 | + $extra_field_result[] = UserManager::get_extra_user_data_by_value( |
|
151 | 151 | $new_field['variable'], |
152 | 152 | $_POST[$varname] |
153 | 153 | ); |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | $final_result = array(); |
164 | 164 | if (count($extra_field_result) > 1) { |
165 | 165 | for ($i = 0; $i < count($extra_field_result) - 1; $i++) { |
166 | - if (is_array($extra_field_result[$i+1])) { |
|
167 | - $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]); |
|
166 | + if (is_array($extra_field_result[$i + 1])) { |
|
167 | + $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]); |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | } else { |
@@ -172,14 +172,14 @@ discard block |
||
172 | 172 | } |
173 | 173 | |
174 | 174 | if (api_is_multiple_url_enabled()) { |
175 | - if (is_array($final_result) && count($final_result)>0) { |
|
176 | - $where_filter = " AND u.user_id IN ('".implode("','",$final_result)."') "; |
|
175 | + if (is_array($final_result) && count($final_result) > 0) { |
|
176 | + $where_filter = " AND u.user_id IN ('".implode("','", $final_result)."') "; |
|
177 | 177 | } else { |
178 | 178 | //no results |
179 | 179 | $where_filter = " AND u.user_id = -1"; |
180 | 180 | } |
181 | 181 | } else { |
182 | - if (is_array($final_result) && count($final_result)>0) { |
|
182 | + if (is_array($final_result) && count($final_result) > 0) { |
|
183 | 183 | $where_filter = " AND user_id IN ('".implode("','", $final_result)."') "; |
184 | 184 | } else { |
185 | 185 | //no results |
@@ -200,10 +200,10 @@ discard block |
||
200 | 200 | $sql = "SELECT user_id, lastname, firstname, username, official_code |
201 | 201 | FROM $tbl_user |
202 | 202 | WHERE user_id<>2 AND ".$target_name." LIKE '".$first_letter_user."%' $where_filter |
203 | - ORDER BY ". (count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy; |
|
203 | + ORDER BY ".(count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy; |
|
204 | 204 | |
205 | 205 | if (api_is_multiple_url_enabled()) { |
206 | - $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
206 | + $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER); |
|
207 | 207 | $access_url_id = api_get_current_access_url_id(); |
208 | 208 | if ($access_url_id != -1) { |
209 | 209 | $sql = "SELECT u.user_id,lastname,firstname,username, official_code |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | access_url_id = $access_url_id AND |
216 | 216 | (".$target_name." LIKE '".$first_letter_user."%' ) |
217 | 217 | $where_filter |
218 | - ORDER BY ". (count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy; |
|
218 | + ORDER BY ".(count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy; |
|
219 | 219 | } |
220 | 220 | } |
221 | 221 | |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | $fieldtype = $new_field['type']; |
259 | 259 | echo ' <select name="'.$varname.'">'; |
260 | 260 | echo '<option value="0">--'.get_lang('Select').'--</option>'; |
261 | - foreach ($new_field['data'] as $option) { |
|
262 | - $checked=''; |
|
261 | + foreach ($new_field['data'] as $option) { |
|
262 | + $checked = ''; |
|
263 | 263 | if ($fieldtype == ExtraField::FIELD_TYPE_TAG) { |
264 | 264 | if (isset($_POST[$varname])) { |
265 | 265 | if ($_POST[$varname] == $option['tag']) { |
@@ -317,7 +317,7 @@ discard block |
||
317 | 317 | <td width="40%" align="center"> |
318 | 318 | <select name="UserList[]" multiple="multiple" size="20" style="width:300px;"> |
319 | 319 | <?php foreach ($db_users as $user) { ?> |
320 | - <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) echo 'selected="selected"'; ?>> |
|
320 | + <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>> |
|
321 | 321 | <?php |
322 | 322 | $userName = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')'; |
323 | 323 | if ($showOfficialCode) { |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | <td width="40%" align="center"> |
339 | 339 | <select name="CourseList[]" multiple="multiple" size="20" style="width:300px;"> |
340 | 340 | <?php foreach ($db_courses as $course) { ?> |
341 | - <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>> |
|
341 | + <option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>> |
|
342 | 342 | <?php echo '('.$course['visual_code'].') '.$course['title']; ?> |
343 | 343 | </option> |
344 | 344 | <?php } ?> |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | $form = new FormValidator( |
23 | 23 | 'thematic_advance', |
24 | 24 | 'POST', |
25 | - api_get_self() . '?' . api_get_cidreq() |
|
25 | + api_get_self().'?'.api_get_cidreq() |
|
26 | 26 | ); |
27 | 27 | $form->addElement('header', $header_form); |
28 | 28 | //$form->addElement('hidden', 'thematic_advance_token',$token); |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | |
192 | 192 | $thematic = new Thematic(); |
193 | 193 | $thematic->set_thematic_advance_attributes( |
194 | - isset($values['thematic_advance_id']) ? $values['thematic_advance_id']: null, |
|
194 | + isset($values['thematic_advance_id']) ? $values['thematic_advance_id'] : null, |
|
195 | 195 | $values['thematic_id'], |
196 | 196 | $values['start_date_type'] == 1 && isset($values['attendance_select']) ? $values['attendance_select'] : 0, |
197 | 197 | $values['content'], |
@@ -210,13 +210,13 @@ discard block |
||
210 | 210 | } |
211 | 211 | } |
212 | 212 | |
213 | - $redirectUrlParams = 'course_progress/index.php?' . api_get_cidreq() . '&' . |
|
213 | + $redirectUrlParams = 'course_progress/index.php?'.api_get_cidreq().'&'. |
|
214 | 214 | http_build_query([ |
215 | 215 | 'action' => 'thematic_advance_list', |
216 | 216 | 'thematic_id' => $values['thematic_id'] |
217 | 217 | ]); |
218 | 218 | |
219 | - header('Location: ' . api_get_path(WEB_CODE_PATH) . $redirectUrlParams); |
|
219 | + header('Location: '.api_get_path(WEB_CODE_PATH).$redirectUrlParams); |
|
220 | 220 | exit; |
221 | 221 | } |
222 | 222 | |
@@ -226,10 +226,10 @@ discard block |
||
226 | 226 | // thematic advance list |
227 | 227 | echo '<div class="actions">'; |
228 | 228 | echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=thematic_details">'. |
229 | - Display::return_icon('back.png', get_lang("BackTo"),'',ICON_SIZE_MEDIUM).'</a>'; |
|
229 | + Display::return_icon('back.png', get_lang("BackTo"), '', ICON_SIZE_MEDIUM).'</a>'; |
|
230 | 230 | if (api_is_allowed_to_edit(false, true)) { |
231 | 231 | echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematic_id.'"> '. |
232 | - Display::return_icon('add.png', get_lang('NewThematicAdvance'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
232 | + Display::return_icon('add.png', get_lang('NewThematicAdvance'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
233 | 233 | } |
234 | 234 | echo '</div>'; |
235 | 235 | $table = new SortableTable( |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | } |
74 | 74 | |
75 | 75 | if (!empty($gradebook) && $gradebook == 'view') { |
76 | - $interbreadcrumb[]= array ( |
|
76 | + $interbreadcrumb[] = array( |
|
77 | 77 | 'url' => '../gradebook/'.$_SESSION['gradebook_dest'], |
78 | 78 | 'name' => get_lang('ToolGradebook') |
79 | 79 | ); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | $form = new FormValidator( |
98 | 98 | 'lp_add', |
99 | 99 | 'post', |
100 | - api_get_path(WEB_CODE_PATH) . 'lp/lp_controller.php?'.api_get_cidreq() |
|
100 | + api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq() |
|
101 | 101 | ); |
102 | 102 | |
103 | 103 | // Form title |
@@ -126,17 +126,17 @@ discard block |
||
126 | 126 | |
127 | 127 | // Start date |
128 | 128 | $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()')); |
129 | -$form->addElement('html','<div id="start_date_div" style="display:block;">'); |
|
129 | +$form->addElement('html', '<div id="start_date_div" style="display:block;">'); |
|
130 | 130 | $form->addDatePicker('publicated_on', get_lang('PublicationDate')); |
131 | -$form->addElement('html','</div>'); |
|
131 | +$form->addElement('html', '</div>'); |
|
132 | 132 | |
133 | 133 | //End date |
134 | 134 | $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()')); |
135 | -$form->addElement('html','<div id="end_date_div" style="display:none;">'); |
|
135 | +$form->addElement('html', '<div id="end_date_div" style="display:none;">'); |
|
136 | 136 | $form->addDatePicker('expired_on', get_lang('ExpirationDate')); |
137 | -$form->addElement('html','</div>'); |
|
137 | +$form->addElement('html', '</div>'); |
|
138 | 138 | |
139 | -$form->addElement('html','</div>'); |
|
139 | +$form->addElement('html', '</div>'); |
|
140 | 140 | |
141 | 141 | $defaults['activate_start_date_check'] = 1; |
142 | 142 | |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | } |
148 | 148 | |
149 | 149 | $defaults['publicated_on'] = date('Y-m-d 08:00:00'); |
150 | -$defaults['expired_on'] = date('Y-m-d 08:00:00',time()+86400); |
|
150 | +$defaults['expired_on'] = date('Y-m-d 08:00:00', time() + 86400); |
|
151 | 151 | |
152 | 152 | $form->setDefaults($defaults); |
153 | 153 | $form->addButtonCreate(get_lang('CreateLearningPath')); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | if (!empty($jquery_ready_content)) { |
80 | 80 | $htmlHeadXtra[] = '<script> |
81 | 81 | $(document).ready(function(){ |
82 | - ' . $jquery_ready_content . ' |
|
82 | + ' . $jquery_ready_content.' |
|
83 | 83 | }); |
84 | 84 | </script>'; |
85 | 85 | } |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | ); |
110 | 110 | } |
111 | 111 | |
112 | - header('Location: '.api_get_path(WEB_CODE_PATH) . 'admin/skill_list.php'); |
|
112 | + header('Location: '.api_get_path(WEB_CODE_PATH).'admin/skill_list.php'); |
|
113 | 113 | exit; |
114 | 114 | } |
115 | 115 |