Passed
Push — 1.10.x ( 07da6d...08890a )
by Yannick
83:27 queued 37:15
created
main/gradebook/gradebook_add_eval.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
     null,
31 31
     'add_eval_form',
32 32
     null,
33
-    api_get_self() . '?selectcat=' . $select_cat.'&'.api_get_cidreq()
33
+    api_get_self().'?selectcat='.$select_cat.'&'.api_get_cidreq()
34 34
 );
35 35
 
36 36
 if ($form->validate()) {
@@ -69,23 +69,23 @@  discard block
 block discarded – undo
69 69
             //header('Location: gradebook_add_user.php?selecteval=' . $eval->get_id());
70 70
             exit;
71 71
         } else {
72
-            header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id().'&'.api_get_cidreq());
72
+            header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$eval->get_category_id().'&'.api_get_cidreq());
73 73
             exit;
74 74
         }
75 75
     } else {
76 76
         $val_addresult = isset($values['addresult']) ? $values['addresult'] : null;
77 77
         if ($val_addresult == 1) {
78
-            header('Location: gradebook_add_result.php?selecteval=' . $eval->get_id().'&'.api_get_cidreq());
78
+            header('Location: gradebook_add_result.php?selecteval='.$eval->get_id().'&'.api_get_cidreq());
79 79
             exit;
80 80
         } else {
81
-            header('Location: ' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $eval->get_category_id().'&'.api_get_cidreq());
81
+            header('Location: '.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$eval->get_category_id().'&'.api_get_cidreq());
82 82
             exit;
83 83
         }
84 84
     }
85 85
 }
86 86
 
87 87
 $interbreadcrumb[] = array(
88
-    'url' => Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $select_cat.'&'.api_get_cidreq(),
88
+    'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$select_cat.'&'.api_get_cidreq(),
89 89
     'name' => get_lang('Gradebook'))
90 90
 ;
91 91
 $this_section = SECTION_COURSES;
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
        $("#hid_category_id option:selected").each(function () {
97 97
            var cat_id = $(this).val();
98 98
             $.ajax({
99
-                url: "' . api_get_path(WEB_AJAX_PATH) . 'gradebook.ajax.php?a=get_gradebook_weight",
99
+                url: "' . api_get_path(WEB_AJAX_PATH).'gradebook.ajax.php?a=get_gradebook_weight",
100 100
                 data: "cat_id="+cat_id,
101 101
                 success: function(return_value) {
102 102
                     if (return_value != 0 ) {
Please login to merge, or discard this patch.
main/gradebook/gradebook_add_link_select_course.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 require_once '../inc/global.inc.php';
10
-$current_course_tool  = TOOL_GRADEBOOK;
10
+$current_course_tool = TOOL_GRADEBOOK;
11 11
 
12 12
 api_protect_course_script(true);
13 13
 api_block_anonymous_users();
@@ -16,13 +16,13 @@  discard block
 block discarded – undo
16 16
 $catadd = new Category();
17 17
 $catadd->set_user_id(api_get_user_id());
18 18
 $catadd->set_parent_id($_GET['selectcat']);
19
-$catcourse = Category :: load ($_GET['selectcat']);
19
+$catcourse = Category :: load($_GET['selectcat']);
20 20
 $form = new CatForm(
21 21
     CatForm :: TYPE_SELECT_COURSE,
22 22
     $catadd,
23 23
     'add_cat_form',
24 24
     null,
25
-    api_get_self() . '?selectcat=' . Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq()
25
+    api_get_self().'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq()
26 26
 );
27 27
 
28 28
 if ($form->validate()) {
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
     $cat = new Category();
31 31
     $cat->set_course_code($values['select_course']);
32 32
     $cat->set_name($values['name']);
33
-    header('location: gradebook_add_link.php?selectcat=' .Security::remove_XSS($_GET['selectcat']).'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
33
+    header('location: gradebook_add_link.php?selectcat='.Security::remove_XSS($_GET['selectcat']).'&course_code='.Security::remove_XSS($values['select_course']).'&'.api_get_cidreq());
34 34
     exit;
35 35
 }
36 36
 
37
-$interbreadcrumb[] = array (
37
+$interbreadcrumb[] = array(
38 38
     'url' => Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']).'&'.api_get_cidreq(),
39 39
     'name' => get_lang('Gradebook')
40 40
 );
Please login to merge, or discard this patch.
main/gradebook/lib/fe/userform.class.php 3 patches
Indentation   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -9,71 +9,71 @@
 block discarded – undo
9 9
  */
10 10
 class UserForm extends FormValidator
11 11
 {
12
-	const TYPE_USER_INFO= 1;
13
-	const TYPE_SIMPLE_SEARCH = 3;
14
-	/**
15
-	 * Builds a form containing form items based on a given parameter
16
-	 * @param int form_type 1 = user_info
17
-	 * @param user array
18
-	 * @param string form name
19
-	 * @param method
20
-	 * @param action
21
-	 */
22
-	public function UserForm($form_type, $user, $form_name, $method= 'post', $action= null)
23
-	{
24
-		parent :: __construct($form_name, $method, $action);
25
-		$this->form_type= $form_type;
26
-		if (isset ($user)) {
27
-			$this->user_info= $user;
28
-		}
29
-		if (isset ($result_object)) {
30
-			$this->result_object= $result_object;
31
-		}
32
-		if ($this->form_type == self :: TYPE_USER_INFO) {
33
-			$this->build_user_info_form();
34
-		}
35
-		elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
36
-			$this->build_simple_search();
37
-		}
38
-		$this->setDefaults();
39
-	}
12
+    const TYPE_USER_INFO= 1;
13
+    const TYPE_SIMPLE_SEARCH = 3;
14
+    /**
15
+     * Builds a form containing form items based on a given parameter
16
+     * @param int form_type 1 = user_info
17
+     * @param user array
18
+     * @param string form name
19
+     * @param method
20
+     * @param action
21
+     */
22
+    public function UserForm($form_type, $user, $form_name, $method= 'post', $action= null)
23
+    {
24
+        parent :: __construct($form_name, $method, $action);
25
+        $this->form_type= $form_type;
26
+        if (isset ($user)) {
27
+            $this->user_info= $user;
28
+        }
29
+        if (isset ($result_object)) {
30
+            $this->result_object= $result_object;
31
+        }
32
+        if ($this->form_type == self :: TYPE_USER_INFO) {
33
+            $this->build_user_info_form();
34
+        }
35
+        elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
36
+            $this->build_simple_search();
37
+        }
38
+        $this->setDefaults();
39
+    }
40 40
 
41
-	protected function build_simple_search()
42
-	{
43
-		if (isset($_GET['search']) && (!empty($_GET['search']))) {
44
-			$this->setDefaults(array(
45
-				'keyword' => Security::remove_XSS($_GET['search'])
46
-			));
47
-		}
48
-		$renderer =& $this->defaultRenderer();
49
-		$renderer->setCustomElementTemplate('<span>{element}</span> ');
50
-		$this->addElement('text','keyword','');
51
-		$this->addButtonSearch(get_lang('Search'), 'submit');
52
-	}
41
+    protected function build_simple_search()
42
+    {
43
+        if (isset($_GET['search']) && (!empty($_GET['search']))) {
44
+            $this->setDefaults(array(
45
+                'keyword' => Security::remove_XSS($_GET['search'])
46
+            ));
47
+        }
48
+        $renderer =& $this->defaultRenderer();
49
+        $renderer->setCustomElementTemplate('<span>{element}</span> ');
50
+        $this->addElement('text','keyword','');
51
+        $this->addButtonSearch(get_lang('Search'), 'submit');
52
+    }
53 53
 
54
-	protected function build_user_info_form()
55
-	{
56
-		if (api_is_western_name_order()) {
57
-			$this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
58
-			$this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
59
-		} else {
60
-			$this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
61
-			$this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
62
-		}
63
-		$this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
64
-		$this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:' . $this->user_info['email'] . '">' . $this->user_info['email'] . '</a>');
65
-		$this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
66
-		$this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
67
-		$this->addButtonSave(get_lang('Back'), 'submit');
68
-	}
54
+    protected function build_user_info_form()
55
+    {
56
+        if (api_is_western_name_order()) {
57
+            $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
58
+            $this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
59
+        } else {
60
+            $this->addElement('static', 'lname', get_lang('LastName'), $this->user_info['lastname']);
61
+            $this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
62
+        }
63
+        $this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
64
+        $this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:' . $this->user_info['email'] . '">' . $this->user_info['email'] . '</a>');
65
+        $this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
66
+        $this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
67
+        $this->addButtonSave(get_lang('Back'), 'submit');
68
+    }
69 69
 
70
-	function display()
71
-	{
72
-		parent :: display();
73
-	}
70
+    function display()
71
+    {
72
+        parent :: display();
73
+    }
74 74
 
75
-	function setDefaults($defaults= array(), $filter = null)
76
-	{
77
-		parent :: setDefaults($defaults, $filter);
78
-	}
75
+    function setDefaults($defaults= array(), $filter = null)
76
+    {
77
+        parent :: setDefaults($defaults, $filter);
78
+    }
79 79
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class UserForm extends FormValidator
11 11
 {
12
-	const TYPE_USER_INFO= 1;
12
+	const TYPE_USER_INFO = 1;
13 13
 	const TYPE_SIMPLE_SEARCH = 3;
14 14
 	/**
15 15
 	 * Builds a form containing form items based on a given parameter
@@ -19,15 +19,15 @@  discard block
 block discarded – undo
19 19
 	 * @param method
20 20
 	 * @param action
21 21
 	 */
22
-	public function UserForm($form_type, $user, $form_name, $method= 'post', $action= null)
22
+	public function UserForm($form_type, $user, $form_name, $method = 'post', $action = null)
23 23
 	{
24 24
 		parent :: __construct($form_name, $method, $action);
25
-		$this->form_type= $form_type;
25
+		$this->form_type = $form_type;
26 26
 		if (isset ($user)) {
27
-			$this->user_info= $user;
27
+			$this->user_info = $user;
28 28
 		}
29 29
 		if (isset ($result_object)) {
30
-			$this->result_object= $result_object;
30
+			$this->result_object = $result_object;
31 31
 		}
32 32
 		if ($this->form_type == self :: TYPE_USER_INFO) {
33 33
 			$this->build_user_info_form();
@@ -45,9 +45,9 @@  discard block
 block discarded – undo
45 45
 				'keyword' => Security::remove_XSS($_GET['search'])
46 46
 			));
47 47
 		}
48
-		$renderer =& $this->defaultRenderer();
48
+		$renderer = & $this->defaultRenderer();
49 49
 		$renderer->setCustomElementTemplate('<span>{element}</span> ');
50
-		$this->addElement('text','keyword','');
50
+		$this->addElement('text', 'keyword', '');
51 51
 		$this->addButtonSearch(get_lang('Search'), 'submit');
52 52
 	}
53 53
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 			$this->addElement('static', 'fname', get_lang('FirstName'), $this->user_info['firstname']);
62 62
 		}
63 63
 		$this->addElement('static', 'uname', get_lang('UserName'), $this->user_info['username']);
64
-		$this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:' . $this->user_info['email'] . '">' . $this->user_info['email'] . '</a>');
64
+		$this->addElement('static', 'email', get_lang('Email'), '<a href="mailto:'.$this->user_info['email'].'">'.$this->user_info['email'].'</a>');
65 65
 		$this->addElement('static', 'ofcode', get_lang('OfficialCode'), $this->user_info['official_code']);
66 66
 		$this->addElement('static', 'phone', get_lang('Phone'), $this->user_info['phone']);
67 67
 		$this->addButtonSave(get_lang('Back'), 'submit');
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 		parent :: display();
73 73
 	}
74 74
 
75
-	function setDefaults($defaults= array(), $filter = null)
75
+	function setDefaults($defaults = array(), $filter = null)
76 76
 	{
77 77
 		parent :: setDefaults($defaults, $filter);
78 78
 	}
Please login to merge, or discard this patch.
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -31,8 +31,7 @@
 block discarded – undo
31 31
 		}
32 32
 		if ($this->form_type == self :: TYPE_USER_INFO) {
33 33
 			$this->build_user_info_form();
34
-		}
35
-		elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
34
+		} elseif ($this->form_type == self :: TYPE_SIMPLE_SEARCH) {
36 35
 			$this->build_simple_search();
37 36
 		}
38 37
 		$this->setDefaults();
Please login to merge, or discard this patch.
main/gradebook/lib/fe/displaygradebook.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -558,7 +558,7 @@
 block discarded – undo
558 558
                     $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
559 559
                 }
560 560
                 if ($show_add_link && !$message_resource) {
561
-                   $actionsLeft .= '<a href="gradebook_add_eval.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '" >' .
561
+                    $actionsLeft .= '<a href="gradebook_add_eval.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '" >' .
562 562
                         Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM) . '</a>';
563 563
                     $cats = Category :: load($selectcat);
564 564
 
Please login to merge, or discard this patch.
Spacing   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -20,37 +20,37 @@  discard block
 block discarded – undo
20 20
         if (api_is_allowed_to_edit(null, true)) {
21 21
             $header = '<div class="actions">';
22 22
             if ($page != 'statistics') {
23
-                $header .= '<a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . $selectcat . '">' .
24
-                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>';
23
+                $header .= '<a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.$selectcat.'">'.
24
+                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>';
25 25
                 if ($evalobj->get_course_code() == null) {
26 26
 
27 27
                 } elseif (!$evalobj->has_results()) {
28
-                    $header .= '<a href="gradebook_add_result.php?selectcat=' . $selectcat . '&selecteval=' . $evalobj->get_id() . '">
29
-    				' . Display::return_icon('evaluation_rate.png', get_lang('AddResult'), '', ICON_SIZE_MEDIUM) . '</a>';
28
+                    $header .= '<a href="gradebook_add_result.php?selectcat='.$selectcat.'&selecteval='.$evalobj->get_id().'">
29
+    				' . Display::return_icon('evaluation_rate.png', get_lang('AddResult'), '', ICON_SIZE_MEDIUM).'</a>';
30 30
                 }
31 31
 
32 32
                 if (api_is_platform_admin() || $evalobj->is_locked() == false) {
33
-                    $header .= '<a href="' . api_get_self() . '?&selecteval=' . $evalobj->get_id() . '&import=">' .
34
-                        Display::return_icon('import_evaluation.png', get_lang('ImportResult'), '', ICON_SIZE_MEDIUM) . '</a>';
33
+                    $header .= '<a href="'.api_get_self().'?&selecteval='.$evalobj->get_id().'&import=">'.
34
+                        Display::return_icon('import_evaluation.png', get_lang('ImportResult'), '', ICON_SIZE_MEDIUM).'</a>';
35 35
                 }
36 36
 
37 37
                 if ($evalobj->has_results()) {
38
-                    $header .= '<a href="' . api_get_self() . '?&selecteval=' . $evalobj->get_id() . '&export=">' .
39
-                        Display::return_icon('export_evaluation.png', get_lang('ExportResult'), '', ICON_SIZE_MEDIUM) . '</a>';
38
+                    $header .= '<a href="'.api_get_self().'?&selecteval='.$evalobj->get_id().'&export=">'.
39
+                        Display::return_icon('export_evaluation.png', get_lang('ExportResult'), '', ICON_SIZE_MEDIUM).'</a>';
40 40
 
41 41
                     if (api_is_platform_admin() || $evalobj->is_locked() == false) {
42
-                        $header .= '<a href="gradebook_edit_result.php?selecteval=' . $evalobj->get_id() . '">' .
43
-                            Display::return_icon('edit.png', get_lang('EditResult'), '', ICON_SIZE_MEDIUM) . '</a>';
44
-                        $header .= '<a href="' . api_get_self() . '?&selecteval=' . $evalobj->get_id() . '&deleteall=" onclick="return confirmationall();">' .
45
-                            Display::return_icon('delete.png', get_lang('DeleteResult'), '', ICON_SIZE_MEDIUM) . '</a>';
42
+                        $header .= '<a href="gradebook_edit_result.php?selecteval='.$evalobj->get_id().'">'.
43
+                            Display::return_icon('edit.png', get_lang('EditResult'), '', ICON_SIZE_MEDIUM).'</a>';
44
+                        $header .= '<a href="'.api_get_self().'?&selecteval='.$evalobj->get_id().'&deleteall=" onclick="return confirmationall();">'.
45
+                            Display::return_icon('delete.png', get_lang('DeleteResult'), '', ICON_SIZE_MEDIUM).'</a>';
46 46
                     }
47 47
                 }
48 48
 
49
-                $header .= '<a href="' . api_get_self() . '?print=&selecteval=' . $evalobj->get_id() . '" target="_blank">' .
50
-                    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . '</a>';
49
+                $header .= '<a href="'.api_get_self().'?print=&selecteval='.$evalobj->get_id().'" target="_blank">'.
50
+                    Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
51 51
             } else {
52
-                $header .= '<a href="gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '"> ' .
53
-                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>';
52
+                $header .= '<a href="gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.
53
+                    Display::return_icon(('back.png'), get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>';
54 54
             }
55 55
             $header .= '</div>';
56 56
         }
@@ -69,17 +69,17 @@  discard block
 block discarded – undo
69 69
             $score = $evalobj->calc_score();
70 70
 
71 71
             if ($score != null) {
72
-                $average = get_lang('Average') . ' :<b> ' . $scoredisplay->display_score($score, SCORE_AVERAGE) . '</b>';
72
+                $average = get_lang('Average').' :<b> '.$scoredisplay->display_score($score, SCORE_AVERAGE).'</b>';
73 73
                 $student_score = $evalobj->calc_score(api_get_user_id());
74 74
                 $student_score = Display::tag(
75 75
                     'h3',
76
-                    get_lang('Score') . ': ' . $scoredisplay->display_score($student_score, SCORE_DIV_PERCENT)
76
+                    get_lang('Score').': '.$scoredisplay->display_score($student_score, SCORE_DIV_PERCENT)
77 77
                 );
78 78
             }
79 79
         }
80 80
         $description = "";
81 81
         if (!$evalobj->get_description() == '') {
82
-            $description = get_lang('Description') . ' :<b> ' . $evalobj->get_description() . '</b><br>';
82
+            $description = get_lang('Description').' :<b> '.$evalobj->get_description().'</b><br>';
83 83
         }
84 84
 
85 85
         if ($evalobj->get_course_code() == null) {
@@ -89,18 +89,18 @@  discard block
 block discarded – undo
89 89
         }
90 90
 
91 91
         $evalinfo = '<table width="100%" border="0"><tr><td>';
92
-        $evalinfo .= '<h2>' . $evalobj->get_name() . '</h2><hr>';
92
+        $evalinfo .= '<h2>'.$evalobj->get_name().'</h2><hr>';
93 93
         $evalinfo .= $description;
94
-        $evalinfo .= get_lang('Course') . ' :<b> ' . $course . '</b><br />';
94
+        $evalinfo .= get_lang('Course').' :<b> '.$course.'</b><br />';
95 95
         //'<br>' . get_lang('Weight') . ' :<b> ' . $evalobj->get_weight() . '</b><br>' . get_lang('Visible') . ' :<b> ' . $visible . '</b>
96
-        $evalinfo .= get_lang('QualificationNumeric') . ' :<b> ' . $evalobj->get_max() . '</b><br>' . $average;
96
+        $evalinfo .= get_lang('QualificationNumeric').' :<b> '.$evalobj->get_max().'</b><br>'.$average;
97 97
 
98 98
         if (!api_is_allowed_to_edit()) {
99 99
             $evalinfo .= $student_score;
100 100
         }
101 101
 
102 102
         if (!$evalobj->has_results()) {
103
-            $evalinfo .= '<br /><i>' . get_lang('NoResultsInEvaluation') . '</i>';
103
+            $evalinfo .= '<br /><i>'.get_lang('NoResultsInEvaluation').'</i>';
104 104
         } elseif ($scoredisplay->is_custom() && api_get_self() != '/main/gradebook/gradebook_statistics.php') {
105 105
             if (api_is_allowed_to_edit(null, true)) {
106 106
                 if ($page != 'statistics') {
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         }
111 111
         if ($page != 'statistics') {
112 112
             if (api_is_allowed_to_edit(null, true)) {
113
-                $evalinfo .= '<br /><a href="gradebook_statistics.php?' . api_get_cidreq() . '&selecteval=' . Security::remove_XSS($_GET['selecteval']) . '"> ' . Display::return_icon(('statistics.png'), get_lang('ViewStatistics'), '', ICON_SIZE_MEDIUM) . '</a>';
113
+                $evalinfo .= '<br /><a href="gradebook_statistics.php?'.api_get_cidreq().'&selecteval='.Security::remove_XSS($_GET['selecteval']).'"> '.Display::return_icon(('statistics.png'), get_lang('ViewStatistics'), '', ICON_SIZE_MEDIUM).'</a>';
114 114
             }
115 115
         }
116 116
         $evalinfo .= '</td><td><img style="float:right; position:relative;" src="../img/tutorial.gif"></td></table>';
@@ -127,8 +127,8 @@  discard block
 block discarded – undo
127 127
     public function display_header_flatview($catobj, $showeval, $showlink, $simple_search_form)
128 128
     {
129 129
         $header = '<table border="0" cellpadding="5">';
130
-        $header .= '<td style="vertical-align: top;"><a href="' . Security::remove_XSS($_SESSION['gradebook_dest']) . '?selectcat=' . Security::remove_XSS($_GET['selectcat']) . '">' . Display::return_icon('gradebook.gif') . get_lang('Gradebook') . '</a></td>';
131
-        $header .= '<td style="vertical-align: top;">' . get_lang('FilterCategory') . '</td><td style="vertical-align: top;"><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
130
+        $header .= '<td style="vertical-align: top;"><a href="'.Security::remove_XSS($_SESSION['gradebook_dest']).'?selectcat='.Security::remove_XSS($_GET['selectcat']).'">'.Display::return_icon('gradebook.gif').get_lang('Gradebook').'</a></td>';
131
+        $header .= '<td style="vertical-align: top;">'.get_lang('FilterCategory').'</td><td style="vertical-align: top;"><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
132 132
         $cats = Category :: load();
133 133
         $tree = $cats[0]->get_tree();
134 134
         unset($cats);
@@ -137,26 +137,26 @@  discard block
 block discarded – undo
137 137
                 $line .= '&mdash;';
138 138
             }
139 139
             if ($_GET['selectcat'] == $cat[0]) {
140
-                $header .= '<option selected="selected" value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
140
+                $header .= '<option selected="selected" value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
141 141
             } else {
142
-                $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
142
+                $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
143 143
             }
144 144
             $line = '';
145 145
         }
146 146
         $header .= '</td></select></form>';
147 147
         if (!$catobj->get_id() == '0') {
148
-            $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '"><img src="../img/gradebook.gif" border="0" alt="' . get_lang('Up') . '" /></a></td>';
148
+            $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'"><img src="../img/gradebook.gif" border="0" alt="'.get_lang('Up').'" /></a></td>';
149 149
         }
150
-        $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
151
-        $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?exportpdf=&offset=' . Security::remove_XSS($_GET['offset']) . '&search=' . Security::remove_XSS($_GET['search']) . '&selectcat=' . $catobj->get_id() . '"><img src=../img/icons/32/pdf.png alt=' . get_lang('ExportPDF') . '/> ' . get_lang('ExportPDF') . '</a>';
152
-        $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?print=&selectcat=' . $catobj->get_id() . '" target="_blank"><img src="../img/icons/32/printer.png" alt=' . get_lang('Print') . '/> ' . get_lang('Print') . '</a>';
150
+        $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>';
151
+        $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?exportpdf=&offset='.Security::remove_XSS($_GET['offset']).'&search='.Security::remove_XSS($_GET['search']).'&selectcat='.$catobj->get_id().'"><img src=../img/icons/32/pdf.png alt='.get_lang('ExportPDF').'/> '.get_lang('ExportPDF').'</a>';
152
+        $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?print=&selectcat='.$catobj->get_id().'" target="_blank"><img src="../img/icons/32/printer.png" alt='.get_lang('Print').'/> '.get_lang('Print').'</a>';
153 153
         $header .= '</td></tr></table>';
154 154
         if (!$catobj->get_id() == '0') {
155
-            $header .= '<table border="0" cellpadding="5"><tr><td><form name="itemfilter" method="post" action="' . api_get_self() . '?selectcat=' . $catobj->get_id() . '"><input type="checkbox" name="showeval" onclick="document.itemfilter.submit()" ' . (($showeval == '1') ? 'checked' : '') . '>Show Evaluations &nbsp;';
156
-            $header .= '<input type="checkbox" name="showlink" onclick="document.itemfilter.submit()" ' . (($showlink == '1') ? 'checked' : '') . '>' . get_lang('ShowLinks') . '</form></td></tr></table>';
155
+            $header .= '<table border="0" cellpadding="5"><tr><td><form name="itemfilter" method="post" action="'.api_get_self().'?selectcat='.$catobj->get_id().'"><input type="checkbox" name="showeval" onclick="document.itemfilter.submit()" '.(($showeval == '1') ? 'checked' : '').'>Show Evaluations &nbsp;';
156
+            $header .= '<input type="checkbox" name="showlink" onclick="document.itemfilter.submit()" '.(($showlink == '1') ? 'checked' : '').'>'.get_lang('ShowLinks').'</form></td></tr></table>';
157 157
         }
158 158
         if (isset($_GET['search'])) {
159
-            $header .= '<b>' . get_lang('SearchResults') . ' :</b>';
159
+            $header .= '<b>'.get_lang('SearchResults').' :</b>';
160 160
         }
161 161
         echo $header;
162 162
     }
@@ -177,23 +177,23 @@  discard block
 block discarded – undo
177 177
             $select_cat = $catobj->get_parent_id();
178 178
             $url = 'gradebook_flatview.php';
179 179
         }
180
-        $header .= '<a href="' . $url . '?' . api_get_cidreq() . '&selectcat=' . $select_cat . '">' .
181
-            Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM) . '</a>';
180
+        $header .= '<a href="'.$url.'?'.api_get_cidreq().'&selectcat='.$select_cat.'">'.
181
+            Display::return_icon('back.png', get_lang('FolderView'), '', ICON_SIZE_MEDIUM).'</a>';
182 182
 
183 183
         $pageNum = isset($_GET['flatviewlist_page_nr']) ? intval($_GET['flatviewlist_page_nr']) : '';
184 184
         $perPage = isset($_GET['flatviewlist_per_page']) ? intval($_GET['flatviewlist_per_page']) : '';
185 185
         $offset = isset($_GET['offset']) ? $_GET['offset'] : '0';
186 186
 
187
-        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&export_format=csv&export_report=export_report&selectcat=' . $catobj->get_id() . '">' .
188
-            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM) . '</a>';
189
-        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&export_format=xls&export_report=export_report&selectcat=' . $catobj->get_id() . '">' .
190
-            Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM) . '</a>';
191
-        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&export_format=doc&export_report=export_report&selectcat=' . $catobj->get_id() . '">' .
192
-            Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM) . '</a>';
193
-        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&print=&selectcat=' . $catobj->get_id() . '" target="_blank">' .
194
-            Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM) . '</a>';
195
-        $header .= '<a href="' . api_get_self() . '?'.api_get_cidreq().'&exportpdf=&selectcat=' . $catobj->get_id().'&offset='.$offset.'&flatviewlist_page_nr='.$pageNum.'&flatviewlist_per_page='.$perPage.'" >' .
196
-            Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM) . '</a>';
187
+        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export_format=csv&export_report=export_report&selectcat='.$catobj->get_id().'">'.
188
+            Display::return_icon('export_csv.png', get_lang('ExportAsCSV'), '', ICON_SIZE_MEDIUM).'</a>';
189
+        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export_format=xls&export_report=export_report&selectcat='.$catobj->get_id().'">'.
190
+            Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a>';
191
+        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&export_format=doc&export_report=export_report&selectcat='.$catobj->get_id().'">'.
192
+            Display::return_icon('export_doc.png', get_lang('ExportAsDOC'), '', ICON_SIZE_MEDIUM).'</a>';
193
+        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&print=&selectcat='.$catobj->get_id().'" target="_blank">'.
194
+            Display::return_icon('printer.png', get_lang('Print'), '', ICON_SIZE_MEDIUM).'</a>';
195
+        $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&exportpdf=&selectcat='.$catobj->get_id().'&offset='.$offset.'&flatviewlist_page_nr='.$pageNum.'&flatviewlist_per_page='.$perPage.'" >'.
196
+            Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).'</a>';
197 197
         $header .= '</div>';
198 198
         echo $header;
199 199
     }
@@ -234,8 +234,8 @@  discard block
 block discarded – undo
234 234
                 $item = $evals_links[$count];
235 235
                 $score = $item->calc_score($user_id);
236 236
                 $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
237
-                $item_value+=$score[0] / $my_score_denom * $item->get_weight();
238
-                $item_total+=$item->get_weight();
237
+                $item_value += $score[0] / $my_score_denom * $item->get_weight();
238
+                $item_total += $item->get_weight();
239 239
             }
240 240
             $item_value = number_format($item_value, 2, '.', ' ');
241 241
             $total_score = array($item_value, $item_total);
@@ -244,9 +244,9 @@  discard block
 block discarded – undo
244 244
             $cattotal = Category :: load(0);
245 245
             $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
246 246
             $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
247
-            $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . api_get_person_name($user['firstname'], $user['lastname']) . '</b><br />';
247
+            $scoreinfo = get_lang('StatsStudent').' :<b> '.api_get_person_name($user['firstname'], $user['lastname']).'</b><br />';
248 248
             if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) {
249
-                $scoreinfo.= '<h2>' . get_lang('Total') . ' : ' . $scorecourse_display . '</h2>';
249
+                $scoreinfo .= '<h2>'.get_lang('Total').' : '.$scorecourse_display.'</h2>';
250 250
             }
251 251
             Display :: display_normal_message($scoreinfo, false);
252 252
         }
@@ -256,9 +256,9 @@  discard block
 block discarded – undo
256 256
         if (($showtree == '1') || (isset($_GET['studentoverview']))) {
257 257
             $header .= '<tr>';
258 258
             if (!$selectcat == '0') {
259
-                $header .= '<td style=" "><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' . Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>';
259
+                $header .= '<td style=" "><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'">'.Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('RootCat'), '', ICON_SIZE_MEDIUM).'</a></td>';
260 260
             }
261
-            $header .= '<td style=" ">' . get_lang('CurrentCategory') . '</td>' .
261
+            $header .= '<td style=" ">'.get_lang('CurrentCategory').'</td>'.
262 262
                     '<td style=" "><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
263 263
             $cats = Category :: load();
264 264
 
@@ -271,15 +271,15 @@  discard block
 block discarded – undo
271 271
                 }
272 272
                 $line = isset($line) ? $line : '';
273 273
                 if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
274
-                    $header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
274
+                    $header .= '<option selected value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
275 275
                 } else {
276
-                    $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
276
+                    $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
277 277
                 }
278 278
                 $line = '';
279 279
             }
280 280
             $header .= '</select></form></td>';
281 281
             if (!empty($simple_search_form) && $message_resource === false) {
282
-                $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
282
+                $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>';
283 283
             } else {
284 284
                 $header .= '<td></td>';
285 285
             }
@@ -293,11 +293,11 @@  discard block
 block discarded – undo
293 293
                     //$header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&selectcat=' . $catobj->get_id() . '"><img src="../img/view_list.gif" alt="' . get_lang('FlatView') . '" /> ' . get_lang('FlatView') . '</a>';
294 294
                 }
295 295
             } else {
296
-                $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank"><img src="../img/icons/32/pdf.png" alt="' . get_lang('ExportPDF') . '" /> ' . get_lang('ExportPDF') . '</a>';
296
+                $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank"><img src="../img/icons/32/pdf.png" alt="'.get_lang('ExportPDF').'" /> '.get_lang('ExportPDF').'</a>';
297 297
             }
298 298
             $header .= '</td></tr>';
299 299
         }
300
-        $header.='</table></div>';
300
+        $header .= '</table></div>';
301 301
 
302 302
         // for course admin & platform admin add item buttons are added to the header
303 303
         $header .= '<div class="actions">';
@@ -327,7 +327,7 @@  discard block
 block discarded – undo
327 327
                 $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
328 328
                 $my_api_cidreq = api_get_cidreq();
329 329
                 if ($my_api_cidreq == '') {
330
-                    $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
330
+                    $my_api_cidreq = 'cidReq='.$my_category['course_code'];
331 331
                 }
332 332
                 if ($show_add_link && !$message_resource) {
333 333
                     //$header .= '<td><a href="gradebook_add_eval.php?'.$my_api_cidreq.'&selectcat=' . $catobj->get_id() . '" >'.Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'),'',ICON_SIZE_MEDIUM).'</a>';
@@ -346,28 +346,28 @@  discard block
 block discarded – undo
346 346
                     $my_course_id = api_get_course_id();
347 347
                     $my_file = substr($_SESSION['gradebook_dest'], 0, 5);
348 348
 
349
-                    $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
350
-                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
351
-                    $header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?' . $my_api_cidreq . '&amp;cat_id=' . (int) $_GET['selectcat'] . '">' .
352
-                        Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM) . '</a>';
349
+                    $header .= '<td style="vertical-align: top;"><a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
350
+                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
351
+                    $header .= '<td style="vertical-align: top;"><a href="gradebook_display_certificate.php?'.$my_api_cidreq.'&amp;cat_id='.(int) $_GET['selectcat'].'">'.
352
+                        Display::return_icon('certificate_list.png', get_lang('GradebookSeeListOfStudentsCertificates'), '', ICON_SIZE_MEDIUM).'</a>';
353 353
 
354 354
                     $visibility_icon = ($catobj->is_visible() == 0) ? 'invisible' : 'visible';
355 355
                     $visibility_command = ($catobj->is_visible() == 0) ? 'set_visible' : 'set_invisible';
356 356
 
357 357
                     //Right icons
358
-                    $modify_icons = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' . Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>';
358
+                    $modify_icons = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>';
359 359
                     //$modify_icons .= '<a href="../document/document.php?curdirpath=/certificates&'.$my_api_cidreq.'&origin=gradebook&selectcat=' . $catobj->get_id() . '">'.
360 360
                     //Display::return_icon('certificate.png', get_lang('AttachCertificate'),'',ICON_SIZE_MEDIUM).'</a>';
361 361
                     //hide or delete are not options available
362 362
                     //$modify_icons .= '&nbsp;<a  href="' . api_get_self() . '?visiblecat=' . $catobj->get_id() . '&amp;' . $visibility_command . '=&amp;selectcat=0 ">'.Display::return_icon($visibility_icon.'.png', get_lang('Visible'),'',ICON_SIZE_MEDIUM).'</a>';
363 363
                     if ($catobj->get_name() != api_get_course_id()) {
364
-                        $modify_icons .= '&nbsp;<a  href="' . api_get_self() . '?deletecat=' . $catobj->get_id() . '&amp;selectcat=0&amp;cidReq=' . $catobj->get_course_code() . '" onclick="return confirmation();">' . Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_MEDIUM) . '</a>';
364
+                        $modify_icons .= '&nbsp;<a  href="'.api_get_self().'?deletecat='.$catobj->get_id().'&amp;selectcat=0&amp;cidReq='.$catobj->get_course_code().'" onclick="return confirmation();">'.Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_MEDIUM).'</a>';
365 365
                     }
366 366
                     $header .= Display::div($modify_icons, array('class' => 'right'));
367 367
                 }
368 368
             }
369 369
         } elseif (isset($_GET['search'])) {
370
-            $header .= '<b>' . get_lang('SearchResults') . ' :</b>';
370
+            $header .= '<b>'.get_lang('SearchResults').' :</b>';
371 371
         }
372 372
         $header .= '</div>';
373 373
         echo $header;
@@ -479,7 +479,7 @@  discard block
 block discarded – undo
479 479
                     $aditionalButtons .= isset($certificateLinkInfo['badge_link']) ? $certificateLinkInfo['badge_link'] : '';
480 480
                     $aditionalButtons .= '</div>';
481 481
                 }
482
-                $scoreinfo .= '<strong>' . sprintf(get_lang('TotalX'), $scorecourse_display . $aditionalButtons). '</strong>';
482
+                $scoreinfo .= '<strong>'.sprintf(get_lang('TotalX'), $scorecourse_display.$aditionalButtons).'</strong>';
483 483
 
484 484
             }
485 485
             Display :: display_normal_message($scoreinfo, false);
@@ -490,10 +490,10 @@  discard block
 block discarded – undo
490 490
             $header = '<div class="actions"><table>';
491 491
             $header .= '<tr>';
492 492
             if (!$selectcat == '0') {
493
-                $header .= '<td><a href="' . api_get_self() . '?selectcat=' . $catobj->get_parent_id() . '">' .
494
-                    Display::return_icon('back.png', get_lang('BackTo') . ' ' . get_lang('RootCat'), '', ICON_SIZE_MEDIUM) . '</a></td>';
493
+                $header .= '<td><a href="'.api_get_self().'?selectcat='.$catobj->get_parent_id().'">'.
494
+                    Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('RootCat'), '', ICON_SIZE_MEDIUM).'</a></td>';
495 495
             }
496
-            $header .= '<td>' . get_lang('CurrentCategory') . '</td>' .
496
+            $header .= '<td>'.get_lang('CurrentCategory').'</td>'.
497 497
                     '<td><form name="selector"><select name="selectcat" onchange="document.selector.submit()">';
498 498
             $cats = Category :: load();
499 499
 
@@ -506,15 +506,15 @@  discard block
 block discarded – undo
506 506
                 }
507 507
                 $line = isset($line) ? $line : '';
508 508
                 if (isset($_GET['selectcat']) && $_GET['selectcat'] == $cat[0]) {
509
-                    $header .= '<option selected value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
509
+                    $header .= '<option selected value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
510 510
                 } else {
511
-                    $header .= '<option value=' . $cat[0] . '>' . $line . ' ' . $cat[1] . '</option>';
511
+                    $header .= '<option value='.$cat[0].'>'.$line.' '.$cat[1].'</option>';
512 512
                 }
513 513
                 $line = '';
514 514
             }
515 515
             $header .= '</select></form></td>';
516 516
             if (!empty($simple_search_form) && $message_resource === false) {
517
-                $header .= '<td style="vertical-align: top;">' . $simple_search_form->toHtml() . '</td>';
517
+                $header .= '<td style="vertical-align: top;">'.$simple_search_form->toHtml().'</td>';
518 518
             } else {
519 519
                 $header .= '<td></td>';
520 520
             }
@@ -531,11 +531,11 @@  discard block
 block discarded – undo
531 531
                     //$header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&selectcat=' . $catobj->get_id() . '"><img src="../img/view_list.gif" alt="' . get_lang('FlatView') . '" /> ' . get_lang('FlatView') . '</a>';
532 532
                 }
533 533
             } else {
534
-                $header .= '<td style="vertical-align: top;"><a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">
535
-							<img src="../img/icons/32/pdf.png" alt="' . get_lang('ExportPDF') . '" /> ' . get_lang('ExportPDF') . '</a>';
534
+                $header .= '<td style="vertical-align: top;"><a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank">
535
+							<img src="../img/icons/32/pdf.png" alt="' . get_lang('ExportPDF').'" /> '.get_lang('ExportPDF').'</a>';
536 536
             }
537 537
             $header .= '</td></tr>';
538
-            $header.='</table></div>';
538
+            $header .= '</table></div>';
539 539
         }
540 540
 
541 541
         // for course admin & platform admin add item buttons are added to the header
@@ -547,33 +547,33 @@  discard block
 block discarded – undo
547 547
 
548 548
         if (api_is_allowed_to_edit(null, true)) {
549 549
             if (empty($grade_model_id) || $grade_model_id == -1) {
550
-                $actionsLeft .= '<a href="gradebook_add_cat.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' .
551
-                    Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM) . '</a></td>';
550
+                $actionsLeft .= '<a href="gradebook_add_cat.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.
551
+                    Display::return_icon('new_folder.png', get_lang('AddGradebook'), array(), ICON_SIZE_MEDIUM).'</a></td>';
552 552
             }
553 553
             if ($selectcat == '0') {
554 554
 
555 555
             } else {
556 556
                 $my_category = $catobj->shows_all_information_an_category($catobj->get_id());
557 557
                 if ($my_api_cidreq == '') {
558
-                    $my_api_cidreq = 'cidReq=' . $my_category['course_code'];
558
+                    $my_api_cidreq = 'cidReq='.$my_category['course_code'];
559 559
                 }
560 560
                 if ($show_add_link && !$message_resource) {
561
-                   $actionsLeft .= '<a href="gradebook_add_eval.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '" >' .
562
-                        Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM) . '</a>';
561
+                   $actionsLeft .= '<a href="gradebook_add_eval.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'" >'.
562
+                        Display::return_icon('new_evaluation.png', get_lang('NewEvaluation'), '', ICON_SIZE_MEDIUM).'</a>';
563 563
                     $cats = Category :: load($selectcat);
564 564
 
565 565
                     if ($cats[0]->get_course_code() != null && !$message_resource) {
566
-                        $actionsLeft .= '<a href="gradebook_add_link.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
567
-                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . '</a>';
566
+                        $actionsLeft .= '<a href="gradebook_add_link.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
567
+                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM).'</a>';
568 568
                     } else {
569
-                        $actionsLeft .= '<a href="gradebook_add_link_select_course.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
570
-                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM) . '</a>';
569
+                        $actionsLeft .= '<a href="gradebook_add_link_select_course.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
570
+                            Display::return_icon('new_online_evaluation.png', get_lang('MakeLink'), '', ICON_SIZE_MEDIUM).'</a>';
571 571
                     }
572 572
                 }
573 573
 
574 574
                 if (!$message_resource) {
575
-                    $actionsLeft .= '<a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
576
-                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
575
+                    $actionsLeft .= '<a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
576
+                        Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
577 577
 
578 578
                     if ($my_category['generate_certificates'] == 1) {
579 579
                         $actionsLeft .= Display::url(
@@ -583,7 +583,7 @@  discard block
 block discarded – undo
583 583
                                         '',
584 584
                                         ICON_SIZE_MEDIUM
585 585
                                         ),
586
-                                "gradebook_display_certificate.php?$my_api_cidreq&cat_id=" . intval($_GET['selectcat'])
586
+                                "gradebook_display_certificate.php?$my_api_cidreq&cat_id=".intval($_GET['selectcat'])
587 587
                             );
588 588
                     }
589 589
 
@@ -594,30 +594,30 @@  discard block
 block discarded – undo
594 594
                                     '',
595 595
                                     ICON_SIZE_MEDIUM
596 596
                                     ),
597
-                            "gradebook_display_summary.php?$my_api_cidreq&selectcat=" . intval($_GET['selectcat'])
597
+                            "gradebook_display_summary.php?$my_api_cidreq&selectcat=".intval($_GET['selectcat'])
598 598
                         );
599 599
 
600 600
 
601 601
                     // Right icons
602
-                    $actionsRight = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&amp;cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' .
603
-                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM) . '</a>';
604
-                    $actionsRight .= '<a href="../document/document.php?curdirpath=/certificates&' . $my_api_cidreq . '&origin=gradebook&selectcat=' . $catobj->get_id() . '">' .
605
-                            Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM) . '</a>';
602
+                    $actionsRight = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&amp;cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.
603
+                        Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_MEDIUM).'</a>';
604
+                    $actionsRight .= '<a href="../document/document.php?curdirpath=/certificates&'.$my_api_cidreq.'&origin=gradebook&selectcat='.$catobj->get_id().'">'.
605
+                            Display::return_icon('certificate.png', get_lang('AttachCertificate'), '', ICON_SIZE_MEDIUM).'</a>';
606 606
 
607 607
                     if (empty($categories)) {
608
-                        $actionsRight .= '<a href="gradebook_edit_all.php?id_session=' . api_get_session_id() . '&amp;' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
609
-                            Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM) . '</a>';
608
+                        $actionsRight .= '<a href="gradebook_edit_all.php?id_session='.api_get_session_id().'&amp;'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
609
+                            Display::return_icon('percentage.png', get_lang('EditAllWeights'), '', ICON_SIZE_MEDIUM).'</a>';
610 610
                     }
611 611
                     $score_display_custom = api_get_setting('gradebook_score_display_custom');
612 612
                     if (api_get_setting('teachers_can_change_score_settings') == 'true' && $score_display_custom['my_display_custom'] == 'true') {
613
-                        $actionsRight .= '<a href="gradebook_scoring_system.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
614
-                            Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . '</a>';
613
+                        $actionsRight .= '<a href="gradebook_scoring_system.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
614
+                            Display::return_icon('ranking.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).'</a>';
615 615
                     }
616 616
                     
617 617
                 }
618 618
             }
619 619
         } elseif (isset($_GET['search'])) {
620
-            echo $header = '<b>' . get_lang('SearchResults') . ' :</b>';
620
+            echo $header = '<b>'.get_lang('SearchResults').' :</b>';
621 621
         }
622 622
 
623 623
         $isDrhOfCourse = CourseManager::isUserSubscribedInCourseAsDrh(
@@ -626,26 +626,26 @@  discard block
 block discarded – undo
626 626
         );
627 627
 
628 628
         if ($isDrhOfCourse) {
629
-            $$actionsLeft .= '<a href="gradebook_flatview.php?' . $my_api_cidreq . '&selectcat=' . $catobj->get_id() . '">' .
630
-                Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
629
+            $$actionsLeft .= '<a href="gradebook_flatview.php?'.$my_api_cidreq.'&selectcat='.$catobj->get_id().'">'.
630
+                Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
631 631
         }
632 632
 
633
-        if (api_is_allowed_to_edit(null, true)){
634
-            echo $toolbar = Display::toolbarAction('gradebook-actions', array(0 => $actionsLeft, 1 => $actionsRight ));
633
+        if (api_is_allowed_to_edit(null, true)) {
634
+            echo $toolbar = Display::toolbarAction('gradebook-actions', array(0 => $actionsLeft, 1 => $actionsRight));
635 635
         }
636 636
 
637 637
         if (api_is_allowed_to_edit(null, true)) {
638 638
             $weight = intval($catobj->get_weight()) > 0 ? $catobj->get_weight() : 0;
639
-            $weight = '<strong>' . get_lang('TotalWeight') . ' : </strong>' . $weight;
639
+            $weight = '<strong>'.get_lang('TotalWeight').' : </strong>'.$weight;
640 640
 
641 641
             $min_certification = (intval($catobj->get_certificate_min_score() > 0) ? $catobj->get_certificate_min_score() : 0);
642
-            $min_certification = get_lang('CertificateMinScore') . ' : ' . $min_certification;
643
-            $edit_icon = '<a href="gradebook_edit_cat.php?editcat=' . $catobj->get_id() . '&amp;cidReq=' . $catobj->get_course_code() . '&id_session='.$catobj->get_session_id(). '">' .
644
-                Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL) . '</a>';
642
+            $min_certification = get_lang('CertificateMinScore').' : '.$min_certification;
643
+            $edit_icon = '<a href="gradebook_edit_cat.php?editcat='.$catobj->get_id().'&amp;cidReq='.$catobj->get_course_code().'&id_session='.$catobj->get_session_id().'">'.
644
+                Display::return_icon('edit.png', get_lang('Edit'), array(), ICON_SIZE_SMALL).'</a>';
645 645
             //$msg = Display::tag('h3', $weight.' - '.$min_certification);
646
-            $msg = $weight . ' - ' . $min_certification . $edit_icon;
646
+            $msg = $weight.' - '.$min_certification.$edit_icon;
647 647
             //@todo show description
648
-            $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : '<strong>' . get_lang('GradebookDescriptionLog') . '</strong>' . ': ' . $catobj->get_description());
648
+            $description = (($catobj->get_description() == "" || is_null($catobj->get_description())) ? '' : '<strong>'.get_lang('GradebookDescriptionLog').'</strong>'.': '.$catobj->get_description());
649 649
             Display::display_normal_message($msg, false);
650 650
             if (!empty($description)) {
651 651
                 echo Display::div($description, array());
@@ -673,24 +673,24 @@  discard block
 block discarded – undo
673 673
             $cattotal = Category :: load(0);
674 674
             $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
675 675
             $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
676
-            $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . $user['complete_name']. '</b><br />';
676
+            $scoreinfo = get_lang('StatsStudent').' :<b> '.$user['complete_name'].'</b><br />';
677 677
             if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search'])))
678
-                $scoreinfo.= '<br />' . get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>';
679
-            $scoreinfo.= '<br />' . get_lang('Total') . ' : <b>' . $scoretotal_display . '</b>';
678
+                $scoreinfo .= '<br />'.get_lang('TotalForThisCategory').' : <b>'.$scorecourse_display.'</b>';
679
+            $scoreinfo .= '<br />'.get_lang('Total').' : <b>'.$scoretotal_display.'</b>';
680 680
             Display :: display_normal_message($scoreinfo, false);
681 681
         }
682 682
         // show navigation tree and buttons?
683 683
         $header = '<div class="actions">';
684 684
 
685 685
         if ($is_course_admin) {
686
-            $header .= '<a href="gradebook_flatview.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM) . '</a>';
687
-            $header .= '<a href="gradebook_scoring_system.php?' . api_get_cidreq() . '&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('settings.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM) . '</a>';
686
+            $header .= '<a href="gradebook_flatview.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.Display::return_icon('stats.png', get_lang('FlatView'), '', ICON_SIZE_MEDIUM).'</a>';
687
+            $header .= '<a href="gradebook_scoring_system.php?'.api_get_cidreq().'&selectcat='.$catobj->get_id().'">'.Display::return_icon('settings.png', get_lang('ScoreEdit'), '', ICON_SIZE_MEDIUM).'</a>';
688 688
         } elseif (!(isset($_GET['studentoverview']))) {
689
-            $header .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&selectcat=' . $catobj->get_id() . '">' . Display::return_icon('view_list.gif', get_lang('FlatView')) . ' ' . get_lang('FlatView') . '</a>';
689
+            $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&selectcat='.$catobj->get_id().'">'.Display::return_icon('view_list.gif', get_lang('FlatView')).' '.get_lang('FlatView').'</a>';
690 690
         } else {
691
-            $header .= '<a href="' . api_get_self() . '?' . api_get_cidreq() . '&studentoverview=&exportpdf=&selectcat=' . $catobj->get_id() . '" target="_blank">' . Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM) . '</a>';
691
+            $header .= '<a href="'.api_get_self().'?'.api_get_cidreq().'&studentoverview=&exportpdf=&selectcat='.$catobj->get_id().'" target="_blank">'.Display::return_icon('pdf.png', get_lang('ExportPDF'), '', ICON_SIZE_MEDIUM).'</a>';
692 692
         }
693
-        $header.='</div>';
693
+        $header .= '</div>';
694 694
         echo $header;
695 695
     }
696 696
 
@@ -717,8 +717,8 @@  discard block
 block discarded – undo
717 717
             $item = $evals_links[$count];
718 718
             $score = $item->calc_score($user_id);
719 719
             $my_score_denom = ($score[1] == 0) ? 1 : $score[1];
720
-            $item_value+=$score[0] / $my_score_denom * $item->get_weight();
721
-            $item_total+=$item->get_weight();
720
+            $item_value += $score[0] / $my_score_denom * $item->get_weight();
721
+            $item_total += $item->get_weight();
722 722
             //$row[] = $scoredisplay->display_score($score,SCORE_DIV_PERCENT);
723 723
         }
724 724
         $item_value = number_format($item_value, 2, '.', ' ');
@@ -733,17 +733,17 @@  discard block
 block discarded – undo
733 733
         $imageUrl = UserManager::getUserPicture($userid);
734 734
 
735 735
         $info = '<div class="row"><div class="col-md-3">';
736
-        $info .= '<div class="thumbnail"><img src="' . $imageUrl . '" /></div>';
736
+        $info .= '<div class="thumbnail"><img src="'.$imageUrl.'" /></div>';
737 737
         $info .= '</div>';
738 738
         $info .= '<div class="col-md-6">';
739
-        $info .= get_lang('Name') . ' :  <a target="_blank" href="' . api_get_path(WEB_CODE_PATH) . 'social/profile.php?u=' . $userid . '"> ' .
740
-            $user['complete_name'] . '</a><br />';
739
+        $info .= get_lang('Name').' :  <a target="_blank" href="'.api_get_path(WEB_CODE_PATH).'social/profile.php?u='.$userid.'"> '.
740
+            $user['complete_name'].'</a><br />';
741 741
 
742 742
         if (api_get_setting('show_email_addresses') == 'true') {
743
-            $info .= get_lang('Email') . ' : <a href="mailto:' . $user['email'] . '">' . $user['email'] . '</a><br />';
743
+            $info .= get_lang('Email').' : <a href="mailto:'.$user['email'].'">'.$user['email'].'</a><br />';
744 744
         }
745 745
 
746
-        $info .= get_lang('TotalUser') . ' : <b>' . $scorecourse_display . '</b>';
746
+        $info .= get_lang('TotalUser').' : <b>'.$scorecourse_display.'</b>';
747 747
         $info .= '</div>';
748 748
         $info .= '</div>';
749 749
 
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -674,8 +674,9 @@
 block discarded – undo
674 674
             $scoretotal = $cattotal[0]->calc_score(api_get_user_id());
675 675
             $scoretotal_display = (isset($scoretotal) ? $scoredisplay->display_score($scoretotal, SCORE_PERCENT) : get_lang('NoResultsAvailable'));
676 676
             $scoreinfo = get_lang('StatsStudent') . ' :<b> ' . $user['complete_name']. '</b><br />';
677
-            if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search'])))
678
-                $scoreinfo.= '<br />' . get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>';
677
+            if ((!$catobj->get_id() == '0') && (!isset($_GET['studentoverview'])) && (!isset($_GET['search']))) {
678
+                            $scoreinfo.= '<br />' . get_lang('TotalForThisCategory') . ' : <b>' . $scorecourse_display . '</b>';
679
+            }
679 680
             $scoreinfo.= '<br />' . get_lang('Total') . ' : <b>' . $scoretotal_display . '</b>';
680 681
             Display :: display_normal_message($scoreinfo, false);
681 682
         }
Please login to merge, or discard this patch.
main/gradebook/lib/fe/catform.class.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -52,15 +52,15 @@  discard block
 block discarded – undo
52 52
      */
53 53
     protected function build_move_form()
54 54
     {
55
-        $renderer =& $this->defaultRenderer();
55
+        $renderer = & $this->defaultRenderer();
56 56
         $renderer->setCustomElementTemplate('<span>{element}</span> ');
57 57
         $this->addElement(
58 58
             'static',
59 59
             null,
60 60
             null,
61
-            '"' . $this->category_object->get_name() . '" '
61
+            '"'.$this->category_object->get_name().'" '
62 62
         );
63
-        $this->addElement('static', null, null, get_lang('MoveTo') . ' : ');
63
+        $this->addElement('static', null, null, get_lang('MoveTo').' : ');
64 64
         $select = $this->addElement('select', 'move_cat', null, null);
65 65
         $line = null;
66 66
         foreach ($this->category_object->get_target_categories() as $cat) {
@@ -68,9 +68,9 @@  discard block
 block discarded – undo
68 68
                 $line .= '--';
69 69
             }
70 70
             if ($cat[0] != $this->category_object->get_parent_id()) {
71
-                $select->addoption($line . ' ' . $cat[1], $cat[0]);
71
+                $select->addoption($line.' '.$cat[1], $cat[0]);
72 72
             } else {
73
-                $select->addoption($line . ' ' . $cat[1], $cat[0], 'disabled');
73
+                $select->addoption($line.' '.$cat[1], $cat[0], 'disabled');
74 74
             }
75 75
             $line = '';
76 76
         }
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
         $grade_model_id = $this->category_object->get_grade_model_id();
154 154
 
155 155
         if (empty($links)) {
156
-            $grade_model_id    = 0;
156
+            $grade_model_id = 0;
157 157
         }
158 158
 
159 159
         $category_name = $this->category_object->get_name();
@@ -242,7 +242,7 @@  discard block
 block discarded – undo
242 242
                     [
243 243
                         'id' => 'skills',
244 244
                         'multiple' => 'multiple',
245
-                        'url' => api_get_path(WEB_AJAX_PATH) . 'skill.ajax.php?a=search_skills'
245
+                        'url' => api_get_path(WEB_AJAX_PATH).'skill.ajax.php?a=search_skills'
246 246
                     ]
247 247
                 );
248 248
 
@@ -400,14 +400,14 @@  discard block
 block discarded – undo
400 400
         //only return courses that are not yet created by the teacher
401 401
 
402 402
         foreach ($coursecat as $row) {
403
-            $select->addoption($row[1],$row[0]);
403
+            $select->addoption($row[1], $row[0]);
404 404
         }
405 405
         $this->setDefaults(array(
406 406
             'hid_user_id' => $this->category_object->get_user_id(),
407 407
             'hid_parent_id' => $this->category_object->get_parent_id()
408 408
         ));
409
-        $this->addElement('hidden','hid_user_id');
410
-        $this->addElement('hidden','hid_parent_id');
409
+        $this->addElement('hidden', 'hid_user_id');
410
+        $this->addElement('hidden', 'hid_parent_id');
411 411
         $this->addElement('submit', null, get_lang('Ok'));
412 412
     }
413 413
 
Please login to merge, or discard this patch.
main/gradebook/lib/fe/resulttable.class.php 2 patches
Indentation   +149 added lines, -149 removed lines patch added patch discarded remove patch
@@ -10,162 +10,162 @@
 block discarded – undo
10 10
  */
11 11
 class ResultTable extends SortableTable
12 12
 {
13
-	private $datagen;
14
-	private $evaluation;
15
-	private $allresults;
16
-	private $iscourse;
17
-
18
-	/**
19
-	 * Constructor
20
-	 */
13
+    private $datagen;
14
+    private $evaluation;
15
+    private $allresults;
16
+    private $iscourse;
17
+
18
+    /**
19
+     * Constructor
20
+     */
21 21
     public function ResultTable ($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false)
22
-	{
23
-    	parent :: __construct ('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
24
-
25
-		$this->datagen = new ResultsDataGenerator($evaluation, $results, true);
26
-
27
-		$this->evaluation = $evaluation;
28
-		$this->iscourse = $iscourse;
29
-		$this->forprint = $forprint;
30
-
31
-		if (isset ($addparams))  {
32
-			$this->set_additional_parameters($addparams);
33
-		}
34
-		$scoredisplay = ScoreDisplay :: instance();
35
-		$column= 0;
36
-		if ($this->iscourse == '1') {
37
-			$this->set_header($column++, '', false);
38
-			$this->set_form_actions(array (
39
-					'delete' => get_lang('Delete')
40
-			));
41
-		}
42
-		if (api_is_western_name_order()) {
43
-			$this->set_header($column++, get_lang('FirstName'));
44
-			$this->set_header($column++, get_lang('LastName'));
45
-		} else {
46
-			$this->set_header($column++, get_lang('LastName'));
47
-			$this->set_header($column++, get_lang('FirstName'));
48
-		}
49
-		$this->set_header($column++, get_lang('Score'));
50
-		if ($scoredisplay->is_custom()) {
51
-			$this->set_header($column++, get_lang('Display'));
52
-		}
53
-		if (!$this->forprint) {
54
-			$this->set_header($column++, get_lang('Modify'),false);
55
-		}
22
+    {
23
+        parent :: __construct ('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
24
+
25
+        $this->datagen = new ResultsDataGenerator($evaluation, $results, true);
26
+
27
+        $this->evaluation = $evaluation;
28
+        $this->iscourse = $iscourse;
29
+        $this->forprint = $forprint;
30
+
31
+        if (isset ($addparams))  {
32
+            $this->set_additional_parameters($addparams);
33
+        }
34
+        $scoredisplay = ScoreDisplay :: instance();
35
+        $column= 0;
36
+        if ($this->iscourse == '1') {
37
+            $this->set_header($column++, '', false);
38
+            $this->set_form_actions(array (
39
+                    'delete' => get_lang('Delete')
40
+            ));
41
+        }
42
+        if (api_is_western_name_order()) {
43
+            $this->set_header($column++, get_lang('FirstName'));
44
+            $this->set_header($column++, get_lang('LastName'));
45
+        } else {
46
+            $this->set_header($column++, get_lang('LastName'));
47
+            $this->set_header($column++, get_lang('FirstName'));
48
+        }
49
+        $this->set_header($column++, get_lang('Score'));
50
+        if ($scoredisplay->is_custom()) {
51
+            $this->set_header($column++, get_lang('Display'));
52
+        }
53
+        if (!$this->forprint) {
54
+            $this->set_header($column++, get_lang('Modify'),false);
55
+        }
56 56
     }
57 57
 
58 58
 
59
-	/**
60
-	 * Function used by SortableTable to get total number of items in the table
61
-	 */
62
-	function get_total_number_of_items () {
63
-		return $this->datagen->get_total_results_count();
64
-	}
65
-
66
-	/**
67
-	 * Function used by SortableTable to generate the data to display
68
-	 */
69
-	function get_table_data ($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
70
-
71
-		$is_western_name_order = api_is_western_name_order();
72
-		$scoredisplay = ScoreDisplay :: instance();
73
-
74
-		// determine sorting type
75
-		$col_adjust = $this->iscourse == '1' ? 1 : 0;
76
-
77
-		switch ($this->column) {
78
-			// first name or last name
79
-			case (0 + $col_adjust):
80
-				if ($is_western_name_order) {
81
-					$sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
82
-				} else {
83
-					$sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
84
-				}
85
-				break;
59
+    /**
60
+     * Function used by SortableTable to get total number of items in the table
61
+     */
62
+    function get_total_number_of_items () {
63
+        return $this->datagen->get_total_results_count();
64
+    }
65
+
66
+    /**
67
+     * Function used by SortableTable to generate the data to display
68
+     */
69
+    function get_table_data ($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
70
+
71
+        $is_western_name_order = api_is_western_name_order();
72
+        $scoredisplay = ScoreDisplay :: instance();
73
+
74
+        // determine sorting type
75
+        $col_adjust = $this->iscourse == '1' ? 1 : 0;
76
+
77
+        switch ($this->column) {
86 78
             // first name or last name
87
-			case (1 + $col_adjust):
88
-				if ($is_western_name_order) {
89
-					$sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
90
-				} else {
91
-					$sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
92
-				}
93
-				break;
79
+            case (0 + $col_adjust):
80
+                if ($is_western_name_order) {
81
+                    $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
82
+                } else {
83
+                    $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
84
+                }
85
+                break;
86
+            // first name or last name
87
+            case (1 + $col_adjust):
88
+                if ($is_western_name_order) {
89
+                    $sorting = ResultsDataGenerator :: RDG_SORT_LASTNAME;
90
+                } else {
91
+                    $sorting = ResultsDataGenerator :: RDG_SORT_FIRSTNAME;
92
+                }
93
+                break;
94 94
             //Score
95
-			case (2 + $col_adjust):
96
-				$sorting = ResultsDataGenerator :: RDG_SORT_SCORE;
97
-				break;
98
-			case (3 + $col_adjust):
99
-				$sorting = ResultsDataGenerator :: RDG_SORT_MASK;
100
-				break;
101
-		}
102
-
103
-		if ($this->direction == 'DESC') {
104
-			$sorting |= ResultsDataGenerator :: RDG_SORT_DESC;
105
-		} else {
106
-			$sorting |= ResultsDataGenerator :: RDG_SORT_ASC;
107
-		}
108
-
109
-		$data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
110
-
111
-		// generate the data to display
112
-		$sortable_data = array();
113
-		foreach ($data_array as $item) {
114
-			$row = array ();
115
-			if ($this->iscourse == '1') {
116
-				 $row[] = $item['result_id'];
117
-			}
118
-			if ($is_western_name_order) {
119
-				$row[] = $item['firstname'];
120
-				$row[] = $item['lastname'];
121
-			} else {
122
-				$row[] = $item['lastname'];
123
-				$row[] = $item['firstname'];
124
-			}
125
-
126
-			$row[] =  Display::bar_progress($item['percentage_score'], false, $item['score']);
95
+            case (2 + $col_adjust):
96
+                $sorting = ResultsDataGenerator :: RDG_SORT_SCORE;
97
+                break;
98
+            case (3 + $col_adjust):
99
+                $sorting = ResultsDataGenerator :: RDG_SORT_MASK;
100
+                break;
101
+        }
102
+
103
+        if ($this->direction == 'DESC') {
104
+            $sorting |= ResultsDataGenerator :: RDG_SORT_DESC;
105
+        } else {
106
+            $sorting |= ResultsDataGenerator :: RDG_SORT_ASC;
107
+        }
108
+
109
+        $data_array = $this->datagen->get_data($sorting, $from, $this->per_page);
110
+
111
+        // generate the data to display
112
+        $sortable_data = array();
113
+        foreach ($data_array as $item) {
114
+            $row = array ();
115
+            if ($this->iscourse == '1') {
116
+                    $row[] = $item['result_id'];
117
+            }
118
+            if ($is_western_name_order) {
119
+                $row[] = $item['firstname'];
120
+                $row[] = $item['lastname'];
121
+            } else {
122
+                $row[] = $item['lastname'];
123
+                $row[] = $item['firstname'];
124
+            }
125
+
126
+            $row[] =  Display::bar_progress($item['percentage_score'], false, $item['score']);
127 127
             //$row[] =  Display::bar_progress($item['percentage_score'], true);
128
-			if ($scoredisplay->is_custom()) {
129
-				$row[] = $item['display'];
130
-			}
131
-			if (!$this->forprint) {
132
-				$row[] = $this->build_edit_column ($item);
133
-			}
134
-			$sortable_data[] = $row;
135
-		}
136
-
137
-		return $sortable_data;
138
-	}
139
-
140
-	private function build_edit_column ($item)
141
-	{
142
-		$status=CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
143
-		$locked_status = $this->evaluation->get_locked();
144
-		if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
145
-			//api_is_course_admin()
146
-			$edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
147
-				Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>';
148
-			$edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
149
-				Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>';
150
-		}
151
-		if ($this->evaluation->get_course_code() == null) {
152
-			$edit_column.= '&nbsp;<a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">
128
+            if ($scoredisplay->is_custom()) {
129
+                $row[] = $item['display'];
130
+            }
131
+            if (!$this->forprint) {
132
+                $row[] = $this->build_edit_column ($item);
133
+            }
134
+            $sortable_data[] = $row;
135
+        }
136
+
137
+        return $sortable_data;
138
+    }
139
+
140
+    private function build_edit_column ($item)
141
+    {
142
+        $status=CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
143
+        $locked_status = $this->evaluation->get_locked();
144
+        if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
145
+            //api_is_course_admin()
146
+            $edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
147
+                Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>';
148
+            $edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
149
+                Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>';
150
+        }
151
+        if ($this->evaluation->get_course_code() == null) {
152
+            $edit_column.= '&nbsp;<a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">
153 153
 			<img src="../img/delete.gif" border="0" title="' . get_lang('Delete') . '" alt="" /></a>';
154
-		    $edit_column.= '&nbsp;<a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">
154
+            $edit_column.= '&nbsp;<a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">
155 155
 		    <img src="../img/statistics.gif" width="17px" border="0" title="' . get_lang('Statistics') . '" alt="" /></a>';
156
-		}
157
-		// Evaluation's origin is a link
158
-		if ($this->evaluation->get_category_id() < 0) {
159
-			$link = LinkFactory :: get_evaluation_link ($this->evaluation->get_id());
160
-
161
-			$doc_url = $link->get_view_url($item['id']);
162
-
163
-			if ($doc_url != null) {
164
-				$edit_column .= '&nbsp;<a href="'. $doc_url . '" target="_blank">'
165
-								.'<img src="'. api_get_path(WEB_CODE_PATH) . 'img/link.gif" border="0" title="' . get_lang('OpenDocument') . '" alt="" />'
166
-								.'</a>';
167
-			}
168
-		}
169
-		return $edit_column;
170
-	}
156
+        }
157
+        // Evaluation's origin is a link
158
+        if ($this->evaluation->get_category_id() < 0) {
159
+            $link = LinkFactory :: get_evaluation_link ($this->evaluation->get_id());
160
+
161
+            $doc_url = $link->get_view_url($item['id']);
162
+
163
+            if ($doc_url != null) {
164
+                $edit_column .= '&nbsp;<a href="'. $doc_url . '" target="_blank">'
165
+                                .'<img src="'. api_get_path(WEB_CODE_PATH) . 'img/link.gif" border="0" title="' . get_lang('OpenDocument') . '" alt="" />'
166
+                                .'</a>';
167
+            }
168
+        }
169
+        return $edit_column;
170
+    }
171 171
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
18 18
 	/**
19 19
 	 * Constructor
20 20
 	 */
21
-    public function ResultTable ($evaluation, $results = array(), $iscourse, $addparams = null,$forprint = false)
21
+    public function ResultTable($evaluation, $results = array(), $iscourse, $addparams = null, $forprint = false)
22 22
 	{
23
-    	parent :: __construct ('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
23
+    	parent :: __construct('resultlist', null, null, (api_is_western_name_order() xor api_sort_by_first_name()) ? 2 : 1);
24 24
 
25 25
 		$this->datagen = new ResultsDataGenerator($evaluation, $results, true);
26 26
 
@@ -28,14 +28,14 @@  discard block
 block discarded – undo
28 28
 		$this->iscourse = $iscourse;
29 29
 		$this->forprint = $forprint;
30 30
 
31
-		if (isset ($addparams))  {
31
+		if (isset ($addparams)) {
32 32
 			$this->set_additional_parameters($addparams);
33 33
 		}
34 34
 		$scoredisplay = ScoreDisplay :: instance();
35
-		$column= 0;
35
+		$column = 0;
36 36
 		if ($this->iscourse == '1') {
37 37
 			$this->set_header($column++, '', false);
38
-			$this->set_form_actions(array (
38
+			$this->set_form_actions(array(
39 39
 					'delete' => get_lang('Delete')
40 40
 			));
41 41
 		}
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
 			$this->set_header($column++, get_lang('Display'));
52 52
 		}
53 53
 		if (!$this->forprint) {
54
-			$this->set_header($column++, get_lang('Modify'),false);
54
+			$this->set_header($column++, get_lang('Modify'), false);
55 55
 		}
56 56
     }
57 57
 
@@ -59,14 +59,14 @@  discard block
 block discarded – undo
59 59
 	/**
60 60
 	 * Function used by SortableTable to get total number of items in the table
61 61
 	 */
62
-	function get_total_number_of_items () {
62
+	function get_total_number_of_items() {
63 63
 		return $this->datagen->get_total_results_count();
64 64
 	}
65 65
 
66 66
 	/**
67 67
 	 * Function used by SortableTable to generate the data to display
68 68
 	 */
69
-	function get_table_data ($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
69
+	function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = null) {
70 70
 
71 71
 		$is_western_name_order = api_is_western_name_order();
72 72
 		$scoredisplay = ScoreDisplay :: instance();
@@ -111,7 +111,7 @@  discard block
 block discarded – undo
111 111
 		// generate the data to display
112 112
 		$sortable_data = array();
113 113
 		foreach ($data_array as $item) {
114
-			$row = array ();
114
+			$row = array();
115 115
 			if ($this->iscourse == '1') {
116 116
 				 $row[] = $item['result_id'];
117 117
 			}
@@ -123,13 +123,13 @@  discard block
 block discarded – undo
123 123
 				$row[] = $item['firstname'];
124 124
 			}
125 125
 
126
-			$row[] =  Display::bar_progress($item['percentage_score'], false, $item['score']);
126
+			$row[] = Display::bar_progress($item['percentage_score'], false, $item['score']);
127 127
             //$row[] =  Display::bar_progress($item['percentage_score'], true);
128 128
 			if ($scoredisplay->is_custom()) {
129 129
 				$row[] = $item['display'];
130 130
 			}
131 131
 			if (!$this->forprint) {
132
-				$row[] = $this->build_edit_column ($item);
132
+				$row[] = $this->build_edit_column($item);
133 133
 			}
134 134
 			$sortable_data[] = $row;
135 135
 		}
@@ -137,32 +137,32 @@  discard block
 block discarded – undo
137 137
 		return $sortable_data;
138 138
 	}
139 139
 
140
-	private function build_edit_column ($item)
140
+	private function build_edit_column($item)
141 141
 	{
142
-		$status=CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
142
+		$status = CourseManager::get_user_in_course_status(api_get_user_id(), api_get_course_id());
143 143
 		$locked_status = $this->evaluation->get_locked();
144 144
 		if (api_is_allowed_to_edit(null, true) && $locked_status == 0) {
145 145
 			//api_is_course_admin()
146
-			$edit_column = '<a href="' . api_get_self() . '?editres=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
147
-				Display::return_icon('edit.png', get_lang('Modify'),'','22').'</a>';
148
-			$edit_column .= ' <a href="' . api_get_self() . '?delete_mark=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id().'&'.api_get_cidreq().'">'.
149
-				Display::return_icon('delete.png', get_lang('Delete'),'','22').'</a>';
146
+			$edit_column = '<a href="'.api_get_self().'?editres='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
147
+				Display::return_icon('edit.png', get_lang('Modify'), '', '22').'</a>';
148
+			$edit_column .= ' <a href="'.api_get_self().'?delete_mark='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">'.
149
+				Display::return_icon('delete.png', get_lang('Delete'), '', '22').'</a>';
150 150
 		}
151 151
 		if ($this->evaluation->get_course_code() == null) {
152
-			$edit_column.= '&nbsp;<a href="' . api_get_self() . '?resultdelete=' . $item['result_id'] . '&selecteval=' . $this->evaluation->get_id() . '" onclick="return confirmationuser();">
153
-			<img src="../img/delete.gif" border="0" title="' . get_lang('Delete') . '" alt="" /></a>';
154
-		    $edit_column.= '&nbsp;<a href="user_stats.php?userid=' . $item['id'] . '&selecteval=' . $this->evaluation->get_id() . '&'.api_get_cidreq().'">
155
-		    <img src="../img/statistics.gif" width="17px" border="0" title="' . get_lang('Statistics') . '" alt="" /></a>';
152
+			$edit_column .= '&nbsp;<a href="'.api_get_self().'?resultdelete='.$item['result_id'].'&selecteval='.$this->evaluation->get_id().'" onclick="return confirmationuser();">
153
+			<img src="../img/delete.gif" border="0" title="' . get_lang('Delete').'" alt="" /></a>';
154
+		    $edit_column .= '&nbsp;<a href="user_stats.php?userid='.$item['id'].'&selecteval='.$this->evaluation->get_id().'&'.api_get_cidreq().'">
155
+		    <img src="../img/statistics.gif" width="17px" border="0" title="' . get_lang('Statistics').'" alt="" /></a>';
156 156
 		}
157 157
 		// Evaluation's origin is a link
158 158
 		if ($this->evaluation->get_category_id() < 0) {
159
-			$link = LinkFactory :: get_evaluation_link ($this->evaluation->get_id());
159
+			$link = LinkFactory :: get_evaluation_link($this->evaluation->get_id());
160 160
 
161 161
 			$doc_url = $link->get_view_url($item['id']);
162 162
 
163 163
 			if ($doc_url != null) {
164
-				$edit_column .= '&nbsp;<a href="'. $doc_url . '" target="_blank">'
165
-								.'<img src="'. api_get_path(WEB_CODE_PATH) . 'img/link.gif" border="0" title="' . get_lang('OpenDocument') . '" alt="" />'
164
+				$edit_column .= '&nbsp;<a href="'.$doc_url.'" target="_blank">'
165
+								.'<img src="'.api_get_path(WEB_CODE_PATH).'img/link.gif" border="0" title="'.get_lang('OpenDocument').'" alt="" />'
166 166
 								.'</a>';
167 167
 			}
168 168
 		}
Please login to merge, or discard this patch.
main/gradebook/lib/fe/exportgradebook.php 3 patches
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.
Braces   +5 added lines, -4 removed lines patch added patch discarded remove patch
@@ -144,10 +144,11 @@
 block discarded – undo
144 144
 		$css = '';
145 145
 	}
146 146
 
147
-	if(count($data_table) > 30)
148
-		$items_per_page = (count($data_table)/2);
149
-	else
150
-		$items_per_page = count($data_table);
147
+	if(count($data_table) > 30) {
148
+			$items_per_page = (count($data_table)/2);
149
+	} else {
150
+			$items_per_page = count($data_table);
151
+	}
151 152
 
152 153
 	$count_pages = ceil(count($data_table) / $items_per_page);
153 154
 	for ($x = 0; $x<$count_pages; $x++) {
Please login to merge, or discard this patch.
Indentation   +192 added lines, -192 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  * @param	string	Course name to print as title for the table
13 13
  */
14 14
 function print_table ($data_array,$header_names,$view,$coursename) {
15
-	$printdata= '<!DOCTYPE html
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().'">
@@ -64,24 +64,24 @@  discard block
 block discarded – undo
64 64
 </head>
65 65
 <body dir="'.api_get_text_direction().'"><div id="main">';
66 66
 
67
-	$printdata .= '<h2>'.$view.' : '.$coursename.'</h2>';
68
-	//@todo not necessary here
69
-	//$printdata .= '<h3>'.get_lang('Date').' : '.api_convert_and_format_date(null, DATE_FORMAT_SHORT). ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT).'</h3>';
70
-	$printdata .= '<table border="1" width="90%" cellspacing="1" cellpadding="1">';
71
-	foreach ($header_names as $header) {
72
-		$printdata .= '<th>'.$header.'</th>';
73
-	}
67
+    $printdata .= '<h2>'.$view.' : '.$coursename.'</h2>';
68
+    //@todo not necessary here
69
+    //$printdata .= '<h3>'.get_lang('Date').' : '.api_convert_and_format_date(null, DATE_FORMAT_SHORT). ' ' . api_convert_and_format_date(null, TIME_NO_SEC_FORMAT).'</h3>';
70
+    $printdata .= '<table border="1" width="90%" cellspacing="1" cellpadding="1">';
71
+    foreach ($header_names as $header) {
72
+        $printdata .= '<th>'.$header.'</th>';
73
+    }
74 74
 
75
-	foreach ($data_array as $data) {
76
-		$printdata .= '<tr>';
77
-		foreach ($data as $rowdata) {
78
-			$printdata .= '<td>'.$rowdata.'</td>';
79
-		}
80
-		$printdata .= '</tr>';
75
+    foreach ($data_array as $data) {
76
+        $printdata .= '<tr>';
77
+        foreach ($data as $rowdata) {
78
+            $printdata .= '<td>'.$rowdata.'</td>';
79
+        }
80
+        $printdata .= '</tr>';
81 81
 
82
-	}
83
-	$printdata .= '</table></div></body></html>';
84
-	return $printdata;
82
+    }
83
+    $printdata .= '</table></div></body></html>';
84
+    return $printdata;
85 85
 }
86 86
 
87 87
 
@@ -95,13 +95,13 @@  discard block
 block discarded – undo
95 95
  */
96 96
 function export_pdf_attendance($headers_table, $data_table, $headers_pdf, $footers_pdf, $title_pdf) {
97 97
 
98
-	$mpdf = new mPDF('UTF-8', 'A4-L', '', '', 15, 10, 35, 20, 4, 2, 'L');
99
-	$mpdf->useOnlyCoreFonts = true;
100
-	$mpdf->mirrorMargins = 0;      // Use different Odd/Even headers and footers and mirror margins
98
+    $mpdf = new mPDF('UTF-8', 'A4-L', '', '', 15, 10, 35, 20, 4, 2, 'L');
99
+    $mpdf->useOnlyCoreFonts = true;
100
+    $mpdf->mirrorMargins = 0;      // Use different Odd/Even headers and footers and mirror margins
101 101
 
102
-	if (is_array($headers_pdf)) {
103
-		// preparing headers pdf
104
-		$header = '<table width="100%"  cellspacing="1" cellpadding="1" border="0" class="strong">
102
+    if (is_array($headers_pdf)) {
103
+        // preparing headers pdf
104
+        $header = '<table width="100%"  cellspacing="1" cellpadding="1" border="0" class="strong">
105 105
                                 <tr>
106 106
                                    <td ROWSPAN="3" style="text-align: left;" class="title"><img src="'.api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/images/header-logo.png"></td><td  colspan="3"><h1>'.$title_pdf.'</h1></td>
107 107
                                 <tr>
@@ -121,92 +121,92 @@  discard block
 block discarded – undo
121 121
                                     <td><strong>'.$headers_pdf[5][0].'</strong> </td><td> <strong>'.$headers_pdf[5][1].'</strong></td>
122 122
                                 </tr>
123 123
                             </table>';
124
-	}
124
+    }
125 125
 
126
-	// preparing footer pdf
127
-	$footer = '<table width="100%" cellspacing="2" cellpadding="10" border="0">';
128
-	if (is_array($footers_pdf)) {
129
-		$footer .= '<tr>';
130
-		foreach ($footers_pdf as $foot_pdf) {
131
-			$footer .= '<td width="33%" style="text-align: center;">'.$foot_pdf.'</td>';
132
-		}
133
-		$footer .= '</tr>';
134
-	}
135
-	$footer .= '</table>';
126
+    // preparing footer pdf
127
+    $footer = '<table width="100%" cellspacing="2" cellpadding="10" border="0">';
128
+    if (is_array($footers_pdf)) {
129
+        $footer .= '<tr>';
130
+        foreach ($footers_pdf as $foot_pdf) {
131
+            $footer .= '<td width="33%" style="text-align: center;">'.$foot_pdf.'</td>';
132
+        }
133
+        $footer .= '</tr>';
134
+    }
135
+    $footer .= '</table>';
136 136
 
137
-	$footer .= '<div align="right" style="font-weight: bold;">{PAGENO}/{nb}</div>';
137
+    $footer .= '<div align="right" style="font-weight: bold;">{PAGENO}/{nb}</div>';
138 138
 
139
-	// preparing content pdf
140
-	$css_file = api_get_path(TO_SYS, WEB_CSS_PATH).api_get_setting('stylesheets').'/print.css';
141
-	if (file_exists($css_file)) {
142
-		$css = @file_get_contents($css_file);
143
-	} else {
144
-		$css = '';
145
-	}
139
+    // preparing content pdf
140
+    $css_file = api_get_path(TO_SYS, WEB_CSS_PATH).api_get_setting('stylesheets').'/print.css';
141
+    if (file_exists($css_file)) {
142
+        $css = @file_get_contents($css_file);
143
+    } else {
144
+        $css = '';
145
+    }
146 146
 
147
-	if(count($data_table) > 30)
148
-		$items_per_page = (count($data_table)/2);
149
-	else
150
-		$items_per_page = count($data_table);
147
+    if(count($data_table) > 30)
148
+        $items_per_page = (count($data_table)/2);
149
+    else
150
+        $items_per_page = count($data_table);
151 151
 
152
-	$count_pages = ceil(count($data_table) / $items_per_page);
153
-	for ($x = 0; $x<$count_pages; $x++) {
154
-		$content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
155
-		// header table
156
-		$content_table .= '<tr>';
157
-		$i = 0;
158
-		if (is_array($headers_table)) {
152
+    $count_pages = ceil(count($data_table) / $items_per_page);
153
+    for ($x = 0; $x<$count_pages; $x++) {
154
+        $content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
155
+        // header table
156
+        $content_table .= '<tr>';
157
+        $i = 0;
158
+        if (is_array($headers_table)) {
159 159
 
160
-			foreach ($headers_table as $head_table) {
161
-				if (!empty($head_table[0])) {
162
-					$width = (!empty($head_table[1])?$head_table[1].'%':'');
163
-					$content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
164
-					$i++;
165
-				}
166
-			}
167
-		}
168
-		$content_table .= '</tr>';
169
-		// body table
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));
173
-			$i = 1;
174
-			$item = $offset+1;
175
-			foreach ($data_table as $data) {
176
-				$content_table .= '<tr>';
177
-				$content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
178
-				foreach ($data as  $key => $content) {
179
-					if (isset($content)) {
180
-						$key == 1 ? $align='align="left"':$align='align="center"';
181
-						$content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
182
-					}
183
-				}
184
-				$content_table .= '</tr>';
185
-				$i++;
186
-				$item++;
187
-				if ($i > $items_per_page) { break; }
188
-			}
189
-		} else {
190
-			$content_table .= '<tr colspan="'.$i.'"><td>'.get_lang('Empty').'</td></tr>';
191
-		}
192
-		$content_table .= '</table>';
193
-		if ($x < ($count_pages - 1)) { $content_table .= '<pagebreak />'; }
194
-	}
160
+            foreach ($headers_table as $head_table) {
161
+                if (!empty($head_table[0])) {
162
+                    $width = (!empty($head_table[1])?$head_table[1].'%':'');
163
+                    $content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
164
+                    $i++;
165
+                }
166
+            }
167
+        }
168
+        $content_table .= '</tr>';
169
+        // body table
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));
173
+            $i = 1;
174
+            $item = $offset+1;
175
+            foreach ($data_table as $data) {
176
+                $content_table .= '<tr>';
177
+                $content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
178
+                foreach ($data as  $key => $content) {
179
+                    if (isset($content)) {
180
+                        $key == 1 ? $align='align="left"':$align='align="center"';
181
+                        $content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
182
+                    }
183
+                }
184
+                $content_table .= '</tr>';
185
+                $i++;
186
+                $item++;
187
+                if ($i > $items_per_page) { break; }
188
+            }
189
+        } else {
190
+            $content_table .= '<tr colspan="'.$i.'"><td>'.get_lang('Empty').'</td></tr>';
191
+        }
192
+        $content_table .= '</table>';
193
+        if ($x < ($count_pages - 1)) { $content_table .= '<pagebreak />'; }
194
+    }
195 195
 
196
-	$html = $content_table;
196
+    $html = $content_table;
197 197
 
198 198
 
199
-	// set attributes for pdf
200
-	$mpdf->SetHTMLHeader($header);
201
-	$mpdf->SetHTMLFooter($footer);
202
-	if (!empty($css)) {
203
-		$mpdf->WriteHTML($css, 1);
204
-		$mpdf->WriteHTML($html, 2);
205
-	} else {
206
-		$mpdf->WriteHTML($html);
207
-	}
208
-	$mpdf->Output(api_replace_dangerous_char($title_pdf.'.pdf'), 'D');
209
-	exit;
199
+    // set attributes for pdf
200
+    $mpdf->SetHTMLHeader($header);
201
+    $mpdf->SetHTMLFooter($footer);
202
+    if (!empty($css)) {
203
+        $mpdf->WriteHTML($css, 1);
204
+        $mpdf->WriteHTML($html, 2);
205
+    } else {
206
+        $mpdf->WriteHTML($html);
207
+    }
208
+    $mpdf->Output(api_replace_dangerous_char($title_pdf.'.pdf'), 'D');
209
+    exit;
210 210
 }
211 211
 
212 212
 
@@ -220,88 +220,88 @@  discard block
 block discarded – undo
220 220
  */
221 221
 function export_pdf_with_html($headers_table, $data_table, $headers_pdf, $footers_pdf, $title_pdf)
222 222
 {
223
-	$headers_in_pdf = '<img src="'.api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/images/header-logo.png">';
223
+    $headers_in_pdf = '<img src="'.api_get_path(WEB_CSS_PATH).api_get_setting('stylesheets').'/images/header-logo.png">';
224 224
 
225
-	if (is_array($headers_pdf)) {
226
-		// preparing headers pdf
227
-		$header = '<br/><br/><table width="100%" cellspacing="1" cellpadding="5" border="0" class="strong">
225
+    if (is_array($headers_pdf)) {
226
+        // preparing headers pdf
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) {
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>';
232
-			}
233
-		}
234
-		$header.='</table><br />';
235
-	}
229
+        foreach($headers_pdf as $header_pdf) {
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>';
232
+            }
233
+        }
234
+        $header.='</table><br />';
235
+    }
236 236
 
237
-	// preparing footer pdf
238
-	$footer = '<table width="100%" cellspacing="2" cellpadding="10" border="0">';
239
-	if (is_array($footers_pdf)) {
240
-		$footer .= '<tr>';
241
-		foreach ($footers_pdf as $foot_pdf) {
242
-			$footer .= '<td width="33%" style="text-align: center;">'.$foot_pdf.'</td>';
243
-		}
244
-		$footer .= '</tr>';
245
-	}
246
-	$footer .= '</table>';
247
-	$footer .= '<div align="right" style="font-weight: bold;">{PAGENO}/{nb}</div>';
237
+    // preparing footer pdf
238
+    $footer = '<table width="100%" cellspacing="2" cellpadding="10" border="0">';
239
+    if (is_array($footers_pdf)) {
240
+        $footer .= '<tr>';
241
+        foreach ($footers_pdf as $foot_pdf) {
242
+            $footer .= '<td width="33%" style="text-align: center;">'.$foot_pdf.'</td>';
243
+        }
244
+        $footer .= '</tr>';
245
+    }
246
+    $footer .= '</table>';
247
+    $footer .= '<div align="right" style="font-weight: bold;">{PAGENO}/{nb}</div>';
248 248
 
249
-	// preparing content pdf
250
-	$css_file = api_get_path(TO_SYS, WEB_CSS_PATH).api_get_setting('stylesheets').'/print.css';
251
-	if (file_exists($css_file)) {
252
-		$css = @file_get_contents($css_file);
253
-	} else {
254
-		$css = '';
255
-	}
256
-	$items_per_page = 30;
257
-	$count_pages = ceil(count($data_table) / $items_per_page);
258
-	for ($x = 0; $x<$count_pages; $x++) {
259
-		$content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
260
-		// header table
261
-		$content_table .= '<tr>';
262
-		$i = 0;
263
-		if (is_array($headers_table)) {
264
-			foreach ($headers_table as $head_table) {
265
-				if (!empty($head_table[0])) {
266
-					$width = (!empty($head_table[1])?$head_table[1].'%':'');
267
-					$content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
268
-					$i++;
269
-				}
270
-			}
271
-		}
272
-		$content_table .= '</tr>';
273
-		// body table
249
+    // preparing content pdf
250
+    $css_file = api_get_path(TO_SYS, WEB_CSS_PATH).api_get_setting('stylesheets').'/print.css';
251
+    if (file_exists($css_file)) {
252
+        $css = @file_get_contents($css_file);
253
+    } else {
254
+        $css = '';
255
+    }
256
+    $items_per_page = 30;
257
+    $count_pages = ceil(count($data_table) / $items_per_page);
258
+    for ($x = 0; $x<$count_pages; $x++) {
259
+        $content_table .= '<table width="100%" border="1" style="border-collapse:collapse">';
260
+        // header table
261
+        $content_table .= '<tr>';
262
+        $i = 0;
263
+        if (is_array($headers_table)) {
264
+            foreach ($headers_table as $head_table) {
265
+                if (!empty($head_table[0])) {
266
+                    $width = (!empty($head_table[1])?$head_table[1].'%':'');
267
+                    $content_table .= '<th width="'.$width.'">'.$head_table[0].'</th>';
268
+                    $i++;
269
+                }
270
+            }
271
+        }
272
+        $content_table .= '</tr>';
273
+        // body table
274 274
 
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));
278
-			$i = 1;
279
-			$item = $offset+1;
280
-			foreach ($data_table as $data) {
281
-				$content_table .= '<tr>';
282
-				$content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
283
-				foreach ($data as  $key => $content) {
284
-					if (isset($content)) {
285
-						$key == 1 ? $align='align="left"':$align='align="center"';
286
-						$content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
287
-					}
288
-				}
289
-				$content_table .= '</tr>';
290
-				$i++;
291
-				$item++;
292
-				if ($i > $items_per_page) { break; }
293
-			}
294
-		} else {
295
-			$content_table .= '<tr colspan="'.$i.'"><td>'.get_lang('Empty').'</td></tr>';
296
-		}
297
-		$content_table .= '</table>';
298
-		if ($x < ($count_pages - 1)) { $content_table .= '<pagebreak />'; }
299
-	}
300
-	$pdf = new PDF();
301
-	$pdf->set_custom_footer($footer);
302
-	$pdf->set_custom_header($headers_in_pdf);
303
-	$pdf->content_to_pdf($header.$content_table, $css, $title_pdf );
304
-	exit;
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));
278
+            $i = 1;
279
+            $item = $offset+1;
280
+            foreach ($data_table as $data) {
281
+                $content_table .= '<tr>';
282
+                $content_table .= '<td>'.($item<10?'0'.$item:$item).'</td>';
283
+                foreach ($data as  $key => $content) {
284
+                    if (isset($content)) {
285
+                        $key == 1 ? $align='align="left"':$align='align="center"';
286
+                        $content_table .= '<td '.$align.' style="padding:4px;" >'.$content.'</td>';
287
+                    }
288
+                }
289
+                $content_table .= '</tr>';
290
+                $i++;
291
+                $item++;
292
+                if ($i > $items_per_page) { break; }
293
+            }
294
+        } else {
295
+            $content_table .= '<tr colspan="'.$i.'"><td>'.get_lang('Empty').'</td></tr>';
296
+        }
297
+        $content_table .= '</table>';
298
+        if ($x < ($count_pages - 1)) { $content_table .= '<pagebreak />'; }
299
+    }
300
+    $pdf = new PDF();
301
+    $pdf->set_custom_footer($footer);
302
+    $pdf->set_custom_header($headers_in_pdf);
303
+    $pdf->content_to_pdf($header.$content_table, $css, $title_pdf );
304
+    exit;
305 305
 
306 306
 }
307 307
 
@@ -313,20 +313,20 @@  discard block
 block discarded – undo
313 313
  * @param	string		Format (portrait or landscape)
314 314
  */
315 315
 function export_pdf($pdf,$newarray,$header_names,$format) {
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');
319
-	$pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
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);
324
-	} else {
325
-		$pdf->line(40,540,790,540);
326
-		$pdf->line(40,40,790,40);
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')));
330
-	$pdf->ezStream();
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');
319
+    $pdf->selectFont(api_get_path(LIBRARY_PATH).'ezpdf/fonts/Courier.afm');
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);
324
+    } else {
325
+        $pdf->line(40,540,790,540);
326
+        $pdf->line(40,40,790,40);
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')));
330
+    $pdf->ezStream();
331 331
 
332 332
 }
Please login to merge, or discard this patch.
main/gradebook/lib/fe/linkaddeditform.class.php 2 patches
Indentation   +174 added lines, -174 removed lines patch added patch discarded remove patch
@@ -9,108 +9,108 @@  discard block
 block discarded – undo
9 9
  */
10 10
 class LinkAddEditForm extends FormValidator
11 11
 {
12
-	const TYPE_ADD  = 1;
13
-	const TYPE_EDIT = 2;
14
-
15
-	/**
16
-	 * Constructor
17
-	 * To add link, define category_object and link_type
18
-	 * To edit link, define link_object
19
-	 */
20
-	public function LinkAddEditForm(
21
-		$form_type,
22
-		$category_object,
23
-		$link_type,
24
-		$link_object,
25
-		$form_name,
26
-		$action = null
27
-	) {
28
-		parent :: __construct($form_name, 'post', $action);
29
-
30
-		// set or create link object
31
-		if (isset($link_object)) {
32
-			$link = $link_object;
33
-		} elseif (isset($link_type) && isset($category_object)) {
34
-			$link = LinkFactory :: create ($link_type);
35
-			$link->set_course_code(api_get_course_id());
36
-			$link->set_category_id($category_object[0]->get_id());
37
-		} else {
38
-			die ('LinkAddEditForm error: define link_type/category_object or link_object');
39
-		}
40
-
41
-		$defaults = array();
42
-		$this->addElement('hidden', 'zero', 0);
43
-
44
-		if (!empty($_GET['editlink'])) {
45
-			$this->addElement('header', '', get_lang('EditLink'));
46
-		}
47
-
48
-		// ELEMENT: name
49
-		if ($form_type == self :: TYPE_ADD || $link->is_allowed_to_change_name()) {
50
-			if ($link->needs_name_and_description()) {
51
-				$this->addText('name', get_lang('Name'), true, array('size'=>'40', 'maxlength'=>'40'));
52
-			} else {
53
-				$select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
54
-				foreach ($link->get_all_links() as $newlink) {
55
-					$select->addoption($newlink[1],$newlink[0]);
56
-				}
57
-			}
58
-		} else {
59
-			$this->addElement('label',get_lang('Name'),  '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
60
-			$this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
61
-		}
62
-
63
-		if (count($category_object) == 1) {
64
-			$this->addElement('hidden', 'select_gradebook', $category_object[0]->get_id());
65
-		} else {
66
-			$select_gradebook = $this->addElement(
67
-				'select',
68
-				'select_gradebook',
69
-				get_lang('SelectGradebook'),
70
-				array(),
71
-				array('id' => 'hide_category_id')
72
-			);
73
-			$this->addRule('select_gradebook', get_lang('ThisFieldIsRequired'), 'nonzero');
74
-
75
-			$default_weight = 0;
76
-			if (!empty($category_object)) {
77
-				foreach ($category_object as $my_cat) {
78
-
79
-					if ($my_cat->get_course_code() == api_get_course_id()) {
80
-						$grade_model_id = $my_cat->get_grade_model_id();
81
-						if (empty($grade_model_id)) {
82
-
83
-							if ($my_cat->get_parent_id() == 0 ) {
84
-								$default_weight = $my_cat->get_weight();
85
-								$select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
86
-							} else {
87
-								$select_gradebook->addoption($my_cat->get_name(), $my_cat->get_id());
88
-							}
89
-						} else {
90
-							$select_gradebook->addoption(get_lang('Select'), 0);
91
-						}
92
-						if ($link->get_category_id() == $my_cat->get_id()) {
93
-							$default_weight = $my_cat->get_weight();
94
-						}
95
-					}
96
-				}
97
-			}
98
-		}
99
-
100
-		$this->addText(
101
-			'weight_mask',
102
-			array(get_lang('Weight'), null, ' [0 .. <span id="max_weight">'.$category_object[0]->get_weight().'</span>] '),
103
-			true,
104
-			array(
105
-				'size' => '4',
106
-				'maxlength' => '5',
107
-				'class' => 'span1'
108
-			)
109
-		);
110
-
111
-		$this->addElement('hidden', 'weight');
112
-
113
-		/*
12
+    const TYPE_ADD  = 1;
13
+    const TYPE_EDIT = 2;
14
+
15
+    /**
16
+     * Constructor
17
+     * To add link, define category_object and link_type
18
+     * To edit link, define link_object
19
+     */
20
+    public function LinkAddEditForm(
21
+        $form_type,
22
+        $category_object,
23
+        $link_type,
24
+        $link_object,
25
+        $form_name,
26
+        $action = null
27
+    ) {
28
+        parent :: __construct($form_name, 'post', $action);
29
+
30
+        // set or create link object
31
+        if (isset($link_object)) {
32
+            $link = $link_object;
33
+        } elseif (isset($link_type) && isset($category_object)) {
34
+            $link = LinkFactory :: create ($link_type);
35
+            $link->set_course_code(api_get_course_id());
36
+            $link->set_category_id($category_object[0]->get_id());
37
+        } else {
38
+            die ('LinkAddEditForm error: define link_type/category_object or link_object');
39
+        }
40
+
41
+        $defaults = array();
42
+        $this->addElement('hidden', 'zero', 0);
43
+
44
+        if (!empty($_GET['editlink'])) {
45
+            $this->addElement('header', '', get_lang('EditLink'));
46
+        }
47
+
48
+        // ELEMENT: name
49
+        if ($form_type == self :: TYPE_ADD || $link->is_allowed_to_change_name()) {
50
+            if ($link->needs_name_and_description()) {
51
+                $this->addText('name', get_lang('Name'), true, array('size'=>'40', 'maxlength'=>'40'));
52
+            } else {
53
+                $select = $this->addElement('select', 'select_link', get_lang('ChooseItem'));
54
+                foreach ($link->get_all_links() as $newlink) {
55
+                    $select->addoption($newlink[1],$newlink[0]);
56
+                }
57
+            }
58
+        } else {
59
+            $this->addElement('label',get_lang('Name'),  '<span class="freeze">'.$link->get_name().' ['.$link->get_type_name().']</span>');
60
+            $this->addElement('hidden','name_link',$link->get_name(),array('id'=>'name_link'));
61
+        }
62
+
63
+        if (count($category_object) == 1) {
64
+            $this->addElement('hidden', 'select_gradebook', $category_object[0]->get_id());
65
+        } else {
66
+            $select_gradebook = $this->addElement(
67
+                'select',
68
+                'select_gradebook',
69
+                get_lang('SelectGradebook'),
70
+                array(),
71
+                array('id' => 'hide_category_id')
72
+            );
73
+            $this->addRule('select_gradebook', get_lang('ThisFieldIsRequired'), 'nonzero');
74
+
75
+            $default_weight = 0;
76
+            if (!empty($category_object)) {
77
+                foreach ($category_object as $my_cat) {
78
+
79
+                    if ($my_cat->get_course_code() == api_get_course_id()) {
80
+                        $grade_model_id = $my_cat->get_grade_model_id();
81
+                        if (empty($grade_model_id)) {
82
+
83
+                            if ($my_cat->get_parent_id() == 0 ) {
84
+                                $default_weight = $my_cat->get_weight();
85
+                                $select_gradebook->addoption(get_lang('Default'), $my_cat->get_id());
86
+                            } else {
87
+                                $select_gradebook->addoption($my_cat->get_name(), $my_cat->get_id());
88
+                            }
89
+                        } else {
90
+                            $select_gradebook->addoption(get_lang('Select'), 0);
91
+                        }
92
+                        if ($link->get_category_id() == $my_cat->get_id()) {
93
+                            $default_weight = $my_cat->get_weight();
94
+                        }
95
+                    }
96
+                }
97
+            }
98
+        }
99
+
100
+        $this->addText(
101
+            'weight_mask',
102
+            array(get_lang('Weight'), null, ' [0 .. <span id="max_weight">'.$category_object[0]->get_weight().'</span>] '),
103
+            true,
104
+            array(
105
+                'size' => '4',
106
+                'maxlength' => '5',
107
+                'class' => 'span1'
108
+            )
109
+        );
110
+
111
+        $this->addElement('hidden', 'weight');
112
+
113
+        /*
114 114
 
115 115
         // ELEMENT: weight
116 116
         $this->addText('weight', array(get_lang('Weight'), null, '/ <span id="max_weight">'.$default_weight.'</span>'), true, array (
@@ -119,76 +119,76 @@  discard block
 block discarded – undo
119 119
             'class' => 'span1'
120 120
         ));*/
121 121
 
122
-		$this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
123
-		$this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
124
-		if ($form_type == self :: TYPE_EDIT) {
125
-			$parent_cat = Category :: load($link->get_category_id());
126
-
127
-			if ($parent_cat[0]->get_parent_id() == 0) {
128
-				$values['weight'] = $link->get_weight();
129
-			} else {
130
-				$cat = Category :: load($parent_cat[0]->get_parent_id());
131
-				//$global_weight = $cat[0]->get_weight();
132
-				//$values['weight'] = $link->get_weight()/$parent_cat[0]->get_weight()*$global_weight;
133
-				//var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
134
-				//$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
135
-				//$values['weight'] = $weight;
136
-				$values['weight'] = $link->get_weight() ;
137
-			}
138
-			$defaults['weight_mask'] = $values['weight'] ;
139
-			$defaults['select_gradebook'] = $link->get_category_id();
140
-
141
-		}
142
-		// ELEMENT: max
143
-		if ($link->needs_max()) {
144
-			if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
145
-				$this->addText('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '5', 'disabled' => 'disabled'));
146
-			} else {
147
-				$this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
148
-				$this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
149
-				$this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
150
-			}
151
-			if ($form_type == self :: TYPE_EDIT) {
152
-				$defaults['max'] = $link->get_max();
153
-			}
154
-		}
155
-
156
-		// ELEMENT: description
157
-		if ($link->needs_name_and_description()) {
158
-			$this->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3','cols' => '34'));
159
-			if ($form_type == self :: TYPE_EDIT) {
160
-				$defaults['description'] = $link->get_description();
161
-			}
162
-		}
163
-
164
-		// ELEMENT: visible
165
-		$visible = ($form_type == self :: TYPE_EDIT && $link->is_visible()) ? '1' : '0';
166
-		$this->addElement('checkbox', 'visible', null, get_lang('Visible'), $visible);
167
-		if ($form_type == self :: TYPE_EDIT) {
168
-			$defaults['visible'] = $link->is_visible();
169
-		}
170
-
171
-		// ELEMENT: add results
172
-		if ($form_type == self :: TYPE_ADD && $link->needs_results()) {
173
-			$this->addElement('checkbox', 'addresult', get_lang('AddResult'));
174
-		}
175
-		// submit button
176
-		if ($form_type == self :: TYPE_ADD) {
177
-			$this->addButtonCreate(get_lang('CreateLink'));
178
-		} else {
179
-			$this->addButtonUpdate(get_lang('LinkMod'));
180
-		}
181
-
182
-		if ($form_type == self :: TYPE_ADD) {
183
-			$setting = api_get_setting('tool_visible_by_default_at_creation');
184
-			$visibility_default = 1;
185
-			if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
186
-				$visibility_default = 0;
187
-			}
188
-			$defaults['visible']  = $visibility_default;
189
-		}
190
-
191
-		// set default values
192
-		$this->setDefaults($defaults);
193
-	}
122
+        $this->addRule('weight_mask',get_lang('OnlyNumbers'),'numeric');
123
+        $this->addRule(array ('weight_mask', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
124
+        if ($form_type == self :: TYPE_EDIT) {
125
+            $parent_cat = Category :: load($link->get_category_id());
126
+
127
+            if ($parent_cat[0]->get_parent_id() == 0) {
128
+                $values['weight'] = $link->get_weight();
129
+            } else {
130
+                $cat = Category :: load($parent_cat[0]->get_parent_id());
131
+                //$global_weight = $cat[0]->get_weight();
132
+                //$values['weight'] = $link->get_weight()/$parent_cat[0]->get_weight()*$global_weight;
133
+                //var_dump($global_weight, $link->get_weight(), $parent_cat[0]->get_weight());
134
+                //$weight = $parent_cat[0]->get_weight()* $link->get_weight() / $global_weight;
135
+                //$values['weight'] = $weight;
136
+                $values['weight'] = $link->get_weight() ;
137
+            }
138
+            $defaults['weight_mask'] = $values['weight'] ;
139
+            $defaults['select_gradebook'] = $link->get_category_id();
140
+
141
+        }
142
+        // ELEMENT: max
143
+        if ($link->needs_max()) {
144
+            if ($form_type == self :: TYPE_EDIT && $link->has_results()) {
145
+                $this->addText('max', get_lang('QualificationNumeric'), false, array ('size' => '4','maxlength' => '5', 'disabled' => 'disabled'));
146
+            } else {
147
+                $this->addText('max', get_lang('QualificationNumeric'), true, array ('size' => '4','maxlength' => '5'));
148
+                $this->addRule('max', get_lang('OnlyNumbers'), 'numeric');
149
+                $this->addRule(array ('max', 'zero'), get_lang('NegativeValue'), 'compare', '>=');
150
+            }
151
+            if ($form_type == self :: TYPE_EDIT) {
152
+                $defaults['max'] = $link->get_max();
153
+            }
154
+        }
155
+
156
+        // ELEMENT: description
157
+        if ($link->needs_name_and_description()) {
158
+            $this->addElement('textarea', 'description', get_lang('Description'), array ('rows' => '3','cols' => '34'));
159
+            if ($form_type == self :: TYPE_EDIT) {
160
+                $defaults['description'] = $link->get_description();
161
+            }
162
+        }
163
+
164
+        // ELEMENT: visible
165
+        $visible = ($form_type == self :: TYPE_EDIT && $link->is_visible()) ? '1' : '0';
166
+        $this->addElement('checkbox', 'visible', null, get_lang('Visible'), $visible);
167
+        if ($form_type == self :: TYPE_EDIT) {
168
+            $defaults['visible'] = $link->is_visible();
169
+        }
170
+
171
+        // ELEMENT: add results
172
+        if ($form_type == self :: TYPE_ADD && $link->needs_results()) {
173
+            $this->addElement('checkbox', 'addresult', get_lang('AddResult'));
174
+        }
175
+        // submit button
176
+        if ($form_type == self :: TYPE_ADD) {
177
+            $this->addButtonCreate(get_lang('CreateLink'));
178
+        } else {
179
+            $this->addButtonUpdate(get_lang('LinkMod'));
180
+        }
181
+
182
+        if ($form_type == self :: TYPE_ADD) {
183
+            $setting = api_get_setting('tool_visible_by_default_at_creation');
184
+            $visibility_default = 1;
185
+            if (isset($setting['gradebook']) && $setting['gradebook'] == 'false') {
186
+                $visibility_default = 0;
187
+            }
188
+            $defaults['visible']  = $visibility_default;
189
+        }
190
+
191
+        // set default values
192
+        $this->setDefaults($defaults);
193
+    }
194 194
 }
Please login to merge, or discard this patch.
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 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -201,9 +201,9 @@  discard block
 block discarded – undo
201 201
             $myCache = new pCache(array('CacheFolder' => substr($cachePath, 0, strlen($cachePath) - 1)));
202 202
             $chartHash = $myCache->getHash($dataSet);
203 203
             if ($myCache->isInCache($chartHash)) {
204
-                $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
204
+                $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
205 205
                 $myCache->saveFromCache($chartHash, $imgPath);
206
-                $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
206
+                $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
207 207
             } else {
208 208
                 /* Create the pChart object */
209 209
                 $widthSize = 480;
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
                 /* Set the default font */
231 231
                 $myPicture->setFontProperties(
232 232
                     array(
233
-                        'FontName' => api_get_path(SYS_FONTS_PATH) . 'opensans/OpenSans-Regular.ttf',
233
+                        'FontName' => api_get_path(SYS_FONTS_PATH).'opensans/OpenSans-Regular.ttf',
234 234
                         'FontSize' => 10
235 235
                     )
236 236
                 );
@@ -302,11 +302,11 @@  discard block
 block discarded – undo
302 302
                 /* Render the picture (choose the best way) */
303 303
 
304 304
                 $myCache->writeToCache($chartHash, $myPicture);
305
-                $imgPath = api_get_path(SYS_ARCHIVE_PATH) . $chartHash;
305
+                $imgPath = api_get_path(SYS_ARCHIVE_PATH).$chartHash;
306 306
                 $myCache->saveFromCache($chartHash, $imgPath);
307
-                $imgPath = api_get_path(WEB_ARCHIVE_PATH) . $chartHash;
307
+                $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
308 308
             }
309
-            echo '<img src="' . $imgPath . '" >';
309
+            echo '<img src="'.$imgPath.'" >';
310 310
             if ($i % 2 == 0 && $i != 0) {
311 311
                 echo '<br /><br />';
312 312
             } else {
@@ -349,10 +349,10 @@  discard block
 block discarded – undo
349 349
             // previous X
350 350
             $header .= '<td style="width:100%;">';
351 351
             if ($this->offset >= GRADEBOOK_ITEM_LIMIT) {
352
-                $header .= '<a href="' . api_get_self()
353
-                    . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
354
-                    . '&offset=' . (($this->offset) - GRADEBOOK_ITEM_LIMIT)
355
-                    . (isset($_GET['search']) ? '&search=' . Security::remove_XSS($_GET['search']) : '') . '">'
352
+                $header .= '<a href="'.api_get_self()
353
+                    . '?selectcat='.Security::remove_XSS($_GET['selectcat'])
354
+                    . '&offset='.(($this->offset) - GRADEBOOK_ITEM_LIMIT)
355
+                    . (isset($_GET['search']) ? '&search='.Security::remove_XSS($_GET['search']) : '').'">'
356 356
                     . Display::return_icon('action_prev.png', get_lang('PreviousPage'), array(), 32)
357 357
                     . '</a>';
358 358
             } else {
@@ -364,10 +364,10 @@  discard block
 block discarded – undo
364 364
                 ($totalitems - (GRADEBOOK_ITEM_LIMIT + $this->offset)) : GRADEBOOK_ITEM_LIMIT;
365 365
 
366 366
             if ($calcnext > 0) {
367
-                $header .= '<a href="' . api_get_self()
368
-                    . '?selectcat=' . Security::remove_XSS($_GET['selectcat'])
369
-                    . '&offset=' . ($this->offset + GRADEBOOK_ITEM_LIMIT)
370
-                    . (isset($_GET['search']) ? '&search=' . Security::remove_XSS($_GET['search']) : '') . '">'
367
+                $header .= '<a href="'.api_get_self()
368
+                    . '?selectcat='.Security::remove_XSS($_GET['selectcat'])
369
+                    . '&offset='.($this->offset + GRADEBOOK_ITEM_LIMIT)
370
+                    . (isset($_GET['search']) ? '&search='.Security::remove_XSS($_GET['search']) : '').'">'
371 371
                     . Display::return_icon('action_next.png', get_lang('NextPage'), array(), 32)
372 372
                     . '</a>';
373 373
             } else {
@@ -475,6 +475,6 @@  discard block
 block discarded – undo
475 475
      */
476 476
     private function build_name_link($user_id, $name)
477 477
     {
478
-        return '<a href="user_stats.php?userid=' . $user_id . '&selectcat=' . $this->selectcat->get_id() . '&'.api_get_cidreq().'">' . $name . '</a>';
478
+        return '<a href="user_stats.php?userid='.$user_id.'&selectcat='.$this->selectcat->get_id().'&'.api_get_cidreq().'">'.$name.'</a>';
479 479
     }
480 480
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -149,8 +149,9 @@
 block discarded – undo
149 149
                 }
150 150
 
151 151
                 foreach ($customdisplays as $display) {
152
-                    if (!in_array($display['display'], $key_list))
153
-                        $resource_list[$key][$display['display']] = 0;
152
+                    if (!in_array($display['display'], $key_list)) {
153
+                                            $resource_list[$key][$display['display']] = 0;
154
+                    }
154 155
                 }
155 156
                 $i++;
156 157
             }
Please login to merge, or discard this patch.