Completed
Push — 1.11.x ( 30f47b...9fdd19 )
by José
24:40
created
main/gradebook/gradebook_scoring_system.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
     api_not_allowed();
14 14
 }
15 15
 
16
-$htmlHeadXtra[]= '<script>
16
+$htmlHeadXtra[] = '<script>
17 17
 function plusItem(item) {
18 18
     document.getElementById(item).style.display = "inline";
19 19
     document.getElementById("plus-"+item).style.display = "none";
@@ -45,10 +45,10 @@  discard block
 block discarded – undo
45 45
 );
46 46
 
47 47
 $select_cat = intval($_GET['selectcat']);
48
-$displayscore= ScoreDisplay :: instance();
48
+$displayscore = ScoreDisplay :: instance();
49 49
 $customdisplays = $displayscore->get_custom_score_display_settings();
50 50
 
51
-$nr_items = (count($customdisplays) != '0' )? count($customdisplays) : '1';
51
+$nr_items = (count($customdisplays) != '0') ? count($customdisplays) : '1';
52 52
 $scoreform = new ScoreDisplayForm(
53 53
     'scoring_system_form',
54 54
     api_get_self().'?selectcat='.$select_cat.'&'.api_get_cidreq()
@@ -57,18 +57,18 @@  discard block
 block discarded – undo
57 57
 if ($scoreform->validate()) {
58 58
     $value_export = '';
59 59
     $value_export = $scoreform->exportValues();
60
-    $value_export = isset($value_export) ? $scoreform->exportValues(): '';
60
+    $value_export = isset($value_export) ? $scoreform->exportValues() : '';
61 61
     $values = $value_export;
62 62
 
63 63
     // create new array of custom display settings
64 64
     // this loop also checks if all score ranges are unique
65 65
 
66
-    $scoringdisplay= array ();
66
+    $scoringdisplay = array();
67 67
     $ranges_ok = true;
68
-    $endscore= isset($values['endscore']) ? $values['endscore'] : null;
69
-    $displaytext=isset($values['displaytext']) ? $values['displaytext'] : null;
70
-    for ($counter= 1; $ranges_ok && $counter <= 20; $counter++) {
71
-        $setting= array ();
68
+    $endscore = isset($values['endscore']) ? $values['endscore'] : null;
69
+    $displaytext = isset($values['displaytext']) ? $values['displaytext'] : null;
70
+    for ($counter = 1; $ranges_ok && $counter <= 20; $counter++) {
71
+        $setting = array();
72 72
         $setting['score'] = $endscore[$counter];
73 73
         $setting['display'] = $displaytext[$counter];
74 74
         if (!empty($setting['score'])) {
@@ -77,12 +77,12 @@  discard block
 block discarded – undo
77 77
                     $ranges_ok = false;
78 78
                 }
79 79
             }
80
-            $scoringdisplay[]= $setting;
80
+            $scoringdisplay[] = $setting;
81 81
         }
82 82
     }
83 83
 
84 84
     if (!$ranges_ok) {
85
-        header('Location: ' . api_get_self() . '?nouniqueranges=&selectcat=' . $select_cat.'&'.api_get_cidreq());
85
+        header('Location: '.api_get_self().'?nouniqueranges=&selectcat='.$select_cat.'&'.api_get_cidreq());
86 86
         exit;
87 87
     }
88 88
 
@@ -102,8 +102,8 @@  discard block
 block discarded – undo
102 102
 $this_section = SECTION_COURSES;
103 103
 Display :: display_header(get_lang('ScoreEdit'));
104 104
 
105
-if (((isset($_GET['isStudentView']) && $_GET['isStudentView']=='false') ||
106
-    (isset($_GET['selectcat']) && ($_SESSION['studentview']=='teacherview')))
105
+if (((isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'false') ||
106
+    (isset($_GET['selectcat']) && ($_SESSION['studentview'] == 'teacherview')))
107 107
 ) {
108 108
     if (isset ($_GET['scoringupdated'])) {
109 109
         Display::display_confirmation_message(get_lang('ScoringUpdated'), false);
Please login to merge, or discard this patch.
main/gradebook/gradebook_edit_all.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -79,7 +79,7 @@
 block discarded – undo
79 79
 
80 80
 $submitted = isset($_POST['submitted']) ? $_POST['submitted'] : '';
81 81
 if ($submitted == 1) {
82
-    Display :: display_confirmation_message(get_lang('GradebookWeightUpdated')) . '<br /><br />';
82
+    Display :: display_confirmation_message(get_lang('GradebookWeightUpdated')).'<br /><br />';
83 83
     if (isset($_POST['evaluation'])) {
84 84
         $eval_log = new Evaluation();
85 85
     }
Please login to merge, or discard this patch.
main/gradebook/my_certificates.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@
 block discarded – undo
36 36
         'actions',
37 37
         Display::toolbarButton(
38 38
             get_lang('SearchCertificates'),
39
-            api_get_path(WEB_CODE_PATH) . "gradebook/search.php",
39
+            api_get_path(WEB_CODE_PATH)."gradebook/search.php",
40 40
             'search',
41 41
             'info'
42 42
         )
Please login to merge, or discard this patch.
main/gradebook/user_stats.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 if (!$isDrhOfCourse) {
17 17
     GradebookUtils::block_students();
18 18
 }
19
-$interbreadcrumb[]= array (
19
+$interbreadcrumb[] = array(
20 20
     'url' => $_SESSION['gradebook_dest'],
21 21
     'name' => get_lang('Gradebook'
22 22
 ));
@@ -27,12 +27,12 @@  discard block
 block discarded – undo
27 27
 $alllinks = $category[0]->get_links($my_user_id, true);
28 28
 
29 29
 if ($_GET['selectcat'] != null) {
30
-    $addparams= array (
30
+    $addparams = array(
31 31
         'userid' => $my_user_id,
32 32
         'selectcat' => Security::remove_XSS($_GET['selectcat'])
33 33
     );
34 34
 } else {
35
-    $addparams= array (
35
+    $addparams = array(
36 36
         'userid' => $my_user_id,
37 37
         'selecteval' => Security::remove_XSS($_GET['selecteval'])
38 38
     );
@@ -49,7 +49,7 @@  discard block
 block discarded – undo
49 49
         $newarray[] = array_slice($data, 1);
50 50
     }
51 51
     $userinfo = api_get_user_info($my_user_id);
52
-    $html .= get_lang('Results').' : '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT). ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')';
52
+    $html .= get_lang('Results').' : '.api_get_person_name($userinfo['firstname'], $userinfo['lastname']).' ('.api_convert_and_format_date(null, DATE_FORMAT_SHORT).' '.api_convert_and_format_date(null, TIME_NO_SEC_FORMAT).')';
53 53
 
54 54
     if ($displayscore->is_custom()) {
55 55
         $header_names = array(
@@ -95,23 +95,23 @@  discard block
 block discarded – undo
95 95
 $actions = '<div class="actions">';
96 96
 
97 97
 if (isset($_GET['selectcat'])) {
98
-    $interbreadcrumb[]= array ('url' => 'gradebook_flatview.php?selectcat=' . Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('FlatView'));
99
-    $actions.= '<a href=gradebook_flatview.php?selectcat=' .Security::remove_XSS($_GET['selectcat']) . '>' . Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('FlatView'),'',ICON_SIZE_MEDIUM).'</a>';
98
+    $interbreadcrumb[] = array('url' => 'gradebook_flatview.php?selectcat='.Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('FlatView'));
99
+    $actions .= '<a href=gradebook_flatview.php?selectcat='.Security::remove_XSS($_GET['selectcat']).'>'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
100 100
 }
101 101
 
102 102
 if (isset ($_GET['selecteval'])) {
103
-    $interbreadcrumb[]= array (
104
-        'url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']),
103
+    $interbreadcrumb[] = array(
104
+        'url' => 'gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']),
105 105
         'name' => get_lang('ViewResult'
106 106
     ));
107
-    $actions.= '<a href=gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '>
108
-	'.Display::return_icon('back.png', get_lang('BackToEvaluation'),'',ICON_SIZE_MEDIUM).'</a>';
107
+    $actions .= '<a href=gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'>
108
+	'.Display::return_icon('back.png', get_lang('BackToEvaluation'), '', ICON_SIZE_MEDIUM).'</a>';
109 109
 }
110 110
 
111
-$actions.= '<a href="' . api_get_self() . '?exportpdf=&userid='.Security::remove_XSS($_GET['userid']).'&selectcat=' . $category[0]->get_id() . '" target="_blank">
112
-' . Display::return_icon('pdf.png', get_lang('ExportPDF'),'',ICON_SIZE_MEDIUM).'</a>';
111
+$actions .= '<a href="'.api_get_self().'?exportpdf=&userid='.Security::remove_XSS($_GET['userid']).'&selectcat='.$category[0]->get_id().'" target="_blank">
112
+' . Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM).'</a>';
113 113
 
114
-$actions.='</div>';
114
+$actions .= '</div>';
115 115
 
116 116
 Display :: display_header(get_lang('ResultsPerUser'));
117 117
 echo $actions;
Please login to merge, or discard this patch.
main/gradebook/gradebook_add_eval.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     null,
31 31
     'add_eval_form',
32 32
     null,
33
-    api_get_self() . '?selectcat=' . $select_cat.'&'.api_get_cidreq()
33
+    api_get_self().'?selectcat='.$select_cat.'&'.api_get_cidreq()
34 34
 );
35 35
 
36 36
 if ($form->validate()) {
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
             //header('Location: gradebook_add_user.php?selecteval=' . $eval->get_id());
70 70
             exit;
71 71
         } else {
72
-            header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id().'&'.api_get_cidreq());
72
+            header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$eval->get_category_id().'&'.api_get_cidreq());
73 73
             exit;
74 74
         }
75 75
     } else {
76 76
         $val_addresult = isset($values['addresult']) ? $values['addresult'] : null;
77 77
         if ($val_addresult == 1) {
78
-            header('Location: gradebook_add_result.php?selecteval=' . $eval->get_id().'&'.api_get_cidreq());
78
+            header('Location: gradebook_add_result.php?selecteval='.$eval->get_id().'&'.api_get_cidreq());
79 79
             exit;
80 80
         } else {
81
-            header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id().'&'.api_get_cidreq());
81
+            header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$eval->get_category_id().'&'.api_get_cidreq());
82 82
             exit;
83 83
         }
84 84
     }
85 85
 }
86 86
 
87 87
 $interbreadcrumb[] = array(
88
-    'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $select_cat.'&'.api_get_cidreq(),
88
+    'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$select_cat.'&'.api_get_cidreq(),
89 89
     'name' => get_lang('Gradebook'))
90 90
 ;
91 91
 $this_section = SECTION_COURSES;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
        $("#hid_category_id option:selected").each(function () {
97 97
            var cat_id = $(this).val();
98 98
             $.ajax({
99
-                url: "' . api_get_path(WEB_AJAX_PATH) . 'gradebook.ajax.php?a=get_gradebook_weight",
99
+                url: "' . api_get_path(WEB_AJAX_PATH).'gradebook.ajax.php?a=get_gradebook_weight",
100 100
                 data: "cat_id="+cat_id,
101 101
                 success: function(return_value) {
102 102
                     if (return_value != 0 ) {
Please login to merge, or discard this patch.
main/gradebook/lib/fe/catform.class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
      */
53 53
     protected function build_move_form()
54 54
     {
55
-        $renderer =& $this->defaultRenderer();
55
+        $renderer = & $this->defaultRenderer();
56 56
         $renderer->setCustomElementTemplate('<span>{element}</span> ');
57 57
         $this->addElement(
58 58
             'static',
59 59
             null,
60 60
             null,
61
-            '"' . $this->category_object->get_name() . '" '
61
+            '"'.$this->category_object->get_name().'" '
62 62
         );
63
-        $this->addElement('static', null, null, get_lang('MoveTo') . ' : ');
63
+        $this->addElement('static', null, null, get_lang('MoveTo').' : ');
64 64
         $select = $this->addElement('select', 'move_cat', null, null);
65 65
         $line = null;
66 66
         foreach ($this->category_object->get_target_categories() as $cat) {
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
                 $line .= '--';
69 69
             }
70 70
             if ($cat[0] != $this->category_object->get_parent_id()) {
71
-                $select->addoption($line . ' ' . $cat[1], $cat[0]);
71
+                $select->addoption($line.' '.$cat[1], $cat[0]);
72 72
             } else {
73
-                $select->addoption($line . ' ' . $cat[1], $cat[0], 'disabled');
73
+                $select->addoption($line.' '.$cat[1], $cat[0], 'disabled');
74 74
             }
75 75
             $line = '';
76 76
         }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $grade_model_id = $this->category_object->get_grade_model_id();
154 154
 
155 155
         if (empty($links)) {
156
-            $grade_model_id    = 0;
156
+            $grade_model_id = 0;
157 157
         }
158 158
 
159 159
         $category_name = $this->category_object->get_name();
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                     [
243 243
                         'id' => 'skills',
244 244
                         'multiple' => 'multiple',
245
-                        'url' => api_get_path(WEB_AJAX_PATH) . 'skill.ajax.php?a=search_skills'
245
+                        'url' => api_get_path(WEB_AJAX_PATH).'skill.ajax.php?a=search_skills'
246 246
                     ]
247 247
                 );
248 248
 
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
         //only return courses that are not yet created by the teacher
401 401
 
402 402
         foreach ($coursecat as $row) {
403
-            $select->addoption($row[1],$row[0]);
403
+            $select->addoption($row[1], $row[0]);
404 404
         }
405 405
         $this->setDefaults(array(
406 406
             'hid_user_id' => $this->category_object->get_user_id(),
407 407
             'hid_parent_id' => $this->category_object->get_parent_id()
408 408
         ));
409
-        $this->addElement('hidden','hid_user_id');
410
-        $this->addElement('hidden','hid_parent_id');
409
+        $this->addElement('hidden', 'hid_user_id');
410
+        $this->addElement('hidden', 'hid_parent_id');
411 411
         $this->addElement('submit', null, get_lang('Ok'));
412 412
     }
413 413
 
Please login to merge, or discard this patch.
main/gradebook/lib/fe/flatviewtable.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
             $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
202 202
             $chartHash = $myCache->getHash($dataSet);
203 203
             if ($myCache->isInCache($chartHash)) {
204
-                $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
204
+                $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
205 205
                 $myCache->saveFromCache($chartHash, $imgPath);
206
-                $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
206
+                $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
207 207
             } else {
208 208
                 /* Create the pChart object */
209 209
                 $widthSize = 480;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 /* Set the default font */
231 231
                 $myPicture->setFontProperties(
232 232
                     array(
233
-                        'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
233
+                        'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
234 234
                         'FontSize' => 10
235 235
                     )
236 236
                 );
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
                 /* Render the picture (choose the best way) */
303 303
 
304 304
                 $myCache->writeToCache($chartHash, $myPicture);
305
-                $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
305
+                $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
306 306
                 $myCache->saveFromCache($chartHash, $imgPath);
307
-                $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
307
+                $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
308 308
             }
309
-            echo '<img src="' . $imgPath . '" >';
309
+            echo '<img src="'.$imgPath.'" >';
310 310
             if ($i % 2 == 0 && $i != 0) {
311 311
                 echo '<br /><br />';
312 312
             } else {
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
             // previous X
350 350
             $header .= '<td style="width:100%;">';
351 351
             if ($this->offset >= GRADEBOOK_ITEM_LIMIT) {
352
-                $header .= '<a href="' . api_get_self()
353
-                    . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
354
-                    . '&offset=' . (($this->offset) - GRADEBOOK_ITEM_LIMIT)
355
-                    . (isset($_GET['search']) ? '&search=' . Security::remove_XSS($_GET['search']) : '') . '">'
352
+                $header .= '<a href="'.api_get_self()
353
+                    . '?selectcat='.Security::remove_XSS($_GET['selectcat'])
354
+                    . '&offset='.(($this->offset) - GRADEBOOK_ITEM_LIMIT)
355
+                    . (isset($_GET['search']) ? '&search='.Security::remove_XSS($_GET['search']) : '').'">'
356 356
                     . Display::return_icon('action_prev.png', get_lang('PreviousPage'), array(), 32)
357 357
                     . '</a>';
358 358
             } else {
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
                 ($totalitems - (GRADEBOOK_ITEM_LIMIT + $this->offset)) : GRADEBOOK_ITEM_LIMIT;
365 365
 
366 366
             if ($calcnext > 0) {
367
-                $header .= '<a href="' . api_get_self()
368
-                    . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
369
-                    . '&offset=' . ($this->offset + GRADEBOOK_ITEM_LIMIT)
370
-                    . (isset($_GET['search']) ? '&search=' . Security::remove_XSS($_GET['search']) : '') . '">'
367
+                $header .= '<a href="'.api_get_self()
368
+                    . '?selectcat='.Security::remove_XSS($_GET['selectcat'])
369
+                    . '&offset='.($this->offset + GRADEBOOK_ITEM_LIMIT)
370
+                    . (isset($_GET['search']) ? '&search='.Security::remove_XSS($_GET['search']) : '').'">'
371 371
                     . Display::return_icon('action_next.png', get_lang('NextPage'), array(), 32)
372 372
                     . '</a>';
373 373
             } else {
@@ -475,6 +475,6 @@  discard block
 block discarded – undo
475 475
      */
476 476
     private function build_name_link($user_id, $name)
477 477
     {
478
-        return '<a href="user_stats.php?userid=' . $user_id . '&selectcat=' . $this->selectcat->get_id() . '&'.api_get_cidreq().'">' . $name . '</a>';
478
+        return '<a href="user_stats.php?userid='.$user_id.'&selectcat='.$this->selectcat->get_id().'&'.api_get_cidreq().'">'.$name.'</a>';
479 479
     }
480 480
 }
Please login to merge, or discard this patch.
main/gradebook/lib/scoredisplay.class.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * Compare the custom display of 2 scores, can be useful in sorting
36 36
      */
37
-    public static function compare_scores_by_custom_display ($score1, $score2)
37
+    public static function compare_scores_by_custom_display($score1, $score2)
38 38
     {
39 39
         if (!isset($score1)) {
40 40
             return (isset($score2) ? 1 : 0);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             if ($custom1 == $custom2) {
48 48
                 return 0;
49 49
             } else {
50
-                return (($score1[0]/$score1[1]) < ($score2[0]/$score2[1]) ? -1 : 1);
50
+                return (($score1[0] / $score1[1]) < ($score2[0] / $score2[1]) ? -1 : 1);
51 51
             }
52 52
         }
53 53
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         //Setting custom enabled
80 80
         $value = api_get_setting('gradebook_score_display_custom');
81 81
         $value = $value['my_display_custom'];
82
-        $this->custom_enabled  = $value == 'true' ? true : false;
82
+        $this->custom_enabled = $value == 'true' ? true : false;
83 83
 
84 84
         if ($this->custom_enabled) {
85 85
             $params = array('category = ?' =>  array('Gradebook'));
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
                 sort($portal_displays);
97 97
             }
98 98
             $this->custom_display = $portal_displays;
99
-            if (count($this->custom_display)>0) {
99
+            if (count($this->custom_display) > 0) {
100 100
                 $value = api_get_setting('gradebook_score_display_upperlimit');
101 101
                 $value = $value['my_display_upperlimit'];
102
-                $this->upperlimit_included  = $value == 'true' ? true : false;
102
+                $this->upperlimit_included = $value == 'true' ? true : false;
103 103
                 $this->custom_display_conv = $this->convert_displays($this->custom_display);
104 104
             }
105 105
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             //Load course settings
111 111
             if ($this->custom_enabled) {
112 112
                 $this->custom_display = $this->get_custom_displays();
113
-                if (count($this->custom_display)> 0) {
113
+                if (count($this->custom_display) > 0) {
114 114
                     $this->custom_display_conv = $this->convert_displays($this->custom_display);
115 115
                 }
116 116
             }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         }
183 183
 
184 184
         $sql = 'SELECT id FROM '.$tbl_gradebook_category.'
185
-                WHERE course_code = "'.$curr_course_code.'" '. $session_condition;
185
+                WHERE course_code = "'.$curr_course_code.'" '.$session_condition;
186 186
         $rs  = Database::query($sql);
187 187
         $category_id = 0;
188 188
         if (Database::num_rows($rs) > 0) {
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         );
252 252
 
253 253
         $tbl_display = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
254
-        foreach($display as $value => $text) {
254
+        foreach ($display as $value => $text) {
255 255
             $params = array(
256 256
                 'score' => $value,
257 257
                 'display' => $text,
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         $my_score = $score == 0 ? 1 : $score;
308 308
 
309 309
         if ($type == SCORE_BAR) {
310
-            $percentage = $my_score[0]/$my_score[1]*100;
310
+            $percentage = $my_score[0] / $my_score[1] * 100;
311 311
 
312 312
             return Display::bar_progress($percentage);
313 313
         }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             case SCORE_PERCENT :                        // XX %
349 349
                 return $this->display_as_percent($score);
350 350
             case SCORE_DIV_PERCENT :                    // X / Y (XX %)
351
-                return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')';
351
+                return $this->display_as_div($score).' ('.$this->display_as_percent($score).')';
352 352
             case SCORE_AVERAGE :                        // XX %
353 353
                 return $this->display_as_percent($score);
354 354
             case SCORE_DECIMAL :                        // 0.50  (X/Y)
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                 if (!empty($custom)) {
359 359
                     $custom = ' - '.$custom;
360 360
                 }
361
-                return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')'.$custom;
361
+                return $this->display_as_div($score).' ('.$this->display_as_percent($score).')'.$custom;
362 362
             case SCORE_DIV_SIMPLE_WITH_CUSTOM :         // X - Good!
363 363
                 $custom = $this->display_custom($score);
364 364
 
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
      */
411 411
     private function display_as_decimal($score)
412 412
     {
413
-        $score_denom = ($score[1]==0) ? 1 : $score[1];
413
+        $score_denom = ($score[1] == 0) ? 1 : $score[1];
414 414
 
415
-        return $this->format_score($score[0]/$score_denom);
415
+        return $this->format_score($score[0] / $score_denom);
416 416
     }
417 417
 
418 418
     /**
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
      */
421 421
     private function display_as_percent($score)
422 422
     {
423
-        $score_denom = ($score[1]==0) ? 1 : $score[1];
423
+        $score_denom = ($score[1] == 0) ? 1 : $score[1];
424 424
 
425
-        return $this->format_score($score[0]/$score_denom*100) . ' %';
425
+        return $this->format_score($score[0] / $score_denom * 100).' %';
426 426
     }
427 427
 
428 428
     /**
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
         } else {
439 439
             $score[0] = isset($score[0]) ? $this->format_score($score[0]) : 0;
440 440
             $score[1] = isset($score[1]) ? $this->format_score($score[1]) : 0;
441
-            return  $score[0] . ' / ' . $score[1];
441
+            return  $score[0].' / '.$score[1];
442 442
         }
443 443
     }
444 444
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
      */
449 449
     private function display_custom($score)
450 450
     {
451
-        $my_score_denom= ($score[1]==0) ? 1 : $score[1];
451
+        $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
452 452
         $scaledscore = $score[0] / $my_score_denom;
453 453
         if ($this->upperlimit_included) {
454 454
             foreach ($this->custom_display_conv as $displayitem) {
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
                 ORDER BY score';
513 513
         $result = Database::query($sql);
514 514
 
515
-        return Database::store_result($result,'ASSOC');
515
+        return Database::store_result($result, 'ASSOC');
516 516
     }
517 517
 
518 518
     /**
Please login to merge, or discard this patch.
main/gradebook/lib/be/exerciselink.class.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 
52 52
         $result = Database::query($sql);
53 53
         $cats = array();
54
-        while ($data=Database::fetch_array($result)) {
55
-            $cats[] = array ($data['id'], $data['title']);
54
+        while ($data = Database::fetch_array($result)) {
55
+            $cats[] = array($data['id'], $data['title']);
56 56
         }
57 57
 
58 58
         return $cats;
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
         $cats = array();
117 117
         if (isset($result)) {
118 118
             if (Database::num_rows($result) > 0) {
119
-                while ($data=Database::fetch_array($result)) {
120
-                    $cats[] = array ($data['id'], $data['title']);
119
+                while ($data = Database::fetch_array($result)) {
120
+                    $cats[] = array($data['id'], $data['title']);
121 121
                 }
122 122
             }
123 123
         }
124 124
 
125 125
         if (isset($result2)) {
126 126
             if (Database::num_rows($result2) > 0) {
127
-                while ($row=Database::fetch_array($result2)) {
127
+                while ($row = Database::fetch_array($result2)) {
128 128
                     /*$path = $data['path'];
129 129
                     $fname = GetQuizName($path,$documentPath);
130 130
         			$cats[] = array ($data['id'], $fname);*/
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
                 WHERE
171 171
                     session_id = $session_id AND
172 172
                     c_id = $course_id AND
173
-                    exe_exo_id   = ".(int)$this->get_ref_id();
173
+                    exe_exo_id   = ".(int) $this->get_ref_id();
174 174
         $result = Database::query($sql);
175
-        $number=Database::fetch_row($result);
175
+        $number = Database::fetch_row($result);
176 176
         return ($number[0] != 0);
177 177
     }
178 178
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         } else {
255 255
             // all students -> get average
256 256
             // normal way of getting the info
257
-            $students = array();  // user list, needed to make sure we only
257
+            $students = array(); // user list, needed to make sure we only
258 258
             // take first attempts into account
259 259
             $student_count = 0;
260 260
             $sum = 0;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                         /*if (empty($count)) {
290 290
                             return null;
291 291
                         }*/
292
-                        return array($sumResult/$count , $weight);
292
+                        return array($sumResult / $count, $weight);
293 293
                         break;
294 294
                     case 'ranking':
295 295
                         return AbstractLink::getCurrentUserRanking($stud_id, $students);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         $session_id = api_get_session_id();
320 320
 
321 321
         $url = api_get_path(WEB_CODE_PATH).'gradebook/exercise_jump.php?session_id='.$session_id.'&cidReq='.$this->get_course_code().'&gradebook=view&exerciseId='.$this->get_ref_id().'&type='.$this->get_type();
322
-        if ((!api_is_allowed_to_edit() && $this->calc_score(api_get_user_id()) == null) || $status_user!=1) {
322
+        if ((!api_is_allowed_to_edit() && $this->calc_score(api_get_user_id()) == null) || $status_user != 1) {
323 323
             $url .= '&amp;doexercise='.$this->get_ref_id();
324 324
         }
325 325
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
     public function is_valid_link()
365 365
     {
366 366
         $sql = 'SELECT count(id) from '.$this->get_exercise_table().'
367
-                WHERE c_id = '.$this->course_id.' AND id = '.(int)$this->get_ref_id().' ';
367
+                WHERE c_id = '.$this->course_id.' AND id = '.(int) $this->get_ref_id().' ';
368 368
         $result = Database::query($sql);
369 369
         $number = Database::fetch_row($result);
370 370
 
Please login to merge, or discard this patch.