Completed
Push — 1.10.x ( c82817...6a93c3 )
by Yannick
202:42 queued 149:59
created
main/gradebook/lib/be/studentpublicationlink.class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -84,9 +84,9 @@  discard block
 block discarded – undo
84 84
 
85 85
 		$result = Database::query($sql);
86 86
 
87
-		$cats=array();
88
-		while ($data=Database::fetch_array($result)) {
89
-			$cats[] = array ($data['id'], $data['url']);
87
+		$cats = array();
88
+		while ($data = Database::fetch_array($result)) {
89
+			$cats[] = array($data['id'], $data['url']);
90 90
 		}
91 91
 		return $cats;
92 92
 	}
@@ -127,9 +127,9 @@  discard block
 block discarded – undo
127 127
 			if (empty($work_name)) {
128 128
 				$work_name = basename($data['url']);
129 129
 			}
130
-			$cats[] = array ($data['id'], $work_name);
130
+			$cats[] = array($data['id'], $work_name);
131 131
 		}
132
-		$cats=isset($cats) ? $cats : array();
132
+		$cats = isset($cats) ? $cats : array();
133 133
 		return $cats;
134 134
 	}
135 135
 
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
     				c_id = '.$this->course_id.' AND
179 179
     				active = 1 AND
180 180
     				parent_id = "'.$parentId.'" AND
181
-    				session_id = '.api_get_session_id() .' AND
181
+    				session_id = '.api_get_session_id().' AND
182 182
     				qualificator_id <> 0
183 183
 				';
184 184
 		if (!empty($stud_id)) {
@@ -212,7 +212,7 @@  discard block
 block discarded – undo
212 212
 				return '';
213 213
 			}
214 214
 		} else {
215
-			$students = array();  // user list, needed to make sure we only
215
+			$students = array(); // user list, needed to make sure we only
216 216
 			// take first attempts into account
217 217
 			$rescount = 0;
218 218
 			$sum = 0;
@@ -245,7 +245,7 @@  discard block
 block discarded – undo
245 245
 						return array($bestResult, $weight);
246 246
 						break;
247 247
 					case 'average':
248
-						return array($sumResult/$rescount, $weight);
248
+						return array($sumResult / $rescount, $weight);
249 249
 						break;
250 250
 					case 'ranking':
251 251
 						return AbstractLink::getCurrentUserRanking($stud_id, $students);
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	{
308 308
 		$tbl_name = $this->get_studpub_table();
309 309
 		$course_info = api_get_course_info($this->get_course_code());
310
-		if ($tbl_name=='') {
310
+		if ($tbl_name == '') {
311 311
 			return false;
312 312
 		} elseif (!isset($this->exercise_data)) {
313 313
 			$sql = 'SELECT * FROM '.$this->get_studpub_table()."
@@ -346,7 +346,7 @@  discard block
 block discarded – undo
346 346
 
347 347
 	public function save_linked_data()
348 348
 	{
349
-		$weight = (float)$this->get_weight();
349
+		$weight = (float) $this->get_weight();
350 350
 		$ref_id = $this->get_ref_id();
351 351
 
352 352
 		if (!empty($ref_id)) {
Please login to merge, or discard this patch.
main/gradebook/lib/be/evaluation.class.php 1 patch
Spacing   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -223,36 +223,36 @@  discard block
 block discarded – undo
223 223
 		$paramcount = 0;
224 224
 
225 225
 		if (isset ($id)) {
226
-			$sql.= ' WHERE id = '.intval($id);
227
-			$paramcount ++;
226
+			$sql .= ' WHERE id = '.intval($id);
227
+			$paramcount++;
228 228
 		}
229 229
 
230 230
 		if (isset ($user_id)) {
231 231
 			if ($paramcount != 0) $sql .= ' AND';
232 232
 			else $sql .= ' WHERE';
233 233
 			$sql .= ' user_id = '.intval($user_id);
234
-			$paramcount ++;
234
+			$paramcount++;
235 235
 		}
236 236
 
237 237
 		if (isset ($course_code) && $course_code <> '-1') {
238 238
 			if ($paramcount != 0) $sql .= ' AND';
239 239
 			else $sql .= ' WHERE';
240 240
 			$sql .= " course_code = '".Database::escape_string($course_code)."'";
241
-			$paramcount ++;
241
+			$paramcount++;
242 242
 		}
243 243
 
244 244
 		if (isset ($category_id)) {
245 245
 			if ($paramcount != 0) $sql .= ' AND';
246 246
 			else $sql .= ' WHERE';
247 247
 			$sql .= ' category_id = '.intval($category_id);
248
-			$paramcount ++;
248
+			$paramcount++;
249 249
 		}
250 250
 
251 251
 		if (isset ($visible)) {
252 252
 			if ($paramcount != 0) $sql .= ' AND';
253 253
 			else $sql .= ' WHERE';
254 254
 			$sql .= ' visible = '.intval($visible);
255
-			$paramcount ++;
255
+			$paramcount++;
256 256
 		}
257 257
 
258 258
 		if (isset ($locked)) {
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 		$alleval = array();
279 279
 		if (Database::num_rows($result)) {
280 280
 			while ($data = Database::fetch_array($result)) {
281
-				$eval= new Evaluation();
281
+				$eval = new Evaluation();
282 282
 				$eval->set_id($data['id']);
283 283
 				$eval->set_name($data['name']);
284 284
 				$eval->set_description($data['description']);
@@ -363,7 +363,7 @@  discard block
 block discarded – undo
363 363
 			$tbl_grade_evaluations = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_EVALUATION);
364 364
 			$tbl_grade_linkeval_log = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINKEVAL_LOG);
365 365
 			$eval = new Evaluation();
366
-			$dateobject = $eval->load($idevaluation,null,null,null,null);
366
+			$dateobject = $eval->load($idevaluation, null, null, null, null);
367 367
 			$arreval = get_object_vars($dateobject[0]);
368 368
 			if (!empty($arreval['id'])) {
369 369
 				$sql = 'SELECT weight from '.$tbl_grade_evaluations.'
@@ -397,7 +397,7 @@  discard block
 block discarded – undo
397 397
 			.', description = ';
398 398
 		if (isset($this->description)) {
399 399
 			$sql .= "'".Database::escape_string($this->get_description())."'";
400
-		}else {
400
+		} else {
401 401
 			$sql .= 'null';
402 402
 		}
403 403
 		$sql .= ', user_id = '.intval($this->get_user_id())
@@ -468,17 +468,17 @@  discard block
 block discarded – undo
468 468
 				$sql .= ' AND user_id = '.api_get_user_id();
469 469
 			}
470 470
 
471
-		}else {
471
+		} else {
472 472
 			$sql .= ' AND user_id = '.api_get_user_id();
473 473
 		}
474 474
 
475 475
 		if (!isset ($parent)) {
476
-			$sql.= ' AND category_id is null';
476
+			$sql .= ' AND category_id is null';
477 477
 		} else {
478
-			$sql.= ' AND category_id = '.intval($parent);
478
+			$sql .= ' AND category_id = '.intval($parent);
479 479
 		}
480 480
 		$result = Database::query($sql);
481
-		$number=Database::fetch_row($result);
481
+		$number = Database::fetch_row($result);
482 482
 
483 483
 		return $number[0] != 0;
484 484
 	}
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
 				FROM '.$tbl_grade_results.'
495 495
 				WHERE evaluation_id = '.intval($this->id);
496 496
 		$result = Database::query($sql);
497
-		$number=Database::fetch_row($result);
497
+		$number = Database::fetch_row($result);
498 498
 
499 499
 		return ($number[0] != 0);
500 500
 	}
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
             $results = isset($data[$key]) ? $data[$key] : null;
545 545
 
546 546
             if ($useSession == false) {
547
-                $results  = null;
547
+                $results = null;
548 548
             }
549 549
 			if (empty($results)) {
550 550
 				$results = Result::load(null, $stud_id, $this->id);
@@ -570,7 +570,7 @@  discard block
 block discarded – undo
570 570
             $data = Session::read('calc_score');
571 571
             $allResults = isset($data[$key]) ? $data[$key] : null;
572 572
             if ($useSession == false) {
573
-                $allResults  = null;
573
+                $allResults = null;
574 574
             }
575 575
 			if (empty($allResults)) {
576 576
 				$allResults = Result::load(null, null, $this->id);
@@ -602,7 +602,7 @@  discard block
 block discarded – undo
602 602
 					return array($bestResult, $weight);
603 603
 					break;
604 604
 				case 'average':
605
-					return array($sumResult/$count, $weight);
605
+					return array($sumResult / $count, $weight);
606 606
 					break;
607 607
 				case 'ranking':
608 608
                     $students = array();
@@ -640,17 +640,17 @@  discard block
 block discarded – undo
640 640
 		$targets[] = $root;
641 641
 
642 642
 		if (isset($this->course_code) && !empty($this->course_code)) {
643
-			$crscats = Category::load(null,null,$this->course_code,0);
643
+			$crscats = Category::load(null, null, $this->course_code, 0);
644 644
 			foreach ($crscats as $cat) {
645
-				$targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
646
-				$targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
645
+				$targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
646
+				$targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
647 647
 			}
648 648
 		}
649 649
 
650
-		$indcats = Category::load(null,$user,0,0);
650
+		$indcats = Category::load(null, $user, 0, 0);
651 651
 		foreach ($indcats as $cat) {
652
-			$targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
653
-			$targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
652
+			$targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
653
+			$targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
654 654
 		}
655 655
 
656 656
 		return $targets;
@@ -661,10 +661,10 @@  discard block
 block discarded – undo
661 661
 	 */
662 662
 	private function add_target_subcategories($targets, $level, $catid)
663 663
 	{
664
-		$subcats = Category::load(null,null,null,$catid);
664
+		$subcats = Category::load(null, null, null, $catid);
665 665
 		foreach ($subcats as $cat) {
666
-			$targets[] = array ($cat->get_id(), $cat->get_name(), $level+1);
667
-			$targets = $this->add_target_subcategories($targets, $level+1, $cat->get_id());
666
+			$targets[] = array($cat->get_id(), $cat->get_name(), $level + 1);
667
+			$targets = $this->add_target_subcategories($targets, $level + 1, $cat->get_id());
668 668
 		}
669 669
 		return $targets;
670 670
 	}
@@ -743,7 +743,7 @@  discard block
 block discarded – undo
743 743
 	 * @return array evaluation objects matching the search criterium
744 744
 	 * @todo can be written more efficiently using a new (but very complex) sql query
745 745
 	 */
746
-	public function find_evaluations($name_mask,$selectcat)
746
+	public function find_evaluations($name_mask, $selectcat)
747 747
 	{
748 748
 		$rootcat = Category::load($selectcat);
749 749
 		$evals = $rootcat[0]->get_evaluations((api_is_allowed_to_create_course() ? null : api_get_user_id()), true);
Please login to merge, or discard this patch.
main/gradebook/lib/results_data_generator.class.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
     /**
39 39
      * Get total number of results (rows)
40 40
      */
41
-    public function get_total_results_count ()
41
+    public function get_total_results_count()
42 42
     {
43 43
         return count($this->results);
44 44
     }
@@ -53,12 +53,12 @@  discard block
 block discarded – undo
53 53
      * 4 ['score']     : student's score
54 54
      * 5 ['display']   : custom score display (only if custom scoring enabled)
55 55
      */
56
-    public function get_data ($sorting = 0, $start = 0, $count = null, $ignore_score_color = false, $pdf=false)
56
+    public function get_data($sorting = 0, $start = 0, $count = null, $ignore_score_color = false, $pdf = false)
57 57
     {
58 58
         // do some checks on count, redefine if invalid value
59 59
         $number_decimals = api_get_setting('gradebook_number_decimals');
60 60
         if (!isset($count)) {
61
-            $count = count ($this->results) - $start;
61
+            $count = count($this->results) - $start;
62 62
         }
63 63
         if ($count < 0) {
64 64
             $count = 0;
@@ -66,11 +66,11 @@  discard block
 block discarded – undo
66 66
         $scoredisplay = ScoreDisplay :: instance();
67 67
         // generate actual data array
68 68
         $table = array();
69
-        foreach($this->results as $result) {
69
+        foreach ($this->results as $result) {
70 70
             $user = array();
71 71
             $info = api_get_user_info($result->get_user_id());
72 72
             $user['id'] = $result->get_user_id();
73
-            if ($pdf){
73
+            if ($pdf) {
74 74
                 $user['username'] = $info['username'];
75 75
             }
76 76
             $user['result_id'] = $result->get_id();
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
                 true
93 93
             )
94 94
             );
95
-            if ($pdf && $number_decimals == null){
95
+            if ($pdf && $number_decimals == null) {
96 96
                 $user['scoreletter'] = $result->get_score();
97 97
             }
98 98
             if ($scoredisplay->is_custom()) {
@@ -132,13 +132,13 @@  discard block
 block discarded – undo
132 132
      * @param bool  Whether we want to ignore the score color
133 133
      * @result string The score as we want to show it
134 134
      */
135
-    private function get_score_display ($score, $realscore, $ignore_score_color = false)
135
+    private function get_score_display($score, $realscore, $ignore_score_color = false)
136 136
     {
137 137
         if ($score != null) {
138 138
             $scoredisplay = ScoreDisplay :: instance();
139 139
             $type = SCORE_CUSTOM;
140 140
             if ($realscore === true) {
141
-                $type = SCORE_DIV_PERCENT ;
141
+                $type = SCORE_DIV_PERCENT;
142 142
             }
143 143
 
144 144
             return $scoredisplay->display_score(
@@ -172,10 +172,10 @@  discard block
 block discarded – undo
172 172
         }
173 173
     }
174 174
 
175
-    function sort_by_mask ($item1, $item2)
175
+    function sort_by_mask($item1, $item2)
176 176
     {
177
-        $score1 = (isset($item1['score']) ? array($item1['score'],$this->evaluation->get_max()) : null);
178
-        $score2 = (isset($item2['score']) ? array($item2['score'],$this->evaluation->get_max()) : null);
177
+        $score1 = (isset($item1['score']) ? array($item1['score'], $this->evaluation->get_max()) : null);
178
+        $score2 = (isset($item2['score']) ? array($item2['score'], $this->evaluation->get_max()) : null);
179 179
         return ScoreDisplay :: compare_scores_by_custom_display($score1, $score2);
180 180
     }
181 181
 }
Please login to merge, or discard this patch.
main/gradebook/lib/flatview_data_generator.class.php 1 patch
Spacing   +44 added lines, -44 removed lines patch added patch discarded remove patch
@@ -114,10 +114,10 @@  discard block
 block discarded – undo
114 114
             isset($this->params['only_subcat']) &&
115 115
             $this->params['only_subcat'] == $this->category->get_id()
116 116
         ) {
117
-            $main_weight  = $this->category->get_weight();
117
+            $main_weight = $this->category->get_weight();
118 118
             $grade_model_id = $this->category->get_grade_model_id();
119 119
         } else {
120
-            $main_cat  = Category::load($parent_id, null, null);
120
+            $main_cat = Category::load($parent_id, null, null);
121 121
             $main_weight = $main_cat[0]->get_weight();
122 122
             $grade_model_id = $main_cat[0]->get_grade_model_id();
123 123
         }
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
                     $list = [];
200 200
                     $list['items'] = $finalList;
201 201
                     $list['header'] = '<center>'.$mainHeader.'</center>';
202
-                    $headers[]= $list;
202
+                    $headers[] = $list;
203 203
                 } else {
204 204
                     $headers[] = '<center>'.$mainHeader.'</center>';
205 205
                 }
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
209 209
                 (isset($this->params['only_total_category']) &&
210 210
                     $this->params['only_total_category'] == false)
211 211
             ) {
212
-                for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) {
212
+                for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) {
213 213
                     /** @var AbstractLink $item */
214 214
                     $item = $this->evals_links[$count + $items_start];
215 215
                     $weight = round(100 * $item->get_weight() / $main_weight, 1);
@@ -227,7 +227,7 @@  discard block
 block discarded – undo
227 227
                     !in_array($item->get_id(), $evaluationsAdded)
228 228
                 ) {
229 229
                     $weight = round(100 * $item->get_weight() / $main_weight, 1);
230
-                    $headers[] = $item->get_name() . ' ' . $weight . ' % ';
230
+                    $headers[] = $item->get_name().' '.$weight.' % ';
231 231
                 }
232 232
             }
233 233
         }
@@ -266,7 +266,7 @@  discard block
 block discarded – undo
266 266
         if (!isset($items_count)) {
267 267
             $items_count = count($this->evals_links) - $items_start;
268 268
         }
269
-        for ($count=0; ($count < $items_count ) && ($items_start + $count < count($this->evals_links)); $count++) {
269
+        for ($count = 0; ($count < $items_count) && ($items_start + $count < count($this->evals_links)); $count++) {
270 270
             $item = $this->evals_links [$count + $items_start];
271 271
             $headers[] = $item->get_name();
272 272
         }
@@ -293,13 +293,13 @@  discard block
 block discarded – undo
293 293
     ) {
294 294
         // Do some checks on users/items counts, redefine if invalid values
295 295
         if (!isset($users_count)) {
296
-            $users_count = count ($this->users) - $users_start;
296
+            $users_count = count($this->users) - $users_start;
297 297
         }
298 298
         if ($users_count < 0) {
299 299
             $users_count = 0;
300 300
         }
301 301
         if (!isset($items_count)) {
302
-            $items_count = count ($this->evals) + count ($this->links) - $items_start;
302
+            $items_count = count($this->evals) + count($this->links) - $items_start;
303 303
         }
304 304
         if ($items_count < 0) {
305 305
             $items_count = 0;
@@ -312,10 +312,10 @@  discard block
 block discarded – undo
312 312
 
313 313
         // sort users array
314 314
         if ($users_sorting & self :: FVDG_SORT_LASTNAME) {
315
-            usort($userTable, array('FlatViewDataGenerator','sort_by_last_name'));
315
+            usort($userTable, array('FlatViewDataGenerator', 'sort_by_last_name'));
316 316
 
317 317
         } elseif ($users_sorting & self :: FVDG_SORT_FIRSTNAME) {
318
-            usort($userTable, array('FlatViewDataGenerator','sort_by_first_name'));
318
+            usort($userTable, array('FlatViewDataGenerator', 'sort_by_first_name'));
319 319
         }
320 320
 
321 321
         if ($users_sorting & self :: FVDG_SORT_DESC) {
@@ -356,10 +356,10 @@  discard block
 block discarded – undo
356 356
         $parent_id = $this->category->get_parent_id();
357 357
 
358 358
         if ($parent_id == 0 or $this->params['only_subcat'] == $this->category->get_id()) {
359
-            $main_weight  = $this->category->get_weight();
359
+            $main_weight = $this->category->get_weight();
360 360
             $grade_model_id = $this->category->get_grade_model_id();
361 361
         } else {
362
-            $main_cat  = Category::load($parent_id, null, null);
362
+            $main_cat = Category::load($parent_id, null, null);
363 363
             $main_weight = $main_cat[0]->get_weight();
364 364
             $grade_model_id = $main_cat[0]->get_grade_model_id();
365 365
         }
@@ -471,11 +471,11 @@  discard block
 block discarded – undo
471 471
                     $divide = $score[1] == 0 ? 1 : $score[1];
472 472
 
473 473
                     $sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
474
-                    $item_value  = $score[0]/$divide*$main_weight;
474
+                    $item_value = $score[0] / $divide * $main_weight;
475 475
 
476 476
                     // Fixing total when using one or multiple gradebooks
477
-                    $percentage = $sub_cat->get_weight()/($sub_cat_percentage) * $sub_cat_percentage/$this->category->get_weight();
478
-                    $item_value = $percentage*$item_value;
477
+                    $percentage = $sub_cat->get_weight() / ($sub_cat_percentage) * $sub_cat_percentage / $this->category->get_weight();
478
+                    $item_value = $percentage * $item_value;
479 479
                     $item_total += $sub_cat->get_weight();
480 480
                     /*
481 481
                         if ($convert_using_the_global_weight) {
@@ -521,7 +521,7 @@  discard block
 block discarded – undo
521 521
                 if ($convert_using_the_global_weight) {
522 522
                     //$item_total = $main_weight;
523 523
                 }
524
-            } else  {
524
+            } else {
525 525
                 // All evaluations
526 526
                 $result = $this->parseEvaluations(
527 527
                     $user_id,
@@ -628,7 +628,7 @@  discard block
 block discarded – undo
628 628
             // Sub cat weight
629 629
             //$sub_cat_percentage = $sum_categories_weight_array[$item->get_category_id()];
630 630
 
631
-            $item_value = isset($score[0]) ? $score[0]/$divide : 0;
631
+            $item_value = isset($score[0]) ? $score[0] / $divide : 0;
632 632
 
633 633
             // Fixing total when using one or multiple gradebooks.
634 634
             if (empty($parentCategoryIdFilter)) {
@@ -710,11 +710,11 @@  discard block
 block discarded – undo
710 710
         $data = array();
711 711
 
712 712
         foreach ($selected_users as $user) {
713
-            $row = array ();
714
-            for ($count=0;$count < count($this->evals_links); $count++) {
713
+            $row = array();
714
+            for ($count = 0; $count < count($this->evals_links); $count++) {
715 715
                 $item = $this->evals_links [$count];
716 716
                 $score = $item->calc_score($user[0]);
717
-                $porcent_score = isset($score[1]) &&  $score[1] > 0 ? ($score[0]*100)/$score[1] :0;
717
+                $porcent_score = isset($score[1]) && $score[1] > 0 ? ($score[0] * 100) / $score[1] : 0;
718 718
                 $row[$item->get_name()] = $porcent_score;
719 719
             }
720 720
             $data[$user[0]] = $row;
@@ -726,7 +726,7 @@  discard block
 block discarded – undo
726 726
             $tmp = array();
727 727
             foreach ($items as $item => $value) {
728 728
                 $tmp[] = $item;
729
-                if (in_array($item,$tmp)) {
729
+                if (in_array($item, $tmp)) {
730 730
                     $data_by_item[$item][$uid] = $value;
731 731
                 }
732 732
             }
@@ -737,7 +737,7 @@  discard block
 block discarded – undo
737 737
         */
738 738
         $result = array();
739 739
         foreach ($data_by_item as $k => $v) {
740
-            $average = round(array_sum($v)/count($v));
740
+            $average = round(array_sum($v) / count($v));
741 741
             arsort($v);
742 742
             $maximum = array_shift($v);
743 743
             $minimum = array_pop($v);
@@ -746,7 +746,7 @@  discard block
 block discarded – undo
746 746
                 $minimum = 0;
747 747
             }
748 748
 
749
-            $summary= array(
749
+            $summary = array(
750 750
                 'max' => $maximum,
751 751
                 'min' => $minimum,
752 752
                 'avg' => $average
@@ -763,32 +763,32 @@  discard block
 block discarded – undo
763 763
     public function get_data_to_graph()
764 764
     {
765 765
         // do some checks on users/items counts, redefine if invalid values
766
-        $usertable = array ();
766
+        $usertable = array();
767 767
         foreach ($this->users as $user) {
768 768
             $usertable[] = $user;
769 769
         }
770 770
         // sort users array
771
-        usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name'));
771
+        usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name'));
772 772
 
773
-        $data = array ();
773
+        $data = array();
774 774
 
775 775
         $selected_users = $usertable;
776 776
         foreach ($selected_users as $user) {
777
-            $row = array ();
778
-            $row[] = $user[0];    // user id
777
+            $row = array();
778
+            $row[] = $user[0]; // user id
779 779
             $item_value = 0;
780 780
             $item_total = 0;
781 781
 
782
-            for ($count=0;$count < count($this->evals_links); $count++) {
782
+            for ($count = 0; $count < count($this->evals_links); $count++) {
783 783
                 $item = $this->evals_links[$count];
784 784
                 $score = $item->calc_score($user[0]);
785 785
 
786
-                $divide =( ($score[1])==0 ) ? 1 : $score[1];
787
-                $item_value += $score[0]/$divide*$item->get_weight();
786
+                $divide = (($score[1]) == 0) ? 1 : $score[1];
787
+                $item_value += $score[0] / $divide * $item->get_weight();
788 788
                 $item_total += $item->get_weight();
789 789
 
790 790
 
791
-                $score_denom = ($score[1]==0) ? 1 : $score[1];
791
+                $score_denom = ($score[1] == 0) ? 1 : $score[1];
792 792
                 $score_final = ($score[0] / $score_denom) * 100;
793 793
                 $row[] = $score_final;
794 794
             }
@@ -814,15 +814,15 @@  discard block
 block discarded – undo
814 814
             $usertable[] = $user;
815 815
         }
816 816
         // sort users array
817
-        usort($usertable, array ('FlatViewDataGenerator','sort_by_first_name'));
817
+        usort($usertable, array('FlatViewDataGenerator', 'sort_by_first_name'));
818 818
 
819 819
         // generate actual data array
820 820
         $scoredisplay = ScoreDisplay :: instance();
821 821
         $data = array();
822 822
         $selected_users = $usertable;
823 823
         foreach ($selected_users as $user) {
824
-            $row = array ();
825
-            $row[] = $user[0];    // user id
824
+            $row = array();
825
+            $row[] = $user[0]; // user id
826 826
             $item_value = 0;
827 827
             $item_total = 0;
828 828
             $final_score = 0;
@@ -843,8 +843,8 @@  discard block
 block discarded – undo
843 843
                     $divide = $score[1] == 0 ? 1 : $score[1];
844 844
 
845 845
                     //$sub_cat_percentage = $sum_categories_weight_array[$sub_cat->get_id()];
846
-                    $item_value     = $score[0]/$divide*$main_weight;
847
-                    $item_total        += $sub_cat->get_weight();
846
+                    $item_value = $score[0] / $divide * $main_weight;
847
+                    $item_total += $sub_cat->get_weight();
848 848
 
849 849
                     $row[] = array(
850 850
                         $item_value,
@@ -861,23 +861,23 @@  discard block
 block discarded – undo
861 861
                     trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true))
862 862
                 );
863 863
             } else {
864
-                for ($count=0;$count < count($this->evals_links); $count++) {
864
+                for ($count = 0; $count < count($this->evals_links); $count++) {
865 865
                     $item = $this->evals_links [$count];
866 866
                     $score = $item->calc_score($user[0]);
867 867
                     $divide = ($score[1]) == 0 ? 1 : $score[1];
868 868
                     $item_value += $score[0] / $divide * $item->get_weight();
869
-                    $item_total+=$item->get_weight();
870
-                    $score_denom=($score[1]==0) ? 1 : $score[1];
869
+                    $item_total += $item->get_weight();
870
+                    $score_denom = ($score[1] == 0) ? 1 : $score[1];
871 871
                     $score_final = ($score[0] / $score_denom) * 100;
872
-                    $row[] = array ($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM,null, true)));
872
+                    $row[] = array($score_final, trim($scoredisplay->display_score($score, SCORE_CUSTOM, null, true)));
873 873
 
874 874
                 }
875
-                $total_score=array($item_value,$item_total);
875
+                $total_score = array($item_value, $item_total);
876 876
                 $score_final = ($item_value / $item_total) * 100;
877 877
                 if ($displayWarning) {
878
-                    Display::display_warning_message( Display::display_warning_message($total_score[1]));
878
+                    Display::display_warning_message(Display::display_warning_message($total_score[1]));
879 879
                 }
880
-                $row[] =array ($score_final, trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true)));
880
+                $row[] = array($score_final, trim($scoredisplay->display_score($total_score, SCORE_CUSTOM, null, true)));
881 881
             }
882 882
 
883 883
             $data[] = $row;
Please login to merge, or discard this patch.
main/admin/class_edit.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -19,8 +19,8 @@  discard block
 block discarded – undo
19 19
 api_protect_admin_script();
20 20
 
21 21
 // Setting breadcrumbs.
22
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
23
-$interbreadcrumb[] = array ('url' => 'class_list.php', 'name' => get_lang('AdminClasses'));
22
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
23
+$interbreadcrumb[] = array('url' => 'class_list.php', 'name' => get_lang('AdminClasses'));
24 24
 
25 25
 
26 26
 // Setting the name of the tool.
@@ -30,10 +30,10 @@  discard block
 block discarded – undo
30 30
 $class_id = intval($_GET['idclass']);
31 31
 $class = ClassManager :: get_class_info($class_id);
32 32
 $form = new FormValidator('edit_class', 'post', 'class_edit.php?idclass='.$class_id);
33
-$form->addText('name',get_lang('ClassName'));
33
+$form->addText('name', get_lang('ClassName'));
34 34
 $form->addButtonUpdate(get_lang('Ok'));
35 35
 $form->setDefaults(array('name'=>$class['name']));
36
-if($form->validate())
36
+if ($form->validate())
37 37
 {
38 38
     $values = $form->exportValues();
39 39
     ClassManager :: set_name($values['name'], $class_id);
Please login to merge, or discard this patch.
main/admin/grade_models.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 $htmlHeadXtra[] = api_get_jqgrid_js();
21 21
 
22 22
 // setting breadcrumbs
23
-$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
23
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
24 24
 
25 25
 $action = isset($_GET['action']) ? $_GET['action'] : null;
26 26
 
@@ -28,16 +28,16 @@  discard block
 block discarded – undo
28 28
 $token = Security::get_token();
29 29
 
30 30
 if ($action == 'add') {
31
-    $interbreadcrumb[]=array('url' => 'grade_models.php','name' => get_lang('GradeModel'));
32
-    $interbreadcrumb[]=array('url' => '#','name' => get_lang('Add'));
31
+    $interbreadcrumb[] = array('url' => 'grade_models.php', 'name' => get_lang('GradeModel'));
32
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
33 33
 } elseif ($action == 'edit') {
34
-    $interbreadcrumb[]=array('url' => 'grade_models.php','name' => get_lang('GradeModel'));
35
-    $interbreadcrumb[]=array('url' => '#','name' => get_lang('Edit'));
34
+    $interbreadcrumb[] = array('url' => 'grade_models.php', 'name' => get_lang('GradeModel'));
35
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
36 36
 } else {
37
-    $interbreadcrumb[]=array('url' => '#','name' => get_lang('GradeModel'));
37
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('GradeModel'));
38 38
 }
39 39
 
40
-$htmlHeadXtra[]= '<script>
40
+$htmlHeadXtra[] = '<script>
41 41
 
42 42
 function plusItem(item) {
43 43
         if (item != 1) {
@@ -77,9 +77,9 @@  discard block
 block discarded – undo
77 77
 
78 78
 //Column config
79 79
 $column_model   = array(
80
-                        array('name'=>'name',           'index'=>'name',        'width'=>'80',   'align'=>'left'),
81
-                        array('name'=>'description',    'index'=>'description', 'width'=>'500',  'align'=>'left','sortable'=>'false'),
82
-                        array('name'=>'actions',        'index'=>'actions',     'width'=>'100',  'align'=>'left','formatter'=>'action_formatter','sortable'=>'false')
80
+                        array('name'=>'name', 'index'=>'name', 'width'=>'80', 'align'=>'left'),
81
+                        array('name'=>'description', 'index'=>'description', 'width'=>'500', 'align'=>'left', 'sortable'=>'false'),
82
+                        array('name'=>'actions', 'index'=>'actions', 'width'=>'100', 'align'=>'left', 'formatter'=>'action_formatter', 'sortable'=>'false')
83 83
                        );
84 84
 //Autowidth
85 85
 $extra_params['autowidth'] = 'true';
@@ -88,8 +88,8 @@  discard block
 block discarded – undo
88 88
 
89 89
 //With this function we can add actions to the jgrid (edit, delete, etc)
90 90
 $action_links = 'function action_formatter(cellvalue, options, rowObject) {
91
-                         return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).'</a>'.
92
-                         '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).'</a>'.
91
+                         return \'<a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>'.
92
+                         '&nbsp;<a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;"  href="?sec_token='.$token.'&action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>'.
93 93
                          '\';
94 94
                  }';
95 95
 ?>
@@ -97,7 +97,7 @@  discard block
 block discarded – undo
97 97
 $(function() {
98 98
 <?php
99 99
     // grid definition see the $obj->display() function
100
-    echo Display::grid_js('grade_model',  $url, $columns, $column_model, $extra_params, array(), $action_links,true);
100
+    echo Display::grid_js('grade_model', $url, $columns, $column_model, $extra_params, array(), $action_links, true);
101 101
 ?>
102 102
 });
103 103
 </script>
@@ -125,7 +125,7 @@  discard block
 block discarded – undo
125 125
             $obj->display();
126 126
         } else {
127 127
             echo '<div class="actions">';
128
-            echo '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
128
+            echo '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
129 129
             echo '</div>';
130 130
             $form->addElement('hidden', 'sec_token');
131 131
             $form->setConstants(array('sec_token' => $token));
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
             $obj->display();
148 148
         } else {
149 149
             echo '<div class="actions">';
150
-            echo '<a href="'.api_get_self().'">'.Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
150
+            echo '<a href="'.api_get_self().'">'.Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
151 151
             echo '</div>';
152 152
             $form->addElement('hidden', 'sec_token');
153 153
             $form->setConstants(array('sec_token' => $token));
Please login to merge, or discard this patch.
main/admin/ldap_import_students.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  * Code
10 10
  */
11 11
 // resetting the course id
12
-$cidReset=true;
12
+$cidReset = true;
13 13
 require_once('../inc/global.inc.php');
14 14
 // setting the section (for the tabs)
15 15
 $this_section = SECTION_PLATFORM_ADMIN;
@@ -18,11 +18,11 @@  discard block
 block discarded – undo
18 18
 api_protect_admin_script();
19 19
 require('../auth/ldap/authldap.php');
20 20
 
21
-$annee_base=date('Y');
21
+$annee_base = date('Y');
22 22
 
23 23
 $tool_name = get_lang('LDAPImport');
24 24
 // setting breadcrumbs
25
-$interbreadcrumb[]=array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
25
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
26 26
 
27 27
 $htmlHeadXtra[] = '<script language="JavaScript" type="text/javascript">
28 28
 var buttoncheck = 1;
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 
49 49
 $annee = $_GET['annee'];
50 50
 $composante = $_GET['composante'];
51
-$etape =  $_GET['etape'];
51
+$etape = $_GET['etape'];
52 52
 $course = $_POST['course'];
53 53
 
54 54
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
 	echo '</div>';
199 199
 }
200 200
 */
201
-elseif(!empty($annee) && empty($course))
201
+elseif (!empty($annee) && empty($course))
202 202
 {
203 203
 	Display::display_header($tool_name);
204 204
 	echo '<div style="align:center">';
@@ -206,7 +206,7 @@  discard block
 block discarded – undo
206 206
 	echo '<form method="post" action="'.api_get_self().'?annee='.Security::remove_XSS($annee).'"><br />';
207 207
 	echo '<select name="course">';
208 208
 	$courses = CourseManager::get_courses_list();
209
-	foreach($courses as $row)
209
+	foreach ($courses as $row)
210 210
 	{
211 211
 		echo '<option value="'.$row['code'].'">'.api_htmlentities($row['title']).'</option>';
212 212
 	}
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 
240 240
 		$info = ldap_get_entries($ds, $sr);
241 241
 
242
-		for ($key = 0; $key < $info["count"]; $key ++) {
242
+		for ($key = 0; $key < $info["count"]; $key++) {
243 243
 			$nom_form[] = $info[$key]["sn"][0];
244 244
 			$prenom_form[] = $info[$key]["givenname"][0];
245 245
 			$email_form[] = $info[$key]["mail"][0];
@@ -259,7 +259,7 @@  discard block
 block discarded – undo
259 259
 		asort($nom_form);
260 260
 		reset($nom_form);
261 261
 
262
-		$statut=5;
262
+		$statut = 5;
263 263
 		include ('ldap_form_add_users_group.php');
264 264
 	} else {
265 265
 		echo '<h4>'.get_lang('UnableToConnectTo').' '.$host.'</h4>';
@@ -270,25 +270,25 @@  discard block
 block discarded – undo
270 270
     echo '</div>';
271 271
 
272 272
 }
273
-elseif (!empty($annee) && !empty($course) && ($_POST['confirmed']=='yes'))
273
+elseif (!empty($annee) && !empty($course) && ($_POST['confirmed'] == 'yes'))
274 274
 {
275
-	$id=$_POST['username_form'];
276
-	$UserList=array();
275
+	$id = $_POST['username_form'];
276
+	$UserList = array();
277 277
 	$userid_match_login = array();
278 278
 	foreach ($id as $form_index=>$user_id)
279 279
 	{
280
-		if(is_array($_POST['checkboxes']) && in_array($form_index,array_values($_POST['checkboxes'])))
280
+		if (is_array($_POST['checkboxes']) && in_array($form_index, array_values($_POST['checkboxes'])))
281 281
 		{
282 282
 			$tmp = ldap_add_user($user_id);
283
-			$UserList[]= $tmp;
283
+			$UserList[] = $tmp;
284 284
 			$userid_match_login[$tmp] = $user_id;
285 285
 		}
286 286
 	}
287 287
 	if (!empty($_POST['course']))
288 288
 	{
289
-		foreach($UserList as $user_id)
289
+		foreach ($UserList as $user_id)
290 290
 		{
291
-			CourseManager::add_user_to_course($user_id,$_POST['course']);
291
+			CourseManager::add_user_to_course($user_id, $_POST['course']);
292 292
 		}
293 293
 		header('Location: course_information.php?code='.Security::remove_XSS($_POST['course']));
294 294
 	}
@@ -314,8 +314,8 @@  discard block
 block discarded – undo
314 314
 	else
315 315
 	{
316 316
 		Display::display_header($tool_name);
317
-		$message=get_lang('NoUserAdded');
318
-		Display :: display_normal_message($message,false);
317
+		$message = get_lang('NoUserAdded');
318
+		Display :: display_normal_message($message, false);
319 319
 	}
320 320
 	echo '<br /><br />';
321 321
     echo '<a href="ldap_import_students.php?annee=&composante=&etape=">'.get_lang('BackToNewSearch').'</a>';
Please login to merge, or discard this patch.
main/admin/access_url_add_usergroup_to_url.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -30,8 +30,8 @@  discard block
 block discarded – undo
30 30
 $tbl_course = Database:: get_main_table(TABLE_MAIN_COURSE);
31 31
 
32 32
 $tool_name = get_lang('AddUserGroupToURL');
33
-$interbreadcrumb[] = array ('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
34
-$interbreadcrumb[] = array ('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
33
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
34
+$interbreadcrumb[] = array('url' => 'access_urls.php', 'name' => get_lang('MultipleAccessURLs'));
35 35
 
36 36
 Display::display_header($tool_name);
37 37
 
@@ -46,8 +46,8 @@  discard block
 block discarded – undo
46 46
 
47 47
 if (isset($_POST['form_sent']) && $_POST['form_sent']) {
48 48
     $form_sent = $_POST['form_sent'];
49
-    $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array() ;
50
-    $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array() ;
49
+    $userGroups = is_array($_POST['user_group_list']) ? $_POST['user_group_list'] : array();
50
+    $urlList = is_array($_POST['url_list']) ? $_POST['url_list'] : array();
51 51
     $firstLetterUserGroup = $_POST['first_letter_user_group'];
52 52
 
53 53
     if ($form_sent == 1) {
Please login to merge, or discard this patch.
main/admin/legal_add.php 1 patch
Spacing   +26 added lines, -26 removed lines patch added patch discarded remove patch
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
 if ($form->validate()) {
26 26
 	$check = Security::check_token('post');
27 27
 	if ($check) {
28
-		$values  = $form->getSubmitValues();
29
-		$lang 	 = $values['language'];
28
+		$values = $form->getSubmitValues();
29
+		$lang = $values['language'];
30 30
 		//language id
31 31
 		$lang = api_get_language_id($lang);
32 32
 
33 33
 		if (isset($values['type'])) {
34
-			$type 	 = $values['type'];
34
+			$type = $values['type'];
35 35
 		} else {
36 36
 			$type = 0;
37 37
 		}
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 		}
48 48
 		$navigator_info = api_get_navigator();
49 49
 
50
-		if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
50
+		if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
51 51
 			if (isset($values['preview'])) {
52
-				$submit	='preview';
52
+				$submit	= 'preview';
53 53
 			} elseif (isset($values['save'])) {
54
-				$submit	='save';
54
+				$submit	= 'save';
55 55
 			} elseif (isset($values['back'])) {
56
-				$submit	='back';
56
+				$submit	= 'back';
57 57
 			}
58 58
 		} else {
59 59
 			$submit  = $values['send'];
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
 				exit;
67 67
 			} elseif ($submit == 'save') {
68 68
 				$insert_result = LegalManager::add($lang, $content, $type, $changes);
69
-				if ($insert_result ) {
69
+				if ($insert_result) {
70 70
 					$message = get_lang('TermAndConditionSaved');
71 71
 				} else {
72 72
 					$message = get_lang('TermAndConditionNotSaved');
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 				$tok = Security::get_token();
76 76
 				header('Location: legal_list.php?action=show_message&message='.urlencode($message).'&sec_token='.$tok);
77 77
 				exit();
78
-			} elseif ($submit=='preview') {
78
+			} elseif ($submit == 'preview') {
79 79
 				$defaults['type'] = $type;
80 80
 				$defaults['content'] = $content;
81 81
 				$defaults['changes'] = $changes;
@@ -83,16 +83,16 @@  discard block
 block discarded – undo
83 83
 				$term_preview['type'] = intval($_POST['type']);
84 84
 			} else {
85 85
 				$my_lang = $_POST['language'];
86
-				if (isset($_POST['language'])){
86
+				if (isset($_POST['language'])) {
87 87
 					$all_langs = api_get_languages();
88
-					if (in_array($my_lang, $all_langs['folder'])){
88
+					if (in_array($my_lang, $all_langs['folder'])) {
89 89
 						$language = api_get_language_id($my_lang);
90 90
 						$term_preview = LegalManager::get_last_condition($language);
91 91
 						$defaults = $term_preview;
92 92
 						if (!$term_preview) {
93 93
 							// there are not terms and conditions
94
-							$term_preview['type']=-1;
95
-							$defaults['type']=0;
94
+							$term_preview['type'] = -1;
95
+							$defaults['type'] = 0;
96 96
 						}
97 97
 					}
98 98
 				}
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
 }
109 109
 $token = Security::get_token();
110 110
 
111
-$form->addElement('hidden','sec_token');
111
+$form->addElement('hidden', 'sec_token');
112 112
 //$form->setConstants(array('sec_token' => $token));
113 113
 $defaults['sec_token'] = $token;
114 114
 $form->addElement('header', get_lang('DisplayTermsConditions'));
@@ -116,24 +116,24 @@  discard block
 block discarded – undo
116 116
 if (isset($_POST['language'])) {
117 117
 
118 118
 	$form->addElement('static', Security::remove_XSS($_POST['language']));
119
-	$form->addElement('hidden', 'language',Security::remove_XSS($_POST['language']));
119
+	$form->addElement('hidden', 'language', Security::remove_XSS($_POST['language']));
120 120
 	$form->addHtmlEditor('content', get_lang('Content'), true, false, array('ToolbarSet' => 'terms_and_conditions', 'Width' => '100%', 'Height' => '250'));
121 121
 
122
-	$form->addElement('radio', 'type', '', get_lang('HTMLText') ,'0');
123
-	$form->addElement('radio', 'type', '', get_lang('PageLink') ,'1');
124
-	$form->addElement('textarea', 'changes', get_lang('ExplainChanges'),array('width'=>'20'));
122
+	$form->addElement('radio', 'type', '', get_lang('HTMLText'), '0');
123
+	$form->addElement('radio', 'type', '', get_lang('PageLink'), '1');
124
+	$form->addElement('textarea', 'changes', get_lang('ExplainChanges'), array('width'=>'20'));
125 125
 
126 126
 	$preview = LegalManager::show_last_condition($term_preview);
127 127
 
128
-	if ($term_preview['type']!=-1) {
129
-		$form->addElement('label', get_lang('Preview'),  $preview);
128
+	if ($term_preview['type'] != -1) {
129
+		$form->addElement('label', get_lang('Preview'), $preview);
130 130
 	}
131 131
 
132 132
 	// Submit & preview button
133 133
     $navigator_info = api_get_navigator();
134 134
 
135 135
     //ie6 fix
136
-	if ($navigator_info['name']=='Internet Explorer' &&  $navigator_info['version']=='6') {
136
+	if ($navigator_info['name'] == 'Internet Explorer' && $navigator_info['version'] == '6') {
137 137
 		$buttons = '<div class="row" align="center">
138 138
 				<div class="formw">
139 139
 				<input type="submit" name="back"  value="'.get_lang('Back').'"/>
@@ -141,7 +141,7 @@  discard block
 block discarded – undo
141 141
 				<input type="submit" name="save"  value="'.get_lang('Save').'"/>
142 142
 				</div>
143 143
 			</div>';
144
-			$form->addElement('html',$buttons);
144
+			$form->addElement('html', $buttons);
145 145
 	} else {
146 146
         $buttons = '<div class="row" align="center">
147 147
 					<div class="formw">
@@ -150,16 +150,16 @@  discard block
 block discarded – undo
150 150
 					<button type="submit" class="save" 	 name="send" value="save">'.get_lang('Save').'</button>
151 151
 					</div>
152 152
 				</div>';
153
-		$form->addElement('html',$buttons);
153
+		$form->addElement('html', $buttons);
154 154
 	}
155 155
 } else {
156
-	$form->addElement('select_language', 'language', get_lang('Language'),null,array());
156
+	$form->addElement('select_language', 'language', get_lang('Language'), null, array());
157 157
 	$form->addElement('button', 'send', get_lang('Load'));
158 158
 
159 159
 }
160 160
 
161 161
 $tool_name = get_lang('AddTermsAndConditions');
162
-$interbreadcrumb[] = array ("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
162
+$interbreadcrumb[] = array("url" => 'index.php', "name" => get_lang('PlatformAdmin'));
163 163
 Display :: display_header($tool_name);
164 164
 
165 165
 echo '<script>
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 // action menu
174 174
 echo '<div class="actions">';
175
-echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/legal_list.php">'.Display::return_icon('search.gif',get_lang('EditTermsAndConditions'),'').get_lang('AllVersions').'</a>';
175
+echo '<a href="'.api_get_path(WEB_CODE_PATH).'admin/legal_list.php">'.Display::return_icon('search.gif', get_lang('EditTermsAndConditions'), '').get_lang('AllVersions').'</a>';
176 176
 echo '</div>';
177 177
 
178 178
 if (isset ($_GET['action'])) {
Please login to merge, or discard this patch.