Completed
Push — 1.11.x ( 566ea6...b264ab )
by José
110:20 queued 69:00
created
main/gradebook/lib/fe/linkaddeditform.class.php 2 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 		if (isset($link_object)) {
32 32
 			$link = $link_object;
33 33
 		} elseif (isset($link_type) && isset($category_object)) {
34
-			$link = LinkFactory :: create ($link_type);
34
+			$link = LinkFactory :: create($link_type);
35 35
 			$link->set_course_code(api_get_course_id());
36 36
 			$link->set_category_id($category_object[0]->get_id());
37 37
 		} else {
@@ -52,12 +52,12 @@  discard block
 block discarded – undo
52 52
 			} else {
53 53
 				$select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
54 54
 				foreach ($link->get_all_links() as $newlink) {
55
-					$select->addoption($newlink[1],$newlink[0]);
55
+					$select->addoption($newlink[1], $newlink[0]);
56 56
 				}
57 57
 			}
58 58
 		} else {
59
-			$this->addElement('label',get_lang('Name'),  '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
60
-			$this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
59
+			$this->addElement('label', get_lang('Name'), '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
60
+			$this->addElement('hidden', 'name_link', $link->get_name(), array('id'=>'name_link'));
61 61
 		}
62 62
 
63 63
 		if (count($category_object) == 1) {
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 						$grade_model_id = $my_cat->get_grade_model_id();
81 81
 						if (empty($grade_model_id)) {
82 82
 
83
-							if ($my_cat->get_parent_id() == 0 ) {
83
+							if ($my_cat->get_parent_id() == 0) {
84 84
 								$default_weight = $my_cat->get_weight();
85 85
 								$select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
86 86
 							} else {
@@ -119,8 +119,8 @@  discard block
 block discarded – undo
119 119
             'class' => 'span1'
120 120
         ));*/
121 121
 
122
-		$this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
123
-		$this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
122
+		$this->addRule('weight_mask', get_lang('OnlyNumbers'), 'numeric');
123
+		$this->addRule(array('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
124 124
 		if ($form_type == self :: TYPE_EDIT) {
125 125
 			$parent_cat = Category :: load($link->get_category_id());
126 126
 
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
 				//var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
134 134
 				//$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
135 135
 				//$values['weight'] = $weight;
136
-				$values['weight'] = $link->get_weight() ;
136
+				$values['weight'] = $link->get_weight();
137 137
 			}
138
-			$defaults['weight_mask'] = $values['weight'] ;
138
+			$defaults['weight_mask'] = $values['weight'];
139 139
 			$defaults['select_gradebook'] = $link->get_category_id();
140 140
 
141 141
 		}
142 142
 		// ELEMENT: max
143 143
 		if ($link->needs_max()) {
144 144
 			if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
145
-				$this->addText('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '5', 'disabled' => 'disabled'));
145
+				$this->addText('max', get_lang('QualificationNumeric'), false, array('size' => '4', 'maxlength' => '5', 'disabled' => 'disabled'));
146 146
 			} else {
147
-				$this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
147
+				$this->addText('max', get_lang('QualificationNumeric'), true, array('size' => '4', 'maxlength' => '5'));
148 148
 				$this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
149
-				$this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
149
+				$this->addRule(array('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
150 150
 			}
151 151
 			if ($form_type == self :: TYPE_EDIT) {
152 152
 				$defaults['max'] = $link->get_max();
@@ -155,7 +155,7 @@  discard block
 block discarded – undo
155 155
 
156 156
 		// ELEMENT: description
157 157
 		if ($link->needs_name_and_description()) {
158
-			$this->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3','cols' => '34'));
158
+			$this->addElement('textarea', 'description', get_lang('Description'), array('rows' => '3', 'cols' => '34'));
159 159
 			if ($form_type == self :: TYPE_EDIT) {
160 160
 				$defaults['description'] = $link->get_description();
161 161
 			}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
 			if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
186 186
 				$visibility_default = 0;
187 187
 			}
188
-			$defaults['visible']  = $visibility_default;
188
+			$defaults['visible'] = $visibility_default;
189 189
 		}
190 190
 
191 191
 		// set default values
Please login to merge, or discard this patch.
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -9,108 +9,108 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class LinkAddEditForm extends FormValidator
11 11
 {
12
-	const TYPE_ADD  = 1;
13
-	const TYPE_EDIT = 2;
14
-
15
-	/**
16
-	 * Constructor
17
-	 * To add link, define category_object and link_type
18
-	 * To edit link, define link_object
19
-	 */
20
-	public function __construct(
21
-		$form_type,
22
-		$category_object,
23
-		$link_type,
24
-		$link_object,
25
-		$form_name,
26
-		$action = null
27
-	) {
28
-		parent :: __construct($form_name, 'post', $action);
29
-
30
-		// set or create link object
31
-		if (isset($link_object)) {
32
-			$link = $link_object;
33
-		} elseif (isset($link_type) && isset($category_object)) {
34
-			$link = LinkFactory :: create ($link_type);
35
-			$link->set_course_code(api_get_course_id());
36
-			$link->set_category_id($category_object[0]->get_id());
37
-		} else {
38
-			die ('LinkAddEditForm error: define link_type/category_object or link_object');
39
-		}
40
-
41
-		$defaults = array();
42
-		$this->addElement('hidden', 'zero', 0);
43
-
44
-		if (!empty($_GET['editlink'])) {
45
-			$this->addElement('header', '', get_lang('EditLink'));
46
-		}
47
-
48
-		// ELEMENT: name
49
-		if ($form_type == self :: TYPE_ADD || $link->is_allowed_to_change_name()) {
50
-			if ($link->needs_name_and_description()) {
51
-				$this->addText('name', get_lang('Name'), true, array('size'=>'40', 'maxlength'=>'40'));
52
-			} else {
53
-				$select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
54
-				foreach ($link->get_all_links() as $newlink) {
55
-					$select->addoption($newlink[1],$newlink[0]);
56
-				}
57
-			}
58
-		} else {
59
-			$this->addElement('label',get_lang('Name'),  '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
60
-			$this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
61
-		}
62
-
63
-		if (count($category_object) == 1) {
64
-			$this->addElement('hidden', 'select_gradebook', $category_object[0]->get_id());
65
-		} else {
66
-			$select_gradebook = $this->addElement(
67
-				'select',
68
-				'select_gradebook',
69
-				get_lang('SelectGradebook'),
70
-				array(),
71
-				array('id' => 'hide_category_id')
72
-			);
73
-			$this->addRule('select_gradebook', get_lang('ThisFieldIsRequired'), 'nonzero');
74
-
75
-			$default_weight = 0;
76
-			if (!empty($category_object)) {
77
-				foreach ($category_object as $my_cat) {
78
-
79
-					if ($my_cat->get_course_code() == api_get_course_id()) {
80
-						$grade_model_id = $my_cat->get_grade_model_id();
81
-						if (empty($grade_model_id)) {
82
-
83
-							if ($my_cat->get_parent_id() == 0 ) {
84
-								$default_weight = $my_cat->get_weight();
85
-								$select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
86
-							} else {
87
-								$select_gradebook->addoption($my_cat->get_name(), $my_cat->get_id());
88
-							}
89
-						} else {
90
-							$select_gradebook->addoption(get_lang('Select'), 0);
91
-						}
92
-						if ($link->get_category_id() == $my_cat->get_id()) {
93
-							$default_weight = $my_cat->get_weight();
94
-						}
95
-					}
96
-				}
97
-			}
98
-		}
99
-
100
-		$this->addText(
101
-			'weight_mask',
102
-			array(get_lang('Weight'), null, ' [0 .. <span id="max_weight">'.$category_object[0]->get_weight().'</span>] '),
103
-			true,
104
-			array(
105
-				'size' => '4',
106
-				'maxlength' => '5',
107
-				'class' => 'span1'
108
-			)
109
-		);
110
-
111
-		$this->addElement('hidden', 'weight');
112
-
113
-		/*
12
+    const TYPE_ADD  = 1;
13
+    const TYPE_EDIT = 2;
14
+
15
+    /**
16
+     * Constructor
17
+     * To add link, define category_object and link_type
18
+     * To edit link, define link_object
19
+     */
20
+    public function __construct(
21
+        $form_type,
22
+        $category_object,
23
+        $link_type,
24
+        $link_object,
25
+        $form_name,
26
+        $action = null
27
+    ) {
28
+        parent :: __construct($form_name, 'post', $action);
29
+
30
+        // set or create link object
31
+        if (isset($link_object)) {
32
+            $link = $link_object;
33
+        } elseif (isset($link_type) && isset($category_object)) {
34
+            $link = LinkFactory :: create ($link_type);
35
+            $link->set_course_code(api_get_course_id());
36
+            $link->set_category_id($category_object[0]->get_id());
37
+        } else {
38
+            die ('LinkAddEditForm error: define link_type/category_object or link_object');
39
+        }
40
+
41
+        $defaults = array();
42
+        $this->addElement('hidden', 'zero', 0);
43
+
44
+        if (!empty($_GET['editlink'])) {
45
+            $this->addElement('header', '', get_lang('EditLink'));
46
+        }
47
+
48
+        // ELEMENT: name
49
+        if ($form_type == self :: TYPE_ADD || $link->is_allowed_to_change_name()) {
50
+            if ($link->needs_name_and_description()) {
51
+                $this->addText('name', get_lang('Name'), true, array('size'=>'40', 'maxlength'=>'40'));
52
+            } else {
53
+                $select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
54
+                foreach ($link->get_all_links() as $newlink) {
55
+                    $select->addoption($newlink[1],$newlink[0]);
56
+                }
57
+            }
58
+        } else {
59
+            $this->addElement('label',get_lang('Name'),  '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
60
+            $this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
61
+        }
62
+
63
+        if (count($category_object) == 1) {
64
+            $this->addElement('hidden', 'select_gradebook', $category_object[0]->get_id());
65
+        } else {
66
+            $select_gradebook = $this->addElement(
67
+                'select',
68
+                'select_gradebook',
69
+                get_lang('SelectGradebook'),
70
+                array(),
71
+                array('id' => 'hide_category_id')
72
+            );
73
+            $this->addRule('select_gradebook', get_lang('ThisFieldIsRequired'), 'nonzero');
74
+
75
+            $default_weight = 0;
76
+            if (!empty($category_object)) {
77
+                foreach ($category_object as $my_cat) {
78
+
79
+                    if ($my_cat->get_course_code() == api_get_course_id()) {
80
+                        $grade_model_id = $my_cat->get_grade_model_id();
81
+                        if (empty($grade_model_id)) {
82
+
83
+                            if ($my_cat->get_parent_id() == 0 ) {
84
+                                $default_weight = $my_cat->get_weight();
85
+                                $select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
86
+                            } else {
87
+                                $select_gradebook->addoption($my_cat->get_name(), $my_cat->get_id());
88
+                            }
89
+                        } else {
90
+                            $select_gradebook->addoption(get_lang('Select'), 0);
91
+                        }
92
+                        if ($link->get_category_id() == $my_cat->get_id()) {
93
+                            $default_weight = $my_cat->get_weight();
94
+                        }
95
+                    }
96
+                }
97
+            }
98
+        }
99
+
100
+        $this->addText(
101
+            'weight_mask',
102
+            array(get_lang('Weight'), null, ' [0 .. <span id="max_weight">'.$category_object[0]->get_weight().'</span>] '),
103
+            true,
104
+            array(
105
+                'size' => '4',
106
+                'maxlength' => '5',
107
+                'class' => 'span1'
108
+            )
109
+        );
110
+
111
+        $this->addElement('hidden', 'weight');
112
+
113
+        /*
114 114
 
115 115
         // ELEMENT: weight
116 116
         $this->addText('weight', array(get_lang('Weight'), null, '/ <span id="max_weight">'.$default_weight.'</span>'), true, array (
@@ -119,76 +119,76 @@  discard block
 block discarded – undo
119 119
             'class' => 'span1'
120 120
         ));*/
121 121
 
122
-		$this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
123
-		$this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
124
-		if ($form_type == self :: TYPE_EDIT) {
125
-			$parent_cat = Category :: load($link->get_category_id());
126
-
127
-			if ($parent_cat[0]->get_parent_id() == 0) {
128
-				$values['weight'] = $link->get_weight();
129
-			} else {
130
-				$cat = Category :: load($parent_cat[0]->get_parent_id());
131
-				//$global_weight = $cat[0]->get_weight();
132
-				//$values['weight'] = $link->get_weight()/$parent_cat[0]->get_weight()*$global_weight;
133
-				//var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
134
-				//$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
135
-				//$values['weight'] = $weight;
136
-				$values['weight'] = $link->get_weight() ;
137
-			}
138
-			$defaults['weight_mask'] = $values['weight'] ;
139
-			$defaults['select_gradebook'] = $link->get_category_id();
140
-
141
-		}
142
-		// ELEMENT: max
143
-		if ($link->needs_max()) {
144
-			if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
145
-				$this->addText('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '5', 'disabled' => 'disabled'));
146
-			} else {
147
-				$this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
148
-				$this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
149
-				$this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
150
-			}
151
-			if ($form_type == self :: TYPE_EDIT) {
152
-				$defaults['max'] = $link->get_max();
153
-			}
154
-		}
155
-
156
-		// ELEMENT: description
157
-		if ($link->needs_name_and_description()) {
158
-			$this->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3','cols' => '34'));
159
-			if ($form_type == self :: TYPE_EDIT) {
160
-				$defaults['description'] = $link->get_description();
161
-			}
162
-		}
163
-
164
-		// ELEMENT: visible
165
-		$visible = ($form_type == self :: TYPE_EDIT && $link->is_visible()) ? '1' : '0';
166
-		$this->addElement('checkbox', 'visible', null, get_lang('Visible'), $visible);
167
-		if ($form_type == self :: TYPE_EDIT) {
168
-			$defaults['visible'] = $link->is_visible();
169
-		}
170
-
171
-		// ELEMENT: add results
172
-		if ($form_type == self :: TYPE_ADD && $link->needs_results()) {
173
-			$this->addElement('checkbox', 'addresult', get_lang('AddResult'));
174
-		}
175
-		// submit button
176
-		if ($form_type == self :: TYPE_ADD) {
177
-			$this->addButtonCreate(get_lang('CreateLink'));
178
-		} else {
179
-			$this->addButtonUpdate(get_lang('LinkMod'));
180
-		}
181
-
182
-		if ($form_type == self :: TYPE_ADD) {
183
-			$setting = api_get_setting('tool_visible_by_default_at_creation');
184
-			$visibility_default = 1;
185
-			if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
186
-				$visibility_default = 0;
187
-			}
188
-			$defaults['visible']  = $visibility_default;
189
-		}
190
-
191
-		// set default values
192
-		$this->setDefaults($defaults);
193
-	}
122
+        $this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
123
+        $this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
124
+        if ($form_type == self :: TYPE_EDIT) {
125
+            $parent_cat = Category :: load($link->get_category_id());
126
+
127
+            if ($parent_cat[0]->get_parent_id() == 0) {
128
+                $values['weight'] = $link->get_weight();
129
+            } else {
130
+                $cat = Category :: load($parent_cat[0]->get_parent_id());
131
+                //$global_weight = $cat[0]->get_weight();
132
+                //$values['weight'] = $link->get_weight()/$parent_cat[0]->get_weight()*$global_weight;
133
+                //var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
134
+                //$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
135
+                //$values['weight'] = $weight;
136
+                $values['weight'] = $link->get_weight() ;
137
+            }
138
+            $defaults['weight_mask'] = $values['weight'] ;
139
+            $defaults['select_gradebook'] = $link->get_category_id();
140
+
141
+        }
142
+        // ELEMENT: max
143
+        if ($link->needs_max()) {
144
+            if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
145
+                $this->addText('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '5', 'disabled' => 'disabled'));
146
+            } else {
147
+                $this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
148
+                $this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
149
+                $this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
150
+            }
151
+            if ($form_type == self :: TYPE_EDIT) {
152
+                $defaults['max'] = $link->get_max();
153
+            }
154
+        }
155
+
156
+        // ELEMENT: description
157
+        if ($link->needs_name_and_description()) {
158
+            $this->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3','cols' => '34'));
159
+            if ($form_type == self :: TYPE_EDIT) {
160
+                $defaults['description'] = $link->get_description();
161
+            }
162
+        }
163
+
164
+        // ELEMENT: visible
165
+        $visible = ($form_type == self :: TYPE_EDIT && $link->is_visible()) ? '1' : '0';
166
+        $this->addElement('checkbox', 'visible', null, get_lang('Visible'), $visible);
167
+        if ($form_type == self :: TYPE_EDIT) {
168
+            $defaults['visible'] = $link->is_visible();
169
+        }
170
+
171
+        // ELEMENT: add results
172
+        if ($form_type == self :: TYPE_ADD && $link->needs_results()) {
173
+            $this->addElement('checkbox', 'addresult', get_lang('AddResult'));
174
+        }
175
+        // submit button
176
+        if ($form_type == self :: TYPE_ADD) {
177
+            $this->addButtonCreate(get_lang('CreateLink'));
178
+        } else {
179
+            $this->addButtonUpdate(get_lang('LinkMod'));
180
+        }
181
+
182
+        if ($form_type == self :: TYPE_ADD) {
183
+            $setting = api_get_setting('tool_visible_by_default_at_creation');
184
+            $visibility_default = 1;
185
+            if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
186
+                $visibility_default = 0;
187
+            }
188
+            $defaults['visible']  = $visibility_default;
189
+        }
190
+
191
+        // set default values
192
+        $this->setDefaults($defaults);
193
+    }
194 194
 }
Please login to merge, or discard this patch.
main/gradebook/lib/fe/flatviewtable.class.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
             $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
202 202
             $chartHash = $myCache->getHash($dataSet);
203 203
             if ($myCache->isInCache($chartHash)) {
204
-                $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
204
+                $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
205 205
                 $myCache->saveFromCache($chartHash, $imgPath);
206
-                $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
206
+                $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
207 207
             } else {
208 208
                 /* Create the pChart object */
209 209
                 $widthSize = 480;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 /* Set the default font */
231 231
                 $myPicture->setFontProperties(
232 232
                     array(
233
-                        'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
233
+                        'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
234 234
                         'FontSize' => 10
235 235
                     )
236 236
                 );
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
                 /* Render the picture (choose the best way) */
303 303
 
304 304
                 $myCache->writeToCache($chartHash, $myPicture);
305
-                $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
305
+                $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
306 306
                 $myCache->saveFromCache($chartHash, $imgPath);
307
-                $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
307
+                $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
308 308
             }
309
-            echo '<img src="' . $imgPath . '" >';
309
+            echo '<img src="'.$imgPath.'" >';
310 310
             if ($i % 2 == 0 && $i != 0) {
311 311
                 echo '<br /><br />';
312 312
             } else {
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
             // previous X
350 350
             $header .= '<td style="width:100%;">';
351 351
             if ($this->offset >= GRADEBOOK_ITEM_LIMIT) {
352
-                $header .= '<a href="' . api_get_self()
353
-                    . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
354
-                    . '&offset=' . (($this->offset) - GRADEBOOK_ITEM_LIMIT)
355
-                    . (isset($_GET['search']) ? '&search=' . Security::remove_XSS($_GET['search']) : '') . '">'
352
+                $header .= '<a href="'.api_get_self()
353
+                    . '?selectcat='.Security::remove_XSS($_GET['selectcat'])
354
+                    . '&offset='.(($this->offset) - GRADEBOOK_ITEM_LIMIT)
355
+                    . (isset($_GET['search']) ? '&search='.Security::remove_XSS($_GET['search']) : '').'">'
356 356
                     . Display::return_icon('action_prev.png', get_lang('PreviousPage'), array(), 32)
357 357
                     . '</a>';
358 358
             } else {
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
                 ($totalitems - (GRADEBOOK_ITEM_LIMIT + $this->offset)) : GRADEBOOK_ITEM_LIMIT;
365 365
 
366 366
             if ($calcnext > 0) {
367
-                $header .= '<a href="' . api_get_self()
368
-                    . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
369
-                    . '&offset=' . ($this->offset + GRADEBOOK_ITEM_LIMIT)
370
-                    . (isset($_GET['search']) ? '&search=' . Security::remove_XSS($_GET['search']) : '') . '">'
367
+                $header .= '<a href="'.api_get_self()
368
+                    . '?selectcat='.Security::remove_XSS($_GET['selectcat'])
369
+                    . '&offset='.($this->offset + GRADEBOOK_ITEM_LIMIT)
370
+                    . (isset($_GET['search']) ? '&search='.Security::remove_XSS($_GET['search']) : '').'">'
371 371
                     . Display::return_icon('action_next.png', get_lang('NextPage'), array(), 32)
372 372
                     . '</a>';
373 373
             } else {
@@ -475,6 +475,6 @@  discard block
 block discarded – undo
475 475
      */
476 476
     private function build_name_link($user_id, $name)
477 477
     {
478
-        return '<a href="user_stats.php?userid=' . $user_id . '&selectcat=' . $this->selectcat->get_id() . '&'.api_get_cidreq().'">' . $name . '</a>';
478
+        return '<a href="user_stats.php?userid='.$user_id.'&selectcat='.$this->selectcat->get_id().'&'.api_get_cidreq().'">'.$name.'</a>';
479 479
     }
480 480
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -149,8 +149,9 @@
 block discarded – undo
149 149
                 }
150 150
 
151 151
                 foreach ($customdisplays as $display) {
152
-                    if (!in_array($display['display'], $key_list))
153
-                        $resource_list[$key][$display['display']] = 0;
152
+                    if (!in_array($display['display'], $key_list)) {
153
+                                            $resource_list[$key][$display['display']] = 0;
154
+                    }
154 155
                 }
155 156
                 $i++;
156 157
             }
Please login to merge, or discard this patch.
main/gradebook/lib/fe/usertable.class.php 3 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 */
19 19
 	public function UserTable($userid, $evals = array(), $links = array(), $addparams = null)
20 20
 	{
21
-		parent :: __construct ('userlist', null, null, 0);
21
+		parent :: __construct('userlist', null, null, 0);
22 22
 		$this->userid = $userid;
23 23
 		$this->datagen = new UserDataGenerator($userid, $evals, $links);
24 24
 		if (isset($addparams)) {
@@ -87,8 +87,8 @@  discard block
 block discarded – undo
87 87
 		// generate the data to display
88 88
 		$sortable_data = array();
89 89
 		foreach ($data_array as $data) {
90
-			if ($data[2]!="") {//filter by course removed
91
-				$row = array ();
90
+			if ($data[2] != "") {//filter by course removed
91
+				$row = array();
92 92
 				$row[] = $this->build_type_column($data[0]);
93 93
 				$row[] = $this->build_name_link($data[0]);
94 94
 				$row[] = $data[2];
@@ -123,15 +123,15 @@  discard block
 block discarded – undo
123 123
 			// evaluation
124 124
 			case 'E' :
125 125
 				return '&nbsp;'
126
-				. '<a href="gradebook_view_result.php?selecteval=' . $item->get_id() . '">'
126
+				. '<a href="gradebook_view_result.php?selecteval='.$item->get_id().'">'
127 127
 				. $item->get_name()
128 128
 				. '</a>';
129 129
 			// link
130 130
 			case 'L' :
131
-				return '&nbsp;<a href="' . $item->get_link() . '">'
131
+				return '&nbsp;<a href="'.$item->get_link().'">'
132 132
 				. $item->get_name()
133 133
 				. '</a>'
134
-				. '&nbsp;[' . $item->get_type_name() . ']';
134
+				. '&nbsp;['.$item->get_type_name().']';
135 135
 		}
136 136
 	}
137 137
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -95,8 +95,9 @@
 block discarded – undo
95 95
 				$row[] = $data[3];
96 96
 				$row[] = $data[4];
97 97
 				$row[] = $data[5];
98
-				if ($scoredisplay->is_custom())
99
-					$row[] = $data[6];
98
+				if ($scoredisplay->is_custom()) {
99
+									$row[] = $data[6];
100
+				}
100 101
 				$sortable_data[] = $row;
101 102
 			}
102 103
 		}
Please login to merge, or discard this patch.
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -10,128 +10,128 @@
 block discarded – undo
10 10
  */
11 11
 class UserTable extends SortableTable
12 12
 {
13
-	private $userid;
14
-	private $datagen;
13
+    private $userid;
14
+    private $datagen;
15 15
 
16
-	/**
17
-	 * Constructor
18
-	 */
19
-	public function __construct($userid, $evals = array(), $links = array(), $addparams = null)
20
-	{
21
-		parent :: __construct ('userlist', null, null, 0);
22
-		$this->userid = $userid;
23
-		$this->datagen = new UserDataGenerator($userid, $evals, $links);
24
-		if (isset($addparams)) {
25
-			$this->set_additional_parameters($addparams);
26
-		}
27
-		$column = 0;
28
-		$this->set_header($column++, get_lang('Type'));
29
-		$this->set_header($column++, get_lang('Evaluation'));
30
-		$this->set_header($column++, get_lang('Course'));
31
-		$this->set_header($column++, get_lang('Category'));
32
-		$this->set_header($column++, get_lang('EvaluationAverage'));
33
-		$this->set_header($column++, get_lang('Result'));
16
+    /**
17
+     * Constructor
18
+     */
19
+    public function __construct($userid, $evals = array(), $links = array(), $addparams = null)
20
+    {
21
+        parent :: __construct ('userlist', null, null, 0);
22
+        $this->userid = $userid;
23
+        $this->datagen = new UserDataGenerator($userid, $evals, $links);
24
+        if (isset($addparams)) {
25
+            $this->set_additional_parameters($addparams);
26
+        }
27
+        $column = 0;
28
+        $this->set_header($column++, get_lang('Type'));
29
+        $this->set_header($column++, get_lang('Evaluation'));
30
+        $this->set_header($column++, get_lang('Course'));
31
+        $this->set_header($column++, get_lang('Category'));
32
+        $this->set_header($column++, get_lang('EvaluationAverage'));
33
+        $this->set_header($column++, get_lang('Result'));
34 34
 
35
-		$scoredisplay = ScoreDisplay :: instance();
36
-		if ($scoredisplay->is_custom()) {
37
-			$this->set_header($column++, get_lang('Display'));
38
-		}
39
-	}
35
+        $scoredisplay = ScoreDisplay :: instance();
36
+        if ($scoredisplay->is_custom()) {
37
+            $this->set_header($column++, get_lang('Display'));
38
+        }
39
+    }
40 40
 
41
-	/**
42
-	 * Function used by SortableTable to get total number of items in the table
43
-	 */
44
-	function get_total_number_of_items()
45
-	{
46
-		return $this->datagen->get_total_items_count();
47
-	}
41
+    /**
42
+     * Function used by SortableTable to get total number of items in the table
43
+     */
44
+    function get_total_number_of_items()
45
+    {
46
+        return $this->datagen->get_total_items_count();
47
+    }
48 48
 
49
-	/**
50
-	 * Function used by SortableTable to generate the data to display
51
-	 */
52
-	public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null)
53
-	{
54
-		$scoredisplay = ScoreDisplay :: instance();
49
+    /**
50
+     * Function used by SortableTable to generate the data to display
51
+     */
52
+    public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null)
53
+    {
54
+        $scoredisplay = ScoreDisplay :: instance();
55 55
 
56
-		// determine sorting type
57
-		switch ($this->column) {
58
-			// Type
59
-			case 0:
60
-				$sorting = UserDataGenerator :: UDG_SORT_TYPE;
61
-				break;
62
-			case 1:
63
-				$sorting = UserDataGenerator :: UDG_SORT_NAME;
64
-				break;
65
-			case 2:
66
-				$sorting = UserDataGenerator :: UDG_SORT_COURSE;
67
-				break;
68
-			case 3:
69
-				$sorting = UserDataGenerator :: UDG_SORT_CATEGORY;
70
-				break;
71
-			case 4:
72
-				$sorting = UserDataGenerator :: UDG_SORT_AVERAGE;
73
-				break;
74
-			case 5:
75
-				$sorting = UserDataGenerator :: UDG_SORT_SCORE;
76
-				break;
77
-			case 6:
78
-				$sorting = UserDataGenerator :: UDG_SORT_MASK;
79
-				break;
80
-		}
81
-		if ($this->direction == 'DESC') {
82
-			$sorting |= UserDataGenerator :: UDG_SORT_DESC;
83
-		} else {
84
-			$sorting |= UserDataGenerator :: UDG_SORT_ASC;
85
-		}
86
-		$data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
87
-		// generate the data to display
88
-		$sortable_data = array();
89
-		foreach ($data_array as $data) {
90
-			if ($data[2]!="") {//filter by course removed
91
-				$row = array ();
92
-				$row[] = $this->build_type_column($data[0]);
93
-				$row[] = $this->build_name_link($data[0]);
94
-				$row[] = $data[2];
95
-				$row[] = $data[3];
96
-				$row[] = $data[4];
97
-				$row[] = $data[5];
98
-				if ($scoredisplay->is_custom())
99
-					$row[] = $data[6];
100
-				$sortable_data[] = $row;
101
-			}
102
-		}
56
+        // determine sorting type
57
+        switch ($this->column) {
58
+            // Type
59
+            case 0:
60
+                $sorting = UserDataGenerator :: UDG_SORT_TYPE;
61
+                break;
62
+            case 1:
63
+                $sorting = UserDataGenerator :: UDG_SORT_NAME;
64
+                break;
65
+            case 2:
66
+                $sorting = UserDataGenerator :: UDG_SORT_COURSE;
67
+                break;
68
+            case 3:
69
+                $sorting = UserDataGenerator :: UDG_SORT_CATEGORY;
70
+                break;
71
+            case 4:
72
+                $sorting = UserDataGenerator :: UDG_SORT_AVERAGE;
73
+                break;
74
+            case 5:
75
+                $sorting = UserDataGenerator :: UDG_SORT_SCORE;
76
+                break;
77
+            case 6:
78
+                $sorting = UserDataGenerator :: UDG_SORT_MASK;
79
+                break;
80
+        }
81
+        if ($this->direction == 'DESC') {
82
+            $sorting |= UserDataGenerator :: UDG_SORT_DESC;
83
+        } else {
84
+            $sorting |= UserDataGenerator :: UDG_SORT_ASC;
85
+        }
86
+        $data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
87
+        // generate the data to display
88
+        $sortable_data = array();
89
+        foreach ($data_array as $data) {
90
+            if ($data[2]!="") {//filter by course removed
91
+                $row = array ();
92
+                $row[] = $this->build_type_column($data[0]);
93
+                $row[] = $this->build_name_link($data[0]);
94
+                $row[] = $data[2];
95
+                $row[] = $data[3];
96
+                $row[] = $data[4];
97
+                $row[] = $data[5];
98
+                if ($scoredisplay->is_custom())
99
+                    $row[] = $data[6];
100
+                $sortable_data[] = $row;
101
+            }
102
+        }
103 103
 
104
-		return $sortable_data;
105
-	}
104
+        return $sortable_data;
105
+    }
106 106
 
107
-	/**
108
-	 * @param $item
109
-	 * @return string
110
-	 */
111
-	private function build_type_column($item)
112
-	{
113
-		return GradebookUtils::build_type_icon_tag($item->get_icon_name());
114
-	}
107
+    /**
108
+     * @param $item
109
+     * @return string
110
+     */
111
+    private function build_type_column($item)
112
+    {
113
+        return GradebookUtils::build_type_icon_tag($item->get_icon_name());
114
+    }
115 115
 
116
-	/**
117
-	 * @param $item
118
-	 * @return string
119
-	 */
120
-	private function build_name_link($item)
121
-	{
122
-		switch ($item->get_item_type()) {
123
-			// evaluation
124
-			case 'E' :
125
-				return '&nbsp;'
126
-				. '<a href="gradebook_view_result.php?selecteval=' . $item->get_id() . '">'
127
-				. $item->get_name()
128
-				. '</a>';
129
-			// link
130
-			case 'L' :
131
-				return '&nbsp;<a href="' . $item->get_link() . '">'
132
-				. $item->get_name()
133
-				. '</a>'
134
-				. '&nbsp;[' . $item->get_type_name() . ']';
135
-		}
136
-	}
116
+    /**
117
+     * @param $item
118
+     * @return string
119
+     */
120
+    private function build_name_link($item)
121
+    {
122
+        switch ($item->get_item_type()) {
123
+            // evaluation
124
+            case 'E' :
125
+                return '&nbsp;'
126
+                . '<a href="gradebook_view_result.php?selecteval=' . $item->get_id() . '">'
127
+                . $item->get_name()
128
+                . '</a>';
129
+            // link
130
+            case 'L' :
131
+                return '&nbsp;<a href="' . $item->get_link() . '">'
132
+                . $item->get_name()
133
+                . '</a>'
134
+                . '&nbsp;[' . $item->get_type_name() . ']';
135
+        }
136
+    }
137 137
 }
Please login to merge, or discard this patch.
main/gradebook/lib/fe/evalform.class.php 1 patch
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
             'onchange' => 'document.add_users_to_evaluation.submit()'
92 92
         ));
93 93
         $select->addOption('', '');
94
-        for ($i = 65; $i <= 90; $i ++) {
94
+        for ($i = 65; $i <= 90; $i++) {
95 95
             $letter = chr($i);
96 96
             if (isset($this->extra) && $this->extra == $letter) {
97 97
                 $select->addOption($letter, $letter, 'selected');
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
         ));
107 107
         foreach ($this->evaluation_object->get_not_subscribed_students() as $user) {
108 108
             if ((!isset($this->extra)) || empty($this->extra) || api_strtoupper(api_substr($user[1], 0, 1)) == $this->extra) {
109
-                $select->addoption($user[1] . ' ' . $user[2] . ' (' . $user[3] . ')', $user[0]);
109
+                $select->addoption($user[1].' '.$user[2].' ('.$user[3].')', $user[0]);
110 110
             }
111 111
         }
112 112
         $this->addButtonCreate(get_lang('AddUserToEval'), 'submit_button');
@@ -134,21 +134,21 @@  discard block
 block discarded – undo
134 134
         if (api_is_western_name_order()) {
135 135
             $renderer->setHeaderTemplate(
136 136
                     '<tr>
137
-    		       <th>' . get_lang('OfficialCode') . '</th>
138
-    		      <th>' . get_lang('UserName') . '</th>
139
-    		      <th>' . get_lang('FirstName') . '</th>
140
-    		      <th>' . get_lang('LastName') . '</th>
141
-    		      <th>' . get_lang('Qualify') . '</th>
137
+    		       <th>' . get_lang('OfficialCode').'</th>
138
+    		      <th>' . get_lang('UserName').'</th>
139
+    		      <th>' . get_lang('FirstName').'</th>
140
+    		      <th>' . get_lang('LastName').'</th>
141
+    		      <th>' . get_lang('Qualify').'</th>
142 142
     		   </tr>'
143 143
             );
144 144
         } else {
145 145
             $renderer->setHeaderTemplate(
146 146
                     '<tr>
147
-                   <th>' . get_lang('OfficialCode') . '</th>
148
-                  <th>' . get_lang('UserName') . '</th>
149
-                  <th>' . get_lang('LastName') . '</th>
150
-                  <th>' . get_lang('FirstName') . '</th>
151
-                  <th>' . get_lang('Qualify') . '</th>
147
+                   <th>' . get_lang('OfficialCode').'</th>
148
+                  <th>' . get_lang('UserName').'</th>
149
+                  <th>' . get_lang('LastName').'</th>
150
+                  <th>' . get_lang('FirstName').'</th>
151
+                  <th>' . get_lang('Qualify').'</th>
152 152
                </tr>'
153 153
             );
154 154
         }
@@ -174,33 +174,33 @@  discard block
 block discarded – undo
174 174
             $result = $result_and_user['result'];
175 175
 
176 176
             $renderer = &$this->defaultRenderer();
177
-            $this->addText('score[' . $result->get_id() . ']', $this->build_stud_label($user['user_id'], $user['username'], $user['lastname'], $user['firstname']), false, array('class' => "span2",
177
+            $this->addText('score['.$result->get_id().']', $this->build_stud_label($user['user_id'], $user['username'], $user['lastname'], $user['firstname']), false, array('class' => "span2",
178 178
                 'maxlength' => 5));
179 179
 
180
-            $this->addRule('score[' . $result->get_id() . ']', get_lang('OnlyNumbers'), 'numeric');
180
+            $this->addRule('score['.$result->get_id().']', get_lang('OnlyNumbers'), 'numeric');
181 181
             $this->addRule(array(
182
-                'score[' . $result->get_id() . ']', 'maxvalue'), get_lang('OverMax'), 'compare', '<=');
182
+                'score['.$result->get_id().']', 'maxvalue'), get_lang('OverMax'), 'compare', '<=');
183 183
             $this->addRule(array(
184
-                'score[' . $result->get_id() . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>=');
185
-            $defaults['score[' . $result->get_id() . ']'] = $result->get_score();
184
+                'score['.$result->get_id().']', 'minvalue'), get_lang('UnderMin'), 'compare', '>=');
185
+            $defaults['score['.$result->get_id().']'] = $result->get_score();
186 186
 
187 187
             if (api_is_western_name_order()) {
188
-                $user_info = '<td align="left" >' . $user['firstname'] . '</td>';
189
-                $user_info .= '<td align="left" >' . $user['lastname'] . '</td>';
188
+                $user_info = '<td align="left" >'.$user['firstname'].'</td>';
189
+                $user_info .= '<td align="left" >'.$user['lastname'].'</td>';
190 190
             } else {
191
-                $user_info = '<td align="left" >' . $user['lastname'] . '</td>';
192
-                $user_info .= '<td align="left" >' . $user['firstname'] . '</td>';
191
+                $user_info = '<td align="left" >'.$user['lastname'].'</td>';
192
+                $user_info .= '<td align="left" >'.$user['firstname'].'</td>';
193 193
             }
194 194
 
195 195
             $template = '<tr>
196
-		      <td align="left" >' . $user['official_code'] . '</td>
197
-		      <td align="left" >' . $user['username'] . '</td>
198
-		      ' . $user_info . '
199
-		       <td align="left">{element} / ' . $this->evaluation_object->get_max() . '
196
+		      <td align="left" >' . $user['official_code'].'</td>
197
+		      <td align="left" >' . $user['username'].'</td>
198
+		      ' . $user_info.'
199
+		       <td align="left">{element} / ' . $this->evaluation_object->get_max().'
200 200
 		         <!-- BEGIN error --><br /><span style="color: #ff0000;font-size:10px">{error}</span><!-- END error -->
201 201
 		      </td>
202 202
 		   </tr>';
203
-            $renderer->setElementTemplate($template, 'score[' . $result->get_id() . ']');
203
+            $renderer->setElementTemplate($template, 'score['.$result->get_id().']');
204 204
         }
205 205
         $this->setDefaults($defaults);
206 206
         $this->addButtonSave(get_lang('EditResult'), 'submit');
@@ -215,15 +215,15 @@  discard block
 block discarded – undo
215 215
     {
216 216
         $renderer = & $this->defaultRenderer();
217 217
         $renderer->setCustomElementTemplate('<span>{element}</span> ');
218
-        $this->addElement('static', null, null, '"' . $this->evaluation_object->get_name() . '" ');
219
-        $this->addElement('static', null, null, get_lang('MoveTo') . ' : ');
218
+        $this->addElement('static', null, null, '"'.$this->evaluation_object->get_name().'" ');
219
+        $this->addElement('static', null, null, get_lang('MoveTo').' : ');
220 220
         $select = $this->addElement('select', 'move_cat', null, null);
221 221
         $line = '';
222 222
         foreach ($this->evaluation_object->get_target_categories() as $cat) {
223 223
             for ($i = 0; $i < $cat[2]; $i++) {
224 224
                 $line .= '&mdash;';
225 225
             }
226
-            $select->addoption($line . ' ' . $cat[1], $cat[0]);
226
+            $select->addoption($line.' '.$cat[1], $cat[0]);
227 227
             $line = '';
228 228
         }
229 229
         $this->addButtonSave(get_lang('Ok'), 'submit');
@@ -253,21 +253,21 @@  discard block
 block discarded – undo
253 253
         if (api_is_western_name_order()) {
254 254
             $renderer->setHeaderTemplate(
255 255
                     '<tr>
256
-                   <th>' . get_lang('OfficialCode') . '</th>
257
-                  <th>' . get_lang('UserName') . '</th>
258
-                  <th>' . get_lang('FirstName') . '</th>
259
-                  <th>' . get_lang('LastName') . '</th>
260
-                  <th>' . get_lang('Qualify') . '</th>
256
+                   <th>' . get_lang('OfficialCode').'</th>
257
+                  <th>' . get_lang('UserName').'</th>
258
+                  <th>' . get_lang('FirstName').'</th>
259
+                  <th>' . get_lang('LastName').'</th>
260
+                  <th>' . get_lang('Qualify').'</th>
261 261
                </tr>'
262 262
             );
263 263
         } else {
264 264
             $renderer->setHeaderTemplate(
265 265
                     '<tr>
266
-                   <th>' . get_lang('OfficialCode') . '</th>
267
-                  <th>' . get_lang('UserName') . '</th>
268
-                  <th>' . get_lang('LastName') . '</th>
269
-                  <th>' . get_lang('FirstName') . '</th>
270
-                  <th>' . get_lang('Qualify') . '</th>
266
+                   <th>' . get_lang('OfficialCode').'</th>
267
+                  <th>' . get_lang('UserName').'</th>
268
+                  <th>' . get_lang('LastName').'</th>
269
+                  <th>' . get_lang('FirstName').'</th>
270
+                  <th>' . get_lang('Qualify').'</th>
271 271
                </tr>'
272 272
             );
273 273
         }
@@ -275,7 +275,7 @@  discard block
 block discarded – undo
275 275
         $firstUser = true;
276 276
         foreach ($tblusers as $user) {
277 277
 
278
-            $element_name = 'score[' . $user[0] . ']';
278
+            $element_name = 'score['.$user[0].']';
279 279
 
280 280
             $scoreColumnProperties = array('maxlength' => 5);
281 281
             if ($firstUser) {
@@ -290,19 +290,19 @@  discard block
 block discarded – undo
290 290
             $this->addRule(array($element_name, 'minvalue'), get_lang('UnderMin'), 'compare', '>=');
291 291
 
292 292
             if (api_is_western_name_order()) {
293
-                $user_info = '<td align="left" >' . $user[3] . '</td>';
294
-                $user_info .= '<td align="left" >' . $user[2] . '</td>';
293
+                $user_info = '<td align="left" >'.$user[3].'</td>';
294
+                $user_info .= '<td align="left" >'.$user[2].'</td>';
295 295
             } else {
296
-                $user_info = '<td align="left" >' . $user[2] . '</td>';
297
-                $user_info .= '<td align="left" >' . $user[3] . '</td>';
296
+                $user_info = '<td align="left" >'.$user[2].'</td>';
297
+                $user_info .= '<td align="left" >'.$user[3].'</td>';
298 298
             }
299 299
             $nr_users++;
300 300
 
301 301
             $template = '<tr>
302
-		      <td align="left" >' . $user[4] . '</td>
303
-		      <td align="left" >' . $user[1] . '</td>
304
-		      ' . $user_info . '
305
-		       <td align="left">{element} / ' . $this->evaluation_object->get_max() . '
302
+		      <td align="left" >' . $user[4].'</td>
303
+		      <td align="left" >' . $user[1].'</td>
304
+		      ' . $user_info.'
305
+		       <td align="left">{element} / ' . $this->evaluation_object->get_max().'
306 306
 		         <!-- BEGIN error --><br /><span style="color: #ff0000;font-size:10px">{error}</span><!-- END error -->
307 307
 		      </td>
308 308
             </tr>';
@@ -336,7 +336,7 @@  discard block
 block discarded – undo
336 336
         $renderer->setCustomElementTemplate('<span>{element}</span> ');
337 337
         $this->addElement('label', get_lang('User'), $userinfo['complete_name']);
338 338
 
339
-        $this->addText('score', array(get_lang('Score'), null, '/ ' . $this->evaluation_object->get_max()), false, array(
339
+        $this->addText('score', array(get_lang('Score'), null, '/ '.$this->evaluation_object->get_max()), false, array(
340 340
             'size' => '4',
341 341
             'class' => 'span1',
342 342
             'maxlength' => '5'
@@ -471,7 +471,7 @@  discard block
 block discarded – undo
471 471
             }
472 472
         }
473 473
 
474
-        $this->addText('weight_mask', array(get_lang('Weight'), null, ' [0 .. <span id="max_weight">' . $all_categories[0]->get_weight() . '</span>] '), true, array(
474
+        $this->addText('weight_mask', array(get_lang('Weight'), null, ' [0 .. <span id="max_weight">'.$all_categories[0]->get_weight().'</span>] '), true, array(
475 475
             'size' => '4',
476 476
             'maxlength' => '5',
477 477
             'class' => 'span1'
@@ -543,11 +543,11 @@  discard block
 block discarded – undo
543 543
             $link = LinkFactory :: get_evaluation_link($this->evaluation_object->get_id());
544 544
             $doc_url = $link->get_view_url($id);
545 545
             if ($doc_url != null) {
546
-                $opendocurl_start .= '<a href="' . $doc_url . '" target="_blank">';
546
+                $opendocurl_start .= '<a href="'.$doc_url.'" target="_blank">';
547 547
                 $opendocurl_end = '</a>';
548 548
             }
549 549
         }
550
-        return $opendocurl_start . api_get_person_name($firstname, $lastname) . ' (' . $username . ')' . $opendocurl_end;
550
+        return $opendocurl_start.api_get_person_name($firstname, $lastname).' ('.$username.')'.$opendocurl_end;
551 551
     }
552 552
 
553 553
     function sort_by_user($item1, $item2)
Please login to merge, or discard this patch.
main/gradebook/lib/scoredisplay.class.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     /**
35 35
      * Compare the custom display of 2 scores, can be useful in sorting
36 36
      */
37
-    public static function compare_scores_by_custom_display ($score1, $score2)
37
+    public static function compare_scores_by_custom_display($score1, $score2)
38 38
     {
39 39
         if (!isset($score1)) {
40 40
             return (isset($score2) ? 1 : 0);
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
             if ($custom1 == $custom2) {
48 48
                 return 0;
49 49
             } else {
50
-                return (($score1[0]/$score1[1]) < ($score2[0]/$score2[1]) ? -1 : 1);
50
+                return (($score1[0] / $score1[1]) < ($score2[0] / $score2[1]) ? -1 : 1);
51 51
             }
52 52
         }
53 53
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
         //Setting custom enabled
80 80
         $value = api_get_setting('gradebook_score_display_custom');
81 81
         $value = $value['my_display_custom'];
82
-        $this->custom_enabled  = $value == 'true' ? true : false;
82
+        $this->custom_enabled = $value == 'true' ? true : false;
83 83
 
84 84
         if ($this->custom_enabled) {
85 85
             $params = array('category = ?' =>  array('Gradebook'));
@@ -96,10 +96,10 @@  discard block
 block discarded – undo
96 96
                 sort($portal_displays);
97 97
             }
98 98
             $this->custom_display = $portal_displays;
99
-            if (count($this->custom_display)>0) {
99
+            if (count($this->custom_display) > 0) {
100 100
                 $value = api_get_setting('gradebook_score_display_upperlimit');
101 101
                 $value = $value['my_display_upperlimit'];
102
-                $this->upperlimit_included  = $value == 'true' ? true : false;
102
+                $this->upperlimit_included = $value == 'true' ? true : false;
103 103
                 $this->custom_display_conv = $this->convert_displays($this->custom_display);
104 104
             }
105 105
         }
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
             //Load course settings
111 111
             if ($this->custom_enabled) {
112 112
                 $this->custom_display = $this->get_custom_displays();
113
-                if (count($this->custom_display)> 0) {
113
+                if (count($this->custom_display) > 0) {
114 114
                     $this->custom_display_conv = $this->convert_displays($this->custom_display);
115 115
                 }
116 116
             }
@@ -182,7 +182,7 @@  discard block
 block discarded – undo
182 182
         }
183 183
 
184 184
         $sql = 'SELECT id FROM '.$tbl_gradebook_category.'
185
-                WHERE course_code = "'.$curr_course_code.'" '. $session_condition;
185
+                WHERE course_code = "'.$curr_course_code.'" '.$session_condition;
186 186
         $rs  = Database::query($sql);
187 187
         $category_id = 0;
188 188
         if (Database::num_rows($rs) > 0) {
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
         );
252 252
 
253 253
         $tbl_display = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_SCORE_DISPLAY);
254
-        foreach($display as $value => $text) {
254
+        foreach ($display as $value => $text) {
255 255
             $params = array(
256 256
                 'score' => $value,
257 257
                 'display' => $text,
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
         $my_score = $score == 0 ? 1 : $score;
308 308
 
309 309
         if ($type == SCORE_BAR) {
310
-            $percentage = $my_score[0]/$my_score[1]*100;
310
+            $percentage = $my_score[0] / $my_score[1] * 100;
311 311
 
312 312
             return Display::bar_progress($percentage);
313 313
         }
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
             case SCORE_PERCENT :                        // XX %
349 349
                 return $this->display_as_percent($score);
350 350
             case SCORE_DIV_PERCENT :                    // X / Y (XX %)
351
-                return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')';
351
+                return $this->display_as_div($score).' ('.$this->display_as_percent($score).')';
352 352
             case SCORE_AVERAGE :                        // XX %
353 353
                 return $this->display_as_percent($score);
354 354
             case SCORE_DECIMAL :                        // 0.50  (X/Y)
@@ -358,7 +358,7 @@  discard block
 block discarded – undo
358 358
                 if (!empty($custom)) {
359 359
                     $custom = ' - '.$custom;
360 360
                 }
361
-                return $this->display_as_div($score).' (' . $this->display_as_percent($score) . ')'.$custom;
361
+                return $this->display_as_div($score).' ('.$this->display_as_percent($score).')'.$custom;
362 362
             case SCORE_DIV_SIMPLE_WITH_CUSTOM :         // X - Good!
363 363
                 $custom = $this->display_custom($score);
364 364
 
@@ -410,9 +410,9 @@  discard block
 block discarded – undo
410 410
      */
411 411
     private function display_as_decimal($score)
412 412
     {
413
-        $score_denom = ($score[1]==0) ? 1 : $score[1];
413
+        $score_denom = ($score[1] == 0) ? 1 : $score[1];
414 414
 
415
-        return $this->format_score($score[0]/$score_denom);
415
+        return $this->format_score($score[0] / $score_denom);
416 416
     }
417 417
 
418 418
     /**
@@ -420,9 +420,9 @@  discard block
 block discarded – undo
420 420
      */
421 421
     private function display_as_percent($score)
422 422
     {
423
-        $score_denom = ($score[1]==0) ? 1 : $score[1];
423
+        $score_denom = ($score[1] == 0) ? 1 : $score[1];
424 424
 
425
-        return $this->format_score($score[0]/$score_denom*100) . ' %';
425
+        return $this->format_score($score[0] / $score_denom * 100).' %';
426 426
     }
427 427
 
428 428
     /**
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
         } else {
439 439
             $score[0] = isset($score[0]) ? $this->format_score($score[0]) : 0;
440 440
             $score[1] = isset($score[1]) ? $this->format_score($score[1]) : 0;
441
-            return  $score[0] . ' / ' . $score[1];
441
+            return  $score[0].' / '.$score[1];
442 442
         }
443 443
     }
444 444
 
@@ -448,7 +448,7 @@  discard block
 block discarded – undo
448 448
      */
449 449
     private function display_custom($score)
450 450
     {
451
-        $my_score_denom= ($score[1]==0) ? 1 : $score[1];
451
+        $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
452 452
         $scaledscore = $score[0] / $my_score_denom;
453 453
         if ($this->upperlimit_included) {
454 454
             foreach ($this->custom_display_conv as $displayitem) {
@@ -512,7 +512,7 @@  discard block
 block discarded – undo
512 512
                 ORDER BY score';
513 513
         $result = Database::query($sql);
514 514
 
515
-        return Database::store_result($result,'ASSOC');
515
+        return Database::store_result($result, 'ASSOC');
516 516
     }
517 517
 
518 518
     /**
Please login to merge, or discard this patch.
main/gradebook/lib/gradebook_data_generator.class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
         if (count($allcats) > 0) {
43 43
             // get sub categories id
44 44
             $tabCategories = array();
45
-            for ($i=0; $i < count($allcats); $i++) {
45
+            for ($i = 0; $i < count($allcats); $i++) {
46 46
                 $tabCategories[] = $allcats[$i]->get_id();
47 47
             }
48 48
             // dont display links that belongs to a sub category
49 49
             $tabLinkToDisplay = array();
50
-            for ($i=0; $i < count($alllinks); $i++) {
50
+            for ($i = 0; $i < count($alllinks); $i++) {
51 51
                 if (!in_array($alllinks[$i]->get_category_id(), $tabCategories)) {
52 52
                     $tabLinkToDisplay[] = $alllinks[$i];
53 53
                 }
@@ -89,7 +89,7 @@  discard block
 block discarded – undo
89 89
         //$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
90 90
         // do some checks on count, redefine if invalid value
91 91
         if (!isset($count)) {
92
-            $count = count ($this->items) - $start;
92
+            $count = count($this->items) - $start;
93 93
         }
94 94
         if ($count < 0) {
95 95
             $count = 0;
@@ -246,7 +246,7 @@  discard block
 block discarded – undo
246 246
         $display = $scoreDisplay->display_score($score, SCORE_DIV, SCORE_BOTH, true);
247 247
         $type = $item->get_item_type();
248 248
         if ($type == 'L' && get_class($item) == 'ExerciseLink') {
249
-            $display  = ExerciseLib::show_score($score[0], $score[1], false);
249
+            $display = ExerciseLib::show_score($score[0], $score[1], false);
250 250
         }
251 251
 
252 252
         return array(
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
         $type = $item->get_item_type();
269 269
 
270 270
         if ($type == 'L' && get_class($item) == 'ExerciseLink') {
271
-            $display  = ExerciseLib::show_score($score[0], $score[1], false);
271
+            $display = ExerciseLib::show_score($score[0], $score[1], false);
272 272
         }
273 273
 
274 274
         return array(
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
 
362 362
                 $type = $item->get_item_type();
363 363
                 if ($type == 'L' && get_class($item) == 'ExerciseLink') {
364
-                    $display  = ExerciseLib::show_score($score[0], $score[1], false);
364
+                    $display = ExerciseLib::show_score($score[0], $score[1], false);
365 365
                 }
366 366
 
367 367
                 return array(
@@ -442,7 +442,7 @@  discard block
 block discarded – undo
442 442
     public function sort_by_type($item1, $item2)
443 443
     {
444 444
         if ($item1->get_item_type() == $item2->get_item_type()) {
445
-            return $this->sort_by_name($item1,$item2);
445
+            return $this->sort_by_name($item1, $item2);
446 446
         } else {
447 447
             return ($item1->get_item_type() < $item2->get_item_type() ? -1 : 1);
448 448
         }
@@ -457,7 +457,7 @@  discard block
 block discarded – undo
457 457
     {
458 458
         $result = api_strcmp($item1->get_description(), $item2->get_description());
459 459
         if ($result == 0) {
460
-            return $this->sort_by_name($item1,$item2);
460
+            return $this->sort_by_name($item1, $item2);
461 461
         }
462 462
         return $result;
463 463
     }
@@ -470,7 +470,7 @@  discard block
 block discarded – undo
470 470
     public function sort_by_weight($item1, $item2)
471 471
     {
472 472
         if ($item1->get_weight() == $item2->get_weight()) {
473
-            return $this->sort_by_name($item1,$item2);
473
+            return $this->sort_by_name($item1, $item2);
474 474
         } else {
475 475
             return ($item1->get_weight() < $item2->get_weight() ? -1 : 1);
476 476
         }
@@ -501,7 +501,7 @@  discard block
 block discarded – undo
501 501
         }
502 502
 
503 503
         if ($timestamp1 == $timestamp2) {
504
-            return $this->sort_by_name($item1,$item2);
504
+            return $this->sort_by_name($item1, $item2);
505 505
         } else {
506 506
             return ($timestamp1 < $timestamp2 ? -1 : 1);
507 507
         }
Please login to merge, or discard this patch.
main/gradebook/lib/be/exerciselink.class.php 2 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -194,13 +194,13 @@  discard block
 block discarded – undo
194 194
         in exercice/exercice.php, look for note-query-exe-results marker*/
195 195
         $session_id = api_get_session_id();
196 196
         $courseId = $this->getCourseId();
197
-	    $exercise = new Exercise($courseId);
197
+        $exercise = new Exercise($courseId);
198 198
         $exercise->read($this->get_ref_id());
199 199
 
200 200
         if (!$this->is_hp) {
201 201
 
202
-		if ($exercise->exercise_was_added_in_lp == false) {
203
-			$sql = "SELECT * FROM $tblStats
202
+        if ($exercise->exercise_was_added_in_lp == false) {
203
+            $sql = "SELECT * FROM $tblStats
204 204
 			        WHERE
205 205
 			            exe_exo_id = ".intval($this->get_ref_id())." AND
206 206
 			            orig_lp_id = 0 AND
@@ -209,15 +209,15 @@  discard block
 block discarded – undo
209 209
 			            session_id = $session_id AND
210 210
                                     c_id = $courseId 
211 211
                                 ";
212
-		    } else {
213
-		        $lpId = null;
214
-		        if (!empty($exercise->lpList)) {
215
-		            // Taking only the first LP
216
-		            $lpId = current($exercise->lpList);
217
-		            $lpId = $lpId['lp_id'];
218
-		        }
219
-
220
-		        $sql = "SELECT * FROM $tblStats
212
+            } else {
213
+                $lpId = null;
214
+                if (!empty($exercise->lpList)) {
215
+                    // Taking only the first LP
216
+                    $lpId = current($exercise->lpList);
217
+                    $lpId = $lpId['lp_id'];
218
+                }
219
+
220
+                $sql = "SELECT * FROM $tblStats
221 221
 		                WHERE
222 222
 		                    exe_exo_id = ".intval($this->get_ref_id())." AND
223 223
 		                    orig_lp_id = $lpId AND
@@ -225,7 +225,7 @@  discard block
 block discarded – undo
225 225
 		                    session_id = $session_id AND
226 226
                                     c_id = $courseId 
227 227
                                 ";
228
-		    }
228
+            }
229 229
 
230 230
             if (!empty($stud_id) && $type != 'ranking') {
231 231
                 $sql .= " AND exe_user_id = $stud_id ";
Please login to merge, or discard this patch.
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -51,8 +51,8 @@  discard block
 block discarded – undo
51 51
 
52 52
         $result = Database::query($sql);
53 53
         $cats = array();
54
-        while ($data=Database::fetch_array($result)) {
55
-            $cats[] = array ($data['id'], $data['title']);
54
+        while ($data = Database::fetch_array($result)) {
55
+            $cats[] = array($data['id'], $data['title']);
56 56
         }
57 57
 
58 58
         return $cats;
@@ -116,15 +116,15 @@  discard block
 block discarded – undo
116 116
         $cats = array();
117 117
         if (isset($result)) {
118 118
             if (Database::num_rows($result) > 0) {
119
-                while ($data=Database::fetch_array($result)) {
120
-                    $cats[] = array ($data['id'], $data['title']);
119
+                while ($data = Database::fetch_array($result)) {
120
+                    $cats[] = array($data['id'], $data['title']);
121 121
                 }
122 122
             }
123 123
         }
124 124
 
125 125
         if (isset($result2)) {
126 126
             if (Database::num_rows($result2) > 0) {
127
-                while ($row=Database::fetch_array($result2)) {
127
+                while ($row = Database::fetch_array($result2)) {
128 128
                     /*$path = $data['path'];
129 129
                     $fname = GetQuizName($path,$documentPath);
130 130
         			$cats[] = array ($data['id'], $fname);*/
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
                 WHERE
171 171
                     session_id = $session_id AND
172 172
                     c_id = $course_id AND
173
-                    exe_exo_id   = ".(int)$this->get_ref_id();
173
+                    exe_exo_id   = ".(int) $this->get_ref_id();
174 174
         $result = Database::query($sql);
175
-        $number=Database::fetch_row($result);
175
+        $number = Database::fetch_row($result);
176 176
         return ($number[0] != 0);
177 177
     }
178 178
 
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
         } else {
255 255
             // all students -> get average
256 256
             // normal way of getting the info
257
-            $students = array();  // user list, needed to make sure we only
257
+            $students = array(); // user list, needed to make sure we only
258 258
             // take first attempts into account
259 259
             $student_count = 0;
260 260
             $sum = 0;
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
                         /*if (empty($count)) {
290 290
                             return null;
291 291
                         }*/
292
-                        return array($sumResult/$count , $weight);
292
+                        return array($sumResult / $count, $weight);
293 293
                         break;
294 294
                     case 'ranking':
295 295
                         return AbstractLink::getCurrentUserRanking($stud_id, $students);
@@ -319,7 +319,7 @@  discard block
 block discarded – undo
319 319
         $session_id = api_get_session_id();
320 320
 
321 321
         $url = api_get_path(WEB_CODE_PATH).'gradebook/exercise_jump.php?session_id='.$session_id.'&cidReq='.$this->get_course_code().'&gradebook=view&exerciseId='.$this->get_ref_id().'&type='.$this->get_type();
322
-        if ((!api_is_allowed_to_edit() && $this->calc_score(api_get_user_id()) == null) || $status_user!=1) {
322
+        if ((!api_is_allowed_to_edit() && $this->calc_score(api_get_user_id()) == null) || $status_user != 1) {
323 323
             $url .= '&amp;doexercise='.$this->get_ref_id();
324 324
         }
325 325
 
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
     public function is_valid_link()
365 365
     {
366 366
         $sql = 'SELECT count(id) from '.$this->get_exercise_table().'
367
-                WHERE c_id = '.$this->course_id.' AND id = '.(int)$this->get_ref_id().' ';
367
+                WHERE c_id = '.$this->course_id.' AND id = '.(int) $this->get_ref_id().' ';
368 368
         $result = Database::query($sql);
369 369
         $number = Database::fetch_row($result);
370 370
 
Please login to merge, or discard this patch.
main/gradebook/lib/be/abstractlink.class.php 2 patches
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -138,22 +138,22 @@  discard block
 block discarded – undo
138 138
         return $this->visible;
139 139
     }
140 140
 
141
-    public function set_id ($id)
141
+    public function set_id($id)
142 142
     {
143 143
         $this->id = $id;
144 144
     }
145 145
 
146
-    public function set_type ($type)
146
+    public function set_type($type)
147 147
     {
148 148
         $this->type = $type;
149 149
     }
150 150
 
151
-    public function set_ref_id ($ref_id)
151
+    public function set_ref_id($ref_id)
152 152
     {
153 153
         $this->ref_id = $ref_id;
154 154
     }
155 155
 
156
-    public function set_user_id ($user_id)
156
+    public function set_user_id($user_id)
157 157
     {
158 158
         $this->user_id = $user_id;
159 159
     }
@@ -231,29 +231,29 @@  discard block
 block discarded – undo
231 231
         $sql = 'SELECT * FROM '.$tbl_grade_links;
232 232
         $paramcount = 0;
233 233
         if (isset ($id)) {
234
-            $sql.= ' WHERE id = '.intval($id);
235
-            $paramcount ++;
234
+            $sql .= ' WHERE id = '.intval($id);
235
+            $paramcount++;
236 236
         }
237 237
         if (isset ($type)) {
238 238
             if ($paramcount != 0) $sql .= ' AND';
239 239
             else $sql .= ' WHERE';
240 240
             $sql .= ' type = '.intval($type);
241
-            $paramcount ++;
241
+            $paramcount++;
242 242
         }
243 243
         if (isset ($ref_id)) {
244 244
             if ($paramcount != 0) $sql .= ' AND';
245 245
             else $sql .= ' WHERE';
246 246
             $sql .= ' ref_id = '.intval($ref_id);
247
-            $paramcount ++;
247
+            $paramcount++;
248 248
         }
249 249
         if (isset ($user_id)) {
250 250
             if ($paramcount != 0) {
251 251
                 $sql .= ' AND';
252
-            }else {
252
+            } else {
253 253
                 $sql .= ' WHERE';
254 254
             }
255 255
             $sql .= ' user_id = '.intval($user_id);
256
-            $paramcount ++;
256
+            $paramcount++;
257 257
         }
258 258
         if (isset ($course_code)) {
259 259
             if ($paramcount != 0) {
@@ -262,16 +262,16 @@  discard block
 block discarded – undo
262 262
                 $sql .= ' WHERE';
263 263
             }
264 264
             $sql .= " course_code = '".Database::escape_string($course_code)."'";
265
-            $paramcount ++;
265
+            $paramcount++;
266 266
         }
267 267
         if (isset ($category_id)) {
268 268
             if ($paramcount != 0) {
269 269
                 $sql .= ' AND';
270
-            }else {
270
+            } else {
271 271
                 $sql .= ' WHERE';
272 272
             }
273 273
             $sql .= ' category_id = '.intval($category_id);
274
-            $paramcount ++;
274
+            $paramcount++;
275 275
         }
276 276
         if (isset ($visible)) {
277 277
             if ($paramcount != 0) {
@@ -311,7 +311,7 @@  discard block
 block discarded – undo
311 311
             $session_id = api_get_session_id();
312 312
 
313 313
             $link->set_session_id($session_id);
314
-            $links[]=$link;
314
+            $links[] = $link;
315 315
         }
316 316
         return $links;
317 317
     }
@@ -402,12 +402,12 @@  discard block
 block discarded – undo
402 402
         $dateobject = AbstractLink::load($idevaluation, null, null, null, null);
403 403
         $current_date_server = api_get_utc_datetime();
404 404
         $arreval = get_object_vars($dateobject[0]);
405
-        $description_log = isset($arreval['description']) ? $arreval['description']:'';
405
+        $description_log = isset($arreval['description']) ? $arreval['description'] : '';
406 406
         if (empty($nameLog)) {
407 407
             if (isset($_POST['name_link'])) {
408 408
                 $name_log = isset($_POST['name_link']) ? $_POST['name_link'] : $arreval['course_code'];
409
-            } elseif (isset($_POST['link_' . $idevaluation]) && $_POST['link_' . $idevaluation]) {
410
-                $name_log = $_POST['link_' . $idevaluation];
409
+            } elseif (isset($_POST['link_'.$idevaluation]) && $_POST['link_'.$idevaluation]) {
410
+                $name_log = $_POST['link_'.$idevaluation];
411 411
             } else {
412 412
                 $name_log = $arreval['course_code'];
413 413
             }
@@ -452,10 +452,10 @@  discard block
 block discarded – undo
452 452
         $targets = array();
453 453
         $level = 0;
454 454
 
455
-        $crscats = Category::load(null,null,$this->get_course_code(),0);
455
+        $crscats = Category::load(null, null, $this->get_course_code(), 0);
456 456
         foreach ($crscats as $cat) {
457
-            $targets[] = array($cat->get_id(), $cat->get_name(), $level+1);
458
-            $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
457
+            $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
458
+            $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
459 459
         }
460 460
 
461 461
         return $targets;
@@ -466,10 +466,10 @@  discard block
 block discarded – undo
466 466
      */
467 467
     private function add_target_subcategories($targets, $level, $catid)
468 468
     {
469
-        $subcats = Category::load(null,null,null,$catid);
469
+        $subcats = Category::load(null, null, null, $catid);
470 470
         foreach ($subcats as $cat) {
471
-            $targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
472
-            $targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
471
+            $targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
472
+            $targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
473 473
         }
474 474
         return $targets;
475 475
     }
@@ -493,7 +493,7 @@  discard block
 block discarded – undo
493 493
      * To keep consistency, do not call this method but LinkFactory::find_links instead.
494 494
      * @todo can be written more efficiently using a new (but very complex) sql query
495 495
      */
496
-    public function find_links ($name_mask,$selectcat)
496
+    public function find_links($name_mask, $selectcat)
497 497
     {
498 498
         $rootcat = Category::load($selectcat);
499 499
         $links = $rootcat[0]->get_links((api_is_allowed_to_edit() ? null : api_get_user_id()), true);
Please login to merge, or discard this patch.
Braces   +12 added lines, -6 removed lines patch added patch discarded remove patch
@@ -235,21 +235,27 @@  discard block
 block discarded – undo
235 235
             $paramcount ++;
236 236
         }
237 237
         if (isset ($type)) {
238
-            if ($paramcount != 0) $sql .= ' AND';
239
-            else $sql .= ' WHERE';
238
+            if ($paramcount != 0) {
239
+                $sql .= ' AND';
240
+            } else {
241
+                $sql .= ' WHERE';
242
+            }
240 243
             $sql .= ' type = '.intval($type);
241 244
             $paramcount ++;
242 245
         }
243 246
         if (isset ($ref_id)) {
244
-            if ($paramcount != 0) $sql .= ' AND';
245
-            else $sql .= ' WHERE';
247
+            if ($paramcount != 0) {
248
+                $sql .= ' AND';
249
+            } else {
250
+                $sql .= ' WHERE';
251
+            }
246 252
             $sql .= ' ref_id = '.intval($ref_id);
247 253
             $paramcount ++;
248 254
         }
249 255
         if (isset ($user_id)) {
250 256
             if ($paramcount != 0) {
251 257
                 $sql .= ' AND';
252
-            }else {
258
+            } else {
253 259
                 $sql .= ' WHERE';
254 260
             }
255 261
             $sql .= ' user_id = '.intval($user_id);
@@ -267,7 +273,7 @@  discard block
 block discarded – undo
267 273
         if (isset ($category_id)) {
268 274
             if ($paramcount != 0) {
269 275
                 $sql .= ' AND';
270
-            }else {
276
+            } else {
271 277
                 $sql .= ' WHERE';
272 278
             }
273 279
             $sql .= ' category_id = '.intval($category_id);
Please login to merge, or discard this patch.
main/gradebook/lib/be/gradebookitem.class.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -8,16 +8,16 @@
 block discarded – undo
8 8
  */
9 9
 interface GradebookItem
10 10
 {
11
-	public function get_item_type();
12
-	public function get_id();
13
-	public function get_name();
14
-	public function get_description();
15
-	public function get_course_code();
16
-	public function get_weight();
17
-	public function get_date();
18
-	public function is_visible();
19
-	public function get_icon_name();
20
-	public function getStudentList();
21
-	public function setStudentList($list);
22
-	public function calc_score($stud_id = null, $type = null);
11
+    public function get_item_type();
12
+    public function get_id();
13
+    public function get_name();
14
+    public function get_description();
15
+    public function get_course_code();
16
+    public function get_weight();
17
+    public function get_date();
18
+    public function is_visible();
19
+    public function get_icon_name();
20
+    public function getStudentList();
21
+    public function setStudentList($list);
22
+    public function calc_score($stud_id = null, $type = null);
23 23
 }
Please login to merge, or discard this patch.