@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * Deletes all survey invitations of a user |
48 | 48 | * @param int $user_id |
49 | 49 | * |
50 | - * @return boolean |
|
50 | + * @return false|null |
|
51 | 51 | * @assert ('') === false |
52 | 52 | */ |
53 | 53 | public static function delete_all_survey_invitations_by_user($user_id) |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * Retrieves all the survey information |
105 | 105 | * |
106 | 106 | * @param integer $survey_id the id of the survey |
107 | - * @param boolean $shared this parameter determines if |
|
107 | + * @param integer $shared this parameter determines if |
|
108 | 108 | * we have to get the information of a survey from the central (shared) database or from the |
109 | 109 | * course database |
110 | 110 | * @param string course code optional |
@@ -571,7 +571,7 @@ discard block |
||
571 | 571 | * This function deletes a survey (and also all the question in that survey |
572 | 572 | * |
573 | 573 | * @param int $survey_id id of the survey that has to be deleted |
574 | - * @return true |
|
574 | + * @return boolean |
|
575 | 575 | * |
576 | 576 | * @author Patrick Cool <[email protected]>, Ghent University |
577 | 577 | * @version January 2007 |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | * |
757 | 757 | * @param int $survey_id id of the survey that has to be duplicated |
758 | 758 | * @param int $courseId id of the course which survey has to be duplicated |
759 | - * @return true |
|
759 | + * @return boolean |
|
760 | 760 | * |
761 | 761 | * @author Eric Marguin <[email protected]>, Elixir Interactive |
762 | 762 | * @version October 2007 |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | /** |
797 | 797 | * This function recalculates the number of people who have taken the survey (=filled at least one question) |
798 | 798 | * |
799 | - * @param int $survey_id the id of the survey somebody |
|
799 | + * @param int $survey_data the id of the survey somebody |
|
800 | 800 | * @return true |
801 | 801 | * |
802 | 802 | * @author Patrick Cool <[email protected]>, Ghent University |
@@ -841,7 +841,7 @@ discard block |
||
841 | 841 | * and all the options of all the questions. |
842 | 842 | * |
843 | 843 | * @param integer $survey_id the id of the survey |
844 | - * @param boolean $shared this parameter determines if we have to get the |
|
844 | + * @param integer $shared this parameter determines if we have to get the |
|
845 | 845 | * information of a survey from the central (shared) database or from the |
846 | 846 | * course database |
847 | 847 | * |
@@ -1387,7 +1387,7 @@ discard block |
||
1387 | 1387 | * This function deletes a shared survey question from the main database and all its options |
1388 | 1388 | * |
1389 | 1389 | * @param int $question_id the id of the question |
1390 | - * @param int $shared |
|
1390 | + * @param integer $survey_id |
|
1391 | 1391 | * |
1392 | 1392 | * @todo delete all the options of this question |
1393 | 1393 | * |
@@ -1514,8 +1514,8 @@ discard block |
||
1514 | 1514 | * This function deletes all the options of the questions of a given survey |
1515 | 1515 | * This function is normally only called when a survey is deleted |
1516 | 1516 | * |
1517 | - * @param $survey_id the id of the survey that has to be deleted |
|
1518 | - * @return true |
|
1517 | + * @param integer $survey_id the id of the survey that has to be deleted |
|
1518 | + * @return boolean |
|
1519 | 1519 | * |
1520 | 1520 | * @author Patrick Cool <[email protected]>, Ghent University |
1521 | 1521 | * @version January 2007 |
@@ -1581,8 +1581,8 @@ discard block |
||
1581 | 1581 | * This function deletes all the answers anyone has given on this survey |
1582 | 1582 | * This function is normally only called when a survey is deleted |
1583 | 1583 | * |
1584 | - * @param $survey_id the id of the survey that has to be deleted |
|
1585 | - * @return true |
|
1584 | + * @param integer $survey_id the id of the survey that has to be deleted |
|
1585 | + * @return boolean |
|
1586 | 1586 | * |
1587 | 1587 | * @todo write the function |
1588 | 1588 | * |
@@ -1824,7 +1824,7 @@ discard block |
||
1824 | 1824 | /** |
1825 | 1825 | * This function checks the parameters that are used in this page |
1826 | 1826 | * |
1827 | - * @return string The header, an error and the footer if any parameter fails, else it returns true |
|
1827 | + * @return null|boolean The header, an error and the footer if any parameter fails, else it returns true |
|
1828 | 1828 | * @author Patrick Cool <[email protected]>, Ghent University |
1829 | 1829 | * @version February 2007 |
1830 | 1830 | */ |
@@ -2391,6 +2391,7 @@ discard block |
||
2391 | 2391 | * Display score data about a survey question |
2392 | 2392 | * @param array Question info |
2393 | 2393 | * @param integer The offset of results shown |
2394 | + * @param integer $offset |
|
2394 | 2395 | * @return void (direct output) |
2395 | 2396 | */ |
2396 | 2397 | public static function display_question_report_score($survey_data, $question, $offset) |
@@ -3228,7 +3229,7 @@ discard block |
||
3228 | 3229 | * @param array User's answers |
3229 | 3230 | * @param mixed User ID or user details as string - Used as a string in the result string |
3230 | 3231 | * @param boolean Whether to display user fields or not |
3231 | - * @return string One line of the csv file |
|
3232 | + * @return string[] One line of the csv file |
|
3232 | 3233 | */ |
3233 | 3234 | static function export_complete_report_row_xls( |
3234 | 3235 | $survey_data, |
@@ -3821,7 +3822,7 @@ discard block |
||
3821 | 3822 | |
3822 | 3823 | /** |
3823 | 3824 | * @param $params |
3824 | - * @return bool|int |
|
3825 | + * @return false|string |
|
3825 | 3826 | */ |
3826 | 3827 | public static function save_invitation($params) |
3827 | 3828 | { |
@@ -3875,6 +3876,7 @@ discard block |
||
3875 | 3876 | * |
3876 | 3877 | * @param int invitedUser - the userId (course user) or emailaddress of additional user |
3877 | 3878 | * $param string $invitation_code - the unique invitation code for the URL |
3879 | + * @param string|null $invitation_text |
|
3878 | 3880 | * @return void |
3879 | 3881 | */ |
3880 | 3882 | public static function send_invitation_mail($invitedUser, $invitation_code, $invitation_title, $invitation_text) |
@@ -4803,7 +4805,7 @@ discard block |
||
4803 | 4805 | /** |
4804 | 4806 | * @author Isaac Flores Paz <[email protected]> |
4805 | 4807 | * @param int $user_id - User ID |
4806 | - * @param int $user_id_answer - User in survey answer table (user id or anonymus) |
|
4808 | + * @param int $user_answer - User in survey answer table (user id or anonymus) |
|
4807 | 4809 | * @return boolean |
4808 | 4810 | */ |
4809 | 4811 | static function show_link_available($user_id, $survey_code, $user_answer) |
@@ -4849,7 +4851,7 @@ discard block |
||
4849 | 4851 | * Display survey question chart |
4850 | 4852 | * @param array Chart data |
4851 | 4853 | * @param boolean Tells if the chart has a serie. False by default |
4852 | - * @return void (direct output) |
|
4854 | + * @return string (direct output) |
|
4853 | 4855 | */ |
4854 | 4856 | public static function drawChart($chartData, $hasSerie = false, $chartContainerId = 'chartContainer') |
4855 | 4857 | { |
@@ -1207,16 +1207,16 @@ |
||
1207 | 1207 | } |
1208 | 1208 | |
1209 | 1209 | /** |
1210 | - * This function saves the question in the shared database |
|
1211 | - * |
|
1212 | - * @param array $form_content all the information of the form |
|
1213 | - * @param array $survey_data all the information of the survey |
|
1214 | - * |
|
1215 | - * @author Patrick Cool <[email protected]>, Ghent University |
|
1216 | - * @version February 2007 |
|
1217 | - * |
|
1218 | - * @todo editing of a shared question |
|
1219 | - */ |
|
1210 | + * This function saves the question in the shared database |
|
1211 | + * |
|
1212 | + * @param array $form_content all the information of the form |
|
1213 | + * @param array $survey_data all the information of the survey |
|
1214 | + * |
|
1215 | + * @author Patrick Cool <[email protected]>, Ghent University |
|
1216 | + * @version February 2007 |
|
1217 | + * |
|
1218 | + * @todo editing of a shared question |
|
1219 | + */ |
|
1220 | 1220 | public function save_shared_question($form_content, $survey_data) |
1221 | 1221 | { |
1222 | 1222 | $_course = api_get_course_info(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | $result = Database::query($sql); |
36 | 36 | if (Database::num_rows($result)) { |
37 | 37 | $num++; |
38 | - $new_code = $code . $num; |
|
38 | + $new_code = $code.$num; |
|
39 | 39 | } else { |
40 | 40 | break; |
41 | 41 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | $sql = "SELECT survey_invitation_id, survey_code |
64 | 64 | FROM $table_survey_invitation WHERE user = '$user_id' AND c_id <> 0 "; |
65 | 65 | $result = Database::query($sql); |
66 | - while ($row = Database::fetch_array($result ,'ASSOC')){ |
|
66 | + while ($row = Database::fetch_array($result, 'ASSOC')) { |
|
67 | 67 | $survey_invitation_id = $row['survey_invitation_id']; |
68 | 68 | $survey_code = $row['survey_code']; |
69 | 69 | $sql2 = "DELETE FROM $table_survey_invitation |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | $table_survey = Database :: get_course_table(TABLE_SURVEY); |
130 | 130 | |
131 | 131 | if ($shared != 0) { |
132 | - $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); |
|
132 | + $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); |
|
133 | 133 | $sql = "SELECT * FROM $table_survey |
134 | 134 | WHERE survey_id='".intval($survey_id)."' "; |
135 | 135 | } else { |
@@ -142,8 +142,8 @@ discard block |
||
142 | 142 | $result = Database::query($sql); |
143 | 143 | $return = array(); |
144 | 144 | |
145 | - if (Database::num_rows($result)> 0) { |
|
146 | - $return = Database::fetch_array($result,'ASSOC'); |
|
145 | + if (Database::num_rows($result) > 0) { |
|
146 | + $return = Database::fetch_array($result, 'ASSOC'); |
|
147 | 147 | if ($simple_return) { |
148 | 148 | return $return; |
149 | 149 | } |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | $return['survey_type'] = $return['survey_type']; |
162 | 162 | $return['one_question_per_page'] = $return['one_question_per_page']; |
163 | 163 | $return['show_form_profile'] = $return['show_form_profile']; |
164 | - $return['input_name_list'] = isset($return['input_name_list']) ? $return['input_name_list'] : null; |
|
164 | + $return['input_name_list'] = isset($return['input_name_list']) ? $return['input_name_list'] : null; |
|
165 | 165 | $return['shuffle'] = $return['shuffle']; |
166 | 166 | $return['parent_id'] = $return['parent_id']; |
167 | 167 | $return['survey_version'] = $return['survey_version']; |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | $course_id = api_get_course_int_id(); |
188 | 188 | $session_id = api_get_session_id(); |
189 | 189 | $courseCode = api_get_course_id(); |
190 | - $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
190 | + $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
191 | 191 | $shared_survey_id = 0; |
192 | 192 | |
193 | 193 | if (!isset($values['survey_id'])) { |
@@ -233,7 +233,7 @@ discard block |
||
233 | 233 | if ($values[$field] == '') { |
234 | 234 | $values[$field] = 0; |
235 | 235 | } |
236 | - $field_values.= $field.':'.$values[$field].'@'; |
|
236 | + $field_values .= $field.':'.$values[$field].'@'; |
|
237 | 237 | } |
238 | 238 | } |
239 | 239 | $extraParams['form_fields'] = $field_values; |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | if ($values['anonymous'] == 0) { |
386 | 386 | $extraParams['show_form_profile'] = $values['show_form_profile']; |
387 | 387 | if ($values['show_form_profile'] == 1) { |
388 | - $fields = explode(',',$values['input_name_list']); |
|
388 | + $fields = explode(',', $values['input_name_list']); |
|
389 | 389 | $field_values = ''; |
390 | 390 | foreach ($fields as & $field) { |
391 | 391 | if ($field != '') { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | ) { |
395 | 395 | $values[$field] = 0; |
396 | 396 | } |
397 | - $field_values.= $field.':'.$values[$field].'@'; |
|
397 | + $field_values .= $field.':'.$values[$field].'@'; |
|
398 | 398 | } |
399 | 399 | } |
400 | 400 | $extraParams['form_fields'] = $field_values; |
@@ -526,7 +526,7 @@ discard block |
||
526 | 526 | $_course = api_get_course_info(); |
527 | 527 | |
528 | 528 | // Table definitions |
529 | - $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY); |
|
529 | + $table_survey = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY); |
|
530 | 530 | |
531 | 531 | if (!$values['survey_id'] || |
532 | 532 | !is_numeric($values['survey_id']) || |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | '".api_get_utc_datetime()."', |
545 | 545 | '".$_course['id']."')"; |
546 | 546 | Database::query($sql); |
547 | - $return = Database::insert_id(); |
|
547 | + $return = Database::insert_id(); |
|
548 | 548 | |
549 | 549 | $sql = "UPDATE $table_survey SET survey_id = $return WHERE iid = $return"; |
550 | 550 | Database::query($sql); |
@@ -561,7 +561,7 @@ discard block |
||
561 | 561 | surveythanks = '".Database::escape_string($values['survey_thanks'])."' |
562 | 562 | WHERE survey_id = '".Database::escape_string($values['survey_share']['survey_share'])."'"; |
563 | 563 | Database::query($sql); |
564 | - $return = $values['survey_share']['survey_share']; |
|
564 | + $return = $values['survey_share']['survey_share']; |
|
565 | 565 | } |
566 | 566 | |
567 | 567 | return $return; |
@@ -659,7 +659,7 @@ discard block |
||
659 | 659 | $params['c_id'] = $targetCourseId; |
660 | 660 | unset($params['survey_id']); |
661 | 661 | $params['session_id'] = api_get_session_id(); |
662 | - $params['title'] = $params['title'] . ' ' . get_lang('Copy'); |
|
662 | + $params['title'] = $params['title'].' '.get_lang('Copy'); |
|
663 | 663 | unset($params['iid']); |
664 | 664 | Database::insert($table_survey, $params); |
665 | 665 | $new_survey_id = Database::insert_id(); |
@@ -685,7 +685,7 @@ discard block |
||
685 | 685 | $sql = "SELECT * FROM $table_survey_question_group |
686 | 686 | WHERE c_id = $course_id AND survey_id='".$survey_id."'"; |
687 | 687 | $res = Database::query($sql); |
688 | - while($row = Database::fetch_array($res, 'ASSOC')) { |
|
688 | + while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
689 | 689 | $params = array( |
690 | 690 | 'c_id' => $targetCourseId, |
691 | 691 | 'name' => $row['name'], |
@@ -732,7 +732,7 @@ discard block |
||
732 | 732 | WHERE c_id = $course_id AND survey_id='".$survey_id."'"; |
733 | 733 | |
734 | 734 | $res = Database::query($sql); |
735 | - while ($row = Database::fetch_array($res ,'ASSOC')) { |
|
735 | + while ($row = Database::fetch_array($res, 'ASSOC')) { |
|
736 | 736 | $params = array( |
737 | 737 | 'c_id' => $targetCourseId, |
738 | 738 | 'question_id' => $question_id[$row['question_id']], |
@@ -916,7 +916,7 @@ discard block |
||
916 | 916 | { |
917 | 917 | // Table definitions |
918 | 918 | $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
919 | - $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
919 | + $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
920 | 920 | $course_id = api_get_course_int_id(); |
921 | 921 | |
922 | 922 | $sql = "SELECT * FROM $tbl_survey_question |
@@ -942,7 +942,7 @@ discard block |
||
942 | 942 | // Getting the information of the question |
943 | 943 | |
944 | 944 | $result = Database::query($sql); |
945 | - $row = Database::fetch_array($result,'ASSOC'); |
|
945 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
946 | 946 | |
947 | 947 | $return['survey_id'] = $row['survey_id']; |
948 | 948 | $return['question_id'] = $row['question_id']; |
@@ -990,8 +990,8 @@ discard block |
||
990 | 990 | public static function get_questions($survey_id, $course_id = '') |
991 | 991 | { |
992 | 992 | // Table definitions |
993 | - $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
994 | - $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
993 | + $tbl_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
994 | + $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
995 | 995 | |
996 | 996 | if (empty($course_id)) { |
997 | 997 | $course_id = api_get_course_int_id(); |
@@ -1096,7 +1096,7 @@ discard block |
||
1096 | 1096 | FROM $tbl_survey_question |
1097 | 1097 | WHERE c_id = $course_id AND survey_id='".intval($form_content['survey_id'])."'"; |
1098 | 1098 | $result = Database::query($sql); |
1099 | - $row = Database::fetch_array($result,'ASSOC'); |
|
1099 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
1100 | 1100 | $max_sort = $row['max_sort']; |
1101 | 1101 | |
1102 | 1102 | // Some variables defined for survey-test type |
@@ -1233,7 +1233,7 @@ discard block |
||
1233 | 1233 | WHERE survey_id='".intval($survey_data['survey_share'])."' |
1234 | 1234 | AND code='".Database::escape_string($_course['id'])."'"; |
1235 | 1235 | $result = Database::query($sql); |
1236 | - $row = Database::fetch_array($result,'ASSOC'); |
|
1236 | + $row = Database::fetch_array($result, 'ASSOC'); |
|
1237 | 1237 | $max_sort = $row['max_sort']; |
1238 | 1238 | |
1239 | 1239 | // Adding the question to the survey_question table |
@@ -1243,11 +1243,11 @@ discard block |
||
1243 | 1243 | '".Database::escape_string($form_content['question_comment'])."', |
1244 | 1244 | '".Database::escape_string($form_content['type'])."', |
1245 | 1245 | '".Database::escape_string($form_content['horizontalvertical'])."', |
1246 | - '".Database::escape_string($max_sort+1)."', |
|
1246 | + '".Database::escape_string($max_sort + 1)."', |
|
1247 | 1247 | '".Database::escape_string($_course['id'])."')"; |
1248 | 1248 | Database::query($sql); |
1249 | 1249 | $shared_question_id = Database::insert_id(); |
1250 | - } else { |
|
1250 | + } else { |
|
1251 | 1251 | // Updating an existing question |
1252 | 1252 | // adding the question to the survey_question table |
1253 | 1253 | $sql = "UPDATE $tbl_survey_question SET |
@@ -1277,7 +1277,7 @@ discard block |
||
1277 | 1277 | public static function move_survey_question($direction, $survey_question_id, $survey_id) |
1278 | 1278 | { |
1279 | 1279 | // Table definition |
1280 | - $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1280 | + $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1281 | 1281 | $course_id = api_get_course_int_id(); |
1282 | 1282 | |
1283 | 1283 | if ($direction == 'moveup') { |
@@ -1329,11 +1329,11 @@ discard block |
||
1329 | 1329 | $course_id = api_get_course_int_id(); |
1330 | 1330 | |
1331 | 1331 | // Table definitions |
1332 | - $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1332 | + $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1333 | 1333 | $course_condition = " c_id = $course_id AND "; |
1334 | 1334 | if ($shared) { |
1335 | 1335 | $course_condition = ""; |
1336 | - $table_survey_question = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); |
|
1336 | + $table_survey_question = Database :: get_main_table(TABLE_MAIN_SHARED_SURVEY_QUESTION); |
|
1337 | 1337 | } |
1338 | 1338 | |
1339 | 1339 | $sql = "DELETE FROM $table_survey_question |
@@ -1366,7 +1366,7 @@ discard block |
||
1366 | 1366 | { |
1367 | 1367 | $course_id = api_get_course_int_id(); |
1368 | 1368 | // Table definitions |
1369 | - $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1369 | + $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
1370 | 1370 | if ($shared) { |
1371 | 1371 | SurveyManager::delete_shared_survey_question($survey_id, $question_id); |
1372 | 1372 | } |
@@ -1428,7 +1428,7 @@ discard block |
||
1428 | 1428 | $course_id = api_get_course_int_id(); |
1429 | 1429 | // A percentage question type has options 1 -> 100 |
1430 | 1430 | if ($form_content['type'] == 'percentage') { |
1431 | - for($i = 1; $i < 101; $i++) { |
|
1431 | + for ($i = 1; $i < 101; $i++) { |
|
1432 | 1432 | $form_content['answers'][] = $i; |
1433 | 1433 | } |
1434 | 1434 | } |
@@ -1608,7 +1608,7 @@ discard block |
||
1608 | 1608 | { |
1609 | 1609 | $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
1610 | 1610 | |
1611 | - $user_id = intval($user_id); |
|
1611 | + $user_id = intval($user_id); |
|
1612 | 1612 | $course_id = intval($course_id); |
1613 | 1613 | $survey_id = intval($survey_id); |
1614 | 1614 | |
@@ -1636,14 +1636,14 @@ discard block |
||
1636 | 1636 | static function get_people_who_filled_survey($survey_id, $all_user_info = false, $course_id = null) |
1637 | 1637 | { |
1638 | 1638 | // Database table definition |
1639 | - $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
1640 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
1639 | + $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
1640 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
1641 | 1641 | |
1642 | 1642 | // Variable initialisation |
1643 | 1643 | $return = array(); |
1644 | 1644 | |
1645 | 1645 | if (empty($course_id)) { |
1646 | - $course_id = api_get_course_int_id(); |
|
1646 | + $course_id = api_get_course_int_id(); |
|
1647 | 1647 | } else { |
1648 | 1648 | $course_id = intval($course_id); |
1649 | 1649 | } |
@@ -1766,7 +1766,7 @@ discard block |
||
1766 | 1766 | static function remove_answer($user, $survey_id, $question_id, $course_id) { |
1767 | 1767 | $course_id = intval($course_id); |
1768 | 1768 | // table definition |
1769 | - $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
1769 | + $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
1770 | 1770 | $sql = "DELETE FROM $table_survey_answer |
1771 | 1771 | WHERE |
1772 | 1772 | c_id = $course_id AND |
@@ -1939,16 +1939,16 @@ discard block |
||
1939 | 1939 | */ |
1940 | 1940 | function delete_user_report($survey_id, $user_id) |
1941 | 1941 | { |
1942 | - $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
1943 | - $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
1944 | - $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
1942 | + $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
1943 | + $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
1944 | + $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
1945 | 1945 | |
1946 | 1946 | $course_id = api_get_course_int_id(); |
1947 | 1947 | |
1948 | 1948 | if (!empty($survey_id) && !empty($user_id)) { |
1949 | 1949 | // delete data from survey_answer by user_id and survey_id |
1950 | 1950 | $sql = "DELETE FROM $table_survey_answer |
1951 | - WHERE c_id = $course_id AND survey_id = '".(int)$survey_id."' AND user = '".(int)$user_id."'"; |
|
1951 | + WHERE c_id = $course_id AND survey_id = '".(int) $survey_id."' AND user = '".(int) $user_id."'"; |
|
1952 | 1952 | Database::query($sql); |
1953 | 1953 | // update field answered from survey_invitation by user_id and survey_id |
1954 | 1954 | $sql = "UPDATE $table_survey_invitation SET answered = '0' |
@@ -1958,9 +1958,9 @@ discard block |
||
1958 | 1958 | SELECT code FROM $table_survey |
1959 | 1959 | WHERE |
1960 | 1960 | c_id = $course_id AND |
1961 | - survey_id = '".(int)$survey_id."' |
|
1961 | + survey_id = '".(int) $survey_id."' |
|
1962 | 1962 | ) AND |
1963 | - user = '".(int)$user_id."'"; |
|
1963 | + user = '".(int) $user_id."'"; |
|
1964 | 1964 | $result = Database::query($sql); |
1965 | 1965 | } |
1966 | 1966 | |
@@ -1990,19 +1990,19 @@ discard block |
||
1990 | 1990 | // Actions bar |
1991 | 1991 | echo '<div class="actions">'; |
1992 | 1992 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'">'. |
1993 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
1993 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1994 | 1994 | if (isset($_GET['user'])) { |
1995 | 1995 | if (api_is_allowed_to_edit()) { |
1996 | 1996 | // The delete link |
1997 | 1997 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=deleteuserreport&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user='.Security::remove_XSS($_GET['user']).'" >'. |
1998 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
1998 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
1999 | 1999 | } |
2000 | 2000 | |
2001 | 2001 | // Export the user report |
2002 | 2002 | echo '<a href="javascript: void(0);" onclick="document.form1a.submit();">'. |
2003 | - Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
2003 | + Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
2004 | 2004 | echo '<a href="javascript: void(0);" onclick="document.form1b.submit();">'. |
2005 | - Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
2005 | + Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
2006 | 2006 | echo '<form id="form1a" name="form1a" method="post" action="'.api_get_self().'?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user_id='.Security::remove_XSS($_GET['user']).'">'; |
2007 | 2007 | echo '<input type="hidden" name="export_report" value="export_report">'; |
2008 | 2008 | echo '<input type="hidden" name="export_format" value="csv">'; |
@@ -2035,7 +2035,7 @@ discard block |
||
2035 | 2035 | $name = $person['invited_user']; |
2036 | 2036 | } |
2037 | 2037 | } else { |
2038 | - $name = get_lang('Anonymous') . ' ' . ($key + 1); |
|
2038 | + $name = get_lang('Anonymous').' '.($key + 1); |
|
2039 | 2039 | $id = $person; |
2040 | 2040 | } |
2041 | 2041 | echo '<option value="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.Security::remove_XSS($_GET['action']).'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&user='.Security::remove_XSS($id).'" '; |
@@ -2165,9 +2165,9 @@ discard block |
||
2165 | 2165 | $singlePage = isset($_GET['single_page']) ? intval($_GET['single_page']) : 0; |
2166 | 2166 | $course_id = api_get_course_int_id(); |
2167 | 2167 | // Database table definitions |
2168 | - $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
2169 | - $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
2170 | - $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
2168 | + $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
2169 | + $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
2170 | + $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
2171 | 2171 | |
2172 | 2172 | // Determining the offset of the sql statement (the n-th question of the survey) |
2173 | 2173 | $offset = !isset($_GET['question']) ? 0 : intval($_GET['question']); |
@@ -2178,7 +2178,7 @@ discard block |
||
2178 | 2178 | |
2179 | 2179 | echo '<div class="actions">'; |
2180 | 2180 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.$surveyId.'">'. |
2181 | - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
2181 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
2182 | 2182 | echo '</div>'; |
2183 | 2183 | |
2184 | 2184 | if ($survey_data['number_of_questions'] > 0) { |
@@ -2188,21 +2188,21 @@ discard block |
||
2188 | 2188 | /* echo '<ul><li class="disabled"><a href="#">'.get_lang('Question').'</a></li>'; */ |
2189 | 2189 | |
2190 | 2190 | if ($currentQuestion != 0) { |
2191 | - echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($offset - 1) . '">' . get_lang('PreviousQuestion') . '</a></li>'; |
|
2191 | + echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($offset - 1).'">'.get_lang('PreviousQuestion').'</a></li>'; |
|
2192 | 2192 | } |
2193 | 2193 | |
2194 | 2194 | for ($i = 1; $i <= $survey_data['number_of_questions']; $i++) { |
2195 | 2195 | if ($offset != $i - 1) { |
2196 | - echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($i - 1) . '">' . $i . '</a></li>'; |
|
2196 | + echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($i - 1).'">'.$i.'</a></li>'; |
|
2197 | 2197 | } else { |
2198 | - echo '<li class="disabled"s><a href="#">' . $i . '</a></li>'; |
|
2198 | + echo '<li class="disabled"s><a href="#">'.$i.'</a></li>'; |
|
2199 | 2199 | } |
2200 | 2200 | /*if ($i < $survey_data['number_of_questions']) { |
2201 | 2201 | echo ' | '; |
2202 | 2202 | }*/ |
2203 | 2203 | } |
2204 | 2204 | if ($currentQuestion < ($survey_data['number_of_questions'] - 1)) { |
2205 | - echo '<li><a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&' . api_get_cidreq() . '&survey_id=' . $surveyId . '&question=' . ($offset + 1) . '">' . get_lang('NextQuestion') . '</li></a>'; |
|
2205 | + echo '<li><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&'.api_get_cidreq().'&survey_id='.$surveyId.'&question='.($offset + 1).'">'.get_lang('NextQuestion').'</li></a>'; |
|
2206 | 2206 | } |
2207 | 2207 | echo '</ul>'; |
2208 | 2208 | echo '</div>'; |
@@ -2254,19 +2254,19 @@ discard block |
||
2254 | 2254 | $sql = "SELECT * FROM $table_survey_answer |
2255 | 2255 | WHERE |
2256 | 2256 | c_id = $course_id AND |
2257 | - survey_id='" . intval($_GET['survey_id']) . "' AND |
|
2258 | - question_id = '" . intval($question['question_id']) . "'"; |
|
2257 | + survey_id='".intval($_GET['survey_id'])."' AND |
|
2258 | + question_id = '" . intval($question['question_id'])."'"; |
|
2259 | 2259 | $result = Database::query($sql); |
2260 | 2260 | while ($row = Database::fetch_array($result)) { |
2261 | - echo $row['option_id'] . '<hr noshade="noshade" size="1" />'; |
|
2261 | + echo $row['option_id'].'<hr noshade="noshade" size="1" />'; |
|
2262 | 2262 | } |
2263 | 2263 | } else { |
2264 | 2264 | // Getting the options ORDER BY sort ASC |
2265 | 2265 | $sql = "SELECT * FROM $table_survey_question_option |
2266 | 2266 | WHERE |
2267 | 2267 | c_id = $course_id AND |
2268 | - survey_id='" . intval($_GET['survey_id']) . "' |
|
2269 | - AND question_id = '" . intval($question['question_id']) . "' |
|
2268 | + survey_id='".intval($_GET['survey_id'])."' |
|
2269 | + AND question_id = '" . intval($question['question_id'])."' |
|
2270 | 2270 | ORDER BY sort ASC"; |
2271 | 2271 | $result = Database::query($sql); |
2272 | 2272 | while ($row = Database::fetch_array($result)) { |
@@ -2276,8 +2276,8 @@ discard block |
||
2276 | 2276 | $sql = "SELECT *, count(answer_id) as total FROM $table_survey_answer |
2277 | 2277 | WHERE |
2278 | 2278 | c_id = $course_id AND |
2279 | - survey_id='" . intval($_GET['survey_id']) . "' |
|
2280 | - AND question_id = '" . intval($question['question_id']) . "' |
|
2279 | + survey_id='".intval($_GET['survey_id'])."' |
|
2280 | + AND question_id = '" . intval($question['question_id'])."' |
|
2281 | 2281 | GROUP BY option_id, value"; |
2282 | 2282 | $result = Database::query($sql); |
2283 | 2283 | $number_of_answers = array(); |
@@ -2294,8 +2294,7 @@ discard block |
||
2294 | 2294 | $optionText = strip_tags($option['option_text']); |
2295 | 2295 | $optionText = html_entity_decode($optionText); |
2296 | 2296 | $votes = isset($data[$option['question_option_id']]['total']) ? |
2297 | - $data[$option['question_option_id']]['total'] : |
|
2298 | - '0'; |
|
2297 | + $data[$option['question_option_id']]['total'] : '0'; |
|
2299 | 2298 | array_push($chartData, array('option' => $optionText, 'votes' => $votes)); |
2300 | 2299 | } |
2301 | 2300 | $chartContainerId = 'chartContainer'.$question['question_id']; |
@@ -2307,9 +2306,9 @@ discard block |
||
2307 | 2306 | echo '<table class="display-survey table">'; |
2308 | 2307 | echo ' <tr>'; |
2309 | 2308 | echo ' <th> </th>'; |
2310 | - echo ' <th>' . get_lang('AbsoluteTotal') . '</th>'; |
|
2311 | - echo ' <th>' . get_lang('Percentage') . '</th>'; |
|
2312 | - echo ' <th>' . get_lang('VisualRepresentation') . '</th>'; |
|
2309 | + echo ' <th>'.get_lang('AbsoluteTotal').'</th>'; |
|
2310 | + echo ' <th>'.get_lang('Percentage').'</th>'; |
|
2311 | + echo ' <th>'.get_lang('VisualRepresentation').'</th>'; |
|
2313 | 2312 | echo ' <tr>'; |
2314 | 2313 | |
2315 | 2314 | // Displaying the table: the content |
@@ -2328,22 +2327,22 @@ discard block |
||
2328 | 2327 | $answers_number = $absolute_number / $number_of_answers[$option['question_id']] * 100; |
2329 | 2328 | } |
2330 | 2329 | echo ' <tr>'; |
2331 | - echo ' <td class="center">' . $value['option_text'] . '</td>'; |
|
2330 | + echo ' <td class="center">'.$value['option_text'].'</td>'; |
|
2332 | 2331 | echo ' <td class="center">'; |
2333 | 2332 | if ($absolute_number != 0) { |
2334 | - echo '<a href="' . api_get_path(WEB_CODE_PATH) . 'survey/reporting.php?action=' . $action . '&survey_id=' . $surveyId . '&question=' . $offset . '&viewoption=' . $value['question_option_id'] . '">' . $absolute_number . '</a>'; |
|
2333 | + echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&survey_id='.$surveyId.'&question='.$offset.'&viewoption='.$value['question_option_id'].'">'.$absolute_number.'</a>'; |
|
2335 | 2334 | } else { |
2336 | 2335 | echo '0'; |
2337 | 2336 | } |
2338 | 2337 | |
2339 | 2338 | echo ' </td>'; |
2340 | - echo ' <td class="center">' . round($answers_number, 2) . ' %</td>'; |
|
2339 | + echo ' <td class="center">'.round($answers_number, 2).' %</td>'; |
|
2341 | 2340 | echo ' <td class="center">'; |
2342 | 2341 | $size = $answers_number * 2; |
2343 | 2342 | if ($size > 0) { |
2344 | - echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:' . $size . 'px"> </div>'; |
|
2343 | + echo '<div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px"> </div>'; |
|
2345 | 2344 | } else { |
2346 | - echo '<div style="text-align: left;">' . get_lang("NoDataAvailable") . '</div>'; |
|
2345 | + echo '<div style="text-align: left;">'.get_lang("NoDataAvailable").'</div>'; |
|
2347 | 2346 | } |
2348 | 2347 | echo ' </td>'; |
2349 | 2348 | echo ' </tr>'; |
@@ -2351,8 +2350,8 @@ discard block |
||
2351 | 2350 | } |
2352 | 2351 | // displaying the table: footer (totals) |
2353 | 2352 | echo ' <tr>'; |
2354 | - echo ' <td class="total"><b>' . get_lang('Total') . '</b></td>'; |
|
2355 | - echo ' <td class="total"><b>' . ($number_of_answers[$option['question_id']] == 0 ? '0' : $number_of_answers[$option['question_id']]) . '</b></td>'; |
|
2353 | + echo ' <td class="total"><b>'.get_lang('Total').'</b></td>'; |
|
2354 | + echo ' <td class="total"><b>'.($number_of_answers[$option['question_id']] == 0 ? '0' : $number_of_answers[$option['question_id']]).'</b></td>'; |
|
2356 | 2355 | echo ' <td class="total"> </td>'; |
2357 | 2356 | echo ' <td class="total"> </td>'; |
2358 | 2357 | echo ' </tr>'; |
@@ -2396,8 +2395,8 @@ discard block |
||
2396 | 2395 | public static function display_question_report_score($survey_data, $question, $offset) |
2397 | 2396 | { |
2398 | 2397 | // Database table definitions |
2399 | - $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
2400 | - $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
2398 | + $table_survey_question_option = Database :: get_course_table(TABLE_SURVEY_QUESTION_OPTION); |
|
2399 | + $table_survey_answer = Database :: get_course_table(TABLE_SURVEY_ANSWER); |
|
2401 | 2400 | |
2402 | 2401 | $course_id = api_get_course_int_id(); |
2403 | 2402 | |
@@ -2467,9 +2466,9 @@ discard block |
||
2467 | 2466 | echo ' <td>'.$value['option_text'].'</td>'; |
2468 | 2467 | echo ' <td>'.$i.'</td>'; |
2469 | 2468 | echo ' <td><a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action='.$action.'&survey_id='.Security::remove_XSS($_GET['survey_id']).'&question='.Security::remove_XSS($offset).'&viewoption='.$value['question_option_id'].'&value='.$i.'">'.$absolute_number.'</a></td>'; |
2470 | - echo ' <td>'.round($absolute_number/$number_of_answers*100, 2).' %</td>'; |
|
2469 | + echo ' <td>'.round($absolute_number / $number_of_answers * 100, 2).' %</td>'; |
|
2471 | 2470 | echo ' <td>'; |
2472 | - $size = ($absolute_number/$number_of_answers*100*2); |
|
2471 | + $size = ($absolute_number / $number_of_answers * 100 * 2); |
|
2473 | 2472 | if ($size > 0) { |
2474 | 2473 | echo ' <div style="border:1px solid #264269; background-color:#aecaf4; height:10px; width:'.$size.'px"> </div>'; |
2475 | 2474 | } |
@@ -2506,11 +2505,11 @@ discard block |
||
2506 | 2505 | // Actions bar |
2507 | 2506 | echo '<div class="actions">'; |
2508 | 2507 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.Security::remove_XSS($_GET['survey_id']).'"> |
2509 | - '.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
2508 | + '.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
2510 | 2509 | echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1a.submit();"> |
2511 | - '.Display::return_icon('export_csv.png',get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
2510 | + '.Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
2512 | 2511 | echo '<a class="survey_export_link" href="javascript: void(0);" onclick="document.form1b.submit();"> |
2513 | - '.Display::return_icon('export_excel.png',get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
2512 | + '.Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
2514 | 2513 | echo '</div>'; |
2515 | 2514 | |
2516 | 2515 | // The form |
@@ -2543,8 +2542,8 @@ discard block |
||
2543 | 2542 | // Show user fields section with a big th colspan that spans over all fields |
2544 | 2543 | $extra_user_fields = UserManager::get_extra_fields(0, 0, 5, 'ASC', false, true); |
2545 | 2544 | $num = count($extra_user_fields); |
2546 | - if ($num > 0 ) { |
|
2547 | - echo '<th '.($num>0?' colspan="'.$num.'"':'').'>'; |
|
2545 | + if ($num > 0) { |
|
2546 | + echo '<th '.($num > 0 ? ' colspan="'.$num.'"' : '').'>'; |
|
2548 | 2547 | echo '<label><input type="checkbox" name="fields_filter" value="1" checked="checked"/> '; |
2549 | 2548 | echo get_lang('UserFields'); |
2550 | 2549 | echo '</label>'; |
@@ -2609,7 +2608,7 @@ discard block |
||
2609 | 2608 | if (!(isset($_POST['submit_question_filter']) && $_POST['submit_question_filter'] || |
2610 | 2609 | isset($_POST['export_report']) && $_POST['export_report']) || !empty($_POST['fields_filter'])) { |
2611 | 2610 | //show the fields names for user fields |
2612 | - foreach($extra_user_fields as & $field) { |
|
2611 | + foreach ($extra_user_fields as & $field) { |
|
2613 | 2612 | echo '<th>'.$field[3].'</th>'; |
2614 | 2613 | } |
2615 | 2614 | } |
@@ -2629,7 +2628,7 @@ discard block |
||
2629 | 2628 | ORDER BY sq.sort ASC, sqo.sort ASC"; |
2630 | 2629 | $result = Database::query($sql); |
2631 | 2630 | |
2632 | - $display_percentage_header = 1; // in order to display only once the cell option (and not 100 times) |
|
2631 | + $display_percentage_header = 1; // in order to display only once the cell option (and not 100 times) |
|
2633 | 2632 | while ($row = Database::fetch_array($result)) { |
2634 | 2633 | // We show the options if |
2635 | 2634 | // 1. there is no question filter and the export button has not been clicked |
@@ -2689,7 +2688,7 @@ discard block |
||
2689 | 2688 | $questions, |
2690 | 2689 | $display_extra_user_fields |
2691 | 2690 | ); |
2692 | - $answers_of_user=array(); |
|
2691 | + $answers_of_user = array(); |
|
2693 | 2692 | } |
2694 | 2693 | if (isset($questions[$row['question_id']]) && $questions[$row['question_id']]['type'] != 'open') { |
2695 | 2694 | $answers_of_user[$row['question_id']][$row['option_id']] = $row; |
@@ -2751,7 +2750,7 @@ discard block |
||
2751 | 2750 | echo '<th>'.$user.'</th>'; // the user column |
2752 | 2751 | } |
2753 | 2752 | } else { |
2754 | - echo '<th>' . get_lang('Anonymous') . ' ' . $user . '</th>'; |
|
2753 | + echo '<th>'.get_lang('Anonymous').' '.$user.'</th>'; |
|
2755 | 2754 | } |
2756 | 2755 | |
2757 | 2756 | if ($display_extra_user_fields) { |
@@ -2847,10 +2846,10 @@ discard block |
||
2847 | 2846 | // We do not show comment and pagebreak question types |
2848 | 2847 | if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') { |
2849 | 2848 | if ($row['number_of_options'] == 0 && $row['type'] == 'open') { |
2850 | - $return .= str_replace("\r\n",' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';'; |
|
2849 | + $return .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';'; |
|
2851 | 2850 | } else { |
2852 | 2851 | for ($ii = 0; $ii < $row['number_of_options']; $ii++) { |
2853 | - $return .= str_replace("\r\n",' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';'; |
|
2852 | + $return .= str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($row['survey_question']), ENT_QUOTES)).';'; |
|
2854 | 2853 | } |
2855 | 2854 | } |
2856 | 2855 | } |
@@ -2864,7 +2863,7 @@ discard block |
||
2864 | 2863 | // Show the fields names for user fields |
2865 | 2864 | if (!empty($extra_user_fields)) { |
2866 | 2865 | foreach ($extra_user_fields as & $field) { |
2867 | - $return .= '"'.str_replace("\r\n",' ',api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES)).'";'; |
|
2866 | + $return .= '"'.str_replace("\r\n", ' ', api_html_entity_decode(strip_tags($field[3]), ENT_QUOTES)).'";'; |
|
2868 | 2867 | } |
2869 | 2868 | } |
2870 | 2869 | |
@@ -2899,7 +2898,7 @@ discard block |
||
2899 | 2898 | ) { |
2900 | 2899 | // We do not show comment and pagebreak question types |
2901 | 2900 | if ($row['type'] != 'comment' && $row['type'] != 'pagebreak') { |
2902 | - $row['option_text'] = str_replace(array("\r","\n"),array('',''),$row['option_text']); |
|
2901 | + $row['option_text'] = str_replace(array("\r", "\n"), array('', ''), $row['option_text']); |
|
2903 | 2902 | $return .= api_html_entity_decode(strip_tags($row['option_text']), ENT_QUOTES).';'; |
2904 | 2903 | $possible_answers[$row['question_id']][$row['question_option_id']] = $row['question_option_id']; |
2905 | 2904 | $possible_answers_type[$row['question_id']] = $row['type']; |
@@ -2929,9 +2928,9 @@ discard block |
||
2929 | 2928 | $old_user, |
2930 | 2929 | true |
2931 | 2930 | ); |
2932 | - $answers_of_user=array(); |
|
2931 | + $answers_of_user = array(); |
|
2933 | 2932 | } |
2934 | - if($possible_answers_type[$row['question_id']] == 'open') { |
|
2933 | + if ($possible_answers_type[$row['question_id']] == 'open') { |
|
2935 | 2934 | $temp_id = 'open'.$open_question_iterator; |
2936 | 2935 | $answers_of_user[$row['question_id']][$temp_id] = $row; |
2937 | 2936 | $open_question_iterator++; |
@@ -2990,7 +2989,7 @@ discard block |
||
2990 | 2989 | |
2991 | 2990 | if ($display_extra_user_fields) { |
2992 | 2991 | // Show user fields data, if any, for this user |
2993 | - $user_fields_values = UserManager::get_extra_user_data($user,false,false, false, true); |
|
2992 | + $user_fields_values = UserManager::get_extra_user_data($user, false, false, false, true); |
|
2994 | 2993 | foreach ($user_fields_values as & $value) { |
2995 | 2994 | $return .= '"'.str_replace('"', '""', api_html_entity_decode(strip_tags($value), ENT_QUOTES)).'";'; |
2996 | 2995 | } |
@@ -3089,9 +3088,9 @@ discard block |
||
3089 | 3088 | ENT_QUOTES |
3090 | 3089 | ) |
3091 | 3090 | ); |
3092 | - $column ++; |
|
3091 | + $column++; |
|
3093 | 3092 | } else { |
3094 | - for ($ii = 0; $ii < $row['number_of_options']; $ii ++) { |
|
3093 | + for ($ii = 0; $ii < $row['number_of_options']; $ii++) { |
|
3095 | 3094 | $worksheet->SetCellValueByColumnAndRow( |
3096 | 3095 | $line, |
3097 | 3096 | $column, |
@@ -3100,7 +3099,7 @@ discard block |
||
3100 | 3099 | ENT_QUOTES |
3101 | 3100 | ) |
3102 | 3101 | ); |
3103 | - $column ++; |
|
3102 | + $column++; |
|
3104 | 3103 | } |
3105 | 3104 | } |
3106 | 3105 | } |
@@ -3160,7 +3159,7 @@ discard block |
||
3160 | 3159 | } |
3161 | 3160 | |
3162 | 3161 | // Getting all the answers of the users |
3163 | - $line ++; |
|
3162 | + $line++; |
|
3164 | 3163 | $column = 0; |
3165 | 3164 | $old_user = ''; |
3166 | 3165 | $answers_of_user = array(); |
@@ -3169,7 +3168,7 @@ discard block |
||
3169 | 3168 | if ($user_id != 0) { |
3170 | 3169 | $sql .= "AND user='".intval($user_id)."' "; |
3171 | 3170 | } |
3172 | - $sql .= "ORDER BY user ASC"; |
|
3171 | + $sql .= "ORDER BY user ASC"; |
|
3173 | 3172 | |
3174 | 3173 | $open_question_iterator = 1; |
3175 | 3174 | $result = Database::query($sql); |
@@ -3244,7 +3243,7 @@ discard block |
||
3244 | 3243 | FROM '.Database::get_main_table(TABLE_MAIN_USER).' |
3245 | 3244 | WHERE user_id='.intval($user); |
3246 | 3245 | $rs = Database::query($sql); |
3247 | - if($row = Database::fetch_array($rs)) { |
|
3246 | + if ($row = Database::fetch_array($rs)) { |
|
3248 | 3247 | $user_displayed = api_get_person_name($row['firstname'], $row['lastname']); |
3249 | 3248 | } else { |
3250 | 3249 | $user_displayed = '-'; |
@@ -3259,8 +3258,8 @@ discard block |
||
3259 | 3258 | |
3260 | 3259 | if ($display_extra_user_fields) { |
3261 | 3260 | //show user fields data, if any, for this user |
3262 | - $user_fields_values = UserManager::get_extra_user_data(intval($user),false,false, false, true); |
|
3263 | - foreach($user_fields_values as $value) { |
|
3261 | + $user_fields_values = UserManager::get_extra_user_data(intval($user), false, false, false, true); |
|
3262 | + foreach ($user_fields_values as $value) { |
|
3264 | 3263 | $return[] = api_html_entity_decode(strip_tags($value), ENT_QUOTES); |
3265 | 3264 | } |
3266 | 3265 | } |
@@ -3269,7 +3268,7 @@ discard block |
||
3269 | 3268 | foreach ($possible_options as $question_id => & $possible_option) { |
3270 | 3269 | if (is_array($possible_option) && count($possible_option) > 0) { |
3271 | 3270 | foreach ($possible_option as $option_id => & $value) { |
3272 | - $my_answers_of_user = ($answers_of_user[$question_id]==null) ? array() : $answers_of_user[$question_id]; |
|
3271 | + $my_answers_of_user = ($answers_of_user[$question_id] == null) ? array() : $answers_of_user[$question_id]; |
|
3273 | 3272 | $key = array_keys($my_answers_of_user); |
3274 | 3273 | if (substr($key[0], 0, 4) == 'open') { |
3275 | 3274 | $return[] = api_html_entity_decode(strip_tags($answers_of_user[$question_id][$key[0]]['option_id']), ENT_QUOTES); |
@@ -3319,7 +3318,7 @@ discard block |
||
3319 | 3318 | // Actions bar |
3320 | 3319 | echo '<div class="actions">'; |
3321 | 3320 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?survey_id='.intval($_GET['survey_id']).'">'. |
3322 | - Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'),'',ICON_SIZE_MEDIUM).'</a>'; |
|
3321 | + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ReportingOverview'), '', ICON_SIZE_MEDIUM).'</a>'; |
|
3323 | 3322 | echo '</div>'; |
3324 | 3323 | |
3325 | 3324 | // Displaying an information message that only the questions with predefined answers can be used in a comparative report |
@@ -3384,25 +3383,25 @@ discard block |
||
3384 | 3383 | |
3385 | 3384 | $xOptions = array(); |
3386 | 3385 | // The header |
3387 | - $tableHtml .= ' <tr>'; |
|
3386 | + $tableHtml .= ' <tr>'; |
|
3388 | 3387 | for ($ii = 0; $ii <= count($question_x['answers']); $ii++) { |
3389 | 3388 | if ($ii == 0) { |
3390 | - $tableHtml .= ' <th> </th>'; |
|
3389 | + $tableHtml .= ' <th> </th>'; |
|
3391 | 3390 | } else { |
3392 | 3391 | if ($question_x['type'] == 'score') { |
3393 | 3392 | for ($x = 1; $x <= $question_x['maximum_score']; $x++) { |
3394 | - $tableHtml .= ' <th>'.$question_x['answers'][($ii-1)].'<br />'.$x.'</th>'; |
|
3393 | + $tableHtml .= ' <th>'.$question_x['answers'][($ii - 1)].'<br />'.$x.'</th>'; |
|
3395 | 3394 | } |
3396 | 3395 | $x = ''; |
3397 | 3396 | } else { |
3398 | - $tableHtml .= ' <th>'.$question_x['answers'][($ii-1)].'</th>'; |
|
3397 | + $tableHtml .= ' <th>'.$question_x['answers'][($ii - 1)].'</th>'; |
|
3399 | 3398 | } |
3400 | - $optionText = strip_tags($question_x['answers'][$ii-1]); |
|
3399 | + $optionText = strip_tags($question_x['answers'][$ii - 1]); |
|
3401 | 3400 | $optionText = html_entity_decode($optionText); |
3402 | 3401 | array_push($xOptions, trim($optionText)); |
3403 | 3402 | } |
3404 | 3403 | } |
3405 | - $tableHtml .= ' </tr>'; |
|
3404 | + $tableHtml .= ' </tr>'; |
|
3406 | 3405 | $chartData = array(); |
3407 | 3406 | |
3408 | 3407 | // The main part |
@@ -3412,15 +3411,15 @@ discard block |
||
3412 | 3411 | // The Y axis is a scoring question type so we have more rows than the options (actually options * maximum score) |
3413 | 3412 | if ($question_y['type'] == 'score') { |
3414 | 3413 | for ($y = 1; $y <= $question_y['maximum_score']; $y++) { |
3415 | - $tableHtml .= ' <tr>'; |
|
3414 | + $tableHtml .= ' <tr>'; |
|
3416 | 3415 | for ($ii = 0; $ii <= count($question_x['answers']); $ii++) { |
3417 | 3416 | if ($question_x['type'] == 'score') { |
3418 | 3417 | for ($x = 1; $x <= $question_x['maximum_score']; $x++) { |
3419 | 3418 | if ($ii == 0) { |
3420 | - $tableHtml .= ' <th>'.$question_y['answers'][($ij)].' '.$y.'</th>'; |
|
3419 | + $tableHtml .= ' <th>'.$question_y['answers'][($ij)].' '.$y.'</th>'; |
|
3421 | 3420 | break; |
3422 | 3421 | } else { |
3423 | - $tableHtml .= ' <td align="center">'; |
|
3422 | + $tableHtml .= ' <td align="center">'; |
|
3424 | 3423 | $votes = SurveyUtil::comparative_check( |
3425 | 3424 | $answers_x, |
3426 | 3425 | $answers_y, |
@@ -3429,23 +3428,23 @@ discard block |
||
3429 | 3428 | $x, |
3430 | 3429 | $y |
3431 | 3430 | ); |
3432 | - $tableHtml .= $votes; |
|
3431 | + $tableHtml .= $votes; |
|
3433 | 3432 | array_push( |
3434 | 3433 | $chartData, |
3435 | 3434 | array( |
3436 | - 'serie' => array($currentYQuestion, $xOptions[$ii-1]), |
|
3435 | + 'serie' => array($currentYQuestion, $xOptions[$ii - 1]), |
|
3437 | 3436 | 'option' => $x, |
3438 | 3437 | 'votes' => $votes |
3439 | 3438 | ) |
3440 | 3439 | ); |
3441 | - $tableHtml .= '</td>'; |
|
3440 | + $tableHtml .= '</td>'; |
|
3442 | 3441 | } |
3443 | 3442 | } |
3444 | 3443 | } else { |
3445 | 3444 | if ($ii == 0) { |
3446 | - $tableHtml .= '<th>'.$question_y['answers'][$ij].' '.$y.'</th>'; |
|
3445 | + $tableHtml .= '<th>'.$question_y['answers'][$ij].' '.$y.'</th>'; |
|
3447 | 3446 | } else { |
3448 | - $tableHtml .= '<td align="center">'; |
|
3447 | + $tableHtml .= '<td align="center">'; |
|
3449 | 3448 | $votes = SurveyUtil::comparative_check( |
3450 | 3449 | $answers_x, |
3451 | 3450 | $answers_y, |
@@ -3458,65 +3457,65 @@ discard block |
||
3458 | 3457 | array_push( |
3459 | 3458 | $chartData, |
3460 | 3459 | array( |
3461 | - 'serie' => array($currentYQuestion, $xOptions[$ii-1]), |
|
3460 | + 'serie' => array($currentYQuestion, $xOptions[$ii - 1]), |
|
3462 | 3461 | 'option' => $y, |
3463 | 3462 | 'votes' => $votes |
3464 | 3463 | ) |
3465 | 3464 | ); |
3466 | - $tableHtml .= '</td>'; |
|
3465 | + $tableHtml .= '</td>'; |
|
3467 | 3466 | } |
3468 | 3467 | } |
3469 | 3468 | } |
3470 | - $tableHtml .= ' </tr>'; |
|
3469 | + $tableHtml .= ' </tr>'; |
|
3471 | 3470 | } |
3472 | 3471 | } |
3473 | 3472 | // The Y axis is NOT a score question type so the number of rows = the number of options |
3474 | 3473 | else { |
3475 | - $tableHtml .= ' <tr>'; |
|
3474 | + $tableHtml .= ' <tr>'; |
|
3476 | 3475 | for ($ii = 0; $ii <= count($question_x['answers']); $ii++) { |
3477 | 3476 | if ($question_x['type'] == 'score') { |
3478 | 3477 | for ($x = 1; $x <= $question_x['maximum_score']; $x++) { |
3479 | 3478 | if ($ii == 0) { |
3480 | - $tableHtml .= ' <th>'.$question_y['answers'][$ij].'</th>'; |
|
3479 | + $tableHtml .= ' <th>'.$question_y['answers'][$ij].'</th>'; |
|
3481 | 3480 | break; |
3482 | 3481 | } else { |
3483 | - $tableHtml .= ' <td align="center">'; |
|
3484 | - $votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)], $x, 0); |
|
3482 | + $tableHtml .= ' <td align="center">'; |
|
3483 | + $votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii - 1)], $question_y['answersid'][($ij)], $x, 0); |
|
3485 | 3484 | $tableHtml .= $votes; |
3486 | 3485 | array_push( |
3487 | 3486 | $chartData, |
3488 | 3487 | array( |
3489 | - 'serie' => array($currentYQuestion, $xOptions[$ii-1]), |
|
3488 | + 'serie' => array($currentYQuestion, $xOptions[$ii - 1]), |
|
3490 | 3489 | 'option' => $x, |
3491 | 3490 | 'votes' => $votes |
3492 | 3491 | ) |
3493 | 3492 | ); |
3494 | - $tableHtml .= '</td>'; |
|
3493 | + $tableHtml .= '</td>'; |
|
3495 | 3494 | } |
3496 | 3495 | } |
3497 | 3496 | } else { |
3498 | 3497 | if ($ii == 0) { |
3499 | - $tableHtml .= ' <th>'.$question_y['answers'][($ij)].'</th>'; |
|
3498 | + $tableHtml .= ' <th>'.$question_y['answers'][($ij)].'</th>'; |
|
3500 | 3499 | } else { |
3501 | - $tableHtml .= ' <td align="center">'; |
|
3502 | - $votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii-1)], $question_y['answersid'][($ij)]); |
|
3500 | + $tableHtml .= ' <td align="center">'; |
|
3501 | + $votes = SurveyUtil::comparative_check($answers_x, $answers_y, $question_x['answersid'][($ii - 1)], $question_y['answersid'][($ij)]); |
|
3503 | 3502 | $tableHtml .= $votes; |
3504 | 3503 | array_push( |
3505 | 3504 | $chartData, |
3506 | 3505 | array( |
3507 | - 'serie' => $xOptions[$ii-1], |
|
3506 | + 'serie' => $xOptions[$ii - 1], |
|
3508 | 3507 | 'option' => $currentYQuestion, |
3509 | 3508 | 'votes' => $votes |
3510 | 3509 | ) |
3511 | 3510 | ); |
3512 | - $tableHtml .= '</td>'; |
|
3511 | + $tableHtml .= '</td>'; |
|
3513 | 3512 | } |
3514 | 3513 | } |
3515 | 3514 | } |
3516 | - $tableHtml .= ' </tr>'; |
|
3515 | + $tableHtml .= ' </tr>'; |
|
3517 | 3516 | } |
3518 | 3517 | } |
3519 | - $tableHtml .= '</table>'; |
|
3518 | + $tableHtml .= '</table>'; |
|
3520 | 3519 | echo '<div id="chartContainer" class="col-md-12">'; |
3521 | 3520 | echo self::drawChart($chartData, true); |
3522 | 3521 | echo '</div>'; |
@@ -3656,7 +3655,7 @@ discard block |
||
3656 | 3655 | survey_id='".intval($_GET['survey_id'])."' AND |
3657 | 3656 | session_id='".api_get_session_id()."' "; |
3658 | 3657 | $res = Database::query($sql); |
3659 | - $row = Database::fetch_array($res,'ASSOC'); |
|
3658 | + $row = Database::fetch_array($res, 'ASSOC'); |
|
3660 | 3659 | |
3661 | 3660 | return $row['total']; |
3662 | 3661 | } |
@@ -3731,7 +3730,7 @@ discard block |
||
3731 | 3730 | $exclude_users = SurveyManager::get_people_who_filled_survey($_GET['survey_id']); |
3732 | 3731 | } |
3733 | 3732 | |
3734 | - $counter = 0; // Nr of invitations "sent" (if sendmail option) |
|
3733 | + $counter = 0; // Nr of invitations "sent" (if sendmail option) |
|
3735 | 3734 | $course_id = api_get_course_int_id(); |
3736 | 3735 | $session_id = api_get_session_id(); |
3737 | 3736 | |
@@ -3887,7 +3886,7 @@ discard block |
||
3887 | 3886 | $text_link = '<a href="'.$survey_link.'">'.get_lang('ClickHereToAnswerTheSurvey')."</a><br />\r\n<br />\r\n".get_lang('OrCopyPasteTheFollowingUrl')." <br />\r\n ".$survey_link; |
3888 | 3887 | |
3889 | 3888 | $replace_count = 0; |
3890 | - $full_invitation_text = api_str_ireplace('**link**', $text_link ,$invitation_text, $replace_count); |
|
3889 | + $full_invitation_text = api_str_ireplace('**link**', $text_link, $invitation_text, $replace_count); |
|
3891 | 3890 | if ($replace_count < 1) { |
3892 | 3891 | $full_invitation_text = $full_invitation_text."<br />\r\n<br />\r\n".$text_link; |
3893 | 3892 | } |
@@ -3959,8 +3958,8 @@ discard block |
||
3959 | 3958 | $course_id = api_get_course_int_id(); |
3960 | 3959 | |
3961 | 3960 | // Database table definition |
3962 | - $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
3963 | - $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
3961 | + $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
3962 | + $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
3964 | 3963 | |
3965 | 3964 | // Counting the number of people that are invited |
3966 | 3965 | $sql = "SELECT count(user) as total |
@@ -4074,7 +4073,7 @@ discard block |
||
4074 | 4073 | { |
4075 | 4074 | $course_id = api_get_course_int_id(); |
4076 | 4075 | // Database table definition |
4077 | - $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
4076 | + $table_survey_invitation = Database :: get_course_table(TABLE_SURVEY_INVITATION); |
|
4078 | 4077 | |
4079 | 4078 | $sql = "SELECT * FROM $table_survey_invitation |
4080 | 4079 | WHERE |
@@ -4210,7 +4209,7 @@ discard block |
||
4210 | 4209 | function display_survey_list_for_coach() |
4211 | 4210 | { |
4212 | 4211 | $parameters = array(); |
4213 | - $parameters['cidReq']=api_get_course_id(); |
|
4212 | + $parameters['cidReq'] = api_get_course_id(); |
|
4214 | 4213 | if (isset($_GET['do_search'])) { |
4215 | 4214 | $message = get_lang('DisplaySearchResults').'<br />'; |
4216 | 4215 | $message .= '<a href="'.api_get_self().'?'.api_get_cidreq().'">'.get_lang('DisplayAll').'</a>'; |
@@ -4254,17 +4253,17 @@ discard block |
||
4254 | 4253 | |
4255 | 4254 | if ($drh) { |
4256 | 4255 | return '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'. |
4257 | - Display::return_icon('stats.png', get_lang('Reporting'),'',ICON_SIZE_SMALL).'</a>'; |
|
4256 | + Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).'</a>'; |
|
4258 | 4257 | } |
4259 | 4258 | |
4260 | 4259 | // Coach can see that only if the survey is in his session |
4261 | 4260 | if (api_is_allowed_to_edit() || |
4262 | 4261 | api_is_element_in_the_session(TOOL_SURVEY, $survey_id) |
4263 | 4262 | ) { |
4264 | - $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=edit&survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'; |
|
4263 | + $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/create_new_survey.php?'.api_get_cidreq().'&action=edit&survey_id='.$survey_id.'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'; |
|
4265 | 4264 | if (SurveyManager::survey_generation_hash_available()) { |
4266 | - $return .= Display::url( |
|
4267 | - Display::return_icon('new_link.png', get_lang('GenerateSurveyAccessLink'),'',ICON_SIZE_SMALL), |
|
4265 | + $return .= Display::url( |
|
4266 | + Display::return_icon('new_link.png', get_lang('GenerateSurveyAccessLink'), '', ICON_SIZE_SMALL), |
|
4268 | 4267 | api_get_path(WEB_CODE_PATH).'survey/generate_link.php?survey_id='.$survey_id.'&'.api_get_cidreq() |
4269 | 4268 | ); |
4270 | 4269 | } |
@@ -4274,20 +4273,20 @@ discard block |
||
4274 | 4273 | ); |
4275 | 4274 | |
4276 | 4275 | $return .= ' <a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?')).'\')) return false;">'. |
4277 | - Display::return_icon('clean.png', get_lang('EmptySurvey'),'',ICON_SIZE_SMALL).'</a> '; |
|
4276 | + Display::return_icon('clean.png', get_lang('EmptySurvey'), '', ICON_SIZE_SMALL).'</a> '; |
|
4278 | 4277 | } |
4279 | 4278 | $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'. |
4280 | - Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_SMALL).'</a> '; |
|
4279 | + Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL).'</a> '; |
|
4281 | 4280 | $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'. |
4282 | - Display::return_icon('mail_send.png', get_lang('Publish'),'',ICON_SIZE_SMALL).'</a> '; |
|
4281 | + Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL).'</a> '; |
|
4283 | 4282 | $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'. |
4284 | - Display::return_icon('stats.png', get_lang('Reporting'),'',ICON_SIZE_SMALL).'</a>'; |
|
4283 | + Display::return_icon('stats.png', get_lang('Reporting'), '', ICON_SIZE_SMALL).'</a>'; |
|
4285 | 4284 | |
4286 | 4285 | if (api_is_allowed_to_edit() || |
4287 | 4286 | api_is_element_in_the_session(TOOL_SURVEY, $survey_id) |
4288 | 4287 | ) { |
4289 | 4288 | $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=delete&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?', ENT_QUOTES)).'\')) return false;">'. |
4290 | - Display::return_icon('delete.png', get_lang('Delete'),'',ICON_SIZE_SMALL).'</a> '; |
|
4289 | + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a> '; |
|
4291 | 4290 | } |
4292 | 4291 | |
4293 | 4292 | return $return; |
@@ -4300,9 +4299,9 @@ discard block |
||
4300 | 4299 | //$return .= '<a href="survey_list.php?'.api_get_cidreq().'&action=delete&survey_id='.$survey_id.'" onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang("DeleteSurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('delete.gif', get_lang('Delete')).'</a>'; |
4301 | 4300 | //$return .= '<a href="create_survey_in_another_language.php?id_survey='.$survey_id.'">'.Display::return_icon('copy.gif', get_lang('Copy')).'</a>'; |
4302 | 4301 | //$return .= '<a href="survey.php?survey_id='.$survey_id.'">'.Display::return_icon('add.gif', get_lang('Add')).'</a>'; |
4303 | - $return = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'),'',ICON_SIZE_SMALL).'</a> '; |
|
4304 | - $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'),'',ICON_SIZE_SMALL).'</a> '; |
|
4305 | - $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('clean.png', get_lang('EmptySurvey'),'',ICON_SIZE_SMALL).'</a> '; |
|
4302 | + $return = '<a href="'.api_get_path(WEB_CODE_PATH).'survey/preview.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('preview_view.png', get_lang('Preview'), '', ICON_SIZE_SMALL).'</a> '; |
|
4303 | + $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_invite.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('mail_send.png', get_lang('Publish'), '', ICON_SIZE_SMALL).'</a> '; |
|
4304 | + $return .= '<a href="'.api_get_path(WEB_CODE_PATH).'survey/survey_list.php?'.api_get_cidreq().'&action=empty&survey_id='.$survey_id.'" onclick="javascript: if(!confirm(\''.addslashes(api_htmlentities(get_lang("EmptySurvey").'?', ENT_QUOTES)).'\')) return false;">'.Display::return_icon('clean.png', get_lang('EmptySurvey'), '', ICON_SIZE_SMALL).'</a> '; |
|
4306 | 4305 | //$return .= '<a href="reporting.php?'.api_get_cidreq().'&survey_id='.$survey_id.'">'.Display::return_icon('statistics.gif', get_lang('Reporting')).'</a>'; |
4307 | 4306 | return $return; |
4308 | 4307 | } |
@@ -4457,7 +4456,7 @@ discard block |
||
4457 | 4456 | |
4458 | 4457 | // Validation when belonging to a session |
4459 | 4458 | $session_img = api_get_session_image($survey['session_id'], $_user['status']); |
4460 | - $array[2] = $survey[2] . $session_img; |
|
4459 | + $array[2] = $survey[2].$session_img; |
|
4461 | 4460 | $array[3] = $survey[3]; |
4462 | 4461 | $array[4] = $survey[4]; |
4463 | 4462 | $array[5] = $survey[5]; |
@@ -4491,10 +4490,10 @@ discard block |
||
4491 | 4490 | $last_version_surveys = $survey_tree->get_last_children_from_branch($survey_tree->surveylist); |
4492 | 4491 | $list = array(); |
4493 | 4492 | foreach ($last_version_surveys as & $survey) { |
4494 | - $list[]=$survey['id']; |
|
4493 | + $list[] = $survey['id']; |
|
4495 | 4494 | } |
4496 | 4495 | if (count($list) > 0) { |
4497 | - $list_condition = " AND survey.survey_id IN (".implode(',',$list).") "; |
|
4496 | + $list_condition = " AND survey.survey_id IN (".implode(',', $list).") "; |
|
4498 | 4497 | } else { |
4499 | 4498 | $list_condition = ''; |
4500 | 4499 | } |
@@ -4506,9 +4505,9 @@ discard block |
||
4506 | 4505 | $direction = 'asc'; |
4507 | 4506 | } |
4508 | 4507 | |
4509 | - $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
4510 | - $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
4511 | - $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
4508 | + $table_survey = Database :: get_course_table(TABLE_SURVEY); |
|
4509 | + $table_survey_question = Database :: get_course_table(TABLE_SURVEY_QUESTION); |
|
4510 | + $table_user = Database :: get_main_table(TABLE_MAIN_USER); |
|
4512 | 4511 | |
4513 | 4512 | $course_id = api_get_course_int_id(); |
4514 | 4513 | |
@@ -4623,16 +4622,16 @@ discard block |
||
4623 | 4622 | ) |
4624 | 4623 | "; |
4625 | 4624 | $result_answer = Database::query($sql); |
4626 | - $row_answer = Database::fetch_array($result_answer,'ASSOC'); |
|
4625 | + $row_answer = Database::fetch_array($result_answer, 'ASSOC'); |
|
4627 | 4626 | echo '<tr>'; |
4628 | 4627 | if ($row['answered'] == 0) { |
4629 | 4628 | echo '<td>'; |
4630 | - echo Display::return_icon('statistics.png', get_lang('CreateNewSurvey'),array('style'=>'inline-block'),ICON_SIZE_TINY); |
|
4629 | + echo Display::return_icon('statistics.png', get_lang('CreateNewSurvey'), array('style'=>'inline-block'), ICON_SIZE_TINY); |
|
4631 | 4630 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/fillsurvey.php?course='.$_course['sysCode'].'&invitationcode='.$row['invitation_code'].'&cidReq='.$_course['sysCode'].'">'.$row['title'].'</a></td>'; |
4632 | 4631 | } else { |
4633 | 4632 | //echo '<td>'.$row['title'].'</td>'; |
4634 | 4633 | echo '<td>'; |
4635 | - echo Display::return_icon('statistics_na.png', get_lang('CreateNewSurvey'),array('style'=>'inline-block'),ICON_SIZE_TINY); |
|
4634 | + echo Display::return_icon('statistics_na.png', get_lang('CreateNewSurvey'), array('style'=>'inline-block'), ICON_SIZE_TINY); |
|
4636 | 4635 | echo '<a href="'.api_get_path(WEB_CODE_PATH).'survey/reporting.php?action=questionreport&cidReq='.$_course['sysCode'].'&id_session='.$row['session_id'].'&gidReq='.'0'.'&origin='.''.'&survey_id='.$row['survey_id'].'">'.$row['title'].'</a></td>'; |
4637 | 4636 | } |
4638 | 4637 | echo '<td class="center">'; |
@@ -4644,7 +4643,7 @@ discard block |
||
4644 | 4643 | } else { |
4645 | 4644 | $current_user_id = api_get_user_id(); |
4646 | 4645 | } |
4647 | - $link_available = self::show_link_available(api_get_user_id(),$row['code'],$current_user_id); |
|
4646 | + $link_available = self::show_link_available(api_get_user_id(), $row['code'], $current_user_id); |
|
4648 | 4647 | //todo check this link |
4649 | 4648 | if ($link_add === true && $link_available === true) { |
4650 | 4649 | //echo '<tr><td><a href="fillsurvey.php?user_id='.api_get_user_id().'&course='.$_course['sysCode'].'&invitationcode='.$row['invitation_code'].'&cidReq='.$_course['sysCode'].'">'.get_lang('CompleteTheSurveysQuestions').'</a></td><td></td></tr>'; |
@@ -4789,7 +4788,7 @@ discard block |
||
4789 | 4788 | if ($field_details[7] == 0) { |
4790 | 4789 | $field_list_array['extra_'.$field_details[1]]['visibility'] = 0; |
4791 | 4790 | } else { |
4792 | - $field_list_array['extra_'.$field_details[1]]['visibility']=1; |
|
4791 | + $field_list_array['extra_'.$field_details[1]]['visibility'] = 1; |
|
4793 | 4792 | } |
4794 | 4793 | break; |
4795 | 4794 | case UserManager::USER_FIELD_TYPE_DIVIDER: |
@@ -4856,7 +4855,7 @@ discard block |
||
4856 | 4855 | $htmlChart = ''; |
4857 | 4856 | if (api_browser_support("svg")) { |
4858 | 4857 | $htmlChart .= api_get_js("d3/d3.v3.5.4.min.js"); |
4859 | - $htmlChart .= api_get_js("dimple.v2.1.2.min.js") . ' |
|
4858 | + $htmlChart .= api_get_js("dimple.v2.1.2.min.js").' |
|
4860 | 4859 | <script type="text/javascript"> |
4861 | 4860 | var svg = dimple.newSvg("#'.$chartContainerId.'", "100%", 400); |
4862 | 4861 | var data = ['; |
@@ -4865,40 +4864,40 @@ discard block |
||
4865 | 4864 | foreach ($chartData as $chartDataElement) { |
4866 | 4865 | $htmlChart .= '{"'; |
4867 | 4866 | if (!$hasSerie) { |
4868 | - $htmlChart .= get_lang("Option") . '":"' . $chartDataElement['option'] . '", "'; |
|
4867 | + $htmlChart .= get_lang("Option").'":"'.$chartDataElement['option'].'", "'; |
|
4869 | 4868 | array_push($order, $chartDataElement['option']); |
4870 | 4869 | } else { |
4871 | 4870 | if (!is_array($chartDataElement['serie'])) { |
4872 | - $htmlChart .= get_lang("Option") . '":"' . $chartDataElement['serie'] . '", "' . |
|
4873 | - get_lang("Score") . '":"' . $chartDataElement['option'] . '", "'; |
|
4871 | + $htmlChart .= get_lang("Option").'":"'.$chartDataElement['serie'].'", "'. |
|
4872 | + get_lang("Score").'":"'.$chartDataElement['option'].'", "'; |
|
4874 | 4873 | array_push($serie, $chartDataElement['serie']); |
4875 | 4874 | } else { |
4876 | - $htmlChart .= get_lang("Serie") . '":"' . $chartDataElement['serie'][0] . '", "' . |
|
4877 | - get_lang("Option") . '":"' . $chartDataElement['serie'][1] . '", "' . |
|
4878 | - get_lang("Score") . '":"' . $chartDataElement['option'] . '", "'; |
|
4875 | + $htmlChart .= get_lang("Serie").'":"'.$chartDataElement['serie'][0].'", "'. |
|
4876 | + get_lang("Option").'":"'.$chartDataElement['serie'][1].'", "'. |
|
4877 | + get_lang("Score").'":"'.$chartDataElement['option'].'", "'; |
|
4879 | 4878 | } |
4880 | 4879 | } |
4881 | - $htmlChart .= get_lang("Votes") . '":"' . $chartDataElement['votes'] . |
|
4880 | + $htmlChart .= get_lang("Votes").'":"'.$chartDataElement['votes']. |
|
4882 | 4881 | '"},'; |
4883 | 4882 | } |
4884 | 4883 | rtrim($htmlChart, ","); |
4885 | 4884 | $htmlChart .= ']; |
4886 | 4885 | var myChart = new dimple.chart(svg, data); |
4887 | - myChart.addMeasureAxis("y", "' . get_lang("Votes") . '");'; |
|
4886 | + myChart.addMeasureAxis("y", "' . get_lang("Votes").'");'; |
|
4888 | 4887 | if (!$hasSerie) { |
4889 | - $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", "' . get_lang("Option") . '"); |
|
4890 | - xAxisCategory.addOrderRule(' . json_encode($order) . '); |
|
4891 | - myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);'; |
|
4888 | + $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", "'.get_lang("Option").'"); |
|
4889 | + xAxisCategory.addOrderRule(' . json_encode($order).'); |
|
4890 | + myChart.addSeries("' . get_lang("Option").'", dimple.plot.bar);'; |
|
4892 | 4891 | } else { |
4893 | 4892 | if (!is_array($chartDataElement['serie'])) { |
4894 | 4893 | $serie = array_values(array_unique($serie)); |
4895 | - $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]); |
|
4896 | - xAxisCategory.addOrderRule(' . json_encode($serie) . '); |
|
4897 | - xAxisCategory.addGroupOrderRule("' . get_lang("Score") . '"); |
|
4898 | - myChart.addSeries("' . get_lang("Option") . '", dimple.plot.bar);'; |
|
4894 | + $htmlChart .= 'var xAxisCategory = myChart.addCategoryAxis("x", ["'.get_lang("Option").'","'.get_lang("Score").'"]); |
|
4895 | + xAxisCategory.addOrderRule(' . json_encode($serie).'); |
|
4896 | + xAxisCategory.addGroupOrderRule("' . get_lang("Score").'"); |
|
4897 | + myChart.addSeries("' . get_lang("Option").'", dimple.plot.bar);'; |
|
4899 | 4898 | } else { |
4900 | - $htmlChart .= 'myChart.addCategoryAxis("x", ["' . get_lang("Option") . '","' . get_lang("Score") . '"]); |
|
4901 | - myChart.addSeries("' . get_lang("Serie") . '", dimple.plot.bar);'; |
|
4899 | + $htmlChart .= 'myChart.addCategoryAxis("x", ["'.get_lang("Option").'","'.get_lang("Score").'"]); |
|
4900 | + myChart.addSeries("' . get_lang("Serie").'", dimple.plot.bar);'; |
|
4902 | 4901 | } |
4903 | 4902 | } |
4904 | 4903 | $htmlChart .= 'myChart.draw(); |
@@ -1247,7 +1247,7 @@ discard block |
||
1247 | 1247 | '".Database::escape_string($_course['id'])."')"; |
1248 | 1248 | Database::query($sql); |
1249 | 1249 | $shared_question_id = Database::insert_id(); |
1250 | - } else { |
|
1250 | + } else { |
|
1251 | 1251 | // Updating an existing question |
1252 | 1252 | // adding the question to the survey_question table |
1253 | 1253 | $sql = "UPDATE $tbl_survey_question SET |
@@ -2776,14 +2776,12 @@ discard block |
||
2776 | 2776 | echo $answers_of_user[$question_id][$option_id]['value']; |
2777 | 2777 | echo "</td>"; |
2778 | 2778 | } |
2779 | - } |
|
2780 | - else { |
|
2779 | + } else { |
|
2781 | 2780 | echo '<td align="center">'; |
2782 | 2781 | if (!empty($answers_of_user[$question_id][$option_id])) { |
2783 | 2782 | if ($answers_of_user[$question_id][$option_id]['value'] != 0) { |
2784 | 2783 | echo $answers_of_user[$question_id][$option_id]['value']; |
2785 | - } |
|
2786 | - else { |
|
2784 | + } else { |
|
2787 | 2785 | echo 'v'; |
2788 | 2786 | } |
2789 | 2787 | } |
@@ -735,7 +735,6 @@ |
||
735 | 735 | * lock = the user can no longer use this account |
736 | 736 | * @author Patrick Cool <[email protected]>, Ghent University |
737 | 737 | * @param int $active the current state of the account |
738 | - * @param int $user_id The user id |
|
739 | 738 | * @param string $urlParams |
740 | 739 | * |
741 | 740 | * @return string Some HTML-code with the lock/unlock button |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | */ |
14 | 14 | $use_anonymous = true; |
15 | 15 | require_once '../inc/global.inc.php'; |
16 | -$current_course_tool = TOOL_USER; |
|
16 | +$current_course_tool = TOOL_USER; |
|
17 | 17 | $this_section = SECTION_COURSES; |
18 | 18 | |
19 | 19 | // notice for unauthorized people. |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | |
42 | 42 | //Can't auto unregister from a session |
43 | 43 | if (!empty($sessionId)) { |
44 | - $course_info['unsubscribe'] = 0; |
|
44 | + $course_info['unsubscribe'] = 0; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /* Unregistering a user section */ |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | '#', |
185 | 185 | get_lang('UserPicture'), |
186 | 186 | get_lang('OfficialCode'), |
187 | - get_lang('FirstName') . ', ' . get_lang('LastName'), |
|
187 | + get_lang('FirstName').', '.get_lang('LastName'), |
|
188 | 188 | get_lang('Email'), |
189 | 189 | get_lang('Phone') |
190 | 190 | ); |
@@ -193,7 +193,7 @@ discard block |
||
193 | 193 | '#', |
194 | 194 | get_lang('UserPicture'), |
195 | 195 | get_lang('OfficialCode'), |
196 | - get_lang('LastName') . ', ' . get_lang('FirstName'), |
|
196 | + get_lang('LastName').', '.get_lang('FirstName'), |
|
197 | 197 | get_lang('Email'), |
198 | 198 | get_lang('Phone') |
199 | 199 | ); |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | if (api_is_multiple_url_enabled()) { |
219 | 219 | $sql .= ' , '.Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER).' au '; |
220 | 220 | } |
221 | - $sql .=" WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id "; |
|
221 | + $sql .= " WHERE c_id = '$courseId' AND session_course_user.user_id = user.user_id "; |
|
222 | 222 | $sql .= ' AND session_id = '.$sessionId; |
223 | 223 | |
224 | 224 | if (api_is_multiple_url_enabled()) { |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | true |
253 | 253 | ); |
254 | 254 | if (!empty($extra_fields)) { |
255 | - foreach($extra_fields as $key => $extra_value) { |
|
255 | + foreach ($extra_fields as $key => $extra_value) { |
|
256 | 256 | $user[$key] = $extra_value; |
257 | 257 | } |
258 | 258 | } |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | $counter, |
267 | 267 | $user_image, |
268 | 268 | $user['official_code'], |
269 | - $user['firstname'] . ', ' . $user['lastname'], |
|
269 | + $user['firstname'].', '.$user['lastname'], |
|
270 | 270 | $user['email'], |
271 | 271 | $user['phone'] |
272 | 272 | ); |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | $counter, |
276 | 276 | $user_image, |
277 | 277 | $user['official_code'], |
278 | - $user['lastname'] . ', ' . $user['firstname'], |
|
278 | + $user['lastname'].', '.$user['firstname'], |
|
279 | 279 | $user['email'], |
280 | 280 | $user['phone'] |
281 | 281 | ); |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | $counter, |
355 | 355 | $user_image, |
356 | 356 | $user['official_code'], |
357 | - $user['firstname'] . ', ' . $user['lastname'], |
|
357 | + $user['firstname'].', '.$user['lastname'], |
|
358 | 358 | $user['email'], |
359 | 359 | $user['phone'] |
360 | 360 | ); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | $counter, |
364 | 364 | $user_image, |
365 | 365 | $user['official_code'], |
366 | - $user['lastname'] . ', ' . $user['firstname'], |
|
366 | + $user['lastname'].', '.$user['firstname'], |
|
367 | 367 | $user['email'], |
368 | 368 | $user['phone'] |
369 | 369 | ); |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | $userInfo = api_get_user_info($user_id); |
701 | 701 | $userPicture = $userInfo['avatar']; |
702 | 702 | |
703 | - $photo= '<img src="'.$userPicture.'" alt="'.$userInfo['complete_name'].'" width="22" height="22" title="'.$userInfo['complete_name'].'" />'; |
|
703 | + $photo = '<img src="'.$userPicture.'" alt="'.$userInfo['complete_name'].'" width="22" height="22" title="'.$userInfo['complete_name'].'" />'; |
|
704 | 704 | |
705 | 705 | $temp[] = $user_id; |
706 | 706 | $temp[] = $photo; |
@@ -821,7 +821,7 @@ discard block |
||
821 | 821 | if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' or api_is_platform_admin()) { |
822 | 822 | // unregister |
823 | 823 | if ($user_id != $current_user_id || api_is_platform_admin()) { |
824 | - $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;">'. |
|
824 | + $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">'. |
|
825 | 825 | get_lang('Unreg').'</a> '; |
826 | 826 | } else { |
827 | 827 | //$result .= Display::return_icon('unsubscribe_course_na.png', get_lang('Unreg'),'',ICON_SIZE_SMALL).'</a> '; |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | // Show buttons for unsubscribe |
832 | 832 | if ($course_info['unsubscribe'] == 1) { |
833 | 833 | if ($user_id == $current_user_id) { |
834 | - $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'),ENT_QUOTES,$charset)).'\')) return false;">'. |
|
834 | + $result .= '<a class="btn btn-small btn-danger" href="'.api_get_self().'?'.api_get_cidreq().'&type='.$type.'&unregister=yes&user_id='.$user_id.'" title="'.get_lang('Unreg').' " onclick="javascript:if(!confirm(\''.addslashes(api_htmlentities(get_lang('ConfirmYourChoice'), ENT_QUOTES, $charset)).'\')) return false;">'. |
|
835 | 835 | get_lang('Unreg').'</a> '; |
836 | 836 | } |
837 | 837 | } |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | |
908 | 908 | // Actions column |
909 | 909 | $table->set_header($header_nr++, get_lang('Action'), false); |
910 | - $table->set_column_filter($header_nr-1, 'modify_filter'); |
|
910 | + $table->set_column_filter($header_nr - 1, 'modify_filter'); |
|
911 | 911 | |
912 | 912 | if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true') { |
913 | 913 | $table->set_form_actions(array('unsubscribe' => get_lang('Unreg')), 'user'); |
@@ -915,7 +915,7 @@ discard block |
||
915 | 915 | } else { |
916 | 916 | if ($course_info['unsubscribe'] == 1) { |
917 | 917 | $table->set_header($header_nr++, get_lang('Action'), false); |
918 | - $table->set_column_filter($header_nr-1, 'modify_filter'); |
|
918 | + $table->set_column_filter($header_nr - 1, 'modify_filter'); |
|
919 | 919 | } |
920 | 920 | } |
921 | 921 | |
@@ -971,19 +971,19 @@ discard block |
||
971 | 971 | echo '<div class="col-md-6">'; |
972 | 972 | echo $icon; |
973 | 973 | $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=csv&type='.$type.'">'. |
974 | - Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
974 | + Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
975 | 975 | $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=xls&type='.$type.'">'. |
976 | - Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
976 | + Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
977 | 977 | |
978 | 978 | if (api_get_setting('allow_user_course_subscription_by_course_admin') == 'true' || |
979 | 979 | api_is_platform_admin() |
980 | 980 | ) { |
981 | 981 | $actions .= '<a href="user_import.php?'.api_get_cidreq().'&action=import">'. |
982 | - Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
982 | + Display::return_icon('import_csv.png', get_lang('ImportUsersToACourse'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
983 | 983 | } |
984 | 984 | |
985 | 985 | $actions .= '<a href="user.php?'.api_get_cidreq().'&action=export&format=pdf&type='.$type.'">'. |
986 | - Display::return_icon('pdf.png', get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a> '; |
|
986 | + Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a> '; |
|
987 | 987 | echo $actions; |
988 | 988 | |
989 | 989 | echo '</div>'; |
@@ -1,9 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | /* For licensing terms, see /license.txt */ |
3 | 3 | |
4 | -use Chamilo\CoreBundle\Entity\ExtraField as EntityExtraField; |
|
5 | -use Chamilo\UserBundle\Entity\User; |
|
6 | - |
|
7 | 4 | /** |
8 | 5 | * @package chamilo.webservices |
9 | 6 | */ |
@@ -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 |
@@ -58,19 +58,22 @@ discard block |
||
58 | 58 | list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
59 | 59 | $ip = trim($ip1); |
60 | 60 | } |
61 | - if ($debug) |
|
62 | - error_log("ip: $ip"); |
|
61 | + if ($debug) { |
|
62 | + error_log("ip: $ip"); |
|
63 | + } |
|
63 | 64 | // Check if a file that limits access from webservices exists and contains |
64 | 65 | // the restraining check |
65 | 66 | if (is_file('webservice-auth-ip.conf.php')) { |
66 | 67 | include 'webservice-auth-ip.conf.php'; |
67 | - if ($debug) |
|
68 | - error_log("webservice-auth-ip.conf.php file included"); |
|
68 | + if ($debug) { |
|
69 | + error_log("webservice-auth-ip.conf.php file included"); |
|
70 | + } |
|
69 | 71 | if (!empty($ws_auth_ip)) { |
70 | 72 | $check_ip = true; |
71 | 73 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
72 | - if ($debug) |
|
73 | - error_log("ip_matches: $ip_matches"); |
|
74 | + if ($debug) { |
|
75 | + error_log("ip_matches: $ip_matches"); |
|
76 | + } |
|
74 | 77 | } |
75 | 78 | } |
76 | 79 | |
@@ -87,8 +90,9 @@ discard block |
||
87 | 90 | |
88 | 91 | $result = api_is_valid_secret_key($secret_key, $security_key); |
89 | 92 | //error_log($secret_key.'-'.$security_key); |
90 | - if ($debug) |
|
91 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
93 | + if ($debug) { |
|
94 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
95 | + } |
|
92 | 96 | return $result; |
93 | 97 | } |
94 | 98 |
@@ -20,6 +20,9 @@ |
||
20 | 20 | |
21 | 21 | define('WS_ERROR_SECRET_KEY', 1); |
22 | 22 | |
23 | +/** |
|
24 | + * @param integer $code |
|
25 | + */ |
|
23 | 26 | function return_error($code) { |
24 | 27 | $fault = null; |
25 | 28 | switch ($code) { |
@@ -84,7 +84,7 @@ |
||
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
87 | - * @param $directoryPath |
|
87 | + * @param string $directoryPath |
|
88 | 88 | * @return bool |
89 | 89 | */ |
90 | 90 | function deleteDirectory($directoryPath) |
@@ -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); |
@@ -32,6 +32,8 @@ discard block |
||
32 | 32 | * |
33 | 33 | * @param int Error code |
34 | 34 | * @param string Error message |
35 | + * @param integer $code |
|
36 | + * @param string $message |
|
35 | 37 | */ |
36 | 38 | public function __construct($code, $message) { |
37 | 39 | $this->code = $code; |
@@ -42,6 +44,7 @@ discard block |
||
42 | 44 | * Sets the error handler |
43 | 45 | * |
44 | 46 | * @param WSErrorHandler Error handler |
47 | + * @param WSCMSoapErrorHandler $handler |
|
45 | 48 | */ |
46 | 49 | public static function setErrorHandler($handler) { |
47 | 50 | if($handler instanceof WSErrorHandler) { |
@@ -76,6 +79,7 @@ discard block |
||
76 | 79 | * Handle method |
77 | 80 | * |
78 | 81 | * @param WSError Error |
82 | + * @return void |
|
79 | 83 | */ |
80 | 84 | public function handle($error); |
81 | 85 | } |
@@ -102,7 +106,7 @@ discard block |
||
102 | 106 | * Verifies the API key |
103 | 107 | * |
104 | 108 | * @param string Secret key |
105 | - * @return mixed WSError in case of failure, null in case of success |
|
109 | + * @return WSCMError|null WSError in case of failure, null in case of success |
|
106 | 110 | */ |
107 | 111 | protected function verifyKey($secret_key) { |
108 | 112 | $ip = trim($_SERVER['REMOTE_ADDR']); |
@@ -6,120 +6,120 @@ discard block |
||
6 | 6 | * Error returned by one of the methods of the web service. Contains an error code and an error message |
7 | 7 | */ |
8 | 8 | class WSCMError { |
9 | - /** |
|
10 | - * Error handler. This needs to be a class that implements the interface WSErrorHandler |
|
11 | - * |
|
12 | - * @var WSErrorHandler |
|
13 | - */ |
|
14 | - protected static $_handler; |
|
9 | + /** |
|
10 | + * Error handler. This needs to be a class that implements the interface WSErrorHandler |
|
11 | + * |
|
12 | + * @var WSErrorHandler |
|
13 | + */ |
|
14 | + protected static $_handler; |
|
15 | 15 | |
16 | - /** |
|
17 | - * Error code |
|
18 | - * |
|
19 | - * @var int |
|
20 | - */ |
|
21 | - public $code; |
|
16 | + /** |
|
17 | + * Error code |
|
18 | + * |
|
19 | + * @var int |
|
20 | + */ |
|
21 | + public $code; |
|
22 | 22 | |
23 | - /** |
|
24 | - * Error message |
|
25 | - * |
|
26 | - * @var string |
|
27 | - */ |
|
28 | - public $message; |
|
23 | + /** |
|
24 | + * Error message |
|
25 | + * |
|
26 | + * @var string |
|
27 | + */ |
|
28 | + public $message; |
|
29 | 29 | |
30 | - /** |
|
31 | - * Constructor |
|
32 | - * |
|
33 | - * @param int Error code |
|
34 | - * @param string Error message |
|
35 | - */ |
|
36 | - public function __construct($code, $message) { |
|
37 | - $this->code = $code; |
|
38 | - $this->message = $message; |
|
39 | - } |
|
30 | + /** |
|
31 | + * Constructor |
|
32 | + * |
|
33 | + * @param int Error code |
|
34 | + * @param string Error message |
|
35 | + */ |
|
36 | + public function __construct($code, $message) { |
|
37 | + $this->code = $code; |
|
38 | + $this->message = $message; |
|
39 | + } |
|
40 | 40 | |
41 | - /** |
|
42 | - * Sets the error handler |
|
43 | - * |
|
44 | - * @param WSErrorHandler Error handler |
|
45 | - */ |
|
46 | - public static function setErrorHandler($handler) { |
|
47 | - if($handler instanceof WSErrorHandler) { |
|
48 | - self::$_handler = $handler; |
|
49 | - } |
|
50 | - } |
|
41 | + /** |
|
42 | + * Sets the error handler |
|
43 | + * |
|
44 | + * @param WSErrorHandler Error handler |
|
45 | + */ |
|
46 | + public static function setErrorHandler($handler) { |
|
47 | + if($handler instanceof WSErrorHandler) { |
|
48 | + self::$_handler = $handler; |
|
49 | + } |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Returns the error handler |
|
54 | - * |
|
55 | - * @return WSErrorHandler Error handler |
|
56 | - */ |
|
57 | - public static function getErrorHandler() { |
|
58 | - return self::$_handler; |
|
59 | - } |
|
52 | + /** |
|
53 | + * Returns the error handler |
|
54 | + * |
|
55 | + * @return WSErrorHandler Error handler |
|
56 | + */ |
|
57 | + public static function getErrorHandler() { |
|
58 | + return self::$_handler; |
|
59 | + } |
|
60 | 60 | |
61 | - /** |
|
62 | - * Transforms the error into an array |
|
63 | - * |
|
64 | - * @return array Associative array with code and message |
|
65 | - */ |
|
66 | - public function toArray() { |
|
67 | - return array('code' => $this->code, 'message' => $this->message); |
|
68 | - } |
|
61 | + /** |
|
62 | + * Transforms the error into an array |
|
63 | + * |
|
64 | + * @return array Associative array with code and message |
|
65 | + */ |
|
66 | + public function toArray() { |
|
67 | + return array('code' => $this->code, 'message' => $this->message); |
|
68 | + } |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
72 | 72 | * Interface that must be implemented by any error handler |
73 | 73 | */ |
74 | 74 | interface WSCMErrorHandler { |
75 | - /** |
|
76 | - * Handle method |
|
77 | - * |
|
78 | - * @param WSError Error |
|
79 | - */ |
|
80 | - public function handle($error); |
|
75 | + /** |
|
76 | + * Handle method |
|
77 | + * |
|
78 | + * @param WSError Error |
|
79 | + */ |
|
80 | + public function handle($error); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
84 | 84 | * Main class of the webservice. Webservice classes extend this class |
85 | 85 | */ |
86 | 86 | class WSCM { |
87 | - /** |
|
88 | - * Chamilo configuration |
|
89 | - * |
|
90 | - * @var array |
|
91 | - */ |
|
92 | - protected $_configuration; |
|
87 | + /** |
|
88 | + * Chamilo configuration |
|
89 | + * |
|
90 | + * @var array |
|
91 | + */ |
|
92 | + protected $_configuration; |
|
93 | 93 | |
94 | - /** |
|
95 | - * Constructor |
|
96 | - */ |
|
97 | - public function __construct() { |
|
98 | - $this->_configuration = $GLOBALS['_configuration']; |
|
99 | - } |
|
94 | + /** |
|
95 | + * Constructor |
|
96 | + */ |
|
97 | + public function __construct() { |
|
98 | + $this->_configuration = $GLOBALS['_configuration']; |
|
99 | + } |
|
100 | 100 | |
101 | - /** |
|
102 | - * Verifies the API key |
|
103 | - * |
|
104 | - * @param string Secret key |
|
105 | - * @return mixed WSError in case of failure, null in case of success |
|
106 | - */ |
|
107 | - protected function verifyKey($secret_key) { |
|
108 | - $ip = trim($_SERVER['REMOTE_ADDR']); |
|
109 | - // if we are behind a reverse proxy, assume it will send the |
|
110 | - // HTTP_X_FORWARDED_FOR header and use this IP instead |
|
111 | - if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
112 | - list($ip1,$ip2) = split(',',$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
113 | - $ip = trim($ip1); |
|
114 | - } |
|
115 | - $security_key = $ip.$this->_configuration['security_key']; |
|
101 | + /** |
|
102 | + * Verifies the API key |
|
103 | + * |
|
104 | + * @param string Secret key |
|
105 | + * @return mixed WSError in case of failure, null in case of success |
|
106 | + */ |
|
107 | + protected function verifyKey($secret_key) { |
|
108 | + $ip = trim($_SERVER['REMOTE_ADDR']); |
|
109 | + // if we are behind a reverse proxy, assume it will send the |
|
110 | + // HTTP_X_FORWARDED_FOR header and use this IP instead |
|
111 | + if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
112 | + list($ip1,$ip2) = split(',',$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
113 | + $ip = trim($ip1); |
|
114 | + } |
|
115 | + $security_key = $ip.$this->_configuration['security_key']; |
|
116 | 116 | |
117 | - if(!api_is_valid_secret_key($secret_key, $security_key)) { |
|
118 | - return new WSCMError(1, "API key is invalid"); |
|
119 | - } else { |
|
120 | - return null; |
|
121 | - } |
|
122 | - } |
|
117 | + if(!api_is_valid_secret_key($secret_key, $security_key)) { |
|
118 | + return new WSCMError(1, "API key is invalid"); |
|
119 | + } else { |
|
120 | + return null; |
|
121 | + } |
|
122 | + } |
|
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Verifies if the user is valid |
@@ -134,12 +134,12 @@ discard block |
||
134 | 134 | $login = $username; |
135 | 135 | $password = $pass; |
136 | 136 | |
137 | - //lookup the user in the main database |
|
137 | + //lookup the user in the main database |
|
138 | 138 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
139 | - $sql = "SELECT user_id, username, password, auth_source, active, expiration_date |
|
139 | + $sql = "SELECT user_id, username, password, auth_source, active, expiration_date |
|
140 | 140 | FROM $user_table |
141 | 141 | WHERE username = '".trim(addslashes($login))."'"; |
142 | - $result = Database::query($sql); |
|
142 | + $result = Database::query($sql); |
|
143 | 143 | |
144 | 144 | if (Database::num_rows($result) > 0) { |
145 | 145 | $uData = Database::fetch_array($result); |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | |
172 | 172 | /** |
173 | 173 | * Return the encrypted pass |
174 | - * @deprecated |
|
174 | + * @deprecated |
|
175 | 175 | * @param <String> $pass |
176 | 176 | * @return <String> $pass encrypted |
177 | 177 | */ |
@@ -180,112 +180,112 @@ discard block |
||
180 | 180 | }*/ |
181 | 181 | |
182 | 182 | /** |
183 | - * Gets the real user id based on the user id field name and value. Note that if the user id field name is "chamilo_user_id", it will use the user id |
|
184 | - * in the system database |
|
185 | - * |
|
186 | - * @param string User id field name |
|
187 | - * @param string User id value |
|
188 | - * @return mixed System user id if the user was found, WSError otherwise |
|
189 | - */ |
|
190 | - protected function getUserId($user_id_field_name, $user_id_value) { |
|
191 | - if($user_id_field_name == "chamilo_user_id") { |
|
192 | - if(UserManager::is_user_id_valid(intval($user_id_value))) { |
|
193 | - return intval($user_id_value); |
|
194 | - } else { |
|
195 | - return new WSCMError(100, "User not found"); |
|
196 | - } |
|
197 | - } else { |
|
198 | - $user_id = UserManager::get_user_id_from_original_id($user_id_value, $user_id_field_name); |
|
199 | - if($user_id == 0) { |
|
200 | - return new WSCMError(100, "User not found"); |
|
201 | - } else { |
|
202 | - return $user_id; |
|
203 | - } |
|
204 | - } |
|
205 | - } |
|
183 | + * Gets the real user id based on the user id field name and value. Note that if the user id field name is "chamilo_user_id", it will use the user id |
|
184 | + * in the system database |
|
185 | + * |
|
186 | + * @param string User id field name |
|
187 | + * @param string User id value |
|
188 | + * @return mixed System user id if the user was found, WSError otherwise |
|
189 | + */ |
|
190 | + protected function getUserId($user_id_field_name, $user_id_value) { |
|
191 | + if($user_id_field_name == "chamilo_user_id") { |
|
192 | + if(UserManager::is_user_id_valid(intval($user_id_value))) { |
|
193 | + return intval($user_id_value); |
|
194 | + } else { |
|
195 | + return new WSCMError(100, "User not found"); |
|
196 | + } |
|
197 | + } else { |
|
198 | + $user_id = UserManager::get_user_id_from_original_id($user_id_value, $user_id_field_name); |
|
199 | + if($user_id == 0) { |
|
200 | + return new WSCMError(100, "User not found"); |
|
201 | + } else { |
|
202 | + return $user_id; |
|
203 | + } |
|
204 | + } |
|
205 | + } |
|
206 | 206 | |
207 | - /** |
|
208 | - * Gets the real course id based on the course id field name and value. Note that if the course id field name is "chamilo_course_id", it will use the course id |
|
209 | - * in the system database |
|
210 | - * |
|
211 | - * @param string Course id field name |
|
212 | - * @param string Course id value |
|
213 | - * @return mixed System course id if the course was found, WSError otherwise |
|
214 | - */ |
|
215 | - protected function getCourseId($course_id_field_name, $course_id_value) { |
|
216 | - if($course_id_field_name == "chamilo_course_id") { |
|
217 | - if(CourseManager::get_course_code_from_course_id(intval($course_id_value)) != null) { |
|
218 | - return intval($course_id_value); |
|
219 | - } else { |
|
220 | - return new WSCMError(200, "Course not found"); |
|
221 | - } |
|
222 | - } else { |
|
223 | - $courseId = CourseManager::get_course_code_from_original_id($course_id_value, $course_id_field_name); |
|
224 | - if (empty($courseId)) { |
|
225 | - return new WSCMError(200, "Course not found"); |
|
226 | - } else { |
|
227 | - return $courseId; |
|
228 | - } |
|
229 | - } |
|
230 | - } |
|
207 | + /** |
|
208 | + * Gets the real course id based on the course id field name and value. Note that if the course id field name is "chamilo_course_id", it will use the course id |
|
209 | + * in the system database |
|
210 | + * |
|
211 | + * @param string Course id field name |
|
212 | + * @param string Course id value |
|
213 | + * @return mixed System course id if the course was found, WSError otherwise |
|
214 | + */ |
|
215 | + protected function getCourseId($course_id_field_name, $course_id_value) { |
|
216 | + if($course_id_field_name == "chamilo_course_id") { |
|
217 | + if(CourseManager::get_course_code_from_course_id(intval($course_id_value)) != null) { |
|
218 | + return intval($course_id_value); |
|
219 | + } else { |
|
220 | + return new WSCMError(200, "Course not found"); |
|
221 | + } |
|
222 | + } else { |
|
223 | + $courseId = CourseManager::get_course_code_from_original_id($course_id_value, $course_id_field_name); |
|
224 | + if (empty($courseId)) { |
|
225 | + return new WSCMError(200, "Course not found"); |
|
226 | + } else { |
|
227 | + return $courseId; |
|
228 | + } |
|
229 | + } |
|
230 | + } |
|
231 | 231 | |
232 | - /** |
|
233 | - * Gets the real session id based on the session id field name and value. Note that if the session id field name is "chamilo_session_id", it will use the session id |
|
234 | - * in the system database |
|
235 | - * |
|
236 | - * @param string Session id field name |
|
237 | - * @param string Session id value |
|
238 | - * @return mixed System session id if the session was found, WSError otherwise |
|
239 | - */ |
|
240 | - protected function getSessionId($session_id_field_name, $session_id_value) |
|
241 | - { |
|
242 | - if ($session_id_field_name == "chamilo_session_id") { |
|
243 | - $session = SessionManager::fetch((int)$session_id_value); |
|
244 | - if(!empty($session)) { |
|
245 | - return intval($session_id_value); |
|
246 | - } else { |
|
247 | - return new WSCMError(300, "Session not found"); |
|
248 | - } |
|
249 | - } else { |
|
250 | - $session_id = SessionManager::getSessionIdFromOriginalId( |
|
251 | - $session_id_value, |
|
252 | - $session_id_field_name |
|
253 | - ); |
|
254 | - if($session_id == 0) { |
|
255 | - return new WSCMError(300, "Session not found"); |
|
256 | - } else { |
|
257 | - return $session_id; |
|
258 | - } |
|
259 | - } |
|
260 | - } |
|
232 | + /** |
|
233 | + * Gets the real session id based on the session id field name and value. Note that if the session id field name is "chamilo_session_id", it will use the session id |
|
234 | + * in the system database |
|
235 | + * |
|
236 | + * @param string Session id field name |
|
237 | + * @param string Session id value |
|
238 | + * @return mixed System session id if the session was found, WSError otherwise |
|
239 | + */ |
|
240 | + protected function getSessionId($session_id_field_name, $session_id_value) |
|
241 | + { |
|
242 | + if ($session_id_field_name == "chamilo_session_id") { |
|
243 | + $session = SessionManager::fetch((int)$session_id_value); |
|
244 | + if(!empty($session)) { |
|
245 | + return intval($session_id_value); |
|
246 | + } else { |
|
247 | + return new WSCMError(300, "Session not found"); |
|
248 | + } |
|
249 | + } else { |
|
250 | + $session_id = SessionManager::getSessionIdFromOriginalId( |
|
251 | + $session_id_value, |
|
252 | + $session_id_field_name |
|
253 | + ); |
|
254 | + if($session_id == 0) { |
|
255 | + return new WSCMError(300, "Session not found"); |
|
256 | + } else { |
|
257 | + return $session_id; |
|
258 | + } |
|
259 | + } |
|
260 | + } |
|
261 | 261 | |
262 | - /** |
|
263 | - * Handles an error by calling the WSError error handler |
|
264 | - * |
|
265 | - * @param WSError Error |
|
266 | - */ |
|
267 | - protected function handleError($error) { |
|
268 | - $handler = WSCMError::getErrorHandler(); |
|
269 | - $handler->handle($error); |
|
270 | - } |
|
262 | + /** |
|
263 | + * Handles an error by calling the WSError error handler |
|
264 | + * |
|
265 | + * @param WSError Error |
|
266 | + */ |
|
267 | + protected function handleError($error) { |
|
268 | + $handler = WSCMError::getErrorHandler(); |
|
269 | + $handler->handle($error); |
|
270 | + } |
|
271 | 271 | |
272 | - /** |
|
273 | - * Gets a successful result |
|
274 | - * |
|
275 | - * @return array Array with a code of 0 and a message 'Operation was successful' |
|
276 | - */ |
|
277 | - protected function getSuccessfulResult() { |
|
278 | - return array('code' => 0, 'message' => 'Operation was successful'); |
|
279 | - } |
|
272 | + /** |
|
273 | + * Gets a successful result |
|
274 | + * |
|
275 | + * @return array Array with a code of 0 and a message 'Operation was successful' |
|
276 | + */ |
|
277 | + protected function getSuccessfulResult() { |
|
278 | + return array('code' => 0, 'message' => 'Operation was successful'); |
|
279 | + } |
|
280 | 280 | |
281 | - /** |
|
282 | - * Test function. Returns the string success |
|
283 | - * |
|
284 | - * @return string Success |
|
285 | - */ |
|
286 | - public function test() { |
|
287 | - return "success"; |
|
288 | - } |
|
281 | + /** |
|
282 | + * Test function. Returns the string success |
|
283 | + * |
|
284 | + * @return string Success |
|
285 | + */ |
|
286 | + public function test() { |
|
287 | + return "success"; |
|
288 | + } |
|
289 | 289 | |
290 | 290 | /** |
291 | 291 | * *Strictly* reverts PHP's nl2br() effects (whether it was used in XHTML mode or not) |
@@ -44,7 +44,7 @@ discard block |
||
44 | 44 | * @param WSErrorHandler Error handler |
45 | 45 | */ |
46 | 46 | public static function setErrorHandler($handler) { |
47 | - if($handler instanceof WSErrorHandler) { |
|
47 | + if ($handler instanceof WSErrorHandler) { |
|
48 | 48 | self::$_handler = $handler; |
49 | 49 | } |
50 | 50 | } |
@@ -109,12 +109,12 @@ discard block |
||
109 | 109 | // if we are behind a reverse proxy, assume it will send the |
110 | 110 | // HTTP_X_FORWARDED_FOR header and use this IP instead |
111 | 111 | if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
112 | - list($ip1,$ip2) = split(',',$_SERVER['HTTP_X_FORWARDED_FOR']); |
|
112 | + list($ip1, $ip2) = split(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
113 | 113 | $ip = trim($ip1); |
114 | 114 | } |
115 | 115 | $security_key = $ip.$this->_configuration['security_key']; |
116 | 116 | |
117 | - if(!api_is_valid_secret_key($secret_key, $security_key)) { |
|
117 | + if (!api_is_valid_secret_key($secret_key, $security_key)) { |
|
118 | 118 | return new WSCMError(1, "API key is invalid"); |
119 | 119 | } else { |
120 | 120 | return null; |
@@ -149,9 +149,9 @@ discard block |
||
149 | 149 | // Check the user's password |
150 | 150 | if ($password == $uData['password'] AND (trim($login) == $uData['username'])) { |
151 | 151 | // Check if the account is active (not locked) |
152 | - if ($uData['active']=='1') { |
|
152 | + if ($uData['active'] == '1') { |
|
153 | 153 | // Check if the expiration date has not been reached |
154 | - if ($uData['expiration_date']>date('Y-m-d H:i:s') OR $uData['expiration_date']=='0000-00-00 00:00:00') { |
|
154 | + if ($uData['expiration_date'] > date('Y-m-d H:i:s') OR $uData['expiration_date'] == '0000-00-00 00:00:00') { |
|
155 | 155 | return "valid"; |
156 | 156 | } |
157 | 157 | else |
@@ -188,15 +188,15 @@ discard block |
||
188 | 188 | * @return mixed System user id if the user was found, WSError otherwise |
189 | 189 | */ |
190 | 190 | protected function getUserId($user_id_field_name, $user_id_value) { |
191 | - if($user_id_field_name == "chamilo_user_id") { |
|
192 | - if(UserManager::is_user_id_valid(intval($user_id_value))) { |
|
191 | + if ($user_id_field_name == "chamilo_user_id") { |
|
192 | + if (UserManager::is_user_id_valid(intval($user_id_value))) { |
|
193 | 193 | return intval($user_id_value); |
194 | 194 | } else { |
195 | 195 | return new WSCMError(100, "User not found"); |
196 | 196 | } |
197 | 197 | } else { |
198 | 198 | $user_id = UserManager::get_user_id_from_original_id($user_id_value, $user_id_field_name); |
199 | - if($user_id == 0) { |
|
199 | + if ($user_id == 0) { |
|
200 | 200 | return new WSCMError(100, "User not found"); |
201 | 201 | } else { |
202 | 202 | return $user_id; |
@@ -213,8 +213,8 @@ discard block |
||
213 | 213 | * @return mixed System course id if the course was found, WSError otherwise |
214 | 214 | */ |
215 | 215 | protected function getCourseId($course_id_field_name, $course_id_value) { |
216 | - if($course_id_field_name == "chamilo_course_id") { |
|
217 | - if(CourseManager::get_course_code_from_course_id(intval($course_id_value)) != null) { |
|
216 | + if ($course_id_field_name == "chamilo_course_id") { |
|
217 | + if (CourseManager::get_course_code_from_course_id(intval($course_id_value)) != null) { |
|
218 | 218 | return intval($course_id_value); |
219 | 219 | } else { |
220 | 220 | return new WSCMError(200, "Course not found"); |
@@ -240,8 +240,8 @@ discard block |
||
240 | 240 | protected function getSessionId($session_id_field_name, $session_id_value) |
241 | 241 | { |
242 | 242 | if ($session_id_field_name == "chamilo_session_id") { |
243 | - $session = SessionManager::fetch((int)$session_id_value); |
|
244 | - if(!empty($session)) { |
|
243 | + $session = SessionManager::fetch((int) $session_id_value); |
|
244 | + if (!empty($session)) { |
|
245 | 245 | return intval($session_id_value); |
246 | 246 | } else { |
247 | 247 | return new WSCMError(300, "Session not found"); |
@@ -251,7 +251,7 @@ discard block |
||
251 | 251 | $session_id_value, |
252 | 252 | $session_id_field_name |
253 | 253 | ); |
254 | - if($session_id == 0) { |
|
254 | + if ($session_id == 0) { |
|
255 | 255 | return new WSCMError(300, "Session not found"); |
256 | 256 | } else { |
257 | 257 | return $session_id; |
@@ -153,18 +153,18 @@ |
||
153 | 153 | // Check if the expiration date has not been reached |
154 | 154 | if ($uData['expiration_date']>date('Y-m-d H:i:s') OR $uData['expiration_date']=='0000-00-00 00:00:00') { |
155 | 155 | return "valid"; |
156 | + } else { |
|
157 | + return get_lang('AccountExpired'); |
|
156 | 158 | } |
157 | - else |
|
158 | - return get_lang('AccountExpired'); |
|
159 | + } else { |
|
160 | + return get_lang('AccountInactive'); |
|
159 | 161 | } |
160 | - else |
|
161 | - return get_lang('AccountInactive'); |
|
162 | + } else { |
|
163 | + return get_lang('InvalidId'); |
|
162 | 164 | } |
163 | - else |
|
164 | - return get_lang('InvalidId'); |
|
165 | + } else { |
|
166 | + return get_lang('AccountURLInactive'); |
|
165 | 167 | } |
166 | - else |
|
167 | - return get_lang('AccountURLInactive'); |
|
168 | 168 | } |
169 | 169 | return get_lang('InvalidId'); |
170 | 170 | } |
@@ -204,6 +204,9 @@ |
||
204 | 204 | |
205 | 205 | } |
206 | 206 | |
207 | + /** |
|
208 | + * @param integer $user_id |
|
209 | + */ |
|
207 | 210 | protected function set_message_as_read($user_id, $message_id){ |
208 | 211 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
209 | 212 | $query = "UPDATE $table_message SET msg_status = '".MESSAGE_STATUS_NEW."' WHERE user_receiver_id=".$user_id." AND id='".$message_id."';"; |
@@ -37,8 +37,8 @@ discard block |
||
37 | 37 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
38 | 38 | |
39 | 39 | $sql_query = "SELECT id FROM $table_message " . |
40 | - " WHERE user_receiver_id=".$user_id." AND msg_status IN (0,1)" . |
|
41 | - " ORDER BY send_date LIMIT $from,$number_of_items"; |
|
40 | + " WHERE user_receiver_id=".$user_id." AND msg_status IN (0,1)" . |
|
41 | + " ORDER BY send_date LIMIT $from,$number_of_items"; |
|
42 | 42 | |
43 | 43 | $sql_result = Database::query($sql_query); |
44 | 44 | $message = "#"; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
87 | 87 | |
88 | 88 | $sql_query = "SELECT ".$field_table." FROM $table_message " . |
89 | - " WHERE user_receiver_id=".$user_id." AND id=".$message_id; |
|
89 | + " WHERE user_receiver_id=".$user_id." AND id=".$message_id; |
|
90 | 90 | |
91 | 91 | $sql_result = Database::query($sql_query); |
92 | 92 | $result = Database::fetch_row($sql_result); |
@@ -107,8 +107,8 @@ discard block |
||
107 | 107 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
108 | 108 | |
109 | 109 | $sql_query = "SELECT id FROM $table_message " . |
110 | - "WHERE user_sender_id=".$user_id." AND msg_status=".MESSAGE_STATUS_OUTBOX." " . |
|
111 | - "ORDER BY send_date LIMIT $from,$number_of_items"; |
|
110 | + "WHERE user_sender_id=".$user_id." AND msg_status=".MESSAGE_STATUS_OUTBOX." " . |
|
111 | + "ORDER BY send_date LIMIT $from,$number_of_items"; |
|
112 | 112 | |
113 | 113 | $sql_result = Database::query($sql_query); |
114 | 114 | $message = "#"; |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
158 | 158 | |
159 | 159 | $sql_query = "SELECT ".$field_table." FROM $table_message " . |
160 | - " WHERE user_sender_id=".$user_id." AND id=".$id; |
|
160 | + " WHERE user_sender_id=".$user_id." AND id=".$id; |
|
161 | 161 | |
162 | 162 | $sql_result = Database::query($sql_query); |
163 | 163 | $result = Database::fetch_row($sql_result); |
@@ -188,11 +188,11 @@ discard block |
||
188 | 188 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
189 | 189 | |
190 | 190 | $query = "INSERT INTO $table_message(user_sender_id, user_receiver_id, msg_status, send_date, title, content, group_id, parent_id, update_date ) ". |
191 | - " VALUES ('$user_sender_id', '$receiver_user_id', '1', '".api_get_utc_datetime()."','$subject','$content','$group_id','$parent_id', '".api_get_utc_datetime()."')"; |
|
191 | + " VALUES ('$user_sender_id', '$receiver_user_id', '1', '".api_get_utc_datetime()."','$subject','$content','$group_id','$parent_id', '".api_get_utc_datetime()."')"; |
|
192 | 192 | $result = Database::query($query); |
193 | 193 | |
194 | 194 | $query = "INSERT INTO $table_message(user_sender_id, user_receiver_id, msg_status, send_date, title, content, group_id, parent_id, update_date ) ". |
195 | - " VALUES ('$user_sender_id', '$receiver_user_id', '4', '".api_get_utc_datetime()."','$subject','$content','$group_id','$parent_id', '".api_get_utc_datetime()."')"; |
|
195 | + " VALUES ('$user_sender_id', '$receiver_user_id', '4', '".api_get_utc_datetime()."','$subject','$content','$group_id','$parent_id', '".api_get_utc_datetime()."')"; |
|
196 | 196 | $result = Database::query($query); |
197 | 197 | |
198 | 198 | $inbox_last_id = Database::insert_id(); |
@@ -12,7 +12,7 @@ discard block |
||
12 | 12 | { |
13 | 13 | public function unreadMessage($username, $password) |
14 | 14 | { |
15 | - if($this->verifyUserPass($username, $password) == "valid") |
|
15 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
16 | 16 | { |
17 | 17 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
18 | 18 | $user_id = UserManager::get_user_id_from_username($username); |
@@ -30,14 +30,14 @@ discard block |
||
30 | 30 | |
31 | 31 | public function get_message_id($username, $password, $from, $number_of_items) |
32 | 32 | { |
33 | - if($this->verifyUserPass($username, $password) == "valid") |
|
33 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
34 | 34 | { |
35 | 35 | $user_id = UserManager::get_user_id_from_username($username); |
36 | 36 | |
37 | 37 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
38 | 38 | |
39 | - $sql_query = "SELECT id FROM $table_message " . |
|
40 | - " WHERE user_receiver_id=".$user_id." AND msg_status IN (0,1)" . |
|
39 | + $sql_query = "SELECT id FROM $table_message ". |
|
40 | + " WHERE user_receiver_id=".$user_id." AND msg_status IN (0,1)". |
|
41 | 41 | " ORDER BY send_date LIMIT $from,$number_of_items"; |
42 | 42 | |
43 | 43 | $sql_result = Database::query($sql_query); |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | |
56 | 56 | public function get_message_data($username, $password, $message_id, $field) |
57 | 57 | { |
58 | - if($this->verifyUserPass($username, $password) == "valid") |
|
58 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
59 | 59 | { |
60 | 60 | $htmlcode = false; |
61 | 61 | $user_id = UserManager::get_user_id_from_username($username); |
@@ -85,14 +85,14 @@ discard block |
||
85 | 85 | |
86 | 86 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
87 | 87 | |
88 | - $sql_query = "SELECT ".$field_table." FROM $table_message " . |
|
88 | + $sql_query = "SELECT ".$field_table." FROM $table_message ". |
|
89 | 89 | " WHERE user_receiver_id=".$user_id." AND id=".$message_id; |
90 | 90 | |
91 | 91 | $sql_result = Database::query($sql_query); |
92 | 92 | $result = Database::fetch_row($sql_result); |
93 | 93 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
94 | 94 | |
95 | - }else |
|
95 | + } else |
|
96 | 96 | return get_lang('InvalidId'); |
97 | 97 | |
98 | 98 | |
@@ -100,14 +100,14 @@ discard block |
||
100 | 100 | |
101 | 101 | public function get_message_id_sent($username, $password, $from, $number_of_items) |
102 | 102 | { |
103 | - if($this->verifyUserPass($username, $password) == "valid") |
|
103 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
104 | 104 | { |
105 | 105 | $user_id = UserManager::get_user_id_from_username($username); |
106 | 106 | |
107 | 107 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
108 | 108 | |
109 | - $sql_query = "SELECT id FROM $table_message " . |
|
110 | - "WHERE user_sender_id=".$user_id." AND msg_status=".MESSAGE_STATUS_OUTBOX." " . |
|
109 | + $sql_query = "SELECT id FROM $table_message ". |
|
110 | + "WHERE user_sender_id=".$user_id." AND msg_status=".MESSAGE_STATUS_OUTBOX." ". |
|
111 | 111 | "ORDER BY send_date LIMIT $from,$number_of_items"; |
112 | 112 | |
113 | 113 | $sql_result = Database::query($sql_query); |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | |
127 | 127 | public function get_message_data_sent($username, $password, $id, $field) |
128 | 128 | { |
129 | - if($this->verifyUserPass($username, $password) == "valid") |
|
129 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
130 | 130 | { |
131 | 131 | $htmlcode = false; |
132 | 132 | switch ($field) |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | |
157 | 157 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
158 | 158 | |
159 | - $sql_query = "SELECT ".$field_table." FROM $table_message " . |
|
159 | + $sql_query = "SELECT ".$field_table." FROM $table_message ". |
|
160 | 160 | " WHERE user_sender_id=".$user_id." AND id=".$id; |
161 | 161 | |
162 | 162 | $sql_result = Database::query($sql_query); |
@@ -164,7 +164,7 @@ discard block |
||
164 | 164 | |
165 | 165 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
166 | 166 | |
167 | - }else |
|
167 | + } else |
|
168 | 168 | return get_lang('InvalidId'); |
169 | 169 | |
170 | 170 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | public function message_send($username, $password, $receiver_user_id, $subject, $content) |
174 | 174 | { |
175 | 175 | //TODO: verificar data de envio. Esta divergindo de data! |
176 | - if($this->verifyUserPass($username, $password) == "valid") |
|
176 | + if ($this->verifyUserPass($username, $password) == "valid") |
|
177 | 177 | { |
178 | 178 | $group_id = intval(0); |
179 | 179 | $parent_id = intval(0); |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | } |
206 | 206 | |
207 | - protected function set_message_as_read($user_id, $message_id){ |
|
207 | + protected function set_message_as_read($user_id, $message_id) { |
|
208 | 208 | $table_message = Database::get_main_table(TABLE_MESSAGE); |
209 | 209 | $query = "UPDATE $table_message SET msg_status = '".MESSAGE_STATUS_NEW."' WHERE user_receiver_id=".$user_id." AND id='".$message_id."';"; |
210 | 210 | $result = Database::query($query); |
@@ -48,8 +48,9 @@ discard block |
||
48 | 48 | |
49 | 49 | return $message; |
50 | 50 | |
51 | - } else |
|
52 | - return get_lang('InvalidId'); |
|
51 | + } else { |
|
52 | + return get_lang('InvalidId'); |
|
53 | + } |
|
53 | 54 | |
54 | 55 | } |
55 | 56 | |
@@ -92,8 +93,9 @@ discard block |
||
92 | 93 | $result = Database::fetch_row($sql_result); |
93 | 94 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
94 | 95 | |
95 | - }else |
|
96 | - return get_lang('InvalidId'); |
|
96 | + } else { |
|
97 | + return get_lang('InvalidId'); |
|
98 | + } |
|
97 | 99 | |
98 | 100 | |
99 | 101 | } |
@@ -118,8 +120,9 @@ discard block |
||
118 | 120 | |
119 | 121 | return $message; |
120 | 122 | |
121 | - } else |
|
122 | - return get_lang('InvalidId'); |
|
123 | + } else { |
|
124 | + return get_lang('InvalidId'); |
|
125 | + } |
|
123 | 126 | |
124 | 127 | } |
125 | 128 | |
@@ -164,8 +167,9 @@ discard block |
||
164 | 167 | |
165 | 168 | return (htmlcode) ? html_entity_decode($result[0]) : $result[0]; |
166 | 169 | |
167 | - }else |
|
168 | - return get_lang('InvalidId'); |
|
170 | + } else { |
|
171 | + return get_lang('InvalidId'); |
|
172 | + } |
|
169 | 173 | |
170 | 174 | |
171 | 175 | } |
@@ -199,8 +203,9 @@ discard block |
||
199 | 203 | |
200 | 204 | return $inbox_last_id; |
201 | 205 | |
202 | - } else |
|
203 | - return get_lang('InvalidId'); |
|
206 | + } else { |
|
207 | + return get_lang('InvalidId'); |
|
208 | + } |
|
204 | 209 | |
205 | 210 | } |
206 | 211 |
@@ -137,7 +137,7 @@ |
||
137 | 137 | /** |
138 | 138 | * Get a list of users of which the given conditions match with a LIKE '%cond%' |
139 | 139 | * @param array $conditions a list of condition (exemple : status=>STUDENT) |
140 | - * @param array $order_by a list of fields on which sort |
|
140 | + * @param string[] $order_by a list of fields on which sort |
|
141 | 141 | * @return array An array with all users of the platform. |
142 | 142 | * @todo optional course code parameter, optional sorting parameters... |
143 | 143 | *@todo Use the UserManager class |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | { |
96 | 96 | global $charset; |
97 | 97 | if ($this->verifyUserPass($username, $password) == "valid") { |
98 | - $user_id = UserManager::get_user_id_from_username($username); |
|
98 | + $user_id = UserManager::get_user_id_from_username($username); |
|
99 | 99 | $message_title = get_lang('Invitation'); |
100 | 100 | $count_is_true = SocialManager::send_invitation_friend($user_id,$userfriend_id, $message_title, $content_message); |
101 | 101 | |
@@ -135,14 +135,14 @@ discard block |
||
135 | 135 | |
136 | 136 | |
137 | 137 | /** |
138 | - * Get a list of users of which the given conditions match with a LIKE '%cond%' |
|
139 | - * @param array $conditions a list of condition (exemple : status=>STUDENT) |
|
140 | - * @param array $order_by a list of fields on which sort |
|
141 | - * @return array An array with all users of the platform. |
|
142 | - * @todo optional course code parameter, optional sorting parameters... |
|
138 | + * Get a list of users of which the given conditions match with a LIKE '%cond%' |
|
139 | + * @param array $conditions a list of condition (exemple : status=>STUDENT) |
|
140 | + * @param array $order_by a list of fields on which sort |
|
141 | + * @return array An array with all users of the platform. |
|
142 | + * @todo optional course code parameter, optional sorting parameters... |
|
143 | 143 | *@todo Use the UserManager class |
144 | 144 | * @todo security filter order by |
145 | - */ |
|
145 | + */ |
|
146 | 146 | private static function get_user_list_like_start($conditions = array(), $order_by = array()) |
147 | 147 | { |
148 | 148 | $user_table = Database :: get_main_table(TABLE_MAIN_USER); |
@@ -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'); |
@@ -20,6 +20,9 @@ |
||
20 | 20 | |
21 | 21 | define('WS_ERROR_SECRET_KEY', 1); |
22 | 22 | |
23 | +/** |
|
24 | + * @param integer $code |
|
25 | + */ |
|
23 | 26 | function return_error($code) { |
24 | 27 | $fault = null; |
25 | 28 | switch ($code) { |
@@ -581,7 +581,7 @@ |
||
581 | 581 | /*$sessionIdName = isset($params['session_id_name']) ? $params['session_id_name'] : null; |
582 | 582 | $sessionIdValue = isset($params['session_id_value']) ? $params['session_id_value'] : null;*/ |
583 | 583 | |
584 | - $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
|
584 | + $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
|
585 | 585 | $courseIdValue, |
586 | 586 | $courseIdName |
587 | 587 | ); |
@@ -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 |
@@ -48,19 +48,22 @@ discard block |
||
48 | 48 | list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
49 | 49 | $ip = trim($ip1); |
50 | 50 | } |
51 | - if ($debug) |
|
52 | - error_log("ip: $ip"); |
|
51 | + if ($debug) { |
|
52 | + error_log("ip: $ip"); |
|
53 | + } |
|
53 | 54 | // Check if a file that limits access from webservices exists and contains |
54 | 55 | // the restraining check |
55 | 56 | if (is_file('webservice-auth-ip.conf.php')) { |
56 | 57 | include 'webservice-auth-ip.conf.php'; |
57 | - if ($debug) |
|
58 | - error_log("webservice-auth-ip.conf.php file included"); |
|
58 | + if ($debug) { |
|
59 | + error_log("webservice-auth-ip.conf.php file included"); |
|
60 | + } |
|
59 | 61 | if (!empty($ws_auth_ip)) { |
60 | 62 | $check_ip = true; |
61 | 63 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
62 | - if ($debug) |
|
63 | - error_log("ip_matches: $ip_matches"); |
|
64 | + if ($debug) { |
|
65 | + error_log("ip_matches: $ip_matches"); |
|
66 | + } |
|
64 | 67 | } |
65 | 68 | } |
66 | 69 | |
@@ -76,8 +79,9 @@ discard block |
||
76 | 79 | } |
77 | 80 | $result = api_is_valid_secret_key($secret_key, $security_key); |
78 | 81 | //error_log($secret_key.'-'.$security_key); |
79 | - if ($debug) |
|
80 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
82 | + if ($debug) { |
|
83 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
84 | + } |
|
81 | 85 | return $result; |
82 | 86 | } |
83 | 87 | |
@@ -140,7 +144,9 @@ discard block |
||
140 | 144 | if (!WSHelperVerifyKey($params)) { |
141 | 145 | return return_error(WS_ERROR_SECRET_KEY); |
142 | 146 | } |
143 | - if ($debug) error_log('WSImportLP'); |
|
147 | + if ($debug) { |
|
148 | + error_log('WSImportLP'); |
|
149 | + } |
|
144 | 150 | |
145 | 151 | $courseIdName = $params['course_id_name']; |
146 | 152 | $courseIdValue = $params['course_id_value']; |
@@ -156,7 +162,9 @@ discard block |
||
156 | 162 | $courseId = $courseInfo['real_id']; |
157 | 163 | |
158 | 164 | if (empty($courseInfo)) { |
159 | - if ($debug) error_log('Course not found'); |
|
165 | + if ($debug) { |
|
166 | + error_log('Course not found'); |
|
167 | + } |
|
160 | 168 | return 'Course not found'; |
161 | 169 | } |
162 | 170 | |
@@ -169,7 +177,9 @@ discard block |
||
169 | 177 | |
170 | 178 | if (empty($sessionId)) { |
171 | 179 | |
172 | - if ($debug) error_log('Session not found'); |
|
180 | + if ($debug) { |
|
181 | + error_log('Session not found'); |
|
182 | + } |
|
173 | 183 | return 'Session not found'; |
174 | 184 | } |
175 | 185 | } |
@@ -196,7 +206,9 @@ discard block |
||
196 | 206 | $manifest = $oScorm->import_package($fileInfo, '', $courseInfo); |
197 | 207 | |
198 | 208 | if (!$manifest) { |
199 | - if ($debug) error_log('manifest.xml file not found'); |
|
209 | + if ($debug) { |
|
210 | + error_log('manifest.xml file not found'); |
|
211 | + } |
|
200 | 212 | //if api_set_failure |
201 | 213 | return 'manifest.xml file not found'; |
202 | 214 | } |
@@ -215,10 +227,14 @@ discard block |
||
215 | 227 | $oScorm->set_maker($maker, $courseId); |
216 | 228 | //$oScorm->set_jslib('scorm_api.php'); |
217 | 229 | |
218 | - if ($debug) error_log('scorm was added'); |
|
230 | + if ($debug) { |
|
231 | + error_log('scorm was added'); |
|
232 | + } |
|
219 | 233 | return 1; |
220 | 234 | } else { |
221 | - if ($debug) error_log('manifest data empty'); |
|
235 | + if ($debug) { |
|
236 | + error_log('manifest data empty'); |
|
237 | + } |
|
222 | 238 | return 'manifest data empty'; |
223 | 239 | } |
224 | 240 | } |
@@ -311,7 +327,9 @@ discard block |
||
311 | 327 | ); |
312 | 328 | |
313 | 329 | if (empty($courseInfo)) { |
314 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
330 | + if ($debug) { |
|
331 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
332 | + } |
|
315 | 333 | return 'Course not found'; |
316 | 334 | } |
317 | 335 | |
@@ -326,7 +344,9 @@ discard block |
||
326 | 344 | |
327 | 345 | if (empty($sessionId)) { |
328 | 346 | |
329 | - if ($debug) error_log('Session not found'); |
|
347 | + if ($debug) { |
|
348 | + error_log('Session not found'); |
|
349 | + } |
|
330 | 350 | return 'Session not found'; |
331 | 351 | } |
332 | 352 | } |
@@ -407,7 +427,9 @@ discard block |
||
407 | 427 | ); |
408 | 428 | |
409 | 429 | if (empty($courseInfo)) { |
410 | - if ($debug) error_log("Course not found: $courseIdName : $courseIdValue"); |
|
430 | + if ($debug) { |
|
431 | + error_log("Course not found: $courseIdName : $courseIdValue"); |
|
432 | + } |
|
411 | 433 | return 'Course not found'; |
412 | 434 | } |
413 | 435 | $courseId = $courseInfo['real_id']; |
@@ -432,7 +454,9 @@ discard block |
||
432 | 454 | |
433 | 455 | $lp = new learnpath($courseCode, $lpId, null); |
434 | 456 | if ($lp) { |
435 | - if ($debug) error_log("LP deleted $lpId"); |
|
457 | + if ($debug) { |
|
458 | + error_log("LP deleted $lpId"); |
|
459 | + } |
|
436 | 460 | |
437 | 461 | $course_dir = $courseInfo['directory'] . '/document'; |
438 | 462 | $sys_course_path = api_get_path(SYS_COURSE_PATH); |
@@ -448,7 +472,9 @@ discard block |
||
448 | 472 | if ($item) { |
449 | 473 | $documentId = $item->get_path(); |
450 | 474 | |
451 | - if ($debug) error_log("lp item id found #$itemId"); |
|
475 | + if ($debug) { |
|
476 | + error_log("lp item id found #$itemId"); |
|
477 | + } |
|
452 | 478 | |
453 | 479 | $documentInfo = DocumentManager::get_document_data_by_id( |
454 | 480 | $documentId, |
@@ -474,7 +500,9 @@ discard block |
||
474 | 500 | } |
475 | 501 | } |
476 | 502 | } else { |
477 | - if ($debug) error_log("Document not found #$itemId"); |
|
503 | + if ($debug) { |
|
504 | + error_log("Document not found #$itemId"); |
|
505 | + } |
|
478 | 506 | } |
479 | 507 | } |
480 | 508 | } |
@@ -2617,6 +2617,9 @@ |
||
2617 | 2617 | ) |
2618 | 2618 | ); |
2619 | 2619 | |
2620 | +/** |
|
2621 | + * @param string $type |
|
2622 | + */ |
|
2620 | 2623 | function WSHelperActionOnUsers($params, $type) { |
2621 | 2624 | if(!WSHelperVerifyKey($params)) { |
2622 | 2625 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -4930,9 +4930,9 @@ |
||
4930 | 4930 | 'This service unsubscribe a user from a course' // documentation |
4931 | 4931 | ); |
4932 | 4932 | /** |
4933 | - * @param array $params |
|
4934 | - * @return array|null|soap_fault |
|
4935 | - */ |
|
4933 | + * @param array $params |
|
4934 | + * @return array|null|soap_fault |
|
4935 | + */ |
|
4936 | 4936 | function WSUnSubscribeUserFromCourseSimple($params) |
4937 | 4937 | { |
4938 | 4938 | global $debug; |
@@ -63,19 +63,22 @@ discard block |
||
63 | 63 | list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); |
64 | 64 | $ip = trim($ip1); |
65 | 65 | } |
66 | - if ($debug) |
|
67 | - error_log("ip: $ip"); |
|
66 | + if ($debug) { |
|
67 | + error_log("ip: $ip"); |
|
68 | + } |
|
68 | 69 | // Check if a file that limits access from webservices exists and contains |
69 | 70 | // the restraining check |
70 | 71 | if (is_file('webservice-auth-ip.conf.php')) { |
71 | 72 | include 'webservice-auth-ip.conf.php'; |
72 | - if ($debug) |
|
73 | - error_log("webservice-auth-ip.conf.php file included"); |
|
73 | + if ($debug) { |
|
74 | + error_log("webservice-auth-ip.conf.php file included"); |
|
75 | + } |
|
74 | 76 | if (!empty($ws_auth_ip)) { |
75 | 77 | $check_ip = true; |
76 | 78 | $ip_matches = api_check_ip_in_range($ip, $ws_auth_ip); |
77 | - if ($debug) |
|
78 | - error_log("ip_matches: $ip_matches"); |
|
79 | + if ($debug) { |
|
80 | + error_log("ip_matches: $ip_matches"); |
|
81 | + } |
|
79 | 82 | } |
80 | 83 | } |
81 | 84 | |
@@ -92,8 +95,9 @@ discard block |
||
92 | 95 | |
93 | 96 | $result = api_is_valid_secret_key($secret_key, $security_key); |
94 | 97 | |
95 | - if ($debug) |
|
96 | - error_log('WSHelperVerifyKey result: '.intval($result)); |
|
98 | + if ($debug) { |
|
99 | + error_log('WSHelperVerifyKey result: '.intval($result)); |
|
100 | + } |
|
97 | 101 | return $result; |
98 | 102 | } |
99 | 103 | |
@@ -553,7 +557,9 @@ discard block |
||
553 | 557 | |
554 | 558 | // First check wether the login already exists |
555 | 559 | if (!UserManager::is_username_available($loginName)) { |
556 | - if ($debug) error_log("Username $loginName is not available"); |
|
560 | + if ($debug) { |
|
561 | + error_log("Username $loginName is not available"); |
|
562 | + } |
|
557 | 563 | return 0; |
558 | 564 | } |
559 | 565 | |
@@ -1012,7 +1018,9 @@ discard block |
||
1012 | 1018 | if (empty($userId) && empty($sessionId) && empty($courseId)) { |
1013 | 1019 | // try original values |
1014 | 1020 | |
1015 | - if ($debug) error_log('try original values'); |
|
1021 | + if ($debug) { |
|
1022 | + error_log('try original values'); |
|
1023 | + } |
|
1016 | 1024 | |
1017 | 1025 | $userIdName = isset($params['original_user_id_name']) ? $params['original_user_id_name'] : 0; |
1018 | 1026 | $userIdValue = isset($params['original_user_id_value']) ? $params['original_user_id_value'] : 0; |
@@ -1044,9 +1052,15 @@ discard block |
||
1044 | 1052 | ); |
1045 | 1053 | } |
1046 | 1054 | |
1047 | - if ($debug) error_log('$userId found: '. $userId); |
|
1048 | - if ($debug) error_log('$courseId found: '. $courseId); |
|
1049 | - if ($debug) error_log('$sessionId found: '. $sessionId); |
|
1055 | + if ($debug) { |
|
1056 | + error_log('$userId found: '. $userId); |
|
1057 | + } |
|
1058 | + if ($debug) { |
|
1059 | + error_log('$courseId found: '. $courseId); |
|
1060 | + } |
|
1061 | + if ($debug) { |
|
1062 | + error_log('$sessionId found: '. $sessionId); |
|
1063 | + } |
|
1050 | 1064 | |
1051 | 1065 | return [ |
1052 | 1066 | 'user_id' => $userId, |
@@ -1076,13 +1090,17 @@ discard block |
||
1076 | 1090 | { |
1077 | 1091 | global $debug; |
1078 | 1092 | |
1079 | - if ($debug) error_log('WSSubscribeTeacherToSessionCourse'); |
|
1093 | + if ($debug) { |
|
1094 | + error_log('WSSubscribeTeacherToSessionCourse'); |
|
1095 | + } |
|
1080 | 1096 | |
1081 | 1097 | if (!WSHelperVerifyKey($params)) { |
1082 | 1098 | return returnError(WS_ERROR_SECRET_KEY); |
1083 | 1099 | } |
1084 | 1100 | |
1085 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1101 | + if ($debug) { |
|
1102 | + error_log('Params '. print_r($params, 1)); |
|
1103 | + } |
|
1086 | 1104 | |
1087 | 1105 | $params = parseCourseSessionUserParams($params); |
1088 | 1106 | |
@@ -1095,13 +1113,17 @@ discard block |
||
1095 | 1113 | $result = 0; |
1096 | 1114 | |
1097 | 1115 | if (!empty($coaches)) { |
1098 | - if ($debug) error_log('Coaches: '. print_r($coaches, 1)); |
|
1116 | + if ($debug) { |
|
1117 | + error_log('Coaches: '. print_r($coaches, 1)); |
|
1118 | + } |
|
1099 | 1119 | if (in_array($userId, $coaches)) { |
1100 | 1120 | $result = 1; |
1101 | 1121 | } |
1102 | 1122 | } |
1103 | 1123 | |
1104 | - if ($debug) error_log('Result: '. $result); |
|
1124 | + if ($debug) { |
|
1125 | + error_log('Result: '. $result); |
|
1126 | + } |
|
1105 | 1127 | |
1106 | 1128 | return $result; |
1107 | 1129 | } |
@@ -1127,13 +1149,17 @@ discard block |
||
1127 | 1149 | { |
1128 | 1150 | global $debug; |
1129 | 1151 | |
1130 | - if ($debug) error_log('WSSubscribeTeacherToSessionCourse'); |
|
1152 | + if ($debug) { |
|
1153 | + error_log('WSSubscribeTeacherToSessionCourse'); |
|
1154 | + } |
|
1131 | 1155 | |
1132 | 1156 | if (!WSHelperVerifyKey($params)) { |
1133 | 1157 | return returnError(WS_ERROR_SECRET_KEY); |
1134 | 1158 | } |
1135 | 1159 | |
1136 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1160 | + if ($debug) { |
|
1161 | + error_log('Params '. print_r($params, 1)); |
|
1162 | + } |
|
1137 | 1163 | |
1138 | 1164 | $params = parseCourseSessionUserParams($params); |
1139 | 1165 | |
@@ -1147,7 +1173,9 @@ discard block |
||
1147 | 1173 | $result = 0; |
1148 | 1174 | |
1149 | 1175 | if (!empty($coaches)) { |
1150 | - if ($debug) error_log('Coaches: ' . print_r($coaches, 1)); |
|
1176 | + if ($debug) { |
|
1177 | + error_log('Coaches: ' . print_r($coaches, 1)); |
|
1178 | + } |
|
1151 | 1179 | if (!in_array($userId, $coaches)) { |
1152 | 1180 | $result = 1; |
1153 | 1181 | } |
@@ -1155,7 +1183,9 @@ discard block |
||
1155 | 1183 | $result = 1; |
1156 | 1184 | } |
1157 | 1185 | |
1158 | - if ($debug) error_log('Final Result: '. $result); |
|
1186 | + if ($debug) { |
|
1187 | + error_log('Final Result: '. $result); |
|
1188 | + } |
|
1159 | 1189 | |
1160 | 1190 | return $result; |
1161 | 1191 | } |
@@ -1207,8 +1237,12 @@ discard block |
||
1207 | 1237 | { |
1208 | 1238 | global $_user, $_configuration, $debug; |
1209 | 1239 | $debug = 1; |
1210 | - if ($debug) error_log('WSCreateUserPasswordCrypted'); |
|
1211 | - if ($debug) error_log(print_r($params,1)); |
|
1240 | + if ($debug) { |
|
1241 | + error_log('WSCreateUserPasswordCrypted'); |
|
1242 | + } |
|
1243 | + if ($debug) { |
|
1244 | + error_log(print_r($params,1)); |
|
1245 | + } |
|
1212 | 1246 | |
1213 | 1247 | if (!WSHelperVerifyKey($params)) { |
1214 | 1248 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -1244,22 +1278,30 @@ discard block |
||
1244 | 1278 | if ($_configuration['password_encryption'] === $encrypt_method ) { |
1245 | 1279 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
1246 | 1280 | $msg = "Encryption $encrypt_method is invalid"; |
1247 | - if ($debug) error_log($msg); |
|
1281 | + if ($debug) { |
|
1282 | + error_log($msg); |
|
1283 | + } |
|
1248 | 1284 | return $msg; |
1249 | 1285 | |
1250 | 1286 | } else if ($encrypt_method == 'sha1' && !preg_match('/^[A-Fa-f0-9]{40}$/', $password)) { |
1251 | 1287 | $msg = "Encryption $encrypt_method is invalid"; |
1252 | - if ($debug) error_log($msg); |
|
1288 | + if ($debug) { |
|
1289 | + error_log($msg); |
|
1290 | + } |
|
1253 | 1291 | return $msg; |
1254 | 1292 | } |
1255 | 1293 | } else { |
1256 | 1294 | $msg = "This encryption $encrypt_method is not configured"; |
1257 | - if ($debug) error_log($msg); |
|
1295 | + if ($debug) { |
|
1296 | + error_log($msg); |
|
1297 | + } |
|
1258 | 1298 | return $msg; |
1259 | 1299 | } |
1260 | 1300 | } else { |
1261 | 1301 | $msg = 'The chamilo setting $_configuration["password_encryption"] is not configured'; |
1262 | - if ($debug) error_log($msg); |
|
1302 | + if ($debug) { |
|
1303 | + error_log($msg); |
|
1304 | + } |
|
1263 | 1305 | return $msg; |
1264 | 1306 | } |
1265 | 1307 | |
@@ -1279,10 +1321,14 @@ discard block |
||
1279 | 1321 | $original_user_id_name |
1280 | 1322 | ); |
1281 | 1323 | |
1282 | - if ($debug) error_log('Ready to create user'); |
|
1324 | + if ($debug) { |
|
1325 | + error_log('Ready to create user'); |
|
1326 | + } |
|
1283 | 1327 | |
1284 | 1328 | if ($user_id > 0) { |
1285 | - if ($debug) error_log('User found with id: '.$user_id); |
|
1329 | + if ($debug) { |
|
1330 | + error_log('User found with id: '.$user_id); |
|
1331 | + } |
|
1286 | 1332 | |
1287 | 1333 | // Check whether user is not active |
1288 | 1334 | //@todo why this condition exists?? |
@@ -1293,7 +1339,9 @@ discard block |
||
1293 | 1339 | $count_check_user = Database::num_rows($resu); |
1294 | 1340 | if ($count_check_user > 0) { |
1295 | 1341 | |
1296 | - if ($debug) error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
|
1342 | + if ($debug) { |
|
1343 | + error_log('User id: '.$user_id.' exists and is NOT active. Updating user and setting setting active = 1'); |
|
1344 | + } |
|
1297 | 1345 | |
1298 | 1346 | $sql = "UPDATE $table_user SET |
1299 | 1347 | lastname='".Database::escape_string($lastName)."', |
@@ -1313,7 +1361,9 @@ discard block |
||
1313 | 1361 | active='1', |
1314 | 1362 | hr_dept_id=".intval($hr_dept_id); |
1315 | 1363 | $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
1316 | - if ($debug) error_log($sql); |
|
1364 | + if ($debug) { |
|
1365 | + error_log($sql); |
|
1366 | + } |
|
1317 | 1367 | Database::query($sql); |
1318 | 1368 | |
1319 | 1369 | if (is_array($extra_list) && count($extra_list) > 0) { |
@@ -1330,11 +1380,15 @@ discard block |
||
1330 | 1380 | } |
1331 | 1381 | return $r_check_user[0]; |
1332 | 1382 | } else { |
1333 | - if ($debug) error_log('User exists but is active. Cant be updated'); |
|
1383 | + if ($debug) { |
|
1384 | + error_log('User exists but is active. Cant be updated'); |
|
1385 | + } |
|
1334 | 1386 | return 0; |
1335 | 1387 | } |
1336 | 1388 | } else { |
1337 | - if ($debug) error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"); |
|
1389 | + if ($debug) { |
|
1390 | + error_log("User not found with original_id = $original_user_id_value and original_name = $original_user_id_name"); |
|
1391 | + } |
|
1338 | 1392 | } |
1339 | 1393 | |
1340 | 1394 | // Default language. |
@@ -1350,7 +1404,9 @@ discard block |
||
1350 | 1404 | |
1351 | 1405 | // First check wether the login already exists |
1352 | 1406 | if (!UserManager::is_username_available($loginName)) { |
1353 | - if ($debug) error_log("Username $loginName is not available"); |
|
1407 | + if ($debug) { |
|
1408 | + error_log("Username $loginName is not available"); |
|
1409 | + } |
|
1354 | 1410 | return 0; |
1355 | 1411 | } |
1356 | 1412 | |
@@ -1372,7 +1428,9 @@ discard block |
||
1372 | 1428 | expiration_date = '".Database::escape_string($expiration_date)."', |
1373 | 1429 | hr_dept_id = '".Database::escape_string($hr_dept_id)."', |
1374 | 1430 | active = '".Database::escape_string($active)."'"; |
1375 | - if ($debug) error_log($sql); |
|
1431 | + if ($debug) { |
|
1432 | + error_log($sql); |
|
1433 | + } |
|
1376 | 1434 | |
1377 | 1435 | Database::query($sql); |
1378 | 1436 | $return = Database::insert_id(); |
@@ -1384,7 +1442,9 @@ discard block |
||
1384 | 1442 | |
1385 | 1443 | $url_id = api_get_current_access_url_id(); |
1386 | 1444 | UrlManager::add_user_to_url($return, $url_id); |
1387 | - if ($debug) error_log("Adding user_id = $return to URL id $url_id "); |
|
1445 | + if ($debug) { |
|
1446 | + error_log("Adding user_id = $return to URL id $url_id "); |
|
1447 | + } |
|
1388 | 1448 | |
1389 | 1449 | // Create extra field for the original_user_id_name |
1390 | 1450 | UserManager::create_extra_field( |
@@ -1421,7 +1481,9 @@ discard block |
||
1421 | 1481 | } |
1422 | 1482 | } |
1423 | 1483 | } else { |
1424 | - if ($debug) error_log('Error while inserting a user'); |
|
1484 | + if ($debug) { |
|
1485 | + error_log('Error while inserting a user'); |
|
1486 | + } |
|
1425 | 1487 | return 0; |
1426 | 1488 | } |
1427 | 1489 | |
@@ -4480,7 +4542,9 @@ discard block |
||
4480 | 4542 | if (!WSHelperVerifyKey($params)) { |
4481 | 4543 | return returnError(WS_ERROR_SECRET_KEY); |
4482 | 4544 | } |
4483 | - if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4545 | + if ($debug) { |
|
4546 | + error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4547 | + } |
|
4484 | 4548 | |
4485 | 4549 | $results = array(); |
4486 | 4550 | $userscourses = $params['userscourses']; |
@@ -4499,7 +4563,9 @@ discard block |
||
4499 | 4563 | $original_user_id['original_user_id_value'], |
4500 | 4564 | $original_user_id['original_user_id_name'] |
4501 | 4565 | ); |
4502 | - if ($debug) error_log('WSSubscribeUserToCourse user_id: '.$user_id); |
|
4566 | + if ($debug) { |
|
4567 | + error_log('WSSubscribeUserToCourse user_id: '.$user_id); |
|
4568 | + } |
|
4503 | 4569 | |
4504 | 4570 | if ($user_id == 0) { |
4505 | 4571 | // If user was not found, there was a problem |
@@ -4517,13 +4583,19 @@ discard block |
||
4517 | 4583 | // Course was not found |
4518 | 4584 | $resultValue = 0; |
4519 | 4585 | } else { |
4520 | - if ($debug) error_log('WSSubscribeUserToCourse courseCode: '.$courseCode); |
|
4586 | + if ($debug) { |
|
4587 | + error_log('WSSubscribeUserToCourse courseCode: '.$courseCode); |
|
4588 | + } |
|
4521 | 4589 | $result = CourseManager::add_user_to_course($user_id, $courseCode, $status, false); |
4522 | 4590 | if ($result) { |
4523 | 4591 | $resultValue = 1; |
4524 | - if ($debug) error_log('WSSubscribeUserToCourse subscribed'); |
|
4592 | + if ($debug) { |
|
4593 | + error_log('WSSubscribeUserToCourse subscribed'); |
|
4594 | + } |
|
4525 | 4595 | } else { |
4526 | - if ($debug) error_log('WSSubscribeUserToCourse NOT subscribed: '); |
|
4596 | + if ($debug) { |
|
4597 | + error_log('WSSubscribeUserToCourse NOT subscribed: '); |
|
4598 | + } |
|
4527 | 4599 | } |
4528 | 4600 | } |
4529 | 4601 | } |
@@ -4581,8 +4653,12 @@ discard block |
||
4581 | 4653 | function WSSubscribeUserToCourseSimple($params) { |
4582 | 4654 | global $debug; |
4583 | 4655 | |
4584 | - if ($debug) error_log('WSSubscribeUserToCourseSimple'); |
|
4585 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
4656 | + if ($debug) { |
|
4657 | + error_log('WSSubscribeUserToCourseSimple'); |
|
4658 | + } |
|
4659 | + if ($debug) { |
|
4660 | + error_log('Params '. print_r($params, 1)); |
|
4661 | + } |
|
4586 | 4662 | if (!WSHelperVerifyKey($params)) { |
4587 | 4663 | return returnError(WS_ERROR_SECRET_KEY); |
4588 | 4664 | } |
@@ -4597,7 +4673,9 @@ discard block |
||
4597 | 4673 | if (empty($user_data)) { |
4598 | 4674 | // If user was not found, there was a problem |
4599 | 4675 | $result = "User $user_id does not exist"; |
4600 | - if ($debug) error_log($result); |
|
4676 | + if ($debug) { |
|
4677 | + error_log($result); |
|
4678 | + } |
|
4601 | 4679 | return $result; |
4602 | 4680 | } |
4603 | 4681 | if (!empty($course_code)) { |
@@ -4605,14 +4683,22 @@ discard block |
||
4605 | 4683 | if (empty($course_data)) { |
4606 | 4684 | // Course was not found |
4607 | 4685 | $result = "Course $course_code does not exist in the platform "; |
4608 | - if ($debug) error_log($result); |
|
4686 | + if ($debug) { |
|
4687 | + error_log($result); |
|
4688 | + } |
|
4609 | 4689 | } else { |
4610 | - if ($debug) error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
|
4690 | + if ($debug) { |
|
4691 | + error_log('Try to register: user_id= '.$user_id.' to course: '.$course_data['code']); |
|
4692 | + } |
|
4611 | 4693 | if (!CourseManager::add_user_to_course($user_id, $course_data['code'], $status)) { |
4612 | 4694 | $result = 'User was not registered possible reasons: User already registered to the course, Course visibility doesnt allow user subscriptions '; |
4613 | - if ($debug) error_log($result); |
|
4695 | + if ($debug) { |
|
4696 | + error_log($result); |
|
4697 | + } |
|
4614 | 4698 | } else { |
4615 | - if ($debug) error_log('User registered to the course: '.$course_data['code']); |
|
4699 | + if ($debug) { |
|
4700 | + error_log('User registered to the course: '.$course_data['code']); |
|
4701 | + } |
|
4616 | 4702 | $result = 1; |
4617 | 4703 | } |
4618 | 4704 | } |
@@ -4664,8 +4750,12 @@ discard block |
||
4664 | 4750 | // define the method WSGetUser |
4665 | 4751 | function WSGetUser($params) { |
4666 | 4752 | global $debug; |
4667 | - if ($debug) error_log('WSGetUser'); |
|
4668 | - if ($debug) error_log('$params: '.print_r($params, 1)); |
|
4753 | + if ($debug) { |
|
4754 | + error_log('WSGetUser'); |
|
4755 | + } |
|
4756 | + if ($debug) { |
|
4757 | + error_log('$params: '.print_r($params, 1)); |
|
4758 | + } |
|
4669 | 4759 | |
4670 | 4760 | if (!WSHelperVerifyKey($params)) { |
4671 | 4761 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -4718,8 +4808,12 @@ discard block |
||
4718 | 4808 | // define the method WSGetUserFromUsername |
4719 | 4809 | function WSGetUserFromUsername($params) { |
4720 | 4810 | global $debug; |
4721 | - if ($debug) error_log('WSGetUserFromUsername'); |
|
4722 | - if ($debug) error_log('$params: '.print_r($params, 1)); |
|
4811 | + if ($debug) { |
|
4812 | + error_log('WSGetUserFromUsername'); |
|
4813 | + } |
|
4814 | + if ($debug) { |
|
4815 | + error_log('$params: '.print_r($params, 1)); |
|
4816 | + } |
|
4723 | 4817 | |
4724 | 4818 | if (!WSHelperVerifyKey($params)) { |
4725 | 4819 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -5169,7 +5263,9 @@ discard block |
||
5169 | 5263 | $orig_session_id_value[] = $original_session_id_value; |
5170 | 5264 | $results[] = 1; |
5171 | 5265 | |
5172 | - if ($debug) error_log("subscribe user:$user_id to session $sessionId"); |
|
5266 | + if ($debug) { |
|
5267 | + error_log("subscribe user:$user_id to session $sessionId"); |
|
5268 | + } |
|
5173 | 5269 | } |
5174 | 5270 | } |
5175 | 5271 | } // end principal foreach |
@@ -5253,7 +5349,9 @@ discard block |
||
5253 | 5349 | SESSION_VISIBLE_READ_ONLY, |
5254 | 5350 | false |
5255 | 5351 | ); |
5256 | - if ($debug) error_log('User registered to the course: '.$session_id); |
|
5352 | + if ($debug) { |
|
5353 | + error_log('User registered to the course: '.$session_id); |
|
5354 | + } |
|
5257 | 5355 | $result = 1; |
5258 | 5356 | } |
5259 | 5357 | } |
@@ -5399,7 +5497,9 @@ discard block |
||
5399 | 5497 | $orig_session_id_value[] = $original_session_id_value; |
5400 | 5498 | $results[] = 1; |
5401 | 5499 | |
5402 | - if ($debug) error_log("Unsubscribe user:$user_id to session:$id_session"); |
|
5500 | + if ($debug) { |
|
5501 | + error_log("Unsubscribe user:$user_id to session:$id_session"); |
|
5502 | + } |
|
5403 | 5503 | } |
5404 | 5504 | } |
5405 | 5505 | } // end principal foreach |
@@ -5546,7 +5646,9 @@ discard block |
||
5546 | 5646 | return returnError(WS_ERROR_SECRET_KEY); |
5547 | 5647 | } |
5548 | 5648 | |
5549 | - if ($debug) error_log('WSSuscribeCoursesToSession: '.print_r($params, 1)); |
|
5649 | + if ($debug) { |
|
5650 | + error_log('WSSuscribeCoursesToSession: '.print_r($params, 1)); |
|
5651 | + } |
|
5550 | 5652 | |
5551 | 5653 | $coursessessions_params = $params['coursessessions']; |
5552 | 5654 | $results = array(); |
@@ -5584,7 +5686,9 @@ discard block |
||
5584 | 5686 | array($courseInfo['real_id']), |
5585 | 5687 | false |
5586 | 5688 | ); |
5587 | - if ($debug) error_log("add_courses_to_session: course:$courseCode to session:$sessionId"); |
|
5689 | + if ($debug) { |
|
5690 | + error_log("add_courses_to_session: course:$courseCode to session:$sessionId"); |
|
5691 | + } |
|
5588 | 5692 | |
5589 | 5693 | $results[] = 1; |
5590 | 5694 | $orig_course_id_value[] = $original_session_id_value; |
@@ -5935,8 +6039,7 @@ discard block |
||
5935 | 6039 | UserManager::create_extra_field($params['original_user_id_name'], 1, $params['original_user_id_name'], ''); |
5936 | 6040 | // Save the external system's id into user_field_value table. |
5937 | 6041 | UserManager::update_extra_field_value($user_id, $params['original_user_id_name'], $params['original_user_id_value']); |
5938 | - } |
|
5939 | - else { |
|
6042 | + } else { |
|
5940 | 6043 | return 0; |
5941 | 6044 | } |
5942 | 6045 | } |
@@ -6086,8 +6189,12 @@ discard block |
||
6086 | 6189 | { |
6087 | 6190 | global $debug; |
6088 | 6191 | |
6089 | - if ($debug) error_log('WSUserSubscribedInCourse'); |
|
6090 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
6192 | + if ($debug) { |
|
6193 | + error_log('WSUserSubscribedInCourse'); |
|
6194 | + } |
|
6195 | + if ($debug) { |
|
6196 | + error_log('Params '. print_r($params, 1)); |
|
6197 | + } |
|
6091 | 6198 | if (!WSHelperVerifyKey($params)) { |
6092 | 6199 | |
6093 | 6200 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | } |
81 | 81 | |
82 | 82 | if ($debug) { |
83 | - error_log("checkip " . intval($check_ip)); |
|
83 | + error_log("checkip ".intval($check_ip)); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | if ($check_ip) { |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | '', |
139 | 139 | 'SOAP-ENC:Array', |
140 | 140 | array(), |
141 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:extras[]')), |
|
141 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:extras[]')), |
|
142 | 142 | 'tns:extras' |
143 | 143 | ); |
144 | 144 | |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | '', |
172 | 172 | 'SOAP-ENC:Array', |
173 | 173 | array(), |
174 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:usersParams[]')), |
|
174 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:usersParams[]')), |
|
175 | 175 | 'tns:usersParams' |
176 | 176 | ); |
177 | 177 | |
@@ -210,17 +210,17 @@ discard block |
||
210 | 210 | '', |
211 | 211 | 'SOAP-ENC:Array', |
212 | 212 | array(), |
213 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:result_createUsers[]')),'tns:result_createUsers' |
|
213 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:result_createUsers[]')), 'tns:result_createUsers' |
|
214 | 214 | ); |
215 | 215 | |
216 | 216 | // Register the method to expose |
217 | -$server->register('WSCreateUsers', // method name |
|
218 | - array('createUsers' => 'tns:createUsers'), // input parameters |
|
219 | - array('return' => 'tns:results_createUsers'), // output parameters |
|
220 | - 'urn:WSRegistration', // namespace |
|
221 | - 'urn:WSRegistration#WSCreateUsers', // soapaction |
|
222 | - 'rpc', // style |
|
223 | - 'encoded', // use |
|
217 | +$server->register('WSCreateUsers', // method name |
|
218 | + array('createUsers' => 'tns:createUsers'), // input parameters |
|
219 | + array('return' => 'tns:results_createUsers'), // output parameters |
|
220 | + 'urn:WSRegistration', // namespace |
|
221 | + 'urn:WSRegistration#WSCreateUsers', // soapaction |
|
222 | + 'rpc', // style |
|
223 | + 'encoded', // use |
|
224 | 224 | 'This service adds a user' // documentation |
225 | 225 | ); |
226 | 226 | |
@@ -401,7 +401,7 @@ discard block |
||
401 | 401 | continue; |
402 | 402 | } |
403 | 403 | |
404 | - $results[] = $userId; |
|
404 | + $results[] = $userId; |
|
405 | 405 | |
406 | 406 | } // end principal foreach |
407 | 407 | |
@@ -447,13 +447,13 @@ discard block |
||
447 | 447 | |
448 | 448 | |
449 | 449 | // Register the method to expose |
450 | -$server->register('WSCreateUser', // method name |
|
451 | - array('createUser' => 'tns:createUser'), // input parameters |
|
452 | - array('return' => 'xsd:string'), // output parameters |
|
453 | - 'urn:WSRegistration', // namespace |
|
454 | - 'urn:WSRegistration#WSCreateUser', // soapaction |
|
455 | - 'rpc', // style |
|
456 | - 'encoded', // use |
|
450 | +$server->register('WSCreateUser', // method name |
|
451 | + array('createUser' => 'tns:createUser'), // input parameters |
|
452 | + array('return' => 'xsd:string'), // output parameters |
|
453 | + 'urn:WSRegistration', // namespace |
|
454 | + 'urn:WSRegistration#WSCreateUser', // soapaction |
|
455 | + 'rpc', // style |
|
456 | + 'encoded', // use |
|
457 | 457 | 'This service adds a user' // documentation |
458 | 458 | ); |
459 | 459 | |
@@ -558,7 +558,7 @@ discard block |
||
558 | 558 | } |
559 | 559 | |
560 | 560 | if (isset($original_user_id_name) && isset($original_user_id_value)) { |
561 | - $_SESSION['ws_' . $original_user_id_name] = $original_user_id_value; |
|
561 | + $_SESSION['ws_'.$original_user_id_name] = $original_user_id_value; |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | /** @var User $user */ |
@@ -606,7 +606,7 @@ discard block |
||
606 | 606 | ); |
607 | 607 | |
608 | 608 | if (isset($original_user_id_name) && isset($original_user_id_value)) { |
609 | - unset($_SESSION['ws_' . $original_user_id_name]); |
|
609 | + unset($_SESSION['ws_'.$original_user_id_name]); |
|
610 | 610 | } |
611 | 611 | |
612 | 612 | if (is_array($extra_list) && count($extra_list) > 0) { |
@@ -658,7 +658,7 @@ discard block |
||
658 | 658 | 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
659 | 659 | 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), |
660 | 660 | 'expiration_date' => array('name' => 'expiration_date', 'type' => 'xsd:string'), |
661 | - 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
661 | + 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
662 | 662 | 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
663 | 663 | 'original_user_id_value'=> array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
664 | 664 | 'extra' => array('name' => 'extra', 'type' => 'tns:extrasList') |
@@ -686,7 +686,7 @@ discard block |
||
686 | 686 | 'all', |
687 | 687 | '', |
688 | 688 | array( |
689 | - 'users' => array('name' => 'users', 'type' => 'tns:createUsersPassEncryptParamsList'), |
|
689 | + 'users' => array('name' => 'users', 'type' => 'tns:createUsersPassEncryptParamsList'), |
|
690 | 690 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
691 | 691 | ) |
692 | 692 | ); |
@@ -716,13 +716,13 @@ discard block |
||
716 | 716 | ); |
717 | 717 | |
718 | 718 | // Register the method to expose |
719 | -$server->register('WSCreateUsersPasswordCrypted', // method name |
|
719 | +$server->register('WSCreateUsersPasswordCrypted', // method name |
|
720 | 720 | array('createUsersPasswordCrypted' => 'tns:createUsersPasswordCrypted'), // input parameters |
721 | - array('return' => 'tns:results_createUsersPassEncrypt'), // output parameters |
|
722 | - 'urn:WSRegistration', // namespace |
|
723 | - 'urn:WSRegistration#WSCreateUsersPasswordCrypted', // soapaction |
|
724 | - 'rpc', // style |
|
725 | - 'encoded', // use |
|
721 | + array('return' => 'tns:results_createUsersPassEncrypt'), // output parameters |
|
722 | + 'urn:WSRegistration', // namespace |
|
723 | + 'urn:WSRegistration#WSCreateUsersPasswordCrypted', // soapaction |
|
724 | + 'rpc', // style |
|
725 | + 'encoded', // use |
|
726 | 726 | 'This service adds users to the system' // documentation |
727 | 727 | ); |
728 | 728 | |
@@ -769,7 +769,7 @@ discard block |
||
769 | 769 | $salt = ''; |
770 | 770 | |
771 | 771 | if (!empty($_configuration['password_encryption'])) { |
772 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
772 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
773 | 773 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
774 | 774 | $msg = "Encryption $encrypt_method is invalid"; |
775 | 775 | $results[] = $msg; |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | |
793 | 793 | if (is_array($extra_list) && count($extra_list) > 0) { |
794 | 794 | foreach ($extra_list as $extra) { |
795 | - if($extra['field_name'] == 'salt') { |
|
795 | + if ($extra['field_name'] == 'salt') { |
|
796 | 796 | $salt = $extra['field_value']; |
797 | 797 | break; |
798 | 798 | } |
@@ -847,7 +847,7 @@ discard block |
||
847 | 847 | active='1', |
848 | 848 | hr_dept_id=".intval($hr_dept_id); |
849 | 849 | |
850 | - $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
|
850 | + $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
|
851 | 851 | Database::query($sql); |
852 | 852 | |
853 | 853 | if (is_array($extra_list) && count($extra_list) > 0) { |
@@ -967,7 +967,7 @@ discard block |
||
967 | 967 | |
968 | 968 | $count_results = count($results); |
969 | 969 | $output = array(); |
970 | - for($i = 0; $i < $count_results; $i++) { |
|
970 | + for ($i = 0; $i < $count_results; $i++) { |
|
971 | 971 | $output[] = array( |
972 | 972 | 'original_user_id_value' => $orig_user_id_value[$i], |
973 | 973 | 'result' => $results[$i], |
@@ -986,9 +986,9 @@ discard block |
||
986 | 986 | 'all', |
987 | 987 | '', |
988 | 988 | array( |
989 | - 'user_id' => array('name' => 'course', 'type' => 'xsd:string'), // Chamilo user Id |
|
990 | - 'session_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Current Session course ID |
|
991 | - 'course_id' =>array('name' => 'courseId', 'type' => 'xsd:string'), // Course Real Id |
|
989 | + 'user_id' => array('name' => 'course', 'type' => 'xsd:string'), // Chamilo user Id |
|
990 | + 'session_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Current Session course ID |
|
991 | + 'course_id' =>array('name' => 'courseId', 'type' => 'xsd:string'), // Course Real Id |
|
992 | 992 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string'), |
993 | 993 | |
994 | 994 | // optional |
@@ -1044,9 +1044,9 @@ discard block |
||
1044 | 1044 | ); |
1045 | 1045 | } |
1046 | 1046 | |
1047 | - if ($debug) error_log('$userId found: '. $userId); |
|
1048 | - if ($debug) error_log('$courseId found: '. $courseId); |
|
1049 | - if ($debug) error_log('$sessionId found: '. $sessionId); |
|
1047 | + if ($debug) error_log('$userId found: '.$userId); |
|
1048 | + if ($debug) error_log('$courseId found: '.$courseId); |
|
1049 | + if ($debug) error_log('$sessionId found: '.$sessionId); |
|
1050 | 1050 | |
1051 | 1051 | return [ |
1052 | 1052 | 'user_id' => $userId, |
@@ -1082,7 +1082,7 @@ discard block |
||
1082 | 1082 | return returnError(WS_ERROR_SECRET_KEY); |
1083 | 1083 | } |
1084 | 1084 | |
1085 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1085 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
1086 | 1086 | |
1087 | 1087 | $params = parseCourseSessionUserParams($params); |
1088 | 1088 | |
@@ -1095,13 +1095,13 @@ discard block |
||
1095 | 1095 | $result = 0; |
1096 | 1096 | |
1097 | 1097 | if (!empty($coaches)) { |
1098 | - if ($debug) error_log('Coaches: '. print_r($coaches, 1)); |
|
1098 | + if ($debug) error_log('Coaches: '.print_r($coaches, 1)); |
|
1099 | 1099 | if (in_array($userId, $coaches)) { |
1100 | 1100 | $result = 1; |
1101 | 1101 | } |
1102 | 1102 | } |
1103 | 1103 | |
1104 | - if ($debug) error_log('Result: '. $result); |
|
1104 | + if ($debug) error_log('Result: '.$result); |
|
1105 | 1105 | |
1106 | 1106 | return $result; |
1107 | 1107 | } |
@@ -1133,7 +1133,7 @@ discard block |
||
1133 | 1133 | return returnError(WS_ERROR_SECRET_KEY); |
1134 | 1134 | } |
1135 | 1135 | |
1136 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
1136 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
1137 | 1137 | |
1138 | 1138 | $params = parseCourseSessionUserParams($params); |
1139 | 1139 | |
@@ -1147,7 +1147,7 @@ discard block |
||
1147 | 1147 | $result = 0; |
1148 | 1148 | |
1149 | 1149 | if (!empty($coaches)) { |
1150 | - if ($debug) error_log('Coaches: ' . print_r($coaches, 1)); |
|
1150 | + if ($debug) error_log('Coaches: '.print_r($coaches, 1)); |
|
1151 | 1151 | if (!in_array($userId, $coaches)) { |
1152 | 1152 | $result = 1; |
1153 | 1153 | } |
@@ -1155,7 +1155,7 @@ discard block |
||
1155 | 1155 | $result = 1; |
1156 | 1156 | } |
1157 | 1157 | |
1158 | - if ($debug) error_log('Final Result: '. $result); |
|
1158 | + if ($debug) error_log('Final Result: '.$result); |
|
1159 | 1159 | |
1160 | 1160 | return $result; |
1161 | 1161 | } |
@@ -1173,32 +1173,32 @@ discard block |
||
1173 | 1173 | 'all', |
1174 | 1174 | '', |
1175 | 1175 | array( |
1176 | - 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
1177 | - 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
1178 | - 'status' => array('name' => 'status', 'type' => 'xsd:string'), |
|
1179 | - 'email' => array('name' => 'email', 'type' => 'xsd:string'), |
|
1180 | - 'loginname' => array('name' => 'loginname', 'type' => 'xsd:string'), |
|
1181 | - 'password' => array('name' => 'password', 'type' => 'xsd:string'), //encripted password using the encrypt_method |
|
1182 | - 'encrypt_method' => array('name' => 'encrypt_method', 'type' => 'xsd:string'), |
|
1183 | - 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
|
1184 | - 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), |
|
1185 | - 'expiration_date' => array('name' => 'expiration_date', 'type' => 'xsd:string'), |
|
1186 | - 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
1187 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
1188 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
1189 | - 'extra' => array('name' => 'extra', 'type' => 'tns:extrasList'), |
|
1190 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
1176 | + 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
1177 | + 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
1178 | + 'status' => array('name' => 'status', 'type' => 'xsd:string'), |
|
1179 | + 'email' => array('name' => 'email', 'type' => 'xsd:string'), |
|
1180 | + 'loginname' => array('name' => 'loginname', 'type' => 'xsd:string'), |
|
1181 | + 'password' => array('name' => 'password', 'type' => 'xsd:string'), //encripted password using the encrypt_method |
|
1182 | + 'encrypt_method' => array('name' => 'encrypt_method', 'type' => 'xsd:string'), |
|
1183 | + 'language' => array('name' => 'language', 'type' => 'xsd:string'), |
|
1184 | + 'phone' => array('name' => 'phone', 'type' => 'xsd:string'), |
|
1185 | + 'expiration_date' => array('name' => 'expiration_date', 'type' => 'xsd:string'), |
|
1186 | + 'official_code' => array('name' => 'official_code', 'type' => 'xsd:string'), |
|
1187 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
1188 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
1189 | + 'extra' => array('name' => 'extra', 'type' => 'tns:extrasList'), |
|
1190 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
1191 | 1191 | ) |
1192 | 1192 | ); |
1193 | 1193 | |
1194 | 1194 | // Register the method to expose |
1195 | -$server->register('WSCreateUserPasswordCrypted', // method name |
|
1196 | - array('createUserPasswordCrypted' => 'tns:createUserPasswordCrypted'), // input parameters |
|
1197 | - array('return' => 'xsd:string'), // output parameters |
|
1198 | - 'urn:WSRegistration', // namespace |
|
1199 | - 'urn:WSRegistration#WSCreateUserPasswordCrypted', // soapaction |
|
1200 | - 'rpc', // style |
|
1201 | - 'encoded', // use |
|
1195 | +$server->register('WSCreateUserPasswordCrypted', // method name |
|
1196 | + array('createUserPasswordCrypted' => 'tns:createUserPasswordCrypted'), // input parameters |
|
1197 | + array('return' => 'xsd:string'), // output parameters |
|
1198 | + 'urn:WSRegistration', // namespace |
|
1199 | + 'urn:WSRegistration#WSCreateUserPasswordCrypted', // soapaction |
|
1200 | + 'rpc', // style |
|
1201 | + 'encoded', // use |
|
1202 | 1202 | 'This service adds users' // documentation |
1203 | 1203 | ); |
1204 | 1204 | |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | global $_user, $_configuration, $debug; |
1209 | 1209 | $debug = 1; |
1210 | 1210 | if ($debug) error_log('WSCreateUserPasswordCrypted'); |
1211 | - if ($debug) error_log(print_r($params,1)); |
|
1211 | + if ($debug) error_log(print_r($params, 1)); |
|
1212 | 1212 | |
1213 | 1213 | if (!WSHelperVerifyKey($params)) { |
1214 | 1214 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -1241,7 +1241,7 @@ discard block |
||
1241 | 1241 | $extra_list = isset($params['extra']) ? $params['extra'] : ''; |
1242 | 1242 | |
1243 | 1243 | if (!empty($_configuration['password_encryption'])) { |
1244 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
1244 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
1245 | 1245 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
1246 | 1246 | $msg = "Encryption $encrypt_method is invalid"; |
1247 | 1247 | if ($debug) error_log($msg); |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | if (!is_null($auth_source)) { |
1304 | 1304 | $sql .= " auth_source='".Database::escape_string($auth_source)."',"; |
1305 | 1305 | } |
1306 | - $sql .= " |
|
1306 | + $sql .= " |
|
1307 | 1307 | password='".Database::escape_string($password)."', |
1308 | 1308 | email='".Database::escape_string($email)."', |
1309 | 1309 | status='".Database::escape_string($status)."', |
@@ -1312,7 +1312,7 @@ discard block |
||
1312 | 1312 | expiration_date='".Database::escape_string($expiration_date)."', |
1313 | 1313 | active='1', |
1314 | 1314 | hr_dept_id=".intval($hr_dept_id); |
1315 | - $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
|
1315 | + $sql .= " WHERE user_id='".$r_check_user[0]."'"; |
|
1316 | 1316 | if ($debug) error_log($sql); |
1317 | 1317 | Database::query($sql); |
1318 | 1318 | |
@@ -1492,13 +1492,13 @@ discard block |
||
1492 | 1492 | ); |
1493 | 1493 | |
1494 | 1494 | // Register the method to expose |
1495 | -$server->register('WSEditUserCredentials', // method name |
|
1496 | - array('editUserCredentials' => 'tns:editUserCredentials'), // input parameters |
|
1497 | - array('return' => 'xsd:string'), // output parameters |
|
1498 | - 'urn:WSRegistration', // namespace |
|
1499 | - 'urn:WSRegistration#WSEditUserCredentials', // soapaction |
|
1500 | - 'rpc', // style |
|
1501 | - 'encoded', // use |
|
1495 | +$server->register('WSEditUserCredentials', // method name |
|
1496 | + array('editUserCredentials' => 'tns:editUserCredentials'), // input parameters |
|
1497 | + array('return' => 'xsd:string'), // output parameters |
|
1498 | + 'urn:WSRegistration', // namespace |
|
1499 | + 'urn:WSRegistration#WSEditUserCredentials', // soapaction |
|
1500 | + 'rpc', // style |
|
1501 | + 'encoded', // use |
|
1502 | 1502 | 'This service edits the username and password of a user' // documentation |
1503 | 1503 | ); |
1504 | 1504 | |
@@ -1597,13 +1597,13 @@ discard block |
||
1597 | 1597 | ); |
1598 | 1598 | |
1599 | 1599 | // Register the method to expose |
1600 | -$server->register('WSEditUsers', // method name |
|
1601 | - array('editUsers' => 'tns:editUsers'), // input parameters |
|
1600 | +$server->register('WSEditUsers', // method name |
|
1601 | + array('editUsers' => 'tns:editUsers'), // input parameters |
|
1602 | 1602 | array('return' => 'tns:results_editUsers'), // output parameters |
1603 | - 'urn:WSRegistration', // namespace |
|
1604 | - 'urn:WSRegistration#WSEditUsers', // soapaction |
|
1605 | - 'rpc', // style |
|
1606 | - 'encoded', // use |
|
1603 | + 'urn:WSRegistration', // namespace |
|
1604 | + 'urn:WSRegistration#WSEditUsers', // soapaction |
|
1605 | + 'rpc', // style |
|
1606 | + 'encoded', // use |
|
1607 | 1607 | 'This service edits a user from wiener' // documentation |
1608 | 1608 | ); |
1609 | 1609 | |
@@ -1795,13 +1795,13 @@ discard block |
||
1795 | 1795 | ); |
1796 | 1796 | |
1797 | 1797 | // Register the method to expose |
1798 | -$server->register('WSEditUser', // method name |
|
1799 | - array('editUser' => 'tns:editUser'), // input parameters |
|
1800 | - array('return' => 'xsd:string'), // output parameters |
|
1801 | - 'urn:WSRegistration', // namespace |
|
1802 | - 'urn:WSRegistration#WSEditUser', // soapaction |
|
1803 | - 'rpc', // style |
|
1804 | - 'encoded', // use |
|
1798 | +$server->register('WSEditUser', // method name |
|
1799 | + array('editUser' => 'tns:editUser'), // input parameters |
|
1800 | + array('return' => 'xsd:string'), // output parameters |
|
1801 | + 'urn:WSRegistration', // namespace |
|
1802 | + 'urn:WSRegistration#WSEditUser', // soapaction |
|
1803 | + 'rpc', // style |
|
1804 | + 'encoded', // use |
|
1805 | 1805 | 'This service edits a user from wiener' // documentation |
1806 | 1806 | ); |
1807 | 1807 | |
@@ -1972,13 +1972,13 @@ discard block |
||
1972 | 1972 | ); |
1973 | 1973 | |
1974 | 1974 | // Register the method to expose |
1975 | -$server->register('WSEditUserWithPicture', // method name |
|
1976 | - array('editUserWithPicture' => 'tns:editUserWithPicture'), // input parameters |
|
1977 | - array('return' => 'xsd:string'), // output parameters |
|
1978 | - 'urn:WSRegistration', // namespace |
|
1979 | - 'urn:WSRegistration#WSEditUserWithPicture', // soapaction |
|
1980 | - 'rpc', // style |
|
1981 | - 'encoded', // use |
|
1975 | +$server->register('WSEditUserWithPicture', // method name |
|
1976 | + array('editUserWithPicture' => 'tns:editUserWithPicture'), // input parameters |
|
1977 | + array('return' => 'xsd:string'), // output parameters |
|
1978 | + 'urn:WSRegistration', // namespace |
|
1979 | + 'urn:WSRegistration#WSEditUserWithPicture', // soapaction |
|
1980 | + 'rpc', // style |
|
1981 | + 'encoded', // use |
|
1982 | 1982 | 'This service edits a user from wiener' // documentation |
1983 | 1983 | ); |
1984 | 1984 | |
@@ -2036,8 +2036,8 @@ discard block |
||
2036 | 2036 | $tempDir = api_get_path(SYS_ARCHIVE_PATH); |
2037 | 2037 | // Make sure the file download was OK by checking the HTTP headers for OK |
2038 | 2038 | if (strpos(get_headers($picture_url)[0], "OK")) { |
2039 | - file_put_contents($tempDir . $filename, file_get_contents($picture_url)); |
|
2040 | - $pictureUri = UserManager::update_user_picture($user_id, $filename, $tempDir . $filename); |
|
2039 | + file_put_contents($tempDir.$filename, file_get_contents($picture_url)); |
|
2040 | + $pictureUri = UserManager::update_user_picture($user_id, $filename, $tempDir.$filename); |
|
2041 | 2041 | } |
2042 | 2042 | |
2043 | 2043 | if ($user_id == 0) { |
@@ -2108,7 +2108,7 @@ discard block |
||
2108 | 2108 | ->setExpirationDate($expiration_date) |
2109 | 2109 | ->setHrDeptId($hr_dept_id) |
2110 | 2110 | ->setActive(true) |
2111 | - ->setPictureUri($pictureUri);; |
|
2111 | + ->setPictureUri($pictureUri); ; |
|
2112 | 2112 | |
2113 | 2113 | if (!is_null($creator_id)) { |
2114 | 2114 | $user->setCreatorId($creator_id); |
@@ -2205,13 +2205,13 @@ discard block |
||
2205 | 2205 | ); |
2206 | 2206 | |
2207 | 2207 | // Register the method to expose |
2208 | -$server->register('WSEditUsersPasswordCrypted', // method name |
|
2209 | - array('editUsersPasswordCrypted' => 'tns:editUsersPasswordCrypted'), // input parameters |
|
2210 | - array('return' => 'tns:results_editUsersPasswordCrypted'), // output parameters |
|
2211 | - 'urn:WSRegistration', // namespace |
|
2212 | - 'urn:WSRegistration#WSEditUsersPasswordCrypted', // soapaction |
|
2213 | - 'rpc', // style |
|
2214 | - 'encoded', // use |
|
2208 | +$server->register('WSEditUsersPasswordCrypted', // method name |
|
2209 | + array('editUsersPasswordCrypted' => 'tns:editUsersPasswordCrypted'), // input parameters |
|
2210 | + array('return' => 'tns:results_editUsersPasswordCrypted'), // output parameters |
|
2211 | + 'urn:WSRegistration', // namespace |
|
2212 | + 'urn:WSRegistration#WSEditUsersPasswordCrypted', // soapaction |
|
2213 | + 'rpc', // style |
|
2214 | + 'encoded', // use |
|
2215 | 2215 | 'This service edits a user' // documentation |
2216 | 2216 | ); |
2217 | 2217 | |
@@ -2219,7 +2219,7 @@ discard block |
||
2219 | 2219 | function WSEditUsersPasswordCrypted($params) { |
2220 | 2220 | global $_configuration; |
2221 | 2221 | |
2222 | - if(!WSHelperVerifyKey($params)) { |
|
2222 | + if (!WSHelperVerifyKey($params)) { |
|
2223 | 2223 | return returnError(WS_ERROR_SECRET_KEY); |
2224 | 2224 | } |
2225 | 2225 | |
@@ -2256,7 +2256,7 @@ discard block |
||
2256 | 2256 | |
2257 | 2257 | $password = $user_param['password']; |
2258 | 2258 | $encrypt_method = $user_param['encrypt_method']; |
2259 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
2259 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
2260 | 2260 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
2261 | 2261 | $msg = "Encryption $encrypt_method is invalid"; |
2262 | 2262 | $results[] = $msg; |
@@ -2271,11 +2271,11 @@ discard block |
||
2271 | 2271 | $results[] = $msg; |
2272 | 2272 | continue; |
2273 | 2273 | } |
2274 | - } elseif (!empty($user_param['password']) && empty($user_param['encrypt_method'])){ |
|
2274 | + } elseif (!empty($user_param['password']) && empty($user_param['encrypt_method'])) { |
|
2275 | 2275 | $msg = "If password is not empty the encrypt_method param is required "; |
2276 | 2276 | $results[] = $msg; |
2277 | 2277 | continue; |
2278 | - } elseif (empty($user_param['password']) && !empty($user_param['encrypt_method'])){ |
|
2278 | + } elseif (empty($user_param['password']) && !empty($user_param['encrypt_method'])) { |
|
2279 | 2279 | $msg = "If encrypt_method is not empty the password param is required "; |
2280 | 2280 | $results[] = $msg; |
2281 | 2281 | continue; |
@@ -2411,13 +2411,13 @@ discard block |
||
2411 | 2411 | ); |
2412 | 2412 | |
2413 | 2413 | // Register the method to expose |
2414 | -$server->register('WSEditUserPasswordCrypted', // method name |
|
2414 | +$server->register('WSEditUserPasswordCrypted', // method name |
|
2415 | 2415 | array('editUserPasswordCrypted' => 'tns:editUserPasswordCrypted'), // input parameters |
2416 | - array('return' => 'xsd:string'), // output parameters |
|
2417 | - 'urn:WSRegistration', // namespace |
|
2418 | - 'urn:WSRegistration#WSEditUserPasswordCrypted', // soapaction |
|
2419 | - 'rpc', // style |
|
2420 | - 'encoded', // use |
|
2416 | + array('return' => 'xsd:string'), // output parameters |
|
2417 | + 'urn:WSRegistration', // namespace |
|
2418 | + 'urn:WSRegistration#WSEditUserPasswordCrypted', // soapaction |
|
2419 | + 'rpc', // style |
|
2420 | + 'encoded', // use |
|
2421 | 2421 | 'This service edits a user' // documentation |
2422 | 2422 | ); |
2423 | 2423 | |
@@ -2461,7 +2461,7 @@ discard block |
||
2461 | 2461 | if (!empty($params['password']) && !empty($params['encrypt_method'])) { |
2462 | 2462 | $password = $params['password']; |
2463 | 2463 | $encrypt_method = $params['encrypt_method']; |
2464 | - if ($_configuration['password_encryption'] === $encrypt_method ) { |
|
2464 | + if ($_configuration['password_encryption'] === $encrypt_method) { |
|
2465 | 2465 | if ($encrypt_method == 'md5' && !preg_match('/^[A-Fa-f0-9]{32}$/', $password)) { |
2466 | 2466 | $msg = "Encryption $encrypt_method is invalid"; |
2467 | 2467 | return $msg; |
@@ -2602,7 +2602,7 @@ discard block |
||
2602 | 2602 | '', |
2603 | 2603 | 'SOAP-ENC:Array', |
2604 | 2604 | array(), |
2605 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:user_id[]')),'tns:user_id' |
|
2605 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:user_id[]')), 'tns:user_id' |
|
2606 | 2606 | ); |
2607 | 2607 | |
2608 | 2608 | $server->wsdl->addComplexType( |
@@ -2618,35 +2618,35 @@ discard block |
||
2618 | 2618 | ); |
2619 | 2619 | |
2620 | 2620 | function WSHelperActionOnUsers($params, $type) { |
2621 | - if(!WSHelperVerifyKey($params)) { |
|
2621 | + if (!WSHelperVerifyKey($params)) { |
|
2622 | 2622 | return returnError(WS_ERROR_SECRET_KEY); |
2623 | 2623 | } |
2624 | 2624 | |
2625 | 2625 | $original_user_ids = $params['ids']; |
2626 | - foreach($original_user_ids as $original_user_id) { |
|
2626 | + foreach ($original_user_ids as $original_user_id) { |
|
2627 | 2627 | $user_id = UserManager::get_user_id_from_original_id( |
2628 | 2628 | $original_user_id['original_user_id_value'], |
2629 | 2629 | $original_user_id['original_user_id_name'] |
2630 | 2630 | ); |
2631 | - if($user_id > 0) { |
|
2632 | - if($type == "delete") { |
|
2631 | + if ($user_id > 0) { |
|
2632 | + if ($type == "delete") { |
|
2633 | 2633 | UserManager::delete_user($user_id); |
2634 | - } else if($type == "disable") { |
|
2634 | + } else if ($type == "disable") { |
|
2635 | 2635 | UserManager::disable($user_id); |
2636 | - } else if($type == "enable") { |
|
2636 | + } else if ($type == "enable") { |
|
2637 | 2637 | UserManager::enable($user_id); |
2638 | 2638 | } |
2639 | 2639 | } |
2640 | 2640 | } |
2641 | 2641 | } |
2642 | 2642 | |
2643 | -$server->register('WSDeleteUsers', // method name |
|
2644 | - array('user_ids' => 'tns:user_ids'), // input parameters |
|
2645 | - array(), // output parameters |
|
2646 | - 'urn:WSRegistration', // namespace |
|
2647 | - 'urn:WSRegistration#WSDeleteUsers', // soapaction |
|
2648 | - 'rpc', // style |
|
2649 | - 'encoded', // use |
|
2643 | +$server->register('WSDeleteUsers', // method name |
|
2644 | + array('user_ids' => 'tns:user_ids'), // input parameters |
|
2645 | + array(), // output parameters |
|
2646 | + 'urn:WSRegistration', // namespace |
|
2647 | + 'urn:WSRegistration#WSDeleteUsers', // soapaction |
|
2648 | + 'rpc', // style |
|
2649 | + 'encoded', // use |
|
2650 | 2650 | 'Deletes users provided as parameters from the system' // documentation |
2651 | 2651 | ); |
2652 | 2652 | |
@@ -2655,13 +2655,13 @@ discard block |
||
2655 | 2655 | } |
2656 | 2656 | |
2657 | 2657 | /** WSDisableUsers **/ |
2658 | -$server->register('WSDisableUsers', // method name |
|
2659 | - array('user_ids' => 'tns:user_ids'), // input parameters |
|
2660 | - array(), // output parameters |
|
2661 | - 'urn:WSRegistration', // namespace |
|
2662 | - 'urn:WSRegistration#WSDisableUsers', // soapaction |
|
2663 | - 'rpc', // style |
|
2664 | - 'encoded', // use |
|
2658 | +$server->register('WSDisableUsers', // method name |
|
2659 | + array('user_ids' => 'tns:user_ids'), // input parameters |
|
2660 | + array(), // output parameters |
|
2661 | + 'urn:WSRegistration', // namespace |
|
2662 | + 'urn:WSRegistration#WSDisableUsers', // soapaction |
|
2663 | + 'rpc', // style |
|
2664 | + 'encoded', // use |
|
2665 | 2665 | 'Disables users provided as parameters from the system' // documentation |
2666 | 2666 | ); |
2667 | 2667 | |
@@ -2670,13 +2670,13 @@ discard block |
||
2670 | 2670 | } |
2671 | 2671 | |
2672 | 2672 | /** WSEnableUsers **/ |
2673 | -$server->register('WSEnableUsers', // method name |
|
2674 | - array('user_ids' => 'tns:user_ids'), // input parameters |
|
2675 | - array(), // output parameters |
|
2676 | - 'urn:WSRegistration', // namespace |
|
2677 | - 'urn:WSRegistration#WSEnableUsers', // soapaction |
|
2678 | - 'rpc', // style |
|
2679 | - 'encoded', // use |
|
2673 | +$server->register('WSEnableUsers', // method name |
|
2674 | + array('user_ids' => 'tns:user_ids'), // input parameters |
|
2675 | + array(), // output parameters |
|
2676 | + 'urn:WSRegistration', // namespace |
|
2677 | + 'urn:WSRegistration#WSEnableUsers', // soapaction |
|
2678 | + 'rpc', // style |
|
2679 | + 'encoded', // use |
|
2680 | 2680 | 'Enables users provided as parameters' // documentation |
2681 | 2681 | ); |
2682 | 2682 | |
@@ -2726,7 +2726,7 @@ discard block |
||
2726 | 2726 | '', |
2727 | 2727 | 'SOAP-ENC:Array', |
2728 | 2728 | array(), |
2729 | - array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:createCourseParams[]')),'tns:createCourseParams' |
|
2729 | + array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:createCourseParams[]')), 'tns:createCourseParams' |
|
2730 | 2730 | ); |
2731 | 2731 | |
2732 | 2732 | // Register the data structures used by the service |
@@ -2767,13 +2767,13 @@ discard block |
||
2767 | 2767 | ); |
2768 | 2768 | |
2769 | 2769 | // Register the method to expose |
2770 | -$server->register('WSCreateCourse', // method name |
|
2771 | - array('createCourse' => 'tns:createCourse'), // input parameters |
|
2770 | +$server->register('WSCreateCourse', // method name |
|
2771 | + array('createCourse' => 'tns:createCourse'), // input parameters |
|
2772 | 2772 | array('return' => 'tns:results_createCourse'), // output parameters |
2773 | - 'urn:WSRegistration', // namespace |
|
2774 | - 'urn:WSRegistration#WSCreateCourse', // soapaction |
|
2775 | - 'rpc', // style |
|
2776 | - 'encoded', // use |
|
2773 | + 'urn:WSRegistration', // namespace |
|
2774 | + 'urn:WSRegistration#WSCreateCourse', // soapaction |
|
2775 | + 'rpc', // style |
|
2776 | + 'encoded', // use |
|
2777 | 2777 | 'This service adds a course' // documentation |
2778 | 2778 | ); |
2779 | 2779 | |
@@ -2829,7 +2829,7 @@ discard block |
||
2829 | 2829 | category_code='".Database::escape_string($category_code)."', |
2830 | 2830 | tutor_name='".Database::escape_string($tutor_name)."', |
2831 | 2831 | visual_code='".Database::escape_string($wanted_code)."'"; |
2832 | - if($visibility !== null) { |
|
2832 | + if ($visibility !== null) { |
|
2833 | 2833 | $sql .= ", visibility = '$visibility' "; |
2834 | 2834 | } |
2835 | 2835 | $sql .= " WHERE id='".$courseInfo['real_id']."'"; |
@@ -2879,7 +2879,7 @@ discard block |
||
2879 | 2879 | $params['title'] = $title; |
2880 | 2880 | $params['wanted_code'] = $wanted_code; |
2881 | 2881 | $params['category_code'] = $category_code; |
2882 | - $params['course_category'] = $category_code; |
|
2882 | + $params['course_category'] = $category_code; |
|
2883 | 2883 | $params['tutor_name'] = $tutor_name; |
2884 | 2884 | $params['course_language'] = $course_language; |
2885 | 2885 | $params['user_id'] = api_get_user_id(); |
@@ -3010,13 +3010,13 @@ discard block |
||
3010 | 3010 | |
3011 | 3011 | |
3012 | 3012 | // Register the method to expose |
3013 | -$server->register('WSCreateCourseByTitle', // method name |
|
3013 | +$server->register('WSCreateCourseByTitle', // method name |
|
3014 | 3014 | array('createCourseByTitle' => 'tns:createCourseByTitle'), // input parameters |
3015 | - array('return' => 'tns:results_createCourseByTitle'), // output parameters |
|
3016 | - 'urn:WSRegistration', // namespace |
|
3017 | - 'urn:WSRegistration#WSCreateCourseByTitle', // soapaction |
|
3018 | - 'rpc', // style |
|
3019 | - 'encoded', // use |
|
3015 | + array('return' => 'tns:results_createCourseByTitle'), // output parameters |
|
3016 | + 'urn:WSRegistration', // namespace |
|
3017 | + 'urn:WSRegistration#WSCreateCourseByTitle', // soapaction |
|
3018 | + 'rpc', // style |
|
3019 | + 'encoded', // use |
|
3020 | 3020 | 'This service adds a course by title' // documentation |
3021 | 3021 | ); |
3022 | 3022 | |
@@ -3247,18 +3247,18 @@ discard block |
||
3247 | 3247 | ); |
3248 | 3248 | |
3249 | 3249 | // Register the method to expose |
3250 | -$server->register('WSEditCourse', // method name |
|
3251 | - array('editCourse' => 'tns:editCourse'), // input parameters |
|
3250 | +$server->register('WSEditCourse', // method name |
|
3251 | + array('editCourse' => 'tns:editCourse'), // input parameters |
|
3252 | 3252 | array('return' => 'tns:results_editCourse'), // output parameters |
3253 | - 'urn:WSRegistration', // namespace |
|
3254 | - 'urn:WSRegistration#WSEditCourse', // soapaction |
|
3255 | - 'rpc', // style |
|
3256 | - 'encoded', // use |
|
3253 | + 'urn:WSRegistration', // namespace |
|
3254 | + 'urn:WSRegistration#WSEditCourse', // soapaction |
|
3255 | + 'rpc', // style |
|
3256 | + 'encoded', // use |
|
3257 | 3257 | 'This service edits a course' // documentation |
3258 | 3258 | ); |
3259 | 3259 | |
3260 | 3260 | // Define the method WSEditCourse |
3261 | -function WSEditCourse($params){ |
|
3261 | +function WSEditCourse($params) { |
|
3262 | 3262 | |
3263 | 3263 | global $_configuration; |
3264 | 3264 | if (!WSHelperVerifyKey($params)) { |
@@ -3413,13 +3413,13 @@ discard block |
||
3413 | 3413 | |
3414 | 3414 | |
3415 | 3415 | // Register the method to expose |
3416 | -$server->register('WSCourseDescription', // method name |
|
3417 | - array('courseDescription' => 'tns:courseDescription'), // input parameters |
|
3418 | - array('return' => 'tns:fields_course_desc_list'), // output parameters |
|
3419 | - 'urn:WSRegistration', // namespace |
|
3420 | - 'urn:WSRegistration#WSCourseDescription', // soapaction |
|
3421 | - 'rpc', // style |
|
3422 | - 'encoded', // use |
|
3416 | +$server->register('WSCourseDescription', // method name |
|
3417 | + array('courseDescription' => 'tns:courseDescription'), // input parameters |
|
3418 | + array('return' => 'tns:fields_course_desc_list'), // output parameters |
|
3419 | + 'urn:WSRegistration', // namespace |
|
3420 | + 'urn:WSRegistration#WSCourseDescription', // soapaction |
|
3421 | + 'rpc', // style |
|
3422 | + 'encoded', // use |
|
3423 | 3423 | 'This service edits a course description' // documentation |
3424 | 3424 | ); |
3425 | 3425 | |
@@ -3472,14 +3472,14 @@ discard block |
||
3472 | 3472 | } |
3473 | 3473 | |
3474 | 3474 | while ($row = Database::fetch_array($result)) { |
3475 | - $ind = (int)$row['id']; |
|
3475 | + $ind = (int) $row['id']; |
|
3476 | 3476 | $array_course_desc_title[$ind] = $row['title']; |
3477 | 3477 | $array_course_desc_content[$ind] = $row['content']; |
3478 | 3478 | } |
3479 | 3479 | |
3480 | 3480 | $count_results = count($default_titles); |
3481 | 3481 | $output = array(); |
3482 | - for($i = 1; $i <= $count_results; $i++) { |
|
3482 | + for ($i = 1; $i <= $count_results; $i++) { |
|
3483 | 3483 | $output[] = array( |
3484 | 3484 | 'course_desc_id' => $array_course_desc_id[$i], |
3485 | 3485 | 'course_desc_default_title' => $array_course_desc_default_title[$i], |
@@ -3559,13 +3559,13 @@ discard block |
||
3559 | 3559 | |
3560 | 3560 | |
3561 | 3561 | // Register the method to expose |
3562 | -$server->register('WSEditCourseDescription', // method name |
|
3562 | +$server->register('WSEditCourseDescription', // method name |
|
3563 | 3563 | array('editCourseDescription' => 'tns:editCourseDescription'), // input parameters |
3564 | - array('return' => 'tns:results_editCourseDescription'), // output parameters |
|
3565 | - 'urn:WSRegistration', // namespace |
|
3566 | - 'urn:WSRegistration#WSEditCourseDescription', // soapaction |
|
3567 | - 'rpc', // style |
|
3568 | - 'encoded', // use |
|
3564 | + array('return' => 'tns:results_editCourseDescription'), // output parameters |
|
3565 | + 'urn:WSRegistration', // namespace |
|
3566 | + 'urn:WSRegistration#WSEditCourseDescription', // soapaction |
|
3567 | + 'rpc', // style |
|
3568 | + 'encoded', // use |
|
3569 | 3569 | 'This service edits a course description' // documentation |
3570 | 3570 | ); |
3571 | 3571 | |
@@ -3609,7 +3609,7 @@ discard block |
||
3609 | 3609 | $course_desc_title = Database::escape_string($course_desc_title); |
3610 | 3610 | $course_desc_content = Database::escape_string($course_desc_content); |
3611 | 3611 | |
3612 | - $course_desc_id = (int)$course_desc_id; |
|
3612 | + $course_desc_id = (int) $course_desc_id; |
|
3613 | 3613 | if ($course_desc_id > 8 && $course_desc_id < 1) { |
3614 | 3614 | $results[] = 0; // course_desc_id invalid. |
3615 | 3615 | continue; |
@@ -3643,7 +3643,7 @@ discard block |
||
3643 | 3643 | |
3644 | 3644 | $count_results = count($results); |
3645 | 3645 | $output = array(); |
3646 | - for($i = 0; $i < $count_results; $i++) { |
|
3646 | + for ($i = 0; $i < $count_results; $i++) { |
|
3647 | 3647 | $output[] = array( |
3648 | 3648 | 'original_course_id_value' => $orig_course_id_value[$i], |
3649 | 3649 | 'result' => $results[$i], |
@@ -3715,13 +3715,13 @@ discard block |
||
3715 | 3715 | 'tns:result_deleteCourse' |
3716 | 3716 | ); |
3717 | 3717 | |
3718 | -$server->register('WSDeleteCourse', // method name |
|
3719 | - array('deleteCourse' => 'tns:deleteCourse'), // input parameters |
|
3718 | +$server->register('WSDeleteCourse', // method name |
|
3719 | + array('deleteCourse' => 'tns:deleteCourse'), // input parameters |
|
3720 | 3720 | array('return' => 'tns:results_deleteCourse'), // output parameters |
3721 | - 'urn:WSRegistration', // namespace |
|
3722 | - 'urn:WSRegistration#WSDeleteCourse', // soapaction |
|
3723 | - 'rpc', // style |
|
3724 | - 'encoded', // use |
|
3721 | + 'urn:WSRegistration', // namespace |
|
3722 | + 'urn:WSRegistration#WSDeleteCourse', // soapaction |
|
3723 | + 'rpc', // style |
|
3724 | + 'encoded', // use |
|
3725 | 3725 | 'This service deletes a course ' // documentation |
3726 | 3726 | ); |
3727 | 3727 | |
@@ -3847,13 +3847,13 @@ discard block |
||
3847 | 3847 | ); |
3848 | 3848 | |
3849 | 3849 | // Register the method to expose |
3850 | -$server->register('WSCreateSession', // method name |
|
3851 | - array('createSession' => 'tns:createSession'), // input parameters |
|
3850 | +$server->register('WSCreateSession', // method name |
|
3851 | + array('createSession' => 'tns:createSession'), // input parameters |
|
3852 | 3852 | array('return' => 'tns:results_createSession'), // output parameters |
3853 | - 'urn:WSRegistration', // namespace |
|
3854 | - 'urn:WSRegistration#WSCreateSession', // soapaction |
|
3855 | - 'rpc', // style |
|
3856 | - 'encoded', // use |
|
3853 | + 'urn:WSRegistration', // namespace |
|
3854 | + 'urn:WSRegistration#WSCreateSession', // soapaction |
|
3855 | + 'rpc', // style |
|
3856 | + 'encoded', // use |
|
3857 | 3857 | 'This service edits a session' // documentation |
3858 | 3858 | ); |
3859 | 3859 | |
@@ -3907,8 +3907,8 @@ discard block |
||
3907 | 3907 | } |
3908 | 3908 | |
3909 | 3909 | if (empty($nolimit)) { |
3910 | - $date_start = "$year_start-".(($month_start < 10)?"0$month_start":$month_start)."-".(($day_start < 10)?"0$day_start":$day_start) . ' 00:00:00'; |
|
3911 | - $date_end = "$year_end-".(($month_end < 10)?"0$month_end":$month_end)."-".(($day_end < 10)?"0$day_end":$day_end) . ' 23:59:59'; |
|
3910 | + $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start).' 00:00:00'; |
|
3911 | + $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end).' 23:59:59'; |
|
3912 | 3912 | } else { |
3913 | 3913 | $date_start = ""; |
3914 | 3914 | $date_end = ""; |
@@ -3926,7 +3926,7 @@ discard block |
||
3926 | 3926 | } |
3927 | 3927 | $results[] = 0; |
3928 | 3928 | continue; |
3929 | - } elseif (empty($nolimit) && (!$month_end || !$day_end || !$year_end || !checkdate($month_end, $day_end, $year_end))) { |
|
3929 | + } elseif (empty($nolimit) && (!$month_end || !$day_end || !$year_end || !checkdate($month_end, $day_end, $year_end))) { |
|
3930 | 3930 | $results[] = 0; |
3931 | 3931 | if ($debug) { |
3932 | 3932 | error_log("There's an error with the end date: $month_end - $day_end - $year_end"); |
@@ -4029,7 +4029,7 @@ discard block |
||
4029 | 4029 | |
4030 | 4030 | $count_results = count($results); |
4031 | 4031 | $output = array(); |
4032 | - for($i = 0; $i < $count_results; $i++) { |
|
4032 | + for ($i = 0; $i < $count_results; $i++) { |
|
4033 | 4033 | $output[] = array( |
4034 | 4034 | 'original_session_id_value' => $orig_session_id_value[$i], |
4035 | 4035 | 'result' => $results[$i], |
@@ -4114,13 +4114,13 @@ discard block |
||
4114 | 4114 | |
4115 | 4115 | |
4116 | 4116 | // Register the method to expose |
4117 | -$server->register('WSEditSession', // method name |
|
4118 | - array('editSession' => 'tns:editSession'), // input parameters |
|
4117 | +$server->register('WSEditSession', // method name |
|
4118 | + array('editSession' => 'tns:editSession'), // input parameters |
|
4119 | 4119 | array('return' => 'tns:results_editSession'), // output parameters |
4120 | - 'urn:WSRegistration', // namespace |
|
4121 | - 'urn:WSRegistration#WSEditSession', // soapaction |
|
4122 | - 'rpc', // style |
|
4123 | - 'encoded', // use |
|
4120 | + 'urn:WSRegistration', // namespace |
|
4121 | + 'urn:WSRegistration#WSEditSession', // soapaction |
|
4122 | + 'rpc', // style |
|
4123 | + 'encoded', // use |
|
4124 | 4124 | 'This service edits a session' // documentation |
4125 | 4125 | ); |
4126 | 4126 | |
@@ -4170,11 +4170,11 @@ discard block |
||
4170 | 4170 | } |
4171 | 4171 | |
4172 | 4172 | if (empty($nolimit)) { |
4173 | - $date_start="$year_start-".(($month_start < 10)?"0$month_start":$month_start)."-".(($day_start < 10)?"0$day_start":$day_start); |
|
4174 | - $date_end="$year_end-".(($month_end < 10)?"0$month_end":$month_end)."-".(($day_end < 10)?"0$day_end":$day_end); |
|
4173 | + $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start); |
|
4174 | + $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end); |
|
4175 | 4175 | } else { |
4176 | - $date_start=""; |
|
4177 | - $date_end=""; |
|
4176 | + $date_start = ""; |
|
4177 | + $date_end = ""; |
|
4178 | 4178 | } |
4179 | 4179 | if (empty($name)) { |
4180 | 4180 | $results[] = 0; //SessionNameIsRequired |
@@ -4318,13 +4318,13 @@ discard block |
||
4318 | 4318 | 'tns:result_deleteSession' |
4319 | 4319 | ); |
4320 | 4320 | |
4321 | -$server->register('WSDeleteSession', // method name |
|
4322 | - array('deleteSession' => 'tns:deleteSession'), // input parameters |
|
4321 | +$server->register('WSDeleteSession', // method name |
|
4322 | + array('deleteSession' => 'tns:deleteSession'), // input parameters |
|
4323 | 4323 | array('return' => 'tns:results_deleteSession'), // output parameters |
4324 | - 'urn:WSRegistration', // namespace |
|
4325 | - 'urn:WSRegistration#WSDeleteSession', // soapaction |
|
4326 | - 'rpc', // style |
|
4327 | - 'encoded', // use |
|
4324 | + 'urn:WSRegistration', // namespace |
|
4325 | + 'urn:WSRegistration#WSDeleteSession', // soapaction |
|
4326 | + 'rpc', // style |
|
4327 | + 'encoded', // use |
|
4328 | 4328 | 'This service deletes a session ' // documentation |
4329 | 4329 | ); |
4330 | 4330 | |
@@ -4406,10 +4406,10 @@ discard block |
||
4406 | 4406 | 'struct', |
4407 | 4407 | 'all', |
4408 | 4408 | '', |
4409 | - array ( |
|
4409 | + array( |
|
4410 | 4410 | 'course_id' => array('name' => 'course_id', 'type' => 'tns:course_id'), |
4411 | - 'user_id' => array('name' => 'user_id', 'type' => 'tns:user_id'), |
|
4412 | - 'status' => array('name' => 'status', 'type' => 'xsd:int') |
|
4411 | + 'user_id' => array('name' => 'user_id', 'type' => 'tns:user_id'), |
|
4412 | + 'status' => array('name' => 'status', 'type' => 'xsd:int') |
|
4413 | 4413 | ) |
4414 | 4414 | ); |
4415 | 4415 | |
@@ -4419,9 +4419,9 @@ discard block |
||
4419 | 4419 | 'struct', |
4420 | 4420 | 'all', |
4421 | 4421 | '', |
4422 | - array ( |
|
4423 | - 'userscourses' => array('name' => 'userscourses', 'type' => 'tns:user_course_status_array'), //removed [] |
|
4424 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4422 | + array( |
|
4423 | + 'userscourses' => array('name' => 'userscourses', 'type' => 'tns:user_course_status_array'), //removed [] |
|
4424 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4425 | 4425 | ) |
4426 | 4426 | ); |
4427 | 4427 | |
@@ -4446,9 +4446,9 @@ discard block |
||
4446 | 4446 | 'all', |
4447 | 4447 | '', |
4448 | 4448 | array( |
4449 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4450 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4451 | - 'result' => array('name' => 'result', 'type' => 'xsd:int') |
|
4449 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4450 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4451 | + 'result' => array('name' => 'result', 'type' => 'xsd:int') |
|
4452 | 4452 | ) |
4453 | 4453 | ); |
4454 | 4454 | |
@@ -4464,13 +4464,13 @@ discard block |
||
4464 | 4464 | ); |
4465 | 4465 | |
4466 | 4466 | // Register the method to expose |
4467 | -$server->register('WSSubscribeUserToCourse', // method name |
|
4468 | - array('subscribeUserToCourse' => 'tns:subscribeUserToCourse_arg'), // input parameters |
|
4467 | +$server->register('WSSubscribeUserToCourse', // method name |
|
4468 | + array('subscribeUserToCourse' => 'tns:subscribeUserToCourse_arg'), // input parameters |
|
4469 | 4469 | array('return' => 'tns:subscribeUserToCourse_return_global'), |
4470 | - 'urn:WSRegistration', // namespace |
|
4471 | - 'urn:WSRegistration#WSSubscribeUserToCourse', // soapaction |
|
4472 | - 'rpc', // style |
|
4473 | - 'encoded', // use |
|
4470 | + 'urn:WSRegistration', // namespace |
|
4471 | + 'urn:WSRegistration#WSSubscribeUserToCourse', // soapaction |
|
4472 | + 'rpc', // style |
|
4473 | + 'encoded', // use |
|
4474 | 4474 | 'This service subscribes a user to a course' // documentation |
4475 | 4475 | ); |
4476 | 4476 | |
@@ -4480,7 +4480,7 @@ discard block |
||
4480 | 4480 | if (!WSHelperVerifyKey($params)) { |
4481 | 4481 | return returnError(WS_ERROR_SECRET_KEY); |
4482 | 4482 | } |
4483 | - if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1)); |
|
4483 | + if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params, 1)); |
|
4484 | 4484 | |
4485 | 4485 | $results = array(); |
4486 | 4486 | $userscourses = $params['userscourses']; |
@@ -4548,8 +4548,8 @@ discard block |
||
4548 | 4548 | 'all', |
4549 | 4549 | '', |
4550 | 4550 | array( |
4551 | - 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
4552 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
4551 | + 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
4552 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
4553 | 4553 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
4554 | 4554 | ) |
4555 | 4555 | ); |
@@ -4562,18 +4562,18 @@ discard block |
||
4562 | 4562 | 'struct', |
4563 | 4563 | 'all', |
4564 | 4564 | '', |
4565 | - array('message' => array('name' => 'message', 'type' => 'xsd:string')) |
|
4565 | + array('message' => array('name' => 'message', 'type' => 'xsd:string')) |
|
4566 | 4566 | ); |
4567 | 4567 | |
4568 | 4568 | |
4569 | 4569 | // Register the method to expose |
4570 | -$server->register('WSSubscribeUserToCourseSimple', // method name |
|
4570 | +$server->register('WSSubscribeUserToCourseSimple', // method name |
|
4571 | 4571 | array('subscribeUserToCourseSimple' => 'tns:subscribeUserToCourseSimple_arg'), // input parameters |
4572 | - array('return' => 'xsd:string'), // output parameters |
|
4573 | - 'urn:WSRegistration', // namespace |
|
4574 | - 'urn:WSRegistration#WSSubscribeUserToCourseSimple', // soapaction |
|
4575 | - 'rpc', // style |
|
4576 | - 'encoded', // use |
|
4572 | + array('return' => 'xsd:string'), // output parameters |
|
4573 | + 'urn:WSRegistration', // namespace |
|
4574 | + 'urn:WSRegistration#WSSubscribeUserToCourseSimple', // soapaction |
|
4575 | + 'rpc', // style |
|
4576 | + 'encoded', // use |
|
4577 | 4577 | 'This service subscribes a user to a course in a simple way' // documentation |
4578 | 4578 | ); |
4579 | 4579 | |
@@ -4582,7 +4582,7 @@ discard block |
||
4582 | 4582 | global $debug; |
4583 | 4583 | |
4584 | 4584 | if ($debug) error_log('WSSubscribeUserToCourseSimple'); |
4585 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
4585 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
4586 | 4586 | if (!WSHelperVerifyKey($params)) { |
4587 | 4587 | return returnError(WS_ERROR_SECRET_KEY); |
4588 | 4588 | } |
@@ -4630,9 +4630,9 @@ discard block |
||
4630 | 4630 | 'all', |
4631 | 4631 | '', |
4632 | 4632 | array( |
4633 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4634 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4635 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4633 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
4634 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4635 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4636 | 4636 | ) |
4637 | 4637 | ); |
4638 | 4638 | |
@@ -4643,21 +4643,21 @@ discard block |
||
4643 | 4643 | 'struct', |
4644 | 4644 | 'all', |
4645 | 4645 | '', |
4646 | - array ( |
|
4647 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), |
|
4648 | - 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
4649 | - 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
4646 | + array( |
|
4647 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), |
|
4648 | + 'firstname' => array('name' => 'firstname', 'type' => 'xsd:string'), |
|
4649 | + 'lastname' => array('name' => 'lastname', 'type' => 'xsd:string'), |
|
4650 | 4650 | ) |
4651 | 4651 | ); |
4652 | 4652 | |
4653 | 4653 | // Register the method to expose |
4654 | -$server->register('WSGetUser', // method name |
|
4655 | - array('GetUser' => 'tns:GetUserArg'), // input parameters |
|
4656 | - array('return' => 'tns:User'), // output parameters |
|
4657 | - 'urn:WSRegistration', // namespace |
|
4658 | - 'urn:WSRegistration#WSGetUser', // soapaction |
|
4659 | - 'rpc', // style |
|
4660 | - 'encoded', // use |
|
4654 | +$server->register('WSGetUser', // method name |
|
4655 | + array('GetUser' => 'tns:GetUserArg'), // input parameters |
|
4656 | + array('return' => 'tns:User'), // output parameters |
|
4657 | + 'urn:WSRegistration', // namespace |
|
4658 | + 'urn:WSRegistration#WSGetUser', // soapaction |
|
4659 | + 'rpc', // style |
|
4660 | + 'encoded', // use |
|
4661 | 4661 | 'This service get user information by id' // documentation |
4662 | 4662 | ); |
4663 | 4663 | |
@@ -4701,17 +4701,17 @@ discard block |
||
4701 | 4701 | '', |
4702 | 4702 | array( |
4703 | 4703 | 'username' => array('name' => 'username', 'type' => 'xsd:string'), |
4704 | - 'secret_key' => array('name' => 'secret_key','type' => 'xsd:string') |
|
4704 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
4705 | 4705 | ) |
4706 | 4706 | ); |
4707 | 4707 | // Register the method to expose |
4708 | -$server->register('WSGetUserFromUsername', // method name |
|
4709 | - array('GetUserFromUsername' => 'tns:GetUserArgUsername'), // input params |
|
4710 | - array('return' => 'tns:User'), // output parameters |
|
4711 | - 'urn:WSRegistration', // namespace |
|
4712 | - 'urn:WSRegistration#WSGetUserFromUsername', // soapaction |
|
4713 | - 'rpc', // style |
|
4714 | - 'encoded', // use |
|
4708 | +$server->register('WSGetUserFromUsername', // method name |
|
4709 | + array('GetUserFromUsername' => 'tns:GetUserArgUsername'), // input params |
|
4710 | + array('return' => 'tns:User'), // output parameters |
|
4711 | + 'urn:WSRegistration', // namespace |
|
4712 | + 'urn:WSRegistration#WSGetUserFromUsername', // soapaction |
|
4713 | + 'rpc', // style |
|
4714 | + 'encoded', // use |
|
4715 | 4715 | 'This service get user information by username' // documentation |
4716 | 4716 | ); |
4717 | 4717 | |
@@ -4752,10 +4752,10 @@ discard block |
||
4752 | 4752 | 'all', |
4753 | 4753 | '', |
4754 | 4754 | array( |
4755 | - 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
4756 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4757 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4758 | - 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
4755 | + 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
4756 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
4757 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
4758 | + 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
4759 | 4759 | ) |
4760 | 4760 | ); |
4761 | 4761 | |
@@ -4808,13 +4808,13 @@ discard block |
||
4808 | 4808 | ); |
4809 | 4809 | |
4810 | 4810 | // Register the method to expose |
4811 | -$server->register('WSUnsubscribeUserFromCourse', // method name |
|
4811 | +$server->register('WSUnsubscribeUserFromCourse', // method name |
|
4812 | 4812 | array('unsuscribeUserFromCourse' => 'tns:unsuscribeUserFromCourse'), // input parameters |
4813 | - array('return' => 'tns:results_unsuscribeUserFromCourse'), // output parameters |
|
4814 | - 'urn:WSRegistration', // namespace |
|
4815 | - 'urn:WSRegistration#WSUnsubscribeUserFromCourse', // soapaction |
|
4816 | - 'rpc', // style |
|
4817 | - 'encoded', // use |
|
4813 | + array('return' => 'tns:results_unsuscribeUserFromCourse'), // output parameters |
|
4814 | + 'urn:WSRegistration', // namespace |
|
4815 | + 'urn:WSRegistration#WSUnsubscribeUserFromCourse', // soapaction |
|
4816 | + 'rpc', // style |
|
4817 | + 'encoded', // use |
|
4818 | 4818 | 'This service unsubscribes a user from a course' // documentation |
4819 | 4819 | ); |
4820 | 4820 | |
@@ -4826,7 +4826,7 @@ discard block |
||
4826 | 4826 | } |
4827 | 4827 | |
4828 | 4828 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
4829 | - $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
|
4829 | + $table_course = Database :: get_main_table(TABLE_MAIN_COURSE); |
|
4830 | 4830 | $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER); |
4831 | 4831 | |
4832 | 4832 | $userscourses_params = $params['userscourses']; |
@@ -4836,8 +4836,8 @@ discard block |
||
4836 | 4836 | foreach ($userscourses_params as $usercourse_param) { |
4837 | 4837 | |
4838 | 4838 | $original_user_id_values = $usercourse_param['original_user_id_values']; |
4839 | - $original_user_id_name = $usercourse_param['original_user_id_name']; |
|
4840 | - $original_course_id_value = $usercourse_param['original_course_id_value']; |
|
4839 | + $original_user_id_name = $usercourse_param['original_user_id_name']; |
|
4840 | + $original_course_id_value = $usercourse_param['original_course_id_value']; |
|
4841 | 4841 | $original_course_id_name = $usercourse_param['original_course_id_name']; |
4842 | 4842 | $orig_course_id_value[] = $original_course_id_value; |
4843 | 4843 | |
@@ -4858,7 +4858,7 @@ discard block |
||
4858 | 4858 | $usersList[] = $user_id; |
4859 | 4859 | } |
4860 | 4860 | |
4861 | - $orig_user_id_value[] = implode(',',$usersList); |
|
4861 | + $orig_user_id_value[] = implode(',', $usersList); |
|
4862 | 4862 | |
4863 | 4863 | $courseInfo = CourseManager::getCourseInfoFromOriginalId( |
4864 | 4864 | $original_course_id_value, |
@@ -4891,7 +4891,7 @@ discard block |
||
4891 | 4891 | |
4892 | 4892 | $count_results = count($results); |
4893 | 4893 | $output = array(); |
4894 | - for($i = 0; $i < $count_results; $i++) { |
|
4894 | + for ($i = 0; $i < $count_results; $i++) { |
|
4895 | 4895 | $output[] = array( |
4896 | 4896 | 'original_user_id_values' => $orig_user_id_value[$i], |
4897 | 4897 | 'original_course_id_value' => $orig_course_id_value[$i], |
@@ -4920,13 +4920,13 @@ discard block |
||
4920 | 4920 | |
4921 | 4921 | |
4922 | 4922 | // Register the method to expose |
4923 | -$server->register('WSUnSubscribeUserFromCourseSimple', // method name |
|
4923 | +$server->register('WSUnSubscribeUserFromCourseSimple', // method name |
|
4924 | 4924 | array('unSubscribeUserFromCourseSimple' => 'tns:unSubscribeUserFromCourseSimple'), // input parameters |
4925 | - array('return' => 'tns:result_createUsersPassEncrypt'), // output parameters |
|
4926 | - 'urn:WSRegistration', // namespace |
|
4927 | - 'urn:WSRegistration#WSUnSubscribeUserFromCourseSimple', // soapaction |
|
4928 | - 'rpc', // style |
|
4929 | - 'encoded', // use |
|
4925 | + array('return' => 'tns:result_createUsersPassEncrypt'), // output parameters |
|
4926 | + 'urn:WSRegistration', // namespace |
|
4927 | + 'urn:WSRegistration#WSUnSubscribeUserFromCourseSimple', // soapaction |
|
4928 | + 'rpc', // style |
|
4929 | + 'encoded', // use |
|
4930 | 4930 | 'This service unsubscribe a user from a course' // documentation |
4931 | 4931 | ); |
4932 | 4932 | /** |
@@ -4996,10 +4996,10 @@ discard block |
||
4996 | 4996 | 'all', |
4997 | 4997 | '', |
4998 | 4998 | array( |
4999 | - 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
5000 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5001 | - 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
5002 | - 'original_course_id_name' => array('name' => 'original_course_id_value', 'type' => 'xsd:string') |
|
4999 | + 'original_user_id_values' => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'), |
|
5000 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5001 | + 'original_course_id_value' => array('name' => 'original_course_id_value', 'type' => 'xsd:string'), |
|
5002 | + 'original_course_id_name' => array('name' => 'original_course_id_value', 'type' => 'xsd:string') |
|
5003 | 5003 | ) |
5004 | 5004 | ); |
5005 | 5005 | |
@@ -5093,13 +5093,13 @@ discard block |
||
5093 | 5093 | |
5094 | 5094 | |
5095 | 5095 | // Register the method to expose |
5096 | -$server->register('WSSuscribeUsersToSession', // method name |
|
5096 | +$server->register('WSSuscribeUsersToSession', // method name |
|
5097 | 5097 | array('subscribeUsersToSession' => 'tns:subscribeUsersToSession'), // input parameters |
5098 | - array('return' => 'tns:results_subscribeUsersToSession'), // output parameters |
|
5099 | - 'urn:WSRegistration', // namespace |
|
5100 | - 'urn:WSRegistration#WSSuscribeUsersToSession', // soapaction |
|
5101 | - 'rpc', // style |
|
5102 | - 'encoded', // use |
|
5098 | + array('return' => 'tns:results_subscribeUsersToSession'), // output parameters |
|
5099 | + 'urn:WSRegistration', // namespace |
|
5100 | + 'urn:WSRegistration#WSSuscribeUsersToSession', // soapaction |
|
5101 | + 'rpc', // style |
|
5102 | + 'encoded', // use |
|
5103 | 5103 | 'This service subscribes a user to a session' // documentation |
5104 | 5104 | ); |
5105 | 5105 | |
@@ -5176,7 +5176,7 @@ discard block |
||
5176 | 5176 | |
5177 | 5177 | $count_results = count($results); |
5178 | 5178 | $output = array(); |
5179 | - for($i = 0; $i < $count_results; $i++) { |
|
5179 | + for ($i = 0; $i < $count_results; $i++) { |
|
5180 | 5180 | $output[] = array( |
5181 | 5181 | 'original_user_id_values' => $orig_user_id_value[$i], |
5182 | 5182 | 'original_session_id_value' => $orig_session_id_value[$i], |
@@ -5196,25 +5196,25 @@ discard block |
||
5196 | 5196 | 'all', |
5197 | 5197 | '', |
5198 | 5198 | array( |
5199 | - 'session' => array('name' => 'session', 'type' => 'xsd:string'), // Session ID |
|
5200 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Chamilo user_id |
|
5199 | + 'session' => array('name' => 'session', 'type' => 'xsd:string'), // Session ID |
|
5200 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), // Chamilo user_id |
|
5201 | 5201 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
5202 | 5202 | ) |
5203 | 5203 | ); |
5204 | -$server->register('WSSubscribeUserToSessionSimple', // method name |
|
5205 | - array('subscribeUserToSessionSimple' => 'tns:subscribeUserToSessionSimple_arg'), // input parameters |
|
5206 | - array('return' => 'xsd:string'), // output parameters |
|
5207 | - 'urn:WSRegistration', // namespace |
|
5208 | - 'urn:WSRegistration#WSSubscribeUserToSessionSimple', // soapaction |
|
5209 | - 'rpc', // style |
|
5210 | - 'encoded', // use |
|
5204 | +$server->register('WSSubscribeUserToSessionSimple', // method name |
|
5205 | + array('subscribeUserToSessionSimple' => 'tns:subscribeUserToSessionSimple_arg'), // input parameters |
|
5206 | + array('return' => 'xsd:string'), // output parameters |
|
5207 | + 'urn:WSRegistration', // namespace |
|
5208 | + 'urn:WSRegistration#WSSubscribeUserToSessionSimple', // soapaction |
|
5209 | + 'rpc', // style |
|
5210 | + 'encoded', // use |
|
5211 | 5211 | 'This service subscribes a user to a session in a simple way' // documentation |
5212 | 5212 | ); |
5213 | 5213 | function WSSubscribeUserToSessionSimple($params) { |
5214 | 5214 | global $debug; |
5215 | 5215 | |
5216 | 5216 | if ($debug) { |
5217 | - error_log('WSSubscribeUserToSessionSimple with params=[' . serialize($params). ']'); |
|
5217 | + error_log('WSSubscribeUserToSessionSimple with params=['.serialize($params).']'); |
|
5218 | 5218 | } |
5219 | 5219 | |
5220 | 5220 | // Check security key |
@@ -5223,8 +5223,8 @@ discard block |
||
5223 | 5223 | } |
5224 | 5224 | |
5225 | 5225 | // Get input parameters |
5226 | - $session_id = intval($params['session']); // Session ID |
|
5227 | - $user_id = intval($params['user_id']); // Chamilo user id |
|
5226 | + $session_id = intval($params['session']); // Session ID |
|
5227 | + $user_id = intval($params['user_id']); // Chamilo user id |
|
5228 | 5228 | |
5229 | 5229 | // Get user id |
5230 | 5230 | $user_data = api_get_user_info($user_id); |
@@ -5325,13 +5325,13 @@ discard block |
||
5325 | 5325 | ); |
5326 | 5326 | |
5327 | 5327 | // Register the method to expose |
5328 | -$server->register('WSUnsuscribeUsersFromSession', // method name |
|
5328 | +$server->register('WSUnsuscribeUsersFromSession', // method name |
|
5329 | 5329 | array('unsubscribeUsersFromSession' => 'tns:unsubscribeUsersFromSession'), // input parameters |
5330 | - array('return' => 'tns:results_unsubscribeUsersFromSession'), // output parameters |
|
5331 | - 'urn:WSRegistration', // namespace |
|
5332 | - 'urn:WSRegistration#WSUnsuscribeUsersFromSession', // soapaction |
|
5333 | - 'rpc', // style |
|
5334 | - 'encoded', // use |
|
5330 | + array('return' => 'tns:results_unsubscribeUsersFromSession'), // output parameters |
|
5331 | + 'urn:WSRegistration', // namespace |
|
5332 | + 'urn:WSRegistration#WSUnsuscribeUsersFromSession', // soapaction |
|
5333 | + 'rpc', // style |
|
5334 | + 'encoded', // use |
|
5335 | 5335 | 'This service unsubscribes a user to a session' // documentation |
5336 | 5336 | ); |
5337 | 5337 | |
@@ -5345,7 +5345,7 @@ discard block |
||
5345 | 5345 | global $debug; |
5346 | 5346 | |
5347 | 5347 | if ($debug) { |
5348 | - error_log('WSUnsuscribeUsersFromSession with params=[' . serialize($params). ']'); |
|
5348 | + error_log('WSUnsuscribeUsersFromSession with params=['.serialize($params).']'); |
|
5349 | 5349 | } |
5350 | 5350 | |
5351 | 5351 | $user_table = Database::get_main_table(TABLE_MAIN_USER); |
@@ -5437,7 +5437,7 @@ discard block |
||
5437 | 5437 | 'all', |
5438 | 5438 | '', |
5439 | 5439 | array( |
5440 | - 'course_code' => array('name' => 'course_code', 'type' => 'xsd:string'), |
|
5440 | + 'course_code' => array('name' => 'course_code', 'type' => 'xsd:string'), |
|
5441 | 5441 | ) |
5442 | 5442 | ); |
5443 | 5443 | |
@@ -5473,9 +5473,9 @@ discard block |
||
5473 | 5473 | '', |
5474 | 5474 | array( |
5475 | 5475 | 'original_course_id_values' => array('name' => 'original_course_id_values', 'type' => 'tns:originalCoursesList'), |
5476 | - 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
5476 | + 'original_course_id_name' => array('name' => 'original_course_id_name', 'type' => 'xsd:string'), |
|
5477 | 5477 | 'original_session_id_value' => array('name' => 'original_session_id_value', 'type' => 'xsd:string'), |
5478 | - 'original_session_id_name' => array('name' => 'original_session_id_name', 'type' => 'xsd:string') |
|
5478 | + 'original_session_id_name' => array('name' => 'original_session_id_name', 'type' => 'xsd:string') |
|
5479 | 5479 | ) |
5480 | 5480 | ); |
5481 | 5481 | |
@@ -5528,13 +5528,13 @@ discard block |
||
5528 | 5528 | ); |
5529 | 5529 | |
5530 | 5530 | // Register the method to expose |
5531 | -$server->register('WSSuscribeCoursesToSession', // method name |
|
5531 | +$server->register('WSSuscribeCoursesToSession', // method name |
|
5532 | 5532 | array('subscribeCoursesToSession' => 'tns:subscribeCoursesToSession'), // input parameters |
5533 | - array('return' => 'tns:results_subscribeCoursesToSession'), // output parameters |
|
5534 | - 'urn:WSRegistration', // namespace |
|
5535 | - 'urn:WSRegistration#WSSuscribeCoursesToSession', // soapaction |
|
5536 | - 'rpc', // style |
|
5537 | - 'encoded', // use |
|
5533 | + array('return' => 'tns:results_subscribeCoursesToSession'), // output parameters |
|
5534 | + 'urn:WSRegistration', // namespace |
|
5535 | + 'urn:WSRegistration#WSSuscribeCoursesToSession', // soapaction |
|
5536 | + 'rpc', // style |
|
5537 | + 'encoded', // use |
|
5538 | 5538 | 'This service subscribes a course to a session' // documentation |
5539 | 5539 | ); |
5540 | 5540 | |
@@ -5672,13 +5672,13 @@ discard block |
||
5672 | 5672 | |
5673 | 5673 | |
5674 | 5674 | // Register the method to expose |
5675 | -$server->register('WSUnsuscribeCoursesFromSession', // method name |
|
5675 | +$server->register('WSUnsuscribeCoursesFromSession', // method name |
|
5676 | 5676 | array('unsubscribeCoursesFromSession' => 'tns:unsubscribeCoursesFromSession'), // input parameters |
5677 | - array('return' => 'tns:results_unsubscribeCoursesFromSession'), // output parameters |
|
5678 | - 'urn:WSRegistration', // namespace |
|
5679 | - 'urn:WSRegistration#WSUnsuscribeCoursesFromSession', // soapaction |
|
5680 | - 'rpc', // style |
|
5681 | - 'encoded', // use |
|
5677 | + array('return' => 'tns:results_unsubscribeCoursesFromSession'), // output parameters |
|
5678 | + 'urn:WSRegistration', // namespace |
|
5679 | + 'urn:WSRegistration#WSUnsuscribeCoursesFromSession', // soapaction |
|
5680 | + 'rpc', // style |
|
5681 | + 'encoded', // use |
|
5682 | 5682 | 'This service subscribes a course to a session' // documentation |
5683 | 5683 | ); |
5684 | 5684 | |
@@ -5785,7 +5785,7 @@ discard block |
||
5785 | 5785 | |
5786 | 5786 | $count_results = count($results); |
5787 | 5787 | $output = array(); |
5788 | - for($i = 0; $i < $count_results; $i++) { |
|
5788 | + for ($i = 0; $i < $count_results; $i++) { |
|
5789 | 5789 | $output[] = array( |
5790 | 5790 | 'original_course_id_values' => $orig_course_id_value[$i], |
5791 | 5791 | 'original_session_id_value' => $orig_session_id_value[$i], |
@@ -5843,13 +5843,13 @@ discard block |
||
5843 | 5843 | |
5844 | 5844 | |
5845 | 5845 | // Register the method to expose |
5846 | -$server->register('WSListCourses', // method name |
|
5846 | +$server->register('WSListCourses', // method name |
|
5847 | 5847 | array('listCourseInput' => 'tns:listCourseInput'), // input parameters |
5848 | - array('return' => 'tns:courses'), // output parameters |
|
5849 | - 'urn:WSRegistration', // namespace |
|
5850 | - 'urn:WSRegistration#WSListCourses', // soapaction |
|
5851 | - 'rpc', // style |
|
5852 | - 'encoded', // use |
|
5848 | + array('return' => 'tns:courses'), // output parameters |
|
5849 | + 'urn:WSRegistration', // namespace |
|
5850 | + 'urn:WSRegistration#WSListCourses', // soapaction |
|
5851 | + 'rpc', // style |
|
5852 | + 'encoded', // use |
|
5853 | 5853 | 'This service list courses available on the system' // documentation |
5854 | 5854 | ); |
5855 | 5855 | |
@@ -5868,7 +5868,7 @@ discard block |
||
5868 | 5868 | $from = isset($params['from']) ? $params['from'] : null; |
5869 | 5869 | $to = isset($params['to']) ? $params['to'] : null; |
5870 | 5870 | |
5871 | - error_log(print_r($params,1)); |
|
5871 | + error_log(print_r($params, 1)); |
|
5872 | 5872 | error_log($from); |
5873 | 5873 | error_log($to); |
5874 | 5874 | |
@@ -5926,27 +5926,27 @@ discard block |
||
5926 | 5926 | 'all', |
5927 | 5927 | '', |
5928 | 5928 | array( |
5929 | - 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5930 | - 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
5931 | - 'chamilo_username' => array('name' => 'chamilo_username', 'type' => 'xsd:string'), |
|
5932 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
5929 | + 'original_user_id_name' => array('name' => 'original_user_id_name', 'type' => 'xsd:string'), |
|
5930 | + 'original_user_id_value' => array('name' => 'original_user_id_value', 'type' => 'xsd:string'), |
|
5931 | + 'chamilo_username' => array('name' => 'chamilo_username', 'type' => 'xsd:string'), |
|
5932 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
5933 | 5933 | ) |
5934 | 5934 | ); |
5935 | 5935 | |
5936 | 5936 | // Register the method to expose |
5937 | -$server->register('WSUpdateUserApiKey', // method name |
|
5937 | +$server->register('WSUpdateUserApiKey', // method name |
|
5938 | 5938 | array('userApiKey' => 'tns:userApiKey'), // input parameters |
5939 | - array('return' => 'xsd:string'), // output parameters |
|
5940 | - 'urn:WSRegistration', // namespace |
|
5941 | - 'urn:WSRegistration#WSListCourses', // soapaction |
|
5942 | - 'rpc', // style |
|
5943 | - 'encoded', // use |
|
5939 | + array('return' => 'xsd:string'), // output parameters |
|
5940 | + 'urn:WSRegistration', // namespace |
|
5941 | + 'urn:WSRegistration#WSListCourses', // soapaction |
|
5942 | + 'rpc', // style |
|
5943 | + 'encoded', // use |
|
5944 | 5944 | 'This service return user api key' // documentation |
5945 | 5945 | ); |
5946 | 5946 | |
5947 | 5947 | |
5948 | 5948 | function WSUpdateUserApiKey($params) { |
5949 | - if(!WSHelperVerifyKey($params)) { |
|
5949 | + if (!WSHelperVerifyKey($params)) { |
|
5950 | 5950 | return returnError(WS_ERROR_SECRET_KEY); |
5951 | 5951 | } |
5952 | 5952 | |
@@ -5988,9 +5988,9 @@ discard block |
||
5988 | 5988 | 'all', |
5989 | 5989 | '', |
5990 | 5990 | array( |
5991 | - 'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), |
|
5992 | - 'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), |
|
5993 | - 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
5991 | + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), |
|
5992 | + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), |
|
5993 | + 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
|
5994 | 5994 | ) |
5995 | 5995 | ); |
5996 | 5996 | |
@@ -6001,11 +6001,11 @@ discard block |
||
6001 | 6001 | 'all', |
6002 | 6002 | '', |
6003 | 6003 | array( |
6004 | - 'id' => array ('name' => 'id' , 'type' => 'xsd:int'), |
|
6005 | - 'title' => array ('name' => 'title', 'type' => 'xsd:string'), |
|
6006 | - 'url' => array ('name' => 'url', 'type' => 'xsd:string'), |
|
6007 | - 'date_start' => array ('name' => 'date_start', 'type' => 'xsd:string'), |
|
6008 | - 'date_end' => array ('name' => 'date_end', 'type' => 'xsd:string'), |
|
6004 | + 'id' => array('name' => 'id', 'type' => 'xsd:int'), |
|
6005 | + 'title' => array('name' => 'title', 'type' => 'xsd:string'), |
|
6006 | + 'url' => array('name' => 'url', 'type' => 'xsd:string'), |
|
6007 | + 'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'), |
|
6008 | + 'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'), |
|
6009 | 6009 | ) |
6010 | 6010 | ); |
6011 | 6011 | |
@@ -6024,13 +6024,13 @@ discard block |
||
6024 | 6024 | ); |
6025 | 6025 | |
6026 | 6026 | // Register the method to expose |
6027 | -$server->register('WSListSessions', // method name |
|
6028 | - array('input' => 'tns:session_arg'), // input parameters |
|
6029 | - array('return' => 'tns:sessions'), // output parameters |
|
6030 | - 'urn:WSRegistration', // namespace |
|
6031 | - 'urn:WSRegistration#WSListSessions', // soapaction |
|
6032 | - 'rpc', // style |
|
6033 | - 'encoded', // use |
|
6027 | +$server->register('WSListSessions', // method name |
|
6028 | + array('input' => 'tns:session_arg'), // input parameters |
|
6029 | + array('return' => 'tns:sessions'), // output parameters |
|
6030 | + 'urn:WSRegistration', // namespace |
|
6031 | + 'urn:WSRegistration#WSListSessions', // soapaction |
|
6032 | + 'rpc', // style |
|
6033 | + 'encoded', // use |
|
6034 | 6034 | 'This service returns a list of sessions' // documentation |
6035 | 6035 | ); |
6036 | 6036 | |
@@ -6045,7 +6045,7 @@ discard block |
||
6045 | 6045 | * @return array Sessions list (id=>[title=>'title',url='http://...',date_start=>'...',date_end=>'']) |
6046 | 6046 | */ |
6047 | 6047 | function WSListSessions($params) { |
6048 | - if(!WSHelperVerifyKey($params)) { |
|
6048 | + if (!WSHelperVerifyKey($params)) { |
|
6049 | 6049 | return returnError(WS_ERROR_SECRET_KEY); |
6050 | 6050 | } |
6051 | 6051 | $sql_params = array(); |
@@ -6084,20 +6084,20 @@ discard block |
||
6084 | 6084 | 'all', |
6085 | 6085 | '', |
6086 | 6086 | array( |
6087 | - 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
6088 | - 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
6087 | + 'course' => array('name' => 'course', 'type' => 'xsd:string'), //Course string code |
|
6088 | + 'user_id' => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id |
|
6089 | 6089 | 'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string') |
6090 | 6090 | ) |
6091 | 6091 | ); |
6092 | 6092 | |
6093 | 6093 | // Register the method to expose |
6094 | -$server->register('WSUserSubscribedInCourse', // method name |
|
6095 | - array('UserSubscribedInCourse' => 'tns:UserSubscribedInCourse'), // input parameters |
|
6096 | - array('return' => 'xsd:string'), // output parameters |
|
6097 | - 'urn:WSRegistration', // namespace |
|
6098 | - 'urn:WSRegistration#WSUserSubscribedInCourse', // soapaction |
|
6099 | - 'rpc', // style |
|
6100 | - 'encoded', // use |
|
6094 | +$server->register('WSUserSubscribedInCourse', // method name |
|
6095 | + array('UserSubscribedInCourse' => 'tns:UserSubscribedInCourse'), // input parameters |
|
6096 | + array('return' => 'xsd:string'), // output parameters |
|
6097 | + 'urn:WSRegistration', // namespace |
|
6098 | + 'urn:WSRegistration#WSUserSubscribedInCourse', // soapaction |
|
6099 | + 'rpc', // style |
|
6100 | + 'encoded', // use |
|
6101 | 6101 | 'This service checks if user assigned to course' // documentation |
6102 | 6102 | ); |
6103 | 6103 | |
@@ -6111,7 +6111,7 @@ discard block |
||
6111 | 6111 | global $debug; |
6112 | 6112 | |
6113 | 6113 | if ($debug) error_log('WSUserSubscribedInCourse'); |
6114 | - if ($debug) error_log('Params '. print_r($params, 1)); |
|
6114 | + if ($debug) error_log('Params '.print_r($params, 1)); |
|
6115 | 6115 | if (!WSHelperVerifyKey($params)) { |
6116 | 6116 | |
6117 | 6117 | return returnError(WS_ERROR_SECRET_KEY); |
@@ -6119,7 +6119,7 @@ discard block |
||
6119 | 6119 | $courseCode = $params['course']; //Course code |
6120 | 6120 | $userId = $params['user_id']; //chamilo user id |
6121 | 6121 | |
6122 | - return (CourseManager::is_user_subscribed_in_course($userId,$courseCode)); |
|
6122 | + return (CourseManager::is_user_subscribed_in_course($userId, $courseCode)); |
|
6123 | 6123 | } |
6124 | 6124 | |
6125 | 6125 | |
@@ -6147,8 +6147,8 @@ discard block |
||
6147 | 6147 | 'all', |
6148 | 6148 | '', |
6149 | 6149 | array( |
6150 | - 'variable' => array('name'=>'variable','type'=>'xsd:string'), |
|
6151 | - 'value' => array('name'=>'value','type'=>'xsd:string') |
|
6150 | + 'variable' => array('name'=>'variable', 'type'=>'xsd:string'), |
|
6151 | + 'value' => array('name'=>'value', 'type'=>'xsd:string') |
|
6152 | 6152 | ) |
6153 | 6153 | ); |
6154 | 6154 | |
@@ -6210,12 +6210,12 @@ discard block |
||
6210 | 6210 | //Reister WSSearchSession |
6211 | 6211 | $server->register( |
6212 | 6212 | 'WSSearchSession', |
6213 | - array('SearchSession' => 'tns:SearchSession'), // input parameters |
|
6214 | - array('return' => 'tns:searchedSessionList'), // output parameters |
|
6215 | - 'urn:WSRegistration', // namespace |
|
6216 | - 'urn:WSRegistration#WSSearchSession', // soapaction |
|
6217 | - 'rpc', // style |
|
6218 | - 'encoded', // use |
|
6213 | + array('SearchSession' => 'tns:SearchSession'), // input parameters |
|
6214 | + array('return' => 'tns:searchedSessionList'), // output parameters |
|
6215 | + 'urn:WSRegistration', // namespace |
|
6216 | + 'urn:WSRegistration#WSSearchSession', // soapaction |
|
6217 | + 'rpc', // style |
|
6218 | + 'encoded', // use |
|
6219 | 6219 | 'This service to get a session list filtered by name, description or short description extra field' // documentation |
6220 | 6220 | ); |
6221 | 6221 | |
@@ -6270,12 +6270,12 @@ discard block |
||
6270 | 6270 | //Reister WSFetchSession |
6271 | 6271 | $server->register( |
6272 | 6272 | 'WSFetchSession', |
6273 | - array('SearchSession' => 'tns:FetchSession'), // input parameters |
|
6274 | - array('return' => 'tns:searchedSessionList'), // output parameters |
|
6275 | - 'urn:WSRegistration', // namespace |
|
6276 | - 'urn:WSRegistration#WSFetchSession', // soapaction |
|
6277 | - 'rpc', // style |
|
6278 | - 'encoded', // use |
|
6273 | + array('SearchSession' => 'tns:FetchSession'), // input parameters |
|
6274 | + array('return' => 'tns:searchedSessionList'), // output parameters |
|
6275 | + 'urn:WSRegistration', // namespace |
|
6276 | + 'urn:WSRegistration#WSFetchSession', // soapaction |
|
6277 | + 'rpc', // style |
|
6278 | + 'encoded', // use |
|
6279 | 6279 | 'This service get a session by its id. Optionally can get its extra fields values' // documentation |
6280 | 6280 | ); |
6281 | 6281 | |
@@ -6352,16 +6352,16 @@ discard block |
||
6352 | 6352 | ); |
6353 | 6353 | // Register the method to expose |
6354 | 6354 | $server->register( |
6355 | - 'WSCertificatesList', // method name |
|
6355 | + 'WSCertificatesList', // method name |
|
6356 | 6356 | array( |
6357 | - 'startingDate' => 'xsd:string', // input parameters |
|
6357 | + 'startingDate' => 'xsd:string', // input parameters |
|
6358 | 6358 | 'endingDate' => 'xsd:string' |
6359 | 6359 | ), |
6360 | - array('return' => 'tns:certificatesList'), // output parameters |
|
6361 | - 'urn:WSRegistration', // namespace |
|
6362 | - 'urn:WSRegistration#WSCertificatesList', // soapaction |
|
6363 | - 'rpc', // style |
|
6364 | - 'encoded', // use |
|
6360 | + array('return' => 'tns:certificatesList'), // output parameters |
|
6361 | + 'urn:WSRegistration', // namespace |
|
6362 | + 'urn:WSRegistration#WSCertificatesList', // soapaction |
|
6363 | + 'rpc', // style |
|
6364 | + 'encoded', // use |
|
6365 | 6365 | 'This service returns a list of certificates' // documentation |
6366 | 6366 | ); |
6367 | 6367 | |
@@ -6427,13 +6427,13 @@ discard block |
||
6427 | 6427 | ); |
6428 | 6428 | |
6429 | 6429 | // Register the method to expose |
6430 | -$server->register('WSCreateGroup', // method name |
|
6431 | - array('createGroup' => 'tns:createGroup'), // input parameters |
|
6432 | - array('return' => 'xsd:string'), // output parameters |
|
6433 | - 'urn:WSRegistration', // namespace |
|
6434 | - 'urn:WSRegistration#WSCreateGroup', // soapaction |
|
6435 | - 'rpc', // style |
|
6436 | - 'encoded', // use |
|
6430 | +$server->register('WSCreateGroup', // method name |
|
6431 | + array('createGroup' => 'tns:createGroup'), // input parameters |
|
6432 | + array('return' => 'xsd:string'), // output parameters |
|
6433 | + 'urn:WSRegistration', // namespace |
|
6434 | + 'urn:WSRegistration#WSCreateGroup', // soapaction |
|
6435 | + 'rpc', // style |
|
6436 | + 'encoded', // use |
|
6437 | 6437 | 'This service adds a group' // documentation |
6438 | 6438 | ); |
6439 | 6439 | |
@@ -6476,13 +6476,13 @@ discard block |
||
6476 | 6476 | ); |
6477 | 6477 | |
6478 | 6478 | // Register the method to expose |
6479 | -$server->register('WSUpdateGroup', // method name |
|
6480 | - array('updateGroup' => 'tns:updateGroup'), // input parameters |
|
6481 | - array('return' => 'xsd:string'), // output parameters |
|
6482 | - 'urn:WSRegistration', // namespace |
|
6483 | - 'urn:WSRegistration#WSUpdateGroup', // soapaction |
|
6484 | - 'rpc', // style |
|
6485 | - 'encoded', // use |
|
6479 | +$server->register('WSUpdateGroup', // method name |
|
6480 | + array('updateGroup' => 'tns:updateGroup'), // input parameters |
|
6481 | + array('return' => 'xsd:string'), // output parameters |
|
6482 | + 'urn:WSRegistration', // namespace |
|
6483 | + 'urn:WSRegistration#WSUpdateGroup', // soapaction |
|
6484 | + 'rpc', // style |
|
6485 | + 'encoded', // use |
|
6486 | 6486 | 'This service updates a group' // documentation |
6487 | 6487 | ); |
6488 | 6488 | |
@@ -6527,13 +6527,13 @@ discard block |
||
6527 | 6527 | ); |
6528 | 6528 | |
6529 | 6529 | // Register the method to expose |
6530 | -$server->register('WSDeleteGroup', // method name |
|
6531 | - array('deleteGroup' => 'tns:deleteGroup'), // input parameters |
|
6532 | - array('return' => 'xsd:string'), // output parameters |
|
6533 | - 'urn:WSRegistration', // namespace |
|
6534 | - 'urn:WSRegistration#WSDeleteGroup', // soapaction |
|
6535 | - 'rpc', // style |
|
6536 | - 'encoded', // use |
|
6530 | +$server->register('WSDeleteGroup', // method name |
|
6531 | + array('deleteGroup' => 'tns:deleteGroup'), // input parameters |
|
6532 | + array('return' => 'xsd:string'), // output parameters |
|
6533 | + 'urn:WSRegistration', // namespace |
|
6534 | + 'urn:WSRegistration#WSDeleteGroup', // soapaction |
|
6535 | + 'rpc', // style |
|
6536 | + 'encoded', // use |
|
6537 | 6537 | 'This service deletes a group' // documentation |
6538 | 6538 | ); |
6539 | 6539 | |
@@ -6570,13 +6570,13 @@ discard block |
||
6570 | 6570 | ); |
6571 | 6571 | |
6572 | 6572 | // Register the method to expose |
6573 | -$server->register('GroupBindToParent', // method name |
|
6574 | - array('groupBindToParent' => 'tns:groupBindToParent'), // input parameters |
|
6575 | - array('return' => 'xsd:string'), // output parameters |
|
6576 | - 'urn:WSRegistration', // namespace |
|
6577 | - 'urn:WSRegistration#GroupBindToParent', // soapaction |
|
6578 | - 'rpc', // style |
|
6579 | - 'encoded', // use |
|
6573 | +$server->register('GroupBindToParent', // method name |
|
6574 | + array('groupBindToParent' => 'tns:groupBindToParent'), // input parameters |
|
6575 | + array('return' => 'xsd:string'), // output parameters |
|
6576 | + 'urn:WSRegistration', // namespace |
|
6577 | + 'urn:WSRegistration#GroupBindToParent', // soapaction |
|
6578 | + 'rpc', // style |
|
6579 | + 'encoded', // use |
|
6580 | 6580 | 'This service binds a group to a parent' // documentation |
6581 | 6581 | ); |
6582 | 6582 | |
@@ -6612,13 +6612,13 @@ discard block |
||
6612 | 6612 | ); |
6613 | 6613 | |
6614 | 6614 | // Register the method to expose |
6615 | -$server->register('GroupUnbindFromParent', // method name |
|
6616 | - array('groupUnbindFromParent' => 'tns:groupUnbindFromParent'), // input parameters |
|
6617 | - array('return' => 'xsd:string'), // output parameters |
|
6618 | - 'urn:WSRegistration', // namespace |
|
6619 | - 'urn:WSRegistration#GroupUnbindFromParent', // soapaction |
|
6620 | - 'rpc', // style |
|
6621 | - 'encoded', // use |
|
6615 | +$server->register('GroupUnbindFromParent', // method name |
|
6616 | + array('groupUnbindFromParent' => 'tns:groupUnbindFromParent'), // input parameters |
|
6617 | + array('return' => 'xsd:string'), // output parameters |
|
6618 | + 'urn:WSRegistration', // namespace |
|
6619 | + 'urn:WSRegistration#GroupUnbindFromParent', // soapaction |
|
6620 | + 'rpc', // style |
|
6621 | + 'encoded', // use |
|
6622 | 6622 | 'This service unbinds a group from its parent' // documentation |
6623 | 6623 | ); |
6624 | 6624 | |
@@ -6652,13 +6652,13 @@ discard block |
||
6652 | 6652 | ); |
6653 | 6653 | |
6654 | 6654 | // Register the method to expose |
6655 | -$server->register('WSAddUserToGroup', // method name |
|
6656 | - array('addUserToGroup' => 'tns:addUserToGroup'), // input parameters |
|
6657 | - array('return' => 'xsd:string'), // output parameters |
|
6658 | - 'urn:WSRegistration', // namespace |
|
6659 | - 'urn:WSRegistration#WSAddUserToGroup', // soapaction |
|
6660 | - 'rpc', // style |
|
6661 | - 'encoded', // use |
|
6655 | +$server->register('WSAddUserToGroup', // method name |
|
6656 | + array('addUserToGroup' => 'tns:addUserToGroup'), // input parameters |
|
6657 | + array('return' => 'xsd:string'), // output parameters |
|
6658 | + 'urn:WSRegistration', // namespace |
|
6659 | + 'urn:WSRegistration#WSAddUserToGroup', // soapaction |
|
6660 | + 'rpc', // style |
|
6661 | + 'encoded', // use |
|
6662 | 6662 | 'This service adds a user to a group' // documentation |
6663 | 6663 | ); |
6664 | 6664 | |
@@ -6695,13 +6695,13 @@ discard block |
||
6695 | 6695 | ); |
6696 | 6696 | |
6697 | 6697 | // Register the method to expose |
6698 | -$server->register('WSUpdateUserRoleInGroup', // method name |
|
6699 | - array('updateUserRoleInGroup' => 'tns:updateUserRoleInGroup'), // input parameters |
|
6700 | - array('return' => 'xsd:string'), // output parameters |
|
6701 | - 'urn:WSRegistration', // namespace |
|
6702 | - 'urn:WSRegistration#WSUpdateUserRoleInGroup', // soapaction |
|
6703 | - 'rpc', // style |
|
6704 | - 'encoded', // use |
|
6698 | +$server->register('WSUpdateUserRoleInGroup', // method name |
|
6699 | + array('updateUserRoleInGroup' => 'tns:updateUserRoleInGroup'), // input parameters |
|
6700 | + array('return' => 'xsd:string'), // output parameters |
|
6701 | + 'urn:WSRegistration', // namespace |
|
6702 | + 'urn:WSRegistration#WSUpdateUserRoleInGroup', // soapaction |
|
6703 | + 'rpc', // style |
|
6704 | + 'encoded', // use |
|
6705 | 6705 | 'This service updates a user role in group' // documentation |
6706 | 6706 | ); |
6707 | 6707 | |
@@ -6740,13 +6740,13 @@ discard block |
||
6740 | 6740 | ); |
6741 | 6741 | |
6742 | 6742 | // Register the method to expose |
6743 | -$server->register('WSDeleteUserFromGroup', // method name |
|
6744 | - array('deleteUserFromGroup' => 'tns:deleteUserFromGroup'), // input parameters |
|
6745 | - array('return' => 'xsd:string'), // output parameters |
|
6746 | - 'urn:WSRegistration', // namespace |
|
6747 | - 'urn:WSRegistration#WSDeleteUserFromGroup', // soapaction |
|
6748 | - 'rpc', // style |
|
6749 | - 'encoded', // use |
|
6743 | +$server->register('WSDeleteUserFromGroup', // method name |
|
6744 | + array('deleteUserFromGroup' => 'tns:deleteUserFromGroup'), // input parameters |
|
6745 | + array('return' => 'xsd:string'), // output parameters |
|
6746 | + 'urn:WSRegistration', // namespace |
|
6747 | + 'urn:WSRegistration#WSDeleteUserFromGroup', // soapaction |
|
6748 | + 'rpc', // style |
|
6749 | + 'encoded', // use |
|
6750 | 6750 | 'This service deletes a user from a group' // documentation |
6751 | 6751 | ); |
6752 | 6752 |