Completed
Push — 1.11.x ( 772bf4...b5113d )
by José
28:31
created
main/chat/chat.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
 ];
18 18
 
19 19
 foreach ($externalCSS as $css) {
20
-    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH) . $css);
20
+    $htmlHeadXtra[] = api_get_css(api_get_path(WEB_LIBRARY_JS_PATH).$css);
21 21
 }
22 22
 
23
-$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'chat.css');
24
-$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH) . 'markdown.css');
23
+$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'chat.css');
24
+$htmlHeadXtra[] = api_get_css(api_get_path(WEB_CSS_PATH).'markdown.css');
25 25
 
26 26
 $externalJS = [
27 27
     'highlight/highlight.pack.js',
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
         continue;
42 42
     }
43 43
 
44
-    $iconList[$key] = strtoupper($icon) . '.png';
44
+    $iconList[$key] = strtoupper($icon).'.png';
45 45
 }
46 46
 
47 47
 $view = new Template(get_lang('Chat'), false, false, false, true, false);
Please login to merge, or discard this patch.
main/inc/lib/extra_field_option.lib.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 
217 217
                         foreach ($sub_options as $sub_option) {
218 218
                             if (!empty($sub_option)) {
219
-                                $new_params  = array(
219
+                                $new_params = array(
220 220
                                     'field_id' => $field_id,
221 221
                                     'option_value' => $sub_id,
222 222
                                     'display_text' => $sub_option,
@@ -660,7 +660,7 @@  discard block
 block discarded – undo
660 660
         $form->addElement('hidden', 'field_id', $this->field_id);
661 661
 
662 662
         if ($action == 'edit') {
663
-            $translateUrl = api_get_path(WEB_CODE_PATH) . 'extrafield/translate.php?' . http_build_query([
663
+            $translateUrl = api_get_path(WEB_CODE_PATH).'extrafield/translate.php?'.http_build_query([
664 664
                 'extra_field_option' => $id
665 665
             ]);
666 666
             $translateButton = Display::toolbarButton(get_lang('TranslateThisTerm'), $translateUrl, 'language', 'link');
Please login to merge, or discard this patch.
main/exercise/question.class.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     public $type;
23 23
     public $level;
24 24
     public $picture;
25
-    public $exerciseList;  // array with the list of exercises which this question is in
25
+    public $exerciseList; // array with the list of exercises which this question is in
26 26
     public $category_list;
27 27
     public $parent_id;
28 28
     public $category;
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
             'multiple_answer_combination_true_false.class.php',
48 48
             'MultipleAnswerCombinationTrueFalse'
49 49
         ),
50
-        GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php' , 'GlobalMultipleAnswer'),
51
-        CALCULATED_ANSWER => array('calculated_answer.class.php' , 'CalculatedAnswer'),
50
+        GLOBAL_MULTIPLE_ANSWER => array('global_multiple_answer.class.php', 'GlobalMultipleAnswer'),
51
+        CALCULATED_ANSWER => array('calculated_answer.class.php', 'CalculatedAnswer'),
52 52
         UNIQUE_ANSWER_IMAGE => ['UniqueAnswerImage.php', 'UniqueAnswerImage'],
53 53
         DRAGGABLE => ['Draggable.php', 'Draggable'],
54 54
         MATCHING_DRAGGABLE => ['MatchingDraggable.php', 'MatchingDraggable']
@@ -107,14 +107,14 @@  discard block
 block discarded – undo
107 107
         $id = intval($id);
108 108
 
109 109
         if (!empty($course_id)) {
110
-            $course_info =  api_get_course_info_by_id($course_id);
110
+            $course_info = api_get_course_info_by_id($course_id);
111 111
         } else {
112 112
             $course_info = api_get_course_info();
113 113
         }
114 114
 
115 115
         $course_id = $course_info['real_id'];
116 116
 
117
-        if (empty($course_id) || $course_id == -1 ) {
117
+        if (empty($course_id) || $course_id == -1) {
118 118
 
119 119
             return false;
120 120
         }
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
     public function selectPicturePath()
270 270
     {
271 271
         if (!empty($this->picture)) {
272
-            return api_get_path(WEB_COURSE_PATH) . $this->course['path'] . '/document/images/' . $this->picture;
272
+            return api_get_path(WEB_COURSE_PATH).$this->course['path'].'/document/images/'.$this->picture;
273 273
         }
274 274
 
275 275
         return '';
@@ -306,7 +306,7 @@  discard block
 block discarded – undo
306 306
      */
307 307
     public function updateTitle($title)
308 308
     {
309
-        $this->question=$title;
309
+        $this->question = $title;
310 310
     }
311 311
 
312 312
     /**
@@ -405,7 +405,7 @@  discard block
 block discarded – undo
405 405
                     // DO nothing
406 406
                 } else {
407 407
                     $sql = "INSERT INTO $TBL_QUESTION_REL_CATEGORY (c_id, question_id, category_id)
408
-                            VALUES (" . api_get_course_int_id() . ", $question_id, $category_id)";
408
+                            VALUES (".api_get_course_int_id().", $question_id, $category_id)";
409 409
                     Database::query($sql);
410 410
                 }
411 411
             }
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
             $sql = "SELECT count(*) AS nb FROM $table
433 433
                     WHERE
434 434
                         question_id = $question_id AND
435
-                        c_id=" . api_get_course_int_id();
435
+                        c_id=".api_get_course_int_id();
436 436
             $res = Database::query($sql);
437 437
             $row = Database::fetch_array($res);
438 438
             if ($row['nb'] > 0) {
@@ -440,11 +440,11 @@  discard block
 block discarded – undo
440 440
                         SET category_id = $category_id
441 441
                         WHERE
442 442
                             question_id = $question_id AND
443
-                            c_id = " . api_get_course_int_id();
443
+                            c_id = ".api_get_course_int_id();
444 444
                 Database::query($sql);
445 445
             } else {
446 446
                 $sql = "INSERT INTO $table (c_id, question_id, category_id)
447
-                        VALUES (" . api_get_course_int_id().", $question_id, $category_id)";
447
+                        VALUES (".api_get_course_int_id().", $question_id, $category_id)";
448 448
                 Database::query($sql);
449 449
             }
450 450
         }
@@ -462,7 +462,7 @@  discard block
 block discarded – undo
462 462
         $sql = "DELETE FROM $table
463 463
                 WHERE
464 464
                     question_id = $question_id AND
465
-                    c_id = " . api_get_course_int_id();
465
+                    c_id = ".api_get_course_int_id();
466 466
         Database::query($sql);
467 467
     }
468 468
 
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
             ) {
516 516
                 // removes old answers
517 517
                 $sql = "DELETE FROM $TBL_REPONSES
518
-                        WHERE c_id = $course_id AND question_id = " . intval($this->id);
518
+                        WHERE c_id = $course_id AND question_id = ".intval($this->id);
519 519
                 Database::query($sql);
520 520
             }
521 521
 
522
-            $this->type=$type;
522
+            $this->type = $type;
523 523
         }
524 524
     }
525 525
 
@@ -543,7 +543,7 @@  discard block
 block discarded – undo
543 543
         if (!file_exists($picturePath)) {
544 544
             if (mkdir($picturePath, api_get_permissions_for_new_directories())) {
545 545
                 // document path
546
-                $documentPath = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . "/document";
546
+                $documentPath = api_get_path(SYS_COURSE_PATH).$this->course['path']."/document";
547 547
                 $path = str_replace($documentPath, '', $picturePath);
548 548
                 $title_path = basename($picturePath);
549 549
                 $doc_id = add_document($this->course, $path, 'folder', 0, $title_path);
@@ -559,14 +559,14 @@  discard block
 block discarded – undo
559 559
 
560 560
         // if the question has got an ID
561 561
         if ($this->id) {
562
-            $this->picture = 'quiz-' . $this->id . '.jpg';
562
+            $this->picture = 'quiz-'.$this->id.'.jpg';
563 563
             $o_img = new Image($Picture);
564
-            $o_img->send_image($picturePath . '/' . $this->picture, -1, 'jpg');
564
+            $o_img->send_image($picturePath.'/'.$this->picture, -1, 'jpg');
565 565
             $document_id = add_document(
566 566
                 $this->course,
567
-                '/images/' . $this->picture,
567
+                '/images/'.$this->picture,
568 568
                 'file',
569
-                filesize($picturePath . '/' . $this->picture),
569
+                filesize($picturePath.'/'.$this->picture),
570 570
                 $this->picture
571 571
             );
572 572
             if ($document_id) {
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
         // if the question has an ID
601 601
         if ($this->id) {
602 602
             // Get dimensions from current image.
603
-            $my_image = new Image($picturePath . '/' . $this->picture);
603
+            $my_image = new Image($picturePath.'/'.$this->picture);
604 604
 
605 605
             $current_image_size = $my_image->get_image_size();
606 606
             $current_width = $current_image_size['width'];
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
             }
641 641
 
642 642
             $my_image->resize($new_width, $new_height);
643
-            $result = $my_image->send_image($picturePath . '/' . $this->picture);
643
+            $result = $my_image->send_image($picturePath.'/'.$this->picture);
644 644
 
645 645
             if ($result) {
646 646
                 return true;
@@ -665,7 +665,7 @@  discard block
 block discarded – undo
665 665
             $picture = $this->picture;
666 666
             $this->picture = '';
667 667
 
668
-            return @unlink($picturePath . '/' . $picture) ? true : false;
668
+            return @unlink($picturePath.'/'.$picture) ? true : false;
669 669
         }
670 670
 
671 671
         return false;
@@ -682,27 +682,27 @@  discard block
 block discarded – undo
682 682
     {
683 683
         $course_id = $course_info['real_id'];
684 684
         $TBL_QUESTIONS = Database::get_course_table(TABLE_QUIZ_QUESTION);
685
-        $destination_path = api_get_path(SYS_COURSE_PATH) . $course_info['path'] . '/document/images';
686
-        $source_path = api_get_path(SYS_COURSE_PATH) . $this->course['path'] . '/document/images';
685
+        $destination_path = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document/images';
686
+        $source_path = api_get_path(SYS_COURSE_PATH).$this->course['path'].'/document/images';
687 687
 
688 688
         // if the question has got an ID and if the picture exists
689 689
         if ($this->id && !empty($this->picture)) {
690 690
             $picture = explode('.', $this->picture);
691 691
             $extension = $picture[sizeof($picture) - 1];
692
-            $picture = 'quiz-' . $questionId . '.' . $extension;
693
-            $result = @copy($source_path . '/' . $this->picture, $destination_path . '/' . $picture) ? true : false;
692
+            $picture = 'quiz-'.$questionId.'.'.$extension;
693
+            $result = @copy($source_path.'/'.$this->picture, $destination_path.'/'.$picture) ? true : false;
694 694
             // If copy was correct then add to the database
695 695
             if ($result) {
696 696
                 $sql = "UPDATE $TBL_QUESTIONS SET
697
-                        picture = '" . Database::escape_string($picture) . "'
698
-                        WHERE c_id = $course_id AND id='" . intval($questionId) . "'";
697
+                        picture = '".Database::escape_string($picture)."'
698
+                        WHERE c_id = $course_id AND id='".intval($questionId)."'";
699 699
                 Database::query($sql);
700 700
 
701 701
                 $document_id = add_document(
702 702
                     $course_info,
703
-                    '/images/' . $picture,
703
+                    '/images/'.$picture,
704 704
                     'file',
705
-                    filesize($destination_path . '/' . $picture),
705
+                    filesize($destination_path.'/'.$picture),
706 706
                     $picture
707 707
                 );
708 708
                 if ($document_id) {
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
         $Extension = $PictureName[sizeof($PictureName) - 1];
738 738
 
739 739
         // saves the picture into a temporary file
740
-        @move_uploaded_file($Picture, $picturePath . '/tmp.' . $Extension);
740
+        @move_uploaded_file($Picture, $picturePath.'/tmp.'.$Extension);
741 741
     }
742 742
 
743 743
     /**
@@ -771,15 +771,15 @@  discard block
 block discarded – undo
771 771
 
772 772
         // if the question has got an ID and if the picture exists
773 773
         if ($this->id) {
774
-            if (file_exists($picturePath . '/tmp.jpg')) {
774
+            if (file_exists($picturePath.'/tmp.jpg')) {
775 775
                 $Extension = 'jpg';
776
-            } elseif (file_exists($picturePath . '/tmp.gif')) {
776
+            } elseif (file_exists($picturePath.'/tmp.gif')) {
777 777
                 $Extension = 'gif';
778
-            } elseif (file_exists($picturePath . '/tmp.png')) {
778
+            } elseif (file_exists($picturePath.'/tmp.png')) {
779 779
                 $Extension = 'png';
780 780
             }
781
-            $this->picture = 'quiz-' . $this->id . '.' . $Extension;
782
-            return @rename($picturePath . '/tmp.' . $Extension, $picturePath . '/' . $this->picture) ? true : false;
781
+            $this->picture = 'quiz-'.$this->id.'.'.$Extension;
782
+            return @rename($picturePath.'/tmp.'.$Extension, $picturePath.'/'.$this->picture) ? true : false;
783 783
         }
784 784
         return false;
785 785
     }
@@ -809,7 +809,7 @@  discard block
 block discarded – undo
809 809
         $category = $this->category;
810 810
 
811 811
         // question already exists
812
-        if(!empty($id)) {
812
+        if (!empty($id)) {
813 813
 
814 814
             $params = [
815 815
                 'question' => $question,
@@ -855,12 +855,12 @@  discard block
 block discarded – undo
855 855
                     $TBL_EXERCISE_QUESTION as test_question
856 856
                     WHERE
857 857
                         question.id = test_question.question_id AND
858
-                        test_question.exercice_id = " . intval($exerciseId) . " AND
858
+                        test_question.exercice_id = ".intval($exerciseId)." AND
859 859
                         question.c_id = $c_id AND
860 860
                         test_question.c_id = $c_id ";
861
-            $result	= Database::query($sql);
862
-            $current_position = Database::result($result,0,0);
863
-            $this->updatePosition($current_position+1);
861
+            $result = Database::query($sql);
862
+            $current_position = Database::result($result, 0, 0);
863
+            $this->updatePosition($current_position + 1);
864 864
             $position = $this->position;
865 865
 
866 866
             $params = [
@@ -956,10 +956,10 @@  discard block
 block discarded – undo
956 956
         }
957 957
     }
958 958
 
959
-    public function search_engine_edit($exerciseId, $addQs=false, $rmQs=false)
959
+    public function search_engine_edit($exerciseId, $addQs = false, $rmQs = false)
960 960
     {
961 961
         // update search engine and its values table if enabled
962
-        if (api_get_setting('search_enabled')=='true' && extension_loaded('xapian')) {
962
+        if (api_get_setting('search_enabled') == 'true' && extension_loaded('xapian')) {
963 963
             $course_id = api_get_course_id();
964 964
             // get search_did
965 965
             $tbl_se_ref = Database::get_main_table(TABLE_MAIN_SEARCH_ENGINE_REF);
@@ -977,8 +977,8 @@  discard block
 block discarded – undo
977 977
             $res = Database::query($sql);
978 978
 
979 979
             if (Database::num_rows($res) > 0 || $addQs) {
980
-                require_once(api_get_path(LIBRARY_PATH) . 'search/ChamiloIndexer.class.php');
981
-                require_once(api_get_path(LIBRARY_PATH) . 'search/IndexableChunk.class.php');
980
+                require_once(api_get_path(LIBRARY_PATH).'search/ChamiloIndexer.class.php');
981
+                require_once(api_get_path(LIBRARY_PATH).'search/IndexableChunk.class.php');
982 982
 
983 983
                 $di = new ChamiloIndexer();
984 984
                 if ($addQs) {
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 
992 992
                 // retrieve others exercise ids
993 993
                 $se_ref = Database::fetch_array($res);
994
-                $se_doc = $di->get_document((int)$se_ref['search_did']);
994
+                $se_doc = $di->get_document((int) $se_ref['search_did']);
995 995
                 if ($se_doc !== FALSE) {
996 996
                     if (($se_doc_data = $di->get_document_data($se_doc)) !== FALSE) {
997 997
                         $se_doc_data = unserialize($se_doc_data);
@@ -1029,16 +1029,16 @@  discard block
 block discarded – undo
1029 1029
                     SE_DATA => array(
1030 1030
                         'type' => SE_DOCTYPE_EXERCISE_QUESTION,
1031 1031
                         'exercise_ids' => $question_exercises,
1032
-                        'question_id' => (int)$this->id
1032
+                        'question_id' => (int) $this->id
1033 1033
                     ),
1034
-                    SE_USER => (int)api_get_user_id(),
1034
+                    SE_USER => (int) api_get_user_id(),
1035 1035
                 );
1036 1036
                 $ic_slide->xapian_data = serialize($xapian_data);
1037 1037
                 $ic_slide->addValue("content", $this->description);
1038 1038
 
1039 1039
                 //TODO: index answers, see also form validation on question_admin.inc.php
1040 1040
 
1041
-                $di->remove_document((int)$se_ref['search_did']);
1041
+                $di->remove_document((int) $se_ref['search_did']);
1042 1042
                 $di->addChunk($ic_slide);
1043 1043
 
1044 1044
                 //index and return search engine document id
@@ -1117,7 +1117,7 @@  discard block
 block discarded – undo
1117 1117
             $count = $new_exercise->selectNbrQuestions();
1118 1118
             $count++;
1119 1119
             $sql = "INSERT INTO $exerciseRelQuestionTable (c_id, question_id, exercice_id, question_order)
1120
-                    VALUES ({$this->course['real_id']}, " . intval($id) . ", " . intval($exerciseId) . ", '$count')";
1120
+                    VALUES ({$this->course['real_id']}, ".intval($id).", ".intval($exerciseId).", '$count')";
1121 1121
             Database::query($sql);
1122 1122
 
1123 1123
             // we do not want to reindex if we had just saved adnd indexed the question
@@ -1146,7 +1146,7 @@  discard block
 block discarded – undo
1146 1146
         $course_id = api_get_course_int_id();
1147 1147
 
1148 1148
         // exercise not found
1149
-        if($pos === false) {
1149
+        if ($pos === false) {
1150 1150
             return false;
1151 1151
         } else {
1152 1152
             // deletes the position in the array containing the wanted exercise ID
@@ -1156,17 +1156,17 @@  discard block
 block discarded – undo
1156 1156
                     FROM $TBL_EXERCISE_QUESTION
1157 1157
                     WHERE
1158 1158
                         c_id = $course_id
1159
-                        AND question_id = " . intval($id) . "
1159
+                        AND question_id = ".intval($id)."
1160 1160
                         AND exercice_id = " . intval($exerciseId);
1161 1161
             $res = Database::query($sql);
1162
-            if (Database::num_rows($res)>0) {
1162
+            if (Database::num_rows($res) > 0) {
1163 1163
                 $row = Database::fetch_array($res);
1164 1164
                 if (!empty($row['question_order'])) {
1165 1165
                     $sql = "UPDATE $TBL_EXERCISE_QUESTION
1166 1166
                         SET question_order = question_order-1
1167 1167
                         WHERE
1168 1168
                             c_id = $course_id
1169
-                            AND exercice_id = " . intval($exerciseId) . "
1169
+                            AND exercice_id = ".intval($exerciseId)."
1170 1170
                             AND question_order > " . $row['question_order'];
1171 1171
                     Database::query($sql);
1172 1172
                 }
@@ -1175,7 +1175,7 @@  discard block
 block discarded – undo
1175 1175
             $sql = "DELETE FROM $TBL_EXERCISE_QUESTION
1176 1176
                     WHERE
1177 1177
                         c_id = $course_id
1178
-                        AND question_id = " . intval($id) . "
1178
+                        AND question_id = ".intval($id)."
1179 1179
                         AND exercice_id = " . intval($exerciseId);
1180 1180
             Database::query($sql);
1181 1181
 
@@ -1216,7 +1216,7 @@  discard block
 block discarded – undo
1216 1216
                                 SET question_order = question_order-1
1217 1217
                                 WHERE
1218 1218
                                     c_id= $course_id
1219
-                                    AND exercice_id = " . intval($row['exercice_id']) . "
1219
+                                    AND exercice_id = ".intval($row['exercice_id'])."
1220 1220
                                     AND question_order > " . $row['question_order'];
1221 1221
                         Database::query($sql);
1222 1222
                     }
@@ -1224,22 +1224,22 @@  discard block
 block discarded – undo
1224 1224
             }
1225 1225
 
1226 1226
             $sql = "DELETE FROM $TBL_EXERCISE_QUESTION
1227
-                    WHERE c_id = $course_id AND question_id = " . $id;
1227
+                    WHERE c_id = $course_id AND question_id = ".$id;
1228 1228
             Database::query($sql);
1229 1229
 
1230 1230
             $sql = "DELETE FROM $TBL_QUESTIONS
1231
-                    WHERE c_id = $course_id AND id = " . $id;
1231
+                    WHERE c_id = $course_id AND id = ".$id;
1232 1232
             Database::query($sql);
1233 1233
 
1234 1234
             $sql = "DELETE FROM $TBL_REPONSES
1235
-                    WHERE c_id = $course_id AND question_id = " . $id;
1235
+                    WHERE c_id = $course_id AND question_id = ".$id;
1236 1236
             Database::query($sql);
1237 1237
 
1238 1238
             // remove the category of this question in the question_rel_category table
1239 1239
             $sql = "DELETE FROM $TBL_QUIZ_QUESTION_REL_CATEGORY
1240 1240
                     WHERE 
1241 1241
                         c_id = $course_id AND 
1242
-                        question_id = " . $id;
1242
+                        question_id = ".$id;
1243 1243
             Database::query($sql);
1244 1244
 
1245 1245
             api_item_property_update(
@@ -1408,7 +1408,7 @@  discard block
 block discarded – undo
1408 1408
                 if (class_exists($class_name)) {
1409 1409
                     return new $class_name();
1410 1410
                 } else {
1411
-                    echo 'Can\'t instanciate class ' . $class_name . ' of type ' . $type;
1411
+                    echo 'Can\'t instanciate class '.$class_name.' of type '.$type;
1412 1412
                 }
1413 1413
             }
1414 1414
         }
@@ -1450,7 +1450,7 @@  discard block
 block discarded – undo
1450 1450
 
1451 1451
         // Question type
1452 1452
         $answerType = isset($_REQUEST['answerType']) ? intval($_REQUEST['answerType']) : null;
1453
-        $form->addElement('hidden','answerType', $answerType);
1453
+        $form->addElement('hidden', 'answerType', $answerType);
1454 1454
 
1455 1455
         // html editor
1456 1456
         $editorConfig = array(
@@ -1458,7 +1458,7 @@  discard block
 block discarded – undo
1458 1458
             'Height' => '150'
1459 1459
         );
1460 1460
 
1461
-        if (!api_is_allowed_to_edit(null,true)) {
1461
+        if (!api_is_allowed_to_edit(null, true)) {
1462 1462
             $editorConfig['UserStatus'] = 'student';
1463 1463
         }
1464 1464
 
@@ -1595,7 +1595,7 @@  discard block
 block discarded – undo
1595 1595
 
1596 1596
         if ($feedback_type == 1) {
1597 1597
             //2. but if it is a feedback DIRECT we only show the UNIQUE_ANSWER type that is currently available
1598
-            $question_type_custom_list = array (
1598
+            $question_type_custom_list = array(
1599 1599
                 UNIQUE_ANSWER => self::$questionTypes[UNIQUE_ANSWER],
1600 1600
                 HOT_SPOT_DELINEATION => self::$questionTypes[HOT_SPOT_DELINEATION]
1601 1601
             );
@@ -1611,14 +1611,14 @@  discard block
 block discarded – undo
1611 1611
             require_once $a_type[0];
1612 1612
             // get the picture of the type and the langvar which describes it
1613 1613
             $img = $explanation = '';
1614
-            eval('$img = ' . $a_type[1] . '::$typePicture;');
1615
-            eval('$explanation = get_lang(' . $a_type[1] . '::$explanationLangVar);');
1614
+            eval('$img = '.$a_type[1].'::$typePicture;');
1615
+            eval('$explanation = get_lang('.$a_type[1].'::$explanationLangVar);');
1616 1616
             echo '<li>';
1617 1617
             echo '<div class="icon-image">';
1618 1618
 
1619 1619
 
1620
-            $icon = '<a href="admin.php?' . api_get_cidreq() . '&newQuestion=yes&answerType=' . $i . '">' .
1621
-                Display::return_icon($img, $explanation, null, ICON_SIZE_BIG) . '</a>';
1620
+            $icon = '<a href="admin.php?'.api_get_cidreq().'&newQuestion=yes&answerType='.$i.'">'.
1621
+                Display::return_icon($img, $explanation, null, ICON_SIZE_BIG).'</a>';
1622 1622
 
1623 1623
             if ($objExercise->force_edit_exercise_in_lp === false) {
1624 1624
                 if ($objExercise->exercise_was_added_in_lp == true) {
@@ -1639,9 +1639,9 @@  discard block
 block discarded – undo
1639 1639
             echo Display::return_icon('database_na.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG);
1640 1640
         } else {
1641 1641
             if ($feedback_type == 1) {
1642
-                echo $url = "<a href=\"question_pool.php?" . api_get_cidreq() . "&type=1&fromExercise=$exerciseId\">";
1642
+                echo $url = "<a href=\"question_pool.php?".api_get_cidreq()."&type=1&fromExercise=$exerciseId\">";
1643 1643
             } else {
1644
-                echo $url = '<a href="question_pool.php?' . api_get_cidreq() . '&fromExercise=' . $exerciseId . '">';
1644
+                echo $url = '<a href="question_pool.php?'.api_get_cidreq().'&fromExercise='.$exerciseId.'">';
1645 1645
             }
1646 1646
             echo Display::return_icon('database.png', get_lang('GetExistingQuestion'), null, ICON_SIZE_BIG);
1647 1647
         }
@@ -1778,7 +1778,7 @@  discard block
 block discarded – undo
1778 1778
             $header .= $this->show_media_content();
1779 1779
         }
1780 1780
 
1781
-        $header .= Display::page_subheader2($counter_label . ". " . $question_title);
1781
+        $header .= Display::page_subheader2($counter_label.". ".$question_title);
1782 1782
         $header .= Display::div(
1783 1783
             "<div class=\"rib rib-$class\"><h3>$score_label</h3></div> <h4>{$score['result']}</h4>",
1784 1784
             array('class' => 'ribbon')
@@ -1800,7 +1800,7 @@  discard block
 block discarded – undo
1800 1800
     public function create_question(
1801 1801
         $quiz_id,
1802 1802
         $question_name,
1803
-        $question_description = "" ,
1803
+        $question_description = "",
1804 1804
         $max_score = 0,
1805 1805
         $type = 1,
1806 1806
         $level = 1
@@ -1870,8 +1870,8 @@  discard block
 block discarded – undo
1870 1870
         require_once $tabQuestionList[$type][0];
1871 1871
 
1872 1872
         $img = $explanation = null;
1873
-        eval('$img = ' . $tabQuestionList[$type][1] . '::$typePicture;');
1874
-        eval('$explanation = get_lang(' . $tabQuestionList[$type][1] . '::$explanationLangVar);');
1873
+        eval('$img = '.$tabQuestionList[$type][1].'::$typePicture;');
1874
+        eval('$explanation = get_lang('.$tabQuestionList[$type][1].'::$explanationLangVar);');
1875 1875
         return array($img, $explanation);
1876 1876
     }
1877 1877
 
@@ -1936,7 +1936,7 @@  discard block
 block discarded – undo
1936 1936
         $media_list[0] = get_lang('NoMedia');
1937 1937
 
1938 1938
         if (!empty($medias)) {
1939
-            foreach($medias as $media) {
1939
+            foreach ($medias as $media) {
1940 1940
                 $media_list[$media['id']] = empty($media['question']) ? get_lang('Untitled') : $media['question'];
1941 1941
             }
1942 1942
         }
Please login to merge, or discard this patch.
main/auth/openid/login.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     // Now that there is an association created, move on
65 65
     // to request authentication from the IdP
66 66
     $identity = (!empty($services[0]['delegate'])) ? $services[0]['delegate'] : $claimed_id;
67
-    if (isset($services[0]['types']) && is_array($services[0]['types']) && in_array(OPENID_NS_2_0 . '/server', $services[0]['types'])) {
67
+    if (isset($services[0]['types']) && is_array($services[0]['types']) && in_array(OPENID_NS_2_0.'/server', $services[0]['types'])) {
68 68
         $identity = 'http://openid.net/identifier_select/2.0';
69 69
     }
70 70
     $authn_request = openid_authentication_request($claimed_id, $identity, $return_to, $assoc_handle, $services[0]['version']);
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
     $xrds_url = $claimed_id;
121 121
     if (_openid_is_xri($claimed_id)) {
122
-        $xrds_url = 'http://xri.net/' . $claimed_id;
122
+        $xrds_url = 'http://xri.net/'.$claimed_id;
123 123
     }
124 124
     $url = @parse_url($xrds_url);
125 125
     if ($url['scheme'] == 'http' || $url['scheme'] == 'https') {
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
     //@todo Remove Old Associations:
183 183
     $openid_association = Database::get_main_table(TABLE_MAIN_OPENID_ASSOCIATION);
184 184
     $sql = "DELETE FROM $openid_association
185
-            WHERE created + expires_in < '" . api_get_utc_datetime() . "'";
185
+            WHERE created + expires_in < '".api_get_utc_datetime()."'";
186 186
     Database::query($sql);
187 187
 
188 188
     // Check to see if we have an association for this IdP already
@@ -339,17 +339,17 @@  discard block
 block discarded – undo
339 339
     switch ($uri['scheme']) {
340 340
         case 'http':
341 341
             $port = isset($uri['port']) ? $uri['port'] : 80;
342
-            $host = $uri['host'] . ($port != 80 ? ':' . $port : '');
342
+            $host = $uri['host'].($port != 80 ? ':'.$port : '');
343 343
             $fp = @fsockopen($uri['host'], $port, $errno, $errstr, 15);
344 344
             break;
345 345
         case 'https':
346 346
             // Note: Only works for PHP 4.3 compiled with OpenSSL.
347 347
             $port = isset($uri['port']) ? $uri['port'] : 443;
348
-            $host = $uri['host'] . ($port != 443 ? ':' . $port : '');
349
-            $fp = @fsockopen('ssl://' . $uri['host'], $port, $errno, $errstr, 20);
348
+            $host = $uri['host'].($port != 443 ? ':'.$port : '');
349
+            $fp = @fsockopen('ssl://'.$uri['host'], $port, $errno, $errstr, 20);
350 350
             break;
351 351
         default:
352
-            $result->error = 'invalid schema ' . $uri['scheme'];
352
+            $result->error = 'invalid schema '.$uri['scheme'];
353 353
             return $result;
354 354
     }
355 355
 
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
     // Construct the path to act on.
366 366
     $path = isset($uri['path']) ? $uri['path'] : '/';
367 367
     if (isset($uri['query'])) {
368
-        $path .= '?' . $uri['query'];
368
+        $path .= '?'.$uri['query'];
369 369
     }
370 370
 
371 371
     // Create HTTP request.
@@ -375,23 +375,23 @@  discard block
 block discarded – undo
375 375
         // host that do not take into account the port number.
376 376
         'Host' => "Host: $host",
377 377
         'User-Agent' => 'User-Agent: Chamilo (+http://www.chamilo.org/)',
378
-        'Content-Length' => 'Content-Length: ' . strlen($data)
378
+        'Content-Length' => 'Content-Length: '.strlen($data)
379 379
     );
380 380
 
381 381
     // If the server url has a user then attempt to use basic authentication
382 382
     if (isset($uri['user'])) {
383
-        $defaults['Authorization'] = 'Authorization: Basic ' . base64_encode($uri['user'] . (!empty($uri['pass']) ? ":" . $uri['pass'] : ''));
383
+        $defaults['Authorization'] = 'Authorization: Basic '.base64_encode($uri['user'].(!empty($uri['pass']) ? ":".$uri['pass'] : ''));
384 384
     }
385 385
 
386 386
     foreach ($headers as $header => $value) {
387
-        $defaults[$header] = $header . ': ' . $value;
387
+        $defaults[$header] = $header.': '.$value;
388 388
     }
389 389
 
390
-    $request = $method . ' ' . $path . " HTTP/1.0\r\n";
390
+    $request = $method.' '.$path." HTTP/1.0\r\n";
391 391
     $request .= implode("\r\n", $defaults);
392 392
     $request .= "\r\n\r\n";
393 393
     if ($data) {
394
-        $request .= $data . "\r\n";
394
+        $request .= $data."\r\n";
395 395
     }
396 396
     $result->request = $request;
397 397
 
@@ -417,7 +417,7 @@  discard block
 block discarded – undo
417 417
         if (isset($result->headers[$header]) && $header == 'Set-Cookie') {
418 418
             // RFC 2109: the Set-Cookie response header comprises the token Set-
419 419
             // Cookie:, followed by a comma-separated list of one or more cookies.
420
-            $result->headers[$header] .= ',' . trim($value);
420
+            $result->headers[$header] .= ','.trim($value);
421 421
         } else {
422 422
             $result->headers[$header] = trim($value);
423 423
         }
Please login to merge, or discard this patch.
main/webservices/cm_webservice_course.php 1 patch
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
 	 */
20 20
 	protected function deleteCourseHelper($course_id_field_name, $course_id_value) {
21 21
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
22
-		if($course_id instanceof WSCMError) {
22
+		if ($course_id instanceof WSCMError) {
23 23
 			return $course_id;
24 24
 		} else {
25 25
 			$course_code = CourseManager::get_course_code_from_course_id($course_id);
@@ -37,11 +37,11 @@  discard block
 block discarded – undo
37 37
 	 */
38 38
 	public function DeleteCourse($secret_key, $course_id_field_name, $course_id_value) {
39 39
 		$verifKey = $this->verifyKey($secret_key);
40
-		if($verifKey instanceof WSError) {
40
+		if ($verifKey instanceof WSError) {
41 41
 			$this->handleError($verifKey);
42 42
 		} else {
43 43
 			$result = $this->deleteCourseHelper($course_id_field_name, $course_id_value);
44
-			if($result instanceof WSError) {
44
+			if ($result instanceof WSError) {
45 45
 				$this->handleError($result);
46 46
 			}
47 47
 		}
@@ -57,15 +57,15 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function DeleteCourses($secret_key, $courses) {
59 59
 		$verifKey = $this->verifyKey($secret_key);
60
-		if($verifKey instanceof WSError) {
60
+		if ($verifKey instanceof WSError) {
61 61
 			$this->handleError($verifKey);
62 62
 		} else {
63 63
 			$results = array();
64
-			foreach($courses as $course) {
64
+			foreach ($courses as $course) {
65 65
 				$result_tmp = array();
66 66
 				$result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']);
67 67
 				$result_tmp['course_id_value'] = $course['course_id_value'];
68
-				if($result_op instanceof WSCMError) {
68
+				if ($result_op instanceof WSCMError) {
69 69
 					// Return the error in the results
70 70
 					$result_tmp['result'] = $result_op->toArray();
71 71
 				} else {
@@ -95,17 +95,17 @@  discard block
 block discarded – undo
95 95
 	protected function createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) {
96 96
 		// Add the original course id field name and value to the extra fields if needed
97 97
 		$extras_associative = array();
98
-		if($course_id_field_name != "chamilo_course_id") {
98
+		if ($course_id_field_name != "chamilo_course_id") {
99 99
 			$extras_associative[$course_id_field_name] = $course_id_value;
100 100
 		}
101
-		foreach($extras as $extra) {
101
+		foreach ($extras as $extra) {
102 102
 			$extras_associative[$extra['field_name']] = $extra['field_value'];
103 103
 		}
104 104
 		$course_admin_id = $this->getUserId($course_admin_user_id_field_name, $course_admin_user_id_value);
105
-		if($course_admin_id instanceof WSError) {
105
+		if ($course_admin_id instanceof WSError) {
106 106
 			return $course_admin_id;
107 107
 		}
108
-		if($wanted_code == '') {
108
+		if ($wanted_code == '') {
109 109
 			$wanted_code = CourseManager::generate_course_code($title);
110 110
 		}
111 111
 		$result = create_course($wanted_code, $title, $tutor_name, $category_code, $language, $course_admin_id, $this->_configuration['db_prefix'], 0);
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 			return new WSError(202, 'There was an error creating the course');
114 114
 		} else {
115 115
 			// Update extra fields
116
-			foreach($extras_associative as $fname => $fvalue) {
116
+			foreach ($extras_associative as $fname => $fvalue) {
117 117
 				CourseManager::update_course_extra_field_value($result, $fname, $fvalue);
118 118
 			}
119 119
 			// Get course id
@@ -141,11 +141,11 @@  discard block
 block discarded – undo
141 141
 	public function CreateCourse($secret_key, $title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) {
142 142
 		// First, verify the secret key
143 143
 		$verifKey = $this->verifyKey($secret_key);
144
-		if($verifKey instanceof WSError) {
144
+		if ($verifKey instanceof WSError) {
145 145
 			$this->handleError($verifKey);
146 146
 		} else {
147 147
 			$result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras);
148
-			if($result instanceof WSError) {
148
+			if ($result instanceof WSError) {
149 149
 				$this->handleError($result);
150 150
 			} else {
151 151
 				return $result;
@@ -163,17 +163,17 @@  discard block
 block discarded – undo
163 163
 	public function CreateCourses($secret_key, $courses) {
164 164
 		// First, verify the secret key
165 165
 		$verifKey = $this->verifyKey($secret_key);
166
-		if($verifKey instanceof WSCMError) {
166
+		if ($verifKey instanceof WSCMError) {
167 167
 			$this->handleError($verifKey);
168 168
 		} else {
169 169
 			$results = array();
170
-			foreach($courses as $course) {
170
+			foreach ($courses as $course) {
171 171
 				$result_tmp = array();
172 172
 				//reinitialize variables just in case
173 173
 				$title = $category_code = $wanted_code = $tutor_name = $course_admin_user_id_field_name = $course_admin_user_id_value = $language = $course_id_field_name = $course_id_value = $extras = null;
174 174
 				extract($course);
175 175
 				$result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras);
176
-				if($result instanceof WSCMError) {
176
+				if ($result instanceof WSCMError) {
177 177
 					$result_tmp['result'] = $result->toArray();
178 178
 					$result_tmp['course_id_value'] = $course_id_value;
179 179
 					$result_tmp['course_id_generated'] = 0;
@@ -207,47 +207,47 @@  discard block
 block discarded – undo
207 207
 	 */
208 208
 	protected function editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) {
209 209
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
210
-		if($course_id instanceof WSCMError) {
210
+		if ($course_id instanceof WSCMError) {
211 211
 			return $course_id;
212 212
 		} else {
213 213
 			$attributes = array();
214
-			if(!empty($title)) {
214
+			if (!empty($title)) {
215 215
 				$attributes['title'] = $title;
216 216
 			}
217
-			if(!empty($category_code)) {
217
+			if (!empty($category_code)) {
218 218
 				$attributes['category_code'] = $category_code;
219 219
 			}
220
-			if(!empty($department_name)) {
220
+			if (!empty($department_name)) {
221 221
 				$attributes['department_name'] = $department_name;
222 222
 			}
223
-			if(!empty($department_url)) {
223
+			if (!empty($department_url)) {
224 224
 				$attributes['department_url'] = $department_url;
225 225
 			}
226
-			if(!empty($language)) {
226
+			if (!empty($language)) {
227 227
 				$attributes['course_language'] = $language;
228 228
 			}
229
-			if($visibility != '') {
230
-				$attributes['visibility'] = (int)$visibility;
229
+			if ($visibility != '') {
230
+				$attributes['visibility'] = (int) $visibility;
231 231
 			}
232
-			if($subscribe != '') {
233
-				$attributes['subscribe'] = (int)$subscribe;
232
+			if ($subscribe != '') {
233
+				$attributes['subscribe'] = (int) $subscribe;
234 234
 			}
235
-			if($unsubscribe != '') {
236
-				$attributes['unsubscribe'] = (int)$unsubscribe;
235
+			if ($unsubscribe != '') {
236
+				$attributes['unsubscribe'] = (int) $unsubscribe;
237 237
 			}
238
-			if(!empty($visual_code)) {
238
+			if (!empty($visual_code)) {
239 239
 				$attributes['visual_code'] = $visual_code;
240 240
 			}
241
-			if(!empty($attributes)) {
241
+			if (!empty($attributes)) {
242 242
 				CourseManager::update_attributes($course_id, $attributes);
243 243
 			}
244
-			if(!empty($extras)) {
244
+			if (!empty($extras)) {
245 245
 				$course_code = CourseManager::get_course_code_from_course_id($course_id);
246 246
 				$extras_associative = array();
247
-				foreach($extras as $extra) {
247
+				foreach ($extras as $extra) {
248 248
 					$extras_associative[$extra['field_name']] = $extra['field_value'];
249 249
 				}
250
-				foreach($extras_associative as $fname => $fvalue) {
250
+				foreach ($extras_associative as $fname => $fvalue) {
251 251
 					CourseManager::update_extra_field_value($course_code, $fname, $fvalue);
252 252
 				}
253 253
 			}
@@ -274,11 +274,11 @@  discard block
 block discarded – undo
274 274
 	 */
275 275
 	public function EditCourse($secret_key, $course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) {
276 276
 		$verifKey = $this->verifyKey($secret_key);
277
-		if($verifKey instanceof WSCMError) {
277
+		if ($verifKey instanceof WSCMError) {
278 278
 			$this->handleError($verifKey);
279 279
 		} else {
280 280
 			$result = $this->editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras);
281
-			if($result instanceof WSCMError) {
281
+			if ($result instanceof WSCMError) {
282 282
 				$this->handleError($result);
283 283
 			}
284 284
 		}
@@ -294,14 +294,14 @@  discard block
 block discarded – undo
294 294
 	 */
295 295
 	public function ListCourses($secret_key, $course_id_field_name) {
296 296
 		$verifKey = $this->verifyKey($secret_key);
297
-		if($verifKey instanceof WSError) {
297
+		if ($verifKey instanceof WSError) {
298 298
 			$this->handleError($verifKey);
299 299
 		} else {
300 300
 			$courses_result = array();
301 301
 			$category_names = array();
302 302
 
303 303
 			$courses = CourseManager::get_courses_list();
304
-			foreach($courses as $course) {
304
+			foreach ($courses as $course) {
305 305
 				$course_tmp = array();
306 306
 				$course_tmp['id'] = $course['id'];
307 307
 				$course_tmp['code'] = $course['code'];
@@ -310,7 +310,7 @@  discard block
 block discarded – undo
310 310
 				$course_tmp['visibility'] = $course['visibility'];
311 311
 
312 312
 				// Determining category name
313
-				if($category_names[$course['category_code']]) {
313
+				if ($category_names[$course['category_code']]) {
314 314
 					$course_tmp['category_name'] = $category_names[$course['category_code']];
315 315
 				} else {
316 316
 					$category = CourseManager::get_course_category($course['category_code']);
@@ -346,21 +346,21 @@  discard block
 block discarded – undo
346 346
 	 */
347 347
 	protected function changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $state, $status = STUDENT) {
348 348
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
349
-		if($course_id instanceof WSError) {
349
+		if ($course_id instanceof WSError) {
350 350
 			return $course_id;
351 351
 		} else {
352 352
 			$user_id = $this->getUserId($user_id_field_name, $user_id_value);
353
-			if($user_id instanceof WSError) {
353
+			if ($user_id instanceof WSError) {
354 354
 				return $user_id;
355 355
 			} else {
356 356
 				$course_code = CourseManager::get_course_code_from_course_id($course_id);
357
-				if($state == 0) {
357
+				if ($state == 0) {
358 358
 					// Unsubscribe user
359 359
 					CourseManager::unsubscribe_user($user_id, $course_code);
360 360
 					return true;
361 361
 				} else {
362 362
 					// Subscribe user
363
-					if(CourseManager::subscribe_user($user_id, $course_code, $status)) {
363
+					if (CourseManager::subscribe_user($user_id, $course_code, $status)) {
364 364
 						return true;
365 365
 					} else {
366 366
 						return new WSError(203, 'An error occured subscribing to this course');
@@ -382,11 +382,11 @@  discard block
 block discarded – undo
382 382
 	 */
383 383
 	public function SubscribeUserToCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $status) {
384 384
 		$verifKey = $this->verifyKey($secret_key);
385
-		if($verifKey instanceof WSError) {
385
+		if ($verifKey instanceof WSError) {
386 386
 			$this->handleError($verifKey);
387 387
 		} else {
388 388
 			$result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 1, $status);
389
-			if($result instanceof WSError) {
389
+			if ($result instanceof WSError) {
390 390
 				$this->handleError($result);
391 391
 			}
392 392
 		}
@@ -403,11 +403,11 @@  discard block
 block discarded – undo
403 403
 	 */
404 404
 	public function UnsubscribeUserFromCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value) {
405 405
 		$verifKey = $this->verifyKey($secret_key);
406
-		if($verifKey instanceof WSError) {
406
+		if ($verifKey instanceof WSError) {
407 407
 			$this->handleError($verifKey);
408 408
 		} else {
409 409
 			$result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 0);
410
-			if($result instanceof WSError) {
410
+			if ($result instanceof WSError) {
411 411
 				$this->handleError($result);
412 412
 			}
413 413
 		}
@@ -423,17 +423,17 @@  discard block
 block discarded – undo
423 423
 	 */
424 424
 	public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) {
425 425
 		$verifKey = $this->verifyKey($secret_key);
426
-		if($verifKey instanceof WSError) {
426
+		if ($verifKey instanceof WSError) {
427 427
 			$this->handleError($verifKey);
428 428
 		} else {
429 429
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
430
-			if($course_id instanceof WSError) {
430
+			if ($course_id instanceof WSError) {
431 431
 				return $course_id;
432 432
 			} else {
433 433
 				// Course exists, get its descriptions
434 434
 				$descriptions = CourseDescription::get_descriptions($course_id);
435 435
 				$results = array();
436
-				foreach($descriptions as $description) {
436
+				foreach ($descriptions as $description) {
437 437
 					$results[] = array('course_desc_id' => $description->get_description_type(),
438 438
 						'course_desc_title' => $description->get_title(),
439 439
 						'course_desc_content' => $description->get_content());
@@ -456,11 +456,11 @@  discard block
 block discarded – undo
456 456
 	 */
457 457
 	public function EditCourseDescription($secret_key, $course_id_field_name, $course_id_value, $course_desc_id, $course_desc_title, $course_desc_content) {
458 458
 		$verifKey = $this->verifyKey($secret_key);
459
-		if($verifKey instanceof WSError) {
459
+		if ($verifKey instanceof WSError) {
460 460
 			$this->handleError($verifKey);
461 461
 		} else {
462 462
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
463
-			if($course_id instanceof WSError) {
463
+			if ($course_id instanceof WSError) {
464 464
 				return $course_id;
465 465
 			} else {
466 466
 				// Create the new course description
@@ -477,8 +477,8 @@  discard block
 block discarded – undo
477 477
 				// Check if this course description exists
478 478
 				$descriptions = CourseDescription::get_descriptions($course_id);
479 479
 				$exists = false;
480
-				foreach($descriptions as $description) {
481
-					if($description->get_description_type() == $course_desc_id) {
480
+				foreach ($descriptions as $description) {
481
+					if ($description->get_description_type() == $course_desc_id) {
482 482
 						$exists = true;
483 483
 					}
484 484
 				}
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 	}
495 495
 	public function unreadMessage($username, $password)
496 496
 	{
497
-		if($this->verifyUserPass($username, $password) == "valid")
497
+		if ($this->verifyUserPass($username, $password) == "valid")
498 498
 		{
499 499
 			$table_message = Database::get_main_table(TABLE_MESSAGE);
500 500
 			$user_id = UserManager::get_user_id_from_username($username);
@@ -511,7 +511,7 @@  discard block
 block discarded – undo
511 511
 
512 512
 	public function get_message_data($username, $password)
513 513
 	{
514
-		if($this->verifyUserPass($username, $password) == "valid")
514
+		if ($this->verifyUserPass($username, $password) == "valid")
515 515
 		{
516 516
 			$user_id = get_user_id_from_username($username);
517 517
 
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
 
522 522
 	public function nada($username, $password)
523 523
 	{
524
-		if($this->verifyUserPass($username, $password) == "valid")
524
+		if ($this->verifyUserPass($username, $password) == "valid")
525 525
 			return $username.$password;
526 526
 		return $username;
527 527
 	}
Please login to merge, or discard this patch.
main/webservices/webservice_course.php 1 patch
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 	 */
22 22
 	protected function deleteCourseHelper($course_id_field_name, $course_id_value) {
23 23
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
24
-		if($course_id instanceof WSError) {
24
+		if ($course_id instanceof WSError) {
25 25
 			return $course_id;
26 26
 		} else {
27 27
 			$course_code = CourseManager::get_course_code_from_course_id($course_id);
@@ -39,11 +39,11 @@  discard block
 block discarded – undo
39 39
 	 */
40 40
 	public function DeleteCourse($secret_key, $course_id_field_name, $course_id_value) {
41 41
 		$verifKey = $this->verifyKey($secret_key);
42
-		if($verifKey instanceof WSError) {
42
+		if ($verifKey instanceof WSError) {
43 43
 			$this->handleError($verifKey);
44 44
 		} else {
45 45
 			$result = $this->deleteCourseHelper($course_id_field_name, $course_id_value);
46
-			if($result instanceof WSError) {
46
+			if ($result instanceof WSError) {
47 47
 				$this->handleError($result);
48 48
 			}
49 49
 		}
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 	 */
60 60
 	public function DeleteCourses($secret_key, $courses) {
61 61
 		$verifKey = $this->verifyKey($secret_key);
62
-		if($verifKey instanceof WSError) {
62
+		if ($verifKey instanceof WSError) {
63 63
 			$this->handleError($verifKey);
64 64
 		} else {
65 65
 			$results = array();
66
-			foreach($courses as $course) {
66
+			foreach ($courses as $course) {
67 67
 				$result_tmp = array();
68 68
 				$result_op = $this->deleteCourseHelper($course['course_id_field_name'], $course['course_id_value']);
69 69
 				$result_tmp['course_id_value'] = $course['course_id_value'];
70
-				if($result_op instanceof WSError) {
70
+				if ($result_op instanceof WSError) {
71 71
 					// Return the error in the results
72 72
 					$result_tmp['result'] = $result_op->toArray();
73 73
 				} else {
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
 	protected function createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) {
98 98
 		// Add the original course id field name and value to the extra fields if needed
99 99
 		$extras_associative = array();
100
-		if($course_id_field_name != "chamilo_course_id") {
100
+		if ($course_id_field_name != "chamilo_course_id") {
101 101
 			$extras_associative[$course_id_field_name] = $course_id_value;
102 102
 		}
103
-		foreach($extras as $extra) {
103
+		foreach ($extras as $extra) {
104 104
 			$extras_associative[$extra['field_name']] = $extra['field_value'];
105 105
 		}
106 106
 		$course_admin_id = $this->getUserId($course_admin_user_id_field_name, $course_admin_user_id_value);
107
-		if($course_admin_id instanceof WSError) {
107
+		if ($course_admin_id instanceof WSError) {
108 108
 			return $course_admin_id;
109 109
 		}
110
-		if($wanted_code == '') {
110
+		if ($wanted_code == '') {
111 111
 			$wanted_code = CourseManager::generate_course_code($title);
112 112
 		}
113 113
 		$result = create_course($wanted_code, $title, $tutor_name, $category_code, $language, $course_admin_id, $this->_configuration['db_prefix'], 0);
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
 			return new WSError(202, 'There was an error creating the course');
116 116
 		} else {
117 117
 			// Update extra fields
118
-			foreach($extras_associative as $fname => $fvalue) {
118
+			foreach ($extras_associative as $fname => $fvalue) {
119 119
 				CourseManager::update_course_extra_field_value($result, $fname, $fvalue);
120 120
 			}
121 121
 			// Get course id
@@ -143,11 +143,11 @@  discard block
 block discarded – undo
143 143
 	public function CreateCourse($secret_key, $title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras) {
144 144
 		// First, verify the secret key
145 145
 		$verifKey = $this->verifyKey($secret_key);
146
-		if($verifKey instanceof WSError) {
146
+		if ($verifKey instanceof WSError) {
147 147
 			$this->handleError($verifKey);
148 148
 		} else {
149 149
 			$result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras);
150
-			if($result instanceof WSError) {
150
+			if ($result instanceof WSError) {
151 151
 				$this->handleError($result);
152 152
 			} else {
153 153
 				return $result;
@@ -165,17 +165,17 @@  discard block
 block discarded – undo
165 165
 	public function CreateCourses($secret_key, $courses) {
166 166
 		// First, verify the secret key
167 167
 		$verifKey = $this->verifyKey($secret_key);
168
-		if($verifKey instanceof WSError) {
168
+		if ($verifKey instanceof WSError) {
169 169
 			$this->handleError($verifKey);
170 170
 		} else {
171 171
 			$results = array();
172
-			foreach($courses as $course) {
172
+			foreach ($courses as $course) {
173 173
 				$result_tmp = array();
174 174
                 // re-initialize variables just in case
175 175
                 $title = $category_code = $wanted_code = $tutor_name = $course_admin_user_id_field_name = $course_admin_user_id_value = $language = $course_id_field_name = $course_id_value = $extras = 0;
176 176
 				extract($course);
177 177
 				$result = $this->createCourseHelper($title, $category_code, $wanted_code, $tutor_name, $course_admin_user_id_field_name, $course_admin_user_id_value, $language, $course_id_field_name, $course_id_value, $extras);
178
-				if($result instanceof WSError) {
178
+				if ($result instanceof WSError) {
179 179
 					$result_tmp['result'] = $result->toArray();
180 180
 					$result_tmp['course_id_value'] = $course_id_value;
181 181
 					$result_tmp['course_id_generated'] = 0;
@@ -209,47 +209,47 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	protected function editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) {
211 211
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
212
-		if($course_id instanceof WSError) {
212
+		if ($course_id instanceof WSError) {
213 213
 			return $course_id;
214 214
 		} else {
215 215
 			$attributes = array();
216
-			if(!empty($title)) {
216
+			if (!empty($title)) {
217 217
 				$attributes['title'] = $title;
218 218
 			}
219
-			if(!empty($category_code)) {
219
+			if (!empty($category_code)) {
220 220
 				$attributes['category_code'] = $category_code;
221 221
 			}
222
-			if(!empty($department_name)) {
222
+			if (!empty($department_name)) {
223 223
 				$attributes['department_name'] = $department_name;
224 224
 			}
225
-			if(!empty($department_url)) {
225
+			if (!empty($department_url)) {
226 226
 				$attributes['department_url'] = $department_url;
227 227
 			}
228
-			if(!empty($language)) {
228
+			if (!empty($language)) {
229 229
 				$attributes['course_language'] = $language;
230 230
 			}
231
-			if($visibility != '') {
232
-				$attributes['visibility'] = (int)$visibility;
231
+			if ($visibility != '') {
232
+				$attributes['visibility'] = (int) $visibility;
233 233
 			}
234
-			if($subscribe != '') {
235
-				$attributes['subscribe'] = (int)$subscribe;
234
+			if ($subscribe != '') {
235
+				$attributes['subscribe'] = (int) $subscribe;
236 236
 			}
237
-			if($unsubscribe != '') {
238
-				$attributes['unsubscribe'] = (int)$unsubscribe;
237
+			if ($unsubscribe != '') {
238
+				$attributes['unsubscribe'] = (int) $unsubscribe;
239 239
 			}
240
-			if(!empty($visual_code)) {
240
+			if (!empty($visual_code)) {
241 241
 				$attributes['visual_code'] = $visual_code;
242 242
 			}
243
-			if(!empty($attributes)) {
243
+			if (!empty($attributes)) {
244 244
 				CourseManager::update_attributes($course_id, $attributes);
245 245
 			}
246
-			if(!empty($extras)) {
246
+			if (!empty($extras)) {
247 247
 				$course_code = CourseManager::get_course_code_from_course_id($course_id);
248 248
 				$extras_associative = array();
249
-				foreach($extras as $extra) {
249
+				foreach ($extras as $extra) {
250 250
 					$extras_associative[$extra['field_name']] = $extra['field_value'];
251 251
 				}
252
-				foreach($extras_associative as $fname => $fvalue) {
252
+				foreach ($extras_associative as $fname => $fvalue) {
253 253
 					CourseManager::update_extra_field_value($course_code, $fname, $fvalue);
254 254
 				}
255 255
 			}
@@ -276,11 +276,11 @@  discard block
 block discarded – undo
276 276
 	 */
277 277
 	public function EditCourse($secret_key, $course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras) {
278 278
 		$verifKey = $this->verifyKey($secret_key);
279
-		if($verifKey instanceof WSError) {
279
+		if ($verifKey instanceof WSError) {
280 280
 			$this->handleError($verifKey);
281 281
 		} else {
282 282
 			$result = $this->editCourseHelper($course_id_field_name, $course_id_value, $title, $category_code, $department_name, $department_url, $language, $visibility, $subscribe, $unsubscribe, $visual_code, $extras);
283
-			if($result instanceof WSError) {
283
+			if ($result instanceof WSError) {
284 284
 				$this->handleError($result);
285 285
 			}
286 286
 		}
@@ -296,10 +296,10 @@  discard block
 block discarded – undo
296 296
 	 */
297 297
 	public function ListCourses($secret_key, $visibility = 'public,public-registered,private,closed') {
298 298
 		$verifKey = $this->verifyKey($secret_key);
299
-		if($verifKey instanceof WSError) {
299
+		if ($verifKey instanceof WSError) {
300 300
 			$this->handleError($verifKey);
301 301
 		} else {
302
-            $visibilities = split(',',$visibility);
302
+            $visibilities = split(',', $visibility);
303 303
             $vis = array('public' => '3', 'public-registered' => '2', 'private' => '1', 'closed' => '0');
304 304
             foreach ($visibilities as $p => $visibility) {
305 305
                 $visibilities[$p] = $vis[$visibility];
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
 			$category_names = array();
309 309
 
310 310
 			$courses = CourseManager::get_courses_list();
311
-			foreach($courses as $course) {
311
+			foreach ($courses as $course) {
312 312
                 //skip elements that do not match required visibility
313
-                if (!in_array($course['visibility'],$visibilities)) { continue; }
313
+                if (!in_array($course['visibility'], $visibilities)) { continue; }
314 314
 				$course_tmp = array();
315 315
 				$course_tmp['id'] = $course['id'];
316 316
 				$course_tmp['code'] = $course['code'];
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
 				$course_tmp['visibility'] = $course['visibility'];
320 320
 
321 321
 				// Determining category name
322
-				if($category_names[$course['category_code']]) {
322
+				if ($category_names[$course['category_code']]) {
323 323
 					$course_tmp['category_name'] = $category_names[$course['category_code']];
324 324
 				} else {
325 325
 					$category = CourseManager::get_course_category($course['category_code']);
@@ -355,21 +355,21 @@  discard block
 block discarded – undo
355 355
 	 */
356 356
 	protected function changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $state, $status = STUDENT) {
357 357
 		$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
358
-		if($course_id instanceof WSError) {
358
+		if ($course_id instanceof WSError) {
359 359
 			return $course_id;
360 360
 		} else {
361 361
 			$user_id = $this->getUserId($user_id_field_name, $user_id_value);
362
-			if($user_id instanceof WSError) {
362
+			if ($user_id instanceof WSError) {
363 363
 				return $user_id;
364 364
 			} else {
365 365
 				$course_code = CourseManager::get_course_code_from_course_id($course_id);
366
-				if($state == 0) {
366
+				if ($state == 0) {
367 367
 					// Unsubscribe user
368 368
 					CourseManager::unsubscribe_user($user_id, $course_code);
369 369
 					return true;
370 370
 				} else {
371 371
 					// Subscribe user
372
-					if(CourseManager::subscribe_user($user_id, $course_code, $status)) {
372
+					if (CourseManager::subscribe_user($user_id, $course_code, $status)) {
373 373
 						return true;
374 374
 					} else {
375 375
 						return new WSError(203, 'An error occured subscribing to this course');
@@ -391,11 +391,11 @@  discard block
 block discarded – undo
391 391
 	 */
392 392
 	public function SubscribeUserToCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, $status) {
393 393
 		$verifKey = $this->verifyKey($secret_key);
394
-		if($verifKey instanceof WSError) {
394
+		if ($verifKey instanceof WSError) {
395 395
 			$this->handleError($verifKey);
396 396
 		} else {
397 397
 			$result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 1, $status);
398
-			if($result instanceof WSError) {
398
+			if ($result instanceof WSError) {
399 399
 				$this->handleError($result);
400 400
 			}
401 401
 		}
@@ -412,11 +412,11 @@  discard block
 block discarded – undo
412 412
 	 */
413 413
 	public function UnsubscribeUserFromCourse($secret_key, $course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value) {
414 414
 		$verifKey = $this->verifyKey($secret_key);
415
-		if($verifKey instanceof WSError) {
415
+		if ($verifKey instanceof WSError) {
416 416
 			$this->handleError($verifKey);
417 417
 		} else {
418 418
 			$result = $this->changeUserSubscription($course_id_field_name, $course_id_value, $user_id_field_name, $user_id_value, 0);
419
-			if($result instanceof WSError) {
419
+			if ($result instanceof WSError) {
420 420
 				$this->handleError($result);
421 421
 			}
422 422
 		}
@@ -432,17 +432,17 @@  discard block
 block discarded – undo
432 432
 	 */
433 433
 	public function GetCourseDescriptions($secret_key, $course_id_field_name, $course_id_value) {
434 434
 		$verifKey = $this->verifyKey($secret_key);
435
-		if($verifKey instanceof WSError) {
435
+		if ($verifKey instanceof WSError) {
436 436
 			$this->handleError($verifKey);
437 437
 		} else {
438 438
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
439
-			if($course_id instanceof WSError) {
439
+			if ($course_id instanceof WSError) {
440 440
 				return $course_id;
441 441
 			} else {
442 442
 				// Course exists, get its descriptions
443 443
 				$descriptions = CourseDescription::get_descriptions($course_id);
444 444
 				$results = array();
445
-				foreach($descriptions as $description) {
445
+				foreach ($descriptions as $description) {
446 446
 					$results[] = array('course_desc_id' => $description->get_description_type(),
447 447
 										'course_desc_title' => $description->get_title(),
448 448
 										'course_desc_content' => $description->get_content());
@@ -465,11 +465,11 @@  discard block
 block discarded – undo
465 465
 	 */
466 466
 	public function EditCourseDescription($secret_key, $course_id_field_name, $course_id_value, $course_desc_id, $course_desc_title, $course_desc_content) {
467 467
 		$verifKey = $this->verifyKey($secret_key);
468
-		if($verifKey instanceof WSError) {
468
+		if ($verifKey instanceof WSError) {
469 469
 			$this->handleError($verifKey);
470 470
 		} else {
471 471
 			$course_id = $this->getCourseId($course_id_field_name, $course_id_value);
472
-			if($course_id instanceof WSError) {
472
+			if ($course_id instanceof WSError) {
473 473
 				return $course_id;
474 474
 			} else {
475 475
 				// Create the new course description
@@ -484,8 +484,8 @@  discard block
 block discarded – undo
484 484
 				// Check if this course description exists
485 485
 				$descriptions = CourseDescription::get_descriptions($course_id);
486 486
 				$exists = false;
487
-				foreach($descriptions as $description) {
488
-					if($description->get_description_type() == $course_desc_id) {
487
+				foreach ($descriptions as $description) {
488
+					if ($description->get_description_type() == $course_desc_id) {
489 489
 						$exists = true;
490 490
 					}
491 491
 				}
Please login to merge, or discard this patch.
main/ticket/categories.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
         $form = TicketManager::getCategoryForm($url, $projectId);
64 64
         $formToString = $form->returnForm();
65 65
         if ($form->validate()) {
66
-            $values =$form->getSubmitValues();
66
+            $values = $form->getSubmitValues();
67 67
 
68 68
             $params = [
69 69
                 'name' => $values['name'],
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
         $form->setDefaults($cat);
96 96
         $formToString = $form->returnForm();
97 97
         if ($form->validate()) {
98
-            $values =$form->getSubmitValues();
98
+            $values = $form->getSubmitValues();
99 99
 
100 100
             $params = [
101 101
                 'name' => $values['name'],
Please login to merge, or discard this patch.
main/admin/subscribe_user2course.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 
31 31
 /* Header */
32 32
 $tool_name = get_lang('AddUsersToACourse');
33
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
33
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
34 34
 
35 35
 $htmlHeadXtra[] = '<script>
36 36
 function validate_filter() {
@@ -142,12 +142,12 @@  discard block
 block discarded – undo
142 142
                 if (isset($_POST[$varname]) && $_POST[$varname] != '0') {
143 143
                     $use_extra_fields = true;
144 144
                     if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
145
-                        $extra_field_result[]= UserManager::get_extra_user_data_by_tags(
145
+                        $extra_field_result[] = UserManager::get_extra_user_data_by_tags(
146 146
                             intval($_POST['field_id']),
147 147
                             $_POST[$varname]
148 148
                         );
149 149
                     } else {
150
-                        $extra_field_result[]= UserManager::get_extra_user_data_by_value(
150
+                        $extra_field_result[] = UserManager::get_extra_user_data_by_value(
151 151
                             $new_field['variable'],
152 152
                             $_POST[$varname]
153 153
                         );
@@ -163,8 +163,8 @@  discard block
 block discarded – undo
163 163
     $final_result = array();
164 164
     if (count($extra_field_result) > 1) {
165 165
         for ($i = 0; $i < count($extra_field_result) - 1; $i++) {
166
-            if (is_array($extra_field_result[$i+1])) {
167
-                $final_result  = array_intersect($extra_field_result[$i], $extra_field_result[$i+1]);
166
+            if (is_array($extra_field_result[$i + 1])) {
167
+                $final_result = array_intersect($extra_field_result[$i], $extra_field_result[$i + 1]);
168 168
             }
169 169
         }
170 170
     } else {
@@ -172,14 +172,14 @@  discard block
 block discarded – undo
172 172
     }
173 173
 
174 174
     if (api_is_multiple_url_enabled()) {
175
-        if (is_array($final_result) && count($final_result)>0) {
176
-            $where_filter = " AND u.user_id IN  ('".implode("','",$final_result)."') ";
175
+        if (is_array($final_result) && count($final_result) > 0) {
176
+            $where_filter = " AND u.user_id IN  ('".implode("','", $final_result)."') ";
177 177
         } else {
178 178
             //no results
179 179
             $where_filter = " AND u.user_id  = -1";
180 180
         }
181 181
     } else {
182
-        if (is_array($final_result) && count($final_result)>0) {
182
+        if (is_array($final_result) && count($final_result) > 0) {
183 183
             $where_filter = " AND user_id IN  ('".implode("','", $final_result)."') ";
184 184
         } else {
185 185
             //no results
@@ -200,10 +200,10 @@  discard block
 block discarded – undo
200 200
 $sql = "SELECT user_id, lastname, firstname, username, official_code
201 201
         FROM $tbl_user
202 202
         WHERE user_id<>2 AND ".$target_name." LIKE '".$first_letter_user."%' $where_filter
203
-        ORDER BY ". (count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy;
203
+        ORDER BY ".(count($users) > 0 ? "(user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy;
204 204
 
205 205
 if (api_is_multiple_url_enabled()) {
206
-    $tbl_user_rel_access_url= Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
206
+    $tbl_user_rel_access_url = Database::get_main_table(TABLE_MAIN_ACCESS_URL_REL_USER);
207 207
     $access_url_id = api_get_current_access_url_id();
208 208
     if ($access_url_id != -1) {
209 209
         $sql = "SELECT u.user_id,lastname,firstname,username, official_code
@@ -215,7 +215,7 @@  discard block
 block discarded – undo
215 215
                     access_url_id =  $access_url_id AND
216 216
                     (".$target_name." LIKE '".$first_letter_user."%' )
217 217
                     $where_filter
218
-                ORDER BY ". (count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy;
218
+                ORDER BY ".(count($users) > 0 ? "(u.user_id IN(".implode(',', $users).")) DESC," : "")." ".$orderBy;
219 219
     }
220 220
 }
221 221
 
@@ -258,8 +258,8 @@  discard block
 block discarded – undo
258 258
             $fieldtype = $new_field['type'];
259 259
             echo '&nbsp;<select name="'.$varname.'">';
260 260
             echo '<option value="0">--'.get_lang('Select').'--</option>';
261
-            foreach	($new_field['data'] as $option) {
262
-                $checked='';
261
+            foreach ($new_field['data'] as $option) {
262
+                $checked = '';
263 263
                 if ($fieldtype == ExtraField::FIELD_TYPE_TAG) {
264 264
                     if (isset($_POST[$varname])) {
265 265
                         if ($_POST[$varname] == $option['tag']) {
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
     <td width="40%" align="center">
318 318
      <select name="UserList[]" multiple="multiple" size="20" style="width:300px;">
319 319
     <?php foreach ($db_users as $user) { ?>
320
-          <option value="<?php echo $user['user_id']; ?>" <?php if(in_array($user['user_id'],$users)) echo 'selected="selected"'; ?>>
320
+          <option value="<?php echo $user['user_id']; ?>" <?php if (in_array($user['user_id'], $users)) echo 'selected="selected"'; ?>>
321 321
       <?php
322 322
         $userName = api_get_person_name($user['firstname'], $user['lastname']).' ('.$user['username'].')';
323 323
         if ($showOfficialCode) {
@@ -338,7 +338,7 @@  discard block
 block discarded – undo
338 338
    <td width="40%" align="center">
339 339
     <select name="CourseList[]" multiple="multiple" size="20" style="width:300px;">
340 340
     <?php foreach ($db_courses as $course) { ?>
341
-         <option value="<?php echo $course['code']; ?>" <?php if(in_array($course['code'],$courses)) echo 'selected="selected"'; ?>>
341
+         <option value="<?php echo $course['code']; ?>" <?php if (in_array($course['code'], $courses)) echo 'selected="selected"'; ?>>
342 342
              <?php echo '('.$course['visual_code'].') '.$course['title']; ?>
343 343
          </option>
344 344
     <?php } ?>
Please login to merge, or discard this patch.
main/course_progress/thematic_advance.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
     $form = new FormValidator(
23 23
         'thematic_advance',
24 24
         'POST',
25
-        api_get_self() . '?' . api_get_cidreq()
25
+        api_get_self().'?'.api_get_cidreq()
26 26
     );
27 27
     $form->addElement('header', $header_form);
28 28
     //$form->addElement('hidden', 'thematic_advance_token',$token);
@@ -191,7 +191,7 @@  discard block
 block discarded – undo
191 191
 
192 192
         $thematic = new Thematic();
193 193
         $thematic->set_thematic_advance_attributes(
194
-            isset($values['thematic_advance_id']) ? $values['thematic_advance_id']: null,
194
+            isset($values['thematic_advance_id']) ? $values['thematic_advance_id'] : null,
195 195
             $values['thematic_id'],
196 196
             $values['start_date_type'] == 1 && isset($values['attendance_select']) ? $values['attendance_select'] : 0,
197 197
             $values['content'],
@@ -210,13 +210,13 @@  discard block
 block discarded – undo
210 210
             }
211 211
         }
212 212
 
213
-        $redirectUrlParams = 'course_progress/index.php?' .  api_get_cidreq() . '&' .
213
+        $redirectUrlParams = 'course_progress/index.php?'.api_get_cidreq().'&'.
214 214
             http_build_query([
215 215
                 'action' => 'thematic_advance_list',
216 216
                 'thematic_id' => $values['thematic_id']
217 217
             ]);
218 218
 
219
-        header('Location: ' . api_get_path(WEB_CODE_PATH) . $redirectUrlParams);
219
+        header('Location: '.api_get_path(WEB_CODE_PATH).$redirectUrlParams);
220 220
         exit;
221 221
     }
222 222
 
@@ -226,10 +226,10 @@  discard block
 block discarded – undo
226 226
     // thematic advance list
227 227
     echo '<div class="actions">';
228 228
     echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=thematic_details">'.
229
-            Display::return_icon('back.png', get_lang("BackTo"),'',ICON_SIZE_MEDIUM).'</a>';
229
+            Display::return_icon('back.png', get_lang("BackTo"), '', ICON_SIZE_MEDIUM).'</a>';
230 230
     if (api_is_allowed_to_edit(false, true)) {
231 231
         echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&amp;action=thematic_advance_add&amp;thematic_id='.$thematic_id.'"> '.
232
-            Display::return_icon('add.png', get_lang('NewThematicAdvance'),'',ICON_SIZE_MEDIUM).'</a>';
232
+            Display::return_icon('add.png', get_lang('NewThematicAdvance'), '', ICON_SIZE_MEDIUM).'</a>';
233 233
     }
234 234
     echo '</div>';
235 235
     $table = new SortableTable(
Please login to merge, or discard this patch.