Browse Source

Minor - format code

Julio 6 years ago
parent
commit
4fd0123556

+ 3 - 4
main/inc/email_editor.php

@@ -79,11 +79,10 @@ if ($form->validate()) {
             $text,
             api_get_person_name($_user['firstname'], $_user['lastname']),
             '',
-            ['reply_to' => 
-                [
+            ['reply_to' => [
                     'mail' => $_user['mail'],
-                    'name' => api_get_person_name($_user['firstname'], $_user['lastname'])
-                ]
+                    'name' => api_get_person_name($_user['firstname'], $_user['lastname']),
+                ],
             ]
         );
     } else {

+ 32 - 28
main/inc/lib/document.lib.php

@@ -276,8 +276,9 @@ class DocumentManager
 
         return 'application/octet-stream';
     }
-	 /**
-     * This function smart streams a file to the client using HTTP headers
+
+    /**
+     * This function smart streams a file to the client using HTTP headers.
      *
      * @param string $fullFilename The full path of the file to be sent
      * @param string $filename     The name of the file as shown to the client
@@ -285,25 +286,27 @@ class DocumentManager
      *
      * @return bool false if file doesn't exist, true if stream succeeded
      */
-	public static function smartReadFile($fullFilename, $filename, $contentType = 'application/octet-stream')
-	{
+    public static function smartReadFile($fullFilename, $filename, $contentType = 'application/octet-stream')
+    {
         if (!file_exists($fullFilename)) {
-            header ("HTTP/1.1 404 Not Found");
+            header("HTTP/1.1 404 Not Found");
+
             return false;
         }
 
         $size = filesize($fullFilename);
         $time = date('r', filemtime($fullFilename));
-        
+
         $fm = @fopen($fullFilename, 'rb');
         if (!$fm) {
-            header ("HTTP/1.1 505 Internal server error");
+            header("HTTP/1.1 505 Internal server error");
+
             return false;
         }
-        
+
         $begin = 0;
         $end = $size - 1;
-        
+
         if (isset($_SERVER['HTTP_RANGE'])) {
             if (preg_match('/bytes=\h*(\d+)-(\d*)[\D.*]?/i', $_SERVER['HTTP_RANGE'], $matches)) {
                 $begin = intval($matches[1]);
@@ -312,33 +315,34 @@ class DocumentManager
                 }
             }
         }
-    
+
         if (isset($_SERVER['HTTP_RANGE'])) {
             header('HTTP/1.1 206 Partial Content');
         } else {
             header('HTTP/1.1 200 OK');
         }
-        
-        header("Content-Type: $contentType"); 
+
+        header("Content-Type: $contentType");
         header('Cache-Control: public, must-revalidate, max-age=0');
-        header('Pragma: no-cache');  
+        header('Pragma: no-cache');
         header('Accept-Ranges: bytes');
-        header('Content-Length:' . (($end - $begin) + 1));
+        header('Content-Length:'.(($end - $begin) + 1));
         if (isset($_SERVER['HTTP_RANGE'])) {
             header("Content-Range: bytes $begin-$end/$size");
         }
         header("Content-Disposition: inline; filename=$filename");
         header("Content-Transfer-Encoding: binary");
         header("Last-Modified: $time");
-        
+
         $cur = $begin;
         fseek($fm, $begin, 0);
-        
-        while(!feof($fm) && $cur <= $end && (connection_status() == 0)) {
-            print fread($fm, min(1024 * 16, ($end - $cur) + 1));
+
+        while (!feof($fm) && $cur <= $end && (connection_status() == 0)) {
+            echo fread($fm, min(1024 * 16, ($end - $cur) + 1));
             $cur += 1024 * 16;
         }
     }
+
     /**
      * This function streams a file to the client.
      *
@@ -435,16 +439,16 @@ class DocumentManager
                         }
                     }
                     break;
-				case 'video/mp4':
-				case 'audio/mpeg':
-				case 'audio/mp4':
-				case 'audio/ogg':
-				case 'audio/webm':
-				case 'audio/wav':
-				case 'video/ogg':
-				case 'video/webm':		
-					self::smartReadFile($full_file_name,$filename,$contentType);
-					exit;
+                case 'video/mp4':
+                case 'audio/mpeg':
+                case 'audio/mp4':
+                case 'audio/ogg':
+                case 'audio/webm':
+                case 'audio/wav':
+                case 'video/ogg':
+                case 'video/webm':
+                    self::smartReadFile($full_file_name, $filename, $contentType);
+                    exit;
                 case 'application/vnd.dwg':
                 case 'application/vnd.dwf':
                     header('Content-type: application/octet-stream');

+ 3 - 3
main/inc/lib/exercise.lib.php

@@ -4850,7 +4850,7 @@ EOT;
     }
 
     /**
-     * Display the ranking of results in a exercise
+     * Display the ranking of results in a exercise.
      *
      * @param int $exerciseId
      * @param int $currentUserId
@@ -4896,7 +4896,7 @@ EOT;
 
     /**
      * Get the ranking for results in a exercise.
-     * Function used internally by ExerciseLib::displayResultsInRanking
+     * Function used internally by ExerciseLib::displayResultsInRanking.
      *
      * @param int $exerciseId
      * @param int $courseId
@@ -4947,7 +4947,7 @@ EOT;
         $data = array_map(
             function ($item) use (&$lastScore, &$position) {
                 if ($item['exe_result'] < $lastScore) {
-                    ++$position;
+                    $position++;
                 }
 
                 $lastScore = $item['exe_result'];

+ 8 - 7
main/inc/lib/tracking.lib.php

@@ -5833,7 +5833,7 @@ class Tracking
                     if (!$learnpath['lp_visibility']) {
                         continue;
                     }
-                    
+
                     $progress = self::get_avg_student_progress(
                         $user_id,
                         $course,
@@ -5965,22 +5965,22 @@ class Tracking
     public static function generate_session_exercise_graph($names, $my_results, $average)
     {
         $html = api_get_js('chartjs/Chart.js');
-        $canvas = Display::tag('canvas', '', array('id' => 'session_graph_chart'));
-        $html .=  Display::tag('div',$canvas, array('style' => 'width:100%'));
+        $canvas = Display::tag('canvas', '', ['id' => 'session_graph_chart']);
+        $html .= Display::tag('div', $canvas, ['style' => 'width:100%']);
         $jsStr = " var data = {
-                       labels:".  json_encode($names).",
+                       labels:".json_encode($names).",
                        datasets: [
                        {
                          label: '".get_lang('MyResults')."',
                          backgroundColor: 'rgb(255, 99, 132)',
                          stack: 'Stack1',
-                         data: ".  json_encode($my_results).",
+                         data: ".json_encode($my_results).",
                         },
                         {
                          label: '".get_lang('AverageScore')."',
                          backgroundColor: 'rgb(75, 192, 192)',
                          stack: 'Stack2',
-                         data: ".  json_encode($average).",
+                         data: ".json_encode($average).",
                         },
                         ],  
                     };
@@ -6011,6 +6011,7 @@ class Tracking
                     }
                 });";
         $html .= Display::tag('script', $jsStr);
+
         return $html;
     }
 
@@ -6383,7 +6384,7 @@ class Tracking
             $myCache->saveFromCache($chartHash, $imgPath);
             $imgPath = api_get_path(WEB_ARCHIVE_PATH).$chartHash;
         }
-        
+
         return $imgPath;
     }
 

+ 1 - 5
main/tracking/courseLog.php

@@ -190,9 +190,7 @@ if (isset($_GET['additional_profile_field'])) {
             $user_array
         );
 
-        $extra_info[$fieldId] = UserManager::get_extra_field_information(
-            $fieldId
-        );
+        $extra_info[$fieldId] = UserManager::get_extra_field_information($fieldId);
     }
 }
 
@@ -202,8 +200,6 @@ Session::write('extra_field_info', $extra_info);
 // Display the header.
 Display::display_header($nameTools, 'Tracking');
 
-/* MAIN CODE */
-
 $actionsLeft = TrackingCourseLog::actionsLeft('users', $sessionId);
 
 $actionsRight = '<div class="pull-right">';

+ 1 - 1
plugin/buycourses/src/buy_course_plugin.class.php

@@ -1127,7 +1127,7 @@ class BuyCoursesPlugin extends Plugin
     }
 
     /**
-     * Get invoice numbering
+     * Get invoice numbering.
      *
      * @param int $saleId    The sale id
      * @param int $isService Check if a service