Passed
Push — 1.10.x ( f9cbcd...83c791 )
by Yannick
657:30 queued 614:41
created
main/gradebook/lib/fe/exportgradebook.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@  discard block
 block discarded – undo
11 11
  * @param	string	View to print as a title for the table
12 12
  * @param	string	Course name to print as title for the table
13 13
  */
14
-function print_table ($data_array,$header_names,$view,$coursename) {
15
-	$printdata= '<!DOCTYPE html
14
+function print_table($data_array, $header_names, $view, $coursename) {
15
+	$printdata = '<!DOCTYPE html
16 16
      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
17 17
      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
18 18
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="'.api_get_language_isocode().'" lang="'.api_get_language_isocode().'">
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 
98 98
 	$mpdf = new mPDF('UTF-8', 'A4-L', '', '', 15, 10, 35, 20, 4, 2, 'L');
99 99
 	$mpdf->useOnlyCoreFonts = true;
100
-	$mpdf->mirrorMargins = 0;      // Use different Odd/Even headers and footers and mirror margins
100
+	$mpdf->mirrorMargins = 0; // Use different Odd/Even headers and footers and mirror margins
101 101
 
102 102
 	if (is_array($headers_pdf)) {
103 103
 		// preparing headers pdf
@@ -144,13 +144,13 @@  discard block
 block discarded – undo
144 144
 		$css = '';
145 145
 	}
146 146
 
147
-	if(count($data_table) > 30)
148
-		$items_per_page = (count($data_table)/2);
147
+	if (count($data_table) > 30)
148
+		$items_per_page = (count($data_table) / 2);
149 149
 	else
150 150
 		$items_per_page = count($data_table);
151 151
 
152 152
 	$count_pages = ceil(count($data_table) / $items_per_page);
153
-	for ($x = 0; $x<$count_pages; $x++) {
153
+	for ($x = 0; $x < $count_pages; $x++) {
154 154
 		$content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
155 155
 		// header table
156 156
 		$content_table .= '<tr>';
@@ -159,7 +159,7 @@  discard block
 block discarded – undo
159 159
 
160 160
 			foreach ($headers_table as $head_table) {
161 161
 				if (!empty($head_table[0])) {
162
-					$width = (!empty($head_table[1])?$head_table[1].'%':'');
162
+					$width = (!empty($head_table[1]) ? $head_table[1].'%' : '');
163 163
 					$content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
164 164
 					$i++;
165 165
 				}
@@ -168,16 +168,16 @@  discard block
 block discarded – undo
168 168
 		$content_table .= '</tr>';
169 169
 		// body table
170 170
 		if (is_array($data_table) && count($data_table) > 0) {
171
-			$offset = $x*$items_per_page;
172
-			$data_table = array_slice ($data_table, $offset, count($data_table));
171
+			$offset = $x * $items_per_page;
172
+			$data_table = array_slice($data_table, $offset, count($data_table));
173 173
 			$i = 1;
174
-			$item = $offset+1;
174
+			$item = $offset + 1;
175 175
 			foreach ($data_table as $data) {
176 176
 				$content_table .= '<tr>';
177
-				$content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
177
+				$content_table .= '<td>'.($item < 10 ? '0'.$item : $item).'</td>';
178 178
 				foreach ($data as  $key => $content) {
179 179
 					if (isset($content)) {
180
-						$key == 1 ? $align='align="left"':$align='align="center"';
180
+						$key == 1 ? $align = 'align="left"' : $align = 'align="center"';
181 181
 						$content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
182 182
 					}
183 183
 				}
@@ -226,12 +226,12 @@  discard block
 block discarded – undo
226 226
 		// preparing headers pdf
227 227
 		$header = '<br/><br/><table width="100%" cellspacing="1" cellpadding="5" border="0" class="strong">
228 228
 					        <tr><td width="100%" style="text-align: center;" class="title" colspan="4"><h1>'.$title_pdf.'</h1></td></tr>';
229
-		foreach($headers_pdf as $header_pdf) {
229
+		foreach ($headers_pdf as $header_pdf) {
230 230
 			if (!empty($header_pdf[0]) && !empty($header_pdf[1])) {
231
-				$header.= '<tr><td><strong>'.$header_pdf[0].'</strong> </td><td>'.$header_pdf[1].'</td></tr>';
231
+				$header .= '<tr><td><strong>'.$header_pdf[0].'</strong> </td><td>'.$header_pdf[1].'</td></tr>';
232 232
 			}
233 233
 		}
234
-		$header.='</table><br />';
234
+		$header .= '</table><br />';
235 235
 	}
236 236
 
237 237
 	// preparing footer pdf
@@ -255,7 +255,7 @@  discard block
 block discarded – undo
255 255
 	}
256 256
 	$items_per_page = 30;
257 257
 	$count_pages = ceil(count($data_table) / $items_per_page);
258
-	for ($x = 0; $x<$count_pages; $x++) {
258
+	for ($x = 0; $x < $count_pages; $x++) {
259 259
 		$content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
260 260
 		// header table
261 261
 		$content_table .= '<tr>';
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
 		if (is_array($headers_table)) {
264 264
 			foreach ($headers_table as $head_table) {
265 265
 				if (!empty($head_table[0])) {
266
-					$width = (!empty($head_table[1])?$head_table[1].'%':'');
266
+					$width = (!empty($head_table[1]) ? $head_table[1].'%' : '');
267 267
 					$content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
268 268
 					$i++;
269 269
 				}
@@ -273,16 +273,16 @@  discard block
 block discarded – undo
273 273
 		// body table
274 274
 
275 275
 		if (is_array($data_table) && count($data_table) > 0) {
276
-			$offset = $x*$items_per_page;
277
-			$data_table = array_slice ($data_table, $offset, count($data_table));
276
+			$offset = $x * $items_per_page;
277
+			$data_table = array_slice($data_table, $offset, count($data_table));
278 278
 			$i = 1;
279
-			$item = $offset+1;
279
+			$item = $offset + 1;
280 280
 			foreach ($data_table as $data) {
281 281
 				$content_table .= '<tr>';
282
-				$content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
282
+				$content_table .= '<td>'.($item < 10 ? '0'.$item : $item).'</td>';
283 283
 				foreach ($data as  $key => $content) {
284 284
 					if (isset($content)) {
285
-						$key == 1 ? $align='align="left"':$align='align="center"';
285
+						$key == 1 ? $align = 'align="left"' : $align = 'align="center"';
286 286
 						$content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
287 287
 					}
288 288
 				}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	$pdf = new PDF();
301 301
 	$pdf->set_custom_footer($footer);
302 302
 	$pdf->set_custom_header($headers_in_pdf);
303
-	$pdf->content_to_pdf($header.$content_table, $css, $title_pdf );
303
+	$pdf->content_to_pdf($header.$content_table, $css, $title_pdf);
304 304
 	exit;
305 305
 
306 306
 }
@@ -312,21 +312,21 @@  discard block
 block discarded – undo
312 312
  * @param	array		Table headers
313 313
  * @param	string		Format (portrait or landscape)
314 314
  */
315
-function export_pdf($pdf,$newarray,$header_names,$format) {
315
+function export_pdf($pdf, $newarray, $header_names, $format) {
316 316
 	$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
317
-	$pdf->ezSetCmMargins(0,0,0,0);
318
-	$pdf->ezSetY(($format=='portrait')?'820':'570');
317
+	$pdf->ezSetCmMargins(0, 0, 0, 0);
318
+	$pdf->ezSetY(($format == 'portrait') ? '820' : '570');
319 319
 	$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
320 320
 	//$pdf->ezText(get_lang('FlatView').' ('. api_convert_and_format_date(null, DATE_FORMAT_SHORT). ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT) .')',12,array('justification'=>'center'));
321
-	if ($format=='portrait') {
322
-		$pdf->line(40,790,540,790);
323
-		$pdf->line(40,40,540,40);
321
+	if ($format == 'portrait') {
322
+		$pdf->line(40, 790, 540, 790);
323
+		$pdf->line(40, 40, 540, 40);
324 324
 	} else {
325
-		$pdf->line(40,540,790,540);
326
-		$pdf->line(40,40,790,40);
325
+		$pdf->line(40, 540, 790, 540);
326
+		$pdf->line(40, 40, 790, 40);
327 327
 	}
328
-	$pdf->ezSetY(($format=='portrait')?'750':'520');
329
-	$pdf->ezTable($newarray,$header_names,'',array('showHeadings'=>1,'shaded'=>1,'showLines'=>1,'rowGap'=>3,'width'=>(($format=='portrait')?'500':'750')));
328
+	$pdf->ezSetY(($format == 'portrait') ? '750' : '520');
329
+	$pdf->ezTable($newarray, $header_names, '', array('showHeadings'=>1, 'shaded'=>1, 'showLines'=>1, 'rowGap'=>3, 'width'=>(($format == 'portrait') ? '500' : '750')));
330 330
 	$pdf->ezStream();
331 331
 
332 332
 }
Please login to merge, or discard this patch.
main/gradebook/lib/fe/linkaddeditform.class.php 1 patch
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.
main/gradebook/lib/fe/flatviewtable.class.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
             $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
202 202
             $chartHash = $myCache->getHash($dataSet);
203 203
             if ($myCache->isInCache($chartHash)) {
204
-                $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
204
+                $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
205 205
                 $myCache->saveFromCache($chartHash, $imgPath);
206
-                $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
206
+                $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
207 207
             } else {
208 208
                 /* Create the pChart object */
209 209
                 $widthSize = 480;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 /* Set the default font */
231 231
                 $myPicture->setFontProperties(
232 232
                     array(
233
-                        'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
233
+                        'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
234 234
                         'FontSize' => 10
235 235
                     )
236 236
                 );
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
                 /* Render the picture (choose the best way) */
303 303
 
304 304
                 $myCache->writeToCache($chartHash, $myPicture);
305
-                $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
305
+                $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
306 306
                 $myCache->saveFromCache($chartHash, $imgPath);
307
-                $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
307
+                $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
308 308
             }
309
-            echo '<img src="' . $imgPath . '" >';
309
+            echo '<img src="'.$imgPath.'" >';
310 310
             if ($i % 2 == 0 && $i != 0) {
311 311
                 echo '<br /><br />';
312 312
             } else {
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
             // previous X
350 350
             $header .= '<td style="width:100%;">';
351 351
             if ($this->offset >= GRADEBOOK_ITEM_LIMIT) {
352
-                $header .= '<a href="' . api_get_self()
353
-                    . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
354
-                    . '&offset=' . (($this->offset) - GRADEBOOK_ITEM_LIMIT)
355
-                    . (isset($_GET['search']) ? '&search=' . Security::remove_XSS($_GET['search']) : '') . '">'
352
+                $header .= '<a href="'.api_get_self()
353
+                    . '?selectcat='.Security::remove_XSS($_GET['selectcat'])
354
+                    . '&offset='.(($this->offset) - GRADEBOOK_ITEM_LIMIT)
355
+                    . (isset($_GET['search']) ? '&search='.Security::remove_XSS($_GET['search']) : '').'">'
356 356
                     . Display::return_icon('action_prev.png', get_lang('PreviousPage'), array(), 32)
357 357
                     . '</a>';
358 358
             } else {
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
                 ($totalitems - (GRADEBOOK_ITEM_LIMIT + $this->offset)) : GRADEBOOK_ITEM_LIMIT;
365 365
 
366 366
             if ($calcnext > 0) {
367
-                $header .= '<a href="' . api_get_self()
368
-                    . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
369
-                    . '&offset=' . ($this->offset + GRADEBOOK_ITEM_LIMIT)
370
-                    . (isset($_GET['search']) ? '&search=' . Security::remove_XSS($_GET['search']) : '') . '">'
367
+                $header .= '<a href="'.api_get_self()
368
+                    . '?selectcat='.Security::remove_XSS($_GET['selectcat'])
369
+                    . '&offset='.($this->offset + GRADEBOOK_ITEM_LIMIT)
370
+                    . (isset($_GET['search']) ? '&search='.Security::remove_XSS($_GET['search']) : '').'">'
371 371
                     . Display::return_icon('action_next.png', get_lang('NextPage'), array(), 32)
372 372
                     . '</a>';
373 373
             } else {
@@ -475,6 +475,6 @@  discard block
 block discarded – undo
475 475
      */
476 476
     private function build_name_link($user_id, $name)
477 477
     {
478
-        return '<a href="user_stats.php?userid=' . $user_id . '&selectcat=' . $this->selectcat->get_id() . '&'.api_get_cidreq().'">' . $name . '</a>';
478
+        return '<a href="user_stats.php?userid='.$user_id.'&selectcat='.$this->selectcat->get_id().'&'.api_get_cidreq().'">'.$name.'</a>';
479 479
     }
480 480
 }
Please login to merge, or discard this patch.
main/gradebook/lib/fe/dataform.class.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -21,9 +21,9 @@  discard block
 block discarded – undo
21 21
 	 * @param method
22 22
 	 * @param action
23 23
 	 */
24
-	public function DataForm($form_type, $form_name, $method = 'post', $action = null, $target='', $locked_status)
24
+	public function DataForm($form_type, $form_name, $method = 'post', $action = null, $target = '', $locked_status)
25 25
 	{
26
-		parent :: __construct($form_name, $method, $action,$target);
26
+		parent :: __construct($form_name, $method, $action, $target);
27 27
 		$this->form_type = $form_type;
28 28
 		if ($this->form_type == self :: TYPE_IMPORT) {
29 29
 			$this->build_import_form();
@@ -41,13 +41,13 @@  discard block
 block discarded – undo
41 41
 
42 42
 	protected function build_pdf_export_form()
43 43
 	{
44
-		$renderer =& $this->defaultRenderer();
44
+		$renderer = & $this->defaultRenderer();
45 45
 		$renderer->setCustomElementTemplate('<span>{element}</span>');
46 46
 		$this->addElement('header', get_lang('ChooseOrientation'));
47 47
 		$this->addElement('radio', 'orientation', null, get_lang('Portrait'), 'portrait');
48 48
 		$this->addElement('radio', 'orientation', null, get_lang('Landscape'), 'landscape');
49 49
 		$this->addButtonExport(get_lang('Export'));
50
-		$this->setDefaults(array (
50
+		$this->setDefaults(array(
51 51
 			'orientation' => 'portrait'
52 52
 		));
53 53
 	}
@@ -59,19 +59,19 @@  discard block
 block discarded – undo
59 59
 		$this->addElement('radio', 'file_type', null, 'XML (Extensible Markup Language)', 'xml');
60 60
 		$this->addElement('radio', 'file_type', null, 'PDF (Portable Document Format)', 'pdf');
61 61
 		$this->addButtonExport(get_lang('Export'));
62
-		$this->setDefaults(array (
62
+		$this->setDefaults(array(
63 63
 			'file_type' => 'csv'
64 64
 		));
65 65
 	}
66 66
 
67
-	protected function build_export_form_option($show_pdf=true)
67
+	protected function build_export_form_option($show_pdf = true)
68 68
 	{
69 69
 		$this->addElement('header', get_lang('ChooseFormat'));
70 70
 		$this->addElement('radio', 'file_type', get_lang('OutputFileType'), 'CSV (Comma-Separated Values)', 'csv');
71 71
 		$this->addElement('radio', 'file_type', null, 'XML (Extensible Markup Language)', 'xml');
72
-		$this->addElement('radio', 'file_type', Display::return_icon('info3.gif',get_lang('ToExportMustLockEvaluation')), 'PDF (Portable Document Format)', 'pdf', array('disabled'));
72
+		$this->addElement('radio', 'file_type', Display::return_icon('info3.gif', get_lang('ToExportMustLockEvaluation')), 'PDF (Portable Document Format)', 'pdf', array('disabled'));
73 73
 		$this->addButtonExport(get_lang('Export'));
74
-		$this->setDefaults(array (
74
+		$this->setDefaults(array(
75 75
 			'file_type' => 'csv'
76 76
 		));
77 77
 	}
@@ -80,16 +80,16 @@  discard block
 block discarded – undo
80 80
 	{
81 81
 		$this->addElement('hidden', 'formSent');
82 82
 		$this->addElement('header', get_lang('ImportFileLocation'));
83
-		$this->addElement('file', 'import_file',get_lang('Location'));
84
-		$allowed_file_types = array (
83
+		$this->addElement('file', 'import_file', get_lang('Location'));
84
+		$allowed_file_types = array(
85 85
 			'xml',
86 86
 			'csv'
87 87
 		);
88 88
 		//$this->addRule('file', get_lang('InvalidExtension') . ' (' . implode(',', $allowed_file_types) . ')', 'filetype', $allowed_file_types);
89
-		$this->addElement('radio', 'file_type', get_lang('FileType'), 'CSV (<a href="docs/example_csv.html" target="_blank">' . get_lang('ExampleCSVFile') . '</a>)', 'csv');
90
-		$this->addElement('radio', 'file_type', null, 'XML (<a href="docs/example_xml.html" target="_blank">' . get_lang('ExampleXMLFile') . '</a>)', 'xml');
91
-		$this->addElement('checkbox','overwrite', null,get_lang('OverwriteScores'));
92
-		$this->addElement('checkbox','ignoreerrors',null,get_lang('IgnoreErrors'));
89
+		$this->addElement('radio', 'file_type', get_lang('FileType'), 'CSV (<a href="docs/example_csv.html" target="_blank">'.get_lang('ExampleCSVFile').'</a>)', 'csv');
90
+		$this->addElement('radio', 'file_type', null, 'XML (<a href="docs/example_xml.html" target="_blank">'.get_lang('ExampleXMLFile').'</a>)', 'xml');
91
+		$this->addElement('checkbox', 'overwrite', null, get_lang('OverwriteScores'));
92
+		$this->addElement('checkbox', 'ignoreerrors', null, get_lang('IgnoreErrors'));
93 93
 		$this->addButtonImport(get_lang('Ok'));
94 94
 		$this->setDefaults(array(
95 95
 			'formSent' => '1',
Please login to merge, or discard this patch.
main/gradebook/lib/fe/usertable.class.php 1 patch
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.
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/fe/scoredisplayform.class.php 1 patch
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -14,28 +14,28 @@  discard block
 block discarded – undo
14 14
 	 * @param $form_name
15 15
 	 * @param null $action
16 16
 	 */
17
-	public function ScoreDisplayForm($form_name, $action= null)
17
+	public function ScoreDisplayForm($form_name, $action = null)
18 18
 	{
19 19
 		parent :: __construct($form_name, 'post', $action);
20 20
 		$displayscore = ScoreDisplay :: instance();
21 21
 		$customdisplays = $displayscore->get_custom_score_display_settings();
22 22
 
23
-		$nr_items = (count($customdisplays)!='0') ? count($customdisplays) : '1';
24
-		$this->setDefaults(array (
23
+		$nr_items = (count($customdisplays) != '0') ? count($customdisplays) : '1';
24
+		$this->setDefaults(array(
25 25
             'scorecolpercent' => $displayscore->get_color_split_value()
26 26
 		));
27 27
 
28 28
 		$this->addElement('hidden', 'maxvalue', '100');
29 29
 		$this->addElement('hidden', 'minvalue', '0');
30
-		$counter= 1;
30
+		$counter = 1;
31 31
 
32 32
 		//setting the default values
33 33
 
34
-		if(is_array($customdisplays)) {
34
+		if (is_array($customdisplays)) {
35 35
 			foreach ($customdisplays as $customdisplay) {
36
-				$this->setDefaults(array (
37
-					'endscore[' . $counter . ']' => $customdisplay['score'],
38
-					'displaytext[' . $counter . ']' => $customdisplay['display']
36
+				$this->setDefaults(array(
37
+					'endscore['.$counter.']' => $customdisplay['score'],
38
+					'displaytext['.$counter.']' => $customdisplay['display']
39 39
 				));
40 40
 				$counter++;
41 41
 			}
@@ -46,7 +46,7 @@  discard block
 block discarded – undo
46 46
 		$this->addElement('header', get_lang('ScoreEdit'));
47 47
 
48 48
         if ($displayscore->is_coloring_enabled()) {
49
-            $this->addElement('html', '<b>' . get_lang('ScoreColor') . '</b>');
49
+            $this->addElement('html', '<b>'.get_lang('ScoreColor').'</b>');
50 50
             $this->addElement('text', 'scorecolpercent', array(get_lang('Below'), get_lang('WillColorRed'), '%'), array(
51 51
                 'size' => 5,
52 52
                 'maxlength' => 5,
@@ -58,14 +58,14 @@  discard block
 block discarded – undo
58 58
             }
59 59
 
60 60
             $this->addRule('scorecolpercent', get_lang('OnlyNumbers'), 'numeric');
61
-            $this->addRule(array('scorecolpercent','maxvalue'), get_lang('Over100'), 'compare', '<=');
62
-            $this->addRule(array('scorecolpercent','minvalue'), get_lang('UnderMin'), 'compare', '>');
61
+            $this->addRule(array('scorecolpercent', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
62
+            $this->addRule(array('scorecolpercent', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
63 63
         }
64 64
 
65 65
 		//Settings for the scoring system
66 66
 
67 67
 		if ($displayscore->is_custom()) {
68
-            $this->addElement('html', '<br /><b>' . get_lang('ScoringSystem') . '</b>');
68
+            $this->addElement('html', '<br /><b>'.get_lang('ScoringSystem').'</b>');
69 69
 			$this->addElement('static', null, null, get_lang('ScoreInfo'));
70 70
 			$this->setDefaults(array(
71 71
 				'beginscore' => '0'
@@ -77,10 +77,10 @@  discard block
 block discarded – undo
77 77
 				'input-size' => 2
78 78
 			));
79 79
 
80
-			for ($counter= 1; $counter <= 20; $counter++) {
81
-				$renderer =& $this->defaultRenderer();
80
+			for ($counter = 1; $counter <= 20; $counter++) {
81
+				$renderer = & $this->defaultRenderer();
82 82
 				$elementTemplateTwoLabel =
83
-				'<div id=' . $counter . ' style="display: '.(($counter<=$nr_items)?'inline':'none').';">
83
+				'<div id='.$counter.' style="display: '.(($counter <= $nr_items) ? 'inline' : 'none').';">
84 84
 
85 85
 				<!-- BEGIN required --><span class="form_required">*</span> <!-- END required -->
86 86
 
@@ -105,37 +105,37 @@  discard block
 block discarded – undo
105 105
 
106 106
 				';
107 107
 
108
-				$elementTemplateTwoLabel2 ='
108
+				$elementTemplateTwoLabel2 = '
109 109
 				<div class="col-sm-2">
110 110
 					<!-- BEGIN error --><span class="form_error">{error}</span>
111 111
 					<!-- END error -->
112 112
 					{element}
113 113
 				</div>
114 114
 				<div class="col-sm-1">
115
-                    <a href="javascript:plusItem(' . ($counter+1) . ')"><img style="display: '.(($counter>=$nr_items)?'inline':'none').';" id="plus-' . ($counter+1) . '" src="../img/icons/22/add.png" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></img></a>
116
-        			<a href="javascript:minItem(' . ($counter) . ')"><img style="display: '.(($counter>=$nr_items && $counter!=1)?'inline':'none').';" id="min-' . $counter . '" src="../img/delete.png" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></img></a>
115
+                    <a href="javascript:plusItem(' . ($counter + 1).')"><img style="display: '.(($counter >= $nr_items) ? 'inline' : 'none').';" id="plus-'.($counter + 1).'" src="../img/icons/22/add.png" alt="'.get_lang('Add').'" title="'.get_lang('Add').'"></img></a>
116
+        			<a href="javascript:minItem(' . ($counter).')"><img style="display: '.(($counter >= $nr_items && $counter != 1) ? 'inline' : 'none').';" id="min-'.$counter.'" src="../img/delete.png" alt="'.get_lang('Delete').'" title="'.get_lang('Delete').'"></img></a>
117 117
 				</div>
118 118
 				</div>
119 119
 				</div>';
120 120
 
121 121
 				$scorebetw = array();
122
-				$this->addElement('text', 'endscore[' . $counter . ']', null, array (
122
+				$this->addElement('text', 'endscore['.$counter.']', null, array(
123 123
 					'size' => 5,
124 124
 					'maxlength' => 5,
125 125
 					'id' => 'txta-'.$counter,
126 126
 					'input-size' => 2
127 127
 				));
128 128
 
129
-				$this->addElement('text', 'displaytext[' . $counter . ']', null,array (
129
+				$this->addElement('text', 'displaytext['.$counter.']', null, array(
130 130
 					'size' => 40,
131 131
 					'maxlength' => 40,
132 132
 					'id' => 'txtb-'.$counter
133 133
 				));
134
-				$renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore[' . $counter . ']');
135
-				$renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext[' . $counter . ']');
136
-				$this->addRule('endscore[' . $counter . ']', get_lang('OnlyNumbers'), 'numeric');
137
-				$this->addRule(array ('endscore[' . $counter . ']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
138
-				$this->addRule(array ('endscore[' . $counter . ']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
134
+				$renderer->setElementTemplate($elementTemplateTwoLabel, 'endscore['.$counter.']');
135
+				$renderer->setElementTemplate($elementTemplateTwoLabel2, 'displaytext['.$counter.']');
136
+				$this->addRule('endscore['.$counter.']', get_lang('OnlyNumbers'), 'numeric');
137
+				$this->addRule(array('endscore['.$counter.']', 'maxvalue'), get_lang('Over100'), 'compare', '<=');
138
+				$this->addRule(array('endscore['.$counter.']', 'minvalue'), get_lang('UnderMin'), 'compare', '>');
139 139
 			}
140 140
 		}
141 141
 
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.