Completed
Pull Request — 1.11.x (#1274)
by José
554:53 queued 513:46
created
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/gradebook_edit_link.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -11,20 +11,20 @@  discard block
 block discarded – undo
11 11
 GradebookUtils::block_students();
12 12
 $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
13 13
 //selected name of database
14
-$course_id              = GradebookUtils::get_course_id_by_link_id($_GET['editlink']);
15
-$tbl_forum_thread 		= Database :: get_course_table(TABLE_FORUM_THREAD);
16
-$tbl_work 				= Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
17
-$tbl_attendance 		= Database :: get_course_table(TABLE_ATTENDANCE);
14
+$course_id = GradebookUtils::get_course_id_by_link_id($_GET['editlink']);
15
+$tbl_forum_thread = Database :: get_course_table(TABLE_FORUM_THREAD);
16
+$tbl_work = Database :: get_course_table(TABLE_STUDENT_PUBLICATION);
17
+$tbl_attendance = Database :: get_course_table(TABLE_ATTENDANCE);
18 18
 
19
-$linkarray 				= LinkFactory :: load($_GET['editlink']);
19
+$linkarray = LinkFactory :: load($_GET['editlink']);
20 20
 /** @var AbstractLink $link */
21 21
 $link = $linkarray[0];
22 22
 if ($link->is_locked() && !api_is_platform_admin()) {
23 23
     api_not_allowed();
24 24
 }
25 25
 
26
-$linkcat  = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']):'';
27
-$linkedit = isset($_GET['editlink']) ? Security::remove_XSS($_GET['editlink']):'';
26
+$linkcat  = isset($_GET['selectcat']) ? Security::remove_XSS($_GET['selectcat']) : '';
27
+$linkedit = isset($_GET['editlink']) ? Security::remove_XSS($_GET['editlink']) : '';
28 28
 
29 29
 $session_id = api_get_session_id();
30 30
 if ($session_id == 0) {
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
     null,
40 40
     $link,
41 41
     'edit_link_form',
42
-    api_get_self() . '?selectcat=' . $linkcat. '&editlink=' . $linkedit.'&'.api_get_cidreq()
42
+    api_get_self().'?selectcat='.$linkcat.'&editlink='.$linkedit.'&'.api_get_cidreq()
43 43
 );
44 44
 if ($form->validate()) {
45 45
     $values = $form->exportValues();
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     //Update weight for attendance
59 59
     $sql = 'SELECT ref_id FROM '.$tbl_grade_links.'
60 60
             WHERE id = '.intval($_GET['editlink']).' AND type='.LINK_ATTENDANCE;
61
-    $rs_attendance  = Database::query($sql);
61
+    $rs_attendance = Database::query($sql);
62 62
     if (Database::num_rows($rs_attendance) > 0) {
63 63
         $row_attendance = Database::fetch_array($rs_attendance);
64 64
         $attendance_id  = $row_attendance['ref_id'];
@@ -81,11 +81,11 @@  discard block
 block discarded – undo
81 81
               weight='.$final_weight.'
82 82
 			  WHERE c_id = '.$course_id.' AND id = (
83 83
 			    SELECT ref_id FROM '.$tbl_grade_links.'
84
-			    WHERE id='.intval($_GET['editlink'] ).' AND type=3
84
+			    WHERE id='.intval($_GET['editlink']).' AND type=3
85 85
               )';
86 86
 
87 87
     Database::query($sql_t);
88
-    header('Location: '.$_SESSION['gradebook_dest'].'?linkedited=&selectcat=' . $link->get_category_id().'&'.api_get_cidreq());
88
+    header('Location: '.$_SESSION['gradebook_dest'].'?linkedited=&selectcat='.$link->get_category_id().'&'.api_get_cidreq());
89 89
     exit;
90 90
 }
91 91
 
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/gradebook_add_link_select_course.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
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();
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 $catadd = new Category();
17 17
 $catadd->set_user_id(api_get_user_id());
18 18
 $catadd->set_parent_id($_GET['selectcat']);
19
-$catcourse = Category :: load ($_GET['selectcat']);
19
+$catcourse = Category :: load($_GET['selectcat']);
20 20
 $form = new CatForm(
21 21
     CatForm :: TYPE_SELECT_COURSE,
22 22
     $catadd,
23 23
     'add_cat_form',
24 24
     null,
25
-    api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq()
25
+    api_get_self().'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq()
26 26
 );
27 27
 
28 28
 if ($form->validate()) {
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
     $cat = new Category();
31 31
     $cat->set_course_code($values['select_course']);
32 32
     $cat->set_name($values['name']);
33
-    header('location: gradebook_add_link.php?selectcat=' .Security::remove_XSS($_GET['selectcat']).'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
33
+    header('location: gradebook_add_link.php?selectcat='.Security::remove_XSS($_GET['selectcat']).'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
34 34
     exit;
35 35
 }
36 36
 
37
-$interbreadcrumb[] = array (
37
+$interbreadcrumb[] = array(
38 38
     'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq(),
39 39
     'name' => get_lang('Gradebook')
40 40
 );
Please login to merge, or discard this patch.
main/gradebook/lib/user_data_generator.class.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -50,9 +50,9 @@  discard block
 block discarded – undo
50 50
 
51 51
         }
52 52
         if (count($result) == 0) {
53
-            $evals_filtered=$evals;
53
+            $evals_filtered = $evals;
54 54
         } else {
55
-            $evals_filtered=$evals_filtered_copy;
55
+            $evals_filtered = $evals_filtered_copy;
56 56
         }
57 57
         $this->items = array_merge($evals_filtered, $links);
58 58
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 	{
86 86
 		// do some checks on count, redefine if invalid value
87 87
 		if (!isset($count)) {
88
-			$count = count ($this->items) - $start;
88
+			$count = count($this->items) - $start;
89 89
 		}
90 90
 		if ($count < 0) {
91 91
 			$count = 0;
@@ -104,20 +104,20 @@  discard block
 block discarded – undo
104 104
 		} elseif ($sorting & self :: UDG_SORT_AVERAGE) {
105 105
 			// if user sorts on average scores, first calculate them and cache them
106 106
 			foreach ($allitems as $item) {
107
-				$this->avgcache[$item->get_item_type() . $item->get_id()]= $item->calc_score();
107
+				$this->avgcache[$item->get_item_type().$item->get_id()] = $item->calc_score();
108 108
 			}
109 109
 			usort($allitems, array('UserDataGenerator', 'sort_by_average'));
110 110
 		} elseif ($sorting & self :: UDG_SORT_SCORE) {
111 111
 			// if user sorts on student's scores, first calculate them and cache them
112 112
 			foreach ($allitems as $item) {
113
-				$this->scorecache[$item->get_item_type() . $item->get_id()]
113
+				$this->scorecache[$item->get_item_type().$item->get_id()]
114 114
 					= $item->calc_score($this->userid);
115 115
 			}
116 116
 			usort($allitems, array('UserDataGenerator', 'sort_by_score'));
117 117
 		} elseif ($sorting & self :: UDG_SORT_MASK) {
118 118
 			// if user sorts on student's masks, first calculate scores and cache them
119 119
 			foreach ($allitems as $item) {
120
-				$this->scorecache[$item->get_item_type() . $item->get_id()]
120
+				$this->scorecache[$item->get_item_type().$item->get_id()]
121 121
 					= $item->calc_score($this->userid);
122 122
 			}
123 123
 			usort($allitems, array('UserDataGenerator', 'sort_by_mask'));
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 		// fill score cache if not done yet
133 133
 		if (!isset ($this->scorecache)) {
134 134
 			foreach ($visibleitems as $item) {
135
-				$this->scorecache[$item->get_item_type() . $item->get_id()]
135
+				$this->scorecache[$item->get_item_type().$item->get_id()]
136 136
 					= $item->calc_score($this->userid);
137 137
 			}
138 138
 
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 		$scoredisplay = ScoreDisplay :: instance();
142 142
 		$data = array();
143 143
 		foreach ($visibleitems as $item) {
144
-			$row = array ();
144
+			$row = array();
145 145
 			$row[] = $item;
146 146
 			$row[] = $item->get_name();
147 147
 			$row[] = $this->build_course_name($item);
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
 	function sort_by_type($item1, $item2)
164 164
 	{
165 165
 		if ($item1->get_item_type() == $item2->get_item_type()) {
166
-			return $this->sort_by_name($item1,$item2);
166
+			return $this->sort_by_name($item1, $item2);
167 167
 		} else {
168 168
 			return ($item1->get_item_type() < $item2->get_item_type() ? -1 : 1);
169 169
 		}
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	 */
204 204
 	function sort_by_name($item1, $item2)
205 205
 	{
206
-		return api_strnatcmp($item1->get_name(),$item2->get_name());
206
+		return api_strnatcmp($item1->get_name(), $item2->get_name());
207 207
 	}
208 208
 
209 209
 	/**
@@ -213,8 +213,8 @@  discard block
 block discarded – undo
213 213
 	 */
214 214
 	function sort_by_average($item1, $item2)
215 215
 	{
216
-		$score1 = $this->avgcache[$item1->get_item_type() . $item1->get_id()];
217
-		$score2 = $this->avgcache[$item2->get_item_type() . $item2->get_id()];
216
+		$score1 = $this->avgcache[$item1->get_item_type().$item1->get_id()];
217
+		$score2 = $this->avgcache[$item2->get_item_type().$item2->get_id()];
218 218
 
219 219
 		return $this->compare_scores($score1, $score2);
220 220
 	}
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 */
227 227
 	function sort_by_score($item1, $item2)
228 228
 	{
229
-		$score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()];
230
-		$score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()];
229
+		$score1 = $this->scorecache[$item1->get_item_type().$item1->get_id()];
230
+		$score2 = $this->scorecache[$item2->get_item_type().$item2->get_id()];
231 231
 
232 232
 		return $this->compare_scores($score1, $score2);
233 233
 	}
@@ -239,8 +239,8 @@  discard block
 block discarded – undo
239 239
 	 */
240 240
 	function sort_by_mask($item1, $item2)
241 241
 	{
242
-		$score1 = $this->scorecache[$item1->get_item_type() . $item1->get_id()];
243
-		$score2 = $this->scorecache[$item2->get_item_type() . $item2->get_id()];
242
+		$score1 = $this->scorecache[$item1->get_item_type().$item1->get_id()];
243
+		$score2 = $this->scorecache[$item2->get_item_type().$item2->get_id()];
244 244
 
245 245
 		return ScoreDisplay :: compare_scores_by_custom_display($score1, $score2);
246 246
 	}
@@ -256,10 +256,10 @@  discard block
 block discarded – undo
256 256
 			return (isset($score2) ? 1 : 0);
257 257
 		} elseif (!isset($score2)) {
258 258
 			return -1;
259
-		} elseif (($score1[0]/$score1[1]) == ($score2[0]/$score2[1])) {
259
+		} elseif (($score1[0] / $score1[1]) == ($score2[0] / $score2[1])) {
260 260
 			return 0;
261 261
 		} else {
262
-			return (($score1[0]/$score1[1]) < ($score2[0]/$score2[1]) ? -1 : 1);
262
+			return (($score1[0] / $score1[1]) < ($score2[0] / $score2[1]) ? -1 : 1);
263 263
 		}
264 264
 	}
265 265
 
@@ -291,7 +291,7 @@  discard block
 block discarded – undo
291 291
 	private function build_average_column($item, $ignore_score_color)
292 292
 	{
293 293
 		if (isset($this->avgcache)) {
294
-			$avgscore = $this->avgcache[$item->get_item_type() . $item->get_id()];
294
+			$avgscore = $this->avgcache[$item->get_item_type().$item->get_id()];
295 295
 		} else {
296 296
 			$avgscore = $item->calc_score();
297 297
 		}
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
 	 */
312 312
 	private function build_result_column($item, $ignore_score_color)
313 313
 	{
314
-		$studscore = $this->scorecache[$item->get_item_type() . $item->get_id()];
314
+		$studscore = $this->scorecache[$item->get_item_type().$item->get_id()];
315 315
 		$scoredisplay = ScoreDisplay :: instance();
316 316
 		$displaytype = SCORE_DIV_PERCENT;
317 317
 		if ($ignore_score_color) {
@@ -328,7 +328,7 @@  discard block
 block discarded – undo
328 328
 	 */
329 329
 	private function build_mask_column($item, $ignore_score_color)
330 330
 	{
331
-		$studscore = $this->scorecache[$item->get_item_type() . $item->get_id()];
331
+		$studscore = $this->scorecache[$item->get_item_type().$item->get_id()];
332 332
 		$scoredisplay = ScoreDisplay :: instance();
333 333
 		$displaytype = SCORE_DIV_PERCENT;
334 334
 		if ($ignore_score_color) {
@@ -362,12 +362,12 @@  discard block
 block discarded – undo
362 362
 		if (isset ($this->categorycache)
363 363
 			&& isset ($this->categorycache[$category_id])) {
364 364
 			return $this->categorycache[$category_id];
365
-		}else {
365
+		} else {
366 366
 			$cat = Category::load($category_id);
367
-			if (isset($cat)){
367
+			if (isset($cat)) {
368 368
 				$this->categorycache[$category_id] = $cat[0];
369 369
 				return $cat[0];
370
-			}else
370
+			} else
371 371
 				return null;
372 372
 		}
373 373
 	}
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	private function get_category_name_to_display($cat)
380 380
 	{
381 381
 		if (isset($cat)) {
382
-			if ($cat->get_parent_id() == '0' || $cat->get_parent_id() == null){
382
+			if ($cat->get_parent_id() == '0' || $cat->get_parent_id() == null) {
383 383
 				return '';
384 384
 			} else {
385 385
 				return $cat->get_name();
Please login to merge, or discard this patch.
main/gradebook/lib/fe/gradebooktable.class.php 1 patch
Spacing   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
             $this->set_additional_parameters($addparams);
72 72
         }
73 73
 
74
-        $column= 0;
74
+        $column = 0;
75 75
         if ($this->teacherView) {
76 76
             if ($this->exportToPdf == false) {
77 77
                 $this->set_header($column++, '', '', 'width="25px"');
@@ -283,13 +283,13 @@  discard block
 block discarded – undo
283 283
                 $main_categories[$item->get_id()]['name'] = $item->get_name();
284 284
             } else {
285 285
                 $name = $this->build_name_link($item, $type);
286
-                $row[] = $invisibility_span_open.$name. $invisibility_span_close;
286
+                $row[] = $invisibility_span_open.$name.$invisibility_span_close;
287 287
                 $main_categories[$item->get_id()]['name'] = $name;
288 288
             }
289 289
 
290 290
             $this->dataForGraph['categories'][] = $item->get_name();
291 291
 
292
-            $main_categories[$item->get_id()]['weight']= $item->get_weight();
292
+            $main_categories[$item->get_id()]['weight'] = $item->get_weight();
293 293
             $total_categories_weight += $item->get_weight();
294 294
 
295 295
             // Description.
@@ -309,9 +309,9 @@  discard block
 block discarded – undo
309 309
             );
310 310
 
311 311
             if ($this->teacherView) {
312
-                $row[] = $invisibility_span_open .Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close;
312
+                $row[] = $invisibility_span_open.Display::tag('p', $weight, array('class' => 'score')).$invisibility_span_close;
313 313
             } else {
314
-                $row[] = $invisibility_span_open .$weight.$invisibility_span_close;
314
+                $row[] = $invisibility_span_open.$weight.$invisibility_span_close;
315 315
             }
316 316
 
317 317
             $category_weight = $item->get_weight();
@@ -337,7 +337,7 @@  discard block
 block discarded – undo
337 337
 
338 338
                 if (!empty($score[1])) {
339 339
                     $completeScore = $scoredisplay->display_score($score, SCORE_DIV_PERCENT);
340
-                    $score = $score[0]/$score[1]*$item->get_weight();
340
+                    $score = $score[0] / $score[1] * $item->get_weight();
341 341
                     $score = $scoredisplay->display_score(array($score, null), SCORE_SIMPLE);
342 342
                     $scoreToDisplay = Display::tip($score, $completeScore);
343 343
                 } else {
@@ -373,7 +373,7 @@  discard block
 block discarded – undo
373 373
                     $totalResultAverageValue = strip_tags($scoredisplay->display_score($totalResult, SCORE_AVERAGE));
374 374
                     $this->dataForGraph['my_result'][] = (float) str_replace('%', '', $totalResultAverageValue);
375 375
                     $totalAverageValue = strip_tags($scoredisplay->display_score($totalAverage, SCORE_AVERAGE));
376
-                    $this->dataForGraph['average'][] =  (float) str_replace('%', '', $totalAverageValue);
376
+                    $this->dataForGraph['average'][] = (float) str_replace('%', '', $totalAverageValue);
377 377
                     // Ranking
378 378
                     $row[] = $ranking;
379 379
                     // Best
@@ -456,7 +456,7 @@  discard block
 block discarded – undo
456 456
                         $row[] = $this->build_type_column($item, array('style' => 'padding-left:5px'));
457 457
 
458 458
                         // Name.
459
-                        $row[] = $invisibility_span_open."&nbsp;&nbsp;&nbsp;  ".$this->build_name_link($item, $type) . $invisibility_span_close;
459
+                        $row[] = $invisibility_span_open."&nbsp;&nbsp;&nbsp;  ".$this->build_name_link($item, $type).$invisibility_span_close;
460 460
 
461 461
                         // Description.
462 462
                         if ($this->exportToPdf == false) {
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
                             // Students get the results and certificates columns
495 495
                             $eval_n_links = array_merge($alleval, $alllink);
496 496
 
497
-                            if (count($eval_n_links)> 0) {
497
+                            if (count($eval_n_links) > 0) {
498 498
                                 $value_data = isset($data[4]) ? $data[4] : null;
499 499
 
500 500
                                 if (!is_null($value_data)) {
@@ -593,7 +593,7 @@  discard block
 block discarded – undo
593 593
                 $row = array(
594 594
                     null,
595 595
                     null,
596
-                    '<strong>' . get_lang('Total') . '</strong>',
596
+                    '<strong>'.get_lang('Total').'</strong>',
597 597
                     null,
598 598
                     $total
599 599
                 );
@@ -663,7 +663,7 @@  discard block
 block discarded – undo
663 663
                 if ($this->exportToPdf) {
664 664
                     $row = array(
665 665
                         null,
666
-                        '<h3>' . get_lang('Total') . '</h3>',
666
+                        '<h3>'.get_lang('Total').'</h3>',
667 667
                         $main_weight,
668 668
                         $totalResult,
669 669
                         $totalRanking,
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
                 } else {
674 674
                     $row = array(
675 675
                         null,
676
-                        '<h3>' . get_lang('Total') . '</h3>',
676
+                        '<h3>'.get_lang('Total').'</h3>',
677 677
                         null,
678 678
                         $main_weight,
679 679
                         $totalResult,
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
         }
689 689
 
690 690
         // Warning messages
691
-        $view = isset($_GET['view']) ? $_GET['view']: null;
691
+        $view = isset($_GET['view']) ? $_GET['view'] : null;
692 692
 
693 693
         if ($this->teacherView) {
694 694
             if (isset($_GET['selectcat']) &&
@@ -701,14 +701,14 @@  discard block
 block discarded – undo
701 701
                 $weight_category = intval($this->build_weight($category[0]));
702 702
 
703 703
                 $course_code = $this->build_course_code($category[0]);
704
-                $weight_total_links  = round($weight_total_links);
704
+                $weight_total_links = round($weight_total_links);
705 705
 
706 706
                 if ($weight_total_links > $weight_category ||
707 707
                     $weight_total_links < $weight_category ||
708 708
                     $weight_total_links > $weight_category
709 709
                 ) {
710 710
                     $warning_message = sprintf(get_lang('TotalWeightMustBeX'), $weight_category);
711
-                    $modify_icons  = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'.
711
+                    $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$id_cat.'&cidReq='.$course_code.'&id_session='.api_get_session_id().'">'.
712 712
                         Display::return_icon('edit.png', $warning_message, array(), ICON_SIZE_SMALL).'</a>';
713 713
                     $warning_message .= $modify_icons;
714 714
                     Display::display_warning_message($warning_message, false);
@@ -721,7 +721,7 @@  discard block
 block discarded – undo
721 721
                 );
722 722
 
723 723
                 if (!empty($content_html)) {
724
-                    $new_content = explode('</head>',$content_html['content']);
724
+                    $new_content = explode('</head>', $content_html['content']);
725 725
                 }
726 726
 
727 727
                 if (empty($new_content[0])) {
@@ -755,7 +755,7 @@  discard block
 block discarded – undo
755 755
                     is_array($course_codes)
756 756
                 ) {
757 757
                     $warning_message = '';
758
-                    for ($x = 0; $x<count($weight_categories);$x++) {
758
+                    for ($x = 0; $x < count($weight_categories); $x++) {
759 759
                         $weight_category = intval($weight_categories[$x]);
760 760
                         $certificate_min_score = intval($certificate_min_scores[$x]);
761 761
                         $course_code = $course_codes[$x];
@@ -763,12 +763,12 @@  discard block
 block discarded – undo
763 763
                         if (empty($certificate_min_score) ||
764 764
                             ($certificate_min_score > $weight_category)
765 765
                         ) {
766
-                            $warning_message .= $course_code .'&nbsp;-&nbsp;'.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').'&nbsp;'.$weight_category.'<br />';
766
+                            $warning_message .= $course_code.'&nbsp;-&nbsp;'.get_lang('CertificateMinimunScoreIsRequiredAndMustNotBeMoreThan').'&nbsp;'.$weight_category.'<br />';
767 767
                         }
768 768
                     }
769 769
 
770 770
                     if (!empty($warning_message)) {
771
-                        Display::display_warning_message($warning_message,false);
771
+                        Display::display_warning_message($warning_message, false);
772 772
                     }
773 773
                 }
774 774
             }
@@ -812,15 +812,15 @@  discard block
 block discarded – undo
812 812
             $pChart->Antialias = FALSE;
813 813
 
814 814
             /* Add a border to the picture */
815
-            $pChart->drawRectangle(0,0,$xSize-10,$ySize-10,array("R"=>0,"G"=>0,"B"=>0));
815
+            $pChart->drawRectangle(0, 0, $xSize - 10, $ySize - 10, array("R"=>0, "G"=>0, "B"=>0));
816 816
 
817
-            $pChart->drawText(10,16,get_lang('Results'),array("FontSize"=>11,"Align"=>TEXT_ALIGN_BOTTOMLEFT));
817
+            $pChart->drawText(10, 16, get_lang('Results'), array("FontSize"=>11, "Align"=>TEXT_ALIGN_BOTTOMLEFT));
818 818
 
819
-            $pChart->setGraphArea(50, 30, $xSize-50, $ySize-50);
819
+            $pChart->setGraphArea(50, 30, $xSize - 50, $ySize - 50);
820 820
 
821 821
             $pChart->setFontProperties(
822 822
                 array(
823
-                    'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
823
+                    'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
824 824
                     'FontSize' => 10,
825 825
                 )
826 826
             );
@@ -840,7 +840,7 @@  discard block
 block discarded – undo
840 840
 
841 841
             /* Draw the line chart */
842 842
             $pChart->drawLineChart();
843
-            $pChart->drawPlotChart(array("DisplayValues"=>TRUE,"PlotBorder"=>TRUE,"BorderSize"=>2,"Surrounding"=>-60,"BorderAlpha"=>80));
843
+            $pChart->drawPlotChart(array("DisplayValues"=>TRUE, "PlotBorder"=>TRUE, "BorderSize"=>2, "Surrounding"=>-60, "BorderAlpha"=>80));
844 844
 
845 845
             /* Write the chart legend */
846 846
             $pChart->drawLegend(
@@ -860,13 +860,13 @@  discard block
 block discarded – undo
860 860
             $chartHash = $myCache->getHash($dataSet);
861 861
 
862 862
             $myCache->writeToCache($chartHash, $pChart);
863
-            $imgSysPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
863
+            $imgSysPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
864 864
             $myCache->saveFromCache($chartHash, $imgSysPath);
865
-            $imgWebPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
865
+            $imgWebPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
866 866
 
867 867
             if (file_exists($imgSysPath)) {
868 868
                 $result = '<div id="contentArea" style="text-align: center;" >';
869
-                $result .= '<img src="' . $imgWebPath.'" >';
869
+                $result .= '<img src="'.$imgWebPath.'" >';
870 870
                 $result .= '</div>';
871 871
                 return $result;
872 872
             }
@@ -911,13 +911,13 @@  discard block
 block discarded – undo
911 911
         switch ($item->get_item_type()) {
912 912
             // category
913 913
             case 'C' :
914
-                return 'CATE' . $item->get_id();
914
+                return 'CATE'.$item->get_id();
915 915
             // evaluation
916 916
             case 'E' :
917
-                return 'EVAL' . $item->get_id();
917
+                return 'EVAL'.$item->get_id();
918 918
             // link
919 919
             case 'L' :
920
-                return 'LINK' . $item->get_id();
920
+                return 'LINK'.$item->get_id();
921 921
         }
922 922
     }
923 923
 
@@ -945,20 +945,20 @@  discard block
 block discarded – undo
945 945
         switch ($item->get_item_type()) {
946 946
             // category
947 947
             case 'C' :
948
-                $prms_uri='?selectcat=' . $item->get_id() . '&amp;view='.$view;
948
+                $prms_uri = '?selectcat='.$item->get_id().'&amp;view='.$view;
949 949
 
950 950
                 if (isset($_GET['isStudentView'])) {
951
-                    if ( isset($is_student) || ( isset($_SESSION['studentview']) && $_SESSION['studentview']=='studentview') ) {
952
-                        $prms_uri=$prms_uri.'&amp;isStudentView='.Security::remove_XSS($_GET['isStudentView']);
951
+                    if (isset($is_student) || (isset($_SESSION['studentview']) && $_SESSION['studentview'] == 'studentview')) {
952
+                        $prms_uri = $prms_uri.'&amp;isStudentView='.Security::remove_XSS($_GET['isStudentView']);
953 953
                     }
954 954
                 }
955 955
 
956 956
                 $cat = new Category();
957
-                $show_message=$cat->show_message_resource_delete($item->get_course_code());
957
+                $show_message = $cat->show_message_resource_delete($item->get_course_code());
958 958
                 return '&nbsp;<a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).$prms_uri.'">'
959 959
                 . $item->get_name()
960 960
                 . '</a>'
961
-                . ($item->is_course() ? ' &nbsp;[' . $item->get_course_code() . ']'.$show_message : '');
961
+                . ($item->is_course() ? ' &nbsp;['.$item->get_course_code().']'.$show_message : '');
962 962
                 // evaluation
963 963
             case 'E' :
964 964
                 $cat = new Category();
@@ -966,10 +966,10 @@  discard block
 block discarded – undo
966 966
                 $show_message = $cat->show_message_resource_delete($course_id);
967 967
 
968 968
                 // course/platform admin can go to the view_results page
969
-                if (api_is_allowed_to_edit() && $show_message===false) {
969
+                if (api_is_allowed_to_edit() && $show_message === false) {
970 970
                     if ($item->get_type() == 'presence') {
971 971
                         return '&nbsp;'
972
-                        . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&amp;selecteval=' . $item->get_id() . '">'
972
+                        . '<a href="gradebook_view_result.php?cidReq='.$course_id.'&amp;selecteval='.$item->get_id().'">'
973 973
                         . $item->get_name()
974 974
                         . '</a>';
975 975
                     } else {
@@ -978,20 +978,20 @@  discard block
 block discarded – undo
978 978
                             $extra = '';
979 979
                         }
980 980
                         return '&nbsp;'
981
-                        . '<a href="gradebook_view_result.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">'
981
+                        . '<a href="gradebook_view_result.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">'
982 982
                         . $item->get_name()
983 983
                         . '</a>&nbsp;'.$extra;
984 984
                     }
985
-                } elseif (ScoreDisplay :: instance()->is_custom() && $show_message===false) {
985
+                } elseif (ScoreDisplay :: instance()->is_custom() && $show_message === false) {
986 986
                     // students can go to the statistics page (if custom display enabled)
987 987
                     return '&nbsp;'
988
-                    . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">'
988
+                    . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">'
989 989
                     . $item->get_name()
990 990
                     . '</a>';
991 991
 
992 992
                 } elseif ($show_message === false && !api_is_allowed_to_edit() && !ScoreDisplay :: instance()->is_custom()) {
993 993
                     return '&nbsp;'
994
-                    . '<a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . $item->get_id() . '">'
994
+                    . '<a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.$item->get_id().'">'
995 995
                     . $item->get_name()
996 996
                     . '</a>';
997 997
                 } else {
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
                 $url = $item->get_link();
1007 1007
 
1008 1008
                 if (isset($url) && $show_message === false) {
1009
-                    $text = '&nbsp;<a href="' . $item->get_link() . '">'
1009
+                    $text = '&nbsp;<a href="'.$item->get_link().'">'
1010 1010
                         . $item->get_name()
1011 1011
                         . '</a>';
1012 1012
                 } else {
Please login to merge, or discard this patch.