Passed
Push — 1.10.x ( e4c880...90da1a )
by
unknown
51:46
created
main/webservices/registration.soap.php 1 patch
Spacing   +455 added lines, -455 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
@@ -2606,7 +2606,7 @@  discard block
 block discarded – undo
2606 2606
     '',
2607 2607
     'SOAP-ENC:Array',
2608 2608
     array(),
2609
-    array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:user_id[]')),'tns:user_id'
2609
+    array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:user_id[]')), 'tns:user_id'
2610 2610
 );
2611 2611
 
2612 2612
 $server->wsdl->addComplexType(
@@ -2622,35 +2622,35 @@  discard block
 block discarded – undo
2622 2622
 );
2623 2623
 
2624 2624
 function WSHelperActionOnUsers($params, $type) {
2625
-    if(!WSHelperVerifyKey($params)) {
2625
+    if (!WSHelperVerifyKey($params)) {
2626 2626
         return returnError(WS_ERROR_SECRET_KEY);
2627 2627
     }
2628 2628
 
2629 2629
     $original_user_ids = $params['ids'];
2630
-    foreach($original_user_ids as $original_user_id) {
2630
+    foreach ($original_user_ids as $original_user_id) {
2631 2631
         $user_id = UserManager::get_user_id_from_original_id(
2632 2632
             $original_user_id['original_user_id_value'],
2633 2633
             $original_user_id['original_user_id_name']
2634 2634
         );
2635
-        if($user_id > 0) {
2636
-            if($type == "delete") {
2635
+        if ($user_id > 0) {
2636
+            if ($type == "delete") {
2637 2637
                 UserManager::delete_user($user_id);
2638
-            } else if($type == "disable") {
2638
+            } else if ($type == "disable") {
2639 2639
                 UserManager::disable($user_id);
2640
-            } else if($type == "enable") {
2640
+            } else if ($type == "enable") {
2641 2641
                 UserManager::enable($user_id);
2642 2642
             }
2643 2643
         }
2644 2644
     }
2645 2645
 }
2646 2646
 
2647
-$server->register('WSDeleteUsers',                         // method name
2648
-    array('user_ids' => 'tns:user_ids'),                   // input parameters
2649
-    array(),                                               // output parameters
2650
-    'urn:WSRegistration',                                  // namespace
2651
-    'urn:WSRegistration#WSDeleteUsers',                    // soapaction
2652
-    'rpc',                                                 // style
2653
-    'encoded',                                             // use
2647
+$server->register('WSDeleteUsers', // method name
2648
+    array('user_ids' => 'tns:user_ids'), // input parameters
2649
+    array(), // output parameters
2650
+    'urn:WSRegistration', // namespace
2651
+    'urn:WSRegistration#WSDeleteUsers', // soapaction
2652
+    'rpc', // style
2653
+    'encoded', // use
2654 2654
     'Deletes users provided as parameters from the system' // documentation
2655 2655
 );
2656 2656
 
@@ -2659,13 +2659,13 @@  discard block
 block discarded – undo
2659 2659
 }
2660 2660
 
2661 2661
 /** WSDisableUsers **/
2662
-$server->register('WSDisableUsers',                         // method name
2663
-    array('user_ids' => 'tns:user_ids'),                    // input parameters
2664
-    array(),                                                // output parameters
2665
-    'urn:WSRegistration',                                   // namespace
2666
-    'urn:WSRegistration#WSDisableUsers',                    // soapaction
2667
-    'rpc',                                                  // style
2668
-    'encoded',                                              // use
2662
+$server->register('WSDisableUsers', // method name
2663
+    array('user_ids' => 'tns:user_ids'), // input parameters
2664
+    array(), // output parameters
2665
+    'urn:WSRegistration', // namespace
2666
+    'urn:WSRegistration#WSDisableUsers', // soapaction
2667
+    'rpc', // style
2668
+    'encoded', // use
2669 2669
     'Disables users provided as parameters from the system' // documentation
2670 2670
 );
2671 2671
 
@@ -2674,13 +2674,13 @@  discard block
 block discarded – undo
2674 2674
 }
2675 2675
 
2676 2676
 /** WSEnableUsers **/
2677
-$server->register('WSEnableUsers',            // method name
2678
-    array('user_ids' => 'tns:user_ids'),      // input parameters
2679
-    array(),                                  // output parameters
2680
-    'urn:WSRegistration',                     // namespace
2681
-    'urn:WSRegistration#WSEnableUsers',       // soapaction
2682
-    'rpc',                                    // style
2683
-    'encoded',                                // use
2677
+$server->register('WSEnableUsers', // method name
2678
+    array('user_ids' => 'tns:user_ids'), // input parameters
2679
+    array(), // output parameters
2680
+    'urn:WSRegistration', // namespace
2681
+    'urn:WSRegistration#WSEnableUsers', // soapaction
2682
+    'rpc', // style
2683
+    'encoded', // use
2684 2684
     'Enables users provided as parameters'    // documentation
2685 2685
 );
2686 2686
 
@@ -2730,7 +2730,7 @@  discard block
 block discarded – undo
2730 2730
     '',
2731 2731
     'SOAP-ENC:Array',
2732 2732
     array(),
2733
-    array(array('ref'=>'SOAP-ENC:arrayType','wsdl:arrayType' => 'tns:createCourseParams[]')),'tns:createCourseParams'
2733
+    array(array('ref'=>'SOAP-ENC:arrayType', 'wsdl:arrayType' => 'tns:createCourseParams[]')), 'tns:createCourseParams'
2734 2734
 );
2735 2735
 
2736 2736
 // Register the data structures used by the service
@@ -2771,13 +2771,13 @@  discard block
 block discarded – undo
2771 2771
 );
2772 2772
 
2773 2773
 // Register the method to expose
2774
-$server->register('WSCreateCourse',                // method name
2775
-    array('createCourse' => 'tns:createCourse'),   // input parameters
2774
+$server->register('WSCreateCourse', // method name
2775
+    array('createCourse' => 'tns:createCourse'), // input parameters
2776 2776
     array('return' => 'tns:results_createCourse'), // output parameters
2777
-    'urn:WSRegistration',                          // namespace
2778
-    'urn:WSRegistration#WSCreateCourse',           // soapaction
2779
-    'rpc',                                         // style
2780
-    'encoded',                                     // use
2777
+    'urn:WSRegistration', // namespace
2778
+    'urn:WSRegistration#WSCreateCourse', // soapaction
2779
+    'rpc', // style
2780
+    'encoded', // use
2781 2781
     'This service adds a course'                   // documentation
2782 2782
 );
2783 2783
 
@@ -2833,7 +2833,7 @@  discard block
 block discarded – undo
2833 2833
                             category_code='".Database::escape_string($category_code)."',
2834 2834
                             tutor_name='".Database::escape_string($tutor_name)."',
2835 2835
                             visual_code='".Database::escape_string($wanted_code)."'";
2836
-                if($visibility !== null) {
2836
+                if ($visibility !== null) {
2837 2837
                     $sql .= ", visibility = '$visibility' ";
2838 2838
                 }
2839 2839
                 $sql .= " WHERE id='".$courseInfo['real_id']."'";
@@ -2883,7 +2883,7 @@  discard block
 block discarded – undo
2883 2883
         $params['title'] = $title;
2884 2884
         $params['wanted_code'] = $wanted_code;
2885 2885
         $params['category_code'] = $category_code;
2886
-        $params['course_category']    = $category_code;
2886
+        $params['course_category'] = $category_code;
2887 2887
         $params['tutor_name'] = $tutor_name;
2888 2888
         $params['course_language'] = $course_language;
2889 2889
         $params['user_id'] = api_get_user_id();
@@ -3014,13 +3014,13 @@  discard block
 block discarded – undo
3014 3014
 
3015 3015
 
3016 3016
 // Register the method to expose
3017
-$server->register('WSCreateCourseByTitle',                     // method name
3017
+$server->register('WSCreateCourseByTitle', // method name
3018 3018
     array('createCourseByTitle' => 'tns:createCourseByTitle'), // input parameters
3019
-    array('return' => 'tns:results_createCourseByTitle'),      // output parameters
3020
-    'urn:WSRegistration',                                      // namespace
3021
-    'urn:WSRegistration#WSCreateCourseByTitle',                // soapaction
3022
-    'rpc',                                                     // style
3023
-    'encoded',                                                 // use
3019
+    array('return' => 'tns:results_createCourseByTitle'), // output parameters
3020
+    'urn:WSRegistration', // namespace
3021
+    'urn:WSRegistration#WSCreateCourseByTitle', // soapaction
3022
+    'rpc', // style
3023
+    'encoded', // use
3024 3024
     'This service adds a course by title'                      // documentation
3025 3025
 );
3026 3026
 
@@ -3251,18 +3251,18 @@  discard block
 block discarded – undo
3251 3251
 );
3252 3252
 
3253 3253
 // Register the method to expose
3254
-$server->register('WSEditCourse',                // method name
3255
-    array('editCourse' => 'tns:editCourse'),     // input parameters
3254
+$server->register('WSEditCourse', // method name
3255
+    array('editCourse' => 'tns:editCourse'), // input parameters
3256 3256
     array('return' => 'tns:results_editCourse'), // output parameters
3257
-    'urn:WSRegistration',                        // namespace
3258
-    'urn:WSRegistration#WSEditCourse',           // soapaction
3259
-    'rpc',                                       // style
3260
-    'encoded',                                   // use
3257
+    'urn:WSRegistration', // namespace
3258
+    'urn:WSRegistration#WSEditCourse', // soapaction
3259
+    'rpc', // style
3260
+    'encoded', // use
3261 3261
     'This service edits a course'                // documentation
3262 3262
 );
3263 3263
 
3264 3264
 // Define the method WSEditCourse
3265
-function WSEditCourse($params){
3265
+function WSEditCourse($params) {
3266 3266
 
3267 3267
     global $_configuration;
3268 3268
     if (!WSHelperVerifyKey($params)) {
@@ -3417,13 +3417,13 @@  discard block
 block discarded – undo
3417 3417
 
3418 3418
 
3419 3419
 // Register the method to expose
3420
-$server->register('WSCourseDescription',                    // method name
3421
-    array('courseDescription' => 'tns:courseDescription'),  // input parameters
3422
-    array('return' => 'tns:fields_course_desc_list'),       // output parameters
3423
-    'urn:WSRegistration',                                   // namespace
3424
-    'urn:WSRegistration#WSCourseDescription',               // soapaction
3425
-    'rpc',                                                  // style
3426
-    'encoded',                                              // use
3420
+$server->register('WSCourseDescription', // method name
3421
+    array('courseDescription' => 'tns:courseDescription'), // input parameters
3422
+    array('return' => 'tns:fields_course_desc_list'), // output parameters
3423
+    'urn:WSRegistration', // namespace
3424
+    'urn:WSRegistration#WSCourseDescription', // soapaction
3425
+    'rpc', // style
3426
+    'encoded', // use
3427 3427
     'This service edits a course description'               // documentation
3428 3428
 );
3429 3429
 
@@ -3476,14 +3476,14 @@  discard block
 block discarded – undo
3476 3476
     }
3477 3477
 
3478 3478
     while ($row = Database::fetch_array($result)) {
3479
-        $ind = (int)$row['id'];
3479
+        $ind = (int) $row['id'];
3480 3480
         $array_course_desc_title[$ind] = $row['title'];
3481 3481
         $array_course_desc_content[$ind] = $row['content'];
3482 3482
     }
3483 3483
 
3484 3484
     $count_results = count($default_titles);
3485 3485
     $output = array();
3486
-    for($i = 1; $i <= $count_results; $i++) {
3486
+    for ($i = 1; $i <= $count_results; $i++) {
3487 3487
         $output[] = array(
3488 3488
             'course_desc_id' => $array_course_desc_id[$i],
3489 3489
             'course_desc_default_title' => $array_course_desc_default_title[$i],
@@ -3563,13 +3563,13 @@  discard block
 block discarded – undo
3563 3563
 
3564 3564
 
3565 3565
 // Register the method to expose
3566
-$server->register('WSEditCourseDescription',                       // method name
3566
+$server->register('WSEditCourseDescription', // method name
3567 3567
     array('editCourseDescription' => 'tns:editCourseDescription'), // input parameters
3568
-    array('return' => 'tns:results_editCourseDescription'),        // output parameters
3569
-    'urn:WSRegistration',                                          // namespace
3570
-    'urn:WSRegistration#WSEditCourseDescription',                  // soapaction
3571
-    'rpc',                                                         // style
3572
-    'encoded',                                                     // use
3568
+    array('return' => 'tns:results_editCourseDescription'), // output parameters
3569
+    'urn:WSRegistration', // namespace
3570
+    'urn:WSRegistration#WSEditCourseDescription', // soapaction
3571
+    'rpc', // style
3572
+    'encoded', // use
3573 3573
     'This service edits a course description'                      // documentation
3574 3574
 );
3575 3575
 
@@ -3613,7 +3613,7 @@  discard block
 block discarded – undo
3613 3613
         $course_desc_title = Database::escape_string($course_desc_title);
3614 3614
         $course_desc_content = Database::escape_string($course_desc_content);
3615 3615
 
3616
-        $course_desc_id = (int)$course_desc_id;
3616
+        $course_desc_id = (int) $course_desc_id;
3617 3617
         if ($course_desc_id > 8 && $course_desc_id < 1) {
3618 3618
             $results[] = 0; // course_desc_id invalid.
3619 3619
             continue;
@@ -3647,7 +3647,7 @@  discard block
 block discarded – undo
3647 3647
 
3648 3648
     $count_results = count($results);
3649 3649
     $output = array();
3650
-    for($i = 0; $i < $count_results; $i++) {
3650
+    for ($i = 0; $i < $count_results; $i++) {
3651 3651
         $output[] = array(
3652 3652
             'original_course_id_value' => $orig_course_id_value[$i],
3653 3653
             'result' => $results[$i],
@@ -3719,13 +3719,13 @@  discard block
 block discarded – undo
3719 3719
     'tns:result_deleteCourse'
3720 3720
 );
3721 3721
 
3722
-$server->register('WSDeleteCourse',                // method name
3723
-    array('deleteCourse' => 'tns:deleteCourse'),   // input parameters
3722
+$server->register('WSDeleteCourse', // method name
3723
+    array('deleteCourse' => 'tns:deleteCourse'), // input parameters
3724 3724
     array('return' => 'tns:results_deleteCourse'), // output parameters
3725
-    'urn:WSRegistration',                          // namespace
3726
-    'urn:WSRegistration#WSDeleteCourse',           // soapaction
3727
-    'rpc',                                         // style
3728
-    'encoded',                                     // use
3725
+    'urn:WSRegistration', // namespace
3726
+    'urn:WSRegistration#WSDeleteCourse', // soapaction
3727
+    'rpc', // style
3728
+    'encoded', // use
3729 3729
     'This service deletes a course '               // documentation
3730 3730
 );
3731 3731
 
@@ -3851,13 +3851,13 @@  discard block
 block discarded – undo
3851 3851
 );
3852 3852
 
3853 3853
 // Register the method to expose
3854
-$server->register('WSCreateSession',                // method name
3855
-    array('createSession' => 'tns:createSession'),  // input parameters
3854
+$server->register('WSCreateSession', // method name
3855
+    array('createSession' => 'tns:createSession'), // input parameters
3856 3856
     array('return' => 'tns:results_createSession'), // output parameters
3857
-    'urn:WSRegistration',                           // namespace
3858
-    'urn:WSRegistration#WSCreateSession',           // soapaction
3859
-    'rpc',                                          // style
3860
-    'encoded',                                      // use
3857
+    'urn:WSRegistration', // namespace
3858
+    'urn:WSRegistration#WSCreateSession', // soapaction
3859
+    'rpc', // style
3860
+    'encoded', // use
3861 3861
     'This service edits a session'                  // documentation
3862 3862
 );
3863 3863
 
@@ -3911,8 +3911,8 @@  discard block
 block discarded – undo
3911 3911
         }
3912 3912
 
3913 3913
         if (empty($nolimit)) {
3914
-            $date_start = "$year_start-".(($month_start < 10)?"0$month_start":$month_start)."-".(($day_start < 10)?"0$day_start":$day_start) . ' 00:00:00';
3915
-            $date_end = "$year_end-".(($month_end < 10)?"0$month_end":$month_end)."-".(($day_end < 10)?"0$day_end":$day_end) . ' 23:59:59';
3914
+            $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start).' 00:00:00';
3915
+            $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end).' 23:59:59';
3916 3916
         } else {
3917 3917
             $date_start = "";
3918 3918
             $date_end = "";
@@ -3930,7 +3930,7 @@  discard block
 block discarded – undo
3930 3930
             }
3931 3931
             $results[] = 0;
3932 3932
             continue;
3933
-        } elseif (empty($nolimit) && (!$month_end || !$day_end || !$year_end || !checkdate($month_end,  $day_end, $year_end))) {
3933
+        } elseif (empty($nolimit) && (!$month_end || !$day_end || !$year_end || !checkdate($month_end, $day_end, $year_end))) {
3934 3934
             $results[] = 0;
3935 3935
             if ($debug) {
3936 3936
                 error_log("There's an error with the end date: $month_end - $day_end - $year_end");
@@ -4033,7 +4033,7 @@  discard block
 block discarded – undo
4033 4033
 
4034 4034
     $count_results = count($results);
4035 4035
     $output = array();
4036
-    for($i = 0; $i < $count_results; $i++) {
4036
+    for ($i = 0; $i < $count_results; $i++) {
4037 4037
         $output[] = array(
4038 4038
             'original_session_id_value' => $orig_session_id_value[$i],
4039 4039
             'result' => $results[$i],
@@ -4118,13 +4118,13 @@  discard block
 block discarded – undo
4118 4118
 
4119 4119
 
4120 4120
 // Register the method to expose
4121
-$server->register('WSEditSession',                // method name
4122
-    array('editSession' => 'tns:editSession'),    // input parameters
4121
+$server->register('WSEditSession', // method name
4122
+    array('editSession' => 'tns:editSession'), // input parameters
4123 4123
     array('return' => 'tns:results_editSession'), // output parameters
4124
-    'urn:WSRegistration',                         // namespace
4125
-    'urn:WSRegistration#WSEditSession',           // soapaction
4126
-    'rpc',                                        // style
4127
-    'encoded',                                    // use
4124
+    'urn:WSRegistration', // namespace
4125
+    'urn:WSRegistration#WSEditSession', // soapaction
4126
+    'rpc', // style
4127
+    'encoded', // use
4128 4128
     'This service edits a session'                // documentation
4129 4129
 );
4130 4130
 
@@ -4174,11 +4174,11 @@  discard block
 block discarded – undo
4174 4174
         }
4175 4175
 
4176 4176
         if (empty($nolimit)) {
4177
-            $date_start="$year_start-".(($month_start < 10)?"0$month_start":$month_start)."-".(($day_start < 10)?"0$day_start":$day_start);
4178
-            $date_end="$year_end-".(($month_end < 10)?"0$month_end":$month_end)."-".(($day_end < 10)?"0$day_end":$day_end);
4177
+            $date_start = "$year_start-".(($month_start < 10) ? "0$month_start" : $month_start)."-".(($day_start < 10) ? "0$day_start" : $day_start);
4178
+            $date_end = "$year_end-".(($month_end < 10) ? "0$month_end" : $month_end)."-".(($day_end < 10) ? "0$day_end" : $day_end);
4179 4179
         } else {
4180
-            $date_start="";
4181
-            $date_end="";
4180
+            $date_start = "";
4181
+            $date_end = "";
4182 4182
         }
4183 4183
         if (empty($name)) {
4184 4184
             $results[] = 0; //SessionNameIsRequired
@@ -4322,13 +4322,13 @@  discard block
 block discarded – undo
4322 4322
     'tns:result_deleteSession'
4323 4323
 );
4324 4324
 
4325
-$server->register('WSDeleteSession',                // method name
4326
-    array('deleteSession' => 'tns:deleteSession'),  // input parameters
4325
+$server->register('WSDeleteSession', // method name
4326
+    array('deleteSession' => 'tns:deleteSession'), // input parameters
4327 4327
     array('return' => 'tns:results_deleteSession'), // output parameters
4328
-    'urn:WSRegistration',                           // namespace
4329
-    'urn:WSRegistration#WSDeleteSession',           // soapaction
4330
-    'rpc',                                          // style
4331
-    'encoded',                                      // use
4328
+    'urn:WSRegistration', // namespace
4329
+    'urn:WSRegistration#WSDeleteSession', // soapaction
4330
+    'rpc', // style
4331
+    'encoded', // use
4332 4332
     'This service deletes a session '               // documentation
4333 4333
 );
4334 4334
 
@@ -4410,10 +4410,10 @@  discard block
 block discarded – undo
4410 4410
     'struct',
4411 4411
     'all',
4412 4412
     '',
4413
-    array (
4413
+    array(
4414 4414
         'course_id' => array('name' => 'course_id', 'type' => 'tns:course_id'),
4415
-        'user_id'   => array('name' => 'user_id',   'type' => 'tns:user_id'),
4416
-        'status'    => array('name' => 'status',    'type' => 'xsd:int')
4415
+        'user_id'   => array('name' => 'user_id', 'type' => 'tns:user_id'),
4416
+        'status'    => array('name' => 'status', 'type' => 'xsd:int')
4417 4417
     )
4418 4418
 );
4419 4419
 
@@ -4423,9 +4423,9 @@  discard block
 block discarded – undo
4423 4423
     'struct',
4424 4424
     'all',
4425 4425
     '',
4426
-    array (
4427
-        'userscourses'  => array('name' => 'userscourses',  'type' => 'tns:user_course_status_array'), //removed []
4428
-        'secret_key'    => array('name' => 'secret_key',    'type' => 'xsd:string')
4426
+    array(
4427
+        'userscourses'  => array('name' => 'userscourses', 'type' => 'tns:user_course_status_array'), //removed []
4428
+        'secret_key'    => array('name' => 'secret_key', 'type' => 'xsd:string')
4429 4429
     )
4430 4430
 );
4431 4431
 
@@ -4450,9 +4450,9 @@  discard block
 block discarded – undo
4450 4450
     'all',
4451 4451
     '',
4452 4452
     array(
4453
-        'original_user_id_value'    => array('name' => 'original_user_id_value',    'type' => 'xsd:string'),
4454
-        'original_course_id_value'  => array('name' => 'original_course_id_value',  'type' => 'xsd:string'),
4455
-        'result'                    => array('name' => 'result',                    'type' => 'xsd:int')
4453
+        'original_user_id_value'    => array('name' => 'original_user_id_value', 'type' => 'xsd:string'),
4454
+        'original_course_id_value'  => array('name' => 'original_course_id_value', 'type' => 'xsd:string'),
4455
+        'result'                    => array('name' => 'result', 'type' => 'xsd:int')
4456 4456
     )
4457 4457
 );
4458 4458
 
@@ -4468,13 +4468,13 @@  discard block
 block discarded – undo
4468 4468
 );
4469 4469
 
4470 4470
 // Register the method to expose
4471
-$server->register('WSSubscribeUserToCourse',                            // method name
4472
-    array('subscribeUserToCourse' => 'tns:subscribeUserToCourse_arg'),  // input parameters
4471
+$server->register('WSSubscribeUserToCourse', // method name
4472
+    array('subscribeUserToCourse' => 'tns:subscribeUserToCourse_arg'), // input parameters
4473 4473
     array('return' => 'tns:subscribeUserToCourse_return_global'),
4474
-    'urn:WSRegistration',                                               // namespace
4475
-    'urn:WSRegistration#WSSubscribeUserToCourse',                       // soapaction
4476
-    'rpc',                                                              // style
4477
-    'encoded',                                                          // use
4474
+    'urn:WSRegistration', // namespace
4475
+    'urn:WSRegistration#WSSubscribeUserToCourse', // soapaction
4476
+    'rpc', // style
4477
+    'encoded', // use
4478 4478
     'This service subscribes a user to a course'                        // documentation
4479 4479
 );
4480 4480
 
@@ -4484,7 +4484,7 @@  discard block
 block discarded – undo
4484 4484
     if (!WSHelperVerifyKey($params)) {
4485 4485
         return returnError(WS_ERROR_SECRET_KEY);
4486 4486
     }
4487
-    if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params,1));
4487
+    if ($debug) error_log('WSSubscribeUserToCourse params: '.print_r($params, 1));
4488 4488
 
4489 4489
     $results = array();
4490 4490
     $userscourses = $params['userscourses'];
@@ -4552,8 +4552,8 @@  discard block
 block discarded – undo
4552 4552
     'all',
4553 4553
     '',
4554 4554
     array(
4555
-        'course'       => array('name' => 'course',     'type' => 'xsd:string'), //Course string code
4556
-        'user_id'      => array('name' => 'user_id',    'type' => 'xsd:string'), //Chamilo user_id
4555
+        'course'       => array('name' => 'course', 'type' => 'xsd:string'), //Course string code
4556
+        'user_id'      => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id
4557 4557
         'secret_key'   => array('name' => 'secret_key', 'type' => 'xsd:string')
4558 4558
     )
4559 4559
 );
@@ -4566,18 +4566,18 @@  discard block
 block discarded – undo
4566 4566
     'struct',
4567 4567
     'all',
4568 4568
     '',
4569
-    array('message' => array('name' => 'message',    'type' => 'xsd:string'))
4569
+    array('message' => array('name' => 'message', 'type' => 'xsd:string'))
4570 4570
 );
4571 4571
 
4572 4572
 
4573 4573
 // Register the method to expose
4574
-$server->register('WSSubscribeUserToCourseSimple',                                 // method name
4574
+$server->register('WSSubscribeUserToCourseSimple', // method name
4575 4575
     array('subscribeUserToCourseSimple' => 'tns:subscribeUserToCourseSimple_arg'), // input parameters
4576
-    array('return' => 'xsd:string'),                                               // output parameters
4577
-    'urn:WSRegistration',                                                          // namespace
4578
-    'urn:WSRegistration#WSSubscribeUserToCourseSimple',                            // soapaction
4579
-    'rpc',                                                                         // style
4580
-    'encoded',                                                                     // use
4576
+    array('return' => 'xsd:string'), // output parameters
4577
+    'urn:WSRegistration', // namespace
4578
+    'urn:WSRegistration#WSSubscribeUserToCourseSimple', // soapaction
4579
+    'rpc', // style
4580
+    'encoded', // use
4581 4581
     'This service subscribes a user to a course in a simple way'                   // documentation
4582 4582
 );
4583 4583
 
@@ -4586,7 +4586,7 @@  discard block
 block discarded – undo
4586 4586
     global $debug;
4587 4587
 
4588 4588
     if ($debug) error_log('WSSubscribeUserToCourseSimple');
4589
-    if ($debug) error_log('Params '. print_r($params, 1));
4589
+    if ($debug) error_log('Params '.print_r($params, 1));
4590 4590
     if (!WSHelperVerifyKey($params)) {
4591 4591
         return returnError(WS_ERROR_SECRET_KEY);
4592 4592
     }
@@ -4634,9 +4634,9 @@  discard block
 block discarded – undo
4634 4634
     'all',
4635 4635
     '',
4636 4636
     array(
4637
-        'original_user_id_value'      => array('name' => 'original_user_id_value',    'type' => 'xsd:string'),
4638
-        'original_user_id_name'       => array('name' => 'original_user_id_name',     'type' => 'xsd:string'),
4639
-        'secret_key'                  => array('name' => 'secret_key',                'type' => 'xsd:string')
4637
+        'original_user_id_value'      => array('name' => 'original_user_id_value', 'type' => 'xsd:string'),
4638
+        'original_user_id_name'       => array('name' => 'original_user_id_name', 'type' => 'xsd:string'),
4639
+        'secret_key'                  => array('name' => 'secret_key', 'type' => 'xsd:string')
4640 4640
     )
4641 4641
 );
4642 4642
 
@@ -4647,21 +4647,21 @@  discard block
 block discarded – undo
4647 4647
     'struct',
4648 4648
     'all',
4649 4649
     '',
4650
-    array (
4651
-        'user_id'      => array('name' => 'user_id',    'type' => 'xsd:string'),
4652
-        'firstname'    => array('name' => 'firstname',  'type' => 'xsd:string'),
4653
-        'lastname'     => array('name' => 'lastname',   'type' => 'xsd:string'),
4650
+    array(
4651
+        'user_id'      => array('name' => 'user_id', 'type' => 'xsd:string'),
4652
+        'firstname'    => array('name' => 'firstname', 'type' => 'xsd:string'),
4653
+        'lastname'     => array('name' => 'lastname', 'type' => 'xsd:string'),
4654 4654
     )
4655 4655
 );
4656 4656
 
4657 4657
 // Register the method to expose
4658
-$server->register('WSGetUser',                   // method name
4659
-    array('GetUser' => 'tns:GetUserArg'),        // input parameters
4660
-    array('return' => 'tns:User'),               // output parameters
4661
-    'urn:WSRegistration',                        // namespace
4662
-    'urn:WSRegistration#WSGetUser',              // soapaction
4663
-    'rpc',                                       // style
4664
-    'encoded',                                   // use
4658
+$server->register('WSGetUser', // method name
4659
+    array('GetUser' => 'tns:GetUserArg'), // input parameters
4660
+    array('return' => 'tns:User'), // output parameters
4661
+    'urn:WSRegistration', // namespace
4662
+    'urn:WSRegistration#WSGetUser', // soapaction
4663
+    'rpc', // style
4664
+    'encoded', // use
4665 4665
     'This service get user information by id'    // documentation
4666 4666
 );
4667 4667
 
@@ -4705,17 +4705,17 @@  discard block
 block discarded – undo
4705 4705
     '',
4706 4706
     array(
4707 4707
         'username'      => array('name' => 'username', 'type' => 'xsd:string'),
4708
-        'secret_key'    => array('name' => 'secret_key','type' => 'xsd:string')
4708
+        'secret_key'    => array('name' => 'secret_key', 'type' => 'xsd:string')
4709 4709
     )
4710 4710
 );
4711 4711
 // Register the method to expose
4712
-$server->register('WSGetUserFromUsername',                     // method name
4713
-    array('GetUserFromUsername' => 'tns:GetUserArgUsername'),  // input params
4714
-    array('return' => 'tns:User'),                             // output parameters
4715
-    'urn:WSRegistration',                                      // namespace
4716
-    'urn:WSRegistration#WSGetUserFromUsername',                // soapaction
4717
-    'rpc',                                                     // style
4718
-    'encoded',                                                 // use
4712
+$server->register('WSGetUserFromUsername', // method name
4713
+    array('GetUserFromUsername' => 'tns:GetUserArgUsername'), // input params
4714
+    array('return' => 'tns:User'), // output parameters
4715
+    'urn:WSRegistration', // namespace
4716
+    'urn:WSRegistration#WSGetUserFromUsername', // soapaction
4717
+    'rpc', // style
4718
+    'encoded', // use
4719 4719
     'This service get user information by username'            // documentation
4720 4720
 );
4721 4721
 
@@ -4756,10 +4756,10 @@  discard block
 block discarded – undo
4756 4756
     'all',
4757 4757
     '',
4758 4758
     array(
4759
-        'original_user_id_values'   => array('name' => 'original_user_id_values',   'type' => 'tns:originalUsersList'),
4760
-        'original_user_id_name'     => array('name' => 'original_user_id_name',     'type' => 'xsd:string'),
4761
-        'original_course_id_value'  => array('name' => 'original_course_id_value',  'type' => 'xsd:string'),
4762
-        'original_course_id_name'   => array('name' => 'original_course_id_name',   'type' => 'xsd:string'),
4759
+        'original_user_id_values'   => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'),
4760
+        'original_user_id_name'     => array('name' => 'original_user_id_name', 'type' => 'xsd:string'),
4761
+        'original_course_id_value'  => array('name' => 'original_course_id_value', 'type' => 'xsd:string'),
4762
+        'original_course_id_name'   => array('name' => 'original_course_id_name', 'type' => 'xsd:string'),
4763 4763
     )
4764 4764
 );
4765 4765
 
@@ -4812,13 +4812,13 @@  discard block
 block discarded – undo
4812 4812
 );
4813 4813
 
4814 4814
 // Register the method to expose
4815
-$server->register('WSUnsubscribeUserFromCourse',                         // method name
4815
+$server->register('WSUnsubscribeUserFromCourse', // method name
4816 4816
     array('unsuscribeUserFromCourse' => 'tns:unsuscribeUserFromCourse'), // input parameters
4817
-    array('return' => 'tns:results_unsuscribeUserFromCourse'),           // output parameters
4818
-    'urn:WSRegistration',                                                // namespace
4819
-    'urn:WSRegistration#WSUnsubscribeUserFromCourse',                    // soapaction
4820
-    'rpc',                                                               // style
4821
-    'encoded',                                                           // use
4817
+    array('return' => 'tns:results_unsuscribeUserFromCourse'), // output parameters
4818
+    'urn:WSRegistration', // namespace
4819
+    'urn:WSRegistration#WSUnsubscribeUserFromCourse', // soapaction
4820
+    'rpc', // style
4821
+    'encoded', // use
4822 4822
     'This service unsubscribes a user from a course'                     // documentation
4823 4823
 );
4824 4824
 
@@ -4830,7 +4830,7 @@  discard block
 block discarded – undo
4830 4830
     }
4831 4831
 
4832 4832
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
4833
-    $table_course     = Database :: get_main_table(TABLE_MAIN_COURSE);
4833
+    $table_course = Database :: get_main_table(TABLE_MAIN_COURSE);
4834 4834
     $table_course_user = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
4835 4835
 
4836 4836
     $userscourses_params = $params['userscourses'];
@@ -4840,8 +4840,8 @@  discard block
 block discarded – undo
4840 4840
     foreach ($userscourses_params as $usercourse_param) {
4841 4841
 
4842 4842
         $original_user_id_values     = $usercourse_param['original_user_id_values'];
4843
-        $original_user_id_name         = $usercourse_param['original_user_id_name'];
4844
-        $original_course_id_value     = $usercourse_param['original_course_id_value'];
4843
+        $original_user_id_name = $usercourse_param['original_user_id_name'];
4844
+        $original_course_id_value = $usercourse_param['original_course_id_value'];
4845 4845
         $original_course_id_name     = $usercourse_param['original_course_id_name'];
4846 4846
         $orig_course_id_value[] = $original_course_id_value;
4847 4847
 
@@ -4862,7 +4862,7 @@  discard block
 block discarded – undo
4862 4862
             $usersList[] = $user_id;
4863 4863
         }
4864 4864
 
4865
-        $orig_user_id_value[] = implode(',',$usersList);
4865
+        $orig_user_id_value[] = implode(',', $usersList);
4866 4866
 
4867 4867
         $courseInfo = CourseManager::getCourseInfoFromOriginalId(
4868 4868
             $original_course_id_value,
@@ -4895,7 +4895,7 @@  discard block
 block discarded – undo
4895 4895
 
4896 4896
     $count_results = count($results);
4897 4897
     $output = array();
4898
-    for($i = 0; $i < $count_results; $i++) {
4898
+    for ($i = 0; $i < $count_results; $i++) {
4899 4899
         $output[] = array(
4900 4900
             'original_user_id_values' => $orig_user_id_value[$i],
4901 4901
             'original_course_id_value' => $orig_course_id_value[$i],
@@ -4924,13 +4924,13 @@  discard block
 block discarded – undo
4924 4924
 
4925 4925
 
4926 4926
 // Register the method to expose
4927
-$server->register('WSUnSubscribeUserFromCourseSimple',                         // method name
4927
+$server->register('WSUnSubscribeUserFromCourseSimple', // method name
4928 4928
     array('unSubscribeUserFromCourseSimple' => 'tns:unSubscribeUserFromCourseSimple'), // input parameters
4929
-    array('return' => 'tns:result_createUsersPassEncrypt'),           // output parameters
4930
-    'urn:WSRegistration',                                                // namespace
4931
-    'urn:WSRegistration#WSUnSubscribeUserFromCourseSimple',                    // soapaction
4932
-    'rpc',                                                               // style
4933
-    'encoded',                                                           // use
4929
+    array('return' => 'tns:result_createUsersPassEncrypt'), // output parameters
4930
+    'urn:WSRegistration', // namespace
4931
+    'urn:WSRegistration#WSUnSubscribeUserFromCourseSimple', // soapaction
4932
+    'rpc', // style
4933
+    'encoded', // use
4934 4934
     'This service unsubscribe a user from a course'                     // documentation
4935 4935
 );
4936 4936
 /**
@@ -5000,10 +5000,10 @@  discard block
 block discarded – undo
5000 5000
     'all',
5001 5001
     '',
5002 5002
     array(
5003
-        'original_user_id_values'   => array('name' => 'original_user_id_values',   'type' => 'tns:originalUsersList'),
5004
-        'original_user_id_name'     => array('name' => 'original_user_id_name',     'type' => 'xsd:string'),
5005
-        'original_course_id_value'  => array('name' => 'original_course_id_value',  'type' => 'xsd:string'),
5006
-        'original_course_id_name'   => array('name' => 'original_course_id_value',  'type' => 'xsd:string')
5003
+        'original_user_id_values'   => array('name' => 'original_user_id_values', 'type' => 'tns:originalUsersList'),
5004
+        'original_user_id_name'     => array('name' => 'original_user_id_name', 'type' => 'xsd:string'),
5005
+        'original_course_id_value'  => array('name' => 'original_course_id_value', 'type' => 'xsd:string'),
5006
+        'original_course_id_name'   => array('name' => 'original_course_id_value', 'type' => 'xsd:string')
5007 5007
     )
5008 5008
 );
5009 5009
 
@@ -5097,13 +5097,13 @@  discard block
 block discarded – undo
5097 5097
 
5098 5098
 
5099 5099
 // Register the method to expose
5100
-$server->register('WSSuscribeUsersToSession',                          // method name
5100
+$server->register('WSSuscribeUsersToSession', // method name
5101 5101
     array('subscribeUsersToSession' => 'tns:subscribeUsersToSession'), // input parameters
5102
-    array('return' => 'tns:results_subscribeUsersToSession'),          // output parameters
5103
-    'urn:WSRegistration',                                              // namespace
5104
-    'urn:WSRegistration#WSSuscribeUsersToSession',                     // soapaction
5105
-    'rpc',                                                             // style
5106
-    'encoded',                                                         // use
5102
+    array('return' => 'tns:results_subscribeUsersToSession'), // output parameters
5103
+    'urn:WSRegistration', // namespace
5104
+    'urn:WSRegistration#WSSuscribeUsersToSession', // soapaction
5105
+    'rpc', // style
5106
+    'encoded', // use
5107 5107
     'This service subscribes a user to a session'                      // documentation
5108 5108
 );
5109 5109
 
@@ -5180,7 +5180,7 @@  discard block
 block discarded – undo
5180 5180
 
5181 5181
     $count_results = count($results);
5182 5182
     $output = array();
5183
-    for($i = 0; $i < $count_results; $i++) {
5183
+    for ($i = 0; $i < $count_results; $i++) {
5184 5184
         $output[] = array(
5185 5185
             'original_user_id_values' => $orig_user_id_value[$i],
5186 5186
             'original_session_id_value' => $orig_session_id_value[$i],
@@ -5200,25 +5200,25 @@  discard block
 block discarded – undo
5200 5200
     'all',
5201 5201
     '',
5202 5202
     array(
5203
-        'session'    => array('name' => 'session',    'type' => 'xsd:string'), // Session ID
5204
-        'user_id'    => array('name' => 'user_id',    'type' => 'xsd:string'), // Chamilo user_id
5203
+        'session'    => array('name' => 'session', 'type' => 'xsd:string'), // Session ID
5204
+        'user_id'    => array('name' => 'user_id', 'type' => 'xsd:string'), // Chamilo user_id
5205 5205
         'secret_key' => array('name' => 'secret_key', 'type' => 'xsd:string')
5206 5206
     )
5207 5207
 );
5208
-$server->register('WSSubscribeUserToSessionSimple',                                   // method name
5209
-    array('subscribeUserToSessionSimple' => 'tns:subscribeUserToSessionSimple_arg'),  // input parameters
5210
-    array('return' => 'xsd:string'),                                                  // output parameters
5211
-    'urn:WSRegistration',                                                             // namespace
5212
-    'urn:WSRegistration#WSSubscribeUserToSessionSimple',                              // soapaction
5213
-    'rpc',                                                                            // style
5214
-    'encoded',                                                                        // use
5208
+$server->register('WSSubscribeUserToSessionSimple', // method name
5209
+    array('subscribeUserToSessionSimple' => 'tns:subscribeUserToSessionSimple_arg'), // input parameters
5210
+    array('return' => 'xsd:string'), // output parameters
5211
+    'urn:WSRegistration', // namespace
5212
+    'urn:WSRegistration#WSSubscribeUserToSessionSimple', // soapaction
5213
+    'rpc', // style
5214
+    'encoded', // use
5215 5215
     'This service subscribes a user to a session in a simple way'                     // documentation
5216 5216
 );
5217 5217
 function WSSubscribeUserToSessionSimple($params) {
5218 5218
     global $debug;
5219 5219
 
5220 5220
     if ($debug) {
5221
-        error_log('WSSubscribeUserToSessionSimple with params=[' . serialize($params). ']');
5221
+        error_log('WSSubscribeUserToSessionSimple with params=['.serialize($params).']');
5222 5222
     }
5223 5223
 
5224 5224
     // Check security key
@@ -5227,8 +5227,8 @@  discard block
 block discarded – undo
5227 5227
     }
5228 5228
 
5229 5229
     // Get input parameters
5230
-    $session_id = intval($params['session']);  // Session ID
5231
-    $user_id    = intval($params['user_id']);  // Chamilo user id
5230
+    $session_id = intval($params['session']); // Session ID
5231
+    $user_id    = intval($params['user_id']); // Chamilo user id
5232 5232
 
5233 5233
     // Get user id
5234 5234
     $user_data = api_get_user_info($user_id);
@@ -5329,13 +5329,13 @@  discard block
 block discarded – undo
5329 5329
 );
5330 5330
 
5331 5331
 // Register the method to expose
5332
-$server->register('WSUnsuscribeUsersFromSession',                              // method name
5332
+$server->register('WSUnsuscribeUsersFromSession', // method name
5333 5333
     array('unsubscribeUsersFromSession' => 'tns:unsubscribeUsersFromSession'), // input parameters
5334
-    array('return' => 'tns:results_unsubscribeUsersFromSession'),              // output parameters
5335
-    'urn:WSRegistration',                                                      // namespace
5336
-    'urn:WSRegistration#WSUnsuscribeUsersFromSession',                         // soapaction
5337
-    'rpc',                                                                     // style
5338
-    'encoded',                                                                 // use
5334
+    array('return' => 'tns:results_unsubscribeUsersFromSession'), // output parameters
5335
+    'urn:WSRegistration', // namespace
5336
+    'urn:WSRegistration#WSUnsuscribeUsersFromSession', // soapaction
5337
+    'rpc', // style
5338
+    'encoded', // use
5339 5339
     'This service unsubscribes a user to a session'                            // documentation
5340 5340
 );
5341 5341
 
@@ -5349,7 +5349,7 @@  discard block
 block discarded – undo
5349 5349
     global $debug;
5350 5350
 
5351 5351
     if ($debug) {
5352
-        error_log('WSUnsuscribeUsersFromSession with params=[' . serialize($params). ']');
5352
+        error_log('WSUnsuscribeUsersFromSession with params=['.serialize($params).']');
5353 5353
     }
5354 5354
 
5355 5355
     $user_table = Database::get_main_table(TABLE_MAIN_USER);
@@ -5441,7 +5441,7 @@  discard block
 block discarded – undo
5441 5441
     'all',
5442 5442
     '',
5443 5443
     array(
5444
-        'course_code'   => array('name' => 'course_code',   'type' => 'xsd:string'),
5444
+        'course_code'   => array('name' => 'course_code', 'type' => 'xsd:string'),
5445 5445
     )
5446 5446
 );
5447 5447
 
@@ -5477,9 +5477,9 @@  discard block
 block discarded – undo
5477 5477
     '',
5478 5478
     array(
5479 5479
         'original_course_id_values' => array('name' => 'original_course_id_values', 'type' => 'tns:originalCoursesList'),
5480
-        'original_course_id_name'   => array('name' => 'original_course_id_name',   'type' => 'xsd:string'),
5480
+        'original_course_id_name'   => array('name' => 'original_course_id_name', 'type' => 'xsd:string'),
5481 5481
         'original_session_id_value' => array('name' => 'original_session_id_value', 'type' => 'xsd:string'),
5482
-        'original_session_id_name'  => array('name' => 'original_session_id_name',  'type' => 'xsd:string')
5482
+        'original_session_id_name'  => array('name' => 'original_session_id_name', 'type' => 'xsd:string')
5483 5483
     )
5484 5484
 );
5485 5485
 
@@ -5532,13 +5532,13 @@  discard block
 block discarded – undo
5532 5532
 );
5533 5533
 
5534 5534
 // Register the method to expose
5535
-$server->register('WSSuscribeCoursesToSession',                            // method name
5535
+$server->register('WSSuscribeCoursesToSession', // method name
5536 5536
     array('subscribeCoursesToSession' => 'tns:subscribeCoursesToSession'), // input parameters
5537
-    array('return' => 'tns:results_subscribeCoursesToSession'),            // output parameters
5538
-    'urn:WSRegistration',                                                  // namespace
5539
-    'urn:WSRegistration#WSSuscribeCoursesToSession',                       // soapaction
5540
-    'rpc',                                                                 // style
5541
-    'encoded',                                                             // use
5537
+    array('return' => 'tns:results_subscribeCoursesToSession'), // output parameters
5538
+    'urn:WSRegistration', // namespace
5539
+    'urn:WSRegistration#WSSuscribeCoursesToSession', // soapaction
5540
+    'rpc', // style
5541
+    'encoded', // use
5542 5542
     'This service subscribes a course to a session'                        // documentation
5543 5543
 );
5544 5544
 
@@ -5676,13 +5676,13 @@  discard block
 block discarded – undo
5676 5676
 
5677 5677
 
5678 5678
 // Register the method to expose
5679
-$server->register('WSUnsuscribeCoursesFromSession',                                // method name
5679
+$server->register('WSUnsuscribeCoursesFromSession', // method name
5680 5680
     array('unsubscribeCoursesFromSession' => 'tns:unsubscribeCoursesFromSession'), // input parameters
5681
-    array('return' => 'tns:results_unsubscribeCoursesFromSession'),                // output parameters
5682
-    'urn:WSRegistration',                                                          // namespace
5683
-    'urn:WSRegistration#WSUnsuscribeCoursesFromSession',                           // soapaction
5684
-    'rpc',                                                                         // style
5685
-    'encoded',                                                                     // use
5681
+    array('return' => 'tns:results_unsubscribeCoursesFromSession'), // output parameters
5682
+    'urn:WSRegistration', // namespace
5683
+    'urn:WSRegistration#WSUnsuscribeCoursesFromSession', // soapaction
5684
+    'rpc', // style
5685
+    'encoded', // use
5686 5686
     'This service subscribes a course to a session'                                // documentation
5687 5687
 );
5688 5688
 
@@ -5789,7 +5789,7 @@  discard block
 block discarded – undo
5789 5789
 
5790 5790
     $count_results = count($results);
5791 5791
     $output = array();
5792
-    for($i = 0; $i < $count_results; $i++) {
5792
+    for ($i = 0; $i < $count_results; $i++) {
5793 5793
         $output[] = array(
5794 5794
             'original_course_id_values' => $orig_course_id_value[$i],
5795 5795
             'original_session_id_value' => $orig_session_id_value[$i],
@@ -5847,13 +5847,13 @@  discard block
 block discarded – undo
5847 5847
 
5848 5848
 
5849 5849
 // Register the method to expose
5850
-$server->register('WSListCourses',                                                  // method name
5850
+$server->register('WSListCourses', // method name
5851 5851
     array('listCourseInput' => 'tns:listCourseInput'), // input parameters
5852
-    array('return' => 'tns:courses'),                                               // output parameters
5853
-    'urn:WSRegistration',                                                           // namespace
5854
-    'urn:WSRegistration#WSListCourses',                                             // soapaction
5855
-    'rpc',                                                                          // style
5856
-    'encoded',                                                                      // use
5852
+    array('return' => 'tns:courses'), // output parameters
5853
+    'urn:WSRegistration', // namespace
5854
+    'urn:WSRegistration#WSListCourses', // soapaction
5855
+    'rpc', // style
5856
+    'encoded', // use
5857 5857
     'This service list courses available on the system'                             // documentation
5858 5858
 );
5859 5859
 
@@ -5933,27 +5933,27 @@  discard block
 block discarded – undo
5933 5933
     'all',
5934 5934
     '',
5935 5935
     array(
5936
-        'original_user_id_name'     => array('name' => 'original_user_id_name',     'type' => 'xsd:string'),
5937
-        'original_user_id_value'    => array('name' => 'original_user_id_value',    'type' => 'xsd:string'),
5938
-        'chamilo_username'          => array('name' => 'chamilo_username',          'type' => 'xsd:string'),
5939
-        'secret_key'                => array('name' => 'secret_key',                'type' => 'xsd:string')
5936
+        'original_user_id_name'     => array('name' => 'original_user_id_name', 'type' => 'xsd:string'),
5937
+        'original_user_id_value'    => array('name' => 'original_user_id_value', 'type' => 'xsd:string'),
5938
+        'chamilo_username'          => array('name' => 'chamilo_username', 'type' => 'xsd:string'),
5939
+        'secret_key'                => array('name' => 'secret_key', 'type' => 'xsd:string')
5940 5940
     )
5941 5941
 );
5942 5942
 
5943 5943
 // Register the method to expose
5944
-$server->register('WSUpdateUserApiKey',      // method name
5944
+$server->register('WSUpdateUserApiKey', // method name
5945 5945
     array('userApiKey' => 'tns:userApiKey'), // input parameters
5946
-    array('return' => 'xsd:string'),         // output parameters
5947
-    'urn:WSRegistration',                    // namespace
5948
-    'urn:WSRegistration#WSListCourses',      // soapaction
5949
-    'rpc',                                   // style
5950
-    'encoded',                               // use
5946
+    array('return' => 'xsd:string'), // output parameters
5947
+    'urn:WSRegistration', // namespace
5948
+    'urn:WSRegistration#WSListCourses', // soapaction
5949
+    'rpc', // style
5950
+    'encoded', // use
5951 5951
     'This service return user api key'       // documentation
5952 5952
 );
5953 5953
 
5954 5954
 
5955 5955
 function WSUpdateUserApiKey($params) {
5956
-    if(!WSHelperVerifyKey($params)) {
5956
+    if (!WSHelperVerifyKey($params)) {
5957 5957
         return returnError(WS_ERROR_SECRET_KEY);
5958 5958
     }
5959 5959
 
@@ -5995,11 +5995,11 @@  discard block
 block discarded – undo
5995 5995
     'all',
5996 5996
     '',
5997 5997
     array(
5998
-        'from'  => array('name' => 'from',  'type' => 'xsd:int'),
5999
-        'to'    => array('name' => 'to',    'type' => 'xsd:int'),
6000
-        'date_start'  => array('name' => 'date_start',  'type' => 'xsd:string'),
6001
-        'date_end'    => array('name' => 'date_end',    'type' => 'xsd:string'),
6002
-        'secret_key'  => array('name' => 'secret_key',  'type' => 'xsd:string')
5998
+        'from'  => array('name' => 'from', 'type' => 'xsd:int'),
5999
+        'to'    => array('name' => 'to', 'type' => 'xsd:int'),
6000
+        'date_start'  => array('name' => 'date_start', 'type' => 'xsd:string'),
6001
+        'date_end'    => array('name' => 'date_end', 'type' => 'xsd:string'),
6002
+        'secret_key'  => array('name' => 'secret_key', 'type' => 'xsd:string')
6003 6003
     )
6004 6004
 );
6005 6005
 
@@ -6010,11 +6010,11 @@  discard block
 block discarded – undo
6010 6010
     'all',
6011 6011
     '',
6012 6012
     array(
6013
-        'id' => array ('name' => 'id'  , 'type' => 'xsd:int'),
6014
-        'title' => array ('name' => 'title', 'type' => 'xsd:string'),
6015
-        'url' => array ('name' => 'url', 'type' => 'xsd:string'),
6016
-        'date_start' => array ('name' => 'date_start', 'type' => 'xsd:string'),
6017
-        'date_end' => array ('name' => 'date_end', 'type' => 'xsd:string'),
6013
+        'id' => array('name' => 'id', 'type' => 'xsd:int'),
6014
+        'title' => array('name' => 'title', 'type' => 'xsd:string'),
6015
+        'url' => array('name' => 'url', 'type' => 'xsd:string'),
6016
+        'date_start' => array('name' => 'date_start', 'type' => 'xsd:string'),
6017
+        'date_end' => array('name' => 'date_end', 'type' => 'xsd:string'),
6018 6018
     )
6019 6019
 );
6020 6020
 
@@ -6033,13 +6033,13 @@  discard block
 block discarded – undo
6033 6033
 );
6034 6034
 
6035 6035
 // Register the method to expose
6036
-$server->register('WSListSessions',           // method name
6037
-    array('input'  => 'tns:session_arg'),     // input parameters
6038
-    array('return' => 'tns:sessions'),        // output parameters
6039
-    'urn:WSRegistration',                     // namespace
6040
-    'urn:WSRegistration#WSListSessions',      // soapaction
6041
-    'rpc',                                    // style
6042
-    'encoded',                                // use
6036
+$server->register('WSListSessions', // method name
6037
+    array('input'  => 'tns:session_arg'), // input parameters
6038
+    array('return' => 'tns:sessions'), // output parameters
6039
+    'urn:WSRegistration', // namespace
6040
+    'urn:WSRegistration#WSListSessions', // soapaction
6041
+    'rpc', // style
6042
+    'encoded', // use
6043 6043
     'This service returns a list of sessions' // documentation
6044 6044
 );
6045 6045
 
@@ -6097,20 +6097,20 @@  discard block
 block discarded – undo
6097 6097
     'all',
6098 6098
     '',
6099 6099
     array(
6100
-        'course'       => array('name' => 'course',     'type' => 'xsd:string'), //Course string code
6101
-        'user_id'      => array('name' => 'user_id',    'type' => 'xsd:string'), //Chamilo user_id
6100
+        'course'       => array('name' => 'course', 'type' => 'xsd:string'), //Course string code
6101
+        'user_id'      => array('name' => 'user_id', 'type' => 'xsd:string'), //Chamilo user_id
6102 6102
         'secret_key'   => array('name' => 'secret_key', 'type' => 'xsd:string')
6103 6103
     )
6104 6104
 );
6105 6105
 
6106 6106
 // Register the method to expose
6107
-$server->register('WSUserSubscribedInCourse',                            // method name
6108
-    array('UserSubscribedInCourse' => 'tns:UserSubscribedInCourse'),    // input parameters
6109
-    array('return' => 'xsd:string'),                                        // output parameters
6110
-    'urn:WSRegistration',                                                    // namespace
6111
-    'urn:WSRegistration#WSUserSubscribedInCourse',                       // soapaction
6112
-    'rpc',                                                                    // style
6113
-    'encoded',                                                                // use
6107
+$server->register('WSUserSubscribedInCourse', // method name
6108
+    array('UserSubscribedInCourse' => 'tns:UserSubscribedInCourse'), // input parameters
6109
+    array('return' => 'xsd:string'), // output parameters
6110
+    'urn:WSRegistration', // namespace
6111
+    'urn:WSRegistration#WSUserSubscribedInCourse', // soapaction
6112
+    'rpc', // style
6113
+    'encoded', // use
6114 6114
     'This service checks if user assigned to course'    // documentation
6115 6115
 );
6116 6116
 
@@ -6124,7 +6124,7 @@  discard block
 block discarded – undo
6124 6124
     global $debug;
6125 6125
 
6126 6126
     if ($debug) error_log('WSUserSubscribedInCourse');
6127
-    if ($debug) error_log('Params '. print_r($params, 1));
6127
+    if ($debug) error_log('Params '.print_r($params, 1));
6128 6128
     if (!WSHelperVerifyKey($params)) {
6129 6129
 
6130 6130
         return returnError(WS_ERROR_SECRET_KEY);
@@ -6132,7 +6132,7 @@  discard block
 block discarded – undo
6132 6132
     $courseCode  = $params['course']; //Course code
6133 6133
     $userId      = $params['user_id']; //chamilo user id
6134 6134
 
6135
-    return (CourseManager::is_user_subscribed_in_course($userId,$courseCode));
6135
+    return (CourseManager::is_user_subscribed_in_course($userId, $courseCode));
6136 6136
 }
6137 6137
 
6138 6138
 
@@ -6160,8 +6160,8 @@  discard block
 block discarded – undo
6160 6160
     'all',
6161 6161
     '',
6162 6162
     array(
6163
-        'variable' => array('name'=>'variable','type'=>'xsd:string'),
6164
-        'value' => array('name'=>'value','type'=>'xsd:string')
6163
+        'variable' => array('name'=>'variable', 'type'=>'xsd:string'),
6164
+        'value' => array('name'=>'value', 'type'=>'xsd:string')
6165 6165
     )
6166 6166
 );
6167 6167
 
@@ -6223,12 +6223,12 @@  discard block
 block discarded – undo
6223 6223
 //Reister WSSearchSession
6224 6224
 $server->register(
6225 6225
     'WSSearchSession',
6226
-    array('SearchSession' => 'tns:SearchSession'),      // input parameters
6227
-    array('return' => 'tns:searchedSessionList'),       // output parameters
6228
-    'urn:WSRegistration',                               // namespace
6229
-    'urn:WSRegistration#WSSearchSession',               // soapaction
6230
-    'rpc',                                              // style
6231
-    'encoded',                                          // use
6226
+    array('SearchSession' => 'tns:SearchSession'), // input parameters
6227
+    array('return' => 'tns:searchedSessionList'), // output parameters
6228
+    'urn:WSRegistration', // namespace
6229
+    'urn:WSRegistration#WSSearchSession', // soapaction
6230
+    'rpc', // style
6231
+    'encoded', // use
6232 6232
     'This service to get a session list filtered by name, description or short description extra field'    // documentation
6233 6233
 );
6234 6234
 
@@ -6283,12 +6283,12 @@  discard block
 block discarded – undo
6283 6283
 //Reister WSFetchSession
6284 6284
 $server->register(
6285 6285
     'WSFetchSession',
6286
-    array('SearchSession' => 'tns:FetchSession'),                    // input parameters
6287
-    array('return' => 'tns:searchedSessionList'),       // output parameters
6288
-    'urn:WSRegistration',                               // namespace
6289
-    'urn:WSRegistration#WSFetchSession',                // soapaction
6290
-    'rpc',                                              // style
6291
-    'encoded',                                          // use
6286
+    array('SearchSession' => 'tns:FetchSession'), // input parameters
6287
+    array('return' => 'tns:searchedSessionList'), // output parameters
6288
+    'urn:WSRegistration', // namespace
6289
+    'urn:WSRegistration#WSFetchSession', // soapaction
6290
+    'rpc', // style
6291
+    'encoded', // use
6292 6292
     'This service get a session by its id. Optionally can get its extra fields values'    // documentation
6293 6293
 );
6294 6294
 
@@ -6365,16 +6365,16 @@  discard block
 block discarded – undo
6365 6365
 );
6366 6366
 // Register the method to expose
6367 6367
 $server->register(
6368
-    'WSCertificatesList',                           // method name
6368
+    'WSCertificatesList', // method name
6369 6369
     array(
6370
-        'startingDate' => 'xsd:string',             // input parameters
6370
+        'startingDate' => 'xsd:string', // input parameters
6371 6371
         'endingDate' => 'xsd:string'
6372 6372
     ),
6373
-    array('return' => 'tns:certificatesList'),      // output parameters
6374
-    'urn:WSRegistration',                           // namespace
6375
-    'urn:WSRegistration#WSCertificatesList',        // soapaction
6376
-    'rpc',                                          // style
6377
-    'encoded',                                      // use
6373
+    array('return' => 'tns:certificatesList'), // output parameters
6374
+    'urn:WSRegistration', // namespace
6375
+    'urn:WSRegistration#WSCertificatesList', // soapaction
6376
+    'rpc', // style
6377
+    'encoded', // use
6378 6378
     'This service returns a list of certificates'   // documentation
6379 6379
 );
6380 6380
 
@@ -6440,13 +6440,13 @@  discard block
 block discarded – undo
6440 6440
 );
6441 6441
 
6442 6442
 // Register the method to expose
6443
-$server->register('WSCreateGroup',              // method name
6444
-    array('createGroup' => 'tns:createGroup'),  // input parameters
6445
-    array('return' => 'xsd:string'),            // output parameters
6446
-    'urn:WSRegistration',                       // namespace
6447
-    'urn:WSRegistration#WSCreateGroup',         // soapaction
6448
-    'rpc',                                      // style
6449
-    'encoded',                                  // use
6443
+$server->register('WSCreateGroup', // method name
6444
+    array('createGroup' => 'tns:createGroup'), // input parameters
6445
+    array('return' => 'xsd:string'), // output parameters
6446
+    'urn:WSRegistration', // namespace
6447
+    'urn:WSRegistration#WSCreateGroup', // soapaction
6448
+    'rpc', // style
6449
+    'encoded', // use
6450 6450
     'This service adds a group'                 // documentation
6451 6451
 );
6452 6452
 
@@ -6489,13 +6489,13 @@  discard block
 block discarded – undo
6489 6489
 );
6490 6490
 
6491 6491
 // Register the method to expose
6492
-$server->register('WSUpdateGroup',              // method name
6493
-    array('updateGroup' => 'tns:updateGroup'),  // input parameters
6494
-    array('return' => 'xsd:string'),            // output parameters
6495
-    'urn:WSRegistration',                       // namespace
6496
-    'urn:WSRegistration#WSUpdateGroup',         // soapaction
6497
-    'rpc',                                      // style
6498
-    'encoded',                                  // use
6492
+$server->register('WSUpdateGroup', // method name
6493
+    array('updateGroup' => 'tns:updateGroup'), // input parameters
6494
+    array('return' => 'xsd:string'), // output parameters
6495
+    'urn:WSRegistration', // namespace
6496
+    'urn:WSRegistration#WSUpdateGroup', // soapaction
6497
+    'rpc', // style
6498
+    'encoded', // use
6499 6499
     'This service updates a group'              // documentation
6500 6500
 );
6501 6501
 
@@ -6540,13 +6540,13 @@  discard block
 block discarded – undo
6540 6540
 );
6541 6541
 
6542 6542
 // Register the method to expose
6543
-$server->register('WSDeleteGroup',              // method name
6544
-    array('deleteGroup' => 'tns:deleteGroup'),  // input parameters
6545
-    array('return' => 'xsd:string'),            // output parameters
6546
-    'urn:WSRegistration',                       // namespace
6547
-    'urn:WSRegistration#WSDeleteGroup',         // soapaction
6548
-    'rpc',                                      // style
6549
-    'encoded',                                  // use
6543
+$server->register('WSDeleteGroup', // method name
6544
+    array('deleteGroup' => 'tns:deleteGroup'), // input parameters
6545
+    array('return' => 'xsd:string'), // output parameters
6546
+    'urn:WSRegistration', // namespace
6547
+    'urn:WSRegistration#WSDeleteGroup', // soapaction
6548
+    'rpc', // style
6549
+    'encoded', // use
6550 6550
     'This service deletes a group'              // documentation
6551 6551
 );
6552 6552
 
@@ -6583,13 +6583,13 @@  discard block
 block discarded – undo
6583 6583
 );
6584 6584
 
6585 6585
 // Register the method to expose
6586
-$server->register('GroupBindToParent',                      // method name
6587
-    array('groupBindToParent' => 'tns:groupBindToParent'),  // input parameters
6588
-    array('return' => 'xsd:string'),                        // output parameters
6589
-    'urn:WSRegistration',                                   // namespace
6590
-    'urn:WSRegistration#GroupBindToParent',                 // soapaction
6591
-    'rpc',                                                  // style
6592
-    'encoded',                                              // use
6586
+$server->register('GroupBindToParent', // method name
6587
+    array('groupBindToParent' => 'tns:groupBindToParent'), // input parameters
6588
+    array('return' => 'xsd:string'), // output parameters
6589
+    'urn:WSRegistration', // namespace
6590
+    'urn:WSRegistration#GroupBindToParent', // soapaction
6591
+    'rpc', // style
6592
+    'encoded', // use
6593 6593
     'This service binds a group to a parent'                // documentation
6594 6594
 );
6595 6595
 
@@ -6625,13 +6625,13 @@  discard block
 block discarded – undo
6625 6625
 );
6626 6626
 
6627 6627
 // Register the method to expose
6628
-$server->register('GroupUnbindFromParent',                          // method name
6629
-    array('groupUnbindFromParent' => 'tns:groupUnbindFromParent'),  // input parameters
6630
-    array('return' => 'xsd:string'),                                // output parameters
6631
-    'urn:WSRegistration',                                           // namespace
6632
-    'urn:WSRegistration#GroupUnbindFromParent',                     // soapaction
6633
-    'rpc',                                                          // style
6634
-    'encoded',                                                      // use
6628
+$server->register('GroupUnbindFromParent', // method name
6629
+    array('groupUnbindFromParent' => 'tns:groupUnbindFromParent'), // input parameters
6630
+    array('return' => 'xsd:string'), // output parameters
6631
+    'urn:WSRegistration', // namespace
6632
+    'urn:WSRegistration#GroupUnbindFromParent', // soapaction
6633
+    'rpc', // style
6634
+    'encoded', // use
6635 6635
     'This service unbinds a group from its parent'                  // documentation
6636 6636
 );
6637 6637
 
@@ -6665,13 +6665,13 @@  discard block
 block discarded – undo
6665 6665
 );
6666 6666
 
6667 6667
 // Register the method to expose
6668
-$server->register('WSAddUserToGroup',                   // method name
6669
-    array('addUserToGroup' => 'tns:addUserToGroup'),    // input parameters
6670
-    array('return' => 'xsd:string'),                    // output parameters
6671
-    'urn:WSRegistration',                               // namespace
6672
-    'urn:WSRegistration#WSAddUserToGroup',              // soapaction
6673
-    'rpc',                                              // style
6674
-    'encoded',                                          // use
6668
+$server->register('WSAddUserToGroup', // method name
6669
+    array('addUserToGroup' => 'tns:addUserToGroup'), // input parameters
6670
+    array('return' => 'xsd:string'), // output parameters
6671
+    'urn:WSRegistration', // namespace
6672
+    'urn:WSRegistration#WSAddUserToGroup', // soapaction
6673
+    'rpc', // style
6674
+    'encoded', // use
6675 6675
     'This service adds a user to a group'               // documentation
6676 6676
 );
6677 6677
 
@@ -6708,13 +6708,13 @@  discard block
 block discarded – undo
6708 6708
 );
6709 6709
 
6710 6710
 // Register the method to expose
6711
-$server->register('WSUpdateUserRoleInGroup',                        // method name
6712
-    array('updateUserRoleInGroup' => 'tns:updateUserRoleInGroup'),  // input parameters
6713
-    array('return' => 'xsd:string'),                                // output parameters
6714
-    'urn:WSRegistration',                                           // namespace
6715
-    'urn:WSRegistration#WSUpdateUserRoleInGroup',                   // soapaction
6716
-    'rpc',                                                          // style
6717
-    'encoded',                                                      // use
6711
+$server->register('WSUpdateUserRoleInGroup', // method name
6712
+    array('updateUserRoleInGroup' => 'tns:updateUserRoleInGroup'), // input parameters
6713
+    array('return' => 'xsd:string'), // output parameters
6714
+    'urn:WSRegistration', // namespace
6715
+    'urn:WSRegistration#WSUpdateUserRoleInGroup', // soapaction
6716
+    'rpc', // style
6717
+    'encoded', // use
6718 6718
     'This service updates a user role in group'                     // documentation
6719 6719
 );
6720 6720
 
@@ -6753,13 +6753,13 @@  discard block
 block discarded – undo
6753 6753
 );
6754 6754
 
6755 6755
 // Register the method to expose
6756
-$server->register('WSDeleteUserFromGroup',                      // method name
6757
-    array('deleteUserFromGroup' => 'tns:deleteUserFromGroup'),  // input parameters
6758
-    array('return' => 'xsd:string'),                            // output parameters
6759
-    'urn:WSRegistration',                                       // namespace
6760
-    'urn:WSRegistration#WSDeleteUserFromGroup',                 // soapaction
6761
-    'rpc',                                                      // style
6762
-    'encoded',                                                  // use
6756
+$server->register('WSDeleteUserFromGroup', // method name
6757
+    array('deleteUserFromGroup' => 'tns:deleteUserFromGroup'), // input parameters
6758
+    array('return' => 'xsd:string'), // output parameters
6759
+    'urn:WSRegistration', // namespace
6760
+    'urn:WSRegistration#WSDeleteUserFromGroup', // soapaction
6761
+    'rpc', // style
6762
+    'encoded', // use
6763 6763
     'This service deletes a user from a group'                  // documentation
6764 6764
 );
6765 6765
 
Please login to merge, or discard this patch.
main/exercice/exercise.class.php 1 patch
Spacing   +348 added lines, -348 removed lines patch added patch discarded remove patch
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
     public $feedback_type;
28 28
     public $end_time;
29 29
     public $start_time;
30
-    public $questionList;  // array with the list of this exercise's questions
30
+    public $questionList; // array with the list of this exercise's questions
31 31
     /* including question list of the media */
32 32
     public $questionListUncompressed;
33 33
     public $results_disabled;
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
         $TBL_EXERCISES = Database::get_course_table(TABLE_QUIZ_TEST);
131 131
         $table_lp_item = Database::get_course_table(TABLE_LP_ITEM);
132 132
 
133
-        $id  = intval($id);
133
+        $id = intval($id);
134 134
         if (empty($this->course_id)) {
135 135
 
136 136
             return false;
@@ -190,10 +190,10 @@  discard block
 block discarded – undo
190 190
             }
191 191
 
192 192
             if ($object->end_time != '0000-00-00 00:00:00') {
193
-                $this->end_time 	= $object->end_time;
193
+                $this->end_time = $object->end_time;
194 194
             }
195 195
             if ($object->start_time != '0000-00-00 00:00:00') {
196
-                $this->start_time 	= $object->start_time;
196
+                $this->start_time = $object->start_time;
197 197
             }
198 198
 
199 199
             //control time
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
      */
479 479
     public function isRandom()
480 480
     {
481
-        if($this->random > 0 || $this->random == -1) {
481
+        if ($this->random > 0 || $this->random == -1) {
482 482
             return true;
483 483
         } else {
484 484
             return false;
@@ -639,7 +639,7 @@  discard block
 block discarded – undo
639 639
                     $question_media = null;
640 640
                     if (!empty($objQuestionTmp->parent_id)) {
641 641
                         $objQuestionMedia = Question::read($objQuestionTmp->parent_id);
642
-                        $question_media  = Question::getMediaLabel($objQuestionMedia->question);
642
+                        $question_media = Question::getMediaLabel($objQuestionMedia->question);
643 643
                     }
644 644
 
645 645
                     $questionType = Display::tag('div', Display::return_icon($typeImg, $typeExpl, array(), ICON_SIZE_MEDIUM).$question_media);
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
 
1033 1033
             foreach ($questions_by_category as $categoryId => $questionList) {
1034 1034
                 $cat = new TestCategory($categoryId);
1035
-                $cat = (array)$cat;
1035
+                $cat = (array) $cat;
1036 1036
                 $cat['iid'] = $cat['id'];
1037 1037
                 //*$cat['name'] = $cat['name'];
1038 1038
 
@@ -1097,7 +1097,7 @@  discard block
 block discarded – undo
1097 1097
     {
1098 1098
         if ($this->specialCategoryOrders == false) {
1099 1099
             if ($from_db && !empty($this->id)) {
1100
-                $TBL_EXERCISE_QUESTION  = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
1100
+                $TBL_EXERCISE_QUESTION = Database::get_course_table(TABLE_QUIZ_TEST_QUESTION);
1101 1101
                 $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
1102 1102
 
1103 1103
                 $sql = "SELECT DISTINCT e.question_order
@@ -1124,7 +1124,7 @@  discard block
 block discarded – undo
1124 1124
                 $question_list = array();
1125 1125
 
1126 1126
                 while ($new_object = Database::fetch_object($result)) {
1127
-                    $question_list[$new_object->question_order]=  $new_object->question_id;
1127
+                    $question_list[$new_object->question_order] = $new_object->question_id;
1128 1128
                     $temp_question_list[$counter] = $new_object->question_id;
1129 1129
                     $counter++;
1130 1130
                 }
@@ -1268,7 +1268,7 @@  discard block
 block discarded – undo
1268 1268
     public function isInList($questionId)
1269 1269
     {
1270 1270
         if (is_array($this->questionList))
1271
-            return in_array($questionId,$this->questionList);
1271
+            return in_array($questionId, $this->questionList);
1272 1272
         else
1273 1273
             return false;
1274 1274
     }
@@ -1281,7 +1281,7 @@  discard block
 block discarded – undo
1281 1281
      */
1282 1282
     public function updateTitle($title)
1283 1283
     {
1284
-        $this->exercise=$title;
1284
+        $this->exercise = $title;
1285 1285
     }
1286 1286
 
1287 1287
     /**
@@ -1291,7 +1291,7 @@  discard block
 block discarded – undo
1291 1291
      */
1292 1292
     public function updateAttempts($attempts)
1293 1293
     {
1294
-        $this->attempts=$attempts;
1294
+        $this->attempts = $attempts;
1295 1295
     }
1296 1296
 
1297 1297
     /**
@@ -1301,7 +1301,7 @@  discard block
 block discarded – undo
1301 1301
      */
1302 1302
     public function updateFeedbackType($feedback_type)
1303 1303
     {
1304
-        $this->feedback_type=$feedback_type;
1304
+        $this->feedback_type = $feedback_type;
1305 1305
     }
1306 1306
 
1307 1307
     /**
@@ -1312,7 +1312,7 @@  discard block
 block discarded – undo
1312 1312
      */
1313 1313
     public function updateDescription($description)
1314 1314
     {
1315
-        $this->description=$description;
1315
+        $this->description = $description;
1316 1316
     }
1317 1317
 
1318 1318
     /**
@@ -1442,23 +1442,23 @@  discard block
 block discarded – undo
1442 1442
      * @param string $sound - exercise sound file
1443 1443
      * @param string $delete - ask to delete the file
1444 1444
      */
1445
-    public function updateSound($sound,$delete)
1445
+    public function updateSound($sound, $delete)
1446 1446
     {
1447 1447
         global $audioPath, $documentPath;
1448 1448
         $TBL_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
1449 1449
 
1450
-        if ($sound['size'] && (strstr($sound['type'],'audio') || strstr($sound['type'],'video'))) {
1451
-            $this->sound=$sound['name'];
1450
+        if ($sound['size'] && (strstr($sound['type'], 'audio') || strstr($sound['type'], 'video'))) {
1451
+            $this->sound = $sound['name'];
1452 1452
 
1453
-            if (@move_uploaded_file($sound['tmp_name'],$audioPath.'/'.$this->sound)) {
1453
+            if (@move_uploaded_file($sound['tmp_name'], $audioPath.'/'.$this->sound)) {
1454 1454
                 $query = "SELECT 1 FROM $TBL_DOCUMENT
1455
-                        WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath,'',$audioPath).'/'.$this->sound."'";
1456
-                $result=Database::query($query);
1455
+                        WHERE c_id = ".$this->course_id." AND path='".str_replace($documentPath, '', $audioPath).'/'.$this->sound."'";
1456
+                $result = Database::query($query);
1457 1457
 
1458 1458
                 if (!Database::num_rows($result)) {
1459 1459
                     $id = add_document(
1460 1460
                         $this->course,
1461
-                        str_replace($documentPath,'',$audioPath).'/'.$this->sound,
1461
+                        str_replace($documentPath, '', $audioPath).'/'.$this->sound,
1462 1462
                         'file',
1463 1463
                         $sound['size'],
1464 1464
                         $sound['name']
@@ -1477,8 +1477,8 @@  discard block
 block discarded – undo
1477 1477
                     );
1478 1478
                 }
1479 1479
             }
1480
-        } elseif($delete && is_file($audioPath.'/'.$this->sound)) {
1481
-            $this->sound='';
1480
+        } elseif ($delete && is_file($audioPath.'/'.$this->sound)) {
1481
+            $this->sound = '';
1482 1482
         }
1483 1483
     }
1484 1484
 
@@ -1490,7 +1490,7 @@  discard block
 block discarded – undo
1490 1490
      */
1491 1491
     public function updateType($type)
1492 1492
     {
1493
-        $this->type=$type;
1493
+        $this->type = $type;
1494 1494
     }
1495 1495
 
1496 1496
     /**
@@ -1526,7 +1526,7 @@  discard block
 block discarded – undo
1526 1526
      */
1527 1527
     public function enable()
1528 1528
     {
1529
-        $this->active=1;
1529
+        $this->active = 1;
1530 1530
     }
1531 1531
 
1532 1532
     /**
@@ -1536,7 +1536,7 @@  discard block
 block discarded – undo
1536 1536
      */
1537 1537
     public function disable()
1538 1538
     {
1539
-        $this->active=0;
1539
+        $this->active = 0;
1540 1540
     }
1541 1541
 
1542 1542
     /**
@@ -1664,7 +1664,7 @@  discard block
 block discarded – undo
1664 1664
                 api_get_user_id()
1665 1665
             );
1666 1666
 
1667
-            if (api_get_setting('search_enabled')=='true') {
1667
+            if (api_get_setting('search_enabled') == 'true') {
1668 1668
                 $this->search_engine_edit();
1669 1669
             }
1670 1670
         } else {
@@ -1812,7 +1812,7 @@  discard block
 block discarded – undo
1812 1812
     public function removeFromList($questionId)
1813 1813
     {
1814 1814
         // searches the position of the question ID in the list
1815
-        $pos = array_search($questionId,$this->questionList);
1815
+        $pos = array_search($questionId, $this->questionList);
1816 1816
 
1817 1817
         // question not found
1818 1818
         if ($pos === false) {
@@ -1847,7 +1847,7 @@  discard block
 block discarded – undo
1847 1847
         api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'QuizDeleted', api_get_user_id());
1848 1848
         api_item_property_update($this->course, TOOL_QUIZ, $this->id, 'delete', api_get_user_id());
1849 1849
 
1850
-        if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian') ) {
1850
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
1851 1851
             $this->search_engine_delete();
1852 1852
         }
1853 1853
     }
@@ -1856,7 +1856,7 @@  discard block
 block discarded – undo
1856 1856
      * Creates the form to create / edit an exercise
1857 1857
      * @param FormValidator $form
1858 1858
      */
1859
-    public function createForm($form, $type='full')
1859
+    public function createForm($form, $type = 'full')
1860 1860
     {
1861 1861
         if (empty($type)) {
1862 1862
             $type = 'full';
@@ -1887,7 +1887,7 @@  discard block
 block discarded – undo
1887 1887
             'Width' => '100%',
1888 1888
             'Height' => '150',
1889 1889
         );
1890
-        if (is_array($type)){
1890
+        if (is_array($type)) {
1891 1891
             $editor_config = array_merge($editor_config, $type);
1892 1892
         }
1893 1893
 
@@ -1941,13 +1941,13 @@  discard block
 block discarded – undo
1941 1941
                     '2',
1942 1942
                     array('id' => 'exerciseType_2')
1943 1943
                 );
1944
-                $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')), '');
1944
+                $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')), '');
1945 1945
 
1946 1946
                 // Type of results display on the final page
1947 1947
                 $radios_results_disabled = array();
1948 1948
                 $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0'));
1949
-                $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'),  '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()'));
1950
-                $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'),  '2', array('id'=>'result_disabled_2'));
1949
+                $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()'));
1950
+                $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2'));
1951 1951
                 //$radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ExamModeWithFinalScoreShowOnlyFinalScoreWithCategoriesIfAvailable'),  '3', array('id'=>'result_disabled_3','onclick' => 'check_results_disabled()'));
1952 1952
 
1953 1953
                 $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
@@ -1955,8 +1955,8 @@  discard block
 block discarded – undo
1955 1955
                 // Type of questions disposition on page
1956 1956
                 $radios = array();
1957 1957
 
1958
-                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'),    '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
1959
-                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
1958
+                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
1959
+                $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
1960 1960
 
1961 1961
                 $form->addGroup($radios, null, get_lang('QuestionsPerPage'), '');
1962 1962
 
@@ -1966,33 +1966,33 @@  discard block
 block discarded – undo
1966 1966
 
1967 1967
                     // feedback type
1968 1968
                     $radios_feedback = array();
1969
-                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'),'0',array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()'));
1969
+                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('ExerciseAtTheEndOfTheTest'), '0', array('id' =>'exerciseType_0', 'onclick' => 'check_feedback()'));
1970 1970
 
1971 1971
                     if (api_get_setting('enable_quiz_scenario') == 'true') {
1972
-                        $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1' , 'onclick' => 'check_direct_feedback()'));
1972
+                        $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('DirectFeedback'), '1', array('id' =>'exerciseType_1', 'onclick' => 'check_direct_feedback()'));
1973 1973
                     }
1974
-                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'),'2',array('id' =>'exerciseType_2'));
1975
-                    $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'),get_lang('FeedbackDisplayOptions')));
1974
+                    $radios_feedback[] = $form->createElement('radio', 'exerciseFeedbackType', null, get_lang('NoFeedback'), '2', array('id' =>'exerciseType_2'));
1975
+                    $form->addGroup($radios_feedback, null, array(get_lang('FeedbackType'), get_lang('FeedbackDisplayOptions')));
1976 1976
 
1977 1977
                     //$form->addElement('select', 'exerciseFeedbackType',get_lang('FeedbackType'),$feedback_option,'onchange="javascript:feedbackselection()"');
1978 1978
                     $radios_results_disabled = array();
1979 1979
                     $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0'));
1980
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'),  '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()'));
1981
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'),  '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()'));
1982
-                    $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),'');
1980
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()'));
1981
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()'));
1982
+                    $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
1983 1983
 
1984 1984
                     // Type of questions disposition on page
1985 1985
                     $radios = array();
1986
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'),    '1');
1987
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2');
1986
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1');
1987
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2');
1988 1988
                     $form->addGroup($radios, null, get_lang('ExerciseType'));
1989 1989
 
1990 1990
                 } else {
1991 1991
                     //Show options freeze
1992 1992
                     $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('ShowScoreAndRightAnswer'), '0', array('id'=>'result_disabled_0'));
1993
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'),  '1',array('id'=>'result_disabled_1','onclick' => 'check_results_disabled()'));
1994
-                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'),  '2',array('id'=>'result_disabled_2','onclick' => 'check_results_disabled()'));
1995
-                    $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'),'');
1993
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('DoNotShowScoreNorRightAnswer'), '1', array('id'=>'result_disabled_1', 'onclick' => 'check_results_disabled()'));
1994
+                    $radios_results_disabled[] = $form->createElement('radio', 'results_disabled', null, get_lang('OnlyShowScore'), '2', array('id'=>'result_disabled_2', 'onclick' => 'check_results_disabled()'));
1995
+                    $result_disable_group = $form->addGroup($radios_results_disabled, null, get_lang('ShowResultsToStudents'), '');
1996 1996
                     $result_disable_group->freeze();
1997 1997
 
1998 1998
                     //we force the options to the DirectFeedback exercisetype
@@ -2000,8 +2000,8 @@  discard block
 block discarded – undo
2000 2000
                     $form->addElement('hidden', 'exerciseType', ONE_PER_PAGE);
2001 2001
 
2002 2002
                     // Type of questions disposition on page
2003
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'),    '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
2004
-                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'),'2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
2003
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SimpleExercise'), '1', array('onclick' => 'check_per_page_all()', 'id'=>'option_page_all'));
2004
+                    $radios[] = $form->createElement('radio', 'exerciseType', null, get_lang('SequentialExercise'), '2', array('onclick' => 'check_per_page_one()', 'id'=>'option_page_one'));
2005 2005
 
2006 2006
                     $type_group = $form->addGroup($radios, null, get_lang('QuestionsPerPage'), '');
2007 2007
                     $type_group->freeze();
@@ -2133,26 +2133,26 @@  discard block
 block discarded – undo
2133 2133
 
2134 2134
                 // number of random question
2135 2135
 
2136
-                $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10 ;
2136
+                $max = ($this->id > 0) ? $this->selectNbrQuestions() : 10;
2137 2137
                 $option = range(0, $max);
2138 2138
                 $option[0] = get_lang('No');
2139 2139
                 $option[-1] = get_lang('AllQuestionsShort');
2140
-                $form->addElement('select', 'randomQuestions',array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions'));
2140
+                $form->addElement('select', 'randomQuestions', array(get_lang('RandomQuestions'), get_lang('RandomQuestionsHelp')), $option, array('id'=>'randomQuestions'));
2141 2141
 
2142 2142
                 // Random answers
2143 2143
                 $radios_random_answers = array();
2144
-                $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'),'1');
2145
-                $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'),'0');
2144
+                $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('Yes'), '1');
2145
+                $radios_random_answers[] = $form->createElement('radio', 'randomAnswers', null, get_lang('No'), '0');
2146 2146
                 $form->addGroup($radios_random_answers, null, get_lang('RandomAnswers'), '');
2147 2147
 
2148 2148
                 // Random by category
2149
-                $form->addElement('html','<div class="clear">&nbsp;</div>');
2149
+                $form->addElement('html', '<div class="clear">&nbsp;</div>');
2150 2150
                 $radiocat = array();
2151
-                $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'),'1');
2152
-                $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'),'2');
2153
-                $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'),'0');
2151
+                $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesShuffled'), '1');
2152
+                $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('YesWithCategoriesSorted'), '2');
2153
+                $radiocat[] = $form->createElement('radio', 'randomByCat', null, get_lang('No'), '0');
2154 2154
                 $radioCatGroup = $form->addGroup($radiocat, null, get_lang('RandomQuestionByCategory'), '');
2155
-                $form->addElement('html','<div class="clear">&nbsp;</div>');
2155
+                $form->addElement('html', '<div class="clear">&nbsp;</div>');
2156 2156
 
2157 2157
                 // add the radio display the category name for student
2158 2158
                 $radio_display_cat_name = array();
@@ -2173,36 +2173,36 @@  discard block
 block discarded – undo
2173 2173
             );
2174 2174
 
2175 2175
             // Exercise time limit
2176
-            $form->addElement('checkbox', 'activate_start_date_check',null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
2176
+            $form->addElement('checkbox', 'activate_start_date_check', null, get_lang('EnableStartTime'), array('onclick' => 'activate_start_date()'));
2177 2177
 
2178 2178
             $var = Exercise::selectTimeLimit();
2179 2179
 
2180 2180
             if (($this->start_time != '0000-00-00 00:00:00'))
2181
-                $form->addElement('html','<div id="start_date_div" style="display:block;">');
2181
+                $form->addElement('html', '<div id="start_date_div" style="display:block;">');
2182 2182
             else
2183
-                $form->addElement('html','<div id="start_date_div" style="display:none;">');
2183
+                $form->addElement('html', '<div id="start_date_div" style="display:none;">');
2184 2184
 
2185 2185
             $form->addElement('date_time_picker', 'start_time');
2186 2186
 
2187
-            $form->addElement('html','</div>');
2187
+            $form->addElement('html', '</div>');
2188 2188
 
2189
-            $form->addElement('checkbox', 'activate_end_date_check', null , get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
2189
+            $form->addElement('checkbox', 'activate_end_date_check', null, get_lang('EnableEndTime'), array('onclick' => 'activate_end_date()'));
2190 2190
 
2191 2191
             if (($this->end_time != '0000-00-00 00:00:00'))
2192
-                $form->addElement('html','<div id="end_date_div" style="display:block;">');
2192
+                $form->addElement('html', '<div id="end_date_div" style="display:block;">');
2193 2193
             else
2194
-                $form->addElement('html','<div id="end_date_div" style="display:none;">');
2194
+                $form->addElement('html', '<div id="end_date_div" style="display:none;">');
2195 2195
 
2196 2196
             $form->addElement('date_time_picker', 'end_time');
2197
-            $form->addElement('html','</div>');
2197
+            $form->addElement('html', '</div>');
2198 2198
 
2199 2199
             //$check_option=$this->selectType();
2200 2200
             $diplay = 'block';
2201 2201
             $form->addElement('checkbox', 'propagate_neg', null, get_lang('PropagateNegativeResults'));
2202
-            $form->addElement('html','<div class="clear">&nbsp;</div>');
2202
+            $form->addElement('html', '<div class="clear">&nbsp;</div>');
2203 2203
             $form->addElement('checkbox', 'review_answers', null, get_lang('ReviewAnswers'));
2204 2204
 
2205
-            $form->addElement('html','<div id="divtimecontrol"  style="display:'.$diplay.';">');
2205
+            $form->addElement('html', '<div id="divtimecontrol"  style="display:'.$diplay.';">');
2206 2206
 
2207 2207
             //Timer control
2208 2208
             //$time_hours_option = range(0,12);
@@ -2218,12 +2218,12 @@  discard block
 block discarded – undo
2218 2218
                     'onload' => 'check_load_time()',
2219 2219
                 )
2220 2220
             );
2221
-            $expired_date = (int)$this->selectExpiredTime();
2221
+            $expired_date = (int) $this->selectExpiredTime();
2222 2222
 
2223
-            if (($expired_date!='0')) {
2224
-                $form->addElement('html','<div id="timercontrol" style="display:block;">');
2223
+            if (($expired_date != '0')) {
2224
+                $form->addElement('html', '<div id="timercontrol" style="display:block;">');
2225 2225
             } else {
2226
-                $form->addElement('html','<div id="timercontrol" style="display:none;">');
2226
+                $form->addElement('html', '<div id="timercontrol" style="display:none;">');
2227 2227
             }
2228 2228
             $form->addText(
2229 2229
                 'enabletimercontroltotalminutes',
@@ -2234,7 +2234,7 @@  discard block
 block discarded – undo
2234 2234
                     'cols-size' => [2, 2, 8]
2235 2235
                 ]
2236 2236
             );
2237
-            $form->addElement('html','</div>');
2237
+            $form->addElement('html', '</div>');
2238 2238
 
2239 2239
             $form->addElement(
2240 2240
                 'text',
@@ -2256,23 +2256,23 @@  discard block
 block discarded – undo
2256 2256
             $defaults = array();
2257 2257
 
2258 2258
             if (api_get_setting('search_enabled') === 'true') {
2259
-                require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
2259
+                require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
2260 2260
 
2261
-                $form->addElement ('checkbox', 'index_document','', get_lang('SearchFeatureDoIndexDocument'));
2262
-                $form->addElement ('select_language', 'language', get_lang('SearchFeatureDocumentLanguage'));
2261
+                $form->addElement('checkbox', 'index_document', '', get_lang('SearchFeatureDoIndexDocument'));
2262
+                $form->addElement('select_language', 'language', get_lang('SearchFeatureDocumentLanguage'));
2263 2263
 
2264 2264
                 $specific_fields = get_specific_field_list();
2265 2265
 
2266 2266
                 foreach ($specific_fields as $specific_field) {
2267
-                    $form->addElement ('text', $specific_field['code'], $specific_field['name']);
2267
+                    $form->addElement('text', $specific_field['code'], $specific_field['name']);
2268 2268
                     $filter = array(
2269 2269
                         'c_id' => api_get_course_int_id(),
2270 2270
                         'field_id' => $specific_field['id'],
2271 2271
                         'ref_id' => $this->id,
2272
-                        'tool_id' => "'" . TOOL_QUIZ . "'"
2272
+                        'tool_id' => "'".TOOL_QUIZ."'"
2273 2273
                     );
2274 2274
                     $values = get_specific_field_values_list($filter, array('value'));
2275
-                    if ( !empty($values) ) {
2275
+                    if (!empty($values)) {
2276 2276
                         $arr_str_values = array();
2277 2277
                         foreach ($values as $value) {
2278 2278
                             $arr_str_values[] = $value['value'];
@@ -2283,8 +2283,8 @@  discard block
 block discarded – undo
2283 2283
                 //$form->addElement ('html','</div>');
2284 2284
             }
2285 2285
 
2286
-            $form->addElement('html','</div>');  //End advanced setting
2287
-            $form->addElement('html','</div>');
2286
+            $form->addElement('html', '</div>'); //End advanced setting
2287
+            $form->addElement('html', '</div>');
2288 2288
         }
2289 2289
 
2290 2290
         // submit
@@ -2304,10 +2304,10 @@  discard block
 block discarded – undo
2304 2304
         }
2305 2305
 
2306 2306
         // defaults
2307
-        if ($type=='full') {
2307
+        if ($type == 'full') {
2308 2308
             if ($this->id > 0) {
2309 2309
                 if ($this->random > $this->selectNbrQuestions()) {
2310
-                    $defaults['randomQuestions'] =  $this->selectNbrQuestions();
2310
+                    $defaults['randomQuestions'] = $this->selectNbrQuestions();
2311 2311
                 } else {
2312 2312
                     $defaults['randomQuestions'] = $this->random;
2313 2313
                 }
@@ -2334,8 +2334,8 @@  discard block
 block discarded – undo
2334 2334
                     $defaults['activate_end_date_check'] = 1;
2335 2335
                 }
2336 2336
 
2337
-                $defaults['start_time'] = ($this->start_time!='0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00');
2338
-                $defaults['end_time'] = ($this->end_time!='0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time()+84600);
2337
+                $defaults['start_time'] = ($this->start_time != '0000-00-00 00:00:00') ? api_get_local_time($this->start_time) : date('Y-m-d 12:00:00');
2338
+                $defaults['end_time'] = ($this->end_time != '0000-00-00 00:00:00') ? api_get_local_time($this->end_time) : date('Y-m-d 12:00:00', time() + 84600);
2339 2339
 
2340 2340
                 // Get expired time
2341 2341
                 if ($this->expired_time != '0') {
@@ -2356,7 +2356,7 @@  discard block
 block discarded – undo
2356 2356
                 $defaults['text_when_finished'] = "";
2357 2357
                 $defaults['start_time'] = date('Y-m-d 12:00:00');
2358 2358
                 $defaults['display_category_name'] = 1;
2359
-                $defaults['end_time']   = date('Y-m-d 12:00:00', time()+84600);
2359
+                $defaults['end_time']   = date('Y-m-d 12:00:00', time() + 84600);
2360 2360
                 $defaults['pass_percentage'] = '';
2361 2361
                 $defaults['end_button'] = $this->selectEndButton();
2362 2362
                 $defaults['question_selection_type'] = 1;
@@ -2442,7 +2442,7 @@  discard block
 block discarded – undo
2442 2442
             $end_time = $form->getSubmitValue('end_time');
2443 2443
             $this->end_time = api_get_utc_datetime($end_time);
2444 2444
         } else {
2445
-            $this->end_time   = '0000-00-00 00:00:00';
2445
+            $this->end_time = '0000-00-00 00:00:00';
2446 2446
         }
2447 2447
 
2448 2448
         if ($form->getSubmitValue('enabletimercontrol') == 1) {
@@ -2455,9 +2455,9 @@  discard block
 block discarded – undo
2455 2455
         }
2456 2456
 
2457 2457
         if ($form->getSubmitValue('randomAnswers') == 1) {
2458
-            $this->random_answers=1;
2458
+            $this->random_answers = 1;
2459 2459
         } else {
2460
-            $this->random_answers=0;
2460
+            $this->random_answers = 0;
2461 2461
         }
2462 2462
         $this->save($type);
2463 2463
     }
@@ -2469,9 +2469,9 @@  discard block
 block discarded – undo
2469 2469
         }
2470 2470
         $course_id = api_get_course_id();
2471 2471
 
2472
-        require_once api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php';
2473
-        require_once api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php';
2474
-        require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
2472
+        require_once api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php';
2473
+        require_once api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php';
2474
+        require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
2475 2475
 
2476 2476
         $specific_fields = get_specific_field_list();
2477 2477
         $ic_slide = new IndexableChunk();
@@ -2481,7 +2481,7 @@  discard block
 block discarded – undo
2481 2481
             if (isset($_REQUEST[$specific_field['code']])) {
2482 2482
                 $sterms = trim($_REQUEST[$specific_field['code']]);
2483 2483
                 if (!empty($sterms)) {
2484
-                    $all_specific_terms .= ' '. $sterms;
2484
+                    $all_specific_terms .= ' '.$sterms;
2485 2485
                     $sterms = explode(',', $sterms);
2486 2486
                     foreach ($sterms as $sterm) {
2487 2487
                         $ic_slide->addTerm(trim($sterm), $specific_field['code']);
@@ -2498,15 +2498,15 @@  discard block
 block discarded – undo
2498 2498
         $xapian_data = array(
2499 2499
             SE_COURSE_ID => $course_id,
2500 2500
             SE_TOOL_ID => TOOL_QUIZ,
2501
-            SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id),
2502
-            SE_USER => (int)api_get_user_id(),
2501
+            SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id),
2502
+            SE_USER => (int) api_get_user_id(),
2503 2503
         );
2504 2504
         $ic_slide->xapian_data = serialize($xapian_data);
2505
-        $exercise_description = $all_specific_terms .' '. $this->description;
2505
+        $exercise_description = $all_specific_terms.' '.$this->description;
2506 2506
         $ic_slide->addValue("content", $exercise_description);
2507 2507
 
2508 2508
         $di = new ChamiloIndexer();
2509
-        isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english';
2509
+        isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english';
2510 2510
         $di->connectDb(NULL, NULL, $lang);
2511 2511
         $di->addChunk($ic_slide);
2512 2512
 
@@ -2525,7 +2525,7 @@  discard block
 block discarded – undo
2525 2525
     function search_engine_edit()
2526 2526
     {
2527 2527
         // update search enchine and its values table if enabled
2528
-        if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
2528
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
2529 2529
             $course_id = api_get_course_id();
2530 2530
 
2531 2531
             // actually, it consists on delete terms from db,
@@ -2537,9 +2537,9 @@  discard block
 block discarded – undo
2537 2537
             $res = Database::query($sql);
2538 2538
 
2539 2539
             if (Database::num_rows($res) > 0) {
2540
-                require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php');
2541
-                require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php');
2542
-                require_once(api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php');
2540
+                require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
2541
+                require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php');
2542
+                require_once(api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php');
2543 2543
 
2544 2544
                 $se_ref = Database::fetch_array($res);
2545 2545
                 $specific_fields = get_specific_field_list();
@@ -2550,7 +2550,7 @@  discard block
 block discarded – undo
2550 2550
                     delete_all_specific_field_value($course_id, $specific_field['id'], TOOL_QUIZ, $this->id);
2551 2551
                     if (isset($_REQUEST[$specific_field['code']])) {
2552 2552
                         $sterms = trim($_REQUEST[$specific_field['code']]);
2553
-                        $all_specific_terms .= ' '. $sterms;
2553
+                        $all_specific_terms .= ' '.$sterms;
2554 2554
                         $sterms = explode(',', $sterms);
2555 2555
                         foreach ($sterms as $sterm) {
2556 2556
                             $ic_slide->addTerm(trim($sterm), $specific_field['code']);
@@ -2566,17 +2566,17 @@  discard block
 block discarded – undo
2566 2566
                 $xapian_data = array(
2567 2567
                     SE_COURSE_ID => $course_id,
2568 2568
                     SE_TOOL_ID => TOOL_QUIZ,
2569
-                    SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int)$this->id),
2570
-                    SE_USER => (int)api_get_user_id(),
2569
+                    SE_DATA => array('type' => SE_DOCTYPE_EXERCISE_EXERCISE, 'exercise_id' => (int) $this->id),
2570
+                    SE_USER => (int) api_get_user_id(),
2571 2571
                 );
2572 2572
                 $ic_slide->xapian_data = serialize($xapian_data);
2573
-                $exercise_description = $all_specific_terms .' '. $this->description;
2573
+                $exercise_description = $all_specific_terms.' '.$this->description;
2574 2574
                 $ic_slide->addValue("content", $exercise_description);
2575 2575
 
2576 2576
                 $di = new ChamiloIndexer();
2577
-                isset($_POST['language'])? $lang=Database::escape_string($_POST['language']): $lang = 'english';
2577
+                isset($_POST['language']) ? $lang = Database::escape_string($_POST['language']) : $lang = 'english';
2578 2578
                 $di->connectDb(NULL, NULL, $lang);
2579
-                $di->remove_document((int)$se_ref['search_did']);
2579
+                $di->remove_document((int) $se_ref['search_did']);
2580 2580
                 $di->addChunk($ic_slide);
2581 2581
 
2582 2582
                 //index and return search engine document id
@@ -2601,7 +2601,7 @@  discard block
 block discarded – undo
2601 2601
     function search_engine_delete()
2602 2602
     {
2603 2603
         // remove from search engine if enabled
2604
-        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian') ) {
2604
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
2605 2605
             $course_id = api_get_course_id();
2606 2606
             $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
2607 2607
             $sql = 'SELECT * FROM %s WHERE course_code=\'%s\' AND tool_id=\'%s\' AND ref_id_high_level=%s AND ref_id_second_level IS NULL LIMIT 1';
@@ -2609,19 +2609,19 @@  discard block
 block discarded – undo
2609 2609
             $res = Database::query($sql);
2610 2610
             if (Database::num_rows($res) > 0) {
2611 2611
                 $row = Database::fetch_array($res);
2612
-                require_once(api_get_path(LIBRARY_PATH) .'search/ChamiloIndexer.class.php');
2612
+                require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
2613 2613
                 $di = new ChamiloIndexer();
2614
-                $di->remove_document((int)$row['search_did']);
2614
+                $di->remove_document((int) $row['search_did']);
2615 2615
                 unset($di);
2616 2616
                 $tbl_quiz_question = Database::get_course_table(TABLE_QUIZ_QUESTION);
2617
-                foreach ( $this->questionList as $question_i) {
2617
+                foreach ($this->questionList as $question_i) {
2618 2618
                     $sql = 'SELECT type FROM %s WHERE id=%s';
2619 2619
                     $sql = sprintf($sql, $tbl_quiz_question, $question_i);
2620 2620
                     $qres = Database::query($sql);
2621 2621
                     if (Database::num_rows($qres) > 0) {
2622 2622
                         $qrow = Database::fetch_array($qres);
2623 2623
                         $objQuestion = Question::getInstance($qrow['type']);
2624
-                        $objQuestion = Question::read((int)$question_i);
2624
+                        $objQuestion = Question::read((int) $question_i);
2625 2625
                         $objQuestion->search_engine_edit($this->id, FALSE, TRUE);
2626 2626
                         unset($objQuestion);
2627 2627
                     }
@@ -2632,7 +2632,7 @@  discard block
 block discarded – undo
2632 2632
             Database::query($sql);
2633 2633
 
2634 2634
             // remove terms from db
2635
-            require_once api_get_path(LIBRARY_PATH) .'specific_fields_manager.lib.php';
2635
+            require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
2636 2636
             delete_all_values_for_item($course_id, TOOL_QUIZ, $this->id);
2637 2637
         }
2638 2638
     }
@@ -2727,7 +2727,7 @@  discard block
 block discarded – undo
2727 2727
      */
2728 2728
     public function copy_exercise()
2729 2729
     {
2730
-        $exercise_obj= new Exercise();
2730
+        $exercise_obj = new Exercise();
2731 2731
         $exercise_obj = $this;
2732 2732
 
2733 2733
         // force the creation of a new exercise
@@ -2799,25 +2799,25 @@  discard block
 block discarded – undo
2799 2799
             $lp_id = 0;
2800 2800
         }
2801 2801
         if (empty($lp_item_id)) {
2802
-            $lp_item_id   = 0;
2802
+            $lp_item_id = 0;
2803 2803
         }
2804 2804
         if (empty($lp_item_view_id)) {
2805 2805
             $lp_item_view_id = 0;
2806 2806
         }
2807
-        $condition = ' WHERE exe_exo_id 	= ' . "'" . $this->id . "'" .' AND
2808
-					   exe_user_id 			= ' . "'" . api_get_user_id() . "'" . ' AND
2809
-					   c_id                 = ' . api_get_course_int_id() . ' AND
2810
-					   status 				= ' . "'" . Database::escape_string($status). "'" . ' AND
2811
-					   orig_lp_id 			= ' . "'" . $lp_id . "'" . ' AND
2812
-					   orig_lp_item_id 		= ' . "'" . $lp_item_id . "'" . ' AND
2813
-                       orig_lp_item_view_id = ' . "'" . $lp_item_view_id . "'" . ' AND
2814
-					   session_id 			= ' . "'" . api_get_session_id() . "' LIMIT 1"; //Adding limit 1 just in case
2807
+        $condition = ' WHERE exe_exo_id 	= '."'".$this->id."'".' AND
2808
+					   exe_user_id 			= ' . "'".api_get_user_id()."'".' AND
2809
+					   c_id                 = ' . api_get_course_int_id().' AND
2810
+					   status 				= ' . "'".Database::escape_string($status)."'".' AND
2811
+					   orig_lp_id 			= ' . "'".$lp_id."'".' AND
2812
+					   orig_lp_item_id 		= ' . "'".$lp_item_id."'".' AND
2813
+                       orig_lp_item_view_id = ' . "'".$lp_item_view_id."'".' AND
2814
+					   session_id 			= ' . "'".api_get_session_id()."' LIMIT 1"; //Adding limit 1 just in case
2815 2815
 
2816 2816
         $sql_track = 'SELECT * FROM '.$track_exercises.$condition;
2817 2817
 
2818 2818
         $result = Database::query($sql_track);
2819 2819
         $new_array = array();
2820
-        if (Database::num_rows($result) > 0 ) {
2820
+        if (Database::num_rows($result) > 0) {
2821 2821
             $new_array = Database::fetch_array($result, 'ASSOC');
2822 2822
             $new_array['num_exe'] = Database::num_rows($result);
2823 2823
         }
@@ -2860,12 +2860,12 @@  discard block
 block discarded – undo
2860 2860
         $questionList = array_map('intval', $questionList);
2861 2861
 
2862 2862
         $params = array(
2863
-            'exe_exo_id' => $this->id ,
2863
+            'exe_exo_id' => $this->id,
2864 2864
             'exe_user_id' => api_get_user_id(),
2865 2865
             'c_id' => api_get_course_int_id(),
2866 2866
             'status' =>  'incomplete',
2867 2867
             'session_id'  => api_get_session_id(),
2868
-            'data_tracking'  => implode(',', $questionList) ,
2868
+            'data_tracking'  => implode(',', $questionList),
2869 2869
             'start_date' => api_get_utc_datetime(),
2870 2870
             'orig_lp_id' => $safe_lp_id,
2871 2871
             'orig_lp_item_id'  => $safe_lp_item_id,
@@ -2897,7 +2897,7 @@  discard block
 block discarded – undo
2897 2897
         $nbrQuestions = $this->get_count_question_list();
2898 2898
 
2899 2899
         $all_button = $html = $label = '';
2900
-        $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']):null;
2900
+        $hotspot_get = isset($_POST['hotspot']) ? Security::remove_XSS($_POST['hotspot']) : null;
2901 2901
 
2902 2902
         if ($this->selectFeedbackType() == EXERCISE_FEEDBACK_TYPE_DIRECT && $this->type == ONE_PER_PAGE) {
2903 2903
             $urlTitle = get_lang('ContinueTest');
@@ -2908,7 +2908,7 @@  discard block
 block discarded – undo
2908 2908
 
2909 2909
             $html .= Display::url(
2910 2910
                 $urlTitle,
2911
-                'exercise_submit_modal.php?' . http_build_query([
2911
+                'exercise_submit_modal.php?'.http_build_query([
2912 2912
                     'learnpath_id' => $safe_lp_id,
2913 2913
                     'learnpath_item_id' => $safe_lp_item_id,
2914 2914
                     'learnpath_item_view_id' => $safe_lp_item_view_id,
@@ -2925,7 +2925,7 @@  discard block
 block discarded – undo
2925 2925
                     'data-size' => 'md'
2926 2926
                 ]
2927 2927
             );
2928
-            $html .='<br />';
2928
+            $html .= '<br />';
2929 2929
         } else {
2930 2930
             // User
2931 2931
             if (api_is_allowed_to_session_edit()) {
@@ -2950,7 +2950,7 @@  discard block
 block discarded – undo
2950 2950
 
2951 2951
                     //Next question
2952 2952
                     if (!empty($questions_in_media)) {
2953
-                        $questions_in_media = "['".implode("','",$questions_in_media)."']";
2953
+                        $questions_in_media = "['".implode("','", $questions_in_media)."']";
2954 2954
                         $all_button .= '&nbsp;<a href="javascript://" class="'.$class.'" onclick="save_question_list('.$questions_in_media.'); ">'.$label.'</a>';
2955 2955
                     } else {
2956 2956
                         $all_button .= '&nbsp;<a href="javascript://" class="'.$class.'" onclick="save_now('.$question_id.', \'\', \''.$currentAnswer.'\'); ">'.$label.'</a>';
@@ -2968,7 +2968,7 @@  discard block
 block discarded – undo
2968 2968
                     }
2969 2969
 					$class .= ' question-validate-btn'; // used to select it with jquery
2970 2970
                     $all_button = '&nbsp;<a href="javascript://" class="'.$class.'" onclick="validate_all(); ">'.$all_label.'</a>';
2971
-                    $all_button .= '&nbsp;' . Display::span(null, ['id' => 'save_all_reponse']);
2971
+                    $all_button .= '&nbsp;'.Display::span(null, ['id' => 'save_all_reponse']);
2972 2972
                     $html .= $all_button;
2973 2973
                 }
2974 2974
             }
@@ -3210,8 +3210,8 @@  discard block
 block discarded – undo
3210 3210
             $params = array();
3211 3211
             $params['course_id'] = $course_id;
3212 3212
             $params['session_id'] = api_get_session_id();
3213
-            $params['user_id'] = isset($exe_info['exe_user_id'])? $exe_info['exe_user_id'] : api_get_user_id();
3214
-            $params['exercise_id'] = isset($exe_info['exe_exo_id'])? $exe_info['exe_exo_id'] : $this->id;
3213
+            $params['user_id'] = isset($exe_info['exe_user_id']) ? $exe_info['exe_user_id'] : api_get_user_id();
3214
+            $params['exercise_id'] = isset($exe_info['exe_exo_id']) ? $exe_info['exe_exo_id'] : $this->id;
3215 3215
             $params['question_id'] = $questionId;
3216 3216
             $params['exe_id'] = isset($exe_info['exe_id']) ? $exe_info['exe_id'] : $exeId;
3217 3217
 
@@ -3267,10 +3267,10 @@  discard block
 block discarded – undo
3267 3267
             $answer = $objAnswerTmp->selectAnswer($answerId);
3268 3268
             $answerComment = $objAnswerTmp->selectComment($answerId);
3269 3269
             $answerCorrect = $objAnswerTmp->isCorrect($answerId);
3270
-            $answerWeighting = (float)$objAnswerTmp->selectWeighting($answerId);
3270
+            $answerWeighting = (float) $objAnswerTmp->selectWeighting($answerId);
3271 3271
             $answerAutoId = $objAnswerTmp->selectAutoId($answerId);
3272 3272
 
3273
-            $answer_correct_array[$answerId] = (bool)$answerCorrect;
3273
+            $answer_correct_array[$answerId] = (bool) $answerCorrect;
3274 3274
 
3275 3275
             if ($debug) {
3276 3276
                 error_log("answer auto id: $answerAutoId ");
@@ -3279,7 +3279,7 @@  discard block
 block discarded – undo
3279 3279
 
3280 3280
             // Delineation
3281 3281
             $delineation_cord = $objAnswerTmp->selectHotspotCoordinates(1);
3282
-            $answer_delineation_destination=$objAnswerTmp->selectDestination(1);
3282
+            $answer_delineation_destination = $objAnswerTmp->selectDestination(1);
3283 3283
 
3284 3284
             switch ($answerType) {
3285 3285
                 // for unique answer
@@ -3292,7 +3292,7 @@  discard block
 block discarded – undo
3292 3292
                                     exe_id = '".$exeId."' AND
3293 3293
                                     question_id= '".$questionId."'";
3294 3294
                         $result = Database::query($sql);
3295
-                        $choice = Database::result($result,0,"answer");
3295
+                        $choice = Database::result($result, 0, "answer");
3296 3296
 
3297 3297
                         $studentChoice = $choice == $answerAutoId ? 1 : 0;
3298 3298
                         if ($studentChoice) {
@@ -3343,7 +3343,7 @@  discard block
 block discarded – undo
3343 3343
                     } else {
3344 3344
                         // If no result then the user just hit don't know
3345 3345
                         $studentChoice = 3;
3346
-                        $questionScore  +=  $doubt_score;
3346
+                        $questionScore += $doubt_score;
3347 3347
                     }
3348 3348
                     $totalScore = $questionScore;
3349 3349
                     break;
@@ -3359,17 +3359,17 @@  discard block
 block discarded – undo
3359 3359
                         }
3360 3360
 
3361 3361
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3362
-                        $real_answers[$answerId] = (bool)$studentChoice;
3362
+                        $real_answers[$answerId] = (bool) $studentChoice;
3363 3363
 
3364 3364
                         if ($studentChoice) {
3365
-                            $questionScore  +=$answerWeighting;
3365
+                            $questionScore += $answerWeighting;
3366 3366
                         }
3367 3367
                     } else {
3368 3368
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3369
-                        $real_answers[$answerId] = (bool)$studentChoice;
3369
+                        $real_answers[$answerId] = (bool) $studentChoice;
3370 3370
 
3371 3371
                         if (isset($studentChoice)) {
3372
-                            $questionScore  += $answerWeighting;
3372
+                            $questionScore += $answerWeighting;
3373 3373
                         }
3374 3374
                     }
3375 3375
                     $totalScore += $answerWeighting;
@@ -3387,16 +3387,16 @@  discard block
 block discarded – undo
3387 3387
                             $choice[$ind] = 1;
3388 3388
                         }
3389 3389
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3390
-                        $real_answers[$answerId] = (bool)$studentChoice;
3390
+                        $real_answers[$answerId] = (bool) $studentChoice;
3391 3391
                         if ($studentChoice) {
3392
-                            $questionScore +=$answerWeighting;
3392
+                            $questionScore += $answerWeighting;
3393 3393
                         }
3394 3394
                     } else {
3395 3395
                         $studentChoice = isset($choice[$answerAutoId]) ? $choice[$answerAutoId] : null;
3396 3396
                         if (isset($studentChoice)) {
3397 3397
                             $questionScore += $answerWeighting;
3398 3398
                         }
3399
-                        $real_answers[$answerId] = (bool)$studentChoice;
3399
+                        $real_answers[$answerId] = (bool) $studentChoice;
3400 3400
                     }
3401 3401
                     $totalScore += $answerWeighting;
3402 3402
                     if ($debug) error_log("studentChoice: $studentChoice");
@@ -3408,7 +3408,7 @@  discard block
 block discarded – undo
3408 3408
                         $resultans = Database::query($sql);
3409 3409
                         while ($row = Database::fetch_array($resultans)) {
3410 3410
                             $ind = $row['answer'];
3411
-                            $result = explode(':',$ind);
3411
+                            $result = explode(':', $ind);
3412 3412
                             if (isset($result[0])) {
3413 3413
                                 $my_answer_id = isset($result[0]) ? $result[0] : '';
3414 3414
                                 $option = isset($result[1]) ? $result[1] : '';
@@ -3529,10 +3529,10 @@  discard block
 block discarded – undo
3529 3529
                             }
3530 3530
                             // adds the piece of text that is before the blank
3531 3531
                             //and ends with '[' into a general storage array
3532
-                            $real_text[] = api_substr($temp, 0, $pos +1);
3533
-                            $answer .= api_substr($temp, 0, $pos +1);
3532
+                            $real_text[] = api_substr($temp, 0, $pos + 1);
3533
+                            $answer .= api_substr($temp, 0, $pos + 1);
3534 3534
                             //take the string remaining (after the last "[" we found)
3535
-                            $temp = api_substr($temp, $pos +1);
3535
+                            $temp = api_substr($temp, $pos + 1);
3536 3536
                             // quit the loop if there are no more blanks, and update $pos to the position of next ']'
3537 3537
                             if (($pos = api_strpos($temp, ']')) === false) {
3538 3538
                                 // adds the end of the text
@@ -3568,7 +3568,7 @@  discard block
 block discarded – undo
3568 3568
                             //put the contents of the [] answer tag into correct_tags[]
3569 3569
                             $correct_tags[] = api_substr($temp, 0, $pos);
3570 3570
                             $j++;
3571
-                            $temp = api_substr($temp, $pos +1);
3571
+                            $temp = api_substr($temp, $pos + 1);
3572 3572
                         }
3573 3573
                         $answer = '';
3574 3574
                         $real_correct_tags = $correct_tags;
@@ -3591,7 +3591,7 @@  discard block
 block discarded – undo
3591 3591
                                 } elseif (!empty($user_tags[$i])) {
3592 3592
                                     // else if the word entered by the student IS NOT the same as the one defined by the professor
3593 3593
                                     // adds the word in red at the end of the string, and strikes it
3594
-                                    $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>';
3594
+                                    $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>';
3595 3595
                                 } else {
3596 3596
                                     // adds a tabulation if no word has been typed by the student
3597 3597
                                     $answer .= ''; // remove &nbsp; that causes issue
@@ -3610,17 +3610,17 @@  discard block
 block discarded – undo
3610 3610
                                 } elseif (!empty ($user_tags[$i])) {
3611 3611
                                     // else if the word entered by the student IS NOT the same as the one defined by the professor
3612 3612
                                     // adds the word in red at the end of the string, and strikes it
3613
-                                    $answer .= '<font color="red"><s>' . $user_tags[$i] . '</s></font>';
3613
+                                    $answer .= '<font color="red"><s>'.$user_tags[$i].'</s></font>';
3614 3614
                                 } else {
3615 3615
                                     // adds a tabulation if no word has been typed by the student
3616
-                                    $answer .= '';  // remove &nbsp; that causes issue
3616
+                                    $answer .= ''; // remove &nbsp; that causes issue
3617 3617
                                 }
3618 3618
                             }
3619 3619
 
3620 3620
                             // adds the correct word, followed by ] to close the blank
3621
-                            $answer .= ' / <font color="green"><b>' . $real_correct_tags[$i] . '</b></font>]';
3622
-                            if (isset($real_text[$i +1])) {
3623
-                                $answer .= $real_text[$i +1];
3621
+                            $answer .= ' / <font color="green"><b>'.$real_correct_tags[$i].'</b></font>]';
3622
+                            if (isset($real_text[$i + 1])) {
3623
+                                $answer .= $real_text[$i + 1];
3624 3624
                             }
3625 3625
                         }
3626 3626
                     } else {
@@ -3754,10 +3754,10 @@  discard block
 block discarded – undo
3754 3754
                         }
3755 3755
                         // adds the piece of text that is before the blank
3756 3756
                         //and ends with '[' into a general storage array
3757
-                        $realText[] = api_substr($temp, 0, $pos +1);
3758
-                        $answer .= api_substr($temp, 0, $pos +1);
3757
+                        $realText[] = api_substr($temp, 0, $pos + 1);
3758
+                        $answer .= api_substr($temp, 0, $pos + 1);
3759 3759
                         //take the string remaining (after the last "[" we found)
3760
-                        $temp = api_substr($temp, $pos +1);
3760
+                        $temp = api_substr($temp, $pos + 1);
3761 3761
                         // quit the loop if there are no more blanks, and update $pos to the position of next ']'
3762 3762
                         if (($pos = api_strpos($temp, ']')) === false) {
3763 3763
                             // adds the end of the text
@@ -3791,7 +3791,7 @@  discard block
 block discarded – undo
3791 3791
                         //put the contents of the [] answer tag into correct_tags[]
3792 3792
                         $correctTags[] = api_substr($temp, 0, $pos);
3793 3793
                         $j++;
3794
-                        $temp = api_substr($temp, $pos +1);
3794
+                        $temp = api_substr($temp, $pos + 1);
3795 3795
                     }
3796 3796
                     $answer = '';
3797 3797
                     $realCorrectTags = $correctTags;
@@ -3811,22 +3811,22 @@  discard block
 block discarded – undo
3811 3811
                         } elseif (!empty($userTags[$i])) {
3812 3812
                             // else if the word entered by the student IS NOT the same as the one defined by the professor
3813 3813
                             // adds the word in red at the end of the string, and strikes it
3814
-                            $answer .= '<font color="red"><s>' . $userTags[$i] . '</s></font>';
3814
+                            $answer .= '<font color="red"><s>'.$userTags[$i].'</s></font>';
3815 3815
                         } else {
3816 3816
                             // adds a tabulation if no word has been typed by the student
3817 3817
                             $answer .= ''; // remove &nbsp; that causes issue
3818 3818
                         }
3819 3819
                         // adds the correct word, followed by ] to close the blank
3820
-                        $answer .= ' / <font color="green"><b>' . $realCorrectTags[$i] . '</b></font>]';
3821
-                        if (isset($realText[$i +1])) {
3822
-                            $answer .= $realText[$i +1];
3820
+                        $answer .= ' / <font color="green"><b>'.$realCorrectTags[$i].'</b></font>]';
3821
+                        if (isset($realText[$i + 1])) {
3822
+                            $answer .= $realText[$i + 1];
3823 3823
                         }
3824 3824
                     }
3825 3825
                     break;
3826 3826
                 // for free answer
3827 3827
                 case FREE_ANSWER:
3828 3828
                     if ($from_database) {
3829
-                        $query  = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT."
3829
+                        $query = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT."
3830 3830
                                    WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'";
3831 3831
                         $resq = Database::query($query);
3832 3832
                         $data = Database::fetch_array($resq);
@@ -3837,9 +3837,9 @@  discard block
 block discarded – undo
3837 3837
                         $questionScore = $data['marks'];
3838 3838
 
3839 3839
                         if ($questionScore == -1) {
3840
-                            $totalScore+= 0;
3840
+                            $totalScore += 0;
3841 3841
                         } else {
3842
-                            $totalScore+= $questionScore;
3842
+                            $totalScore += $questionScore;
3843 3843
                         }
3844 3844
                         if ($questionScore == '') {
3845 3845
                             $questionScore = 0;
@@ -3860,14 +3860,14 @@  discard block
 block discarded – undo
3860 3860
                         $query  = "SELECT answer, marks FROM ".$TBL_TRACK_ATTEMPT."
3861 3861
                                    WHERE exe_id = '".$exeId."' AND question_id= '".$questionId."'";
3862 3862
                         $resq   = Database::query($query);
3863
-                        $choice = Database::result($resq,0,'answer');
3863
+                        $choice = Database::result($resq, 0, 'answer');
3864 3864
                         $choice = str_replace('\r\n', '', $choice);
3865 3865
                         $choice = stripslashes($choice);
3866
-                        $questionScore = Database::result($resq,0,"marks");
3867
-                        if ($questionScore==-1) {
3868
-                            $totalScore+=0;
3866
+                        $questionScore = Database::result($resq, 0, "marks");
3867
+                        if ($questionScore == -1) {
3868
+                            $totalScore += 0;
3869 3869
                         } else {
3870
-                            $totalScore+=$questionScore;
3870
+                            $totalScore += $questionScore;
3871 3871
                         }
3872 3872
                         $arrques = $questionName;
3873 3873
                         $arrans  = $choice;
@@ -3912,7 +3912,7 @@  discard block
 block discarded – undo
3912 3912
 
3913 3913
                         while ($a_answers = Database::fetch_array($res_answers)) {
3914 3914
                             $i_answer_id = $a_answers['id']; //3
3915
-                            $s_answer_label = $a_answers['answer'];  // your daddy - your mother
3915
+                            $s_answer_label = $a_answers['answer']; // your daddy - your mother
3916 3916
                             $i_answer_correct_answer = $a_answers['correct']; //1 - 2
3917 3917
                             $i_answer_id_auto = $a_answers['id_auto']; // 3 - 4
3918 3918
 
@@ -3964,8 +3964,8 @@  discard block
 block discarded – undo
3964 3964
 
3965 3965
                             if ($show_result) {
3966 3966
                                 echo '<tr>';
3967
-                                echo '<td>' . $s_answer_label . '</td>';
3968
-                                echo '<td>' . $user_answer;
3967
+                                echo '<td>'.$s_answer_label.'</td>';
3968
+                                echo '<td>'.$user_answer;
3969 3969
 
3970 3970
                                 if (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) {
3971 3971
                                     if (isset($real_list[$i_answer_correct_answer])) {
@@ -4074,7 +4074,7 @@  discard block
 block discarded – undo
4074 4074
                     if ($from_database) {
4075 4075
                         // getting the user answer
4076 4076
                         $TBL_TRACK_HOTSPOT = Database::get_main_table(TABLE_STATISTIC_TRACK_E_HOTSPOT);
4077
-                        $query   = "SELECT hotspot_correct, hotspot_coordinate
4077
+                        $query = "SELECT hotspot_correct, hotspot_coordinate
4078 4078
                                     FROM $TBL_TRACK_HOTSPOT
4079 4079
                                     WHERE
4080 4080
                                         hotspot_exe_id = '".$exeId."' AND
@@ -4082,20 +4082,20 @@  discard block
 block discarded – undo
4082 4082
                                         hotspot_answer_id='1'";
4083 4083
                         //by default we take 1 because it's a delineation
4084 4084
                         $resq = Database::query($query);
4085
-                        $row = Database::fetch_array($resq,'ASSOC');
4085
+                        $row = Database::fetch_array($resq, 'ASSOC');
4086 4086
 
4087 4087
                         $choice = $row['hotspot_correct'];
4088 4088
                         $user_answer = $row['hotspot_coordinate'];
4089 4089
 
4090 4090
                         // THIS is very important otherwise the poly_compile will throw an error!!
4091 4091
                         // round-up the coordinates
4092
-                        $coords = explode('/',$user_answer);
4092
+                        $coords = explode('/', $user_answer);
4093 4093
                         $user_array = '';
4094 4094
                         foreach ($coords as $coord) {
4095
-                            list($x,$y) = explode(';',$coord);
4095
+                            list($x, $y) = explode(';', $coord);
4096 4096
                             $user_array .= round($x).';'.round($y).'/';
4097 4097
                         }
4098
-                        $user_array = substr($user_array,0,-1);
4098
+                        $user_array = substr($user_array, 0, -1);
4099 4099
                     } else {
4100 4100
                         if (!empty($studentChoice)) {
4101 4101
                             $newquestionList[] = $questionId;
@@ -4105,13 +4105,13 @@  discard block
 block discarded – undo
4105 4105
                             $studentChoice = $choice[$answerId];
4106 4106
                             $questionScore += $answerWeighting;
4107 4107
 
4108
-                            if ($hotspot_delineation_result[1]==1) {
4108
+                            if ($hotspot_delineation_result[1] == 1) {
4109 4109
                                 $totalScore += $answerWeighting; //adding the total
4110 4110
                             }
4111 4111
                         }
4112 4112
                     }
4113
-                    $_SESSION['hotspot_coord'][1]	= $delineation_cord;
4114
-                    $_SESSION['hotspot_dest'][1]	= $answer_delineation_destination;
4113
+                    $_SESSION['hotspot_coord'][1] = $delineation_cord;
4114
+                    $_SESSION['hotspot_dest'][1] = $answer_delineation_destination;
4115 4115
                     break;
4116 4116
             } // end switch Answertype
4117 4117
 
@@ -4169,7 +4169,7 @@  discard block
 block discarded – undo
4169 4169
                                 $results_disabled
4170 4170
                             );
4171 4171
                             //}
4172
-                        } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE ) {
4172
+                        } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
4173 4173
                             //	if ($origin!='learnpath') {
4174 4174
                             ExerciseShowFunctions::display_multiple_answer_combination_true_false(
4175 4175
                                 $feedback_type,
@@ -4186,11 +4186,11 @@  discard block
 block discarded – undo
4186 4186
                             //}
4187 4187
                         } elseif ($answerType == FILL_IN_BLANKS) {
4188 4188
                             //if ($origin!='learnpath') {
4189
-                            ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer,0,0, $results_disabled);
4189
+                            ExerciseShowFunctions::display_fill_in_blanks_answer($feedback_type, $answer, 0, 0, $results_disabled);
4190 4190
                             //	}
4191 4191
                         } elseif ($answerType == CALCULATED_ANSWER) {
4192 4192
                             //if ($origin!='learnpath') {
4193
-                            ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer,0,0);
4193
+                            ExerciseShowFunctions::display_calculated_answer($feedback_type, $answer, 0, 0);
4194 4194
                             //  }
4195 4195
                         } elseif ($answerType == FREE_ANSWER) {
4196 4196
                             //if($origin != 'learnpath') {
@@ -4244,13 +4244,13 @@  discard block
 block discarded – undo
4244 4244
                             $user_answer = $_SESSION['exerciseResultCoordinates'][$questionId];
4245 4245
 
4246 4246
                             //round-up the coordinates
4247
-                            $coords = explode('/',$user_answer);
4247
+                            $coords = explode('/', $user_answer);
4248 4248
                             $user_array = '';
4249 4249
                             foreach ($coords as $coord) {
4250
-                                list($x,$y) = explode(';',$coord);
4250
+                                list($x, $y) = explode(';', $coord);
4251 4251
                                 $user_array .= round($x).';'.round($y).'/';
4252 4252
                             }
4253
-                            $user_array = substr($user_array,0,-1);
4253
+                            $user_array = substr($user_array, 0, -1);
4254 4254
 
4255 4255
                             if ($next) {
4256 4256
 
@@ -4277,7 +4277,7 @@  discard block
 block discarded – undo
4277 4277
                                 //$overlap = round(polygons_overlap($poly_answer,$poly_user));
4278 4278
                                 // //this is an area in pixels
4279 4279
                                 if ($debug > 0) {
4280
-                                    error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0);
4280
+                                    error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0);
4281 4281
                                 }
4282 4282
 
4283 4283
                                 if ($overlap < 1) {
@@ -4290,43 +4290,43 @@  discard block
 block discarded – undo
4290 4290
                                     // that is overlapped by the user's polygon
4291 4291
                                     $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100);
4292 4292
                                     if ($debug > 1) {
4293
-                                        error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0);
4293
+                                        error_log(__LINE__.' - Final overlap is '.$final_overlap, 0);
4294 4294
                                     }
4295 4295
                                     // the final missing area is the percentage of the initial polygon
4296 4296
                                     // that is not overlapped by the user's polygon
4297 4297
                                     $final_missing = 100 - $final_overlap;
4298 4298
                                     if ($debug > 1) {
4299
-                                        error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0);
4299
+                                        error_log(__LINE__.' - Final missing is '.$final_missing, 0);
4300 4300
                                     }
4301 4301
                                     // the final excess area is the percentage of the initial polygon's size
4302 4302
                                     // that is covered by the user's polygon outside of the initial polygon
4303 4303
                                     $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100);
4304 4304
                                     if ($debug > 1) {
4305
-                                        error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0);
4305
+                                        error_log(__LINE__.' - Final excess is '.$final_excess, 0);
4306 4306
                                     }
4307 4307
                                 }
4308 4308
 
4309 4309
                                 //checking the destination parameters parsing the "@@"
4310
-                                $destination_items= explode('@@', $answerDestination);
4310
+                                $destination_items = explode('@@', $answerDestination);
4311 4311
                                 $threadhold_total = $destination_items[0];
4312
-                                $threadhold_items=explode(';',$threadhold_total);
4312
+                                $threadhold_items = explode(';', $threadhold_total);
4313 4313
                                 $threadhold1 = $threadhold_items[0]; // overlap
4314 4314
                                 $threadhold2 = $threadhold_items[1]; // excess
4315
-                                $threadhold3 = $threadhold_items[2];	 //missing
4315
+                                $threadhold3 = $threadhold_items[2]; //missing
4316 4316
 
4317 4317
                                 // if is delineation
4318
-                                if ($answerId===1) {
4318
+                                if ($answerId === 1) {
4319 4319
                                     //setting colors
4320
-                                    if ($final_overlap>=$threadhold1) {
4321
-                                        $overlap_color=true; //echo 'a';
4320
+                                    if ($final_overlap >= $threadhold1) {
4321
+                                        $overlap_color = true; //echo 'a';
4322 4322
                                     }
4323 4323
                                     //echo $excess.'-'.$threadhold2;
4324
-                                    if ($final_excess<=$threadhold2) {
4325
-                                        $excess_color=true; //echo 'b';
4324
+                                    if ($final_excess <= $threadhold2) {
4325
+                                        $excess_color = true; //echo 'b';
4326 4326
                                     }
4327 4327
                                     //echo '--------'.$missing.'-'.$threadhold3;
4328
-                                    if ($final_missing<=$threadhold3) {
4329
-                                        $missing_color=true; //echo 'c';
4328
+                                    if ($final_missing <= $threadhold3) {
4329
+                                        $missing_color = true; //echo 'c';
4330 4330
                                     }
4331 4331
 
4332 4332
                                     // if pass
@@ -4335,67 +4335,67 @@  discard block
 block discarded – undo
4335 4335
                                         $final_missing <= $threadhold3 &&
4336 4336
                                         $final_excess <= $threadhold2
4337 4337
                                     ) {
4338
-                                        $next=1; //go to the oars
4339
-                                        $result_comment=get_lang('Acceptable');
4340
-                                        $final_answer = 1;	// do not update with  update_exercise_attempt
4338
+                                        $next = 1; //go to the oars
4339
+                                        $result_comment = get_lang('Acceptable');
4340
+                                        $final_answer = 1; // do not update with  update_exercise_attempt
4341 4341
                                     } else {
4342
-                                        $next=0;
4343
-                                        $result_comment=get_lang('Unacceptable');
4344
-                                        $comment=$answerDestination=$objAnswerTmp->selectComment(1);
4345
-                                        $answerDestination=$objAnswerTmp->selectDestination(1);
4342
+                                        $next = 0;
4343
+                                        $result_comment = get_lang('Unacceptable');
4344
+                                        $comment = $answerDestination = $objAnswerTmp->selectComment(1);
4345
+                                        $answerDestination = $objAnswerTmp->selectDestination(1);
4346 4346
                                         //checking the destination parameters parsing the "@@"
4347
-                                        $destination_items= explode('@@', $answerDestination);
4347
+                                        $destination_items = explode('@@', $answerDestination);
4348 4348
                                     }
4349
-                                } elseif($answerId>1) {
4349
+                                } elseif ($answerId > 1) {
4350 4350
                                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
4351
-                                        if ($debug>0) {
4352
-                                            error_log(__LINE__.' - answerId is of type noerror',0);
4351
+                                        if ($debug > 0) {
4352
+                                            error_log(__LINE__.' - answerId is of type noerror', 0);
4353 4353
                                         }
4354 4354
                                         //type no error shouldn't be treated
4355 4355
                                         $next = 1;
4356 4356
                                         continue;
4357 4357
                                     }
4358
-                                    if ($debug>0) {
4359
-                                        error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR',0);
4358
+                                    if ($debug > 0) {
4359
+                                        error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0);
4360 4360
                                     }
4361 4361
                                     //check the intersection between the oar and the user
4362 4362
                                     //echo 'user';	print_r($x_user_list);		print_r($y_user_list);
4363 4363
                                     //echo 'official';print_r($x_list);print_r($y_list);
4364 4364
                                     //$result = get_intersection_data($x_list,$y_list,$x_user_list,$y_user_list);
4365
-                                    $inter= $result['success'];
4365
+                                    $inter = $result['success'];
4366 4366
 
4367 4367
                                     //$delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
4368
-                                    $delineation_cord=$objAnswerTmp->selectHotspotCoordinates($answerId);
4368
+                                    $delineation_cord = $objAnswerTmp->selectHotspotCoordinates($answerId);
4369 4369
 
4370
-                                    $poly_answer = convert_coordinates($delineation_cord,'|');
4371
-                                    $max_coord = poly_get_max($poly_user,$poly_answer);
4372
-                                    $poly_answer_compiled = poly_compile($poly_answer,$max_coord);
4373
-                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
4370
+                                    $poly_answer = convert_coordinates($delineation_cord, '|');
4371
+                                    $max_coord = poly_get_max($poly_user, $poly_answer);
4372
+                                    $poly_answer_compiled = poly_compile($poly_answer, $max_coord);
4373
+                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord);
4374 4374
 
4375 4375
                                     if ($overlap == false) {
4376 4376
                                         //all good, no overlap
4377 4377
                                         $next = 1;
4378 4378
                                         continue;
4379 4379
                                     } else {
4380
-                                        if ($debug>0) {
4381
-                                            error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit',0);
4380
+                                        if ($debug > 0) {
4381
+                                            error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0);
4382 4382
                                         }
4383 4383
                                         $organs_at_risk_hit++;
4384 4384
                                         //show the feedback
4385
-                                        $next=0;
4386
-                                        $comment=$answerDestination=$objAnswerTmp->selectComment($answerId);
4387
-                                        $answerDestination=$objAnswerTmp->selectDestination($answerId);
4388
-
4389
-                                        $destination_items= explode('@@', $answerDestination);
4390
-                                        $try_hotspot=$destination_items[1];
4391
-                                        $lp_hotspot=$destination_items[2];
4392
-                                        $select_question_hotspot=$destination_items[3];
4393
-                                        $url_hotspot=$destination_items[4];
4385
+                                        $next = 0;
4386
+                                        $comment = $answerDestination = $objAnswerTmp->selectComment($answerId);
4387
+                                        $answerDestination = $objAnswerTmp->selectDestination($answerId);
4388
+
4389
+                                        $destination_items = explode('@@', $answerDestination);
4390
+                                        $try_hotspot = $destination_items[1];
4391
+                                        $lp_hotspot = $destination_items[2];
4392
+                                        $select_question_hotspot = $destination_items[3];
4393
+                                        $url_hotspot = $destination_items[4];
4394 4394
                                     }
4395 4395
                                 }
4396 4396
                             } else {	// the first delineation feedback
4397
-                                if ($debug>0) {
4398
-                                    error_log(__LINE__.' first',0);
4397
+                                if ($debug > 0) {
4398
+                                    error_log(__LINE__.' first', 0);
4399 4399
                                 }
4400 4400
                             }
4401 4401
                         } elseif (in_array($answerType, [MATCHING, MATCHING_DRAGGABLE])) {
@@ -4403,7 +4403,7 @@  discard block
 block discarded – undo
4403 4403
                             echo Display::tag('td', $answerMatching[$answerId]);
4404 4404
                             echo Display::tag(
4405 4405
                                 'td',
4406
-                                "$user_answer / " . Display::tag(
4406
+                                "$user_answer / ".Display::tag(
4407 4407
                                     'strong',
4408 4408
                                     $answerMatching[$answerCorrect],
4409 4409
                                     ['style' => 'color: #008000; font-weight: bold;']
@@ -4543,7 +4543,7 @@  discard block
 block discarded – undo
4543 4543
                                     $exeId,
4544 4544
                                     $questionId,
4545 4545
                                     $nano
4546
-                                ) . '</td>
4546
+                                ).'</td>
4547 4547
                                 </tr>
4548 4548
                                 </table>';
4549 4549
                             break;
@@ -4602,7 +4602,7 @@  discard block
 block discarded – undo
4602 4602
 
4603 4603
                                 //$overlap = round(polygons_overlap($poly_answer,$poly_user)); //this is an area in pixels
4604 4604
                                 if ($debug > 0) {
4605
-                                    error_log(__LINE__ . ' - Polygons results are ' . print_r($poly_results, 1), 0);
4605
+                                    error_log(__LINE__.' - Polygons results are '.print_r($poly_results, 1), 0);
4606 4606
                                 }
4607 4607
                                 if ($overlap < 1) {
4608 4608
                                     //shortcut to avoid complicated calculations
@@ -4613,17 +4613,17 @@  discard block
 block discarded – undo
4613 4613
                                     // the final overlap is the percentage of the initial polygon that is overlapped by the user's polygon
4614 4614
                                     $final_overlap = round(((float) $overlap / (float) $poly_answer_area) * 100);
4615 4615
                                     if ($debug > 1) {
4616
-                                        error_log(__LINE__ . ' - Final overlap is ' . $final_overlap, 0);
4616
+                                        error_log(__LINE__.' - Final overlap is '.$final_overlap, 0);
4617 4617
                                     }
4618 4618
                                     // the final missing area is the percentage of the initial polygon that is not overlapped by the user's polygon
4619 4619
                                     $final_missing = 100 - $final_overlap;
4620 4620
                                     if ($debug > 1) {
4621
-                                        error_log(__LINE__ . ' - Final missing is ' . $final_missing, 0);
4621
+                                        error_log(__LINE__.' - Final missing is '.$final_missing, 0);
4622 4622
                                     }
4623 4623
                                     // the final excess area is the percentage of the initial polygon's size that is covered by the user's polygon outside of the initial polygon
4624 4624
                                     $final_excess = round((((float) $poly_user_area - (float) $overlap) / (float) $poly_answer_area) * 100);
4625 4625
                                     if ($debug > 1) {
4626
-                                        error_log(__LINE__ . ' - Final excess is ' . $final_excess, 0);
4626
+                                        error_log(__LINE__.' - Final excess is '.$final_excess, 0);
4627 4627
                                     }
4628 4628
                                 }
4629 4629
 
@@ -4633,7 +4633,7 @@  discard block
 block discarded – undo
4633 4633
                                 $threadhold_items = explode(';', $threadhold_total);
4634 4634
                                 $threadhold1 = $threadhold_items[0]; // overlap
4635 4635
                                 $threadhold2 = $threadhold_items[1]; // excess
4636
-                                $threadhold3 = $threadhold_items[2];  //missing
4636
+                                $threadhold3 = $threadhold_items[2]; //missing
4637 4637
                                 // if is delineation
4638 4638
                                 if ($answerId === 1) {
4639 4639
                                     //setting colors
@@ -4665,14 +4665,14 @@  discard block
 block discarded – undo
4665 4665
                                 } elseif ($answerId > 1) {
4666 4666
                                     if ($objAnswerTmp->selectHotspotType($answerId) == 'noerror') {
4667 4667
                                         if ($debug > 0) {
4668
-                                            error_log(__LINE__ . ' - answerId is of type noerror', 0);
4668
+                                            error_log(__LINE__.' - answerId is of type noerror', 0);
4669 4669
                                         }
4670 4670
                                         //type no error shouldn't be treated
4671 4671
                                         $next = 1;
4672 4672
                                         continue;
4673 4673
                                     }
4674 4674
                                     if ($debug > 0) {
4675
-                                        error_log(__LINE__ . ' - answerId is >1 so we\'re probably in OAR', 0);
4675
+                                        error_log(__LINE__.' - answerId is >1 so we\'re probably in OAR', 0);
4676 4676
                                     }
4677 4677
                                     //check the intersection between the oar and the user
4678 4678
                                     //echo 'user';	print_r($x_user_list);		print_r($y_user_list);
@@ -4686,7 +4686,7 @@  discard block
 block discarded – undo
4686 4686
                                     $poly_answer = convert_coordinates($delineation_cord, '|');
4687 4687
                                     $max_coord = poly_get_max($poly_user, $poly_answer);
4688 4688
                                     $poly_answer_compiled = poly_compile($poly_answer, $max_coord);
4689
-                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled,$max_coord);
4689
+                                    $overlap = poly_touch($poly_user_compiled, $poly_answer_compiled, $max_coord);
4690 4690
 
4691 4691
                                     if ($overlap == false) {
4692 4692
                                         //all good, no overlap
@@ -4694,7 +4694,7 @@  discard block
 block discarded – undo
4694 4694
                                         continue;
4695 4695
                                     } else {
4696 4696
                                         if ($debug > 0) {
4697
-                                            error_log(__LINE__ . ' - Overlap is ' . $overlap . ': OAR hit', 0);
4697
+                                            error_log(__LINE__.' - Overlap is '.$overlap.': OAR hit', 0);
4698 4698
                                         }
4699 4699
                                         $organs_at_risk_hit++;
4700 4700
                                         //show the feedback
@@ -4706,12 +4706,12 @@  discard block
 block discarded – undo
4706 4706
                                         $try_hotspot = $destination_items[1];
4707 4707
                                         $lp_hotspot = $destination_items[2];
4708 4708
                                         $select_question_hotspot = $destination_items[3];
4709
-                                        $url_hotspot=$destination_items[4];
4709
+                                        $url_hotspot = $destination_items[4];
4710 4710
                                     }
4711 4711
                                 }
4712 4712
                             } else {	// the first delineation feedback
4713 4713
                                 if ($debug > 0) {
4714
-                                    error_log(__LINE__ . ' first', 0);
4714
+                                    error_log(__LINE__.' first', 0);
4715 4715
                                 }
4716 4716
                             }
4717 4717
                             break;
@@ -4733,7 +4733,7 @@  discard block
 block discarded – undo
4733 4733
                             echo Display::tag('td', $answerMatching[$answerId]);
4734 4734
                             echo Display::tag(
4735 4735
                                 'td',
4736
-                                "$user_answer / " . Display::tag(
4736
+                                "$user_answer / ".Display::tag(
4737 4737
                                     'strong',
4738 4738
                                     $answerMatching[$answerCorrect],
4739 4739
                                     ['style' => 'color: #008000; font-weight: bold;']
@@ -4819,7 +4819,7 @@  discard block
 block discarded – undo
4819 4819
             //  we use the results from the session (from_db=0)
4820 4820
             // TODO Change this, because it is wrong to show the user
4821 4821
             //  some results that haven't been stored in the database yet
4822
-            if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION ) {
4822
+            if ($answerType == HOT_SPOT || $answerType == HOT_SPOT_ORDER || $answerType == HOT_SPOT_DELINEATION) {
4823 4823
 
4824 4824
                 if ($debug) error_log('$from AND this is a hotspot kind of question ');
4825 4825
 
@@ -4828,19 +4828,19 @@  discard block
 block discarded – undo
4828 4828
                 if ($answerType == HOT_SPOT_DELINEATION) {
4829 4829
                     if (0) {
4830 4830
                         if ($overlap_color) {
4831
-                            $overlap_color='green';
4831
+                            $overlap_color = 'green';
4832 4832
                         } else {
4833
-                            $overlap_color='red';
4833
+                            $overlap_color = 'red';
4834 4834
                         }
4835 4835
                         if ($missing_color) {
4836
-                            $missing_color='green';
4836
+                            $missing_color = 'green';
4837 4837
                         } else {
4838
-                            $missing_color='red';
4838
+                            $missing_color = 'red';
4839 4839
                         }
4840 4840
                         if ($excess_color) {
4841
-                            $excess_color='green';
4841
+                            $excess_color = 'green';
4842 4842
                         } else {
4843
-                            $excess_color='red';
4843
+                            $excess_color = 'red';
4844 4844
                         }
4845 4845
                         if (!is_numeric($final_overlap)) {
4846 4846
                             $final_overlap = 0;
@@ -4852,33 +4852,33 @@  discard block
 block discarded – undo
4852 4852
                             $final_excess = 0;
4853 4853
                         }
4854 4854
 
4855
-                        if ($final_overlap>100) {
4855
+                        if ($final_overlap > 100) {
4856 4856
                             $final_overlap = 100;
4857 4857
                         }
4858 4858
 
4859
-                        $table_resume='<table class="data_table">
4859
+                        $table_resume = '<table class="data_table">
4860 4860
                                 <tr class="row_odd" >
4861 4861
                                     <td></td>
4862
-                                    <td ><b>' . get_lang('Requirements') . '</b></td>
4863
-                                    <td><b>' . get_lang('YourAnswer') . '</b></td>
4862
+                                    <td ><b>' . get_lang('Requirements').'</b></td>
4863
+                                    <td><b>' . get_lang('YourAnswer').'</b></td>
4864 4864
                                 </tr>
4865 4865
                                 <tr class="row_even">
4866
-                                    <td><b>' . get_lang('Overlap') . '</b></td>
4867
-                                    <td>' . get_lang('Min') . ' ' . $threadhold1 . '</td>
4868
-                                    <td><div style="color:' . $overlap_color . '">'
4869
-                                        . (($final_overlap < 0) ? 0 : intval($final_overlap)) . '</div></td>
4866
+                                    <td><b>' . get_lang('Overlap').'</b></td>
4867
+                                    <td>' . get_lang('Min').' '.$threadhold1.'</td>
4868
+                                    <td><div style="color:' . $overlap_color.'">'
4869
+                                        . (($final_overlap < 0) ? 0 : intval($final_overlap)).'</div></td>
4870 4870
                                 </tr>
4871 4871
                                 <tr>
4872
-                                    <td><b>' . get_lang('Excess') . '</b></td>
4873
-                                    <td>' . get_lang('Max') . ' ' . $threadhold2 . '</td>
4874
-                                    <td><div style="color:' . $excess_color . '">'
4875
-                                        . (($final_excess < 0) ? 0 : intval($final_excess)) . '</div></td>
4872
+                                    <td><b>' . get_lang('Excess').'</b></td>
4873
+                                    <td>' . get_lang('Max').' '.$threadhold2.'</td>
4874
+                                    <td><div style="color:' . $excess_color.'">'
4875
+                                        . (($final_excess < 0) ? 0 : intval($final_excess)).'</div></td>
4876 4876
                                 </tr>
4877 4877
                                 <tr class="row_even">
4878
-                                    <td><b>' . get_lang('Missing') . '</b></td>
4879
-                                    <td>' . get_lang('Max') . ' ' . $threadhold3 . '</td>
4880
-                                    <td><div style="color:' . $missing_color . '">'
4881
-                                        . (($final_missing < 0) ? 0 : intval($final_missing)) . '</div></td>
4878
+                                    <td><b>' . get_lang('Missing').'</b></td>
4879
+                                    <td>' . get_lang('Max').' '.$threadhold3.'</td>
4880
+                                    <td><div style="color:' . $missing_color.'">'
4881
+                                        . (($final_missing < 0) ? 0 : intval($final_missing)).'</div></td>
4882 4882
                                 </tr>
4883 4883
                             </table>';
4884 4884
                         if ($next == 0) {
@@ -4893,20 +4893,20 @@  discard block
 block discarded – undo
4893 4893
                             $answerDestination = $objAnswerTmp->selectDestination($nbrAnswers);
4894 4894
                         }
4895 4895
 
4896
-                        echo '<h1><div style="color:#333;">' . get_lang('Feedback') . '</div></h1>
4896
+                        echo '<h1><div style="color:#333;">'.get_lang('Feedback').'</div></h1>
4897 4897
                             <p style="text-align:center">';
4898 4898
 
4899
-                        $message = '<p>' . get_lang('YourDelineation') . '</p>';
4899
+                        $message = '<p>'.get_lang('YourDelineation').'</p>';
4900 4900
                         $message .= $table_resume;
4901
-                        $message .= '<br />' . get_lang('ResultIs') . ' ' . $result_comment . '<br />';
4901
+                        $message .= '<br />'.get_lang('ResultIs').' '.$result_comment.'<br />';
4902 4902
                         if ($organs_at_risk_hit > 0) {
4903
-                            $message .= '<p><b>' . get_lang('OARHit') . '</b></p>';
4903
+                            $message .= '<p><b>'.get_lang('OARHit').'</b></p>';
4904 4904
                         }
4905
-                        $message .='<p>' . $comment . '</p>';
4905
+                        $message .= '<p>'.$comment.'</p>';
4906 4906
                         echo $message;
4907 4907
                     } else {
4908 4908
                         echo $hotspot_delineation_result[0]; //prints message
4909
-                        $from_database = 1;  // the hotspot_solution.swf needs this variable
4909
+                        $from_database = 1; // the hotspot_solution.swf needs this variable
4910 4910
                     }
4911 4911
 
4912 4912
                     //save the score attempts
@@ -4928,20 +4928,20 @@  discard block
 block discarded – undo
4928 4928
                             $exerciseResultCoordinates[$quesId]
4929 4929
                         );
4930 4930
                     } else {
4931
-                        if ($final_answer==0) {
4931
+                        if ($final_answer == 0) {
4932 4932
                             $questionScore = 0;
4933
-                            $answer=0;
4933
+                            $answer = 0;
4934 4934
                             Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0);
4935 4935
                             if (is_array($exerciseResultCoordinates[$quesId])) {
4936
-                                foreach($exerciseResultCoordinates[$quesId] as $idx => $val) {
4937
-                                    Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,0,$val);
4936
+                                foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) {
4937
+                                    Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, 0, $val);
4938 4938
                                 }
4939 4939
                             }
4940 4940
                         } else {
4941 4941
                             Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0);
4942 4942
                             if (is_array($exerciseResultCoordinates[$quesId])) {
4943
-                                foreach($exerciseResultCoordinates[$quesId] as $idx => $val) {
4944
-                                    Event::saveExerciseAttemptHotspot($exeId,$quesId,$idx,$choice[$idx],$val);
4943
+                                foreach ($exerciseResultCoordinates[$quesId] as $idx => $val) {
4944
+                                    Event::saveExerciseAttemptHotspot($exeId, $quesId, $idx, $choice[$idx], $val);
4945 4945
                                 }
4946 4946
                             }
4947 4947
                         }
@@ -4960,7 +4960,7 @@  discard block
 block discarded – undo
4960 4960
                     echo "
4961 4961
                         <tr>
4962 4962
                             <td colspan=\"2\">
4963
-                                <p><em>" . get_lang('HotSpot') . "</em></p>
4963
+                                <p><em>" . get_lang('HotSpot')."</em></p>
4964 4964
 
4965 4965
                                 <div id=\"hotspot-solution-$questionId\"></div>
4966 4966
 
@@ -4998,7 +4998,7 @@  discard block
 block discarded – undo
4998 4998
 
4999 4999
         if ($saved_results) {
5000 5000
             if ($debug) error_log("Save question results $saved_results");
5001
-            if ($debug) error_log(print_r($choice ,1 ));
5001
+            if ($debug) error_log(print_r($choice, 1));
5002 5002
 
5003 5003
             if (empty($choice)) {
5004 5004
                 $choice = 0;
@@ -5010,14 +5010,14 @@  discard block
 block discarded – undo
5010 5010
                         $ans = $reply[$i];
5011 5011
                         Event::saveQuestionAttempt(
5012 5012
                             $questionScore,
5013
-                            $ans . ':' . $choice[$ans],
5013
+                            $ans.':'.$choice[$ans],
5014 5014
                             $quesId,
5015 5015
                             $exeId,
5016 5016
                             $i,
5017 5017
                             $this->id
5018 5018
                         );
5019 5019
                         if ($debug) {
5020
-                            error_log('result =>' . $questionScore . ' ' . $ans . ':' . $choice[$ans]);
5020
+                            error_log('result =>'.$questionScore.' '.$ans.':'.$choice[$ans]);
5021 5021
                         }
5022 5022
                     }
5023 5023
                 } else {
@@ -5028,7 +5028,7 @@  discard block
 block discarded – undo
5028 5028
                     $reply = array_keys($choice);
5029 5029
 
5030 5030
                     if ($debug) {
5031
-                        error_log("reply " . print_r($reply, 1) . "");
5031
+                        error_log("reply ".print_r($reply, 1)."");
5032 5032
                     }
5033 5033
                     for ($i = 0; $i < sizeof($reply); $i++) {
5034 5034
                         $ans = $reply[$i];
@@ -5087,7 +5087,7 @@  discard block
 block discarded – undo
5087 5087
 
5088 5088
                 Event::saveQuestionAttempt($questionScore, implode('|', $answer), $quesId, $exeId, 0, $this->id);
5089 5089
             } else {
5090
-                Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0,$this->id);
5090
+                Event::saveQuestionAttempt($questionScore, $answer, $quesId, $exeId, 0, $this->id);
5091 5091
             }
5092 5092
         }
5093 5093
 
@@ -5097,8 +5097,8 @@  discard block
 block discarded – undo
5097 5097
 
5098 5098
         if ($saved_results) {
5099 5099
             $stat_table = Database :: get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
5100
-            $sql = 'UPDATE ' . $stat_table . ' SET
5101
-                        exe_result = exe_result + ' . floatval($questionScore) . '
5100
+            $sql = 'UPDATE '.$stat_table.' SET
5101
+                        exe_result = exe_result + ' . floatval($questionScore).'
5102 5102
                     WHERE exe_id = ' . $exeId;
5103 5103
             if ($debug) error_log($sql);
5104 5104
             Database::query($sql);
@@ -5122,7 +5122,7 @@  discard block
 block discarded – undo
5122 5122
      */
5123 5123
     public function send_mail_notification_for_exam($question_list_answers, $origin, $exe_id)
5124 5124
     {
5125
-        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
5125
+        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) {
5126 5126
             return null;
5127 5127
         }
5128 5128
         // Email configuration settings
@@ -5173,7 +5173,7 @@  discard block
 block discarded – undo
5173 5173
         $msg = str_replace("#course#", $courseInfo['name'], $msg1);
5174 5174
 
5175 5175
         if ($origin != 'learnpath') {
5176
-            $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5176
+            $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5177 5177
         }
5178 5178
         $msg1 = str_replace("#url#", $url_email, $msg);
5179 5179
         $mail_content = $msg1;
@@ -5202,7 +5202,7 @@  discard block
 block discarded – undo
5202 5202
      */
5203 5203
     function send_notification_for_open_questions($question_list_answers, $origin, $exe_id)
5204 5204
     {
5205
-        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
5205
+        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) {
5206 5206
             return null;
5207 5207
         }
5208 5208
         // Email configuration settings
@@ -5265,11 +5265,11 @@  discard block
 block discarded – undo
5265 5265
             $msg .= '</table><br />';
5266 5266
 
5267 5267
 
5268
-            $msg1   = str_replace("#exercise#",    $this->exercise, $msg);
5269
-            $msg    = str_replace("#firstName#",   $user_info['firstname'],$msg1);
5270
-            $msg1   = str_replace("#lastName#",    $user_info['lastname'],$msg);
5271
-            $msg    = str_replace("#mail#",        $user_info['email'],$msg1);
5272
-            $msg    = str_replace("#course#",      $course_info['name'],$msg1);
5268
+            $msg1   = str_replace("#exercise#", $this->exercise, $msg);
5269
+            $msg    = str_replace("#firstName#", $user_info['firstname'], $msg1);
5270
+            $msg1   = str_replace("#lastName#", $user_info['lastname'], $msg);
5271
+            $msg    = str_replace("#mail#", $user_info['email'], $msg1);
5272
+            $msg    = str_replace("#course#", $course_info['name'], $msg1);
5273 5273
 
5274 5274
             if ($origin != 'learnpath') {
5275 5275
                 $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
@@ -5298,7 +5298,7 @@  discard block
 block discarded – undo
5298 5298
 
5299 5299
     function send_notification_for_oral_questions($question_list_answers, $origin, $exe_id)
5300 5300
     {
5301
-        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1 ) {
5301
+        if (api_get_course_setting('email_alert_manager_on_new_quiz') != 1) {
5302 5302
             return null;
5303 5303
         }
5304 5304
         // Email configuration settings
@@ -5322,7 +5322,7 @@  discard block
 block discarded – undo
5322 5322
             $answer_type = $item['answer_type'];
5323 5323
 
5324 5324
             if (!empty($question) && !empty($answer) && $answer_type == ORAL_EXPRESSION) {
5325
-                $oral_question_list.='<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">'
5325
+                $oral_question_list .= '<br /><table width="730" height="136" border="0" cellpadding="3" cellspacing="3">'
5326 5326
                     .'<tr>'
5327 5327
                         .'<td width="220" valign="top" bgcolor="#E5EDF8">&nbsp;&nbsp;'.get_lang('Question').'</td>'
5328 5328
                         .'<td width="473" valign="top" bgcolor="#F3F3F3">'.$question.'</td>'
@@ -5355,7 +5355,7 @@  discard block
 block discarded – undo
5355 5355
                             .'<td>&nbsp;#mail#</td>'
5356 5356
                         .'</tr>'
5357 5357
                     .'</table>';
5358
-            $msg .=  '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'),$oral_question_list).'<br />';
5358
+            $msg .= '<br />'.sprintf(get_lang('OralQuestionsAttemptedAreX'), $oral_question_list).'<br />';
5359 5359
             $msg1 = str_replace("#exercise#", $this->exercise, $msg);
5360 5360
             $msg = str_replace("#firstName#", $user_info['firstname'], $msg1);
5361 5361
             $msg1 = str_replace("#lastName#", $user_info['lastname'], $msg);
@@ -5363,7 +5363,7 @@  discard block
 block discarded – undo
5363 5363
             $msg = str_replace("#course#", $course_info['name'], $msg1);
5364 5364
 
5365 5365
             if ($origin != 'learnpath') {
5366
-                $msg.= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5366
+                $msg .= '<br /><a href="#url#">'.get_lang('ClickToCommentAndGiveFeedback').'</a>';
5367 5367
             }
5368 5368
             $msg1 = str_replace("#url#", $url_email, $msg);
5369 5369
             $mail_content = $msg1;
@@ -5429,10 +5429,10 @@  discard block
 block discarded – undo
5429 5429
         }
5430 5430
         $html  = '<div class="question-result">';
5431 5431
         $html .= Display::page_header(
5432
-            Display::return_icon('test-quiz.png', get_lang('Result'),null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result')
5432
+            Display::return_icon('test-quiz.png', get_lang('Result'), null, ICON_SIZE_MEDIUM).' '.$this->exercise.' : '.get_lang('Result')
5433 5433
         );
5434 5434
         $html .= Display::description($array);
5435
-        $html .="</div>";
5435
+        $html .= "</div>";
5436 5436
         return $html;
5437 5437
     }
5438 5438
 
@@ -5549,7 +5549,7 @@  discard block
 block discarded – undo
5549 5549
                     false,
5550 5550
                     $objExercise->selectPropagateNeg()
5551 5551
                 );
5552
-                $totalScore      += $question_result['score'];
5552
+                $totalScore += $question_result['score'];
5553 5553
             }
5554 5554
 
5555 5555
             if ($objExercise->selectPropagateNeg() == 0 && $totalScore < 0) {
@@ -5755,7 +5755,7 @@  discard block
 block discarded – undo
5755 5755
         }
5756 5756
 
5757 5757
         $rawMessage = "";
5758
-        if (!empty($message)){
5758
+        if (!empty($message)) {
5759 5759
             $rawMessage = $message;
5760 5760
             $message = Display::return_message($message, 'warning', false);
5761 5761
         }
@@ -5771,7 +5771,7 @@  discard block
 block discarded – undo
5771 5771
     {
5772 5772
         $TBL_LP_ITEM = Database::get_course_table(TABLE_LP_ITEM);
5773 5773
         $sql = "SELECT max_score FROM $TBL_LP_ITEM
5774
-            WHERE c_id = {$this->course_id} AND item_type = '" . TOOL_QUIZ . "' AND path = '{$this->id}'";
5774
+            WHERE c_id = {$this->course_id} AND item_type = '".TOOL_QUIZ."' AND path = '{$this->id}'";
5775 5775
         $result = Database::query($sql);
5776 5776
         if (Database::num_rows($result) > 0) {
5777 5777
             return true;
@@ -6099,7 +6099,7 @@  discard block
 block discarded – undo
6099 6099
         $sql_track = "SELECT * FROM $track_exercises WHERE exe_id = $exe_id ";
6100 6100
         $result = Database::query($sql_track);
6101 6101
         $new_array = array();
6102
-        if (Database::num_rows($result) > 0 ) {
6102
+        if (Database::num_rows($result) > 0) {
6103 6103
             $new_array = Database::fetch_array($result, 'ASSOC');
6104 6104
 
6105 6105
             $new_array['duration'] = null;
@@ -6111,11 +6111,11 @@  discard block
 block discarded – undo
6111 6111
                 $start_date = api_strtotime($start_date, 'UTC');
6112 6112
                 $end_date = api_strtotime($end_date, 'UTC');
6113 6113
                 if ($start_date && $end_date) {
6114
-                    $mytime = $end_date- $start_date;
6114
+                    $mytime = $end_date - $start_date;
6115 6115
                     $new_learnpath_item = new learnpathItem(null);
6116 6116
                     $time_attemp = $new_learnpath_item->get_scorm_time('js', $mytime);
6117 6117
                     $h = get_lang('h');
6118
-                    $time_attemp = str_replace('NaN', '00' . $h . '00\'00"', $time_attemp);
6118
+                    $time_attemp = str_replace('NaN', '00'.$h.'00\'00"', $time_attemp);
6119 6119
                     $new_array['duration'] = $time_attemp;
6120 6120
                 }
6121 6121
             }
@@ -6137,7 +6137,7 @@  discard block
 block discarded – undo
6137 6137
                     $result = Database::query($sql);
6138 6138
                 }
6139 6139
             } else {
6140
-                $remind_list = explode(',',$exercise_info['questions_to_check']);
6140
+                $remind_list = explode(',', $exercise_info['questions_to_check']);
6141 6141
 
6142 6142
                 $remind_list_string = '';
6143 6143
                 if ($action == 'add') {
@@ -6149,7 +6149,7 @@  discard block
 block discarded – undo
6149 6149
                         }
6150 6150
                         $remind_list_string = implode(',', $remind_list);
6151 6151
                     }
6152
-                } elseif ($action == 'delete')  {
6152
+                } elseif ($action == 'delete') {
6153 6153
                     if (!empty($remind_list)) {
6154 6154
                         if (in_array($question_id, $remind_list)) {
6155 6155
                             $remind_list = array_flip($remind_list);
@@ -6391,7 +6391,7 @@  discard block
 block discarded – undo
6391 6391
                     true
6392 6392
                 );
6393 6393
 
6394
-                $counter += count($mediaQuestions[$questionId]) - 1 ;
6394
+                $counter += count($mediaQuestions[$questionId]) - 1;
6395 6395
                 $before = count($questionList);
6396 6396
                 $wasMedia = true;
6397 6397
                 $nextValue += count($questionList);
@@ -6470,7 +6470,7 @@  discard block
 block discarded – undo
6470 6470
                         // If it was already seen, then merge the previous with
6471 6471
                         // the current category
6472 6472
                         $oldQuestionList = $newCategoryList[$rootElement]['question_list'];
6473
-                        $category['question_list'] = array_merge($oldQuestionList , $category['question_list']);
6473
+                        $category['question_list'] = array_merge($oldQuestionList, $category['question_list']);
6474 6474
                         $newCategoryList[$rootElement] = $category;
6475 6475
                     }
6476 6476
                 }
@@ -6496,7 +6496,7 @@  discard block
 block discarded – undo
6496 6496
 
6497 6497
                 if ($useRootAsCategoryTitle) {
6498 6498
                     if (isset($category['parent_info'])) {
6499
-                        $categoryName  = $category['parent_info']['title'];
6499
+                        $categoryName = $category['parent_info']['title'];
6500 6500
                     }
6501 6501
                 }
6502 6502
                 $html .= '<div class="row">';
@@ -6639,7 +6639,7 @@  discard block
 block discarded – undo
6639 6639
         // end foreach()
6640 6640
 
6641 6641
         if ($this->type == ALL_ON_ONE_PAGE) {
6642
-            $exercise_actions =  $this->show_button($questionId, $currentQuestion);
6642
+            $exercise_actions = $this->show_button($questionId, $currentQuestion);
6643 6643
             echo Display::div($exercise_actions, array('class'=>'exercise_actions'));
6644 6644
         }
6645 6645
     }
@@ -6725,7 +6725,7 @@  discard block
 block discarded – undo
6725 6725
 
6726 6726
             // Showing the question
6727 6727
 
6728
-            $exercise_actions  = null;
6728
+            $exercise_actions = null;
6729 6729
 
6730 6730
             echo '<a id="questionanchor'.$questionId.'"></a><br />';
6731 6731
             echo '<div id="question_div_'.$questionId.'" class="main_question '.$remind_highlight.'" >';
@@ -6993,7 +6993,7 @@  discard block
 block discarded – undo
6993 6993
                         $header .= Display::tag('th', get_lang('Feedback'));
6994 6994
                     }
6995 6995
                     $s .= '<table class="data_table">';
6996
-                    $s.= Display::tag('tr', $header, array('style' => 'text-align:left;'));
6996
+                    $s .= Display::tag('tr', $header, array('style' => 'text-align:left;'));
6997 6997
                 }
6998 6998
             }
6999 6999
 
@@ -7093,7 +7093,7 @@  discard block
 block discarded – undo
7093 7093
                             $s .= '<td>';
7094 7094
                             $s .= $comment;
7095 7095
                             $s .= '</td>';
7096
-                            $s .='</tr>';
7096
+                            $s .= '</tr>';
7097 7097
                         } else {
7098 7098
                             $s .= $answer_input;
7099 7099
                         }
@@ -7107,7 +7107,7 @@  discard block
 block discarded – undo
7107 7107
                             }
7108 7108
                         }
7109 7109
 
7110
-                        $s .='<tr>';
7110
+                        $s .= '<tr>';
7111 7111
                         $s .= Display::tag('td', $answer);
7112 7112
 
7113 7113
                         if (!empty($quiz_question_options)) {
@@ -7134,7 +7134,7 @@  discard block
 block discarded – undo
7134 7134
                             $s .= $comment;
7135 7135
                             $s .= '</td>';
7136 7136
                         }
7137
-                        $s.='</tr>';
7137
+                        $s .= '</tr>';
7138 7138
                     }
7139 7139
 
7140 7140
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION) {
@@ -7163,16 +7163,16 @@  discard block
 block discarded – undo
7163 7163
                     $answer_input .= '</label>';
7164 7164
 
7165 7165
                     if ($show_comment) {
7166
-                        $s.= '<tr>';
7166
+                        $s .= '<tr>';
7167 7167
                         $s .= '<td>';
7168
-                        $s.= $answer_input;
7168
+                        $s .= $answer_input;
7169 7169
                         $s .= '</td>';
7170 7170
                         $s .= '<td>';
7171 7171
                         $s .= $comment;
7172 7172
                         $s .= '</td>';
7173
-                        $s.= '</tr>';
7173
+                        $s .= '</tr>';
7174 7174
                     } else {
7175
-                        $s.= $answer_input;
7175
+                        $s .= $answer_input;
7176 7176
                     }
7177 7177
                 } elseif ($answerType == MULTIPLE_ANSWER_COMBINATION_TRUE_FALSE) {
7178 7178
                     $s .= '<input type="hidden" name="choice2['.$questionId.']" value="0" />';
@@ -7185,7 +7185,7 @@  discard block
 block discarded – undo
7185 7185
                         }
7186 7186
                     }
7187 7187
                     $answer = Security::remove_XSS($answer);
7188
-                    $s .='<tr>';
7188
+                    $s .= '<tr>';
7189 7189
                     $s .= Display::tag('td', $answer);
7190 7190
 
7191 7191
                     foreach ($objQuestionTmp->options as $key => $item) {
@@ -7209,7 +7209,7 @@  discard block
 block discarded – undo
7209 7209
                         $s .= $comment;
7210 7210
                         $s .= '</td>';
7211 7211
                     }
7212
-                    $s.='</tr>';
7212
+                    $s .= '</tr>';
7213 7213
                 } elseif ($answerType == FILL_IN_BLANKS) {
7214 7214
                     list($answer) = explode('::', $answer);
7215 7215
 
@@ -7243,7 +7243,7 @@  discard block
 block discarded – undo
7243 7243
                                     $value = str_replace('&nbsp;', '', trim($value[0]));
7244 7244
                                 }
7245 7245
                                 $correct_item = preg_quote($correct_item);
7246
-                                $correct_item = api_preg_replace('|/|', '\/', $correct_item);   // to prevent error if there is a / in the text to find
7246
+                                $correct_item = api_preg_replace('|/|', '\/', $correct_item); // to prevent error if there is a / in the text to find
7247 7247
                                 $answer = api_preg_replace('/'.$correct_item.'/', Display::input('text', "choice[$questionId][]", $value), $answer, 1);
7248 7248
                             }
7249 7249
                             $i++;
@@ -7300,7 +7300,7 @@  discard block
 block discarded – undo
7300 7300
                         }
7301 7301
 
7302 7302
                         if (!empty($answerCorrect) && !empty($selectedValue)) {
7303
-                            $s.= '<script>
7303
+                            $s .= '<script>
7304 7304
                                 jsPlumb.ready(function() {
7305 7305
                                     jsPlumb.connect({
7306 7306
                                         source: "window_'.$windowId.'",
@@ -7315,14 +7315,14 @@  discard block
 block discarded – undo
7315 7315
                         }
7316 7316
                         $s .= '</select></div></td>';
7317 7317
 
7318
-                        $s.='<td width="45%" valign="top" >';
7318
+                        $s .= '<td width="45%" valign="top" >';
7319 7319
 
7320 7320
                         if (isset($select_items[$lines_count])) {
7321
-                            $s.= '<div id="window_'.$windowId.'_answer" class="window window_right_question">
7321
+                            $s .= '<div id="window_'.$windowId.'_answer" class="window window_right_question">
7322 7322
                                     <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].'
7323 7323
                                   </div>';
7324 7324
                         } else {
7325
-                            $s.='&nbsp;';
7325
+                            $s .= '&nbsp;';
7326 7326
                         }
7327 7327
 
7328 7328
                         $s .= '</td>';
@@ -7336,16 +7336,16 @@  discard block
 block discarded – undo
7336 7336
                                 $s .= '<tr>
7337 7337
                                       <td colspan="2"></td>
7338 7338
                                       <td valign="top">';
7339
-                                $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>';
7339
+                                $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>';
7340 7340
                                 $s .= $select_items[$lines_count]['answer'];
7341
-                                $s.="</td>
7341
+                                $s .= "</td>
7342 7342
                                 </tr>";
7343 7343
                                 $lines_count++;
7344 7344
                             } // end while()
7345 7345
                         }  // end if()
7346 7346
                         $matching_correct_answer++;
7347 7347
                     }
7348
-                } elseif ($answerType ==  DRAGGABLE) {
7348
+                } elseif ($answerType == DRAGGABLE) {
7349 7349
                     // matching type, showing suggestions and answers
7350 7350
                     // TODO: replace $answerId by $numAnswer
7351 7351
 
@@ -7388,7 +7388,7 @@  discard block
 block discarded – undo
7388 7388
                         $s .= '</select>';
7389 7389
 
7390 7390
                         if (!empty($answerCorrect) && !empty($selectedValue)) {
7391
-                            $s.= '<script>
7391
+                            $s .= '<script>
7392 7392
                                 $(function() {
7393 7393
                                     deleteItem($("#'.$questionId.'_'.$selectedValue.'"), $("#drop_'.$windowId.'"));
7394 7394
                                 });
@@ -7397,11 +7397,11 @@  discard block
 block discarded – undo
7397 7397
 
7398 7398
 
7399 7399
                         if (isset($select_items[$lines_count])) {
7400
-                            $s.= '<div id="window_'.$windowId.'_answer" class="">
7400
+                            $s .= '<div id="window_'.$windowId.'_answer" class="">
7401 7401
                                     <b>'.$select_items[$lines_count]['letter'].'.</b> '.$select_items[$lines_count]['answer'].'
7402 7402
                                   </div>';
7403 7403
                         } else {
7404
-                            $s.='&nbsp;';
7404
+                            $s .= '&nbsp;';
7405 7405
                         }
7406 7406
                         $lines_count++;
7407 7407
                         //if the left side of the "matching" has been completely
@@ -7410,7 +7410,7 @@  discard block
 block discarded – undo
7410 7410
                         if (($lines_count - 1) == $num_suggestions) {
7411 7411
                             // if it remains answers to shown at the right side
7412 7412
                             while (isset($select_items[$lines_count])) {
7413
-                                $s.='<b>'.$select_items[$lines_count]['letter'].'.</b>';
7413
+                                $s .= '<b>'.$select_items[$lines_count]['letter'].'.</b>';
7414 7414
                                 $s .= $select_items[$lines_count]['answer'];
7415 7415
                                 $lines_count++;
7416 7416
                             }
@@ -7513,9 +7513,9 @@  discard block
 block discarded – undo
7513 7513
 
7514 7514
             if (!$only_questions) {
7515 7515
                 if ($show_title) {
7516
-                    $html .=  TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id);
7517
-                    $html .=  '<div class="question_title">'.$current_item.'. '.$questionName.'</div>';
7518
-                    $html .=  $questionDescription;
7516
+                    $html .= TestCategory::getCategoryNamesForQuestion($objQuestionTmp->id);
7517
+                    $html .= '<div class="question_title">'.$current_item.'. '.$questionName.'</div>';
7518
+                    $html .= $questionDescription;
7519 7519
                 } else {
7520 7520
                     $html .= '<div class="media">';
7521 7521
                     $html .= '<div class="pull-left">';
@@ -7531,11 +7531,11 @@  discard block
 block discarded – undo
7531 7531
                     $html .= '</div>';
7532 7532
                 }
7533 7533
                 //@todo I need to the get the feedback type
7534
-                $html .=  '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />';
7535
-                $html .=  '<table class="exercise_questions">
7534
+                $html .= '<input type="hidden" name="hidden_hotspot_id" value="'.$questionId.'" />';
7535
+                $html .= '<table class="exercise_questions">
7536 7536
                            <tr>
7537 7537
                             <td valign="top" colspan="2">';
7538
-                $html .=  '</td></tr>';
7538
+                $html .= '</td></tr>';
7539 7539
             }
7540 7540
 
7541 7541
             $canClick = isset($_GET['editQuestion']) ? '0' : (isset($_GET['modifyAnswers']) ? '0' : '1');
Please login to merge, or discard this patch.
main/inc/local.inc.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     $_user['status']  = $uData['status'];
131 131
     Session::write('_user', $_user);
132 132
     Session::erase('conditional_login');
133
-    $uidReset=true;
133
+    $uidReset = true;
134 134
     Event::event_login($_user['user_id']);
135 135
 }
136 136
 
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 
213 213
             //is necessary verify check
214 214
             if ($legal_type == 1) {
215
-                if ((isset($_POST['legal_accept']) && $_POST['legal_accept']=='1')) {
215
+                if ((isset($_POST['legal_accept']) && $_POST['legal_accept'] == '1')) {
216 216
                     $legal_option = true;
217 217
                 } else {
218 218
                     $legal_option = false;
@@ -221,7 +221,7 @@  discard block
 block discarded – undo
221 221
 
222 222
             //no is check option
223 223
             if ($legal_type == 0) {
224
-                $legal_option=true;
224
+                $legal_option = true;
225 225
             }
226 226
 
227 227
             if (isset($_POST['legal_accept_type']) && $legal_option === true) {
@@ -514,7 +514,7 @@  discard block
 block discarded – undo
514 514
                  * Process external authentication
515 515
                  * on the basis of the given login name
516 516
                  */
517
-                $loginFailed = true;  // Default initialisation. It could
517
+                $loginFailed = true; // Default initialisation. It could
518 518
                 // change after the external authentication
519 519
                 $key = $uData['auth_source']; //'ldap','shibboleth'...
520 520
                 /* >>>>>>>> External authentication modules <<<<<<<<< */
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
             }
534 534
         } else {
535 535
             // login failed, Database::num_rows($result) <= 0
536
-            $loginFailed = true;  // Default initialisation. It could
536
+            $loginFailed = true; // Default initialisation. It could
537 537
             // change after the external authentication
538 538
 
539 539
             /*
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
                         include_once($thisAuthSource['newUser']);
560 560
                     } else {
561 561
                         error_log(
562
-                            'Chamilo Authentication file '. $thisAuthSource['newUser'].
562
+                            'Chamilo Authentication file '.$thisAuthSource['newUser'].
563 563
                             ' could not be found - this might prevent your system from using'.
564 564
                             ' the authentication process in the user creation process',
565 565
                             0
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
             online_logout(null, false);
669 669
             $osso->logout(); //redirects and exits
670 670
         }
671
-    } elseif (api_get_setting('openid_authentication')=='true') {
671
+    } elseif (api_get_setting('openid_authentication') == 'true') {
672 672
         if (!empty($_POST['openid_url'])) {
673 673
             include api_get_path(SYS_CODE_PATH).'auth/openid/login.php';
674 674
             openid_begin(trim($_POST['openid_url']), api_get_path(WEB_PATH).'index.php');
@@ -681,7 +681,7 @@  discard block
 block discarded – undo
681 681
             if ($res['status'] == 'success') {
682 682
                 $id1 = Database::escape_string($res['openid.identity']);
683 683
                 //have another id with or without the final '/'
684
-                $id2 = (substr($id1, -1, 1)=='/'?substr($id1, 0, -1):$id1.'/');
684
+                $id2 = (substr($id1, -1, 1) == '/' ? substr($id1, 0, -1) : $id1.'/');
685 685
                 //lookup the user in the main database
686 686
                 $user_table = Database::get_main_table(TABLE_MAIN_USER);
687 687
                 $sql = "SELECT user_id, username, password, auth_source, active, expiration_date
@@ -690,14 +690,14 @@  discard block
 block discarded – undo
690 690
                         OR openid = '$id2' ";
691 691
                 $result = Database::query($sql);
692 692
                 if ($result !== false) {
693
-                    if (Database::num_rows($result)>0) {
693
+                    if (Database::num_rows($result) > 0) {
694 694
                         $uData = Database::fetch_array($result);
695 695
 
696 696
                         if ($uData['auth_source'] == PLATFORM_AUTH_SOURCE) {
697 697
                             //the authentification of this user is managed by Chamilo itself
698 698
 
699 699
                             // check if the account is active (not locked)
700
-                            if ($uData['active']=='1') {
700
+                            if ($uData['active'] == '1') {
701 701
                                 // check if the expiration date has not been reached
702 702
                                 if ($uData['expiration_date'] > date('Y-m-d H:i:s')
703 703
                                     || empty($uData['expiration_date'])
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
     (isset($_SESSION['_cid']) && $cidReq != $_SESSION['_cid']))
776 776
 ) {
777 777
     $cidReset = true;
778
-    $gidReset = true;    // As groups depend from courses, group id is reset
778
+    $gidReset = true; // As groups depend from courses, group id is reset
779 779
 }
780 780
 
781 781
 /* USER INIT */
@@ -925,8 +925,8 @@  discard block
 block discarded – undo
925 925
             $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
926 926
 
927 927
             if (!empty($_GET['id_session'])) {
928
-                $sql = 'SELECT name FROM '.$tbl_session . '
929
-                        WHERE id="'.intval($_GET['id_session']) . '"';
928
+                $sql = 'SELECT name FROM '.$tbl_session.'
929
+                        WHERE id="'.intval($_GET['id_session']).'"';
930 930
                 $rs = Database::query($sql);
931 931
                 if (Database::num_rows($rs)) {
932 932
                     list($_SESSION['session_name']) = Database::fetch_array(
@@ -1016,7 +1016,7 @@  discard block
 block discarded – undo
1016 1016
         // Moreover, if we want to track a course with another session it can be usefull
1017 1017
         if (!empty($_GET['id_session']) && is_numeric($_GET['id_session'])) {
1018 1018
             $tbl_session = Database::get_main_table(TABLE_MAIN_SESSION);
1019
-            $sql = 'SELECT name FROM '.$tbl_session . ' WHERE id="'.intval($_GET['id_session']). '"';
1019
+            $sql = 'SELECT name FROM '.$tbl_session.' WHERE id="'.intval($_GET['id_session']).'"';
1020 1020
             $rs = Database::query($sql);
1021 1021
             if (Database::num_rows($rs)) {
1022 1022
                 list($_SESSION['session_name']) = Database::fetch_array($rs);
@@ -1097,8 +1097,8 @@  discard block
 block discarded – undo
1097 1097
         if (Database::num_rows($result) > 0) { // this  user have a recorded state for this course
1098 1098
             $cuData = Database::fetch_array($result, 'ASSOC');
1099 1099
 
1100
-            $is_courseAdmin = (bool)($cuData['status'] == 1);
1101
-            $is_courseTutor = (bool)($cuData['is_tutor'] == 1);
1100
+            $is_courseAdmin = (bool) ($cuData['status'] == 1);
1101
+            $is_courseTutor = (bool) ($cuData['is_tutor'] == 1);
1102 1102
             $is_courseMember = true;
1103 1103
         }
1104 1104
 
@@ -1109,7 +1109,7 @@  discard block
 block discarded – undo
1109 1109
                 // This user has no status related to this course
1110 1110
                 // The user is subscribed in a session? The user is a Session coach a Session admin ?
1111 1111
 
1112
-                $tbl_session  = Database :: get_main_table(TABLE_MAIN_SESSION);
1112
+                $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
1113 1113
                 $tbl_session_course = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE);
1114 1114
                 $tbl_session_course_user = Database :: get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
1115 1115
 
@@ -1222,7 +1222,7 @@  discard block
 block discarded – undo
1222 1222
 
1223 1223
             //If I'm the admin platform i'm a teacher of the course
1224 1224
             if ($is_platformAdmin) {
1225
-                $is_courseAdmin     = true;
1225
+                $is_courseAdmin = true;
1226 1226
             }
1227 1227
         }
1228 1228
     } else { // keys missing => not anymore in the course - user relation
@@ -1380,12 +1380,12 @@  discard block
 block discarded – undo
1380 1380
     ($logging_in && exist_firstpage_parameter())
1381 1381
 ) {
1382 1382
     $redirectCourseDir = api_get_firstpage_parameter();
1383
-    api_delete_firstpage_parameter();    // delete the cookie
1383
+    api_delete_firstpage_parameter(); // delete the cookie
1384 1384
 
1385 1385
     if (!isset($_SESSION['request_uri'])) {
1386 1386
         if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
1387 1387
             $_SESSION['noredirection'] = false;
1388
-            $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/';
1388
+            $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/';
1389 1389
         }
1390 1390
     }
1391 1391
 } elseif (api_user_is_login() && exist_firstpage_parameter()) {
@@ -1393,7 +1393,7 @@  discard block
 block discarded – undo
1393 1393
     api_delete_firstpage_parameter(); // delete the cookie
1394 1394
     if (CourseManager::get_course_id_from_path($redirectCourseDir)) {
1395 1395
         $_SESSION['noredirection'] = false;
1396
-        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH) . $redirectCourseDir . '/';
1396
+        $_SESSION['request_uri'] = api_get_path(WEB_COURSE_PATH).$redirectCourseDir.'/';
1397 1397
     }
1398 1398
 }
1399 1399
 
Please login to merge, or discard this patch.
main/mySpace/myStudents.php 2 patches
Spacing   +76 added lines, -76 removed lines patch added patch discarded remove patch
@@ -63,52 +63,52 @@  discard block
 block discarded – undo
63 63
 if (isset($_GET['details'])) {
64 64
     if ($origin == 'user_course') {
65 65
         if (empty ($cidReq)) {
66
-            $interbreadcrumb[] = array (
67
-                "url" => api_get_path(WEB_COURSE_PATH) . $courseInfo['directory'],
66
+            $interbreadcrumb[] = array(
67
+                "url" => api_get_path(WEB_COURSE_PATH).$courseInfo['directory'],
68 68
                 'name' => $courseInfo['title']
69 69
             );
70 70
         }
71
-        $interbreadcrumb[] = array (
72
-            "url" => "../user/user.php?cidReq=" . $course_code,
71
+        $interbreadcrumb[] = array(
72
+            "url" => "../user/user.php?cidReq=".$course_code,
73 73
             "name" => get_lang("Users")
74 74
         );
75 75
     } else
76 76
         if ($origin == 'tracking_course') {
77
-            $interbreadcrumb[] = array (
78
-                "url" => "../tracking/courseLog.php?cidReq=".$course_code.'&id_session=' . api_get_session_id(),
77
+            $interbreadcrumb[] = array(
78
+                "url" => "../tracking/courseLog.php?cidReq=".$course_code.'&id_session='.api_get_session_id(),
79 79
                 "name" => get_lang("Tracking")
80 80
             );
81 81
         } else
82 82
             if ($origin == 'resume_session') {
83
-                $interbreadcrumb[] = array (
83
+                $interbreadcrumb[] = array(
84 84
                     'url' => "../session/session_list.php",
85 85
                     "name" => get_lang('SessionList')
86 86
                 );
87
-                $interbreadcrumb[] = array (
88
-                    'url' => "../session/resume_session.php?id_session=" . $sessionId,
87
+                $interbreadcrumb[] = array(
88
+                    'url' => "../session/resume_session.php?id_session=".$sessionId,
89 89
                     "name" => get_lang('SessionOverview')
90 90
                 );
91 91
             } else {
92
-                $interbreadcrumb[] = array (
92
+                $interbreadcrumb[] = array(
93 93
                     "url" => "index.php",
94 94
                     "name" => get_lang('MySpace')
95 95
                 );
96 96
                 if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
97
-                    $interbreadcrumb[] = array (
98
-                        "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
97
+                    $interbreadcrumb[] = array(
98
+                        "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach']),
99 99
                         "name" => get_lang("CoachStudents")
100 100
                     );
101
-                    $interbreadcrumb[] = array (
102
-                        "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']) . '&id_coach=' . Security :: remove_XSS($_GET['id_coach']),
101
+                    $interbreadcrumb[] = array(
102
+                        "url" => "myStudents.php?student=".Security :: remove_XSS($_GET['student']).'&id_coach='.Security :: remove_XSS($_GET['id_coach']),
103 103
                         "name" => get_lang("StudentDetails")
104 104
                     );
105 105
                 } else {
106
-                    $interbreadcrumb[] = array (
106
+                    $interbreadcrumb[] = array(
107 107
                         "url" => "student.php",
108 108
                         "name" => get_lang("MyStudents")
109 109
                     );
110
-                    $interbreadcrumb[] = array (
111
-                        "url" => "myStudents.php?student=" . Security :: remove_XSS($_GET['student']),
110
+                    $interbreadcrumb[] = array(
111
+                        "url" => "myStudents.php?student=".Security :: remove_XSS($_GET['student']),
112 112
                         "name" => get_lang("StudentDetails")
113 113
                     );
114 114
                 }
@@ -116,7 +116,7 @@  discard block
 block discarded – undo
116 116
     $nameTools = get_lang("DetailsStudentInCourse");
117 117
 } else {
118 118
     if ($origin == 'resume_session') {
119
-        $interbreadcrumb[] = array (
119
+        $interbreadcrumb[] = array(
120 120
             'url' => "../session/session_list.php",
121 121
             "name" => get_lang('SessionList')
122 122
         );
@@ -127,24 +127,24 @@  discard block
 block discarded – undo
127 127
             );
128 128
         }
129 129
     } else {
130
-        $interbreadcrumb[] = array (
130
+        $interbreadcrumb[] = array(
131 131
             "url" => "index.php",
132 132
             "name" => get_lang('MySpace')
133 133
         );
134 134
         if (isset ($_GET['id_coach']) && intval($_GET['id_coach']) != 0) {
135 135
             if ($sessionId) {
136
-                $interbreadcrumb[] = array (
137
-                    "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']) . "&id_session=" . $sessionId,
136
+                $interbreadcrumb[] = array(
137
+                    "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach'])."&id_session=".$sessionId,
138 138
                     "name" => get_lang("CoachStudents")
139 139
                 );
140 140
             } else {
141
-                $interbreadcrumb[] = array (
142
-                    "url" => "student.php?id_coach=" . Security :: remove_XSS($_GET['id_coach']),
141
+                $interbreadcrumb[] = array(
142
+                    "url" => "student.php?id_coach=".Security :: remove_XSS($_GET['id_coach']),
143 143
                     "name" => get_lang("CoachStudents")
144 144
                 );
145 145
             }
146 146
         } else {
147
-            $interbreadcrumb[] = array (
147
+            $interbreadcrumb[] = array(
148 148
                 "url" => "student.php",
149 149
                 "name" => get_lang("MyStudents")
150 150
             );
@@ -312,28 +312,28 @@  discard block
 block discarded – undo
312 312
     // Actions bar
313 313
     echo '<div class="actions">';
314 314
     echo '<a href="javascript: window.history.go(-1);">'.
315
-            Display::return_icon('back.png', get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
315
+            Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
316 316
 
317 317
     echo '<a href="javascript: void(0);" onclick="javascript: window.print();">'.
318
-            Display::return_icon('printer.png', get_lang('Print'),'',ICON_SIZE_MEDIUM).'</a>';
318
+            Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
319 319
 
320
-    echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=csv">'.
321
-            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'),'',ICON_SIZE_MEDIUM).'</a> ';
320
+    echo '<a href="'.api_get_self().'?'.Security :: remove_XSS($_SERVER['QUERY_STRING']).'&export=csv">'.
321
+            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a> ';
322 322
 
323
-    echo '<a href="' . api_get_self() . '?' . Security :: remove_XSS($_SERVER['QUERY_STRING']) . '&export=xls">'.
324
-    Display::return_icon('export_excel.png', get_lang('ExportAsXLS'),'',ICON_SIZE_MEDIUM).'</a> ';
323
+    echo '<a href="'.api_get_self().'?'.Security :: remove_XSS($_SERVER['QUERY_STRING']).'&export=xls">'.
324
+    Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> ';
325 325
 
326 326
     if (!empty ($user_info['email'])) {
327 327
         $send_mail = '<a href="mailto:'.$user_info['email'].'">'.
328
-            Display :: return_icon('mail_send.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM).'</a>';
328
+            Display :: return_icon('mail_send.png', get_lang('SendMail'), '', ICON_SIZE_MEDIUM).'</a>';
329 329
     } else {
330
-        $send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'),'',ICON_SIZE_MEDIUM);
330
+        $send_mail = Display :: return_icon('mail_send_na.png', get_lang('SendMail'), '', ICON_SIZE_MEDIUM);
331 331
     }
332 332
     echo $send_mail;
333 333
     if (!empty($student_id) && !empty($_GET['course'])) {
334 334
         // Only show link to connection details if course and student were defined in the URL
335
-        echo '<a href="access_details.php?student=' . $student_id . '&course=' . Security :: remove_XSS($_GET['course']) . '&origin=' . $origin. '&cidReq='.Security::remove_XSS($_GET['course']).'&id_session='.$sessionId.'">'.
336
-            Display :: return_icon('statistics.png', get_lang('AccessDetails'),'',ICON_SIZE_MEDIUM).'</a>';
335
+        echo '<a href="access_details.php?student='.$student_id.'&course='.Security :: remove_XSS($_GET['course']).'&origin='.$origin.'&cidReq='.Security::remove_XSS($_GET['course']).'&id_session='.$sessionId.'">'.
336
+            Display :: return_icon('statistics.png', get_lang('AccessDetails'), '', ICON_SIZE_MEDIUM).'</a>';
337 337
     }
338 338
     if (api_can_login_as($student_id)) {
339 339
         echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/user_list.php?action=login_as&user_id='.$student_id.'&sec_token='.$token.'">'.
@@ -398,7 +398,7 @@  discard block
 block discarded – undo
398 398
     $csv_content[] = array(
399 399
         get_lang('Information', '')
400 400
     );
401
-    $csv_content[] = array (
401
+    $csv_content[] = array(
402 402
         get_lang('Name', ''),
403 403
         get_lang('Email', ''),
404 404
         get_lang('Tel', '')
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
         strip_tags($first_connection_date),
427 427
         strip_tags($last_connection_date),
428 428
         $time_spent_on_the_course,
429
-        $avg_student_progress . '%',
429
+        $avg_student_progress.'%',
430 430
         $avg_student_score
431 431
     );
432 432
 
@@ -473,19 +473,19 @@  discard block
 block discarded – undo
473 473
             </thead>
474 474
             <tbody>
475 475
             <tr>
476
-                <td><?php echo get_lang('Name') . ' : '.$user_info['complete_name']; ?></td>
476
+                <td><?php echo get_lang('Name').' : '.$user_info['complete_name']; ?></td>
477 477
             </tr>
478 478
             <tr>
479
-                <td><?php echo get_lang('Email') . ' : ';
479
+                <td><?php echo get_lang('Email').' : ';
480 480
                     if (!empty ($user_info['email'])) {
481
-                        echo '<a href="mailto:' . $user_info['email'] . '">' . $user_info['email'] . '</a>';
481
+                        echo '<a href="mailto:'.$user_info['email'].'">'.$user_info['email'].'</a>';
482 482
                     } else {
483 483
                         echo get_lang('NoEmail');
484 484
                     } ?>
485 485
                 </td>
486 486
             </tr>
487 487
             <tr>
488
-                <td> <?php echo get_lang('Tel') . ' : ';
488
+                <td> <?php echo get_lang('Tel').' : ';
489 489
                     if (!empty ($user_info['phone'])) {
490 490
                         echo $user_info['phone'];
491 491
                     } else {
@@ -495,7 +495,7 @@  discard block
 block discarded – undo
495 495
                 </td>
496 496
             </tr>
497 497
             <tr>
498
-                <td> <?php echo get_lang('OfficialCode') . ' : ';
498
+                <td> <?php echo get_lang('OfficialCode').' : ';
499 499
                     if (!empty ($user_info['official_code'])) {
500 500
                         echo $user_info['official_code'];
501 501
                     } else {
@@ -505,13 +505,13 @@  discard block
 block discarded – undo
505 505
                 </td>
506 506
             </tr>
507 507
             <tr>
508
-                <td><?php echo get_lang('OnLine') . ' : '.$online; ?> </td>
508
+                <td><?php echo get_lang('OnLine').' : '.$online; ?> </td>
509 509
             </tr>
510 510
             <?php
511 511
 
512 512
             // Display timezone if the user selected one and if the admin allows the use of user's timezone
513 513
             $timezone = null;
514
-            $timezone_user = UserManager::get_extra_user_data_by_field($user_info['user_id'],'timezone');
514
+            $timezone_user = UserManager::get_extra_user_data_by_field($user_info['user_id'], 'timezone');
515 515
             $use_users_timezone = api_get_setting('use_users_timezone', 'timezones');
516 516
             if ($timezone_user['timezone'] != null && $use_users_timezone == 'true') {
517 517
                 $timezone = $timezone_user['timezone'];
@@ -519,7 +519,7 @@  discard block
 block discarded – undo
519 519
             if ($timezone !== null) {
520 520
                 ?>
521 521
                 <tr>
522
-                    <td> <?php echo get_lang('Timezone') . ' : '.$timezone; ?> </td>
522
+                    <td> <?php echo get_lang('Timezone').' : '.$timezone; ?> </td>
523 523
                 </tr>
524 524
             <?php
525 525
             }
@@ -551,7 +551,7 @@  discard block
 block discarded – undo
551 551
                     <td align="right">
552 552
                         <?php
553 553
                         echo get_lang('Progress').' ';
554
-                        Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px'));?>
554
+                        Display :: display_icon('info3.gif', get_lang('ScormAndLPProgressTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')); ?>
555 555
                     </td>
556 556
                     <td align="left"><?php echo $avg_student_progress.'%' ?></td>
557 557
                 </tr>
@@ -559,7 +559,7 @@  discard block
 block discarded – undo
559 559
                     <td align="right">
560 560
                         <?php
561 561
                         echo get_lang('Score').' ';
562
-                        Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array ('align' => 'absmiddle', 'hspace' => '3px')); ?>
562
+                        Display :: display_icon('info3.gif', get_lang('ScormAndLPTestTotalAverage'), array('align' => 'absmiddle', 'hspace' => '3px')); ?>
563 563
                     </td>
564 564
                     <td align="left"><?php
565 565
                         if (is_numeric($avg_student_score)) {
@@ -602,10 +602,10 @@  discard block
 block discarded – undo
602 602
     $table_title = '';
603 603
     if (!empty($sessionId)) {
604 604
         $session_name = api_get_session_name($sessionId);
605
-        $table_title  = $session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ':'';
605
+        $table_title  = $session_name ? Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.' ' : '';
606 606
     }
607 607
     if (!empty($courseInfo['title'])) {
608
-        $table_title .= $courseInfo ? Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['title'].'  ':'';
608
+        $table_title .= $courseInfo ? Display::return_icon('course.png', get_lang('Course'), array(), ICON_SIZE_SMALL).' '.$courseInfo['title'].'  ' : '';
609 609
     }
610 610
 
611 611
     echo Display::page_subheader($table_title);
@@ -643,13 +643,13 @@  discard block
 block discarded – undo
643 643
             }
644 644
             $date_session = '';
645 645
             if (!empty($access_start_date) && !empty($access_end_date)) {
646
-                $date_session = get_lang('From') . ' ' . $access_start_date . ' ' . get_lang('Until') . ' ' . $access_end_date;
646
+                $date_session = get_lang('From').' '.$access_start_date.' '.get_lang('Until').' '.$access_end_date;
647 647
             }
648 648
             $title = '';
649 649
             if (empty($sessionId)) {
650 650
                 $title = Display::return_icon('course.png', get_lang('Courses'), array(), ICON_SIZE_SMALL).' '.get_lang('Courses');
651 651
             } else {
652
-                $title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session?' ('.$date_session.')':'');
652
+                $title = Display::return_icon('session.png', get_lang('Session'), array(), ICON_SIZE_SMALL).' '.$session_name.($date_session ? ' ('.$date_session.')' : '');
653 653
             }
654 654
 
655 655
             // Courses
@@ -704,16 +704,16 @@  discard block
 block discarded – undo
704 704
                         $scoretotal = array();
705 705
                         if (isset($cats) && isset($cats[0])) {
706 706
                             if (!empty($sessionId)) {
707
-                                $scoretotal= $cats[0]->calc_score($student_id, null, $courseCodeItem, $sessionId);
707
+                                $scoretotal = $cats[0]->calc_score($student_id, null, $courseCodeItem, $sessionId);
708 708
                             } else {
709
-                                $scoretotal= $cats[0]->calc_score($student_id, null, $courseCodeItem);
709
+                                $scoretotal = $cats[0]->calc_score($student_id, null, $courseCodeItem);
710 710
                             }
711 711
                         }
712 712
 
713 713
                         $scoretotal_display = '0/0 (0%)';
714 714
                         if (!empty($scoretotal)) {
715 715
                             $scoretotal_display =
716
-                                round($scoretotal[0], 1 ).'/'.
716
+                                round($scoretotal[0], 1).'/'.
717 717
                                 round($scoretotal[1], 1).
718 718
                                 ' ('.round(($scoretotal[0] / $scoretotal[1]) * 100, 2).' %)';
719 719
                         }
@@ -734,9 +734,9 @@  discard block
 block discarded – undo
734 734
                         );
735 735
 
736 736
                         echo '<tr>
737
-                        <td ><a href="' . api_get_path(WEB_COURSE_PATH) . $courseInfoItem['directory'] .'/?id_session=' . $sessionId . '">'.
737
+                        <td ><a href="' . api_get_path(WEB_COURSE_PATH).$courseInfoItem['directory'].'/?id_session='.$sessionId.'">'.
738 738
                             $courseInfoItem['title'].'</a></td>
739
-                        <td >'.$time_spent_on_course .'</td>
739
+                        <td >'.$time_spent_on_course.'</td>
740 740
                         <td >'.$progress.'</td>
741 741
                         <td >'.$score.'</td>
742 742
                         <td >'.$attendances_faults_avg.'</td>
@@ -806,7 +806,7 @@  discard block
 block discarded – undo
806 806
                 <table class="table table-striped table-hover">
807 807
                 <thead>
808 808
                 <tr>
809
-                    <th><?php echo get_lang('Learnpaths');?></th>
809
+                    <th><?php echo get_lang('Learnpaths'); ?></th>
810 810
                     <th>
811 811
                         <?php
812 812
                         echo get_lang('Time').' ';
@@ -829,15 +829,15 @@  discard block
 block discarded – undo
829 829
                     </th>
830 830
                     <th><?php
831 831
                         echo get_lang('LatestAttemptAverageScore').' ';
832
-                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array ( 'align' => 'absmiddle', 'hspace' => '3px')); ?>
832
+                        Display :: display_icon('info3.gif', get_lang('AverageIsCalculatedBasedInTheLatestAttempts'), array('align' => 'absmiddle', 'hspace' => '3px')); ?>
833 833
                     </th>
834 834
                     <th><?php
835 835
                         echo get_lang('Progress').' ';
836
-                        Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array ('align' => 'absmiddle','hspace' => '3px')); ?>
836
+                        Display :: display_icon('info3.gif', get_lang('LPProgressScore'), array('align' => 'absmiddle', 'hspace' => '3px')); ?>
837 837
                     </th>
838 838
                     <th><?php
839 839
                         echo get_lang('LastConnexion').' ';
840
-                        Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array ('align' => 'absmiddle','hspace' => '3px')); ?>
840
+                        Display :: display_icon('info3.gif', get_lang('LastTimeTheCourseWasUsed'), array('align' => 'absmiddle', 'hspace' => '3px')); ?>
841 841
                     </th>
842 842
                     <?php
843 843
                     echo '<th>'.get_lang('Details').'</th>';
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 
867 867
                     if ($progress === null) {
868 868
                         $progress = '0%';
869
-                    }  else {
869
+                    } else {
870 870
                         $any_result = true;
871 871
                     }
872 872
 
@@ -893,7 +893,7 @@  discard block
 block discarded – undo
893 893
                     if (!empty($start_time)) {
894 894
                         $start_time = api_convert_and_format_date($start_time, DATE_TIME_FORMAT_LONG);
895 895
                     } else {
896
-                        $start_time =  '-';
896
+                        $start_time = '-';
897 897
                     }
898 898
 
899 899
                     if (!empty($total_time)) $any_result = true;
@@ -925,11 +925,11 @@  discard block
 block discarded – undo
925 925
                     $i++;
926 926
 
927 927
                     // csv export content
928
-                    $csv_content[] = array (
928
+                    $csv_content[] = array(
929 929
                         api_html_entity_decode(stripslashes($lp_name), ENT_QUOTES, $charset),
930 930
                         api_time_to_hms($total_time),
931
-                        $score . '%',
932
-                        $score_latest . '%',
931
+                        $score.'%',
932
+                        $score_latest.'%',
933 933
                         $progress.'%',
934 934
                         $start_time
935 935
                     );
@@ -968,7 +968,7 @@  discard block
 block discarded – undo
968 968
                     if ($any_result === true) {
969 969
                         $from = '';
970 970
                         if ($from_myspace) {
971
-                            $from ='&from=myspace';
971
+                            $from = '&from=myspace';
972 972
                         }
973 973
                         $link = Display::url(
974 974
                             Display::return_icon('2rightarrow.png'),
@@ -981,14 +981,14 @@  discard block
 block discarded – undo
981 981
                         echo '<td>';
982 982
                         if ($any_result === true) {
983 983
                             echo '<a href="myStudents.php?action=reset_lp&sec_token='.$token.'&cidReq='.Security::remove_XSS($_GET['course']).'&course='.Security::remove_XSS($_GET['course']).'&details='.Security::remove_XSS($_GET['details']).'&origin='.$origin.'&lp_id='.$learnpath->getId().'&student='.$user_info['user_id'].'&details=true&id_session='.$sessionId.'">';
984
-                            echo Display::return_icon('clean.png',get_lang('Clean'),'',ICON_SIZE_SMALL).'</a>';
984
+                            echo Display::return_icon('clean.png', get_lang('Clean'), '', ICON_SIZE_SMALL).'</a>';
985 985
                             echo '</a>';
986 986
                         }
987 987
                         echo '</td>';
988 988
                         echo '</tr>';
989 989
                     }
990 990
                     $data_learnpath[$i][] = $lp_name;
991
-                    $data_learnpath[$i][] = $progress . '%';
991
+                    $data_learnpath[$i][] = $progress.'%';
992 992
                 }
993 993
             } else {
994 994
                 //echo '<tr><td colspan="6">'.get_lang('NoLearnpath').'</td></tr>';
@@ -1005,7 +1005,7 @@  discard block
 block discarded – undo
1005 1005
         <thead>
1006 1006
         <tr>
1007 1007
             <th><?php echo get_lang('Exercises'); ?></th>
1008
-            <th><?php echo get_lang('LearningPath');?></th>
1008
+            <th><?php echo get_lang('LearningPath'); ?></th>
1009 1009
             <th><?php echo get_lang('AvgCourseScore').' '.Display :: return_icon('info3.gif', get_lang('AverageScore'), array('align' => 'absmiddle', 'hspace' => '3px')) ?></th>
1010 1010
             <th><?php echo get_lang('Attempts'); ?></th>
1011 1011
             <th><?php echo get_lang('LatestAttempt'); ?></th>
@@ -1024,7 +1024,7 @@  discard block
 block discarded – undo
1024 1024
         );
1025 1025
 
1026 1026
         $t_quiz = Database :: get_course_table(TABLE_QUIZ_TEST);
1027
-        $sql = "SELECT quiz.title, id FROM " . $t_quiz . " AS quiz
1027
+        $sql = "SELECT quiz.title, id FROM ".$t_quiz." AS quiz
1028 1028
                 WHERE
1029 1029
                     quiz.c_id =  ".$courseInfo['real_id']." AND
1030 1030
                     (quiz.session_id = $sessionId OR quiz.session_id = 0) AND
@@ -1067,7 +1067,7 @@  discard block
 block discarded – undo
1067 1067
                 echo '<td>';
1068 1068
 
1069 1069
                 if ($count_attempts > 0) {
1070
-                    echo $score_percentage . '%';
1070
+                    echo $score_percentage.'%';
1071 1071
                 } else {
1072 1072
                     echo '-';
1073 1073
                     $score_percentage = 0;
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
                 echo '<td>'.$count_attempts.'</td>';
1078 1078
                 echo '<td>';
1079 1079
 
1080
-                $sql = 'SELECT exe_id FROM ' . $tbl_stats_exercices . '
1080
+                $sql = 'SELECT exe_id FROM '.$tbl_stats_exercices.'
1081 1081
                          WHERE
1082 1082
                             exe_exo_id      ="'.$exercise_id.'" AND
1083 1083
                             exe_user_id     ="'.$student_id.'" AND
@@ -1090,7 +1090,7 @@  discard block
 block discarded – undo
1090 1090
                 if (Database :: num_rows($result_last_attempt) > 0) {
1091 1091
                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
1092 1092
                     if ($count_attempts > 0)
1093
-                        echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'">
1093
+                        echo '<a href="../exercice/exercise_show.php?id='.$id_last_attempt.'&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin) ? 'tracking' : $origin).'">
1094 1094
                         '.Display::return_icon('quiz.gif').'
1095 1095
                      </a>';
1096 1096
                 }
@@ -1098,11 +1098,11 @@  discard block
 block discarded – undo
1098 1098
 
1099 1099
                 echo '<td>';
1100 1100
                 $all_attempt_url = "../exercice/exercise_report.php?exerciseId=$exercise_id&cidReq=$course_code&filter_by_user=$student_id&id_session=$sessionId";
1101
-                echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url );
1101
+                echo Display::url(Display::return_icon('test_results.png', get_lang('AllAttempts'), array(), ICON_SIZE_SMALL), $all_attempt_url);
1102 1102
 
1103 1103
                 echo '</td></tr>';
1104 1104
                 $data_exercices[$i][] = $exercices['title'];
1105
-                $data_exercices[$i][] = $score_percentage . '%';
1105
+                $data_exercices[$i][] = $score_percentage.'%';
1106 1106
                 $data_exercices[$i][] = $count_attempts;
1107 1107
 
1108 1108
                 $csv_content[] = array(
@@ -1130,7 +1130,7 @@  discard block
 block discarded – undo
1130 1130
             $survey_list = SurveyManager::get_surveys($course_code, $sessionId);
1131 1131
 
1132 1132
             $survey_data = array();
1133
-            foreach($survey_list as $survey) {
1133
+            foreach ($survey_list as $survey) {
1134 1134
                 $user_list = SurveyManager::get_people_who_filled_survey($survey['survey_id'], false, $courseInfo['real_id']);
1135 1135
                 $survey_done = Display::return_icon("accept_na.png", get_lang('NoAnswer'), array(), ICON_SIZE_SMALL);
1136 1136
                 if (in_array($student_id, $user_list)) {
@@ -1155,7 +1155,7 @@  discard block
 block discarded – undo
1155 1155
                         $column = 0;
1156 1156
                         $table->setCellContents($row, $column, $data);
1157 1157
                         $class = 'class="row_odd"';
1158
-                        if($row % 2) {
1158
+                        if ($row % 2) {
1159 1159
                             $class = 'class="row_even"';
1160 1160
                         }
1161 1161
                         $table->setRowAttributes($row, $class, true);
Please login to merge, or discard this patch.
Braces   +7 added lines, -4 removed lines patch added patch discarded remove patch
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 
867 867
                     if ($progress === null) {
868 868
                         $progress = '0%';
869
-                    }  else {
869
+                    } else {
870 870
                         $any_result = true;
871 871
                     }
872 872
 
@@ -896,7 +896,9 @@  discard block
 block discarded – undo
896 896
                         $start_time =  '-';
897 897
                     }
898 898
 
899
-                    if (!empty($total_time)) $any_result = true;
899
+                    if (!empty($total_time)) {
900
+                        $any_result = true;
901
+                    }
900 902
 
901 903
                     // Quiz in lp
902 904
                     $score = Tracking::get_avg_student_score(
@@ -1089,10 +1091,11 @@  discard block
 block discarded – undo
1089 1091
                 $result_last_attempt = Database::query($sql);
1090 1092
                 if (Database :: num_rows($result_last_attempt) > 0) {
1091 1093
                     $id_last_attempt = Database :: result($result_last_attempt, 0, 0);
1092
-                    if ($count_attempts > 0)
1093
-                        echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'">
1094
+                    if ($count_attempts > 0) {
1095
+                                            echo '<a href="../exercice/exercise_show.php?id=' . $id_last_attempt . '&cidReq='.$course_code.'&session_id='.$sessionId.'&student='.$student_id.'&origin='.(empty($origin)?'tracking':$origin).'">
1094 1096
                         '.Display::return_icon('quiz.gif').'
1095 1097
                      </a>';
1098
+                    }
1096 1099
                 }
1097 1100
                 echo '</td>';
1098 1101
 
Please login to merge, or discard this patch.