Completed
Pull Request — 1.11.x (#1352)
by José
38:59
created
main/gradebook/gradebook_statistics.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,21 +9,21 @@  discard block
 block discarded – undo
9 9
 
10 10
 api_block_anonymous_users();
11 11
 
12
-$eval= Evaluation :: load($_GET['selecteval']);
12
+$eval = Evaluation :: load($_GET['selecteval']);
13 13
 if ($eval[0]->get_category_id() < 0) {
14 14
     // if category id is negative, then the evaluation's origin is a link
15
-    $link= LinkFactory :: get_evaluation_link($eval[0]->get_id());
15
+    $link = LinkFactory :: get_evaluation_link($eval[0]->get_id());
16 16
     $currentcat = Category :: load($link->get_category_id());
17 17
 } else {
18 18
     $currentcat = Category :: load($eval[0]->get_category_id());
19 19
 }
20 20
 
21
-$interbreadcrumb[]= array (
22
-    'url' => $_SESSION['gradebook_dest'].'?selectcat=' . $currentcat[0]->get_id(), 'name' => get_lang('ToolGradebook'));
21
+$interbreadcrumb[] = array(
22
+    'url' => $_SESSION['gradebook_dest'].'?selectcat='.$currentcat[0]->get_id(), 'name' => get_lang('ToolGradebook'));
23 23
 
24 24
 if (api_is_allowed_to_edit()) {
25
-    $interbreadcrumb[]= array (
26
-        'url' => 'gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
25
+    $interbreadcrumb[] = array(
26
+        'url' => 'gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&'.api_get_cidreq(),
27 27
         'name' => get_lang('ViewResult')
28 28
     );
29 29
 }
@@ -37,10 +37,10 @@  discard block
 block discarded – undo
37 37
 
38 38
 if (!$displayscore->is_custom() || empty($displays)) {
39 39
     if (api_is_platform_admin() || api_is_course_admin()) {
40
-        Display :: display_error_message(get_lang('PleaseEnableScoringSystem'),false);
40
+        Display :: display_error_message(get_lang('PleaseEnableScoringSystem'), false);
41 41
     }
42 42
 } else {
43
-    $allresults = Result::load(null,null,$eval[0]->get_id());
43
+    $allresults = Result::load(null, null, $eval[0]->get_id());
44 44
     $nr_items = array();
45 45
     foreach ($displays as $itemsdisplay) {
46 46
         $nr_items[$itemsdisplay['display']] = 0;
@@ -68,19 +68,19 @@  discard block
 block discarded – undo
68 68
     }
69 69
 
70 70
     // Generate table
71
-    $stattable= '<table class="data_table" cellspacing="0" cellpadding="3">';
72
-    $stattable .= '<tr><th>' . get_lang('ScoringSystem') . '</th>';
73
-    $stattable .= '<th>' . get_lang('Percentage') . '</th>';
74
-    $stattable .= '<th>' . get_lang('CountUsers') . '</th>';
71
+    $stattable = '<table class="data_table" cellspacing="0" cellpadding="3">';
72
+    $stattable .= '<tr><th>'.get_lang('ScoringSystem').'</th>';
73
+    $stattable .= '<th>'.get_lang('Percentage').'</th>';
74
+    $stattable .= '<th>'.get_lang('CountUsers').'</th>';
75 75
     //$stattable .= '<th>' . get_lang('Statistics') . '</th></tr>';
76
-    $counter=0;
76
+    $counter = 0;
77 77
     foreach ($keys as $key) {
78
-        $bar = ($highest_ratio > 0?($nr_items[$key] / $highest_ratio) * 100:0);
79
-        $stattable .= '<tr class="row_' . ($counter % 2 == 0 ? 'odd' : 'even') . '">';
80
-        $stattable .= '<td width="150">' . $key . '</td>';
78
+        $bar = ($highest_ratio > 0 ? ($nr_items[$key] / $highest_ratio) * 100 : 0);
79
+        $stattable .= '<tr class="row_'.($counter % 2 == 0 ? 'odd' : 'even').'">';
80
+        $stattable .= '<td width="150">'.$key.'</td>';
81 81
 
82 82
         $stattable .= '<td width="550">'.Display::bar_progress($bar).'</td>';
83
-        $stattable .= '<td align="right">' . $nr_items[$key] . '</td>';
83
+        $stattable .= '<td align="right">'.$nr_items[$key].'</td>';
84 84
         $counter++;
85 85
     }
86 86
     $stattable .= '</tr></table>';
Please login to merge, or discard this patch.
main/gradebook/gradebook_edit_result.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  discard block
 block discarded – undo
7 7
 require_once '../inc/global.inc.php';
8 8
 api_block_anonymous_users();
9 9
 GradebookUtils::block_students();
10
-$select_eval=Security::remove_XSS($_GET['selecteval']);
10
+$select_eval = Security::remove_XSS($_GET['selecteval']);
11 11
 if (empty($select_eval)) {
12 12
     api_not_allowed();
13 13
 }
14
-$resultedit = Result :: load (null,null,$select_eval);
15
-$evaluation = Evaluation :: load ($select_eval);
14
+$resultedit = Result :: load(null, null, $select_eval);
15
+$evaluation = Evaluation :: load($select_eval);
16 16
 
17 17
 $evaluation[0]->check_lock_permissions();
18 18
 
@@ -29,9 +29,9 @@  discard block
 block discarded – undo
29 29
     $values = $edit_result_form->exportValues();
30 30
     $scores = ($values['score']);
31 31
     foreach ($scores as $row) {
32
-        $resultedit = Result :: load (key($scores));
32
+        $resultedit = Result :: load(key($scores));
33 33
         $row_value = $row;
34
-        if ($row_value != '' ) {
34
+        if ($row_value != '') {
35 35
             $resultedit[0]->set_score(floatval(number_format($row_value, api_get_setting('gradebook_number_decimals'))));
36 36
             $resultedit[0]->save();
37 37
         }
@@ -41,15 +41,15 @@  discard block
 block discarded – undo
41 41
     exit;
42 42
 }
43 43
 
44
-$interbreadcrumb[] = array (
44
+$interbreadcrumb[] = array(
45 45
     'url' => $_SESSION['gradebook_dest'],
46 46
     'name' => get_lang('Gradebook')
47 47
 );
48
-$interbreadcrumb[]= array (
48
+$interbreadcrumb[] = array(
49 49
     'url' => 'gradebook_view_result.php?selecteval='.$select_eval.'&'.api_get_cidreq(),
50 50
     'name' => get_lang('ViewResult')
51 51
 );
52 52
 Display :: display_header(get_lang('EditResult'));
53
-DisplayGradebook::display_header_result($evaluation[0],null,0,0);
53
+DisplayGradebook::display_header_result($evaluation[0], null, 0, 0);
54 54
 echo $table;
55 55
 Display :: display_footer();
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/gradebook_showlog_link.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
 api_block_anonymous_users();
12 12
 GradebookUtils::block_students();
13 13
 
14
-$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?','name' => get_lang('Gradebook'));
15
-$interbreadcrumb[] = array ('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']),'name' => get_lang('Details'));
16
-$interbreadcrumb[] = array ('url' => 'gradebook_showlog_link.php?visiblelink='.Security::remove_XSS($_GET['visiblelink']).'&amp;selectcat='.Security::remove_XSS($_GET['selectcat']),	'name' => get_lang('GradebookQualifyLog'));
14
+$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?', 'name' => get_lang('Gradebook'));
15
+$interbreadcrumb[] = array('url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('Details'));
16
+$interbreadcrumb[] = array('url' => 'gradebook_showlog_link.php?visiblelink='.Security::remove_XSS($_GET['visiblelink']).'&amp;selectcat='.Security::remove_XSS($_GET['selectcat']), 'name' => get_lang('GradebookQualifyLog'));
17 17
 $this_section = SECTION_COURSES;
18 18
 Display :: display_header('');
19 19
 echo '<div class="actions">';
@@ -22,21 +22,21 @@  discard block
 block discarded – undo
22 22
 
23 23
 $t_user     = Database :: get_main_table(TABLE_MAIN_USER);
24 24
 $t_link_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
25
-$visible_link=Security::remove_XSS($_GET['visiblelink']);
25
+$visible_link = Security::remove_XSS($_GET['visiblelink']);
26 26
 $evaledit   = EvalLink :: load($visible_link);
27 27
 $sql = "SELECT lk.name,lk.description,lk.weight,lk.visible,lk.type,lk.created_at,us.username
28 28
         FROM ".$t_link_log." lk inner join ".$t_user." us
29 29
         ON lk.user_id_log=us.user_id
30 30
         WHERE lk.id_linkeval_log=".$evaledit[0]->get_id()." AND lk.type='link';";
31
-$result=Database::query($sql);
32
-$list_info=array();
33
-while ($row=Database::fetch_row($result)) {
31
+$result = Database::query($sql);
32
+$list_info = array();
33
+while ($row = Database::fetch_row($result)) {
34 34
     $list_info[] = $row;
35 35
 }
36 36
 
37
-foreach($list_info as $key => $info_log) {
38
-    $list_info[$key][5]=($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
39
-    $list_info[$key][3]=($info_log[3]==1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
37
+foreach ($list_info as $key => $info_log) {
38
+    $list_info[$key][5] = ($info_log[5]) ? api_convert_and_format_date($info_log[5]) : 'N/A';
39
+    $list_info[$key][3] = ($info_log[3] == 1) ? get_lang('GradebookVisible') : get_lang('GradebookInvisible');
40 40
 }
41 41
 
42 42
 $parameters = array(
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
     'selectcat' => Security::remove_XSS($_GET['selectcat']),
45 45
 );
46 46
 
47
-$table = new SortableTableFromArrayConfig($list_info, 1,20,'gradebooklink');
47
+$table = new SortableTableFromArrayConfig($list_info, 1, 20, 'gradebooklink');
48 48
 $table->set_additional_parameters($parameters);
49 49
 $table->set_header(0, get_lang('GradebookNameLog'));
50 50
 $table->set_header(1, get_lang('GradebookDescriptionLog'));
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.php 2 patches
Braces   +2 added lines, -3 removed lines patch added patch discarded remove patch
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
     GradebookUtils::block_students();
228 228
     if (isset ($_GET['set_visible'])) {
229 229
         $visibility_command= 1;
230
-    }else {
230
+    } else {
231 231
         $visibility_command= 0;
232 232
     }
233 233
     $link= LinkFactory :: load($_GET['visiblelink']);
@@ -281,8 +281,7 @@  discard block
 block discarded – undo
281 281
     if ($number_of_selected_items == '0') {
282 282
         $warning_message = get_lang('NoItemsSelected');
283 283
         $filter_warning_msg = false;
284
-    }
285
-    else {
284
+    } else {
286 285
         switch ($_POST['action']) {
287 286
             case 'deleted' :
288 287
                 $number_of_deleted_categories= 0;
Please login to merge, or discard this patch.
Spacing   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 // $cidReset : This is the main difference with gradebook.php, here we say,
10 10
 // basically, that we are inside a course, and many things depend from that
11
-$cidReset= true;
11
+$cidReset = true;
12 12
 $_in_course = false;
13 13
 //make sure the destination for scripts is index.php instead of gradebook.php
14 14
 require_once '../inc/global.inc.php';
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
  </script>';
33 33
 api_block_anonymous_users();
34 34
 
35
-$htmlHeadXtra[]= '<script>
35
+$htmlHeadXtra[] = '<script>
36 36
 function confirmation () {
37 37
 	if (confirm("'.get_lang('DeleteAll').'?")) {
38 38
 	    return true;
@@ -48,10 +48,10 @@  discard block
 block discarded – undo
48 48
 //this is called when there is no data for the course admin
49 49
 if (isset ($_GET['createallcategories'])) {
50 50
     GradebookUtils::block_students();
51
-    $coursecat= Category :: get_not_created_course_categories(api_get_user_id());
51
+    $coursecat = Category :: get_not_created_course_categories(api_get_user_id());
52 52
     if (!count($coursecat) == 0) {
53 53
         foreach ($coursecat as $row) {
54
-            $cat= new Category();
54
+            $cat = new Category();
55 55
             $cat->set_name($row[1]);
56 56
             $cat->set_course_code($row[0]);
57 57
             $cat->set_description(null);
@@ -67,33 +67,33 @@  discard block
 block discarded – undo
67 67
     exit;
68 68
 }
69 69
 //move a category
70
-$selectcat = isset($_GET['selectcat']) ?  (int) $_GET['selectcat'] : '';
70
+$selectcat = isset($_GET['selectcat']) ? (int) $_GET['selectcat'] : '';
71 71
 
72 72
 if (isset($_GET['movecat'])) {
73 73
     $move_cat = Security::remove_XSS($_GET['movecat']);
74 74
     GradebookUtils::block_students();
75
-    $cats= Category :: load($move_cat);
75
+    $cats = Category :: load($move_cat);
76 76
     if (!isset ($_GET['targetcat'])) {
77
-        $move_form= new CatForm(CatForm :: TYPE_MOVE,
77
+        $move_form = new CatForm(CatForm :: TYPE_MOVE,
78 78
             $cats[0],
79 79
             'move_cat_form',
80 80
             null,
81
-            api_get_self() . '?movecat=' . $move_cat. '&selectcat=' . $selectcat
81
+            api_get_self().'?movecat='.$move_cat.'&selectcat='.$selectcat
82 82
         );
83 83
         if ($move_form->validate()) {
84
-            header('Location: ' . api_get_self() . '?selectcat=' . $selectcat
85
-                . '&movecat=' . $move_cat
86
-                . '&targetcat=' . $move_form->exportValue('move_cat'));
84
+            header('Location: '.api_get_self().'?selectcat='.$selectcat
85
+                . '&movecat='.$move_cat
86
+                . '&targetcat='.$move_form->exportValue('move_cat'));
87 87
             exit;
88 88
         }
89 89
     } else {
90
-        $get_target_cat=Security::remove_XSS($_GET['targetcat']);
91
-        $targetcat= Category :: load($get_target_cat);
90
+        $get_target_cat = Security::remove_XSS($_GET['targetcat']);
91
+        $targetcat = Category :: load($get_target_cat);
92 92
         $course_to_crsind = ($cats[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
93 93
 
94 94
         if (!($course_to_crsind && !isset($_GET['confirm']))) {
95 95
             $cats[0]->move_to_cat($targetcat[0]);
96
-            header('Location: ' . api_get_self() . '?categorymoved=&selectcat=' . $selectcat);
96
+            header('Location: '.api_get_self().'?categorymoved=&selectcat='.$selectcat);
97 97
             exit;
98 98
         }
99 99
         unset($targetcat);
@@ -104,8 +104,8 @@  discard block
 block discarded – undo
104 104
 //move an evaluation
105 105
 if (isset ($_GET['moveeval'])) {
106 106
     GradebookUtils::block_students();
107
-    $get_move_eval=Security::remove_XSS($_GET['moveeval']);
108
-    $evals= Evaluation :: load($get_move_eval);
107
+    $get_move_eval = Security::remove_XSS($_GET['moveeval']);
108
+    $evals = Evaluation :: load($get_move_eval);
109 109
     if (!isset ($_GET['targetcat'])) {
110 110
 
111 111
         $move_form = new EvalForm(EvalForm :: TYPE_MOVE,
@@ -113,23 +113,23 @@  discard block
 block discarded – undo
113 113
             null,
114 114
             'move_eval_form',
115 115
             null,
116
-            api_get_self() . '?moveeval=' . $get_move_eval. '&selectcat=' . $selectcat
116
+            api_get_self().'?moveeval='.$get_move_eval.'&selectcat='.$selectcat
117 117
         );
118 118
 
119 119
         if ($move_form->validate()) {
120
-            header('Location: ' .api_get_self() . '?selectcat=' . $selectcat
121
-                . '&moveeval=' . $get_move_eval
122
-                . '&targetcat=' . $move_form->exportValue('move_cat'));
120
+            header('Location: '.api_get_self().'?selectcat='.$selectcat
121
+                . '&moveeval='.$get_move_eval
122
+                . '&targetcat='.$move_form->exportValue('move_cat'));
123 123
             exit;
124 124
         }
125 125
     } else {
126
-        $get_target_cat=Security::remove_XSS($_GET['targetcat']);
127
-        $targetcat= Category :: load($get_target_cat);
126
+        $get_target_cat = Security::remove_XSS($_GET['targetcat']);
127
+        $targetcat = Category :: load($get_target_cat);
128 128
         $course_to_crsind = ($evals[0]->get_course_code() != null && $targetcat[0]->get_course_code() == null);
129 129
 
130 130
         if (!($course_to_crsind && !isset($_GET['confirm']))) {
131 131
             $evals[0]->move_to_cat($targetcat[0]);
132
-            header('Location: ' . api_get_self() . '?evaluationmoved=&selectcat=' . $selectcat);
132
+            header('Location: '.api_get_self().'?evaluationmoved=&selectcat='.$selectcat);
133 133
             exit;
134 134
         }
135 135
         unset ($targetcat);
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
 //move a link
141 141
 if (isset ($_GET['movelink'])) {
142 142
     GradebookUtils::block_students();
143
-    $get_move_link=Security::remove_XSS($_GET['movelink']);
144
-    $link= LinkFactory :: load($get_move_link);
143
+    $get_move_link = Security::remove_XSS($_GET['movelink']);
144
+    $link = LinkFactory :: load($get_move_link);
145 145
     $move_form = new LinkForm(
146 146
         LinkForm :: TYPE_MOVE,
147 147
         null,
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
         api_get_self().'?movelink='.$get_move_link.'&selectcat='.$selectcat
152 152
     );
153 153
     if ($move_form->validate()) {
154
-        $targetcat= Category :: load($move_form->exportValue('move_cat'));
154
+        $targetcat = Category :: load($move_form->exportValue('move_cat'));
155 155
         $link[0]->move_to_cat($targetcat[0]);
156 156
         unset ($link);
157
-        header('Location: ' . api_get_self(). '?linkmoved=&selectcat=' . $selectcat);
157
+        header('Location: '.api_get_self().'?linkmoved=&selectcat='.$selectcat);
158 158
         exit;
159 159
     }
160 160
 }
@@ -163,11 +163,11 @@  discard block
 block discarded – undo
163 163
 if (isset ($_GET['visiblecat'])) {
164 164
     GradebookUtils::block_students();
165 165
     if (isset ($_GET['set_visible'])) {
166
-        $visibility_command= 1;
166
+        $visibility_command = 1;
167 167
     } else {
168
-        $visibility_command= 0;
168
+        $visibility_command = 0;
169 169
     }
170
-    $cats= Category :: load($_GET['visiblecat']);
170
+    $cats = Category :: load($_GET['visiblecat']);
171 171
     $cats[0]->set_visible($visibility_command);
172 172
     $cats[0]->save();
173 173
     $cats[0]->apply_visibility_to_children();
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
 }
183 183
 if (isset ($_GET['deletecat'])) {
184 184
     GradebookUtils::block_students();
185
-    $cats= Category :: load($_GET['deletecat']);
185
+    $cats = Category :: load($_GET['deletecat']);
186 186
     //delete all categories,subcategories and results
187 187
     if ($cats[0] != null) {
188 188
         if ($cats[0]->get_id() != 0) {
@@ -197,12 +197,12 @@  discard block
 block discarded – undo
197 197
 if (isset ($_GET['visibleeval'])) {
198 198
     GradebookUtils::block_students();
199 199
     if (isset ($_GET['set_visible'])) {
200
-        $visibility_command= 1;
200
+        $visibility_command = 1;
201 201
     } else {
202
-        $visibility_command= 0;
202
+        $visibility_command = 0;
203 203
     }
204 204
 
205
-    $eval= Evaluation :: load($_GET['visibleeval']);
205
+    $eval = Evaluation :: load($_GET['visibleeval']);
206 206
     $eval[0]->set_visible($visibility_command);
207 207
     $eval[0]->save();
208 208
     unset ($eval);
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 }
217 217
 if (isset ($_GET['deleteeval'])) {
218 218
     GradebookUtils::block_students();
219
-    $eval= Evaluation :: load($_GET['deleteeval']);
219
+    $eval = Evaluation :: load($_GET['deleteeval']);
220 220
     if ($eval[0] != null) {
221 221
         $eval[0]->delete_with_results();
222 222
     }
@@ -227,11 +227,11 @@  discard block
 block discarded – undo
227 227
 if (isset ($_GET['visiblelink'])) {
228 228
     GradebookUtils::block_students();
229 229
     if (isset ($_GET['set_visible'])) {
230
-        $visibility_command= 1;
231
-    }else {
232
-        $visibility_command= 0;
230
+        $visibility_command = 1;
231
+    } else {
232
+        $visibility_command = 0;
233 233
     }
234
-    $link= LinkFactory :: load($_GET['visiblelink']);
234
+    $link = LinkFactory :: load($_GET['visiblelink']);
235 235
     $link[0]->set_visible($visibility_command);
236 236
     $link[0]->save();
237 237
     unset ($link);
@@ -247,7 +247,7 @@  discard block
 block discarded – undo
247 247
     GradebookUtils::block_students();
248 248
     //fixing #5229
249 249
     if (!empty($_GET['deletelink'])) {
250
-        $link= LinkFactory :: load($_GET['deletelink']);
250
+        $link = LinkFactory :: load($_GET['deletelink']);
251 251
         if ($link[0] != null) {
252 252
             $link[0]->delete();
253 253
         }
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
     }
265 265
     $button = '<form name="confirm"
266 266
                  method="post"
267
-                 action="'.api_get_self() .'?confirm='
268
-        .(isset($_GET['movecat']) ? '&movecat=' . Security::remove_XSS($_GET['movecat'])
269
-            : '&moveeval=' . Security::remove_XSS($_GET['moveeval']) ).'&selectcat=' . $selectcat.'&targetcat=' . Security::remove_XSS($_GET['targetcat']).'">
267
+                 action="'.api_get_self().'?confirm='
268
+        .(isset($_GET['movecat']) ? '&movecat='.Security::remove_XSS($_GET['movecat'])
269
+            : '&moveeval='.Security::remove_XSS($_GET['moveeval'])).'&selectcat='.$selectcat.'&targetcat='.Security::remove_XSS($_GET['targetcat']).'">
270 270
 			   <input type="submit" value="'.'  '.get_lang('Ok').'  '.'">
271 271
 			   </form>';
272 272
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
 //actions on the sortabletable
277 277
 if (isset ($_POST['action'])) {
278 278
     GradebookUtils::block_students();
279
-    $number_of_selected_items= count($_POST['id']);
279
+    $number_of_selected_items = count($_POST['id']);
280 280
     if ($number_of_selected_items == '0') {
281 281
         $warning_message = get_lang('NoItemsSelected');
282 282
         $filter_warning_msg = false;
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
     else {
285 285
         switch ($_POST['action']) {
286 286
             case 'deleted' :
287
-                $number_of_deleted_categories= 0;
288
-                $number_of_deleted_evaluations= 0;
289
-                $number_of_deleted_links= 0;
287
+                $number_of_deleted_categories = 0;
288
+                $number_of_deleted_evaluations = 0;
289
+                $number_of_deleted_links = 0;
290 290
                 foreach ($_POST['id'] as $indexstr) {
291 291
                     if (api_substr($indexstr, 0, 4) == 'CATE') {
292
-                        $cats= Category :: load(api_substr($indexstr, 4));
292
+                        $cats = Category :: load(api_substr($indexstr, 4));
293 293
                         if ($cats[0] != null) {
294 294
                             $cats[0]->delete_all();
295 295
                         }
296 296
                         $number_of_deleted_categories++;
297 297
                     }
298 298
                     if (api_substr($indexstr, 0, 4) == 'EVAL') {
299
-                        $eval= Evaluation :: load(api_substr($indexstr, 4));
299
+                        $eval = Evaluation :: load(api_substr($indexstr, 4));
300 300
                         if ($eval[0] != null) {
301 301
                             $eval[0]->delete_with_results();
302 302
                         }
@@ -305,7 +305,7 @@  discard block
 block discarded – undo
305 305
                     if (api_substr($indexstr, 0, 4) == 'LINK') {
306 306
                         $id = api_substr($indexstr, 4);
307 307
                         if (!empty($id)) {
308
-                            $link= LinkFactory :: load();
308
+                            $link = LinkFactory :: load();
309 309
                             if ($link[0] != null) {
310 310
                                 $link[0]->delete();
311 311
                             }
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
                         }
314 314
                     }
315 315
                 }
316
-                $confirmation_message = get_lang('DeletedCategories') . ' : <b>' . $number_of_deleted_categories . '</b><br />' . get_lang('DeletedEvaluations') . ' : <b>' . $number_of_deleted_evaluations . '</b><br />' . get_lang('DeletedLinks') . ' : <b>' . $number_of_deleted_links . '</b><br /><br />' . get_lang('TotalItems') . ' : <b>' . $number_of_selected_items . '</b>';
316
+                $confirmation_message = get_lang('DeletedCategories').' : <b>'.$number_of_deleted_categories.'</b><br />'.get_lang('DeletedEvaluations').' : <b>'.$number_of_deleted_evaluations.'</b><br />'.get_lang('DeletedLinks').' : <b>'.$number_of_deleted_links.'</b><br /><br />'.get_lang('TotalItems').' : <b>'.$number_of_selected_items.'</b>';
317 317
                 $filter_confirm_msg = false;
318 318
                 break;
319 319
             case 'setvisible' :
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
 }
366 366
 
367 367
 if (isset ($_POST['submit']) && isset ($_POST['keyword'])) {
368
-    header('Location: ' . api_get_self() . '?selectcat=' . $selectcat
368
+    header('Location: '.api_get_self().'?selectcat='.$selectcat
369 369
         . '&search='.Security::remove_XSS($_POST['keyword']));
370 370
     exit;
371 371
 }
@@ -373,8 +373,8 @@  discard block
 block discarded – undo
373 373
 // DISPLAY HEADERS AND MESSAGES                           -
374 374
 if (!isset($_GET['exportpdf']) && !isset($_GET['export_certificate'])) {
375 375
     if (isset ($_GET['studentoverview'])) {
376
-        $interbreadcrumb[]= array (
377
-            'url' => $_SESSION['gradebook_dest'].'?selectcat=' . $selectcat.'&'.api_get_cidreq(),
376
+        $interbreadcrumb[] = array(
377
+            'url' => $_SESSION['gradebook_dest'].'?selectcat='.$selectcat.'&'.api_get_cidreq(),
378 378
             'name' => get_lang('ToolGradebook')
379 379
         );
380 380
         Display :: display_header(get_lang('FlatView'));
@@ -385,13 +385,13 @@  discard block
 block discarded – undo
385 385
             $gradebook_dest = Security::remove_XSS($_SESSION['gradebook_dest']);
386 386
         }
387 387
 
388
-        $interbreadcrumb[]= array ('url' => $gradebook_dest,'name' => get_lang('Gradebook'));
388
+        $interbreadcrumb[] = array('url' => $gradebook_dest, 'name' => get_lang('Gradebook'));
389 389
 
390
-        if ((isset($_GET['selectcat']) && $_GET['selectcat']>0)) {
390
+        if ((isset($_GET['selectcat']) && $_GET['selectcat'] > 0)) {
391 391
             if (!empty($_GET['course'])) {
392
-                $interbreadcrumb[]= array ('url' => $gradebook_dest.'selectcat='.$selectcat,'name' => get_lang('Details'));
392
+                $interbreadcrumb[] = array('url' => $gradebook_dest.'selectcat='.$selectcat, 'name' => get_lang('Details'));
393 393
             } else {
394
-                $interbreadcrumb[]= array ('url' => $_SESSION['gradebook_dest'].'?selectcat=0','name' => get_lang('Details'));
394
+                $interbreadcrumb[] = array('url' => $_SESSION['gradebook_dest'].'?selectcat=0', 'name' => get_lang('Details'));
395 395
             }
396 396
         }
397 397
         Display :: display_header('');
@@ -401,50 +401,50 @@  discard block
 block discarded – undo
401 401
 }
402 402
 
403 403
 if (isset($_GET['categorymoved'])) {
404
-    Display :: display_confirmation_message(get_lang('CategoryMoved'),false);
404
+    Display :: display_confirmation_message(get_lang('CategoryMoved'), false);
405 405
 }
406 406
 if (isset($_GET['evaluationmoved'])) {
407
-    Display :: display_confirmation_message(get_lang('EvaluationMoved'),false);
407
+    Display :: display_confirmation_message(get_lang('EvaluationMoved'), false);
408 408
 }
409 409
 if (isset($_GET['linkmoved'])) {
410
-    Display :: display_confirmation_message(get_lang('LinkMoved'),false);
410
+    Display :: display_confirmation_message(get_lang('LinkMoved'), false);
411 411
 }
412 412
 if (isset ($_GET['addcat'])) {
413
-    Display :: display_confirmation_message(get_lang('CategoryAdded'),false);
413
+    Display :: display_confirmation_message(get_lang('CategoryAdded'), false);
414 414
 }
415 415
 if (isset ($_GET['linkadded'])) {
416
-    Display :: display_confirmation_message(get_lang('LinkAdded'),false);
416
+    Display :: display_confirmation_message(get_lang('LinkAdded'), false);
417 417
 }
418 418
 if (isset ($_GET['addresult'])) {
419
-    Display :: display_confirmation_message(get_lang('ResultAdded'),false);
419
+    Display :: display_confirmation_message(get_lang('ResultAdded'), false);
420 420
 }
421 421
 if (isset ($_GET['editcat'])) {
422
-    Display :: display_confirmation_message(get_lang('CategoryEdited'),false);
422
+    Display :: display_confirmation_message(get_lang('CategoryEdited'), false);
423 423
 }
424 424
 if (isset ($_GET['editeval'])) {
425
-    Display :: display_confirmation_message(get_lang('EvaluationEdited'),false);
425
+    Display :: display_confirmation_message(get_lang('EvaluationEdited'), false);
426 426
 }
427 427
 if (isset ($_GET['linkedited'])) {
428
-    Display :: display_confirmation_message(get_lang('LinkEdited'),false);
428
+    Display :: display_confirmation_message(get_lang('LinkEdited'), false);
429 429
 }
430 430
 if (isset ($_GET['nolinkitems'])) {
431
-    Display :: display_warning_message(get_lang('NoLinkItems'),false);
431
+    Display :: display_warning_message(get_lang('NoLinkItems'), false);
432 432
 }
433 433
 if (isset ($_GET['addallcat'])) {
434
-    Display :: display_normal_message(get_lang('AddAllCat'),false);
434
+    Display :: display_normal_message(get_lang('AddAllCat'), false);
435 435
 }
436 436
 if (isset ($confirmation_message)) {
437
-    Display :: display_confirmation_message($confirmation_message,$filter_confirm_msg);
437
+    Display :: display_confirmation_message($confirmation_message, $filter_confirm_msg);
438 438
 }
439 439
 if (isset ($warning_message)) {
440
-    Display :: display_warning_message($warning_message,$filter_warning_msg);
440
+    Display :: display_warning_message($warning_message, $filter_warning_msg);
441 441
 }
442 442
 if (isset ($move_form)) {
443
-    Display :: display_normal_message($move_form->toHtml(),false);
443
+    Display :: display_normal_message($move_form->toHtml(), false);
444 444
 }
445 445
 // LOAD DATA & DISPLAY TABLE                             -
446
-$is_platform_admin= api_is_platform_admin();
447
-$is_course_admin= api_is_allowed_to_edit();
446
+$is_platform_admin = api_is_platform_admin();
447
+$is_course_admin = api_is_allowed_to_edit();
448 448
 
449 449
 //load data for category, evaluation and links
450 450
 if (empty($selectcat)) {
@@ -461,7 +461,7 @@  discard block
 block discarded – undo
461 461
     null,
462 462
     api_get_self().'?selectcat='.$selectcat
463 463
 );
464
-$values= $simple_search_form->exportValues();
464
+$values = $simple_search_form->exportValues();
465 465
 $keyword = '';
466 466
 if (isset($_GET['search']) && !empty($_GET['search'])) {
467 467
     $keyword = Security::remove_XSS($_GET['search']);
@@ -471,13 +471,13 @@  discard block
 block discarded – undo
471 471
 }
472 472
 
473 473
 if (!empty($keyword)) {
474
-    $cats= Category :: load($category);
475
-    $allcat= array ();
476
-    if ((isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search'])) {
477
-        $allcat= $cats[0]->get_subcategories(null);
478
-        $allcat_info = Category::find_category($keyword,$allcat);
479
-        $alleval=array();
480
-        $alllink=array();
474
+    $cats = Category :: load($category);
475
+    $allcat = array();
476
+    if ((isset($_GET['selectcat']) && $_GET['selectcat'] == 0) && isset($_GET['search'])) {
477
+        $allcat = $cats[0]->get_subcategories(null);
478
+        $allcat_info = Category::find_category($keyword, $allcat);
479
+        $alleval = array();
480
+        $alllink = array();
481 481
     } else {
482 482
         $alleval = Evaluation::find_evaluations($keyword, $cats[0]->get_id());
483 483
         $alllink = LinkFactory::find_links($keyword, $cats[0]->get_id());
@@ -485,13 +485,13 @@  discard block
 block discarded – undo
485 485
 
486 486
 } elseif (isset ($_GET['studentoverview'])) {
487 487
     //@todo this code seems to be deprecated because the gradebook tab is off
488
-    $cats= Category :: load($category);
489
-    $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
490
-    $allcat= array ();
491
-    $alleval= $cats[0]->get_evaluations($stud_id, true);
492
-    $alllink= $cats[0]->get_links($stud_id, true);
488
+    $cats = Category :: load($category);
489
+    $stud_id = (api_is_allowed_to_edit() ? null : api_get_user_id());
490
+    $allcat = array();
491
+    $alleval = $cats[0]->get_evaluations($stud_id, true);
492
+    $alllink = $cats[0]->get_links($stud_id, true);
493 493
     if (isset ($_GET['exportpdf'])) {
494
-        $datagen = new GradebookDataGenerator ($allcat,$alleval, $alllink);
494
+        $datagen = new GradebookDataGenerator($allcat, $alleval, $alllink);
495 495
         $header_names = array(
496 496
             get_lang('Name'),
497 497
             get_lang('Description'),
@@ -499,18 +499,18 @@  discard block
 block discarded – undo
499 499
             get_lang('Date'),
500 500
             get_lang('Results'),
501 501
         );
502
-        $data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME,0,null,true);
502
+        $data_array = $datagen->get_data(GradebookDataGenerator :: GDG_SORT_NAME, 0, null, true);
503 503
         $newarray = array();
504 504
         foreach ($data_array as $data) {
505 505
             $newarray[] = array_slice($data, 1);
506 506
         }
507
-        $pdf= new Cezpdf();
507
+        $pdf = new Cezpdf();
508 508
         $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
509 509
         $pdf->ezSetMargins(30, 30, 50, 30);
510 510
         $pdf->ezSetY(810);
511
-        $pdf->ezText(get_lang('FlatView').' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT) . ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')',12,array('justification'=>'center'));
512
-        $pdf->line(50,790,550,790);
513
-        $pdf->line(50,40,550,40);
511
+        $pdf->ezText(get_lang('FlatView').' ('.api_convert_and_format_date(null, DATE_FORMAT_SHORT).' '.api_convert_and_format_date(null, TIME_NO_SEC_FORMAT).')', 12, array('justification'=>'center'));
512
+        $pdf->line(50, 790, 550, 790);
513
+        $pdf->line(50, 40, 550, 40);
514 514
         $pdf->ezSetY(750);
515 515
         $pdf->ezTable(
516 516
             $newarray,
@@ -527,57 +527,57 @@  discard block
 block discarded – undo
527 527
         $pdf->ezStream();
528 528
         exit;
529 529
     }
530
-} elseif (!empty($_GET['export_certificate'])){
530
+} elseif (!empty($_GET['export_certificate'])) {
531 531
     //@todo this code seems not to be used
532 532
     $user_id = strval(intval($_GET['user']));
533
-    if (!api_is_allowed_to_edit(true,true)) {
533
+    if (!api_is_allowed_to_edit(true, true)) {
534 534
         $user_id = api_get_user_id();
535 535
     }
536
-    $category = Category :: load ($_GET['cat_id']);
536
+    $category = Category :: load($_GET['cat_id']);
537 537
     if ($category[0]->is_certificate_available($user_id)) {
538 538
         $user = api_get_user_info($user_id);
539 539
         $scoredisplay = ScoreDisplay :: instance();
540 540
         $scorecourse = $category[0]->calc_score($user_id);
541
-        $scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse,SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
541
+        $scorecourse_display = (isset($scorecourse) ? $scoredisplay->display_score($scorecourse, SCORE_AVERAGE) : get_lang('NoResultsAvailable'));
542 542
 
543 543
         $cattotal = Category :: load(0);
544
-        $scoretotal= $cattotal[0]->calc_score($user_id);
545
-        $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal,SCORE_PERCENT) : get_lang('NoResultsAvailable'));
544
+        $scoretotal = $cattotal[0]->calc_score($user_id);
545
+        $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
546 546
 
547 547
         //prepare all necessary variables:
548 548
         $organization_name = api_get_setting('Institution');
549 549
         $portal_name = api_get_setting('siteName');
550 550
         $stud_fn = $user['firstname'];
551 551
         $stud_ln = $user['lastname'];
552
-        $certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'),$organization_name,$stud_fn.' '.$stud_ln,$category[0]->get_name(),$scorecourse_display);
553
-        $certif_text = str_replace("\\n","\n",$certif_text);
552
+        $certif_text = sprintf(get_lang('CertificateWCertifiesStudentXFinishedCourseYWithGradeZ'), $organization_name, $stud_fn.' '.$stud_ln, $category[0]->get_name(), $scorecourse_display);
553
+        $certif_text = str_replace("\\n", "\n", $certif_text);
554 554
         $date = api_convert_and_format_date(null, DATE_FORMAT_SHORT);
555 555
 
556
-        $pdf= new Cezpdf('a4','landscape');
556
+        $pdf = new Cezpdf('a4', 'landscape');
557 557
         $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
558 558
         $pdf->ezSetMargins(30, 30, 50, 50);
559 559
         //line Y coordinates in landscape mode are upside down (500 is on top, 10 is on the bottom)
560
-        $pdf->line(50,50,790,50);
561
-        $pdf->line(50,550,790,550);
560
+        $pdf->line(50, 50, 790, 50);
561
+        $pdf->line(50, 550, 790, 550);
562 562
         $pdf->ezSetY(450);
563 563
         $pdf->ezSetY(480);
564
-        $pdf->ezText($certif_text,28,array('justification'=>'center'));
564
+        $pdf->ezText($certif_text, 28, array('justification'=>'center'));
565 565
         //$pdf->ezSetY(750);
566 566
         $pdf->ezSetY(50);
567
-        $pdf->ezText($date,18,array('justification'=>'center'));
567
+        $pdf->ezText($date, 18, array('justification'=>'center'));
568 568
         $pdf->ezSetY(580);
569
-        $pdf->ezText($organization_name,22,array('justification'=>'left'));
569
+        $pdf->ezText($organization_name, 22, array('justification'=>'left'));
570 570
         $pdf->ezSetY(580);
571
-        $pdf->ezText($portal_name,22,array('justification'=>'right'));
571
+        $pdf->ezText($portal_name, 22, array('justification'=>'right'));
572 572
         $pdf->ezStream();
573 573
     }
574 574
     exit;
575 575
 } else {
576
-    $cats= Category :: load($category);
577
-    $stud_id= (api_is_allowed_to_edit() ? null : api_get_user_id());
578
-    $allcat= $cats[0]->get_subcategories($stud_id);
579
-    $alleval= $cats[0]->get_evaluations($stud_id);
580
-    $alllink= $cats[0]->get_links($stud_id);
576
+    $cats = Category :: load($category);
577
+    $stud_id = (api_is_allowed_to_edit() ? null : api_get_user_id());
578
+    $allcat = $cats[0]->get_subcategories($stud_id);
579
+    $alleval = $cats[0]->get_evaluations($stud_id);
580
+    $alllink = $cats[0]->get_links($stud_id);
581 581
 }
582 582
 $addparams = array('selectcat' => $cats[0]->get_id());
583 583
 if (isset($_GET['search'])) {
@@ -586,10 +586,10 @@  discard block
 block discarded – undo
586 586
 if (isset ($_GET['studentoverview'])) {
587 587
     $addparams['studentoverview'] = '';
588 588
 }
589
-if (isset($allcat_info) && count($allcat_info)>=0 && (isset($_GET['selectcat']) && $_GET['selectcat']==0) && isset($_GET['search']) && strlen(trim($_GET['search']))>0 ) {
590
-    $allcat=$allcat_info;
589
+if (isset($allcat_info) && count($allcat_info) >= 0 && (isset($_GET['selectcat']) && $_GET['selectcat'] == 0) && isset($_GET['search']) && strlen(trim($_GET['search'])) > 0) {
590
+    $allcat = $allcat_info;
591 591
 } else {
592
-    $allcat=$allcat;
592
+    $allcat = $allcat;
593 593
 }
594 594
 $gradebooktable = new GradebookTable(
595 595
     $cats[0],
@@ -602,10 +602,10 @@  discard block
 block discarded – undo
602 602
     api_is_course_tutor()
603 603
 ) {
604 604
     Display :: display_normal_message(
605
-        get_lang('GradebookWelcomeMessage') .
605
+        get_lang('GradebookWelcomeMessage').
606 606
         '<br /><br />
607
-        <form name="createcat" method="post" action="' . api_get_self() . '?createallcategories=1">
608
-        <input type="submit" value="' . get_lang('CreateAllCat') . '"></form>',
607
+        <form name="createcat" method="post" action="' . api_get_self().'?createallcategories=1">
608
+        <input type="submit" value="' . get_lang('CreateAllCat').'"></form>',
609 609
         false
610 610
     );
611 611
 }
Please login to merge, or discard this patch.
main/gradebook/gradebook_add_result.php 2 patches
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -39,7 +39,9 @@
 block discarded – undo
39 39
         $res->set_evaluation_id($values['evaluation_id']);
40 40
         $res->set_user_id(key($scores));
41 41
         //if no scores are given, don't set the score
42
-        if ((!empty ($row)) || ($row == '0')) $res->set_score($row);
42
+        if ((!empty ($row)) || ($row == '0')) {
43
+            $res->set_score($row);
44
+        }
43 45
         $res->add();
44 46
         next($scores);
45 47
     }
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 //$cidReset = true;
9 9
 require_once '../inc/global.inc.php';
10
-$current_course_tool  = TOOL_GRADEBOOK;
10
+$current_course_tool = TOOL_GRADEBOOK;
11 11
 
12 12
 api_protect_course_script(true);
13 13
 api_block_anonymous_users();
@@ -25,14 +25,14 @@  discard block
 block discarded – undo
25 25
     $resultadd,
26 26
     'add_result_form',
27 27
     null,
28
-    api_get_self() . '?selectcat=' . Security::remove_XSS($category) . '&selecteval=' . $selectEval.'&'.api_get_cidreq()
28
+    api_get_self().'?selectcat='.Security::remove_XSS($category).'&selecteval='.$selectEval.'&'.api_get_cidreq()
29 29
 );
30 30
 $table = $add_result_form->toHtml();
31 31
 if ($add_result_form->validate()) {
32 32
     $values = $add_result_form->exportValues();
33 33
     $nr_users = $values['nr_users'];
34 34
     if ($nr_users == '0') {
35
-        header('Location: gradebook_view_result.php?addresultnostudents=&selecteval=' . $selectEval.'&'.api_get_cidreq());
35
+        header('Location: gradebook_view_result.php?addresultnostudents=&selecteval='.$selectEval.'&'.api_get_cidreq());
36 36
         exit;
37 37
     }
38 38
     $scores = ($values['score']);
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $res->add();
46 46
         next($scores);
47 47
     }
48
-    header('Location: gradebook_view_result.php?addresult=&selecteval=' . $selectEval.'&'.api_get_cidreq());
48
+    header('Location: gradebook_view_result.php?addresult=&selecteval='.$selectEval.'&'.api_get_cidreq());
49 49
     exit;
50 50
 }
51 51
 $interbreadcrumb[] = array(
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.