Completed
Push — 1.11.x ( 7ffd51...902ebd )
by José
50:21 queued 21:28
created
plugin/sepe/src/sepe-administration-menu.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 $title = $plugin->get_lang('AdministratorSepe');
16 16
 $pluginPath = api_get_path(WEB_PLUGIN_PATH).'sepe/src/';
17 17
 
18
-if (api_is_platform_admin() && $enable) {
18
+if (api_is_platform_admin() && $enable) {
19 19
     $htmlText = '';
20 20
     $htmlText .= '<div class="panel panel-default">';
21 21
         $htmlText .= '<div class="panel-heading" role="tab">';
@@ -56,6 +56,6 @@  discard block
 block discarded – undo
56 56
     $content = $tpl->fetch($listing_tpl);
57 57
     $tpl->assign('content', $content);
58 58
     $tpl->display_one_col_template();
59
-} else {
59
+} else {
60 60
     header('Location:'.api_get_path(WEB_PATH));
61 61
 }
Please login to merge, or discard this patch.
plugin/sepe/src/formative-actions-list.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,16 +10,16 @@  discard block
 block discarded – undo
10 10
 
11 11
 $plugin = SepePlugin::create();
12 12
 
13
-if (api_is_platform_admin()) {
13
+if (api_is_platform_admin()) {
14 14
     $templateName = $plugin->get_lang('FormativesActionsList');
15 15
     $interbreadcrumb[] = array("url" => "/plugin/sepe/src/sepe-administration-menu.php", "name" => $plugin->get_lang('MenuSepe'));
16 16
     $tpl = new Template($templateName);
17 17
     
18
-    if (isset($_SESSION['sepe_message_info'])) {
18
+    if (isset($_SESSION['sepe_message_info'])) {
19 19
         $tpl->assign('message_info', $_SESSION['sepe_message_info']);    
20 20
         unset($_SESSION['sepe_message_info']);
21 21
     }
22
-    if (isset($_SESSION['sepe_message_error'])) {
22
+    if (isset($_SESSION['sepe_message_error'])) {
23 23
         $tpl->assign('message_error', $_SESSION['sepe_message_error']);    
24 24
         unset($_SESSION['sepe_message_error']);
25 25
     }
@@ -35,6 +35,6 @@  discard block
 block discarded – undo
35 35
     $content = $tpl->fetch($listing_tpl);
36 36
     $tpl->assign('content', $content);
37 37
     $tpl->display_one_col_template();
38
-} else {
38
+} else {
39 39
     header('Location:'.api_get_path(WEB_PATH));
40 40
 }
Please login to merge, or discard this patch.
plugin/sepe/src/formative-action.php 1 patch
Braces   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
 $plugin = SepePlugin::create();
14 14
 $_cid = 0;
15 15
 
16
-if (api_is_platform_admin()) {
16
+if (api_is_platform_admin()) {
17 17
     $actionId = getActionId(intval($_GET['cid']));
18 18
     $info = getActionInfo($actionId);
19
-    if ($info === false) {
19
+    if ($info === false) {
20 20
         header("Location: formative-actions-list.php");    
21 21
     }
22 22
     $templateName = $plugin->get_lang('FormativeActionData');
@@ -24,11 +24,11 @@  discard block
 block discarded – undo
24 24
     $interbreadcrumb[] = array("url" => "formative-actions-list.php", "name" => $plugin->get_lang('FormativesActionsList'));
25 25
     $tpl = new Template($templateName);
26 26
     
27
-    if (isset($_SESSION['sepe_message_info'])) {
27
+    if (isset($_SESSION['sepe_message_info'])) {
28 28
         $tpl->assign('message_info', $_SESSION['sepe_message_info']);    
29 29
         unset($_SESSION['sepe_message_info']);
30 30
     }
31
-    if (isset($_SESSION['sepe_message_error'])) {
31
+    if (isset($_SESSION['sepe_message_error'])) {
32 32
         $tpl->assign('message_error', $_SESSION['sepe_message_error']);    
33 33
         unset($_SESSION['sepe_message_error']);
34 34
     }
@@ -45,6 +45,6 @@  discard block
 block discarded – undo
45 45
     $content = $tpl->fetch($listing_tpl);
46 46
     $tpl->assign('content', $content);
47 47
     $tpl->display_one_col_template();
48
-} else {
48
+} else {
49 49
     header('Location:'.api_get_path(WEB_PATH));
50 50
 }
Please login to merge, or discard this patch.
plugin/sepe/database.php 1 patch
Braces   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 /**
9 9
  * Check if script can be called
10 10
  */
11
-if (!function_exists('api_get_path')) {
11
+if (!function_exists('api_get_path')) {
12 12
     die('This script must be loaded through the Chamilo plugin installer sequence');
13 13
 }
14 14
 
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 
711 711
 $queries = $pluginSchema->toSql($platform);
712 712
 
713
-foreach ($queries as $query) {
713
+foreach ($queries as $query) {
714 714
     Database::query($query);
715 715
 }
716 716
 
@@ -725,7 +725,7 @@  discard block
 block discarded – undo
725 725
     array(6, '06', 'Experiencia docente contrastada de al menos 600 horas de impartición de acciones formativas de formación profesional para el empleo o del sistema educativo en modalidad presencial, en los últimos diez años.')
726 726
 );
727 727
 
728
-foreach ($competences as $competence) {
728
+foreach ($competences as $competence) {
729 729
     Database::insert(
730 730
         $sepeTeachingCompetenceTable,
731 731
         array(
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 $provinces = 'Albacete;Alicante/Alacant;Almería;Araba/Álava;Asturias;Ávila;Badajoz;Balears, Illes;Barcelona;Bizkaia;Burgos;Cáceres;Cádiz;Cantabria;Castellón/Castelló;Ciudad Real;Córdoba;Coruña, A;Cuenca;Gipuzkoa;Girona;Granada;Guadalajara;Huelva;Huesca;Jaén;León;Lleida;Lugo;Madrid;Málaga;Murcia;Navarra;Ourense;Palencia;Palmas, Las;Pontevedr;Rioja, La;Salamanca;Santa Cruz de Tenerife;Segovia;Sevilla;Soria;Tarragona;Teruel;Toledo;Valencia/Valéncia;Valladolid;Zamora;Zaragoza;Ceuta;Melilla';
788 788
 $list_provinces = explode(';', $provinces);
789 789
 $i = 1;
790
-foreach ($list_provinces as $value) {
790
+foreach ($list_provinces as $value) {
791 791
     $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', '".$i."', '".$value."','".$i."');";
792 792
     Database::query($sql);
793 793
     $i++;
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 $ccaa = ';Andalucía;Aragón;Asturias, Principado de;Balears, Illes;Canarias;Cantabria;Castilla y León;Castilla - La Mancha;Cataluña;Comunitat Valenciana;Extremadura;Galicia;Madrid, Comunidad de;Murcia, Región de;Navarra, Comunidad Foral de;País Vasco;Rioja, La;Ceuta;Melilla';
802 802
 $list_ccaa = explode(';', $ccaa);
803 803
 $i = 1;
804
-foreach ($list_ccaa as $value) {
804
+foreach ($list_ccaa as $value) {
805 805
     $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', '".$i."', '".$value."','".$i."');";
806 806
     Database::query($sql);
807 807
     $i++;
@@ -814,7 +814,7 @@  discard block
 block discarded – undo
814 814
 //$fieldoptions = ';Albacete;Alicante/Alacant;Almería;Araba/Álava;Asturias;Ávila;Badajoz;Balears, Illes;Barcelona;Bizkaia;Burgos;Cáceres;Cádiz;Cantabria;Castellón/Castelló;Ciudad Real;Córdoba;Coruña, A;Cuenca;Gipuzkoa;Girona;Granada;Guadalajara;Huelva;Huesca;Jaén;León;Lleida;Lugo;Madrid;Málaga;Murcia;Navarra;Ourense;Palencia;Palmas, Las;Pontevedr;Rioja, La;Salamanca;Santa Cruz de Tenerife;Segovia;Sevilla;Soria;Tarragona;Teruel;Toledo;Valencia/Valéncia;Valladolid;Zamora;Zaragoza;Ceuta;Melilla';
815 815
 $field_id = UserManager::create_extra_field($fieldlabel, $fieldtype, $fieldtitle, $fielddefault);
816 816
 $i = 1;
817
-foreach ($list_provinces as $value) {
817
+foreach ($list_provinces as $value) {
818 818
     $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', '".$i."', '".$value."','".$i."');";
819 819
     Database::query($sql);
820 820
     $i++;
@@ -827,7 +827,7 @@  discard block
 block discarded – undo
827 827
 //$fieldoptions = ';Andalucía;Aragón;Asturias, Principado de;Balears, Illes;Canarias;Cantabria;Castilla y León;Castilla - La Mancha;Cataluña;Comunitat Valenciana;Extremadura;Galicia;Madrid, Comunidad de;Murcia, Región de;Navarra, Comunidad Foral de;País Vasco;Rioja, La;Ceuta;Melilla';
828 828
 $field_id = UserManager::create_extra_field($fieldlabel, $fieldtype, $fieldtitle, $fielddefault);
829 829
 $i = 1;
830
-foreach ($list_ccaa as $value) {
830
+foreach ($list_ccaa as $value) {
831 831
     $sql = "INSERT INTO extra_field_options (field_id, option_value, display_text, option_order) VALUES ('".$field_id."', '".$i."', '".$value."','".$i."');";
832 832
     Database::query($sql);
833 833
     $i++;
Please login to merge, or discard this patch.
main/exercise/hotspot_updatescore.inc.php 1 patch
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,13 +18,15 @@
 block discarded – undo
18 18
 $objExercise = Session::read('objExercise');
19 19
 $hotspotId = $_GET['hotspotId'];
20 20
 $exerciseId = $objExercise->selectId();
21
-if ($_GET['answerId'] == "0") { // click is NOT on a hotspot
21
+if ($_GET['answerId'] == "0") {
22
+// click is NOT on a hotspot
22 23
     $hit = 0;
23 24
     $answerId = $hotspotId;
24 25
 
25 26
     // remove from session
26 27
     unset($_SESSION['exerciseResult'][$questionId][$answerId]);
27
-} else { // user clicked ON a hotspot
28
+} else {
29
+// user clicked ON a hotspot
28 30
     $hit = 1;
29 31
     $answerId = $hotspotId;
30 32
 
Please login to merge, or discard this patch.
main/inc/lib/tracking.lib.php 1 patch
Braces   +42 added lines, -18 removed lines patch added patch discarded remove patch
@@ -414,7 +414,8 @@  discard block
 block discarded – undo
414 414
                                     Display::return_icon('visible.gif', get_lang('HideAttemptView')),
415 415
                                     api_get_self().'?action=stats&extend_id='.$my_item_id.'&fold_attempt_id='.$row['iv_id'].$url_suffix
416 416
                                 );
417
-                            } else { // Same case if fold_attempt_id is set, so not implemented explicitly.
417
+                            } else {
418
+// Same case if fold_attempt_id is set, so not implemented explicitly.
418 419
                                 // The extend button for this attempt has not been clicked.
419 420
                                 $extend_attempt_link = Display::url(
420 421
                                     Display::return_icon('invisible.gif', get_lang('ExtendAttemptView')),
@@ -2608,7 +2609,9 @@  discard block
 block discarded – undo
2608 2609
         $getOnlyBestAttempt = false
2609 2610
     ) {
2610 2611
         $debug = false;
2611
-        if ($debug) echo '<h1>Tracking::get_avg_student_score</h1>';
2612
+        if ($debug) {
2613
+            echo '<h1>Tracking::get_avg_student_score</h1>';
2614
+        }
2612 2615
         $tbl_stats_exercices = Database::get_main_table(TABLE_STATISTIC_TRACK_E_EXERCISES);
2613 2616
         $tbl_stats_attempts = Database::get_main_table(TABLE_STATISTIC_TRACK_E_ATTEMPT);
2614 2617
         $course = api_get_course_info($course_code);
@@ -2794,7 +2797,9 @@  discard block
 block discarded – undo
2794 2797
                             // Came from the lp_item_view
2795 2798
                             $max_score_item_view = $row_max_score['max_score_item_view'];
2796 2799
                             $score = $row_max_score['score'];
2797
-                            if ($debug) echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>';
2800
+                            if ($debug) {
2801
+                                echo '<h3>Item Type: '.$row_max_score['item_type'].'</h3>';
2802
+                            }
2798 2803
 
2799 2804
                             if ($row_max_score['item_type'] == 'sco') {
2800 2805
                                 /* Check if it is sco (easier to get max_score)
@@ -2845,18 +2850,24 @@  discard block
 block discarded – undo
2845 2850
                                         LIMIT 1";
2846 2851
 
2847 2852
                                 $result_last_attempt = Database::query($sql);
2848
-                                if ($debug) var_dump($sql);
2853
+                                if ($debug) {
2854
+                                    var_dump($sql);
2855
+                                }
2849 2856
                                 $num = Database::num_rows($result_last_attempt);
2850 2857
                                 if ($num > 0) {
2851 2858
                                     $attemptResult = Database::fetch_array($result_last_attempt, 'ASSOC');
2852 2859
                                     $id_last_attempt = $attemptResult['exe_id'];
2853 2860
                                     // We overwrite the score with the best one not the one saved in the LP (latest)
2854 2861
                                     if ($getOnlyBestAttempt && $get_only_latest_attempt_results == false) {
2855
-                                        if ($debug) echo "Following score comes from the track_exercise table not in the LP because the score is the best<br />";
2862
+                                        if ($debug) {
2863
+                                            echo "Following score comes from the track_exercise table not in the LP because the score is the best<br />";
2864
+                                        }
2856 2865
                                         $score = $attemptResult['exe_result'];
2857 2866
                                     }
2858 2867
 
2859
-                                    if ($debug) echo "Attempt id: $id_last_attempt with score $score<br />";
2868
+                                    if ($debug) {
2869
+                                        echo "Attempt id: $id_last_attempt with score $score<br />";
2870
+                                    }
2860 2871
                                     // Within the last attempt number tracking, get the sum of
2861 2872
                                     // the max_scores of all questions that it was
2862 2873
                                     // made of (we need to make this call dynamic because of random questions selection)
@@ -2901,7 +2912,9 @@  discard block
 block discarded – undo
2901 2912
                                         $count_items++;
2902 2913
                                     }
2903 2914
                                 }
2904
-                                if ($debug) echo '$count_items: '.$count_items;
2915
+                                if ($debug) {
2916
+                                    echo '$count_items: '.$count_items;
2917
+                                }
2905 2918
                             }
2906 2919
                         } //end for
2907 2920
 
@@ -2937,19 +2950,29 @@  discard block
 block discarded – undo
2937 2950
                     }
2938 2951
                 }
2939 2952
 
2940
-                if ($debug) echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>';
2941
-                if ($debug) echo '<h3>Final return</h3>';
2953
+                if ($debug) {
2954
+                    echo '<h3>$lp_with_quiz '.$lp_with_quiz.' </h3>';
2955
+                }
2956
+                if ($debug) {
2957
+                    echo '<h3>Final return</h3>';
2958
+                }
2942 2959
 
2943 2960
                 if ($lp_with_quiz != 0) {
2944 2961
                     if (!$return_array) {
2945 2962
                         $score_of_scorm_calculate = round(($global_result / $lp_with_quiz), 2);
2946
-                        if ($debug) var_dump($score_of_scorm_calculate);
2963
+                        if ($debug) {
2964
+                            var_dump($score_of_scorm_calculate);
2965
+                        }
2947 2966
                         if (empty($lp_ids)) {
2948
-                            if ($debug) echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>';
2967
+                            if ($debug) {
2968
+                                echo '<h2>All lps fix: '.$score_of_scorm_calculate.'</h2>';
2969
+                            }
2949 2970
                         }
2950 2971
                         return $score_of_scorm_calculate;
2951 2972
                     } else {
2952
-                        if ($debug) var_dump($global_result, $lp_with_quiz);
2973
+                        if ($debug) {
2974
+                            var_dump($global_result, $lp_with_quiz);
2975
+                        }
2953 2976
                         return array($global_result, $lp_with_quiz);
2954 2977
                     }
2955 2978
                 } else {
@@ -3436,11 +3459,13 @@  discard block
 block discarded – undo
3436 3459
 
3437 3460
         if (!empty ($id_session)) {
3438 3461
             $sql .= ' WHERE session_course.session_id='.$id_session;
3439
-            if (api_is_multiple_url_enabled())
3440
-            $sql .= ' AND access_url_id = '.$access_url_id;
3462
+            if (api_is_multiple_url_enabled()) {
3463
+                        $sql .= ' AND access_url_id = '.$access_url_id;
3464
+            }
3441 3465
         } else {
3442
-            if (api_is_multiple_url_enabled())
3443
-            $sql .= ' WHERE access_url_id = '.$access_url_id;
3466
+            if (api_is_multiple_url_enabled()) {
3467
+                        $sql .= ' WHERE access_url_id = '.$access_url_id;
3468
+            }
3444 3469
         }
3445 3470
 
3446 3471
         $result = Database::query($sql);
@@ -3554,8 +3579,7 @@  discard block
 block discarded – undo
3554 3579
                 if (empty($session['access_start_date'])
3555 3580
                 ) {
3556 3581
                     $session['status'] = get_lang('SessionActive');
3557
-                }
3558
-                else {
3582
+                } else {
3559 3583
                     $time_start = api_strtotime($session['access_start_date'], 'UTC');
3560 3584
                     $time_end = api_strtotime($session['access_end_date'], 'UTC');
3561 3585
                     if ($time_start < time() && time() < $time_end) {
Please login to merge, or discard this patch.
plugin/sepe/install.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@
 block discarded – undo
6 6
  */
7 7
 require_once __DIR__.'/config.php';
8 8
 
9
-if (!api_is_platform_admin()) {
9
+if (!api_is_platform_admin()) {
10 10
     die ('You must have admin permissions to install plugins');
11 11
 }
12 12
 
Please login to merge, or discard this patch.
plugin/sepe/src/identification-data.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -12,17 +12,17 @@  discard block
 block discarded – undo
12 12
 $plugin = SepePlugin::create();
13 13
 $_cid = 0;
14 14
 
15
-if (api_is_platform_admin()) {
15
+if (api_is_platform_admin()) {
16 16
     $info = getInfoIdentificationData();
17 17
     $templateName = $plugin->get_lang('DataCenter');
18 18
     $interbreadcrumb[] = array("url" => "/plugin/sepe/src/sepe-administration-menu.php", "name" => $plugin->get_lang('MenuSepe'));
19 19
     $tpl = new Template($templateName);
20 20
 
21
-    if (isset($_SESSION['sepe_message_info'])) {
21
+    if (isset($_SESSION['sepe_message_info'])) {
22 22
         $tpl->assign('message_info', $_SESSION['sepe_message_info']);
23 23
         unset($_SESSION['sepe_message_info']);
24 24
     }
25
-    if (isset($_SESSION['sepe_message_error'])) {
25
+    if (isset($_SESSION['sepe_message_error'])) {
26 26
         $tpl->assign('message_error', $_SESSION['sepe_message_error']);
27 27
         unset($_SESSION['sepe_message_error']);
28 28
     }
@@ -31,6 +31,6 @@  discard block
 block discarded – undo
31 31
     $content = $tpl->fetch($listing_tpl);
32 32
     $tpl->assign('content', $content);
33 33
     $tpl->display_one_col_template();
34
-} else {
34
+} else {
35 35
     header('Location:'.api_get_path(WEB_PATH));
36 36
 }
Please login to merge, or discard this patch.
plugin/sepe/src/configuration.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -13,17 +13,17 @@  discard block
 block discarded – undo
13 13
 $plugin = SepePlugin::create();
14 14
 $_cid = 0;
15 15
 
16
-if (api_is_platform_admin()) {
16
+if (api_is_platform_admin()) {
17 17
     $tUser = Database::get_main_table(TABLE_MAIN_USER);
18 18
     $tApi = Database::get_main_table(TABLE_MAIN_USER_API_KEY);
19 19
     $login = 'SEPE';
20 20
     $sql = "SELECT a.api_key AS api FROM $tUser u, $tApi a WHERE u.username='".$login."' and u.user_id = a.user_id AND a.api_service = 'dokeos';";
21 21
     $result = Database::query($sql);
22
-    if (Database::num_rows($result) > 0) {
22
+    if (Database::num_rows($result) > 0) {
23 23
         $tmp = Database::fetch_assoc($result);
24 24
         $info = $tmp['api'];
25 25
         
26
-    } else {
26
+    } else {
27 27
         $info = '';
28 28
     }
29 29
     $templateName = $plugin->get_lang('Setting');
@@ -36,6 +36,6 @@  discard block
 block discarded – undo
36 36
     $content = $tpl->fetch($listing_tpl);
37 37
     $tpl->assign('content', $content);
38 38
     $tpl->display_one_col_template();
39
-} else {
39
+} else {
40 40
     header('Location:'.api_get_path(WEB_PATH));
41 41
 }
Please login to merge, or discard this patch.