@@ -15,13 +15,13 @@ discard block |
||
15 | 15 | $script = isset($_POST['script']) ? $_POST['script'] : false; |
16 | 16 | $function = isset($_POST['function']) ? $_POST['function'] : false; |
17 | 17 | |
18 | -$contact= $server.$script.'?wsdl'; |
|
18 | +$contact = $server.$script.'?wsdl'; |
|
19 | 19 | |
20 | 20 | $client = new nusoap_client($contact); |
21 | 21 | $err = $client->getError(); |
22 | 22 | if ($err) { |
23 | 23 | // Display the error |
24 | - echo '<h2>Constructor error</h2><pre>' . $err . '</pre>'; |
|
24 | + echo '<h2>Constructor error</h2><pre>'.$err.'</pre>'; |
|
25 | 25 | // At this point, you know the call that follows will fail |
26 | 26 | } |
27 | 27 | $response = array(); |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | $list = scandir($serversys); |
38 | 38 | $scripts = array(); |
39 | 39 | foreach ($list as $item) { |
40 | - if (substr($item,0,1) == '.') { continue; } |
|
41 | - if (substr($item,-8)=='soap.php') { |
|
40 | + if (substr($item, 0, 1) == '.') { continue; } |
|
41 | + if (substr($item, -8) == 'soap.php') { |
|
42 | 42 | $scripts[] = $item; |
43 | 43 | } |
44 | 44 | } |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | ?> |
56 | 56 | </select><br /> |
57 | 57 | <label for="function">Function</label> |
58 | -<input type="text" name="function" value="<?php echo $function;?>"></input><br /> |
|
58 | +<input type="text" name="function" value="<?php echo $function; ?>"></input><br /> |
|
59 | 59 | <label for="param[0]">Param 0</label> |
60 | 60 | <input type="text" name="param[0]" ></input><br /> |
61 | 61 | <input type="submit" name="submit" value="Send"/> |
@@ -28,11 +28,11 @@ discard block |
||
28 | 28 | 'all', |
29 | 29 | '', |
30 | 30 | array( |
31 | - 'name'=>'code' , 'type'=>'xsd:string', |
|
32 | - 'name'=>'title' , 'type'=>'xsd:string', |
|
33 | - 'name'=>'url' , 'type'=>'xsd:string', |
|
31 | + 'name'=>'code', 'type'=>'xsd:string', |
|
32 | + 'name'=>'title', 'type'=>'xsd:string', |
|
33 | + 'name'=>'url', 'type'=>'xsd:string', |
|
34 | 34 | 'name'=>'teacher', 'type'=>'xsd:string', |
35 | - 'name'=>'language','type'=>'xsd:string', |
|
35 | + 'name'=>'language', 'type'=>'xsd:string', |
|
36 | 36 | ) |
37 | 37 | ); |
38 | 38 | |
@@ -51,15 +51,15 @@ discard block |
||
51 | 51 | ); |
52 | 52 | |
53 | 53 | // Register the method to expose |
54 | -$server->register('WSCourseList', // method name |
|
54 | +$server->register('WSCourseList', // method name |
|
55 | 55 | array('username' => 'xsd:string', |
56 | 56 | 'signature' => 'xsd:string', |
57 | - 'visibilities' => 'xsd:string'), // input parameters |
|
58 | - array('return' => 'xsd:Array'), // output parameters |
|
59 | - 'urn:WSCourseList', // namespace |
|
60 | - 'urn:WSCourseList#WSCourseList', // soapaction |
|
61 | - 'rpc', // style |
|
62 | - 'encoded', // use |
|
57 | + 'visibilities' => 'xsd:string'), // input parameters |
|
58 | + array('return' => 'xsd:Array'), // output parameters |
|
59 | + 'urn:WSCourseList', // namespace |
|
60 | + 'urn:WSCourseList#WSCourseList', // soapaction |
|
61 | + 'rpc', // style |
|
62 | + 'encoded', // use |
|
63 | 63 | 'This service returns a list of courses' // documentation |
64 | 64 | ); |
65 | 65 |
@@ -59,5 +59,5 @@ |
||
59 | 59 | |
60 | 60 | $server->register('import_users_from_file'); |
61 | 61 | |
62 | -$http_request = (isset($HTTP_RAW_POST_DATA)?$HTTP_RAW_POST_DATA:''); |
|
62 | +$http_request = (isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : ''); |
|
63 | 63 | $server->service($http_request); |
@@ -4,12 +4,12 @@ discard block |
||
4 | 4 | */ |
5 | 5 | function validate_data($users) { |
6 | 6 | global $defined_auth_sources; |
7 | - $errors = array (); |
|
8 | - $usernames = array (); |
|
9 | - if(is_array($users)) { |
|
7 | + $errors = array(); |
|
8 | + $usernames = array(); |
|
9 | + if (is_array($users)) { |
|
10 | 10 | foreach ($users as $index => $user) { |
11 | 11 | // 1. Check whether mandatory fields have been set. |
12 | - $mandatory_fields = array ('LastName', 'FirstName'); |
|
12 | + $mandatory_fields = array('LastName', 'FirstName'); |
|
13 | 13 | if (api_get_setting('registration', 'email') == 'true') { |
14 | 14 | $mandatory_fields[] = 'Email'; |
15 | 15 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | function save_data($users) { |
92 | 92 | $user_table = Database :: get_main_table(TABLE_MAIN_USER); |
93 | - if(is_array($users)) { |
|
93 | + if (is_array($users)) { |
|
94 | 94 | foreach ($users as $index => $user) { |
95 | 95 | $user = complete_missing_data($user); |
96 | 96 | |
@@ -98,8 +98,8 @@ discard block |
||
98 | 98 | |
99 | 99 | $user_id = UserManager :: create_user($user['FirstName'], $user['LastName'], $user['Status'], $user['Email'], $user['UserName'], $user['Password'], $user['OfficialCode'], api_get_setting('PlatformLanguage'), $user['PhoneNumber'], '', $user['AuthSource']); |
100 | 100 | foreach ($user['Courses'] as $index => $course) { |
101 | - if(CourseManager :: course_exists($course)) |
|
102 | - CourseManager :: subscribe_user($user_id, $course,$user['Status']); |
|
101 | + if (CourseManager :: course_exists($course)) |
|
102 | + CourseManager :: subscribe_user($user_id, $course, $user['Status']); |
|
103 | 103 | } |
104 | 104 | if (strlen($user['ClassName']) > 0) { |
105 | 105 | $class_id = ClassManager :: get_class_id($user['ClassName']); |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | public function get_announcements_id($username, $password, $course_code) |
17 | 17 | { |
18 | - if($this->verifyUserPass($username, $password) == "valid") |
|
18 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
19 | 19 | { |
20 | 20 | |
21 | 21 | $result = self::get_announcements($username, $course_code); |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | |
34 | 34 | public function get_announcement_data($username, $password, $course_code, $announcement_id, $field) |
35 | 35 | { |
36 | - if($this->verifyUserPass($username, $password) == "valid") |
|
36 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
37 | 37 | { |
38 | 38 | $htmlcode = false; |
39 | 39 | $user_id = UserManager::get_user_id_from_username($username); |
40 | 40 | |
41 | 41 | $result = self::get_announcements($username, $course_code, $announcement_id); |
42 | - while($announcement = Database::fetch_array($result)) |
|
42 | + while ($announcement = Database::fetch_array($result)) |
|
43 | 43 | { |
44 | 44 | $announcements[] = $announcement; |
45 | 45 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | |
70 | 70 | return (htmlcode) ? html_entity_decode($announcements[0][$field_table]) : $announcements[0][$field_table]; |
71 | 71 | |
72 | - }else |
|
72 | + } else |
|
73 | 73 | return get_lang('InvalidId'); |
74 | 74 | } |
75 | 75 | |
@@ -82,11 +82,11 @@ discard block |
||
82 | 82 | $announcement_id = ($announcement_id == 0) ? "" : "AND announcement.id=".$announcement_id; |
83 | 83 | $user_id = UserManager::get_user_id_from_username($username); |
84 | 84 | $course_info = CourseManager::get_course_information($course_code); |
85 | - $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
86 | - $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
87 | - $maximum = '12'; |
|
85 | + $tbl_item_property = Database::get_course_table(TABLE_ITEM_PROPERTY); |
|
86 | + $tbl_announcement = Database::get_course_table(TABLE_ANNOUNCEMENT); |
|
87 | + $maximum = '12'; |
|
88 | 88 | |
89 | - $group_memberships=GroupManager::get_group_ids($course_info['real_id'], $user_id); |
|
89 | + $group_memberships = GroupManager::get_group_ids($course_info['real_id'], $user_id); |
|
90 | 90 | |
91 | 91 | if (api_get_group_id() == 0) { |
92 | 92 | $cond_user_id = " AND ( |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | |
105 | 105 | // the user is member of several groups => display personal |
106 | 106 | // announcements AND his group announcements AND the general announcements |
107 | - if (is_array($group_memberships) && count($group_memberships)>0) { |
|
108 | - $sql="SELECT |
|
107 | + if (is_array($group_memberships) && count($group_memberships) > 0) { |
|
108 | + $sql = "SELECT |
|
109 | 109 | announcement.*, ip.visibility, ip.to_group_id, ip.insert_user_id |
110 | 110 | FROM $tbl_announcement announcement, $tbl_item_property ip |
111 | 111 | WHERE |
@@ -51,10 +51,10 @@ |
||
51 | 51 | 'WSCourse.DeleteCourse', |
52 | 52 | array('secret_key' => 'xsd:string', 'course_id_field_name' => 'xsd:string', 'course_id_value' => 'xsd:string'), |
53 | 53 | array(), |
54 | - 'urn:WSService', // namespace |
|
55 | - 'urn:WSService#WSCourse.DeleteCourse', // soapaction |
|
56 | - 'rpc', // style |
|
57 | - 'encoded', // use |
|
54 | + 'urn:WSService', // namespace |
|
55 | + 'urn:WSService#WSCourse.DeleteCourse', // soapaction |
|
56 | + 'rpc', // style |
|
57 | + 'encoded', // use |
|
58 | 58 | 'Delete a course in chamilo' // documentation |
59 | 59 | |
60 | 60 | ); |
@@ -60,11 +60,11 @@ |
||
60 | 60 | $courses_list = courses_list($_POST['security-key'], $_POST['visibility']); |
61 | 61 | foreach ($courses_list as $code => $cd) { |
62 | 62 | echo '<course>'; |
63 | - echo '<code>' , $code , '</code>'; |
|
64 | - echo '<title>' , $cd['title'] , '</title>'; |
|
65 | - echo '<url>' , $cd['url'] , '</url>'; |
|
66 | - echo '<teacher>' , $cd['teacher'] , '</teacher>'; |
|
67 | - echo '<language>' , $cd['language'] , '</language>'; |
|
63 | + echo '<code>', $code, '</code>'; |
|
64 | + echo '<title>', $cd['title'], '</title>'; |
|
65 | + echo '<url>', $cd['url'], '</url>'; |
|
66 | + echo '<teacher>', $cd['teacher'], '</teacher>'; |
|
67 | + echo '<language>', $cd['language'], '</language>'; |
|
68 | 68 | echo '</course>'; |
69 | 69 | } |
70 | 70 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | * Singleton method |
41 | 41 | */ |
42 | 42 | public static function singleton() { |
43 | - if(!isset(self::$_instance)) { |
|
43 | + if (!isset(self::$_instance)) { |
|
44 | 44 | self::$_instance = new soap_server(); |
45 | 45 | // Set the error handler |
46 | 46 | WSCMError::setErrorHandler(new WSCMSoapErrorHandler()); |
@@ -15,12 +15,12 @@ discard block |
||
15 | 15 | { |
16 | 16 | |
17 | 17 | public function get_courses_code($username, $password) { |
18 | - if($this->verifyUserPass($username, $password) == "valid") { |
|
18 | + if ($this->verifyUserPass($username, $password) == "valid") { |
|
19 | 19 | $user_id = UserManager::get_user_id_from_username($username); |
20 | 20 | $listOfCourses = UserManager::get_personal_session_course_list($user_id); |
21 | 21 | |
22 | 22 | $courses_id = "#"; |
23 | - foreach ($listOfCourses as $course){ |
|
23 | + foreach ($listOfCourses as $course) { |
|
24 | 24 | $courses_id .= $course['code']."#"; |
25 | 25 | } |
26 | 26 | return $courses_id; |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | |
32 | 32 | public function get_course_title($username, $password, $course_code) |
33 | 33 | { |
34 | - if($this->verifyUserPass($username, $password) == "valid") |
|
34 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
35 | 35 | { |
36 | 36 | $course_info = CourseManager::get_course_information($course_code); |
37 | 37 | return $course_info['title']; |