@@ -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(!is_empty($title)) { |
|
216 | + if (!is_empty($title)) { |
|
217 | 217 | $attributes['title'] = $title; |
218 | 218 | } |
219 | - if(!is_empty($category_code)) { |
|
219 | + if (!is_empty($category_code)) { |
|
220 | 220 | $attributes['category_code'] = $category_code; |
221 | 221 | } |
222 | - if(!is_empty($department_name)) { |
|
222 | + if (!is_empty($department_name)) { |
|
223 | 223 | $attributes['department_name'] = $department_name; |
224 | 224 | } |
225 | - if(!is_empty($department_url)) { |
|
225 | + if (!is_empty($department_url)) { |
|
226 | 226 | $attributes['department_url'] = $department_url; |
227 | 227 | } |
228 | - if(!is_empty($language)) { |
|
228 | + if (!is_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(!is_empty($visual_code)) { |
|
240 | + if (!is_empty($visual_code)) { |
|
241 | 241 | $attributes['visual_code'] = $visual_code; |
242 | 242 | } |
243 | - if(!is_empty($attributes)) { |
|
243 | + if (!is_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 | } |
@@ -19,12 +19,12 @@ discard block |
||
19 | 19 | { |
20 | 20 | $fileData = $pptData['file_data']; |
21 | 21 | $dataInfo = pathinfo($pptData['file_name']); |
22 | - $fileName = basename($pptData['file_name'], '.' . $dataInfo['extension']); |
|
22 | + $fileName = basename($pptData['file_name'], '.'.$dataInfo['extension']); |
|
23 | 23 | $fullFileName = $pptData['file_name']; |
24 | 24 | |
25 | 25 | $tempArchivePath = api_get_path(SYS_ARCHIVE_PATH); |
26 | - $tempPath = $tempArchivePath . 'wsConvert/' . $fileName . '/'; |
|
27 | - $tempPathNewFiles = $tempArchivePath . 'wsConvert/' . $fileName . '-n/'; |
|
26 | + $tempPath = $tempArchivePath.'wsConvert/'.$fileName.'/'; |
|
27 | + $tempPathNewFiles = $tempArchivePath.'wsConvert/'.$fileName.'-n/'; |
|
28 | 28 | |
29 | 29 | $perms = api_get_permissions_for_new_directories(); |
30 | 30 | if (!is_dir($tempPath)) { |
@@ -33,28 +33,28 @@ discard block |
||
33 | 33 | if (!is_dir($tempPathNewFiles)) { |
34 | 34 | mkdir($tempPathNewFiles, $perms, true); |
35 | 35 | } |
36 | - if (!is_dir($tempPathNewFiles . $fileName)) { |
|
37 | - mkdir($tempPathNewFiles . $fileName, $perms, true); |
|
36 | + if (!is_dir($tempPathNewFiles.$fileName)) { |
|
37 | + mkdir($tempPathNewFiles.$fileName, $perms, true); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $file = base64_decode($fileData); |
41 | - file_put_contents($tempPath . $fullFileName, $file); |
|
41 | + file_put_contents($tempPath.$fullFileName, $file); |
|
42 | 42 | |
43 | 43 | if (IS_WINDOWS_OS) { // IS_WINDOWS_OS has been defined in main_api.lib.php |
44 | - $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'); |
|
45 | - $classPath = $converterPath . ';' . $converterPath . '/jodconverter-2.2.2.jar;' . $converterPath . '/jodconverter-cli-2.2.2.jar'; |
|
46 | - $cmd = 'java -Dfile.encoding=UTF-8 -cp "' . $classPath . '" DokeosConverter'; |
|
44 | + $converterPath = str_replace('/', '\\', api_get_path(SYS_PATH).'main/inc/lib/ppt2png'); |
|
45 | + $classPath = $converterPath.';'.$converterPath.'/jodconverter-2.2.2.jar;'.$converterPath.'/jodconverter-cli-2.2.2.jar'; |
|
46 | + $cmd = 'java -Dfile.encoding=UTF-8 -cp "'.$classPath.'" DokeosConverter'; |
|
47 | 47 | } else { |
48 | - $converterPath = api_get_path(SYS_PATH) . 'main/inc/lib/ppt2png'; |
|
48 | + $converterPath = api_get_path(SYS_PATH).'main/inc/lib/ppt2png'; |
|
49 | 49 | $classPath = ' -Dfile.encoding=UTF-8 -cp .:jodconverter-2.2.2.jar:jodconverter-cli-2.2.2.jar'; |
50 | - $cmd = 'cd ' . $converterPath . ' && java ' . $classPath . ' DokeosConverter'; |
|
50 | + $cmd = 'cd '.$converterPath.' && java '.$classPath.' DokeosConverter'; |
|
51 | 51 | } |
52 | 52 | |
53 | - $cmd .= ' -p ' . api_get_setting('service_ppt2lp', 'port'); |
|
54 | - $cmd .= ' -w 720 -h 540 -d oogie "' . $tempPath . $fullFileName.'" "' . $tempPathNewFiles . $fileName . '.html"'; |
|
53 | + $cmd .= ' -p '.api_get_setting('service_ppt2lp', 'port'); |
|
54 | + $cmd .= ' -w 720 -h 540 -d oogie "'.$tempPath.$fullFileName.'" "'.$tempPathNewFiles.$fileName.'.html"'; |
|
55 | 55 | |
56 | 56 | $perms = api_get_permissions_for_new_files(); |
57 | - chmod($tempPathNewFiles . $fileName, $perms, true); |
|
57 | + chmod($tempPathNewFiles.$fileName, $perms, true); |
|
58 | 58 | |
59 | 59 | $files = array(); |
60 | 60 | $return = 0; |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | $images = array(); |
65 | 65 | foreach ($files as $file) { |
66 | 66 | $imageData = explode('||', $file); |
67 | - $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles . $fileName . '/' . $imageData[1])); |
|
67 | + $images[$imageData[1]] = base64_encode(file_get_contents($tempPathNewFiles.$fileName.'/'.$imageData[1])); |
|
68 | 68 | } |
69 | 69 | $data = array( |
70 | 70 | 'files' => $files, |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | function deleteDirectory($directoryPath) |
91 | 91 | { |
92 | - $files = array_diff(scandir($directoryPath), array('.','..')); |
|
92 | + $files = array_diff(scandir($directoryPath), array('.', '..')); |
|
93 | 93 | foreach ($files as $file) { |
94 | 94 | if (is_dir("$directoryPath/$file")) { |
95 | 95 | deleteDirectory("$directoryPath/$file"); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $webCodePath = api_get_path(WEB_CODE_PATH); |
107 | 107 | $options = array( |
108 | 108 | 'uri' => $webPath, |
109 | - 'location' => $webCodePath . 'webservices/additional_webservices.php' |
|
109 | + 'location' => $webCodePath.'webservices/additional_webservices.php' |
|
110 | 110 | ); |
111 | 111 | |
112 | 112 | $soapServer = new SoapServer(NULL, $options); |
@@ -5,7 +5,7 @@ |
||
5 | 5 | */ |
6 | 6 | $ip = trim($_SERVER['REMOTE_ADDR']); |
7 | 7 | if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
8 | - list($ip1,$ip2) = preg_split('/,/',$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
8 | + list($ip1, $ip2) = preg_split('/,/', $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
9 | 9 | $ip = trim($ip1); |
10 | 10 | } |
11 | 11 | echo htmlentities($ip); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | */ |
21 | 21 | public function GetTimeSpentOnPlatform($user_id_field_name, $user_id_value) { |
22 | 22 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
23 | - if($user_id instanceof WSError) { |
|
23 | + if ($user_id instanceof WSError) { |
|
24 | 24 | return $user_id; |
25 | 25 | } else { |
26 | 26 | return Tracking::get_time_spent_on_the_platform($user_id); |
@@ -38,11 +38,11 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public function GetTimeSpentOnCourse($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value) { |
40 | 40 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
41 | - if($user_id instanceof WSError) { |
|
41 | + if ($user_id instanceof WSError) { |
|
42 | 42 | return $user_id; |
43 | 43 | } |
44 | 44 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
45 | - if($course_id instanceof WSError) { |
|
45 | + if ($course_id instanceof WSError) { |
|
46 | 46 | return $course_id; |
47 | 47 | } else { |
48 | 48 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -61,17 +61,17 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function GetTimeSpentOnCourseInSession($user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $session_id_field_name, $session_id_value) { |
63 | 63 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
64 | - if($user_id instanceof WSError) { |
|
64 | + if ($user_id instanceof WSError) { |
|
65 | 65 | return $user_id; |
66 | 66 | } |
67 | 67 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
68 | - if($course_id instanceof WSError) { |
|
68 | + if ($course_id instanceof WSError) { |
|
69 | 69 | return $course_id; |
70 | 70 | } else { |
71 | 71 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
72 | 72 | } |
73 | 73 | $session_id = $this->getSessionId($session_id_field_name, $session_id_value); |
74 | - if($session_id instanceof WSError) { |
|
74 | + if ($session_id instanceof WSError) { |
|
75 | 75 | return $session_id; |
76 | 76 | } |
77 | 77 | return Tracking::get_time_spent_on_the_course($user_id, $course_id, $session_id); |
@@ -87,17 +87,17 @@ discard block |
||
87 | 87 | */ |
88 | 88 | public function GetLearnpathsByCourse($secret_key, $user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value) { |
89 | 89 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
90 | - if($user_id instanceof WSError) { |
|
90 | + if ($user_id instanceof WSError) { |
|
91 | 91 | return $user_id; |
92 | 92 | } |
93 | 93 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
94 | - if($course_id instanceof WSError) { |
|
94 | + if ($course_id instanceof WSError) { |
|
95 | 95 | return $course_id; |
96 | 96 | } else { |
97 | 97 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
98 | 98 | } |
99 | 99 | |
100 | - $lp = new LearnpathList($user_id,$course_code); |
|
100 | + $lp = new LearnpathList($user_id, $course_code); |
|
101 | 101 | $list = $lp->list; |
102 | 102 | $return = array(); |
103 | 103 | foreach ($list as $id => $item) { |
@@ -117,11 +117,11 @@ discard block |
||
117 | 117 | */ |
118 | 118 | public function GetLearnpathProgress($secret_key, $user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id) { |
119 | 119 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
120 | - if($user_id instanceof WSError) { |
|
120 | + if ($user_id instanceof WSError) { |
|
121 | 121 | return $user_id; |
122 | 122 | } |
123 | 123 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
124 | - if($course_id instanceof WSError) { |
|
124 | + if ($course_id instanceof WSError) { |
|
125 | 125 | return $course_id; |
126 | 126 | } else { |
127 | 127 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -150,11 +150,11 @@ discard block |
||
150 | 150 | */ |
151 | 151 | public function GetLearnpathHighestLessonLocation($secret_key, $user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id) { |
152 | 152 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
153 | - if($user_id instanceof WSError) { |
|
153 | + if ($user_id instanceof WSError) { |
|
154 | 154 | return $user_id; |
155 | 155 | } |
156 | 156 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
157 | - if($course_id instanceof WSError) { |
|
157 | + if ($course_id instanceof WSError) { |
|
158 | 158 | return $course_id; |
159 | 159 | } else { |
160 | 160 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -179,11 +179,11 @@ discard block |
||
179 | 179 | */ |
180 | 180 | public function GetLearnpathScoreSingleItem($secret_key, $user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id, $learnpath_item_id) { |
181 | 181 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
182 | - if($user_id instanceof WSError) { |
|
182 | + if ($user_id instanceof WSError) { |
|
183 | 183 | return $user_id; |
184 | 184 | } |
185 | 185 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
186 | - if($course_id instanceof WSError) { |
|
186 | + if ($course_id instanceof WSError) { |
|
187 | 187 | return $course_id; |
188 | 188 | } else { |
189 | 189 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -213,15 +213,15 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function GetLearnpathStatusSingleItem($secret_key, $user_id_field_name, $user_id_value, $course_id_field_name, $course_id_value, $learnpath_id, $learnpath_item_id) { |
215 | 215 | $verifKey = $this->verifyKey($secret_key); |
216 | - if($verifKey instanceof WSError) { |
|
216 | + if ($verifKey instanceof WSError) { |
|
217 | 217 | $this->handleError($verifKey); |
218 | 218 | } else { |
219 | 219 | $user_id = $this->getUserId($user_id_field_name, $user_id_value); |
220 | - if($user_id instanceof WSError) { |
|
220 | + if ($user_id instanceof WSError) { |
|
221 | 221 | return $user_id; |
222 | 222 | } |
223 | 223 | $course_id = $this->getCourseId($course_id_field_name, $course_id_value); |
224 | - if($course_id instanceof WSError) { |
|
224 | + if ($course_id instanceof WSError) { |
|
225 | 225 | return $course_id; |
226 | 226 | } else { |
227 | 227 | $course_code = CourseManager::get_course_code_from_course_id($course_id); |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | if ($debug) { |
78 | - error_log("checkip " . intval($check_ip)); |
|
78 | + error_log("checkip ".intval($check_ip)); |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | if ($check_ip) { |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | '', |
132 | 132 | 'SOAP-ENC:Array', |
133 | 133 | array(), |
134 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:portalItem[]')),'tns:portalItem' |
|
134 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:portalItem[]')), 'tns:portalItem' |
|
135 | 135 | ); |
136 | 136 | |
137 | 137 | $server->wsdl->addComplexType( |
@@ -146,13 +146,13 @@ discard block |
||
146 | 146 | ); |
147 | 147 | |
148 | 148 | // Register the method to expose |
149 | -$server->register('WSGetPortals', // method name |
|
150 | - array('getPortals' => 'tns:getPortals'), // input parameters |
|
151 | - array('return' => 'tns:portalList'), // output parameters |
|
152 | - 'urn:WSAccessUrl', // namespace |
|
153 | - 'urn:WSAccessUrl#WSGetPortals', // soapaction |
|
154 | - 'rpc', // style |
|
155 | - 'encoded', // use |
|
149 | +$server->register('WSGetPortals', // method name |
|
150 | + array('getPortals' => 'tns:getPortals'), // input parameters |
|
151 | + array('return' => 'tns:portalList'), // output parameters |
|
152 | + 'urn:WSAccessUrl', // namespace |
|
153 | + 'urn:WSAccessUrl#WSGetPortals', // soapaction |
|
154 | + 'rpc', // style |
|
155 | + 'encoded', // use |
|
156 | 156 | 'This service adds a user to portal' // documentation |
157 | 157 | ); |
158 | 158 | |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | ); |
194 | 194 | |
195 | 195 | // Register the method to expose |
196 | -$server->register('WSAddUserToPortal', // method name |
|
197 | - array('addUserToPortal' => 'tns:AddUserToPortal'), // input parameters |
|
198 | - array('return' => 'xsd:string'), // output parameters |
|
199 | - 'urn:WSAccessUrl', // namespace |
|
200 | - 'urn:WSAccessUrl#WSAddUserToPortal', // soapaction |
|
201 | - 'rpc', // style |
|
202 | - 'encoded', // use |
|
196 | +$server->register('WSAddUserToPortal', // method name |
|
197 | + array('addUserToPortal' => 'tns:AddUserToPortal'), // input parameters |
|
198 | + array('return' => 'xsd:string'), // output parameters |
|
199 | + 'urn:WSAccessUrl', // namespace |
|
200 | + 'urn:WSAccessUrl#WSAddUserToPortal', // soapaction |
|
201 | + 'rpc', // style |
|
202 | + 'encoded', // use |
|
203 | 203 | 'This service adds a user to portal' // documentation |
204 | 204 | ); |
205 | 205 | |
@@ -224,13 +224,13 @@ discard block |
||
224 | 224 | } |
225 | 225 | |
226 | 226 | // Register the method to expose |
227 | -$server->register('WSRemoveUserFromPortal', // method name |
|
228 | - array('removeUserFromPortal' => 'tns:AddUserToPortal'), // input parameters |
|
229 | - array('return' => 'xsd:string'), // output parameters |
|
230 | - 'urn:WSAccessUrl', // namespace |
|
231 | - 'urn:WSAccessUrl#WSRemoveUserFromPortal', // soapaction |
|
232 | - 'rpc', // style |
|
233 | - 'encoded', // use |
|
227 | +$server->register('WSRemoveUserFromPortal', // method name |
|
228 | + array('removeUserFromPortal' => 'tns:AddUserToPortal'), // input parameters |
|
229 | + array('return' => 'xsd:string'), // output parameters |
|
230 | + 'urn:WSAccessUrl', // namespace |
|
231 | + 'urn:WSAccessUrl#WSRemoveUserFromPortal', // soapaction |
|
232 | + 'rpc', // style |
|
233 | + 'encoded', // use |
|
234 | 234 | 'This service remove a user from a portal' // documentation |
235 | 235 | ); |
236 | 236 | |
@@ -267,13 +267,13 @@ discard block |
||
267 | 267 | ); |
268 | 268 | |
269 | 269 | // Register the method to expose |
270 | -$server->register('WSGetPortalListFromUser', // method name |
|
271 | - array('getPortalListFromUser' => 'tns:getPortalListFromUser'), // input parameters |
|
272 | - array('return' => 'tns:portalList'), // output parameters |
|
273 | - 'urn:WSAccessUrl', // namespace |
|
274 | - 'urn:WSAccessUrl#WSGetPortalListFromUser', // soapaction |
|
275 | - 'rpc', // style |
|
276 | - 'encoded', // use |
|
270 | +$server->register('WSGetPortalListFromUser', // method name |
|
271 | + array('getPortalListFromUser' => 'tns:getPortalListFromUser'), // input parameters |
|
272 | + array('return' => 'tns:portalList'), // output parameters |
|
273 | + 'urn:WSAccessUrl', // namespace |
|
274 | + 'urn:WSAccessUrl#WSGetPortalListFromUser', // soapaction |
|
275 | + 'rpc', // style |
|
276 | + 'encoded', // use |
|
277 | 277 | 'This service remove a user from a portal' // documentation |
278 | 278 | ); |
279 | 279 | |
@@ -311,13 +311,13 @@ discard block |
||
311 | 311 | ); |
312 | 312 | |
313 | 313 | // Register the method to expose |
314 | -$server->register('WSGetPortalListFromCourse', // method name |
|
315 | - array('getPortalListFromCourse' => 'tns:getPortalListFromCourse'), // input parameters |
|
316 | - array('return' => 'tns:portalList'), // output parameters |
|
317 | - 'urn:WSAccessUrl', // namespace |
|
318 | - 'urn:WSAccessUrl#getPortalListFromCourse', // soapaction |
|
319 | - 'rpc', // style |
|
320 | - 'encoded', // use |
|
314 | +$server->register('WSGetPortalListFromCourse', // method name |
|
315 | + array('getPortalListFromCourse' => 'tns:getPortalListFromCourse'), // input parameters |
|
316 | + array('return' => 'tns:portalList'), // output parameters |
|
317 | + 'urn:WSAccessUrl', // namespace |
|
318 | + 'urn:WSAccessUrl#getPortalListFromCourse', // soapaction |
|
319 | + 'rpc', // style |
|
320 | + 'encoded', // use |
|
321 | 321 | 'This service remove a user from a portal' // documentation |
322 | 322 | ); |
323 | 323 | |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | ); |
362 | 362 | |
363 | 363 | // Register the method to expose |
364 | -$server->register('WSAddCourseToPortal', // method name |
|
365 | - array('addCourseToPortal' => 'tns:addCourseToPortal'), // input parameters |
|
366 | - array('return' => 'xsd:string'), // output parameters |
|
367 | - 'urn:WSAccessUrl', // namespace |
|
368 | - 'urn:WSAccessUrl#WSAddCourseToPortal', // soapaction |
|
369 | - 'rpc', // style |
|
370 | - 'encoded', // use |
|
364 | +$server->register('WSAddCourseToPortal', // method name |
|
365 | + array('addCourseToPortal' => 'tns:addCourseToPortal'), // input parameters |
|
366 | + array('return' => 'xsd:string'), // output parameters |
|
367 | + 'urn:WSAccessUrl', // namespace |
|
368 | + 'urn:WSAccessUrl#WSAddCourseToPortal', // soapaction |
|
369 | + 'rpc', // style |
|
370 | + 'encoded', // use |
|
371 | 371 | 'This service adds a course to portal' // documentation |
372 | 372 | ); |
373 | 373 | |
@@ -394,13 +394,13 @@ discard block |
||
394 | 394 | } |
395 | 395 | |
396 | 396 | // Register the method to expose |
397 | -$server->register('WSRemoveCourseFromPortal', // method name |
|
398 | - array('removeCourseFromPortal' => 'tns:addCourseToPortal'), // input parameters |
|
399 | - array('return' => 'xsd:string'), // output parameters |
|
400 | - 'urn:WSAccessUrl', // namespace |
|
401 | - 'urn:WSAccessUrl#WSRemoveCourseFromPortal', // soapaction |
|
402 | - 'rpc', // style |
|
403 | - 'encoded', // use |
|
397 | +$server->register('WSRemoveCourseFromPortal', // method name |
|
398 | + array('removeCourseFromPortal' => 'tns:addCourseToPortal'), // input parameters |
|
399 | + array('return' => 'xsd:string'), // output parameters |
|
400 | + 'urn:WSAccessUrl', // namespace |
|
401 | + 'urn:WSAccessUrl#WSRemoveCourseFromPortal', // soapaction |
|
402 | + 'rpc', // style |
|
403 | + 'encoded', // use |
|
404 | 404 | 'This service remove a course from a portal' // documentation |
405 | 405 | ); |
406 | 406 |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | * @param WSErrorHandler Error handler |
50 | 50 | */ |
51 | 51 | public static function setErrorHandler($handler) { |
52 | - if($handler instanceof WSErrorHandler) { |
|
52 | + if ($handler instanceof WSErrorHandler) { |
|
53 | 53 | self::$_handler = $handler; |
54 | 54 | } |
55 | 55 | } |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | // if we are behind a reverse proxy, assume it will send the |
115 | 115 | // HTTP_X_FORWARDED_FOR header and use this IP instead |
116 | 116 | if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
117 | - list($ip1,$ip2) = preg_split('/,/',$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
117 | + list($ip1, $ip2) = preg_split('/,/', $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
118 | 118 | $ip = trim($ip1); |
119 | 119 | } |
120 | 120 | $security_key = $ip.$this->_configuration['security_key']; |
121 | 121 | |
122 | - if(!api_is_valid_secret_key($secret_key, $security_key)) { |
|
122 | + if (!api_is_valid_secret_key($secret_key, $security_key)) { |
|
123 | 123 | return new WSError(1, "API key is invalid"); |
124 | 124 | } else { |
125 | 125 | return null; |
@@ -136,15 +136,15 @@ discard block |
||
136 | 136 | * @return mixed System user id if the user was found, WSError otherwise |
137 | 137 | */ |
138 | 138 | protected function getUserId($user_id_field_name, $user_id_value) { |
139 | - if($user_id_field_name == "chamilo_user_id") { |
|
140 | - if(UserManager::is_user_id_valid(intval($user_id_value))) { |
|
139 | + if ($user_id_field_name == "chamilo_user_id") { |
|
140 | + if (UserManager::is_user_id_valid(intval($user_id_value))) { |
|
141 | 141 | return intval($user_id_value); |
142 | 142 | } else { |
143 | 143 | return new WSError(100, "User not found"); |
144 | 144 | } |
145 | 145 | } else { |
146 | 146 | $user_id = UserManager::get_user_id_from_original_id($user_id_value, $user_id_field_name); |
147 | - if($user_id == 0) { |
|
147 | + if ($user_id == 0) { |
|
148 | 148 | return new WSError(100, "User not found"); |
149 | 149 | } else { |
150 | 150 | return $user_id; |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | protected function getSessionId($session_id_field_name, $session_id_value) |
198 | 198 | { |
199 | 199 | if ($session_id_field_name == "chamilo_session_id") { |
200 | - $session = SessionManager::fetch((int)$session_id_value); |
|
200 | + $session = SessionManager::fetch((int) $session_id_value); |
|
201 | 201 | if (!empty($session)) { |
202 | 202 | return intval($session_id_value); |
203 | 203 | } else { |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | $soap_error = $client->getError(); |
34 | 34 | |
35 | 35 | if (!empty($soap_error)) { |
36 | - $error_message = 'Nusoap object creation failed: ' . $soap_error; |
|
36 | + $error_message = 'Nusoap object creation failed: '.$soap_error; |
|
37 | 37 | throw new Exception($error_message); |
38 | 38 | } |
39 | 39 | $client->setDebugLevel(10000); |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | $ip_address = "127.0.0.1"; |
46 | 46 | |
47 | 47 | //Secret key |
48 | -$secret_key = sha1($ip_address.$security_key);// Hash of the combination of IP Address + Chamilo security key |
|
48 | +$secret_key = sha1($ip_address.$security_key); // Hash of the combination of IP Address + Chamilo security key |
|
49 | 49 | //$secret_key = sha1($security_key); |
50 | 50 | |
51 | 51 | //Creating a random user_id, this values need to be provided from your system |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | |
94 | 94 | if ($err) { |
95 | 95 | // Display the error |
96 | - echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; |
|
96 | + echo '<h2>Constructor error</h2><pre>'.$err.'</pre>'; |
|
97 | 97 | } |
98 | 98 | |
99 | 99 | |
@@ -325,14 +325,14 @@ discard block |
||
325 | 325 | |
326 | 326 | if ($err) { |
327 | 327 | // Display the error |
328 | - echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; |
|
328 | + echo '<h2>Constructor error</h2><pre>'.$err.'</pre>'; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | |
332 | 332 | //1. Create user webservice |
333 | 333 | $result = $client->call( |
334 | 334 | 'WSGetPortals', |
335 | - array('getPortals' => [ 'secret_key' => $secret_key]) |
|
335 | + array('getPortals' => ['secret_key' => $secret_key]) |
|
336 | 336 | ); |
337 | 337 | |
338 | 338 | $result = $client->call( |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | ); |
364 | 364 | |
365 | 365 | |
366 | -var_dump($user_id);exit; |
|
366 | +var_dump($user_id); exit; |
|
367 | 367 | |
368 | 368 | |
369 | 369 | |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | $err = $client->getError(); |
383 | 383 | if ($err) { |
384 | 384 | // Display the error |
385 | - echo '<h2>Error</h2><pre>' . $err . '</pre>'; |
|
385 | + echo '<h2>Error</h2><pre>'.$err.'</pre>'; |
|
386 | 386 | } else { |
387 | 387 | // Display the result |
388 | 388 | echo '<h2>There are no errors</h2>'; |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | |
14 | 14 | public function find_id_user($username, $password, $name) |
15 | 15 | { |
16 | - if($this->verifyUserPass($username, $password) == "valid") |
|
16 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
17 | 17 | { |
18 | 18 | |
19 | 19 | $listResult = "#"; |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | $listArrayResult = array_unique($listArray); |
43 | - foreach($listArrayResult as $result) |
|
43 | + foreach ($listArrayResult as $result) |
|
44 | 44 | { |
45 | - $listResult .= $result . "#"; |
|
45 | + $listResult .= $result."#"; |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | return $listResult; |
@@ -97,12 +97,12 @@ discard block |
||
97 | 97 | if ($this->verifyUserPass($username, $password) == "valid") { |
98 | 98 | $user_id = UserManager::get_user_id_from_username($username); |
99 | 99 | $message_title = get_lang('Invitation'); |
100 | - $count_is_true = SocialManager::send_invitation_friend($user_id,$userfriend_id, $message_title, $content_message); |
|
100 | + $count_is_true = SocialManager::send_invitation_friend($user_id, $userfriend_id, $message_title, $content_message); |
|
101 | 101 | |
102 | 102 | if ($count_is_true) { |
103 | - return Display::display_normal_message(api_htmlentities(get_lang('InvitationHasBeenSent'), ENT_QUOTES,$charset),false); |
|
103 | + return Display::display_normal_message(api_htmlentities(get_lang('InvitationHasBeenSent'), ENT_QUOTES, $charset), false); |
|
104 | 104 | } else { |
105 | - return Display::display_error_message(api_htmlentities(get_lang('YouAlreadySentAnInvitation'), ENT_QUOTES,$charset),false); |
|
105 | + return Display::display_error_message(api_htmlentities(get_lang('YouAlreadySentAnInvitation'), ENT_QUOTES, $charset), false); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | return get_lang('InvalidId'); |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | } |
66 | 66 | |
67 | 67 | if ($debug) { |
68 | - error_log("checkip " . intval($check_ip)); |
|
68 | + error_log("checkip ".intval($check_ip)); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | if ($check_ip) { |
@@ -120,13 +120,13 @@ discard block |
||
120 | 120 | ); |
121 | 121 | |
122 | 122 | // Register the method to expose |
123 | -$server->register('WSImportLP', // method name |
|
124 | - array('params' => 'tns:params'), // input parameters |
|
125 | - array('return' => 'xsd:string'), // output parameters |
|
126 | - 'urn:WSLP', // namespace |
|
127 | - 'urn:WSLP#WSImportLP', // soapaction |
|
128 | - 'rpc', // style |
|
129 | - 'encoded', // use |
|
123 | +$server->register('WSImportLP', // method name |
|
124 | + array('params' => 'tns:params'), // input parameters |
|
125 | + array('return' => 'xsd:string'), // output parameters |
|
126 | + 'urn:WSLP', // namespace |
|
127 | + 'urn:WSLP#WSImportLP', // soapaction |
|
128 | + 'rpc', // style |
|
129 | + 'encoded', // use |
|
130 | 130 | 'This service adds users' // documentation |
131 | 131 | ); |
132 | 132 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | |
184 | 184 | $uniqueFile = uniqid(); |
185 | 185 | $userId = 1; // admin |
186 | - $filePath = api_get_path(SYS_ARCHIVE_PATH) . $uniqueFile; |
|
186 | + $filePath = api_get_path(SYS_ARCHIVE_PATH).$uniqueFile; |
|
187 | 187 | file_put_contents($filePath, $fileData); |
188 | 188 | |
189 | 189 | $fileName = $params['filename']; |
@@ -257,8 +257,8 @@ discard block |
||
257 | 257 | 'all', |
258 | 258 | '', |
259 | 259 | array( |
260 | - 'id' => array('name' => 'id', 'type' => 'xsd:string'), |
|
261 | - 'name' => array('name' => 'name', 'type' => 'xsd:string'), |
|
260 | + 'id' => array('name' => 'id', 'type' => 'xsd:string'), |
|
261 | + 'name' => array('name' => 'name', 'type' => 'xsd:string'), |
|
262 | 262 | ) |
263 | 263 | ); |
264 | 264 | |
@@ -274,13 +274,13 @@ discard block |
||
274 | 274 | ); |
275 | 275 | |
276 | 276 | // Register the method to expose |
277 | -$server->register('WSGetLpList', // method name |
|
278 | - array('params' => 'tns:paramsGetLpList'), // input parameters |
|
279 | - array('return' => 'tns:lpList'), // output parameters |
|
280 | - 'urn:WSLP', // namespace |
|
281 | - 'urn:WSLP#WSGetLpList', // soapaction |
|
282 | - 'rpc', // style |
|
283 | - 'encoded', // use |
|
277 | +$server->register('WSGetLpList', // method name |
|
278 | + array('params' => 'tns:paramsGetLpList'), // input parameters |
|
279 | + array('return' => 'tns:lpList'), // output parameters |
|
280 | + 'urn:WSLP', // namespace |
|
281 | + 'urn:WSLP#WSGetLpList', // soapaction |
|
282 | + 'rpc', // style |
|
283 | + 'encoded', // use |
|
284 | 284 | 'This service adds users' // documentation |
285 | 285 | ); |
286 | 286 | |
@@ -369,13 +369,13 @@ discard block |
||
369 | 369 | ); |
370 | 370 | |
371 | 371 | // Register the method to expose |
372 | -$server->register('WSDeleteLp', // method name |
|
373 | - array('params' => 'tns:paramsDeleteLp'), // input parameters |
|
374 | - array('return' => 'xsd:string'), // output parameters |
|
375 | - 'urn:WSLP', // namespace |
|
376 | - 'urn:WSLP#WSDeleteLp', // soapaction |
|
377 | - 'rpc', // style |
|
378 | - 'encoded', // use |
|
372 | +$server->register('WSDeleteLp', // method name |
|
373 | + array('params' => 'tns:paramsDeleteLp'), // input parameters |
|
374 | + array('return' => 'xsd:string'), // output parameters |
|
375 | + 'urn:WSLP', // namespace |
|
376 | + 'urn:WSLP#WSDeleteLp', // soapaction |
|
377 | + 'rpc', // style |
|
378 | + 'encoded', // use |
|
379 | 379 | 'This service deletes a LP' // documentation |
380 | 380 | ); |
381 | 381 | |
@@ -434,9 +434,9 @@ discard block |
||
434 | 434 | if ($lp) { |
435 | 435 | if ($debug) error_log("LP deleted $lpId"); |
436 | 436 | |
437 | - $course_dir = $courseInfo['directory'] . '/document'; |
|
437 | + $course_dir = $courseInfo['directory'].'/document'; |
|
438 | 438 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
439 | - $base_work_dir = $sys_course_path . $course_dir; |
|
439 | + $base_work_dir = $sys_course_path.$course_dir; |
|
440 | 440 | |
441 | 441 | $items = $lp->get_flat_ordered_items_list($lpId, 0, $courseId); |
442 | 442 | |
@@ -495,9 +495,9 @@ discard block |
||
495 | 495 | 'all', |
496 | 496 | '', |
497 | 497 | array( |
498 | - 'data' => array('name' => 'data', 'type' => 'xsd:string'), |
|
499 | - 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
500 | - 'filename' => array('name' => 'filename', 'type' => 'xsd:string'), |
|
498 | + 'data' => array('name' => 'data', 'type' => 'xsd:string'), |
|
499 | + 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
500 | + 'filename' => array('name' => 'filename', 'type' => 'xsd:string'), |
|
501 | 501 | ) |
502 | 502 | ); |
503 | 503 | |
@@ -548,13 +548,13 @@ discard block |
||
548 | 548 | ); |
549 | 549 | |
550 | 550 | // Register the method to expose |
551 | -$server->register('WSCreateLp', // method name |
|
552 | - array('params' => 'tns:paramsCreateLp'), // input parameters |
|
553 | - array('return' => 'xsd:string'), // output parameters |
|
554 | - 'urn:WSLP', // namespace |
|
555 | - 'urn:WSLP#WSCreateLp', // soapaction |
|
556 | - 'rpc', // style |
|
557 | - 'encoded', // use |
|
551 | +$server->register('WSCreateLp', // method name |
|
552 | + array('params' => 'tns:paramsCreateLp'), // input parameters |
|
553 | + array('return' => 'xsd:string'), // output parameters |
|
554 | + 'urn:WSLP', // namespace |
|
555 | + 'urn:WSLP#WSCreateLp', // soapaction |
|
556 | + 'rpc', // style |
|
557 | + 'encoded', // use |
|
558 | 558 | 'This service creates a LP' // documentation |
559 | 559 | ); |
560 | 560 |