Completed
Push — 1.11.x ( d00fca...f1f062 )
by José
28:05
created
main/inc/lib/diagnoser.lib.php 4 patches
Indentation   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -401,19 +401,19 @@
 block discarded – undo
401 401
 
402 402
     public function format_yes_no_optional($value)
403 403
     {
404
-    	$return = '';
405
-    	switch($value) {
406
-     		case 0:
407
-     			$return = get_lang('No');
408
-     			break;
409
-     		case 1:
410
-     			$return = get_lang('Yes');
411
-     			break;
412
-			case 2:
413
-				$return = get_lang('Optional');
414
-				break;
415
-    	}
416
-    	return $return;
404
+        $return = '';
405
+        switch($value) {
406
+                case 0:
407
+                 $return = get_lang('No');
408
+                    break;
409
+                case 1:
410
+                 $return = get_lang('Yes');
411
+                    break;
412
+            case 2:
413
+                $return = get_lang('Optional');
414
+                break;
415
+        }
416
+        return $return;
417 417
 
418 418
     }
419 419
 
Please login to merge, or discard this patch.
Braces   +13 added lines, -9 removed lines patch added patch discarded remove patch
@@ -158,8 +158,9 @@  discard block
 block discarded – undo
158 158
         $array[] = $this->build_setting($status, '[INI]', 'display_errors', 'http://www.php.net/manual/en/ini.core.php#ini.display_errors', $setting, $req_setting, 'on_off', get_lang('DisplayErrorsInfo'));
159 159
 
160 160
         $setting = ini_get('default_charset');
161
-        if ($setting == '')
162
-            $setting = null;
161
+        if ($setting == '') {
162
+                    $setting = null;
163
+        }
163 164
         $req_setting = null;
164 165
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_ERROR;
165 166
         $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo'));
@@ -177,22 +178,25 @@  discard block
 block discarded – undo
177 178
         $setting = ini_get('memory_limit');
178 179
         $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M';
179 180
         $status = self :: STATUS_ERROR;
180
-        if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT)
181
-            $status = self :: STATUS_OK;
181
+        if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT) {
182
+                    $status = self :: STATUS_OK;
183
+        }
182 184
         $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo'));
183 185
 
184 186
         $setting = ini_get('post_max_size');
185 187
         $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M';
186 188
         $status = self :: STATUS_ERROR;
187
-        if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE)
188
-            $status = self :: STATUS_OK;
189
+        if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE) {
190
+                    $status = self :: STATUS_OK;
191
+        }
189 192
         $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo'));
190 193
 
191 194
         $setting = ini_get('upload_max_filesize');
192 195
         $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M';
193 196
         $status = self :: STATUS_ERROR;
194
-        if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE)
195
-            $status = self :: STATUS_OK;
197
+        if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE) {
198
+                    $status = self :: STATUS_OK;
199
+        }
196 200
         $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo'));
197 201
 
198 202
         $setting = ini_get('variables_order');
@@ -205,7 +209,7 @@  discard block
 block discarded – undo
205 209
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING;
206 210
         $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo'));
207 211
 
208
-        if (api_check_browscap()){$setting = true;}else{$setting=false;}
212
+        if (api_check_browscap()){$setting = true;} else{$setting=false;}
209 213
         $req_setting = true;
210 214
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING;
211 215
         $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo'));
Please login to merge, or discard this patch.
Spacing   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
 {
16 16
     const STATUS_OK = 1;
17 17
     const STATUS_WARNING = 2;
18
-    const STATUS_ERROR 	= 3;
18
+    const STATUS_ERROR = 3;
19 19
     const STATUS_INFORMATION = 4;
20 20
 
21 21
     /**
@@ -42,12 +42,12 @@  discard block
 block discarded – undo
42 42
                 $html .= '<li>';
43 43
             }
44 44
             $params['section'] = $section;
45
-            $html .='<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>';
45
+            $html .= '<a href="system_status.php?section='.$section.'">'.get_lang($section).'</a></li>';
46 46
         }
47 47
 
48 48
         $html .= '</ul><div class="tab-pane">';
49 49
 
50
-        $data = call_user_func(array($this, 'get_' . $currentSection . '_data'));
50
+        $data = call_user_func(array($this, 'get_'.$currentSection.'_data'));
51 51
         echo $html;
52 52
 
53 53
         if ($currentSection != 'paths') {
@@ -114,11 +114,11 @@  discard block
 block discarded – undo
114 114
     {
115 115
         $array = array();
116 116
         $writable_folders = array(
117
-            api_get_path(SYS_APP_PATH) .'cache',
117
+            api_get_path(SYS_APP_PATH).'cache',
118 118
             api_get_path(SYS_COURSE_PATH),
119
-            api_get_path(SYS_APP_PATH) .'home',
120
-            api_get_path(SYS_APP_PATH) .'upload/users/',
121
-            api_get_path(SYS_PATH) .'main/default_course_document/images/',
119
+            api_get_path(SYS_APP_PATH).'home',
120
+            api_get_path(SYS_APP_PATH).'upload/users/',
121
+            api_get_path(SYS_PATH).'main/default_course_document/images/',
122 122
         );
123 123
         foreach ($writable_folders as $index => $folder) {
124 124
             $writable = is_writable($folder);
@@ -137,10 +137,10 @@  discard block
 block discarded – undo
137 137
 
138 138
         $exists = file_exists(api_get_path(SYS_CODE_PATH).'install');
139 139
         $status = $exists ? self :: STATUS_WARNING : self :: STATUS_OK;
140
-        $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists') . ': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved'));
140
+        $array[] = $this->build_setting($status, '[FILES]', get_lang('DirectoryExists').': /install', 'http://be2.php.net/file_exists', $exists, 0, 'yes_no', get_lang('DirectoryShouldBeRemoved'));
141 141
 
142 142
         $app_version = api_get_setting('chamilo_database_version');
143
-        $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null,  'Chamilo DB version');
143
+        $array[] = $this->build_setting(self :: STATUS_INFORMATION, '[DB]', 'chamilo_database_version', '#', $app_version, 0, null, 'Chamilo DB version');
144 144
 
145 145
         $access_url_id = api_get_current_access_url_id();
146 146
 
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
                     $message2 .= get_lang('SpaceUsedOnSystemCannotBeMeasuredOnWindows');
153 153
                 } else {
154 154
                     $dir = api_get_path(SYS_PATH);
155
-                    $du = exec('du -sh ' . $dir, $err);
155
+                    $du = exec('du -sh '.$dir, $err);
156 156
                     list($size, $none) = explode("\t", $du);
157 157
                     $limit = $_configuration[$access_url_id]['hosting_limit_disk_space'];
158 158
                     $message2 .= sprintf(get_lang('TotalSpaceUsedByPortalXLimitIsYMB'), $size, $limit);
@@ -236,33 +236,33 @@  discard block
 block discarded – undo
236 236
         $array[] = $this->build_setting($status, '[INI]', 'default_charset', 'http://www.php.net/manual/en/ini.core.php#ini.default-charset', $setting, $req_setting, null, get_lang('DefaultCharsetInfo'));
237 237
 
238 238
         $setting = ini_get('max_execution_time');
239
-        $req_setting = '300 (' . get_lang('Minimum') . ')';
239
+        $req_setting = '300 ('.get_lang('Minimum').')';
240 240
         $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING;
241 241
         $array[] = $this->build_setting($status, '[INI]', 'max_execution_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-execution-time', $setting, $req_setting, null, get_lang('MaxExecutionTimeInfo'));
242 242
 
243 243
         $setting = ini_get('max_input_time');
244
-        $req_setting = '300 (' . get_lang('Minimum') . ')';
244
+        $req_setting = '300 ('.get_lang('Minimum').')';
245 245
         $status = $setting >= 300 ? self :: STATUS_OK : self :: STATUS_WARNING;
246 246
         $array[] = $this->build_setting($status, '[INI]', 'max_input_time', 'http://www.php.net/manual/en/ini.core.php#ini.max-input-time', $setting, $req_setting, null, get_lang('MaxInputTimeInfo'));
247 247
 
248 248
         $setting = ini_get('memory_limit');
249 249
         $req_setting = '>= '.REQUIRED_MIN_MEMORY_LIMIT.'M';
250 250
         $status = self :: STATUS_ERROR;
251
-        if ((float)$setting >= REQUIRED_MIN_MEMORY_LIMIT)
251
+        if ((float) $setting >= REQUIRED_MIN_MEMORY_LIMIT)
252 252
             $status = self :: STATUS_OK;
253 253
         $array[] = $this->build_setting($status, '[INI]', 'memory_limit', 'http://www.php.net/manual/en/ini.core.php#ini.memory-limit', $setting, $req_setting, null, get_lang('MemoryLimitInfo'));
254 254
 
255 255
         $setting = ini_get('post_max_size');
256 256
         $req_setting = '>= '.REQUIRED_MIN_POST_MAX_SIZE.'M';
257 257
         $status = self :: STATUS_ERROR;
258
-        if ((float)$setting >= REQUIRED_MIN_POST_MAX_SIZE)
258
+        if ((float) $setting >= REQUIRED_MIN_POST_MAX_SIZE)
259 259
             $status = self :: STATUS_OK;
260 260
         $array[] = $this->build_setting($status, '[INI]', 'post_max_size', 'http://www.php.net/manual/en/ini.core.php#ini.post-max-size', $setting, $req_setting, null, get_lang('PostMaxSizeInfo'));
261 261
 
262 262
         $setting = ini_get('upload_max_filesize');
263 263
         $req_setting = '>= '.REQUIRED_MIN_UPLOAD_MAX_FILESIZE.'M';
264 264
         $status = self :: STATUS_ERROR;
265
-        if ((float)$setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE)
265
+        if ((float) $setting >= REQUIRED_MIN_UPLOAD_MAX_FILESIZE)
266 266
             $status = self :: STATUS_OK;
267 267
         $array[] = $this->build_setting($status, '[INI]', 'upload_max_filesize', 'http://www.php.net/manual/en/ini.core.php#ini.upload_max_filesize', $setting, $req_setting, null, get_lang('UploadMaxFilesizeInfo'));
268 268
 
@@ -276,7 +276,7 @@  discard block
 block discarded – undo
276 276
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING;
277 277
         $array[] = $this->build_setting($status, '[SESSION]', 'session.gc_maxlifetime', 'http://www.php.net/manual/en/ini.core.php#session.gc-maxlifetime', $setting, $req_setting, null, get_lang('SessionGCMaxLifetimeInfo'));
278 278
 
279
-        if (api_check_browscap()){$setting = true;}else{$setting=false;}
279
+        if (api_check_browscap()) {$setting = true; } else {$setting = false; }
280 280
         $req_setting = true;
281 281
         $status = $setting == $req_setting ? self :: STATUS_OK : self :: STATUS_WARNING;
282 282
         $array[] = $this->build_setting($status, '[INI]', 'browscap', 'http://www.php.net/manual/en/misc.configuration.php#ini.browscap', $setting, $req_setting, 'on_off', get_lang('BrowscapInfo'));
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 
333 333
             $loaded = extension_loaded($extension);
334 334
             $status = $loaded ? self :: STATUS_OK : self :: STATUS_ERROR;
335
-            $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension') . ': ' . $extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment);
335
+            $array[] = $this->build_setting($status, '[EXTENSION]', get_lang('LoadedExtension').': '.$extension, $url, $loaded, $expected_value, 'yes_no_optional', $comment);
336 336
         }
337 337
 
338 338
         return $array;
@@ -455,9 +455,9 @@  discard block
 block discarded – undo
455 455
         $formatted_expected_value = $expected_value;
456 456
 
457 457
         if ($formatter) {
458
-            if (method_exists($this, 'format_' . $formatter)) {
459
-                $formatted_current_value = call_user_func(array($this, 'format_' . $formatter), $current_value);
460
-                $formatted_expected_value = call_user_func(array($this, 'format_' . $formatter), $expected_value);
458
+            if (method_exists($this, 'format_'.$formatter)) {
459
+                $formatted_current_value = call_user_func(array($this, 'format_'.$formatter), $current_value);
460
+                $formatted_expected_value = call_user_func(array($this, 'format_'.$formatter), $expected_value);
461 461
             }
462 462
         }
463 463
 
@@ -472,13 +472,13 @@  discard block
 block discarded – undo
472 472
      */
473 473
     public function get_link($title, $url)
474 474
     {
475
-        return '<a href="' . $url . '" target="about:bank">' . $title . '</a>';
475
+        return '<a href="'.$url.'" target="about:bank">'.$title.'</a>';
476 476
     }
477 477
 
478 478
     public function format_yes_no_optional($value)
479 479
     {
480 480
     	$return = '';
481
-    	switch($value) {
481
+    	switch ($value) {
482 482
      		case 0:
483 483
      			$return = get_lang('No');
484 484
      			break;
Please login to merge, or discard this patch.
Doc Comments   +6 added lines patch added patch discarded remove patch
@@ -435,6 +435,12 @@
 block discarded – undo
435 435
 
436 436
     /**
437 437
      * Additional functions needed for fast integration
438
+     * @param integer $status
439
+     * @param string $section
440
+     * @param string $title
441
+     * @param string $url
442
+     * @param string|null $formatter
443
+     * @param string $comment
438 444
      */
439 445
     public function build_setting(
440 446
         $status,
Please login to merge, or discard this patch.
main/inc/lib/extra_field_value.lib.php 3 patches
Indentation   +5 added lines, -6 removed lines patch added patch discarded remove patch
@@ -720,11 +720,11 @@  discard block
 block discarded – undo
720 720
         return false;
721 721
     }
722 722
 
723
-     /**
724
-     * @param int $itemId
725
-     * @param int $fieldId
726
-     * @return array
727
-     */
723
+        /**
724
+         * @param int $itemId
725
+         * @param int $fieldId
726
+         * @return array
727
+         */
728 728
     public function getAllValuesByItemAndField($itemId, $fieldId)
729 729
     {
730 730
         $fieldId = intval($fieldId);
@@ -847,7 +847,6 @@  discard block
 block discarded – undo
847 847
     /**
848 848
      * Deletes all values from an item
849 849
      * @param int $itemId (session id, course id, etc)
850
-
851 850
      * @assert (-1,-1) == null
852 851
      */
853 852
     public function deleteValuesByItem($itemId)
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
      * This function is used with $extraField->addElements()
76 76
      * @param array $params array for the insertion into the *_field_values table
77 77
      * @param bool $showQuery
78
-     * @return mixed false on empty params, void otherwise
78
+     * @return false|null false on empty params, void otherwise
79 79
      * @assert (array()) === false
80 80
      */
81 81
     public function saveFieldValues($params, $showQuery = false)
@@ -531,7 +531,7 @@  discard block
 block discarded – undo
531 531
      * @param int $item_id Item ID (It could be a session_id, course_id or user_id)
532 532
      * @param int $field_id Field ID (the ID from the *_field table)
533 533
      * @param bool $transform Whether to transform the result to a human readable strings
534
-     * @return mixed A structured array with the field_id and field_value, or false on error
534
+     * @return string A structured array with the field_id and field_value, or false on error
535 535
      * @assert (-1,-1) === false
536 536
      */
537 537
     public function get_values_by_handler_and_field_id($item_id, $field_id, $transform = false)
@@ -624,7 +624,7 @@  discard block
 block discarded – undo
624 624
      * @param int $item_id Item ID from the original table
625 625
      * @param string $field_variable The name of the field we are looking for
626 626
      * @param bool $transform
627
-     * @param bool $allVisibility
627
+     * @param bool $visibility
628 628
      *
629 629
      * @return mixed Array of results, or false on error or not found
630 630
      * @assert (-1,'') === false
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
                             break;
219 219
                     }
220 220
 
221
-                    $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE . "_{$params['item_id']}.png";
221
+                    $fileName = ExtraField::FIELD_TYPE_FILE_IMAGE."_{$params['item_id']}.png";
222 222
 
223 223
                     if (!file_exists($fileDir)) {
224 224
                         mkdir($fileDir, $dirPermissions, true);
@@ -227,15 +227,15 @@  discard block
 block discarded – undo
227 227
                     if ($value['error'] == 0) {
228 228
                         //Crop the image to adjust 16:9 ratio
229 229
                         $crop = new Image($value['tmp_name']);
230
-                        $crop->crop($params['extra_' . $field_variable . '_crop_result']);
230
+                        $crop->crop($params['extra_'.$field_variable.'_crop_result']);
231 231
 
232 232
                         $imageExtraField = new Image($value['tmp_name']);
233 233
                         $imageExtraField->resize(400);
234
-                        $imageExtraField->send_image($fileDir . $fileName, -1, 'png');
234
+                        $imageExtraField->send_image($fileDir.$fileName, -1, 'png');
235 235
                         $newParams = array(
236 236
                             'item_id' => $params['item_id'],
237 237
                             'field_id' => $extraFieldInfo['id'],
238
-                            'value' => $fileDirStored . $fileName,
238
+                            'value' => $fileDirStored.$fileName,
239 239
                             'comment' => $comment
240 240
                         );
241 241
                         self::save($newParams);
@@ -260,18 +260,18 @@  discard block
 block discarded – undo
260 260
                     }
261 261
 
262 262
                     $cleanedName = api_replace_dangerous_char($value['name']);
263
-                    $fileName = ExtraField::FIELD_TYPE_FILE . "_{$params['item_id']}_$cleanedName";
263
+                    $fileName = ExtraField::FIELD_TYPE_FILE."_{$params['item_id']}_$cleanedName";
264 264
                     if (!file_exists($fileDir)) {
265 265
                         mkdir($fileDir, $dirPermissions, true);
266 266
                     }
267 267
 
268 268
                     if ($value['error'] == 0) {
269
-                        moveUploadedFile($value, $fileDir . $fileName);
269
+                        moveUploadedFile($value, $fileDir.$fileName);
270 270
 
271 271
                         $new_params = array(
272 272
                             'item_id' => $params['item_id'],
273 273
                             'field_id' => $extraFieldInfo['id'],
274
-                            'value' => $fileDirStored . $fileName
274
+                            'value' => $fileDirStored.$fileName
275 275
                         );
276 276
 
277 277
                         if ($this->type !== 'session' && $this->type !== 'course') {
@@ -472,7 +472,7 @@  discard block
 block discarded – undo
472 472
                 */
473 473
                 if (false) {
474 474
                     global $app;
475
-                    switch($this->type) {
475
+                    switch ($this->type) {
476 476
                         case 'question':
477 477
                             $extraFieldValue = $app['orm.ems']['db_write']->getRepository('ChamiloLMS\Entity\QuestionFieldValues')->find($field_values['id']);
478 478
                             $extraFieldValue->setUserId(api_get_user_id());
Please login to merge, or discard this patch.
main/inc/lib/export.lib.inc.php 3 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -99,7 +99,7 @@  discard block
 block discarded – undo
99 99
         }
100 100
         foreach ($data as $row) {
101 101
             $string = implode("</td><td>", $row);
102
-            $string = '<tr><td>' . $string . '</td></tr>';
102
+            $string = '<tr><td>'.$string.'</td></tr>';
103 103
             if ($encoding != 'utf-8') {
104 104
                 $string = api_convert_encoding($string, $encoding, $systemEncoding);
105 105
             }
@@ -173,7 +173,7 @@  discard block
 block discarded – undo
173 173
             fwrite($handle, '<'.$wrapper_tagname.'>');
174 174
         }
175 175
         $s = self::_export_complex_table_xml_helper($data);
176
-        fwrite($handle,$s);
176
+        fwrite($handle, $s);
177 177
         if (!is_null($wrapper_tagname)) {
178 178
             fwrite($handle, '</'.$wrapper_tagname.'>'."\n");
179 179
         }
@@ -195,10 +195,10 @@  discard block
 block discarded – undo
195 195
         }
196 196
         $string = '';
197 197
         foreach ($data as $row) {
198
-            $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>';
198
+            $string .= "\n".str_repeat("\t", $level).'<'.$row['name'].'>';
199 199
             if (is_array($row['value'])) {
200
-            	$string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
201
-                $string .= str_repeat("\t",$level).'</'.$row['name'].'>';
200
+            	$string .= self::_export_complex_table_xml_helper($row['value'], $level + 1)."\n";
201
+                $string .= str_repeat("\t", $level).'</'.$row['name'].'>';
202 202
             } else {
203 203
                 $string .= $row['value'];
204 204
                 $string .= '</'.$row['name'].'>';
Please login to merge, or discard this patch.
Doc Comments   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
      * @param array $data
39 39
      * @param string $filename
40 40
      *
41
-     * @return mixed csv file | false if no data to export
41
+     * @return false|null csv file | false if no data to export
42 42
      */
43 43
     public static function arrayToCsv($data, $filename = 'export')
44 44
     {
@@ -160,7 +160,7 @@  discard block
 block discarded – undo
160 160
      * @param string Name of common tag to place each line in
161 161
      * @param string Name of the root element. A root element should always be given.
162 162
      * @param string Encoding in which the data is provided
163
-     * @return void  Prompts the user for a file download
163
+     * @return boolean  Prompts the user for a file download
164 164
      */
165 165
     public static function export_complex_table_xml(
166 166
         $data,
@@ -286,7 +286,7 @@  discard block
 block discarded – undo
286 286
      * @param string $name
287 287
      * @param string $format
288 288
      *
289
-     * @return bool
289
+     * @return false|null
290 290
      */
291 291
     public static function htmlToOdt($html, $name, $format = 'odt')
292 292
     {
Please login to merge, or discard this patch.
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -115,13 +115,13 @@  discard block
 block discarded – undo
115 115
     }
116 116
 
117 117
     /**
118
-    * Export tabular data to XML-file
119
-    * @param array  Simple array of data to put in XML
120
-    * @param string Name of file to be given to the user
121
-    * @param string Name of common tag to place each line in
122
-    * @param string Name of the root element. A root element should always be given.
123
-    * @param string Encoding in which the data is provided
124
-    */
118
+     * Export tabular data to XML-file
119
+     * @param array  Simple array of data to put in XML
120
+     * @param string Name of file to be given to the user
121
+     * @param string Name of common tag to place each line in
122
+     * @param string Name of the root element. A root element should always be given.
123
+     * @param string Encoding in which the data is provided
124
+     */
125 125
     public static function arrayToXml(
126 126
         $data,
127 127
         $filename = 'export',
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
         foreach ($data as $row) {
201 201
             $string .= "\n".str_repeat("\t",$level).'<'.$row['name'].'>';
202 202
             if (is_array($row['value'])) {
203
-            	$string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
203
+                $string .= self::_export_complex_table_xml_helper($row['value'],$level+1)."\n";
204 204
                 $string .= str_repeat("\t",$level).'</'.$row['name'].'>';
205 205
             } else {
206 206
                 $string .= $row['value'];
Please login to merge, or discard this patch.
main/inc/lib/array.lib.php 2 patches
Indentation   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -108,24 +108,24 @@
 block discarded – undo
108 108
  */
109 109
 function utf8_sort($array)
110 110
 {
111
-	$old_locale = setlocale(LC_ALL, null);
112
-	$code = api_get_language_isocode();
113
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
114
-	$try_sort = false;
111
+    $old_locale = setlocale(LC_ALL, null);
112
+    $code = api_get_language_isocode();
113
+    $locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
114
+    $try_sort = false;
115 115
 
116
-	foreach($locale_list as $locale) {
117
-		$my_local = setlocale(LC_COLLATE, $locale);
118
-		if ($my_local) {
119
-			$try_sort = true;
120
-			break;
121
-		}
122
-	}
116
+    foreach($locale_list as $locale) {
117
+        $my_local = setlocale(LC_COLLATE, $locale);
118
+        if ($my_local) {
119
+            $try_sort = true;
120
+            break;
121
+        }
122
+    }
123 123
 
124
-	if ($try_sort) {
125
-		uasort($array, 'strcoll');
126
-	}
127
-	setlocale(LC_COLLATE, $old_locale);
128
-	return $array;
124
+    if ($try_sort) {
125
+        uasort($array, 'strcoll');
126
+    }
127
+    setlocale(LC_COLLATE, $old_locale);
128
+    return $array;
129 129
 }
130 130
 
131 131
 /**
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -110,10 +110,10 @@  discard block
 block discarded – undo
110 110
 {
111 111
 	$old_locale = setlocale(LC_ALL, null);
112 112
 	$code = api_get_language_isocode();
113
-	$locale_list = array($code.'.utf8', 'en.utf8','en_US.utf8','en_GB.utf8');
113
+	$locale_list = array($code.'.utf8', 'en.utf8', 'en_US.utf8', 'en_GB.utf8');
114 114
 	$try_sort = false;
115 115
 
116
-	foreach($locale_list as $locale) {
116
+	foreach ($locale_list as $locale) {
117 117
 		$my_local = setlocale(LC_COLLATE, $locale);
118 118
 		if ($my_local) {
119 119
 			$try_sort = true;
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
     $flatten = array();
152 152
     array_walk_recursive(
153 153
         $array,
154
-        function ($value) use (&$flatten) {
154
+        function($value) use (&$flatten) {
155 155
             $flatten[] = $value;
156 156
         }
157 157
     );
Please login to merge, or discard this patch.
main/inc/lib/notebook.lib.php 2 patches
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -219,10 +219,10 @@
 block discarded – undo
219 219
         // action links
220 220
         echo '<div class="actions">';
221 221
         if (!api_is_anonymous()) {
222
-            if (api_get_session_id() == 0)
223
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
222
+            if (api_get_session_id() == 0) {
223
+                            echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
224 224
                     Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
225
-            elseif (api_is_allowed_to_session_edit(false, true)) {
225
+            } elseif (api_is_allowed_to_session_edit(false, true)) {
226 226
                 echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
227 227
                     Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
228 228
             }
Please login to merge, or discard this patch.
Spacing   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
29 29
         return "<script>
30 30
 				function confirmation (name)
31 31
 				{
32
-					if (confirm(\" " . get_lang("NoteConfirmDelete") . " \"+ name + \" ?\"))
32
+					if (confirm(\" " . get_lang("NoteConfirmDelete")." \"+ name + \" ?\"))
33 33
 						{return true;}
34 34
 					else
35 35
 						{return false;}
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                 description 		AS note_comment,
107 107
                 session_id			AS session_id
108 108
                FROM $t_notebook
109
-               WHERE c_id = $course_id AND notebook_id = '" . intval($notebook_id) . "' ";
109
+               WHERE c_id = $course_id AND notebook_id = '".intval($notebook_id)."' ";
110 110
         $result = Database::query($sql);
111 111
         if (Database::num_rows($result) != 1) {
112 112
             return array();
@@ -184,8 +184,8 @@  discard block
 block discarded – undo
184 184
         $sql = "DELETE FROM $t_notebook
185 185
                 WHERE
186 186
                     c_id = $course_id AND
187
-                    notebook_id='" . intval($notebook_id) . "' AND
188
-                    user_id = '" . api_get_user_id() . "'";
187
+                    notebook_id='".intval($notebook_id)."' AND
188
+                    user_id = '" . api_get_user_id()."'";
189 189
         $result = Database::query($sql);
190 190
         $affected_rows = Database::affected_rows($result);
191 191
         if ($affected_rows != 1) {
@@ -223,22 +223,22 @@  discard block
 block discarded – undo
223 223
         echo '<div class="actions">';
224 224
         if (!api_is_anonymous()) {
225 225
             if (api_get_session_id() == 0)
226
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
227
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
226
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
227
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
228 228
             elseif (api_is_allowed_to_session_edit(false, true)) {
229
-                echo '<a href="index.php?' . api_get_cidreq() . '&action=addnote">' .
230
-                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
229
+                echo '<a href="index.php?'.api_get_cidreq().'&action=addnote">'.
230
+                    Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
231 231
             }
232 232
         } else {
233
-            echo '<a href="javascript:void(0)">' . Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32') . '</a>';
233
+            echo '<a href="javascript:void(0)">'.Display::return_icon('new_note.png', get_lang('NoteAddNew'), '', '32').'</a>';
234 234
         }
235 235
 
236
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=creation_date&direction=' . $link_sort_direction . '">' .
237
-            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32') . '</a>';
238
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=update_date&direction=' . $link_sort_direction . '">' .
239
-            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32') . '</a>';
240
-        echo '<a href="index.php?' . api_get_cidreq() . '&action=changeview&view=title&direction=' . $link_sort_direction . '">' .
241
-            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32') . '</a>';
236
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=creation_date&direction='.$link_sort_direction.'">'.
237
+            Display::return_icon('notes_order_by_date_new.png', get_lang('OrderByCreationDate'), '', '32').'</a>';
238
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=update_date&direction='.$link_sort_direction.'">'.
239
+            Display::return_icon('notes_order_by_date_mod.png', get_lang('OrderByModificationDate'), '', '32').'</a>';
240
+        echo '<a href="index.php?'.api_get_cidreq().'&action=changeview&view=title&direction='.$link_sort_direction.'">'.
241
+            Display::return_icon('notes_order_by_title.png', get_lang('OrderByTitle'), '', '32').'</a>';
242 242
         echo '</div>';
243 243
 
244 244
         if (!isset($_SESSION['notebook_view']) || !in_array($_SESSION['notebook_view'], array('creation_date', 'update_date', 'title'))) {
@@ -248,9 +248,9 @@  discard block
 block discarded – undo
248 248
         // Database table definition
249 249
         $t_notebook = Database :: get_course_table(TABLE_NOTEBOOK);
250 250
         if ($_SESSION['notebook_view'] == 'creation_date' || $_SESSION['notebook_view'] == 'update_date') {
251
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
251
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
252 252
         } else {
253
-            $order_by = " ORDER BY " . $_SESSION['notebook_view'] . " $sort_direction ";
253
+            $order_by = " ORDER BY ".$_SESSION['notebook_view']." $sort_direction ";
254 254
         }
255 255
 
256 256
         //condition for the session
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
         $sql = "SELECT * FROM $t_notebook
264 264
                 WHERE
265 265
                     c_id = $course_id AND
266
-                    user_id = '" . api_get_user_id() . "'
266
+                    user_id = '".api_get_user_id()."'
267 267
                     $condition_session
268 268
                     $cond_extra $order_by
269 269
                 ";
@@ -273,18 +273,18 @@  discard block
 block discarded – undo
273 273
             $session_img = api_get_session_image($row['session_id'], $_user['status']);
274 274
             $updateValue = '';
275 275
             if ($row['update_date'] <> $row['creation_date']) {
276
-                $updateValue = ', ' . get_lang('UpdateDate') . ': ' . Display::dateToStringAgoAndLongDate($row['update_date']);
276
+                $updateValue = ', '.get_lang('UpdateDate').': '.Display::dateToStringAgoAndLongDate($row['update_date']);
277 277
             }
278 278
 
279
-            $actions = '<a href="' . api_get_self() . '?action=editnote&notebook_id=' . $row['notebook_id'] . '">' .
280
-                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL) . '</a>';
281
-            $actions .= '<a href="' . api_get_self() . '?action=deletenote&notebook_id=' . $row['notebook_id'] . '" onclick="return confirmation(\'' . $row['title'] . '\');">' .
282
-                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL) . '</a>';
279
+            $actions = '<a href="'.api_get_self().'?action=editnote&notebook_id='.$row['notebook_id'].'">'.
280
+                Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).'</a>';
281
+            $actions .= '<a href="'.api_get_self().'?action=deletenote&notebook_id='.$row['notebook_id'].'" onclick="return confirmation(\''.$row['title'].'\');">'.
282
+                Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).'</a>';
283 283
 
284 284
             echo Display::panel(
285 285
                 $row['description'],
286
-                $row['title'] . $session_img.' <div class="pull-right">'.$actions.'</div>',
287
-                get_lang('CreationDate') . ': ' . Display::dateToStringAgoAndLongDate($row['creation_date']). $updateValue
286
+                $row['title'].$session_img.' <div class="pull-right">'.$actions.'</div>',
287
+                get_lang('CreationDate').': '.Display::dateToStringAgoAndLongDate($row['creation_date']).$updateValue
288 288
             );
289 289
         }
290 290
     }
Please login to merge, or discard this patch.
main/inc/lib/display.lib.php 4 patches
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -666,9 +666,10 @@
 block discarded – undo
666 666
         $result = '';
667 667
         for ($i = $min; $i <= $max; $i ++) {
668 668
             $result .= '<option value="'.$i.'"';
669
-            if (is_int($selected_num))
670
-                if ($selected_num == $i) {
669
+            if (is_int($selected_num)) {
670
+                            if ($selected_num == $i) {
671 671
                     $result .= ' selected="selected"';
672
+            }
672 673
                 }
673 674
             $result .= '>'.$i.'</option>';
674 675
         }
Please login to merge, or discard this patch.
Doc Comments   +26 added lines, -17 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
     }
34 34
 
35 35
     /**
36
-     * @return array
36
+     * @return string[]
37 37
      */
38 38
     public static function toolList()
39 39
     {
@@ -293,7 +293,6 @@  discard block
 block discarded – undo
293 293
      * 					'page_nr' = The page to display
294 294
      * 					'hide_navigation' =  true to hide the navigation
295 295
      * @param array $query_vars Additional variables to add in the query-string
296
-     * @param array $form actions Additional variables to add in the query-string
297 296
      * @param mixed An array with bool values to know which columns show.
298 297
      * i.e: $visibility_options= array(true, false) we will only show the first column
299 298
      * 				Can be also only a bool value. TRUE: show all columns, FALSE: show nothing
@@ -334,7 +333,6 @@  discard block
 block discarded – undo
334 333
      * 					'page_nr' = The page to display
335 334
      * 					'hide_navigation' =  true to hide the navigation
336 335
      * @param array $query_vars Additional variables to add in the query-string
337
-     * @param array $form actions Additional variables to add in the query-string
338 336
      * @param mixed An array with bool values to know which columns show. i.e:
339 337
      *  $visibility_options= array(true, false) we will only show the first column
340 338
      * 	Can be also only a bool value. TRUE: show all columns, FALSE: show nothing
@@ -391,10 +389,11 @@  discard block
 block discarded – undo
391 389
      * 					'per_page' = number of items to show per page
392 390
      * 					'page_nr' = The page to display
393 391
      * @param array $query_vars Additional variables to add in the query-string
394
-     * @param array $column_show Array of binaries 1= show columns 0. hide a column
392
+     * @param integer[] $column_show Array of binaries 1= show columns 0. hide a column
395 393
      * @param array $column_order An array of integers that let us decide how the columns are going to be sort.
396 394
      * 						      i.e:  $column_order=array('1''4','3','4'); The 2nd column will be order like the 4th column
397 395
      * @param array $form_actions Set optional forms actions
396
+     * @param string $table_name
398 397
      *
399 398
      * @author Julio Montoya
400 399
      */
@@ -449,7 +448,7 @@  discard block
 block discarded – undo
449 448
      *
450 449
      * @deprecated use Display::addFlash with Display::return_message($message, 'normal');
451 450
      *
452
-     * @return void
451
+     * @return string|null
453 452
      */
454 453
     public static function display_normal_message($message, $filter = true, $returnValue = false)
455 454
     {
@@ -481,7 +480,7 @@  discard block
 block discarded – undo
481 480
      * Displays an confirmation message. Use this if something has been done successfully
482 481
      * @param bool	Filter (true) or not (false)
483 482
      * @deprecated use Display::addFlash with Display::return_message
484
-     * @return void
483
+     * @return string|null
485 484
      */
486 485
     public static function display_confirmation_message ($message, $filter = true, $returnValue = false)
487 486
     {
@@ -500,7 +499,7 @@  discard block
 block discarded – undo
500 499
      * @param bool	Filter (true) or not (false)
501 500
      * @deprecated use Display::addFlash with Display::return_message
502 501
      *
503
-     * @return void
502
+     * @return string|null
504 503
      */
505 504
     public static function display_error_message ($message, $filter = true, $returnValue = false)
506 505
     {
@@ -681,6 +680,7 @@  discard block
 block discarded – undo
681 680
      * @param string   The alt text (probably a language variable)
682 681
      * @param array    additional attributes (for instance height, width, onclick, ...)
683 682
      * @param integer  The wanted width of the icon (to be looked for in the corresponding img/icons/ folder)
683
+     * @param string $image
684 684
      * @return void
685 685
     */
686 686
     public static function display_icon(
@@ -917,6 +917,7 @@  discard block
 block discarded – undo
917 917
     /**
918 918
      * Displays an HTML input tag
919 919
      *
920
+     * @param string $type
920 921
      */
921 922
     public static function input($type, $name, $value, $attributes = array())
922 923
     {
@@ -933,8 +934,8 @@  discard block
 block discarded – undo
933 934
     }
934 935
 
935 936
     /**
936
-     * @param $name
937
-     * @param $value
937
+     * @param string $name
938
+     * @param string $value
938 939
      * @param array $attributes
939 940
      * @return string
940 941
      */
@@ -949,6 +950,7 @@  discard block
 block discarded – undo
949 950
     /**
950 951
      * Displays an HTML select tag
951 952
      *
953
+     * @param string $blank_item_text
952 954
      */
953 955
     public static function select(
954 956
         $name,
@@ -1015,8 +1017,8 @@  discard block
 block discarded – undo
1015 1017
                         $( "#tabs" ).tabs();
1016 1018
                     });
1017 1019
                 </script>
1018
-     * @param   array   $headers list of the tab titles
1019
-     * @param   array   $items
1020
+     * @param   string[]   $headers list of the tab titles
1021
+     * @param   string[]   $items
1020 1022
      * @param   string  $id id of the container of the tab in the example "tabs"
1021 1023
      * @param   array   $attributes for the ul
1022 1024
      * @param array $ul_attributes
@@ -1070,7 +1072,7 @@  discard block
 block discarded – undo
1070 1072
 
1071 1073
     /**
1072 1074
      * @param $headers
1073
-     * @param null $selected
1075
+     * @param integer $selected
1074 1076
      *
1075 1077
      * @return string
1076 1078
      */
@@ -1108,6 +1110,7 @@  discard block
 block discarded – undo
1108 1110
      * As you can see both function use the same "my_grid_name" this is very important otherwise nothing will work
1109 1111
      *
1110 1112
      * @param   string  the div id, this value must be the same with the first parameter of Display::grid_js()
1113
+     * @param string $div_id
1111 1114
      * @return  string  html
1112 1115
      *
1113 1116
      */
@@ -1668,6 +1671,8 @@  discard block
 block discarded – undo
1668 1671
      * @param  string  url that will be added (for jquery see hot_courses.tpl)
1669 1672
 	 * @param	string	point info array see function CourseManager::get_course_ranking()
1670 1673
 	 * @param	bool	add a div wrapper
1674
+	 * @param string $id
1675
+	 * @param string $url
1671 1676
 	 * @todo	use     templates
1672 1677
      **/
1673 1678
     public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true)
@@ -1758,6 +1763,9 @@  discard block
 block discarded – undo
1758 1763
         return '<'.$size.'>'.Security::remove_XSS($title).'</'.$size.'>';
1759 1764
     }
1760 1765
 
1766
+    /**
1767
+     * @param string $title
1768
+     */
1761 1769
     public static function page_subheader2($title, $second_title = null)
1762 1770
     {
1763 1771
         return self::page_header($title, $second_title, 'h4');
@@ -2005,6 +2013,7 @@  discard block
 block discarded – undo
2005 2013
 
2006 2014
     /**
2007 2015
      * @todo use twig
2016
+     * @param string $title
2008 2017
      */
2009 2018
     public static function groupButtonWithDropDown($title, $elements)
2010 2019
     {
@@ -2378,9 +2387,9 @@  discard block
 block discarded – undo
2378 2387
 
2379 2388
     /**
2380 2389
      * @param int $id
2381
-     * @param array $content
2390
+     * @param string[] $content
2382 2391
      * @param int $col
2383
-     * @param bool|true $right
2392
+     * @param boolean $right
2384 2393
      * @return string
2385 2394
      */
2386 2395
     public static function toolbarAction($id, $content = array(), $col = 2, $right = true)
@@ -2464,10 +2473,10 @@  discard block
 block discarded – undo
2464 2473
     /**
2465 2474
      * @param string $title
2466 2475
      * @param string $content
2467
-     * @param null $id
2476
+     * @param string $id
2468 2477
      * @param array $params
2469
-     * @param null $idAccordion
2470
-     * @param null $idCollapse
2478
+     * @param string $idAccordion
2479
+     * @param string $idCollapse
2471 2480
      * @param bool|true $open
2472 2481
      * @param bool|false $fullClickable
2473 2482
      * @return null|string
Please login to merge, or discard this patch.
Indentation   +66 added lines, -66 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@  discard block
 block discarded – undo
50 50
         );
51 51
     }
52 52
 
53
-     /**
54
-     * Displays the page header
55
-     * @param string The name of the page (will be showed in the page title)
56
-     * @param string Optional help file name
57
-     * @param string $page_header
58
-     */
53
+        /**
54
+         * Displays the page header
55
+         * @param string The name of the page (will be showed in the page title)
56
+         * @param string Optional help file name
57
+         * @param string $page_header
58
+         */
59 59
     public static function display_header($tool_name ='', $help = null, $page_header = null)
60 60
     {
61 61
         $origin = api_get_origin();
@@ -453,7 +453,7 @@  discard block
 block discarded – undo
453 453
      */
454 454
     public static function display_normal_message($message, $filter = true, $returnValue = false)
455 455
     {
456
-    	$message = self::return_message($message, 'normal', $filter);
456
+        $message = self::return_message($message, 'normal', $filter);
457 457
         if ($returnValue) {
458 458
             return $message;
459 459
         } else {
@@ -537,22 +537,22 @@  discard block
 block discarded – undo
537 537
         }
538 538
 
539 539
         if ($filter) {
540
-        	$message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding());
540
+            $message = api_htmlentities($message, ENT_QUOTES, api_is_xml_http_request() ? 'UTF-8' : api_get_system_encoding());
541 541
         }
542 542
 
543 543
         $class = '';
544 544
         switch ($type) {
545 545
             case 'warning':
546 546
                $class .= 'alert alert-warning';
547
-               break;
547
+                break;
548 548
             case 'error':
549 549
                $class .= 'alert alert-danger';
550
-               break;
550
+                break;
551 551
             case 'confirmation':
552 552
             case 'confirm':
553 553
             case 'success':
554 554
                 $class .= 'alert alert-success';
555
-               break;
555
+                break;
556 556
             case 'normal':
557 557
             default:
558 558
                 $class .= 'alert alert-info';
@@ -682,7 +682,7 @@  discard block
 block discarded – undo
682 682
      * @param array    additional attributes (for instance height, width, onclick, ...)
683 683
      * @param integer  The wanted width of the icon (to be looked for in the corresponding img/icons/ folder)
684 684
      * @return void
685
-    */
685
+     */
686 686
     public static function display_icon(
687 687
         $image,
688 688
         $alt_text = '',
@@ -718,7 +718,7 @@  discard block
 block discarded – undo
718 718
      * @author Julio Montoya 2010 Function improved, adding image constants
719 719
      * @author Yannick Warnier 2011 Added size handler
720 720
      * @version Feb 2011
721
-    */
721
+     */
722 722
     public static function return_icon(
723 723
         $image,
724 724
         $alt_text = '',
@@ -920,14 +920,14 @@  discard block
 block discarded – undo
920 920
      */
921 921
     public static function input($type, $name, $value, $attributes = array())
922 922
     {
923
-         if (isset($type)) {
924
-             $attributes['type']= $type;
925
-         }
926
-         if (isset($name)) {
927
-             $attributes['name']= $name;
928
-         }
929
-         if (isset($value)) {
930
-             $attributes['value']= $value;
923
+            if (isset($type)) {
924
+                $attributes['type']= $type;
925
+            }
926
+            if (isset($name)) {
927
+                $attributes['name']= $name;
928
+            }
929
+            if (isset($value)) {
930
+                $attributes['value']= $value;
931 931
         }
932 932
         return self::tag('input', '', $attributes);
933 933
     }
@@ -940,10 +940,10 @@  discard block
 block discarded – undo
940 940
      */
941 941
     public static function button($name, $value, $attributes = array())
942 942
     {
943
-    	if (!empty($name)) {
943
+        if (!empty($name)) {
944 944
             $attributes['name'] = $name;
945
-    	}
946
-    	return self::tag('button', $value, $attributes);
945
+        }
946
+        return self::tag('button', $value, $attributes);
947 947
     }
948 948
 
949 949
     /**
@@ -1010,7 +1010,7 @@  discard block
 block discarded – undo
1010 1010
      * in the $htmlHeadXtra variable before the display_header
1011 1011
      * Add this script
1012 1012
      * @example
1013
-             * <script>
1013
+     * <script>
1014 1014
                     $(function() {
1015 1015
                         $( "#tabs" ).tabs();
1016 1016
                     });
@@ -1076,20 +1076,20 @@  discard block
 block discarded – undo
1076 1076
      */
1077 1077
     public static function tabsOnlyLink($headers, $selected = null)
1078 1078
     {
1079
-         $id = uniqid();
1080
-         $i = 1;
1081
-         $lis = null;
1082
-         foreach ($headers as $item) {
1079
+            $id = uniqid();
1080
+            $i = 1;
1081
+            $lis = null;
1082
+            foreach ($headers as $item) {
1083 1083
             $class = null;
1084 1084
             if ($i == $selected) {
1085 1085
                 $class = 'active';
1086 1086
             }
1087
-             $item = self::tag(
1088
-                 'a',
1089
-                 $item['content'],
1090
-                 array('id' => $id.'-'.$i, 'href' => $item['url'])
1091
-             );
1092
-             $lis .= self::tag('li', $item, array('class' => $class));
1087
+                $item = self::tag(
1088
+                    'a',
1089
+                    $item['content'],
1090
+                    array('id' => $id.'-'.$i, 'href' => $item['url'])
1091
+                );
1092
+                $lis .= self::tag('li', $item, array('class' => $class));
1093 1093
             $i++;
1094 1094
         }
1095 1095
         return self::tag('ul', $lis, array('class' => 'nav nav-tabs tabs-margin'));
@@ -1301,8 +1301,8 @@  discard block
 block discarded – undo
1301 1301
      */
1302 1302
     public static function table($headers, $rows, $attributes = array())
1303 1303
     {
1304
-    	if (empty($attributes)) {
1305
-    		$attributes['class'] = 'data_table';
1304
+        if (empty($attributes)) {
1305
+            $attributes['class'] = 'data_table';
1306 1306
         }
1307 1307
         $table = new HTML_Table($attributes);
1308 1308
         $row = 0;
@@ -1310,17 +1310,17 @@  discard block
 block discarded – undo
1310 1310
 
1311 1311
         // Course headers
1312 1312
         if (!empty($headers)) {
1313
-	        foreach ($headers as $item) {
1314
-	            $table->setHeaderContents($row, $column, $item);
1315
-	            $column++;
1316
-	        }
1317
-	        $row = 1;
1318
-	        $column = 0;
1313
+            foreach ($headers as $item) {
1314
+                $table->setHeaderContents($row, $column, $item);
1315
+                $column++;
1316
+            }
1317
+            $row = 1;
1318
+            $column = 0;
1319 1319
         }
1320 1320
 
1321 1321
         if (!empty($rows)) {
1322
-	        foreach($rows as $content) {
1323
-	            $table->setCellContents($row, $column, $content);
1322
+            foreach($rows as $content) {
1323
+                $table->setCellContents($row, $column, $content);
1324 1324
                 $row++;
1325 1325
             }
1326 1326
         }
@@ -1666,21 +1666,21 @@  discard block
 block discarded – undo
1666 1666
      *
1667 1667
      * @param  string  id of the rating ul element
1668 1668
      * @param  string  url that will be added (for jquery see hot_courses.tpl)
1669
-	 * @param	string	point info array see function CourseManager::get_course_ranking()
1670
-	 * @param	bool	add a div wrapper
1671
-	 * @todo	use     templates
1669
+     * @param	string	point info array see function CourseManager::get_course_ranking()
1670
+     * @param	bool	add a div wrapper
1671
+     * @todo	use     templates
1672 1672
      **/
1673 1673
     public static function return_rating_system($id, $url, $point_info = array(), $add_div_wrapper = true)
1674 1674
     {
1675
-		$number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null;
1676
-		$percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1675
+        $number_of_users_who_voted = isset($point_info['users_who_voted']) ? $point_info['users_who_voted'] : null;
1676
+        $percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1677 1677
 
1678
-		if (!empty($percentage)) {
1678
+        if (!empty($percentage)) {
1679 1679
             $percentage = $percentage*125/100;
1680 1680
         }
1681
-		$accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1681
+        $accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1682 1682
 
1683
-		$star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1683
+        $star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1684 1684
 
1685 1685
         $html = '<ul id="'.$id.'" class="star-rating">
1686 1686
 					<li class="current-rating" style="width:'.$percentage.'px;"></li>
@@ -1691,26 +1691,26 @@  discard block
 block discarded – undo
1691 1691
 					<li><a href="javascript:void(0);" data-link="'.$url.'&amp;star=5" title="'.$star_label.'" class="five-stars">5</a></li>
1692 1692
 				</ul>';
1693 1693
 
1694
-		$labels = array();
1694
+        $labels = array();
1695 1695
 
1696
-		$labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1697
-		$labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1698
-		/* if (!empty($number_of_users_who_voted)) {
1696
+        $labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1697
+        $labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1698
+        /* if (!empty($number_of_users_who_voted)) {
1699 1699
 			$labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5';
1700 1700
 		} */
1701 1701
 
1702
-		$labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1702
+        $labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1703 1703
 
1704
-		if (!$add_div_wrapper && api_is_anonymous()) {
1705
-			$labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1706
-		}
1704
+        if (!$add_div_wrapper && api_is_anonymous()) {
1705
+            $labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1706
+        }
1707 1707
 
1708 1708
         $html .= Display::div(implode(' | ', $labels) , array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1709 1709
         $html .= ' '.Display::span(' ', array('id' =>  'vote_label2_'.$id));
1710 1710
 
1711 1711
         if ($add_div_wrapper) {
1712
-			$html = Display::div($html, array('id' => 'rating_wrapper_'.$id));
1713
-		}
1712
+            $html = Display::div($html, array('id' => 'rating_wrapper_'.$id));
1713
+        }
1714 1714
 
1715 1715
         return $html;
1716 1716
     }
@@ -1743,8 +1743,8 @@  discard block
 block discarded – undo
1743 1743
         return self::page_header($title, $second_title);
1744 1744
     }
1745 1745
 
1746
-     public static function page_subheader_and_translate($title, $second_title = null)
1747
-     {
1746
+        public static function page_subheader_and_translate($title, $second_title = null)
1747
+        {
1748 1748
         $title = get_lang($title);
1749 1749
         return self::page_subheader($title, $second_title);
1750 1750
     }
@@ -2527,7 +2527,7 @@  discard block
 block discarded – undo
2527 2527
      */
2528 2528
     public static function dateToStringAgoAndLongDate($dateTime)
2529 2529
     {
2530
-       if (empty($dateTime) || $dateTime === '0000-00-00 00:00:00') {
2530
+        if (empty($dateTime) || $dateTime === '0000-00-00 00:00:00') {
2531 2531
             return '';
2532 2532
         }
2533 2533
 
Please login to merge, or discard this patch.
Spacing   +72 added lines, -73 removed lines patch added patch discarded remove patch
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
      * @param string Optional help file name
57 57
      * @param string $page_header
58 58
      */
59
-    public static function display_header($tool_name ='', $help = null, $page_header = null)
59
+    public static function display_header($tool_name = '', $help = null, $page_header = null)
60 60
     {
61 61
         $origin = api_get_origin();
62 62
         $showHeader = true;
@@ -365,7 +365,7 @@  discard block
 block discarded – undo
365 365
         $grid_class = array(),
366 366
         $elementCount = 0
367 367
     ) {
368
-        $column =  0;
368
+        $column = 0;
369 369
         $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;
370 370
 
371 371
         $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name);
@@ -494,7 +494,7 @@  discard block
 block discarded – undo
494 494
      * @deprecated use Display::addFlash with Display::return_message
495 495
      * @return void
496 496
      */
497
-    public static function display_confirmation_message ($message, $filter = true, $returnValue = false)
497
+    public static function display_confirmation_message($message, $filter = true, $returnValue = false)
498 498
     {
499 499
         $message = self::return_message($message, 'confirm', $filter);
500 500
         if ($returnValue) {
@@ -513,7 +513,7 @@  discard block
 block discarded – undo
513 513
      *
514 514
      * @return void
515 515
      */
516
-    public static function display_error_message ($message, $filter = true, $returnValue = false)
516
+    public static function display_error_message($message, $filter = true, $returnValue = false)
517 517
     {
518 518
         $message = self::return_message($message, 'error', $filter);
519 519
         if ($returnValue) {
@@ -528,7 +528,7 @@  discard block
 block discarded – undo
528 528
      * @param string $type
529 529
      * @param bool $filter
530 530
      */
531
-    public static function return_message_and_translate($message, $type='normal', $filter = true)
531
+    public static function return_message_and_translate($message, $type = 'normal', $filter = true)
532 532
     {
533 533
         $message = get_lang($message);
534 534
         echo self::return_message($message, $type, $filter);
@@ -595,14 +595,14 @@  discard block
 block discarded – undo
595 595
         }
596 596
         // Encrypt email
597 597
         $hmail = '';
598
-        for ($i = 0; $i < strlen($email); $i ++) {
598
+        for ($i = 0; $i < strlen($email); $i++) {
599 599
             $hmail .= '&#'.ord($email {
600 600
             $i }).';';
601 601
         }
602 602
         $hclickable_text = null;
603 603
         // Encrypt clickable text if @ is present
604 604
         if (strpos($clickable_text, '@')) {
605
-            for ($i = 0; $i < strlen($clickable_text); $i ++) {
605
+            for ($i = 0; $i < strlen($clickable_text); $i++) {
606 606
                 $hclickable_text .= '&#'.ord($clickable_text {
607 607
                 $i }).';';
608 608
             }
@@ -634,7 +634,7 @@  discard block
 block discarded – undo
634 634
         }
635 635
         // Encrypt email
636 636
         $hmail = '';
637
-        for ($i = 0; $i < strlen($email); $i ++) {
637
+        for ($i = 0; $i < strlen($email); $i++) {
638 638
             $hmail .= '&#'.ord($email {
639 639
             $i }).';';
640 640
         }
@@ -654,7 +654,7 @@  discard block
 block discarded – undo
654 654
     public static function get_alphabet_options($selected_letter = '')
655 655
     {
656 656
         $result = '';
657
-        for ($i = 65; $i <= 90; $i ++) {
657
+        for ($i = 65; $i <= 90; $i++) {
658 658
             $letter = chr($i);
659 659
             $result .= '<option value="'.$letter.'"';
660 660
             if ($selected_letter == $letter) {
@@ -675,7 +675,7 @@  discard block
 block discarded – undo
675 675
     public static function get_numeric_options($min, $max, $selected_num = 0)
676 676
     {
677 677
         $result = '';
678
-        for ($i = $min; $i <= $max; $i ++) {
678
+        for ($i = $min; $i <= $max; $i++) {
679 679
             $result .= '<option value="'.$i.'"';
680 680
             if (is_int($selected_num))
681 681
                 if ($selected_num == $i) {
@@ -745,8 +745,8 @@  discard block
 block discarded – undo
745 745
         // important to use the public path (i.e. web/css/) rather than the
746 746
         // internal path (/app/Resource/public/css/) because the path used
747 747
         // in the end must be the public path
748
-        $alternateCssPath = api_get_path(SYS_PUBLIC_PATH) . 'css/';
749
-        $alternateWebCssPath = api_get_path(WEB_PUBLIC_PATH) . 'css/';
748
+        $alternateCssPath = api_get_path(SYS_PUBLIC_PATH).'css/';
749
+        $alternateWebCssPath = api_get_path(WEB_PUBLIC_PATH).'css/';
750 750
 
751 751
         $image = trim($image);
752 752
 
@@ -756,7 +756,7 @@  discard block
 block discarded – undo
756 756
             $size = ICON_SIZE_SMALL;
757 757
         }
758 758
 
759
-        $size_extra = $size . '/';
759
+        $size_extra = $size.'/';
760 760
 
761 761
         // Checking the img/ folder
762 762
         $icon = $w_code_path.'img/'.$image;
@@ -764,7 +764,7 @@  discard block
 block discarded – undo
764 764
         $theme = 'themes/chamilo/icons/';
765 765
 
766 766
         if ($loadThemeIcon) {
767
-            $theme = 'themes/' . api_get_visual_theme() . '/icons/';
767
+            $theme = 'themes/'.api_get_visual_theme().'/icons/';
768 768
             // Checking the theme icons folder example: app/Resources/public/css/themes/chamilo/icons/XXX
769 769
             if (is_file($alternateCssPath.$theme.$size_extra.$image)) {
770 770
                 $icon = $alternateWebCssPath.$theme.$size_extra.$image;
@@ -786,11 +786,11 @@  discard block
 block discarded – undo
786 786
         // ask for the SVG version directly
787 787
         $svgIcons = api_get_setting('icons_mode_svg');
788 788
         if ($svgIcons == 'true' && $return_only_path == false) {
789
-            $svgImage = substr($image, 0, -3) . 'svg';
790
-            if (is_file($code_path . $theme . 'svg/' . $svgImage)) {
791
-                $icon = $w_code_path . $theme . 'svg/' . $svgImage;
792
-            } elseif (is_file($code_path . 'img/icons/svg/' . $svgImage)) {
793
-                $icon = $w_code_path . 'img/icons/svg/' . $svgImage;
789
+            $svgImage = substr($image, 0, -3).'svg';
790
+            if (is_file($code_path.$theme.'svg/'.$svgImage)) {
791
+                $icon = $w_code_path.$theme.'svg/'.$svgImage;
792
+            } elseif (is_file($code_path.'img/icons/svg/'.$svgImage)) {
793
+                $icon = $w_code_path.'img/icons/svg/'.$svgImage;
794 794
             }
795 795
 
796 796
             if (empty($additional_attributes['height'])) {
@@ -879,7 +879,7 @@  discard block
 block discarded – undo
879 879
             }
880 880
         }
881 881
         //some tags don't have this </XXX>
882
-        if (in_array($tag, array('img','input','br'))) {
882
+        if (in_array($tag, array('img', 'input', 'br'))) {
883 883
             $return_value = '<'.$tag.' '.$attribute_list.' />';
884 884
         } else {
885 885
             $return_value = '<'.$tag.' '.$attribute_list.' >'.$content.'</'.$tag.'>';
@@ -932,13 +932,13 @@  discard block
 block discarded – undo
932 932
     public static function input($type, $name, $value, $attributes = array())
933 933
     {
934 934
          if (isset($type)) {
935
-             $attributes['type']= $type;
935
+             $attributes['type'] = $type;
936 936
          }
937 937
          if (isset($name)) {
938
-             $attributes['name']= $name;
938
+             $attributes['name'] = $name;
939 939
          }
940 940
          if (isset($value)) {
941
-             $attributes['value']= $value;
941
+             $attributes['value'] = $value;
942 942
         }
943 943
         return self::tag('input', '', $attributes);
944 944
     }
@@ -971,14 +971,14 @@  discard block
 block discarded – undo
971 971
     ) {
972 972
         $html = '';
973 973
         $extra = '';
974
-        $default_id = 'id="' . $name . '" ';
974
+        $default_id = 'id="'.$name.'" ';
975 975
         foreach ($extra_attributes as $key => $parameter) {
976 976
             if ($key == 'id') {
977 977
                 $default_id = '';
978 978
             }
979
-            $extra .= $key . '="' . $parameter . '" ';
979
+            $extra .= $key.'="'.$parameter.'" ';
980 980
         }
981
-        $html .= '<select name="' . $name . '" ' . $default_id . ' ' . $extra . '>';
981
+        $html .= '<select name="'.$name.'" '.$default_id.' '.$extra.'>';
982 982
 
983 983
         if ($show_blank_item) {
984 984
             if (empty($blank_item_text)) {
@@ -986,14 +986,14 @@  discard block
 block discarded – undo
986 986
             } else {
987 987
                 $blank_item_text = Security::remove_XSS($blank_item_text);
988 988
             }
989
-            $html .= self::tag('option', '-- ' . $blank_item_text . ' --', array('value' => '-1'));
989
+            $html .= self::tag('option', '-- '.$blank_item_text.' --', array('value' => '-1'));
990 990
         }
991 991
         if ($values) {
992 992
             foreach ($values as $key => $value) {
993 993
                 if (is_array($value) && isset($value['name'])) {
994 994
                     $value = $value['name'];
995 995
                 }
996
-                $html .= '<option value="' . $key . '"';
996
+                $html .= '<option value="'.$key.'"';
997 997
 
998 998
                 if (is_array($default)) {
999 999
                     foreach ($default as $item) {
@@ -1008,7 +1008,7 @@  discard block
 block discarded – undo
1008 1008
                     }
1009 1009
                 }
1010 1010
 
1011
-                $html .= '>' . $value . '</option>';
1011
+                $html .= '>'.$value.'</option>';
1012 1012
             }
1013 1013
         }
1014 1014
         $html .= '</select>';
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
      */
1037 1037
     public static function tabs($headers, $items, $id = 'tabs', $attributes = array(), $ul_attributes = array())
1038 1038
     {
1039
-        if (empty($headers) || count($headers) == 0 ) {
1039
+        if (empty($headers) || count($headers) == 0) {
1040 1040
             return '';
1041 1041
         }
1042 1042
 
@@ -1047,7 +1047,7 @@  discard block
 block discarded – undo
1047 1047
             if ($i == 1) {
1048 1048
                 $active = ' active';
1049 1049
             }
1050
-            $item = self::tag('a', $item, array('href'=>'#'.$id.'-'.$i, 'role'=> 'tab', 'data-toggle' => 'tab', 'id' => $id . $i));
1050
+            $item = self::tag('a', $item, array('href'=>'#'.$id.'-'.$i, 'role'=> 'tab', 'data-toggle' => 'tab', 'id' => $id.$i));
1051 1051
             $ul_attributes['role'] = 'presentation';
1052 1052
             $ul_attributes['class'] = $active;
1053 1053
             $lis .= self::tag('li', $item, $ul_attributes);
@@ -1076,7 +1076,7 @@  discard block
 block discarded – undo
1076 1076
 
1077 1077
         $main_div = self::tag('div', $ul.self::tag('div', $divs, ['class' => 'tab-content']), $attributes);
1078 1078
 
1079
-        return $main_div ;
1079
+        return $main_div;
1080 1080
     }
1081 1081
 
1082 1082
     /**
@@ -1124,8 +1124,8 @@  discard block
 block discarded – undo
1124 1124
      */
1125 1125
     public static function grid_html($div_id)
1126 1126
     {
1127
-        $table = self::tag('table','', array('id' => $div_id));
1128
-        $table .= self::tag('div','', array('id' => $div_id.'_pager'));
1127
+        $table = self::tag('table', '', array('id' => $div_id));
1128
+        $table .= self::tag('div', '', array('id' => $div_id.'_pager'));
1129 1129
         return $table;
1130 1130
     }
1131 1131
 
@@ -1186,7 +1186,7 @@  discard block
 block discarded – undo
1186 1186
         $obj->colNames      = $column_names;
1187 1187
         $obj->colModel      = $column_model;
1188 1188
         $obj->pager         = '#'.$div_id.'_pager';
1189
-        $obj->datatype  = 'json';
1189
+        $obj->datatype = 'json';
1190 1190
         $obj->viewrecords = 'true';
1191 1191
 
1192 1192
         $all_value = 10000000;
@@ -1247,10 +1247,10 @@  discard block
 block discarded – undo
1247 1247
         // Adding static data.
1248 1248
         if (!empty($data)) {
1249 1249
             $data_var = $div_id.'_data';
1250
-            $json.=' var '.$data_var.' = '.json_encode($data).';';
1250
+            $json .= ' var '.$data_var.' = '.json_encode($data).';';
1251 1251
             $obj->data = $data_var;
1252 1252
             $obj->datatype = 'local';
1253
-            $json.="\n";
1253
+            $json .= "\n";
1254 1254
         }
1255 1255
 
1256 1256
         $obj->end = 'end';
@@ -1264,12 +1264,12 @@  discard block
 block discarded – undo
1264 1264
         }
1265 1265
 
1266 1266
         // Fixing true/false js values that doesn't need the ""
1267
-        $json_encode = str_replace(':"true"',':true',$json_encode);
1267
+        $json_encode = str_replace(':"true"', ':true', $json_encode);
1268 1268
         // wrap_cell is not a valid jqgrid attributes is a hack to wrap a text
1269 1269
         $json_encode = str_replace('"wrap_cell":true', 'cellattr : function(rowId, value, rowObject, colModel, arrData) { return \'class = "jqgrid_whitespace"\'; }', $json_encode);
1270
-        $json_encode = str_replace(':"false"',':false',$json_encode);
1270
+        $json_encode = str_replace(':"false"', ':false', $json_encode);
1271 1271
         $json_encode = str_replace('"formatter":"action_formatter"', 'formatter:action_formatter', $json_encode);
1272
-        $json_encode = str_replace(array('{"first":"first",','"end":"end"}'), '', $json_encode);
1272
+        $json_encode = str_replace(array('{"first":"first",', '"end":"end"}'), '', $json_encode);
1273 1273
 
1274 1274
         // Creating the jqgrid element.
1275 1275
         $json .= '$("#'.$div_id.'").jqGrid({';
@@ -1284,22 +1284,22 @@  discard block
 block discarded – undo
1284 1284
             $groups = '';
1285 1285
             foreach ($extra_params['groupHeaders'] as $group) {
1286 1286
                 //{ "startColumnName" : "courses", "numberOfColumns" : 1, "titleText" : "Order Info" },
1287
-                $groups .= '{ "startColumnName" : "' . $group['startColumnName'] . '", "numberOfColumns" : ' . $group['numberOfColumns'] . ', "titleText" : "' . $group['titleText']  . '" },';
1287
+                $groups .= '{ "startColumnName" : "'.$group['startColumnName'].'", "numberOfColumns" : '.$group['numberOfColumns'].', "titleText" : "'.$group['titleText'].'" },';
1288 1288
 
1289 1289
             }
1290 1290
             $json .= '$("#'.$div_id.'").jqGrid("setGroupHeaders", {
1291 1291
                 "useColSpanStyle" : false,
1292 1292
                 "groupHeaders"    : [
1293
-                    ' . $groups . '
1293
+                    ' . $groups.'
1294 1294
                 ]
1295 1295
             });';
1296 1296
         }
1297 1297
 
1298 1298
         $all_text = addslashes(get_lang('All'));
1299 1299
         $json .= '$("'.$obj->pager.' option[value='.$all_value.']").text("'.$all_text.'");';
1300
-        $json.= "\n";
1300
+        $json .= "\n";
1301 1301
         // Adding edit/delete icons.
1302
-        $json.= $formatter;
1302
+        $json .= $formatter;
1303 1303
 
1304 1304
         return $json;
1305 1305
     }
@@ -1330,7 +1330,7 @@  discard block
 block discarded – undo
1330 1330
         }
1331 1331
 
1332 1332
         if (!empty($rows)) {
1333
-	        foreach($rows as $content) {
1333
+	        foreach ($rows as $content) {
1334 1334
 	            $table->setCellContents($row, $column, $content);
1335 1335
                 $row++;
1336 1336
             }
@@ -1443,7 +1443,7 @@  discard block
 block discarded – undo
1443 1443
                             lastedit_user_id != $user_id $sessionCondition AND
1444 1444
                             visibility != 2 AND
1445 1445
                             (to_user_id IN ('$user_id', '0') OR to_user_id IS NULL) AND
1446
-                            (to_group_id IN ('".implode("','",$group_ids)."') OR to_group_id IS NULL)
1446
+                            (to_group_id IN ('".implode("','", $group_ids)."') OR to_group_id IS NULL)
1447 1447
                         ORDER BY lastedit_date DESC
1448 1448
                         LIMIT 1";
1449 1449
                 $result = Database::query($sql);
@@ -1461,9 +1461,8 @@  discard block
 block discarded – undo
1461 1461
         $return = '&nbsp;';
1462 1462
         foreach ($notifications as $notification) {
1463 1463
             $toolName = $notification['tool'];
1464
-            if (!
1465
-                (
1466
-                    $notification['visibility'] == '1'  ||
1464
+            if (!(
1465
+                    $notification['visibility'] == '1' ||
1467 1466
                     ($status == '1' && $notification['visibility'] == '0') ||
1468 1467
                     !isset($notification['visibility'])
1469 1468
                 )
@@ -1547,9 +1546,9 @@  discard block
 block discarded – undo
1547 1546
             $main_user_table = Database :: get_main_table(TABLE_MAIN_USER);
1548 1547
             $tbl_session = Database :: get_main_table(TABLE_MAIN_SESSION);
1549 1548
             // Request for the name of the general coach
1550
-            $sql ='SELECT tu.lastname, tu.firstname, ts.*
1549
+            $sql = 'SELECT tu.lastname, tu.firstname, ts.*
1551 1550
                     FROM '.$tbl_session.' ts
1552
-                    LEFT JOIN '.$main_user_table .' tu
1551
+                    LEFT JOIN '.$main_user_table.' tu
1553 1552
                     ON ts.id_coach = tu.user_id
1554 1553
                     WHERE ts.id = '.intval($session_id);
1555 1554
             $rs = Database::query($sql);
@@ -1561,7 +1560,7 @@  discard block
 block discarded – undo
1561 1560
             $session['title'] = $session_info['name'];
1562 1561
             $session['id_coach'] = $session_info['id_coach'];
1563 1562
             $session['coach'] = '';
1564
-            $session['dates'] =  '';
1563
+            $session['dates'] = '';
1565 1564
 
1566 1565
             if (($session_info['access_end_date'] == '0000-00-00 00:00:00' && $session_info['access_start_date'] == '0000-00-00 00:00:00') ||
1567 1566
                 ($session_info['access_end_date'] == '0000-00-00 00:00:00' && $session_info['access_start_date'] == '0000-00-00 00:00:00') ||
@@ -1633,7 +1632,7 @@  discard block
 block discarded – undo
1633 1632
                 $session['dates'] = $dates['access'];
1634 1633
 
1635 1634
 
1636
-                if (api_get_setting('show_session_coach') === 'true' ) {
1635
+                if (api_get_setting('show_session_coach') === 'true') {
1637 1636
                     $session['coach'] = api_get_person_name(
1638 1637
                         $session_info['firstname'],
1639 1638
                         $session_info['lastname']
@@ -1687,9 +1686,9 @@  discard block
 block discarded – undo
1687 1686
 		$percentage = isset($point_info['point_average']) ? $point_info['point_average'] : 0;
1688 1687
 
1689 1688
 		if (!empty($percentage)) {
1690
-            $percentage = $percentage*125/100;
1689
+            $percentage = $percentage * 125 / 100;
1691 1690
         }
1692
-		$accesses =  isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1691
+		$accesses = isset($point_info['accesses']) ? $point_info['accesses'] : 0;
1693 1692
 
1694 1693
 		$star_label = sprintf(get_lang('XStarsOutOf5'), $point_info['point_average_star']);
1695 1694
 
@@ -1704,19 +1703,19 @@  discard block
 block discarded – undo
1704 1703
 
1705 1704
 		$labels = array();
1706 1705
 
1707
-		$labels[]= $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1708
-		$labels[]= $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1706
+		$labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
1707
+		$labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
1709 1708
 		/* if (!empty($number_of_users_who_voted)) {
1710 1709
 			$labels[]= get_lang('Average').' '.$point_info['point_average_star'].'/5';
1711 1710
 		} */
1712 1711
 
1713
-		$labels[]= $point_info['user_vote']  ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote'). ' [?] ';
1712
+		$labels[] = $point_info['user_vote'] ? get_lang('YourVote').' ['.$point_info['user_vote'].']' : get_lang('YourVote').' [?] ';
1714 1713
 
1715 1714
 		if (!$add_div_wrapper && api_is_anonymous()) {
1716
-			$labels[]= Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1715
+			$labels[] = Display::tag('span', get_lang('LoginToVote'), array('class' => 'error'));
1717 1716
 		}
1718 1717
 
1719
-        $html .= Display::div(implode(' | ', $labels) , array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1718
+        $html .= Display::div(implode(' | ', $labels), array('id' =>  'vote_label_'.$id, 'class' => 'vote_label_info'));
1720 1719
         $html .= ' '.Display::span(' ', array('id' =>  'vote_label2_'.$id));
1721 1720
 
1722 1721
         if ($add_div_wrapper) {
@@ -1789,8 +1788,8 @@  discard block
 block discarded – undo
1789 1788
         if (!empty($list)) {
1790 1789
             $html = '<dl class="dl-horizontal">';
1791 1790
             foreach ($list as $item) {
1792
-                $html .= '<dt>' . $item['title'] . '</dt>';
1793
-                $html .= '<dd>' . $item['content'] . '</dd>';
1791
+                $html .= '<dt>'.$item['title'].'</dt>';
1792
+                $html .= '<dd>'.$item['content'].'</dd>';
1794 1793
             }
1795 1794
             $html .= '</dl>';
1796 1795
         }
@@ -1832,7 +1831,7 @@  discard block
 block discarded – undo
1832 1831
      * @param string $type
1833 1832
      * @return null|string
1834 1833
      */
1835
-    public static function badge($count, $type ="warning")
1834
+    public static function badge($count, $type = "warning")
1836 1835
     {
1837 1836
         $class = '';
1838 1837
 
@@ -1908,7 +1907,7 @@  discard block
 block discarded – undo
1908 1907
         if (!empty($content)) {
1909 1908
             $html = '<span class="label '.$class.'">';
1910 1909
             $html .= $content;
1911
-            $html .='</span>';
1910
+            $html .= '</span>';
1912 1911
         }
1913 1912
 
1914 1913
         return $html;
@@ -1929,7 +1928,7 @@  discard block
 block discarded – undo
1929 1928
                     $class = 'class ="active"';
1930 1929
                 }
1931 1930
 
1932
-                if (basename($_SERVER['REQUEST_URI']) == basename($value['url']) ) {
1931
+                if (basename($_SERVER['REQUEST_URI']) == basename($value['url'])) {
1933 1932
                     $class = 'class ="active"';
1934 1933
                 }
1935 1934
                 $html .= "<li $class >";
@@ -2198,7 +2197,7 @@  discard block
 block discarded – undo
2198 2197
         }
2199 2198
         $label = $nextValue + $localCounter + 1;
2200 2199
         if ($isMedia) {
2201
-            $label = ($fixedValue + 1) .' '.chr(97 + $localCounter);
2200
+            $label = ($fixedValue + 1).' '.chr(97 + $localCounter);
2202 2201
             $link_to_show = $link.$fixedValue.'#questionanchor'.$itemId;
2203 2202
         }
2204 2203
         $link = Display::url($label.' ', $link_to_show, $linkAttributes);
@@ -2381,7 +2380,7 @@  discard block
 block discarded – undo
2381 2380
         $attributes['title'] = isset($attributes['title']) ? $attributes['title'] : $text;
2382 2381
 
2383 2382
         if (!$includeText) {
2384
-            $text = '<span class="sr-only">' . $text . '</span>';
2383
+            $text = '<span class="sr-only">'.$text.'</span>';
2385 2384
         }
2386 2385
 
2387 2386
         return self::url("$icon $text", $url, $attributes);
@@ -2396,9 +2395,9 @@  discard block
 block discarded – undo
2396 2395
      */
2397 2396
     public static function toolbarAction($id, $content = array(), $col = 2, $right = true)
2398 2397
     {
2399
-        $columns = 12/$col;
2398
+        $columns = 12 / $col;
2400 2399
         $html = '';
2401
-        $html .= '<div id="' . $id . '" class="actions">';
2400
+        $html .= '<div id="'.$id.'" class="actions">';
2402 2401
         $html .= '<div class="row">';
2403 2402
         if ($col > 4) {
2404 2403
             $html = '<div class="alert alert-warning" role="alert">
@@ -2406,7 +2405,7 @@  discard block
 block discarded – undo
2406 2405
             </div>';
2407 2406
         } else {
2408 2407
             for ($i = 0; $i < $col; $i++) {
2409
-                $html .= '<div class="col-md-' . $columns . '">';
2408
+                $html .= '<div class="col-md-'.$columns.'">';
2410 2409
                 if ($col == 2 && $i == 1) {
2411 2410
                     if ($right === true) {
2412 2411
                         $html .= '<div class="pull-right">';
@@ -2522,9 +2521,9 @@  discard block
 block discarded – undo
2522 2521
             $params['class'] = 'panel panel-default';
2523 2522
             $html = null;
2524 2523
             if (!empty($title)) {
2525
-                $html .= '<div class="panel-heading">'.$title.'</div>' . PHP_EOL;
2524
+                $html .= '<div class="panel-heading">'.$title.'</div>'.PHP_EOL;
2526 2525
             }
2527
-            $html.= '<div class="panel-body">'.$content.'</div>' . PHP_EOL;
2526
+            $html .= '<div class="panel-body">'.$content.'</div>'.PHP_EOL;
2528 2527
             $html = Display::div($html, $params);
2529 2528
         }
2530 2529
         return $html;
@@ -2558,7 +2557,7 @@  discard block
 block discarded – undo
2558 2557
      * @param string $toolbar
2559 2558
      * @return string
2560 2559
      */
2561
-    public static function getUserCard($userInfo, $status= '', $toolbar = '')
2560
+    public static function getUserCard($userInfo, $status = '', $toolbar = '')
2562 2561
     {
2563 2562
         if (!empty($status)) {
2564 2563
             $status = '<div class="items-user-status">'.$status.'</div>';
Please login to merge, or discard this patch.
main/inc/lib/events.lib.php 3 patches
Braces   +12 added lines, -4 removed lines patch added patch discarded remove patch
@@ -333,8 +333,12 @@  discard block
 block discarded – undo
333 333
     ) {
334 334
         global $debug;
335 335
 
336
-        if ($debug) error_log('Called to update_event_exercice');
337
-        if ($debug) error_log('duration:' . $duration);
336
+        if ($debug) {
337
+            error_log('Called to update_event_exercice');
338
+        }
339
+        if ($debug) {
340
+            error_log('duration:' . $duration);
341
+        }
338 342
 
339 343
         if ($exeid != '') {
340 344
             /*
@@ -386,8 +390,12 @@  discard block
 block discarded – undo
386 390
         		 WHERE exe_id = '".Database::escape_string($exeid)."'";
387 391
             $res = Database::query($sql);
388 392
 
389
-            if ($debug) error_log('update_event_exercice called');
390
-            if ($debug) error_log("$sql");
393
+            if ($debug) {
394
+                error_log('update_event_exercice called');
395
+            }
396
+            if ($debug) {
397
+                error_log("$sql");
398
+            }
391 399
 
392 400
             //Deleting control time session track
393 401
             //ExerciseLib::exercise_time_control_delete($exo_id);
Please login to merge, or discard this patch.
Spacing   +9 added lines, -11 removed lines patch added patch discarded remove patch
@@ -77,9 +77,7 @@  discard block
 block discarded – undo
77 77
         Database::query($sql);
78 78
 
79 79
         // Auto subscribe
80
-        $user_status = $userInfo['status']  == SESSIONADMIN ? 'sessionadmin' :
81
-            $userInfo['status'] == COURSEMANAGER ? 'teacher' :
82
-                $userInfo['status'] == DRH ? 'DRH' : 'student';
80
+        $user_status = $userInfo['status'] == SESSIONADMIN ? 'sessionadmin' : $userInfo['status'] == COURSEMANAGER ? 'teacher' : $userInfo['status'] == DRH ? 'DRH' : 'student';
83 81
         $autoSubscribe = api_get_setting($user_status.'_autosubscribe');
84 82
         if ($autoSubscribe) {
85 83
             $autoSubscribe = explode('|', $autoSubscribe);
@@ -336,7 +334,7 @@  discard block
 block discarded – undo
336 334
         global $debug;
337 335
 
338 336
         if ($debug) error_log('Called to update_event_exercice');
339
-        if ($debug) error_log('duration:' . $duration);
337
+        if ($debug) error_log('duration:'.$duration);
340 338
 
341 339
         if ($exeid != '') {
342 340
             /*
@@ -384,7 +382,7 @@  discard block
 block discarded – undo
384 382
         		   status = '".$status."',
385 383
         		   questions_to_check = '".$remind_list."',
386 384
         		   data_tracking = '".implode(',', $question_list)."',
387
-                   user_ip = '" . Database::escape_string(api_get_real_ip()) . "'
385
+                   user_ip = '" . Database::escape_string(api_get_real_ip())."'
388 386
         		 WHERE exe_id = '".Database::escape_string($exeid)."'";
389 387
             $res = Database::query($sql);
390 388
 
@@ -1055,15 +1053,15 @@  discard block
 block discarded – undo
1055 1053
 
1056 1054
         if (!empty($exe_list) && is_array($exe_list) && count($exe_list) > 0) {
1057 1055
             $sql = "DELETE FROM $track_e_exercises
1058
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1056
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1059 1057
             Database::query($sql);
1060 1058
 
1061 1059
             $sql = "DELETE FROM $track_attempts
1062
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1060
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1063 1061
             Database::query($sql);
1064 1062
 
1065 1063
             $sql = "DELETE FROM $recording_table
1066
-                WHERE exe_id IN (" . implode(',', $exe_list) . ")";
1064
+                WHERE exe_id IN (".implode(',', $exe_list).")";
1067 1065
             Database::query($sql);
1068 1066
         }
1069 1067
 
@@ -1105,7 +1103,7 @@  discard block
 block discarded – undo
1105 1103
             Event::addEvent(
1106 1104
                 LOG_EXERCISE_RESULT_DELETE,
1107 1105
                 LOG_EXERCISE_AND_USER_ID,
1108
-                $exercise_id . '-' . $user_id,
1106
+                $exercise_id.'-'.$user_id,
1109 1107
                 null,
1110 1108
                 null,
1111 1109
                 $course_id,
@@ -1705,7 +1703,7 @@  discard block
 block discarded – undo
1705 1703
         Event::addEvent(
1706 1704
             LOG_QUESTION_RESULT_DELETE,
1707 1705
             LOG_EXERCISE_ATTEMPT_QUESTION_ID,
1708
-            $exe_id . '-' . $question_id,
1706
+            $exe_id.'-'.$question_id,
1709 1707
             null,
1710 1708
             null,
1711 1709
             $courseId,
@@ -1741,7 +1739,7 @@  discard block
 block discarded – undo
1741 1739
         Event::addEvent(
1742 1740
             LOG_QUESTION_RESULT_DELETE,
1743 1741
             LOG_EXERCISE_ATTEMPT_QUESTION_ID,
1744
-            $exe_id . '-' . $question_id,
1742
+            $exe_id.'-'.$question_id,
1745 1743
             null,
1746 1744
             null,
1747 1745
             $courseId,
Please login to merge, or discard this patch.
Doc Comments   +24 added lines, -9 removed lines patch added patch discarded remove patch
@@ -239,7 +239,7 @@  discard block
 block discarded – undo
239 239
     }
240 240
 
241 241
     /**
242
-     * @param doc_id id of document (id in mainDb.document table)
242
+     * @param doc_id string of document (id in mainDb.document table)
243 243
      * @author Sebastien Piraux <[email protected]>
244 244
      * @desc Record information for upload event
245 245
      * used in the works tool to record informations when
@@ -313,6 +313,9 @@  discard block
 block discarded – undo
313 313
      * @param   int     session_id
314 314
      * @param   int     learnpath_id (id of the learnpath)
315 315
      * @param   int     learnpath_item_id (id of the learnpath_item)
316
+     * @param integer $score
317
+     * @param integer $weighting
318
+     * @param integer $session_id
316 319
      *
317 320
      * @author Sebastien Piraux <[email protected]>
318 321
      * @author Julio Montoya Armas <[email protected]> Reworked 2010
@@ -414,7 +417,9 @@  discard block
 block discarded – undo
414 417
      * @param	integer	Session ID (from the session table). Default value of null means "get from context".
415 418
      * @param	integer	Learnpath ID (from c_lp table). Default value of null means "get from context".
416 419
      * @param	integer	Learnpath item ID (from the c_lp_item table). Default value of null means "get from context".
417
-     * @return	boolean	Result of the insert query
420
+     * @param integer $exe_id
421
+     * @param integer $position
422
+     * @return	false|string	Result of the insert query
418 423
      */
419 424
     public static function saveQuestionAttempt(
420 425
         $score,
@@ -591,6 +596,8 @@  discard block
 block discarded – undo
591 596
      * @param	int		Whether this answer is correct (1) or not (0)
592 597
      * @param	string	Coordinates of this point (e.g. 123;324)
593 598
      * @param	bool update results?
599
+     * @param integer $exe_id
600
+     * @param integer $correct
594 601
      * @return	boolean	Result of the insert query
595 602
      * @uses Course code and user_id from global scope $_cid and $_user
596 603
      */
@@ -808,11 +815,11 @@  discard block
 block discarded – undo
808 815
     /**
809 816
      * Save the new message for one event and for one language
810 817
      *
811
-     * @param string $eventName
818
+     * @param string $event_name
812 819
      * @param array $users
813 820
      * @param string $message
814 821
      * @param string $subject
815
-     * @param string $eventMessageLanguage
822
+     * @param string $event_message_language
816 823
      * @param int $activated
817 824
      */
818 825
     public static function save_event_type_message($event_name, $users, $message, $subject, $event_message_language, $activated)
@@ -946,10 +953,10 @@  discard block
 block discarded – undo
946 953
     }
947 954
 
948 955
     /**
949
-     * @param $user_id
956
+     * @param integer $user_id
950 957
      * @param $exerciseId
951
-     * @param $lp_id
952
-     * @param $lp_item_id
958
+     * @param integer $lp_id
959
+     * @param integer $lp_item_id
953 960
      * @return int
954 961
      */
955 962
     public static function get_attempt_count_not_finished($user_id, $exerciseId, $lp_id, $lp_item_id)
@@ -1126,6 +1133,7 @@  discard block
 block discarded – undo
1126 1133
      * @param   int     exercise id
1127 1134
      * @param   int $courseId
1128 1135
      * @param   int     session id
1136
+     * @param integer $user_id
1129 1137
      * @return  array   with the results
1130 1138
      *
1131 1139
      */
@@ -1222,6 +1230,7 @@  discard block
 block discarded – undo
1222 1230
      * @param   int     exercise id
1223 1231
      * @param   int  $courseId
1224 1232
      * @param   int     session id
1233
+     * @param integer $user_id
1225 1234
      * @return  array   with the results
1226 1235
      *
1227 1236
      */
@@ -1313,6 +1322,8 @@  discard block
 block discarded – undo
1313 1322
      * @param   int     lp id
1314 1323
      * @param   int     lp item id
1315 1324
      * @param   string 	order asc or desc
1325
+     * @param integer $courseId
1326
+     * @param string $order
1316 1327
      * @return  array   with the results
1317 1328
      *
1318 1329
      */
@@ -1379,7 +1390,7 @@  discard block
 block discarded – undo
1379 1390
      * @param   int     exercise id
1380 1391
      * @param   int     $courseId
1381 1392
      * @param   int     session id
1382
-     * @return  array   with the results
1393
+     * @return  string   with the results
1383 1394
      *
1384 1395
      */
1385 1396
     public static function count_exercise_attempts_by_user($user_id, $exercise_id, $courseId, $session_id = 0)
@@ -1551,7 +1562,7 @@  discard block
 block discarded – undo
1551 1562
      * @param   int     exercise id
1552 1563
      * @param   int   course id
1553 1564
      * @param   int     session id
1554
-     * @return  array   with the results
1565
+     * @return  integer   with the results
1555 1566
      *
1556 1567
      */
1557 1568
     public static function get_count_exercises_attempted_by_course($courseId, $session_id = 0)
@@ -1795,6 +1806,10 @@  discard block
 block discarded – undo
1795 1806
         CourseManager::update_course_ranking(null, null, null, null, true, false);
1796 1807
     }
1797 1808
 
1809
+    /**
1810
+     * @param integer $userId
1811
+     * @param integer $sessionId
1812
+     */
1798 1813
     public static function eventCourseVirtualLogin($courseId, $userId, $sessionId, $virtualTime = '')
1799 1814
     {
1800 1815
         $courseTrackingTable = Database::get_main_table(TABLE_STATISTIC_TRACK_E_COURSE_ACCESS);
Please login to merge, or discard this patch.
main/inc/lib/skill.lib.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -33,11 +33,11 @@  discard block
 block discarded – undo
33 33
     }
34 34
 
35 35
     /**
36
-    * This function is for editing profile info from profile_id.
37
-    * @param int    $profileId
38
-    * @param string $name
39
-    * @param string $description
40
-    */
36
+     * This function is for editing profile info from profile_id.
37
+     * @param int    $profileId
38
+     * @param string $name
39
+     * @param string $description
40
+     */
41 41
     public function updateProfileInfo($profileId, $name, $description)
42 42
     {
43 43
         $profileId = intval($profileId);
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
     }
129 129
 
130 130
     /**
131
-    * This function is for getting profile info from profile_id.
132
-    * @param int $profileId
133
-    */
131
+     * This function is for getting profile info from profile_id.
132
+     * @param int $profileId
133
+     */
134 134
 
135 135
     public function getProfileInfo($profileId)
136 136
     {
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -803,7 +803,7 @@  discard block
 block discarded – undo
803 803
                     $attributes = array(
804 804
                         'skill_id'      => $skill_id,
805 805
                         'parent_id'     => $parent_id,
806
-                        'relation_type' => (isset($params['relation_type'])?$params['relation_type']:0),
806
+                        'relation_type' => (isset($params['relation_type']) ? $params['relation_type'] : 0),
807 807
                         //'level'         => $params['level'],
808 808
                     );
809 809
                     $skill_rel_skill->save($attributes);
@@ -1012,7 +1012,7 @@  discard block
 block discarded – undo
1012 1012
                     $skills[$skill_id] = $skill_info;
1013 1013
                     // Uncomment code below to hide the searched skill
1014 1014
                     $skills[$skill_id]['data']['parent_id'] = $skill_info['extra']['parent_id'];
1015
-                    $skills[$skill_id]['parent_id'] =  1;
1015
+                    $skills[$skill_id]['parent_id'] = 1;
1016 1016
                 }
1017 1017
             }
1018 1018
         }
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
                     $skill['data']['skill_has_gradebook'] = true;
1078 1078
                 }
1079 1079
                 $refs[$skill['id']] = &$skill;
1080
-                $flat_array[$skill['id']] =  &$skill;
1080
+                $flat_array[$skill['id']] = &$skill;
1081 1081
             }
1082 1082
 
1083 1083
             // Checking family value
@@ -1098,7 +1098,7 @@  discard block
 block discarded – undo
1098 1098
                 $refs['root']['children'][0] = $skills[1];
1099 1099
                 $skills[$skill_id]['data']['family_id'] = 1;
1100 1100
                 $refs['root']['children'][0]['children'][0] = $skills[$skill_id];
1101
-                $flat_array[$skill_id] =  $skills[$skill_id];
1101
+                $flat_array[$skill_id] = $skills[$skill_id];
1102 1102
             } else {
1103 1103
                 // Moving node to the children index of their parents
1104 1104
 
@@ -1107,7 +1107,7 @@  discard block
 block discarded – undo
1107 1107
                         $skill['data']['family_id'] = $new_family_array[$skill['id']];
1108 1108
                     }
1109 1109
                     $refs[$skill['parent_id']]['children'][] = &$skill;
1110
-                    $flat_array[$my_skill_id] =  $skill;
1110
+                    $flat_array[$my_skill_id] = $skill;
1111 1111
                 }
1112 1112
             }
1113 1113
 
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
                 INNER JOIN {$this->table_skill_rel_user} su
1220 1220
                 ON (s.id = su.skill_id)
1221 1221
                 WHERE user_id = $user_id";
1222
-        $result  = Database::query($sql);
1222
+        $result = Database::query($sql);
1223 1223
         if (Database::num_rows($result)) {
1224 1224
             $result = Database::fetch_row($result);
1225 1225
             return $result[0];
@@ -1261,7 +1261,7 @@  discard block
 block discarded – undo
1261 1261
      */
1262 1262
     public function get_user_list_skill_ranking_count()
1263 1263
     {
1264
-        $sql    = "SELECT count(*) FROM (
1264
+        $sql = "SELECT count(*) FROM (
1265 1265
                         SELECT count(distinct 1)
1266 1266
                         FROM {$this->table} s
1267 1267
                         INNER JOIN {$this->table_skill_rel_user} su
@@ -1316,7 +1316,7 @@  discard block
 block discarded – undo
1316 1316
                 ON c.code = g.course_code
1317 1317
                 WHERE sg.skill_id = $skill_id
1318 1318
                 AND (g.session_id IS NULL OR g.session_id = 0)";
1319
-        $result   = Database::query($sql);
1319
+        $result = Database::query($sql);
1320 1320
 
1321 1321
         return Database::store_result($result, 'ASSOC');
1322 1322
     }
@@ -1505,7 +1505,7 @@  discard block
 block discarded – undo
1505 1505
                 WHERE sg.skill_id = $skillId
1506 1506
                 AND g.session_id > 0";
1507 1507
 
1508
-        $result   = Database::query($sql);
1508
+        $result = Database::query($sql);
1509 1509
 
1510 1510
         return Database::store_result($result, 'ASSOC');
1511 1511
     }
Please login to merge, or discard this patch.
Doc Comments   +4 added lines, -3 removed lines patch added patch discarded remove patch
@@ -348,6 +348,7 @@  discard block
 block discarded – undo
348 348
 
349 349
     /**
350 350
      * Gets an element
351
+     * @param integer $gradebook_id
351 352
      */
352 353
     public function get_skill_info($skill_id, $gradebook_id)
353 354
     {
@@ -577,7 +578,7 @@  discard block
 block discarded – undo
577 578
      * Gets an element
578 579
      * @param int $id
579 580
      *
580
-     * @return array|mixed
581
+     * @return integer
581 582
      */
582 583
     public function get($id)
583 584
     {
@@ -923,7 +924,7 @@  discard block
 block discarded – undo
923 924
     /**
924 925
      * Get user's skills
925 926
      *
926
-     * @param int $userId User's id
927
+     * @param integer $user_id User's id
927 928
      * @param bool $get_skill_data
928 929
      */
929 930
     public function get_user_skills($user_id, $get_skill_data = false)
@@ -1133,7 +1134,7 @@  discard block
 block discarded – undo
1133 1134
      * @param int skill id
1134 1135
      * @param bool return a flat array or not
1135 1136
      * @param int depth of the skills
1136
-     * @return json
1137
+     * @return string
1137 1138
      */
1138 1139
     public function get_skills_tree_json(
1139 1140
         $user_id = null,
Please login to merge, or discard this patch.
main/inc/lib/search/xapian/XapianQuery.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -8,11 +8,11 @@  discard block
 block discarded – undo
8 8
  * Code
9 9
  */
10 10
 require_once 'xapian.php';
11
-require_once dirname(__FILE__) . '/../IndexableChunk.class.php';
11
+require_once dirname(__FILE__).'/../IndexableChunk.class.php';
12 12
 //TODO: think another way without including specific fields here
13
-require_once api_get_path(LIBRARY_PATH) . 'specific_fields_manager.lib.php';
13
+require_once api_get_path(LIBRARY_PATH).'specific_fields_manager.lib.php';
14 14
 
15
-define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH) . 'plugins/xapian/searchdb/');
15
+define('XAPIAN_DB', api_get_path(SYS_UPLOAD_PATH).'plugins/xapian/searchdb/');
16 16
 
17 17
 /**
18 18
  * Queries the database.
@@ -95,7 +95,7 @@  discard block
 block discarded – undo
95 95
 
96 96
                 // process each specific field prefix
97 97
                 foreach ($specific_fields as $specific_field) {
98
-                    $results[$count]['sf-' . $specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']);
98
+                    $results[$count]['sf-'.$specific_field['code']] = xapian_get_doc_terms($document, $specific_field['code']);
99 99
                 }
100 100
 
101 101
                 // rest of data
@@ -261,6 +261,6 @@  discard block
 block discarded – undo
261 261
     } else {
262 262
         $message_error = get_lang('SearchOtherXapianError');
263 263
     }
264
-    $display_message = get_lang('Error') . ' : ' . $message_error;
264
+    $display_message = get_lang('Error').' : '.$message_error;
265 265
     Display::display_error_message($display_message);
266 266
 }
Please login to merge, or discard this patch.
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -239,6 +239,7 @@
 block discarded – undo
239 239
 /**
240 240
  * @author Isaac flores paz <[email protected]>
241 241
  * @param String The xapian error message
242
+ * @param string $xapian_error_message
242 243
  * @return String The chamilo error message
243 244
  */
244 245
 function display_xapian_error($xapian_error_message) {
Please login to merge, or discard this patch.