Completed
Push — 1.11.x ( d84d27...922b6f )
by José
30:17
created
main/document/show_content.php 2 patches
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -91,11 +91,11 @@
 block discarded – undo
91 91
 $pathinfo = pathinfo($header_file);
92 92
 
93 93
 if ($pathinfo['extension']=='swf') {
94
-	$width='83%';
95
-	$height='83%';
94
+    $width='83%';
95
+    $height='83%';
96 96
 } else {
97
-	$width='100%';
98
-	$height='100%';
97
+    $width='100%';
98
+    $height='100%';
99 99
 }
100 100
 
101 101
 echo '<iframe border="0" frameborder="0" scrolling="no" style="width:'.$width.'; height:'.$height.';background-color:#ffffff;" id="mainFrame" name="mainFrame" src="'.$file_url_web.'?'.api_get_cidreq().'&amp;rand='.mt_rand(1, 1000).'"></iframe>';
Please login to merge, or discard this patch.
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -90,12 +90,12 @@
 block discarded – undo
90 90
 $file_url_web = api_get_path(WEB_COURSE_PATH).$_course['path'].'/document'.$header_file.'?'.api_get_cidreq();
91 91
 $pathinfo = pathinfo($header_file);
92 92
 
93
-if ($pathinfo['extension']=='swf') {
94
-	$width='83%';
95
-	$height='83%';
93
+if ($pathinfo['extension'] == 'swf') {
94
+	$width = '83%';
95
+	$height = '83%';
96 96
 } else {
97
-	$width='100%';
98
-	$height='100%';
97
+	$width = '100%';
98
+	$height = '100%';
99 99
 }
100 100
 
101 101
 echo '<iframe border="0" frameborder="0" scrolling="no" style="width:'.$width.'; height:'.$height.';background-color:#ffffff;" id="mainFrame" name="mainFrame" src="'.$file_url_web.'?'.api_get_cidreq().'&amp;rand='.mt_rand(1, 1000).'"></iframe>';
Please login to merge, or discard this patch.
main/admin/usergroups.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -15,16 +15,16 @@  discard block
 block discarded – undo
15 15
 //Add the JS needed to use the jqgrid
16 16
 $htmlHeadXtra[] = api_get_jqgrid_js();
17 17
 // setting breadcrumbs
18
-$interbreadcrumb[] = array('url' => 'index.php','name' => get_lang('PlatformAdmin'));
18
+$interbreadcrumb[] = array('url' => 'index.php', 'name' => get_lang('PlatformAdmin'));
19 19
 $action = isset($_GET['action']) ? $_GET['action'] : null;
20 20
 if ($action == 'add') {
21
-    $interbreadcrumb[] = array('url' => 'usergroups.php','name' => get_lang('Classes'));
22
-    $interbreadcrumb[] = array('url' => '#','name' => get_lang('Add'));
21
+    $interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
22
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Add'));
23 23
 } elseif ($action == 'edit') {
24
-    $interbreadcrumb[] = array('url' => 'usergroups.php','name' => get_lang('Classes'));
25
-    $interbreadcrumb[] = array('url' => '#','name' => get_lang('Edit'));
24
+    $interbreadcrumb[] = array('url' => 'usergroups.php', 'name' => get_lang('Classes'));
25
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Edit'));
26 26
 } else {
27
-    $interbreadcrumb[] = array('url' => '#','name' => get_lang('Classes'));
27
+    $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Classes'));
28 28
 }
29 29
 
30 30
 // The header.
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
 );
56 56
 
57 57
 //Column config
58
-$column_model   = array(
59
-    array('name'=>'name',           'index'=>'name',        'width'=>'35',  'align'=>'left'),
60
-    array('name'=>'users',    		'index'=>'users', 		'width'=>'15',  'align'=>'left'),
61
-    array('name'=>'courses',    	'index'=>'courses', 	'width'=>'15',  'align'=>'left'),
62
-    array('name'=>'sessions',    	'index'=>'sessions', 	'width'=>'15',  'align'=>'left'),
63
-    array('name'=>'group_type',    	'index'=>'group_type', 	'width'=>'15',  'align'=>'center'),
64
-    array('name'=>'actions',        'index'=>'actions',     'width'=>'20',  'align'=>'center', 'sortable'=>'false','formatter'=>'action_formatter'),
58
+$column_model = array(
59
+    array('name'=>'name', 'index'=>'name', 'width'=>'35', 'align'=>'left'),
60
+    array('name'=>'users', 'index'=>'users', 'width'=>'15', 'align'=>'left'),
61
+    array('name'=>'courses', 'index'=>'courses', 'width'=>'15', 'align'=>'left'),
62
+    array('name'=>'sessions', 'index'=>'sessions', 'width'=>'15', 'align'=>'left'),
63
+    array('name'=>'group_type', 'index'=>'group_type', 'width'=>'15', 'align'=>'center'),
64
+    array('name'=>'actions', 'index'=>'actions', 'width'=>'20', 'align'=>'center', 'sortable'=>'false', 'formatter'=>'action_formatter'),
65 65
 );
66 66
 
67 67
 //Autowidth
@@ -73,11 +73,11 @@  discard block
 block discarded – undo
73 73
 //With this function we can add actions to the jgrid
74 74
 $action_links = 'function action_formatter (cellvalue, options, rowObject) {
75 75
     return \''
76
-    .' <a href="add_users_to_usergroup.php?id=\'+options.rowId+\'">' . Display::return_icon('user_to_class.png', get_lang('SubscribeUsersToClass'), null, ICON_SIZE_MEDIUM) . '</a>'
77
-    .' <a href="add_courses_to_usergroup.php?id=\'+options.rowId+\'">' . Display::return_icon('course_to_class.png', get_lang('SubscribeClassToCourses'), null, ICON_SIZE_MEDIUM) . '</a>'
78
-    .' <a href="add_sessions_to_usergroup.php?id=\'+options.rowId+\'">' . Display::return_icon('sessions_to_class.png', get_lang('SubscribeClassToSessions'), null, ICON_SIZE_MEDIUM) . '</a>'
79
-    .' <a href="?action=edit&id=\'+options.rowId+\'">' . Display::return_icon('edit.png', get_lang('Edit'), null, ICON_SIZE_SMALL) . '</a>'
80
-    .' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"),ENT_QUOTES))."\'".')) return false;"  href="?action=delete&id=\'+options.rowId+\'">' . Display::return_icon('delete.png', get_lang('Delete'), null, ICON_SIZE_SMALL) . '</a>\';
76
+    .' <a href="add_users_to_usergroup.php?id=\'+options.rowId+\'">'.Display::return_icon('user_to_class.png', get_lang('SubscribeUsersToClass'), null, ICON_SIZE_MEDIUM).'</a>'
77
+    .' <a href="add_courses_to_usergroup.php?id=\'+options.rowId+\'">'.Display::return_icon('course_to_class.png', get_lang('SubscribeClassToCourses'), null, ICON_SIZE_MEDIUM).'</a>'
78
+    .' <a href="add_sessions_to_usergroup.php?id=\'+options.rowId+\'">'.Display::return_icon('sessions_to_class.png', get_lang('SubscribeClassToSessions'), null, ICON_SIZE_MEDIUM).'</a>'
79
+    .' <a href="?action=edit&id=\'+options.rowId+\'">'.Display::return_icon('edit.png', get_lang('Edit'), null, ICON_SIZE_SMALL).'</a>'
80
+    .' <a onclick="javascript:if(!confirm('."\'".addslashes(api_htmlentities(get_lang("ConfirmYourChoice"), ENT_QUOTES))."\'".')) return false;"  href="?action=delete&id=\'+options.rowId+\'">'.Display::return_icon('delete.png', get_lang('Delete'), null, ICON_SIZE_SMALL).'</a>\';
81 81
 }';
82 82
 
83 83
 ?>
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
     } else {
129 129
         echo '<div class="actions">';
130 130
         echo '<a href="'.api_get_self().'">'.
131
-                Display::return_icon('back.png',get_lang('Back'),'',ICON_SIZE_MEDIUM).'</a>';
131
+                Display::return_icon('back.png', get_lang('Back'), '', ICON_SIZE_MEDIUM).'</a>';
132 132
         echo '</div>';
133 133
         $token = Security::get_token();
134 134
         $form->addElement('hidden', 'sec_token');
Please login to merge, or discard this patch.
src/Chamilo/PageBundle/Controller/PageController.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@
 block discarded – undo
42 42
 
43 43
         return $this->render(
44 44
             '@ChamiloPage/latest.html.twig',
45
-            [ 'pages' => $pagesToShow ]
45
+            ['pages' => $pagesToShow]
46 46
         );
47 47
     }
48 48
 }
49 49
\ No newline at end of file
Please login to merge, or discard this patch.
src/Chamilo/CoreBundle/Menu/NavBuilder.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -136,7 +136,7 @@
 block discarded – undo
136 136
             );
137 137
             /** @var Category $category */
138 138
             foreach ($categories as $category) {
139
-                 $faq->addChild(
139
+                    $faq->addChild(
140 140
                     $category->getHeadline(),
141 141
                     array(
142 142
                         'route' => 'faq',
Please login to merge, or discard this patch.
main/inc/lib/formvalidator/Element/SelectAjax.php 1 patch
Spacing   +4 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $iso = api_get_language_isocode(api_get_interface_language());
26 26
         $languageCondition = '';
27 27
 
28
-        if (file_exists(api_get_path(SYS_PATH) . "web/assets/select2/dist/js/i18n/$iso.js")) {
28
+        if (file_exists(api_get_path(SYS_PATH)."web/assets/select2/dist/js/i18n/$iso.js")) {
29 29
             $html .= api_get_asset("select2/dist/js/i18n/$iso.js");
30 30
             $languageCondition = "language: '$iso',";
31 31
         }
@@ -50,8 +50,7 @@  discard block
 block discarded – undo
50 50
 
51 51
         //Get the minimumInputLength for select2
52 52
         $minimumInputLength = $this->getAttribute('minimumInputLength') > 3 ?
53
-            $this->getAttribute('minimumInputLength') :
54
-            3
53
+            $this->getAttribute('minimumInputLength') : 3
55 54
         ;
56 55
 
57 56
         $plHolder = $this->getAttribute('placeholder');
@@ -81,7 +80,7 @@  discard block
 block discarded – undo
81 80
         $multiple = $multiple ? 'true' : 'false';
82 81
 
83 82
         $max = $this->getAttribute('maximumSelectionLength');
84
-        $max = !empty($max) ? "maximumSelectionLength: $max, ": '';
83
+        $max = !empty($max) ? "maximumSelectionLength: $max, " : '';
85 84
 
86 85
         $html .= <<<JS
87 86
             <script>
@@ -125,7 +124,7 @@  discard block
 block discarded – undo
125 124
         $this->removeAttribute('url_function');
126 125
         $this->setAttribute('style', 'width: 100%;');
127 126
 
128
-        return parent::toHtml() . $html;
127
+        return parent::toHtml().$html;
129 128
     }
130 129
 
131 130
     /**
Please login to merge, or discard this patch.
main/gradebook/lib/be/attendancelink.class.php 2 patches
Indentation   +202 added lines, -202 removed lines patch added patch discarded remove patch
@@ -8,48 +8,48 @@  discard block
 block discarded – undo
8 8
  */
9 9
 class AttendanceLink extends AbstractLink
10 10
 {
11
-	private $attendance_table = null;
12
-	private $itemprop_table = null;
11
+    private $attendance_table = null;
12
+    private $itemprop_table = null;
13 13
 
14
-	/**
15
-	 * Constructor
16
-	 */
17
-	public function __construct()
18
-	{
19
-		parent::__construct();
20
-		$this->set_type(LINK_ATTENDANCE);
21
-	}
14
+    /**
15
+     * Constructor
16
+     */
17
+    public function __construct()
18
+    {
19
+        parent::__construct();
20
+        $this->set_type(LINK_ATTENDANCE);
21
+    }
22 22
 
23
-	/**
24
-	 * @return string
25
-	 */
26
-	public function get_type_name()
27
-	{
28
-		return get_lang('Attendance');
29
-	}
23
+    /**
24
+     * @return string
25
+     */
26
+    public function get_type_name()
27
+    {
28
+        return get_lang('Attendance');
29
+    }
30 30
 
31
-	/**
32
-	 * @return bool
33
-	 */
34
-	public function is_allowed_to_change_name()
35
-	{
36
-		return false;
37
-	}
31
+    /**
32
+     * @return bool
33
+     */
34
+    public function is_allowed_to_change_name()
35
+    {
36
+        return false;
37
+    }
38 38
 
39
-	/**
40
-	 * Generate an array of attendances that a teacher hasn't created a link for.
41
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
42
-	 * @todo seems to be depracated
43
-	 */
44
-	public function get_not_created_links()
45
-	{
46
-		return false;
47
-		if (empty($this->course_code)) {
48
-			die('Error in get_not_created_links() : course code not set');
49
-		}
50
-		$tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
39
+    /**
40
+     * Generate an array of attendances that a teacher hasn't created a link for.
41
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
42
+     * @todo seems to be depracated
43
+     */
44
+    public function get_not_created_links()
45
+    {
46
+        return false;
47
+        if (empty($this->course_code)) {
48
+            die('Error in get_not_created_links() : course code not set');
49
+        }
50
+        $tbl_grade_links = Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
51 51
 
52
-		$sql = 'SELECT att.id, att.name, att.attendance_qualify_title
52
+        $sql = 'SELECT att.id, att.name, att.attendance_qualify_title
53 53
 				FROM '.$this->get_attendance_table().' att
54 54
 				WHERE
55 55
 					att.c_id = '.$this->course_id.' AND
@@ -60,7 +60,7 @@  discard block
 block discarded – undo
60 60
 							course_code = "'.Database::escape_string($this->get_course_code()).'"
61 61
 					)
62 62
 				AND att.session_id='.api_get_session_id().'';
63
-		$result = Database::query($sql);
63
+        $result = Database::query($sql);
64 64
 
65 65
         $cats = array();
66 66
         while ($data = Database::fetch_array($result)) {
@@ -71,13 +71,13 @@  discard block
 block discarded – undo
71 71
             }
72 72
         }
73 73
 
74
-		return $cats;
75
-	}
74
+        return $cats;
75
+    }
76 76
 
77
-	/**
78
-	 * Generate an array of all attendances available.
79
-	 * @return array 2-dimensional array - every element contains 2 subelements (id, name)
80
-	 */
77
+    /**
78
+     * Generate an array of all attendances available.
79
+     * @return array 2-dimensional array - every element contains 2 subelements (id, name)
80
+     */
81 81
     public function get_all_links()
82 82
     {
83 83
         if (empty($this->course_code)) {
@@ -104,55 +104,55 @@  discard block
 block discarded – undo
104 104
         $my_cats = isset($cats) ? $cats : null;
105 105
 
106 106
         return $my_cats;
107
-	}
107
+    }
108 108
 
109
-	/**
110
-	 * Has anyone done this exercise yet ?
111
-	 */
112
-	public function has_results()
113
-	{
114
-		$tbl_attendance_result = Database :: get_course_table(TABLE_ATTENDANCE_RESULT);
115
-		$session_id = api_get_session_id();
116
-		$sql = 'SELECT count(*) AS number FROM '.$tbl_attendance_result."
109
+    /**
110
+     * Has anyone done this exercise yet ?
111
+     */
112
+    public function has_results()
113
+    {
114
+        $tbl_attendance_result = Database :: get_course_table(TABLE_ATTENDANCE_RESULT);
115
+        $session_id = api_get_session_id();
116
+        $sql = 'SELECT count(*) AS number FROM '.$tbl_attendance_result."
117 117
 				WHERE
118 118
 					session_id = $session_id AND
119 119
 					c_id = '.$this->course_id.' AND
120 120
 					attendance_id = '".intval($this->get_ref_id())."'";
121
-		$result = Database::query($sql);
122
-		$number = Database::fetch_row($result);
121
+        $result = Database::query($sql);
122
+        $number = Database::fetch_row($result);
123 123
 
124
-		return $number[0] != 0;
125
-	}
124
+        return $number[0] != 0;
125
+    }
126 126
 
127
-	/**
128
-	 * @param int $stud_id
129
-	 * @return array|null
130
-	 */
131
-	public function calc_score($stud_id = null, $type = null)
132
-	{
133
-		$tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT);
134
-		$session_id = api_get_session_id();
127
+    /**
128
+     * @param int $stud_id
129
+     * @return array|null
130
+     */
131
+    public function calc_score($stud_id = null, $type = null)
132
+    {
133
+        $tbl_attendance_result = Database::get_course_table(TABLE_ATTENDANCE_RESULT);
134
+        $session_id = api_get_session_id();
135 135
 
136
-		// get attendance qualify max
137
-		$sql = 'SELECT att.attendance_qualify_max
136
+        // get attendance qualify max
137
+        $sql = 'SELECT att.attendance_qualify_max
138 138
 		        FROM '.$this->get_attendance_table().' att
139 139
   				WHERE
140 140
   					att.c_id = '.$this->course_id.' AND
141 141
   					att.id = '.intval($this->get_ref_id()).' AND
142 142
   					att.session_id='.intval($session_id).'';
143
-		$query = Database::query($sql);
144
-		$attendance = Database::fetch_array($query, 'ASSOC');
143
+        $query = Database::query($sql);
144
+        $attendance = Database::fetch_array($query, 'ASSOC');
145 145
 
146
-		// Get results
147
-		$sql = 'SELECT *
146
+        // Get results
147
+        $sql = 'SELECT *
148 148
 		        FROM '.$tbl_attendance_result.'
149 149
   	    		WHERE c_id = '.$this->course_id.' AND attendance_id = '.intval($this->get_ref_id());
150
-		if (isset($stud_id)) {
151
-			$sql .= ' AND user_id = '.intval($stud_id);
152
-		}
153
-		$scores = Database::query($sql);
154
-		// for 1 student
155
-		if (isset($stud_id)) {
150
+        if (isset($stud_id)) {
151
+            $sql .= ' AND user_id = '.intval($stud_id);
152
+        }
153
+        $scores = Database::query($sql);
154
+        // for 1 student
155
+        if (isset($stud_id)) {
156 156
             if ($data = Database::fetch_array($scores, 'ASSOC')) {
157 157
                 return array(
158 158
                     $data['score'],
@@ -162,7 +162,7 @@  discard block
 block discarded – undo
162 162
                 //We sent the 0/attendance_qualify_max instead of null for correct calculations
163 163
                 return array(0, $attendance['attendance_qualify_max']);
164 164
             }
165
-		} else {
165
+        } else {
166 166
             // all students -> get average
167 167
             $students = array();  // user list, needed to make sure we only
168 168
             // take first attempts into account
@@ -171,144 +171,144 @@  discard block
 block discarded – undo
171 171
             $sumResult = 0;
172 172
             $bestResult = 0;
173 173
 
174
-			while ($data = Database::fetch_array($scores)) {
175
-				if (!(array_key_exists($data['user_id'], $students))) {
176
-					if ($attendance['attendance_qualify_max'] != 0) {
177
-						$students[$data['user_id']] = $data['score'];
178
-						$rescount++;
179
-						$sum += $data['score'] / $attendance['attendance_qualify_max'];
180
-						$sumResult += $data['score'];
181
-						if ($data['score'] > $bestResult) {
182
-							$bestResult = $data['score'];
183
-						}
184
-						$weight = $attendance['attendance_qualify_max'];
185
-					}
186
-				}
187
-			}
174
+            while ($data = Database::fetch_array($scores)) {
175
+                if (!(array_key_exists($data['user_id'], $students))) {
176
+                    if ($attendance['attendance_qualify_max'] != 0) {
177
+                        $students[$data['user_id']] = $data['score'];
178
+                        $rescount++;
179
+                        $sum += $data['score'] / $attendance['attendance_qualify_max'];
180
+                        $sumResult += $data['score'];
181
+                        if ($data['score'] > $bestResult) {
182
+                            $bestResult = $data['score'];
183
+                        }
184
+                        $weight = $attendance['attendance_qualify_max'];
185
+                    }
186
+                }
187
+            }
188 188
 
189
-			if ($rescount == 0) {
190
-				return null;
191
-			} else {
192
-				switch ($type) {
193
-					case 'best':
194
-						return array($bestResult, $weight);
195
-						break;
196
-					case 'average':
197
-						return array($sumResult / $rescount, $weight);
198
-						break;
199
-					case 'ranking':
200
-						return AbstractLink::getCurrentUserRanking($stud_id, $students);
201
-						break;
202
-					default:
203
-						return array($sum, $rescount);
204
-						break;
205
-				}
206
-			}
207
-		}
208
-	}
189
+            if ($rescount == 0) {
190
+                return null;
191
+            } else {
192
+                switch ($type) {
193
+                    case 'best':
194
+                        return array($bestResult, $weight);
195
+                        break;
196
+                    case 'average':
197
+                        return array($sumResult / $rescount, $weight);
198
+                        break;
199
+                    case 'ranking':
200
+                        return AbstractLink::getCurrentUserRanking($stud_id, $students);
201
+                        break;
202
+                    default:
203
+                        return array($sum, $rescount);
204
+                        break;
205
+                }
206
+            }
207
+        }
208
+    }
209 209
 
210
-	/**
211
-	 * Lazy load function to get the database table of the student publications
212
-	 */
213
-	private function get_attendance_table()
214
-	{
215
-		$this->attendance_table = Database::get_course_table(TABLE_ATTENDANCE);
216
-		return $this->attendance_table;
217
-	}
210
+    /**
211
+     * Lazy load function to get the database table of the student publications
212
+     */
213
+    private function get_attendance_table()
214
+    {
215
+        $this->attendance_table = Database::get_course_table(TABLE_ATTENDANCE);
216
+        return $this->attendance_table;
217
+    }
218 218
 
219
-	public function needs_name_and_description()
220
-	{
221
-		return false;
222
-	}
219
+    public function needs_name_and_description()
220
+    {
221
+        return false;
222
+    }
223 223
 
224
-	public function needs_max()
225
-	{
226
-		return false;
227
-	}
224
+    public function needs_max()
225
+    {
226
+        return false;
227
+    }
228 228
 
229
-	public function needs_results()
230
-	{
231
-		return false;
232
-	}
229
+    public function needs_results()
230
+    {
231
+        return false;
232
+    }
233 233
 
234
-	/**
235
-	 * @return string
236
-	 */
237
-	public function get_name()
238
-	{
239
-		$this->get_attendance_data();
240
-		$attendance_title = isset($this->attendance_data['name']) ? $this->attendance_data['name'] : '';
241
-		$attendance_qualify_title = isset($this->attendance_data['attendance_qualify_title']) ? $this->attendance_data['attendance_qualify_title'] : '';
242
-		if ( isset($attendance_qualify_title) && $attendance_qualify_title != '') {
243
-			return $this->attendance_data['attendance_qualify_title'];
244
-		} else {
245
-			return $attendance_title;
246
-		}
247
-	}
234
+    /**
235
+     * @return string
236
+     */
237
+    public function get_name()
238
+    {
239
+        $this->get_attendance_data();
240
+        $attendance_title = isset($this->attendance_data['name']) ? $this->attendance_data['name'] : '';
241
+        $attendance_qualify_title = isset($this->attendance_data['attendance_qualify_title']) ? $this->attendance_data['attendance_qualify_title'] : '';
242
+        if ( isset($attendance_qualify_title) && $attendance_qualify_title != '') {
243
+            return $this->attendance_data['attendance_qualify_title'];
244
+        } else {
245
+            return $attendance_title;
246
+        }
247
+    }
248 248
 
249
-	/**
250
-	 * @return string
251
-	 */
252
-	public function get_description()
253
-	{
254
-		return '';
255
-	}
249
+    /**
250
+     * @return string
251
+     */
252
+    public function get_description()
253
+    {
254
+        return '';
255
+    }
256 256
 
257
-	/**
258
-	 * Check if this still links to an exercise
259
-	 */
260
-	public function is_valid_link()
261
-	{
262
-		$session_id = api_get_session_id();
263
-		$sql = 'SELECT count(att.id) FROM '.$this->get_attendance_table().' att
257
+    /**
258
+     * Check if this still links to an exercise
259
+     */
260
+    public function is_valid_link()
261
+    {
262
+        $session_id = api_get_session_id();
263
+        $sql = 'SELECT count(att.id) FROM '.$this->get_attendance_table().' att
264 264
         		 WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' ';
265
-		$result = Database::query($sql);
266
-		$number = Database::fetch_row($result);
267
-		return ($number[0] != 0);
268
-	}
265
+        $result = Database::query($sql);
266
+        $number = Database::fetch_row($result);
267
+        return ($number[0] != 0);
268
+    }
269 269
 
270
-	public function get_test_id()
271
-	{
272
-		return 'DEBUG:ID';
273
-	}
270
+    public function get_test_id()
271
+    {
272
+        return 'DEBUG:ID';
273
+    }
274 274
 
275
-	public function get_link()
276
-	{
277
-		//it was extracts the attendance id
278
-		$session_id = api_get_session_id();
279
-		$sql = 'SELECT * FROM '.$this->get_attendance_table().' att
275
+    public function get_link()
276
+    {
277
+        //it was extracts the attendance id
278
+        $session_id = api_get_session_id();
279
+        $sql = 'SELECT * FROM '.$this->get_attendance_table().' att
280 280
     			WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' ';
281
-		$result = Database::query($sql);
282
-		$row = Database::fetch_array($result,'ASSOC');
283
-		$attendance_id = $row['id'];
284
-		$url = api_get_path(WEB_PATH).'main/attendance/index.php?action=attendance_sheet_list&gradebook=view&attendance_id='.$attendance_id.'&'.api_get_cidreq_params($this->get_course_code(), $session_id);
281
+        $result = Database::query($sql);
282
+        $row = Database::fetch_array($result,'ASSOC');
283
+        $attendance_id = $row['id'];
284
+        $url = api_get_path(WEB_PATH).'main/attendance/index.php?action=attendance_sheet_list&gradebook=view&attendance_id='.$attendance_id.'&'.api_get_cidreq_params($this->get_course_code(), $session_id);
285 285
 
286
-		return $url;
287
-	}
286
+        return $url;
287
+    }
288 288
 
289
-	/**
290
-	 * @return array|bool
291
-	 */
292
-	private function get_attendance_data()
293
-	{
294
-		$tbl_name = $this->get_attendance_table();
295
-		$session_id = api_get_session_id();
296
-		if ($tbl_name == '') {
297
-			return false;
298
-		} elseif (!isset($this->attendance_data)) {
299
-			$sql = 'SELECT * FROM '.$this->get_attendance_table().' att
289
+    /**
290
+     * @return array|bool
291
+     */
292
+    private function get_attendance_data()
293
+    {
294
+        $tbl_name = $this->get_attendance_table();
295
+        $session_id = api_get_session_id();
296
+        if ($tbl_name == '') {
297
+            return false;
298
+        } elseif (!isset($this->attendance_data)) {
299
+            $sql = 'SELECT * FROM '.$this->get_attendance_table().' att
300 300
 					WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' ';
301
-			$query = Database::query($sql);
302
-			$this->attendance_data = Database::fetch_array($query);
303
-		}
304
-		return $this->attendance_data;
305
-	}
301
+            $query = Database::query($sql);
302
+            $this->attendance_data = Database::fetch_array($query);
303
+        }
304
+        return $this->attendance_data;
305
+    }
306 306
 
307
-	/**
308
-	 * @return string
309
-	 */
310
-	public function get_icon_name()
311
-	{
312
-		return 'attendance';
313
-	}
307
+    /**
308
+     * @return string
309
+     */
310
+    public function get_icon_name()
311
+    {
312
+        return 'attendance';
313
+    }
314 314
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
             }
165 165
 		} else {
166 166
             // all students -> get average
167
-            $students = array();  // user list, needed to make sure we only
167
+            $students = array(); // user list, needed to make sure we only
168 168
             // take first attempts into account
169 169
             $rescount = 0;
170 170
             $sum = 0;
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
 		$this->get_attendance_data();
240 240
 		$attendance_title = isset($this->attendance_data['name']) ? $this->attendance_data['name'] : '';
241 241
 		$attendance_qualify_title = isset($this->attendance_data['attendance_qualify_title']) ? $this->attendance_data['attendance_qualify_title'] : '';
242
-		if ( isset($attendance_qualify_title) && $attendance_qualify_title != '') {
242
+		if (isset($attendance_qualify_title) && $attendance_qualify_title != '') {
243 243
 			return $this->attendance_data['attendance_qualify_title'];
244 244
 		} else {
245 245
 			return $attendance_title;
@@ -279,7 +279,7 @@  discard block
 block discarded – undo
279 279
 		$sql = 'SELECT * FROM '.$this->get_attendance_table().' att
280 280
     			WHERE att.c_id = '.$this->course_id.' AND att.id = '.intval($this->get_ref_id()).' ';
281 281
 		$result = Database::query($sql);
282
-		$row = Database::fetch_array($result,'ASSOC');
282
+		$row = Database::fetch_array($result, 'ASSOC');
283 283
 		$attendance_id = $row['id'];
284 284
 		$url = api_get_path(WEB_PATH).'main/attendance/index.php?action=attendance_sheet_list&gradebook=view&attendance_id='.$attendance_id.'&'.api_get_cidreq_params($this->get_course_code(), $session_id);
285 285
 
Please login to merge, or discard this patch.
main/gradebook/lib/GradebookUtils.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -251,7 +251,7 @@
 block discarded – undo
251 251
                     }
252 252
                 }
253 253
 
254
-               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&' . $courseParams.'">' .
254
+                $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&' . $courseParams.'">' .
255 255
                     Display::return_icon(
256 256
                         'percentage.png',
257 257
                         get_lang('EditAllWeights'),
Please login to merge, or discard this patch.
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -732,7 +732,7 @@
 block discarded – undo
732 732
     }
733 733
 
734 734
     /**
735
-     * @param null $course_code
735
+     * @param string $course_code
736 736
      * @param int $gradebook_model_id
737 737
      * @return mixed
738 738
      */
Please login to merge, or discard this patch.
Spacing   +87 added lines, -87 removed lines patch added patch discarded remove patch
@@ -78,9 +78,9 @@  discard block
 block discarded – undo
78 78
         $course_code = Database::escape_string($course_code);
79 79
         if (!empty($link_id)) {
80 80
             $link_id = intval($link_id);
81
-            $sql = 'UPDATE ' . Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK) . '
82
-                    SET weight = ' . "'" . Database::escape_string((float) $weight) . "'" . '
83
-                    WHERE course_code = "' . $course_code . '" AND id = ' . $link_id;
81
+            $sql = 'UPDATE '.Database :: get_main_table(TABLE_MAIN_GRADEBOOK_LINK).'
82
+                    SET weight = ' . "'".Database::escape_string((float) $weight)."'".'
83
+                    WHERE course_code = "' . $course_code.'" AND id = '.$link_id;
84 84
             Database::query($sql);
85 85
         }
86 86
 
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
 
101 101
         // TODO find the corresponding category (the first one for this course, ordered by ID)
102 102
         $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
103
-        $sql = "DELETE FROM $l WHERE id = ".(int)$link_id;
103
+        $sql = "DELETE FROM $l WHERE id = ".(int) $link_id;
104 104
         Database::query($sql);
105 105
 
106 106
         return true;
@@ -195,8 +195,8 @@  discard block
 block discarded – undo
195 195
             $visibility_icon = ($cat->is_visible() == 0) ? 'invisible' : 'visible';
196 196
             $visibility_command = ($cat->is_visible() == 0) ? 'set_visible' : 'set_invisible';
197 197
 
198
-            $modify_icons .= '<a class="view_children" data-cat-id="' . $cat->get_id() . '" href="javascript:void(0);">' .
199
-                Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL) . '</a>';
198
+            $modify_icons .= '<a class="view_children" data-cat-id="'.$cat->get_id().'" href="javascript:void(0);">'.
199
+                Display::return_icon('view_more_stats.gif', get_lang('Show'), '', ICON_SIZE_SMALL).'</a>';
200 200
 
201 201
             if (!api_is_allowed_to_edit(null, true)) {
202 202
                 $modify_icons .= Display::url(
@@ -206,9 +206,9 @@  discard block
 block discarded – undo
206 206
                         '',
207 207
                         ICON_SIZE_SMALL
208 208
                     ),
209
-                    'personal_stats.php?' . http_build_query([
209
+                    'personal_stats.php?'.http_build_query([
210 210
                         'selectcat' => $cat->get_id()
211
-                    ]) . '&' . api_get_cidreq(),
211
+                    ]).'&'.api_get_cidreq(),
212 212
                     [
213 213
                         'class' => 'ajax',
214 214
                         'data-title' => get_lang('FlatView')
@@ -223,16 +223,16 @@  discard block
 block discarded – undo
223 223
                 if (api_get_setting('gradebook_locking_enabled') == 'true') {
224 224
                     if ($cat->is_locked()) {
225 225
                         if (api_is_platform_admin()) {
226
-                            $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToUnlockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=unlock">' .
227
-                                Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL) . '</a>';
226
+                            $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToUnlockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=unlock">'.
227
+                                Display::return_icon('lock.png', get_lang('UnLockEvaluation'), '', ICON_SIZE_SMALL).'</a>';
228 228
                         } else {
229
-                            $modify_icons .= '&nbsp;<a href="#">' . Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL) . '</a>';
229
+                            $modify_icons .= '&nbsp;<a href="#">'.Display::return_icon('lock_na.png', get_lang('GradebookLockedAlert'), '', ICON_SIZE_SMALL).'</a>';
230 230
                         }
231
-                        $modify_icons .= '&nbsp;<a href="gradebook_flatview.php?export_pdf=category&selectcat=' . $cat->get_id() . '" >' . Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>';
231
+                        $modify_icons .= '&nbsp;<a href="gradebook_flatview.php?export_pdf=category&selectcat='.$cat->get_id().'" >'.Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
232 232
                     } else {
233
-                        $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\'' . addslashes(get_lang('ConfirmToLockElement')) . '\')) return false;" href="' . api_get_self() . '?' . api_get_cidreq() . '&category_id=' . $cat->get_id() . '&action=lock">' .
234
-                            Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL) . '</a>';
235
-                        $modify_icons .= '&nbsp;<a href="#" >' . Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL) . '</a>';
233
+                        $modify_icons .= '&nbsp;<a onclick="javascript:if (!confirm(\''.addslashes(get_lang('ConfirmToLockElement')).'\')) return false;" href="'.api_get_self().'?'.api_get_cidreq().'&category_id='.$cat->get_id().'&action=lock">'.
234
+                            Display::return_icon('unlock.png', get_lang('LockEvaluation'), '', ICON_SIZE_SMALL).'</a>';
235
+                        $modify_icons .= '&nbsp;<a href="#" >'.Display::return_icon('pdf_na.png', get_lang('ExportToPDF'), '', ICON_SIZE_SMALL).'</a>';
236 236
                     }
237 237
                 }
238 238
 
@@ -240,44 +240,44 @@  discard block
 block discarded – undo
240 240
                     if ($cat->is_locked() && !api_is_platform_admin()) {
241 241
                         $modify_icons .= Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
242 242
                     } else {
243
-                        $modify_icons .= '<a href="gradebook_edit_cat.php?editcat=' . $cat->get_id() . '&'.$courseParams.'">' .
243
+                        $modify_icons .= '<a href="gradebook_edit_cat.php?editcat='.$cat->get_id().'&'.$courseParams.'">'.
244 244
                             Display::return_icon(
245 245
                                 'edit.png',
246 246
                                 get_lang('Modify'),
247 247
                                 '',
248 248
                                 ICON_SIZE_SMALL
249
-                            ) . '</a>';
249
+                            ).'</a>';
250 250
                     }
251 251
                 }
252 252
 
253
-               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat=' .$cat->get_id() . '&' . $courseParams.'">' .
253
+               $modify_icons .= '<a href="gradebook_edit_all.php?selectcat='.$cat->get_id().'&'.$courseParams.'">'.
254 254
                     Display::return_icon(
255 255
                         'percentage.png',
256 256
                         get_lang('EditAllWeights'),
257 257
                         '',
258 258
                         ICON_SIZE_SMALL
259
-                    ) . '</a>';
259
+                    ).'</a>';
260 260
 
261
-                $modify_icons .= '<a href="gradebook_flatview.php?selectcat=' .$cat->get_id() . '&' . $courseParams. '">' .
261
+                $modify_icons .= '<a href="gradebook_flatview.php?selectcat='.$cat->get_id().'&'.$courseParams.'">'.
262 262
                     Display::return_icon(
263 263
                         'stats.png',
264 264
                         get_lang('FlatView'),
265 265
                         '',
266 266
                         ICON_SIZE_SMALL
267
-                    ) . '</a>';
268
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() .'?visiblecat=' . $cat->get_id() . '&' .$visibility_command . '=&selectcat=' . $selectcat .'&' . $courseParams. '">' .
267
+                    ).'</a>';
268
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visiblecat='.$cat->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&'.$courseParams.'">'.
269 269
                     Display::return_icon(
270
-                        $visibility_icon . '.png',
270
+                        $visibility_icon.'.png',
271 271
                         get_lang('Visible'),
272 272
                         '',
273 273
                         ICON_SIZE_SMALL
274
-                    ) . '</a>';
274
+                    ).'</a>';
275 275
 
276 276
                 if ($cat->is_locked() && !api_is_platform_admin()) {
277 277
                     $modify_icons .= Display::return_icon('delete_na.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL);
278 278
                 } else {
279
-                    $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletecat=' . $cat->get_id() . '&selectcat=' . $selectcat . '&' . $courseParams. '" onclick="return confirmation();">' .
280
-                        Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL) . '</a>';
279
+                    $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deletecat='.$cat->get_id().'&selectcat='.$selectcat.'&'.$courseParams.'" onclick="return confirmation();">'.
280
+                        Display::return_icon('delete.png', get_lang('DeleteAll'), '', ICON_SIZE_SMALL).'</a>';
281 281
                 }
282 282
             }
283 283
 
@@ -304,22 +304,22 @@  discard block
 block discarded – undo
304 304
             if ($is_locked && !api_is_platform_admin()) {
305 305
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
306 306
             } else {
307
-                $modify_icons = '<a href="gradebook_edit_eval.php?editeval=' . $eval->get_id() . '&' . $courseParams. '">' .
308
-                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
307
+                $modify_icons = '<a href="gradebook_edit_eval.php?editeval='.$eval->get_id().'&'.$courseParams.'">'.
308
+                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
309 309
             }
310 310
 
311
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visibleeval=' . $eval->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&'.$courseParams. ' ">' .
312
-                Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
311
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visibleeval='.$eval->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&'.$courseParams.' ">'.
312
+                Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>';
313 313
             if (api_is_allowed_to_edit(null, true)) {
314
-                $modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &' . $courseParams. '">' .
315
-                    Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
314
+                $modify_icons .= '&nbsp;<a href="gradebook_showlog_eval.php?visiblelog='.$eval->get_id().'&selectcat='.$selectcat.' &'.$courseParams.'">'.
315
+                    Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>';
316 316
             }
317 317
 
318 318
             if ($is_locked && !api_is_platform_admin()) {
319
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
319
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
320 320
             } else {
321
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deleteeval=' . $eval->get_id() . '&selectcat=' . $selectcat . ' &' . $courseParams. '" onclick="return confirmation();">' .
322
-                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
321
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deleteeval='.$eval->get_id().'&selectcat='.$selectcat.' &'.$courseParams.'" onclick="return confirmation();">'.
322
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
323 323
             }
324 324
             return $modify_icons;
325 325
         }
@@ -351,21 +351,21 @@  discard block
 block discarded – undo
351 351
             if ($is_locked && !api_is_platform_admin()) {
352 352
                 $modify_icons = Display::return_icon('edit_na.png', get_lang('Modify'), '', ICON_SIZE_SMALL);
353 353
             } else {
354
-                $modify_icons = '<a href="gradebook_edit_link.php?editlink=' . $link->get_id() . '&' . $courseParams.'">' .
355
-                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL) . '</a>';
354
+                $modify_icons = '<a href="gradebook_edit_link.php?editlink='.$link->get_id().'&'.$courseParams.'">'.
355
+                    Display::return_icon('edit.png', get_lang('Modify'), '', ICON_SIZE_SMALL).'</a>';
356 356
             }
357
-            $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?visiblelink=' . $link->get_id() . '&' . $visibility_command . '=&selectcat=' . $selectcat . '&'.$courseParams. ' ">' .
358
-                Display::return_icon($visibility_icon . '.png', get_lang('Visible'), '', ICON_SIZE_SMALL) . '</a>';
359
-            $modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink=' . $link->get_id() . '&selectcat=' . $selectcat . '&' . $courseParams. '">' .
360
-                Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL) . '</a>';
357
+            $modify_icons .= '&nbsp;<a href="'.api_get_self().'?visiblelink='.$link->get_id().'&'.$visibility_command.'=&selectcat='.$selectcat.'&'.$courseParams.' ">'.
358
+                Display::return_icon($visibility_icon.'.png', get_lang('Visible'), '', ICON_SIZE_SMALL).'</a>';
359
+            $modify_icons .= '&nbsp;<a href="gradebook_showlog_link.php?visiblelink='.$link->get_id().'&selectcat='.$selectcat.'&'.$courseParams.'">'.
360
+                Display::return_icon('history.png', get_lang('GradebookQualifyLog'), '', ICON_SIZE_SMALL).'</a>';
361 361
 
362 362
             //If a work is added in a gradebook you can only delete the link in the work tool
363 363
 
364 364
             if ($is_locked && !api_is_platform_admin()) {
365
-                $modify_icons .= '&nbsp;' . Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
365
+                $modify_icons .= '&nbsp;'.Display::return_icon('delete_na.png', get_lang('Delete'), '', ICON_SIZE_SMALL);
366 366
             } else {
367
-                $modify_icons .= '&nbsp;<a href="' . api_get_self() . '?deletelink=' . $link->get_id() . '&selectcat=' . $selectcat . ' &' . $courseParams. '" onclick="return confirmation();">' .
368
-                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
367
+                $modify_icons .= '&nbsp;<a href="'.api_get_self().'?deletelink='.$link->get_id().'&selectcat='.$selectcat.' &'.$courseParams.'" onclick="return confirmation();">'.
368
+                    Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
369 369
             }
370 370
 
371 371
             return $modify_icons;
@@ -388,8 +388,8 @@  discard block
 block discarded – undo
388 388
         $sql = "SELECT * FROM $table l
389 389
                 WHERE
390 390
                     course_code = '$course_code' AND
391
-                    type = ".(int)$resource_type . " AND
392
-                    ref_id = " . (int)$resource_id;
391
+                    type = ".(int) $resource_type." AND
392
+                    ref_id = " . (int) $resource_id;
393 393
         $res = Database::query($sql);
394 394
 
395 395
         if (Database::num_rows($res) < 1) {
@@ -412,7 +412,7 @@  discard block
 block discarded – undo
412 412
         }
413 413
         // TODO find the corresponding category (the first one for this course, ordered by ID)
414 414
         $l = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
415
-        $sql = "SELECT * FROM $l WHERE id = " . (int) $link_id;
415
+        $sql = "SELECT * FROM $l WHERE id = ".(int) $link_id;
416 416
         $res = Database::query($sql);
417 417
         $row = array();
418 418
         if (Database::num_rows($res) > 0) {
@@ -430,10 +430,10 @@  discard block
 block discarded – undo
430 430
     {
431 431
         $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
432 432
         $tbl_grade_links = Database::get_main_table(TABLE_MAIN_GRADEBOOK_LINK);
433
-        $sql = 'SELECT c.id FROM ' . $course_table . ' c
434
-                INNER JOIN ' . $tbl_grade_links . ' l
433
+        $sql = 'SELECT c.id FROM '.$course_table.' c
434
+                INNER JOIN ' . $tbl_grade_links.' l
435 435
                 ON c.code = l.course_code
436
-                WHERE l.id=' . intval($id_link) . ' OR l.category_id=' . intval($id_link);
436
+                WHERE l.id=' . intval($id_link).' OR l.category_id='.intval($id_link);
437 437
         $res = Database::query($sql);
438 438
         $array = Database::fetch_array($res, 'ASSOC');
439 439
         return $array['id'];
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
     {
543 543
         $result = Result :: load($resid);
544 544
         if ($importscore > $eval_max) {
545
-            header('Location: gradebook_view_result.php?selecteval=' . Security::remove_XSS($_GET['selecteval']) . '&overwritemax=');
545
+            header('Location: gradebook_view_result.php?selecteval='.Security::remove_XSS($_GET['selecteval']).'&overwritemax=');
546 546
             exit;
547 547
         }
548 548
         $result[0]->set_score($importscore);
@@ -588,8 +588,8 @@  discard block
 block discarded – undo
588 588
     ) {
589 589
         $table = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
590 590
         $sql = 'SELECT COUNT(id) as count
591
-                FROM ' . $table . ' gc
592
-                WHERE gc.cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '" ';
591
+                FROM ' . $table.' gc
592
+                WHERE gc.cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'" ';
593 593
         $rs_exist = Database::query($sql);
594 594
         $row = Database::fetch_array($rs_exist);
595 595
         if ($row['count'] == 0) {
@@ -612,8 +612,8 @@  discard block
 block discarded – undo
612 612
     public static function get_certificate_by_user_id($cat_id, $user_id)
613 613
     {
614 614
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
615
-        $sql = 'SELECT * FROM ' . $table_certificate . '
616
-                WHERE cat_id="' . intval($cat_id) . '" AND user_id="' . intval($user_id) . '"';
615
+        $sql = 'SELECT * FROM '.$table_certificate.'
616
+                WHERE cat_id="' . intval($cat_id).'" AND user_id="'.intval($user_id).'"';
617 617
 
618 618
         $result = Database::query($sql);
619 619
         $row = Database::fetch_array($result, 'ASSOC');
@@ -632,18 +632,18 @@  discard block
 block discarded – undo
632 632
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
633 633
         $table_user = Database::get_main_table(TABLE_MAIN_USER);
634 634
         $sql = 'SELECT DISTINCT u.user_id, u.lastname, u.firstname, u.username
635
-                FROM ' . $table_user . ' u
636
-                INNER JOIN ' . $table_certificate . ' gc
635
+                FROM ' . $table_user.' u
636
+                INNER JOIN ' . $table_certificate.' gc
637 637
                 ON u.user_id=gc.user_id ';
638 638
         if (!is_null($cat_id) && $cat_id > 0) {
639
-            $sql.=' WHERE cat_id=' . intval($cat_id);
639
+            $sql .= ' WHERE cat_id='.intval($cat_id);
640 640
         }
641 641
         if (!empty($userList)) {
642 642
             $userList = array_map('intval', $userList);
643 643
             $userListCondition = implode("','", $userList);
644 644
             $sql .= " AND u.user_id IN ('$userListCondition')";
645 645
         }
646
-        $sql.=' ORDER BY u.firstname';
646
+        $sql .= ' ORDER BY u.firstname';
647 647
         $rs = Database::query($sql);
648 648
 
649 649
         $list_users = array();
@@ -664,10 +664,10 @@  discard block
 block discarded – undo
664 664
     {
665 665
         $table_certificate = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CERTIFICATE);
666 666
         $sql = 'SELECT gc.score_certificate, gc.created_at, gc.path_certificate, gc.cat_id, gc.user_id, gc.id
667
-                FROM  ' . $table_certificate . ' gc
668
-                WHERE gc.user_id="' . intval($user_id) . '" ';
667
+                FROM  ' . $table_certificate.' gc
668
+                WHERE gc.user_id="' . intval($user_id).'" ';
669 669
         if (!is_null($cat_id) && $cat_id > 0) {
670
-            $sql.=' AND cat_id=' . intval($cat_id);
670
+            $sql .= ' AND cat_id='.intval($cat_id);
671 671
         }
672 672
 
673 673
         $rs = Database::query($sql);
@@ -693,12 +693,12 @@  discard block
 block discarded – undo
693 693
         $content_html = DocumentManager::replace_user_info_into_html($user_id, $course_code, $sessionId, $is_preview);
694 694
         $new_content_html = isset($content_html['content']) ? $content_html['content'] : null;
695 695
         $variables = isset($content_html['variables']) ? $content_html['variables'] : null;
696
-        $path_image = api_get_path(WEB_COURSE_PATH) . api_get_course_path($course_code) . '/document/images/gallery';
696
+        $path_image = api_get_path(WEB_COURSE_PATH).api_get_course_path($course_code).'/document/images/gallery';
697 697
         $new_content_html = str_replace('../images/gallery', $path_image, $new_content_html);
698 698
 
699
-        $path_image_in_default_course = api_get_path(WEB_CODE_PATH) . 'default_course_document';
699
+        $path_image_in_default_course = api_get_path(WEB_CODE_PATH).'default_course_document';
700 700
         $new_content_html = str_replace('/main/default_course_document', $path_image_in_default_course, $new_content_html);
701
-        $new_content_html = str_replace(SYS_CODE_PATH . 'img/', api_get_path(WEB_IMG_PATH), $new_content_html);
701
+        $new_content_html = str_replace(SYS_CODE_PATH.'img/', api_get_path(WEB_IMG_PATH), $new_content_html);
702 702
 
703 703
         $dom = new DOMDocument();
704 704
         @$dom->loadHTML($new_content_html);
@@ -747,9 +747,9 @@  discard block
 block discarded – undo
747 747
             $session_id = api_get_session_id();
748 748
 
749 749
             $t = Database::get_main_table(TABLE_MAIN_GRADEBOOK_CATEGORY);
750
-            $sql = "SELECT * FROM $t WHERE course_code = '" . Database::escape_string($course_code) . "' ";
750
+            $sql = "SELECT * FROM $t WHERE course_code = '".Database::escape_string($course_code)."' ";
751 751
             if (!empty($session_id)) {
752
-                $sql .= " AND session_id = " . (int) $session_id;
752
+                $sql .= " AND session_id = ".(int) $session_id;
753 753
             } else {
754 754
                 $sql .= " AND (session_id IS NULL OR session_id = 0) ";
755 755
             }
@@ -761,7 +761,7 @@  discard block
 block discarded – undo
761 761
                 if (!empty($session_id)) {
762 762
                     $my_session_id = api_get_session_id();
763 763
                     $s_name = api_get_session_name($my_session_id);
764
-                    $cat->set_name($course_code . ' - ' . get_lang('Session') . ' ' . $s_name);
764
+                    $cat->set_name($course_code.' - '.get_lang('Session').' '.$s_name);
765 765
                     $cat->set_session_id($session_id);
766 766
                 } else {
767 767
                     $cat->set_name($course_code);
@@ -883,13 +883,13 @@  discard block
 block discarded – undo
883 883
 
884 884
         if ($use_grade_model) {
885 885
             if ($parent_id == 0) {
886
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
886
+                $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed');
887 887
             } else {
888
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . $cat[0]->get_description() . ' - (' . $cat[0]->get_name() . ')';
888
+                $title = api_strtoupper(get_lang('Average')).'<br />'.$cat[0]->get_description().' - ('.$cat[0]->get_name().')';
889 889
             }
890 890
         } else {
891 891
             if ($parent_id == 0) {
892
-                $title = api_strtoupper(get_lang('Average')) . '<br />' . get_lang('Detailed');
892
+                $title = api_strtoupper(get_lang('Average')).'<br />'.get_lang('Detailed');
893 893
             } else {
894 894
                 $title = api_strtoupper(get_lang('Average'));
895 895
             }
@@ -943,11 +943,11 @@  discard block
 block discarded – undo
943 943
         } else {
944 944
             $column = 0;
945 945
             $table->setCellContents($row, $column, get_lang('NoResults'));
946
-            $table->updateCellAttributes($row, $column, 'colspan="' . $columns . '" align="center" class="row_odd"');
946
+            $table->updateCellAttributes($row, $column, 'colspan="'.$columns.'" align="center" class="row_odd"');
947 947
         }
948 948
 
949 949
         $pdfParams = array(
950
-            'filename' => get_lang('FlatView') . '_' . api_get_utc_datetime(),
950
+            'filename' => get_lang('FlatView').'_'.api_get_utc_datetime(),
951 951
             'pdf_title' => $title,
952 952
             'course_code' => $course_code,
953 953
             'add_signatures' => true
@@ -1032,7 +1032,7 @@  discard block
 block discarded – undo
1032 1032
         $a_students = array();
1033 1033
         while ($user = Database::fetch_array($result)) {
1034 1034
             if (!array_key_exists($user['user_id'], $a_students)) {
1035
-                $a_current_student = array ();
1035
+                $a_current_student = array();
1036 1036
                 $a_current_student[] = $user['user_id'];
1037 1037
                 $a_current_student[] = $user['username'];
1038 1038
                 $a_current_student[] = $user['lastname'];
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
         foreach ($links as $link) {
1090 1090
             // links are always in a course
1091 1091
             $coursecode = $link->get_course_code();
1092
-            if (!array_key_exists($coursecode,$coursecodes)) {
1092
+            if (!array_key_exists($coursecode, $coursecodes)) {
1093 1093
                 $coursecodes[$coursecode] = '1';
1094 1094
                 $users = array_merge($users, GradebookUtils::get_users_in_course($coursecode));
1095 1095
             }
@@ -1102,7 +1102,7 @@  discard block
 block discarded – undo
1102 1102
      * Search students matching a given last name and/or first name
1103 1103
      * @author Bert Steppé
1104 1104
      */
1105
-    public static function find_students($mask= '')
1105
+    public static function find_students($mask = '')
1106 1106
     {
1107 1107
         // students shouldn't be here // don't search if mask empty
1108 1108
         if (!api_is_allowed_to_edit() || empty ($mask)) {
@@ -1113,23 +1113,23 @@  discard block
 block discarded – undo
1113 1113
         $tbl_user = Database :: get_main_table(TABLE_MAIN_USER);
1114 1114
         $tbl_cru = Database :: get_main_table(TABLE_MAIN_COURSE_USER);
1115 1115
         $sql = 'SELECT DISTINCT user.user_id, user.lastname, user.firstname, user.email, user.official_code
1116
-                FROM ' . $tbl_user . ' user';
1116
+                FROM ' . $tbl_user.' user';
1117 1117
         if (!api_is_platform_admin()) {
1118
-            $sql .= ', ' . $tbl_cru . ' cru';
1118
+            $sql .= ', '.$tbl_cru.' cru';
1119 1119
         }
1120 1120
 
1121
-        $sql .= ' WHERE user.status = ' . STUDENT;
1122
-        $sql .= ' AND (user.lastname LIKE '."'%" . $mask . "%'";
1123
-        $sql .= ' OR user.firstname LIKE '."'%" . $mask . "%')";
1121
+        $sql .= ' WHERE user.status = '.STUDENT;
1122
+        $sql .= ' AND (user.lastname LIKE '."'%".$mask."%'";
1123
+        $sql .= ' OR user.firstname LIKE '."'%".$mask."%')";
1124 1124
 
1125 1125
         if (!api_is_platform_admin()) {
1126 1126
             $sql .= ' AND user.user_id = cru.user_id AND
1127 1127
                       cru.relation_type <> '.COURSE_RELATION_TYPE_RRHH.' AND
1128 1128
                       cru.c_id in (
1129
-                            SELECT c_id FROM '.$tbl_cru . '
1129
+                            SELECT c_id FROM '.$tbl_cru.'
1130 1130
                             WHERE
1131
-                                user_id = ' . api_get_user_id() . ' AND
1132
-                                status = ' . COURSEMANAGER . '
1131
+                                user_id = ' . api_get_user_id().' AND
1132
+                                status = ' . COURSEMANAGER.'
1133 1133
                         )
1134 1134
                     ';
1135 1135
         }
@@ -1171,7 +1171,7 @@  discard block
 block discarded – undo
1171 1171
         $sql = 'SELECT ref_id FROM '.$table_link.'
1172 1172
                 WHERE id = '.$linkId.' AND type='.LINK_ATTENDANCE;
1173 1173
 
1174
-        $rs_attendance  = Database::query($sql);
1174
+        $rs_attendance = Database::query($sql);
1175 1175
         if (Database::num_rows($rs_attendance) > 0) {
1176 1176
             $row_attendance = Database::fetch_array($rs_attendance);
1177 1177
             $sql = 'UPDATE '.$tbl_attendance.' SET attendance_weight ='.$weight.'
@@ -1266,7 +1266,7 @@  discard block
 block discarded – undo
1266 1266
                 'course' => $courseInfo['title'],
1267 1267
                 'score' => $certificateInfo['score_certificate'],
1268 1268
                 'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT),
1269
-                'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"
1269
+                'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}"
1270 1270
             ];
1271 1271
         }
1272 1272
 
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
                     'course' => $course['title'],
1331 1331
                     'score' => $certificateInfo['score_certificate'],
1332 1332
                     'date' => api_format_date($certificateInfo['created_at'], DATE_FORMAT_SHORT),
1333
-                    'link' => api_get_path(WEB_PATH) . "certificates/index.php?id={$certificateInfo['id']}"
1333
+                    'link' => api_get_path(WEB_PATH)."certificates/index.php?id={$certificateInfo['id']}"
1334 1334
                 ];
1335 1335
             }
1336 1336
         }
Please login to merge, or discard this patch.
main/admin/statistics/index.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
         <script>
21 21
             $(document).ready(function() {
22 22
                 $.ajax({
23
-                    url: "'. api_get_path(WEB_CODE_PATH) .'inc/ajax/statistics.ajax.php?a=recentlogins",
23
+                    url: "'. api_get_path(WEB_CODE_PATH).'inc/ajax/statistics.ajax.php?a=recentlogins",
24 24
                     type: "POST",
25 25
                     success: function(data) {
26 26
                         Chart.defaults.global.responsive = true;
@@ -50,10 +50,10 @@  discard block
 block discarded – undo
50 50
 // users ...
51 51
 $tools[$strUsers]['report=users'] = get_lang('CountUsers');
52 52
 $tools[$strUsers]['report=recentlogins'] = get_lang('Logins');
53
-$tools[$strUsers]['report=logins&amp;type=month'] = get_lang('Logins') . ' (' . get_lang('PeriodMonth') . ')';
54
-$tools[$strUsers]['report=logins&amp;type=day'] = get_lang('Logins') . ' (' . get_lang('PeriodDay') . ')';
55
-$tools[$strUsers]['report=logins&amp;type=hour'] = get_lang('Logins') . ' (' . get_lang('PeriodHour') . ')';
56
-$tools[$strUsers]['report=pictures'] = get_lang('CountUsers') . ' (' . get_lang('UserPicture') . ')';
53
+$tools[$strUsers]['report=logins&amp;type=month'] = get_lang('Logins').' ('.get_lang('PeriodMonth').')';
54
+$tools[$strUsers]['report=logins&amp;type=day'] = get_lang('Logins').' ('.get_lang('PeriodDay').')';
55
+$tools[$strUsers]['report=logins&amp;type=hour'] = get_lang('Logins').' ('.get_lang('PeriodHour').')';
56
+$tools[$strUsers]['report=pictures'] = get_lang('CountUsers').' ('.get_lang('UserPicture').')';
57 57
 $tools[$strUsers]['report=no_login_users'] = get_lang('StatsUsersDidNotLoginInLastPeriods');
58 58
 $tools[$strUsers]['report=zombies'] = get_lang('Zombies');
59 59
 
@@ -68,10 +68,10 @@  discard block
 block discarded – undo
68 68
 echo '<table><tr>';
69 69
 foreach ($tools as $section => $items) {
70 70
     echo '<td style="vertical-align:top;">';
71
-    echo '<h3>' . $section . '</h3>';
71
+    echo '<h3>'.$section.'</h3>';
72 72
     echo '<ul>';
73 73
     foreach ($items as $key => $value) {
74
-        echo '<li><a href="index.php?' . $key . '">' . $value . '</a></li>';
74
+        echo '<li><a href="index.php?'.$key.'">'.$value.'</a></li>';
75 75
     }
76 76
     echo '</ul>';
77 77
     echo '</td>';
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
 echo '</tr></table>';
80 80
 
81 81
 $course_categories = Statistics::getCourseCategories();
82
-echo '<br/><br/>';//@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation
82
+echo '<br/><br/>'; //@todo: spaces between elements should be handled in the css, br should be removed if only there for presentation
83 83
 
84 84
 switch ($report) {
85 85
     case 'courses':
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         Statistics::printStats(get_lang('Students'), $students);
122 122
         break;
123 123
     case 'recentlogins':
124
-        echo '<h2>'. sprintf(get_lang('LastXDays'), '15') . '</h2>';
124
+        echo '<h2>'.sprintf(get_lang('LastXDays'), '15').'</h2>';
125 125
         echo '<canvas class="col-md-12" id="canvas" height="100px" style="margin-bottom: 20px"></canvas>';
126 126
         Statistics::printRecentLoginStats();
127 127
         Statistics::printRecentLoginStats(true);
Please login to merge, or discard this patch.
main/inc/lib/javascript/svgedit/extensions/savefile_config.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 api_protect_course_script();
19 19
 api_block_anonymous_users();
20 20
 
21
-if(!isset($_POST['output_svg']) && !isset($_POST['output_png'])) {
22
-    api_not_allowed();//from Chamilo
21
+if (!isset($_POST['output_svg']) && !isset($_POST['output_png'])) {
22
+    api_not_allowed(); //from Chamilo
23 23
     die();
24 24
 }
25 25
 
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
43 43
 }
44 44
 
45 45
 //get SVG-Edit values
46
-$filename = $file;//from svg-edit
47
-$extension = $suffix;// from svg-edit
48
-$content = $contents;//from svg-edit
46
+$filename = $file; //from svg-edit
47
+$extension = $suffix; // from svg-edit
48
+$content = $contents; //from svg-edit
49 49
 
50
-$title = Database::escape_string(str_replace('_',' ',$filename));
50
+$title = Database::escape_string(str_replace('_', ' ', $filename));
51 51
 
52 52
 //get Chamilo variables
53 53
 
54 54
 if (!isset($_SESSION['draw_dir']) && !isset($_SESSION['whereami'])) {
55
-    api_not_allowed();//from Chamilo
55
+    api_not_allowed(); //from Chamilo
56 56
     die();
57 57
 }
58 58
 
@@ -61,7 +61,7 @@  discard block
 block discarded – undo
61 61
 $relativeUrlPath = $_SESSION['draw_dir'];
62 62
 $currentTool = $_SESSION['whereami'];
63 63
 $dirBaseDocuments = api_get_path(SYS_COURSE_PATH).$_course['path'].'/document';
64
-$saveDir=$dirBaseDocuments.$_SESSION['draw_dir'];
64
+$saveDir = $dirBaseDocuments.$_SESSION['draw_dir'];
65 65
 
66 66
 // a bit title security
67 67
 
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
 */
95 95
 
96 96
 //checks if the file exists, then rename the new
97
-if (file_exists($saveDir.'/'.$filename.'.'.$extension) && $currentTool=='document/createdraw') {
97
+if (file_exists($saveDir.'/'.$filename.'.'.$extension) && $currentTool == 'document/createdraw') {
98 98
     $message = get_lang('FileExistsChangeToSave');
99 99
     $params = array(
100 100
         'message' => $message,
@@ -110,21 +110,21 @@  discard block
 block discarded – undo
110 110
 $documentPath = $saveDir.'/'.$drawFileName;
111 111
 
112 112
 //add new document to disk
113
-file_put_contents( $documentPath, $contents );
113
+file_put_contents($documentPath, $contents);
114 114
 
115
-if ($currentTool=='document/createdraw') {
115
+if ($currentTool == 'document/createdraw') {
116 116
     //add document to database
117 117
     $doc_id = add_document($_course, $relativeUrlPath.'/'.$drawFileName, 'file', filesize($documentPath), $title);
118 118
     api_item_property_update($_course, TOOL_DOCUMENT, $doc_id, 'DocumentAdded', $_user['user_id'], $groupId, null, null, null, $current_session_id);
119 119
 
120
-} elseif($currentTool=='document/editdraw') {
120
+} elseif ($currentTool == 'document/editdraw') {
121 121
 
122 122
     //check path
123
-    if (!isset($_SESSION['draw_file'])){
124
-        api_not_allowed();//from Chamilo
123
+    if (!isset($_SESSION['draw_file'])) {
124
+        api_not_allowed(); //from Chamilo
125 125
         die();
126 126
     }
127
-    if ($_SESSION['draw_file'] == $drawFileName ){
127
+    if ($_SESSION['draw_file'] == $drawFileName) {
128 128
         $document_id = DocumentManager::get_document_id($_course, $relativeUrlPath.'/'.$drawFileName);
129 129
         update_existing_document($_course, $document_id, filesize($documentPath), null);
130 130
         api_item_property_update($_course, TOOL_DOCUMENT, $document_id, 'DocumentUpdated', $_user['user_id'], $groupId, null, null, null, $current_session_id);
Please login to merge, or discard this patch.