Browse Source

Minor - format code

jmontoyaa 7 years ago
parent
commit
e7403ee7b0
3 changed files with 200 additions and 202 deletions
  1. 39 39
      main/inc/lib/display.lib.php
  2. 51 51
      main/inc/lib/document.lib.php
  3. 110 112
      main/inc/lib/sessionmanager.lib.php

+ 39 - 39
main/inc/lib/display.lib.php

@@ -222,10 +222,10 @@ class Display
     public static function display_sortable_table(
         $header,
         $content,
-        $sorting_options = array(),
-        $paging_options = array(),
+        $sorting_options = [],
+        $paging_options = [],
         $query_vars = null,
-        $form_actions = array(),
+        $form_actions = [],
         $style = 'table'
     ) {
         $column = isset($sorting_options['column']) ? $sorting_options['column'] : 0;
@@ -267,10 +267,10 @@ class Display
     public static function return_sortable_table(
         $header,
         $content,
-        $sorting_options = array(),
-        $paging_options = array(),
+        $sorting_options = [],
+        $paging_options = [],
         $query_vars = null,
-        $form_actions = array(),
+        $form_actions = [],
         $style = 'table'
     ) {
         ob_start();
@@ -309,12 +309,12 @@ class Display
         $name,
         $header,
         $content,
-        $paging_options = array(),
+        $paging_options = [],
         $query_vars = null,
-        $form_actions = array(),
+        $form_actions = [],
         $visibility_options = true,
         $sort_data = true,
-        $grid_class = array()
+        $grid_class = []
     ) {
         echo self::return_sortable_grid(
             $name,
@@ -353,12 +353,12 @@ class Display
         $name,
         $header,
         $content,
-        $paging_options = array(),
+        $paging_options = [],
         $query_vars = null,
-        $form_actions = array(),
+        $form_actions = [],
         $visibility_options = true,
         $sort_data = true,
-        $grid_class = array(),
+        $grid_class = [],
         $elementCount = 0
     ) {
         $column = 0;
@@ -406,12 +406,12 @@ class Display
         $table_name,
         $header,
         $content,
-        $sorting_options = array(),
-        $paging_options = array(),
+        $sorting_options = [],
+        $paging_options = [],
         $query_vars = null,
-        $column_show = array(),
-        $column_order = array(),
-        $form_actions = array()
+        $column_show = [],
+        $column_order = [],
+        $form_actions = []
     ) {
         $column = isset($sorting_options['column']) ? $sorting_options['column'] : 0;
         $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;
@@ -731,7 +731,7 @@ class Display
     public static function display_icon(
         $image,
         $alt_text = '',
-        $additional_attributes = array(),
+        $additional_attributes = [],
         $size = null
     ) {
         echo self::return_icon($image, $alt_text, $additional_attributes, $size);
@@ -767,7 +767,7 @@ class Display
     public static function return_icon(
         $image,
         $alt_text = '',
-        $additional_attributes = array(),
+        $additional_attributes = [],
         $size = ICON_SIZE_SMALL,
         $show_text = true,
         $return_only_path = false,
@@ -918,7 +918,7 @@ class Display
      * @return string
      * @author Julio Montoya 2010
      */
-    public static function tag($tag, $content, $additional_attributes = array())
+    public static function tag($tag, $content, $additional_attributes = [])
     {
         $attribute_list = '';
         // Managing the additional attributes
@@ -945,7 +945,7 @@ class Display
      *
      * @return string
      */
-    public static function url($name, $url, $attributes = array())
+    public static function url($name, $url, $attributes = [])
     {
         if (!empty($url)) {
             $url = preg_replace('#&#', '&', $url);
@@ -962,7 +962,7 @@ class Display
      * @param array $attributes
      * @return string
      */
-    public static function div($content, $attributes = array())
+    public static function div($content, $attributes = [])
     {
         return self::tag('div', $content, $attributes);
     }
@@ -970,7 +970,7 @@ class Display
     /**
      * Creates a span tag
      */
-    public static function span($content, $attributes = array())
+    public static function span($content, $attributes = [])
     {
         return self::tag('span', $content, $attributes);
     }
@@ -978,7 +978,7 @@ class Display
     /**
      * Displays an HTML input tag
      */
-    public static function input($type, $name, $value, $attributes = array())
+    public static function input($type, $name, $value, $attributes = [])
     {
         if (isset($type)) {
             $attributes['type'] = $type;
@@ -998,7 +998,7 @@ class Display
      * @param array $attributes
      * @return string
      */
-    public static function button($name, $value, $attributes = array())
+    public static function button($name, $value, $attributes = [])
     {
         if (!empty($name)) {
             $attributes['name'] = $name;
@@ -1014,7 +1014,7 @@ class Display
         $name,
         $values,
         $default = -1,
-        $extra_attributes = array(),
+        $extra_attributes = [],
         $show_blank_item = true,
         $blank_item_text = null
     ) {
@@ -1091,8 +1091,8 @@ class Display
         $headers,
         $items,
         $id = 'tabs',
-        $attributes = array(),
-        $ul_attributes = array()
+        $attributes = [],
+        $ul_attributes = []
     ) {
         if (empty($headers) || count($headers) == 0) {
             return '';
@@ -1195,7 +1195,7 @@ class Display
      * @example
      * After your Display::display_header function you have to add the nex javascript code:
      * <script>
-     *   echo Display::grid_js('my_grid_name', $url,$columns, $column_model, $extra_params,array());
+     *   echo Display::grid_js('my_grid_name', $url,$columns, $column_model, $extra_params,[]);
      *   // for more information of this function check the grid_js() function
      * </script>
      * //Then you have to call the grid_html
@@ -1254,7 +1254,7 @@ class Display
         $column_names,
         $column_model,
         $extra_params,
-        $data = array(),
+        $data = [],
         $formatter = '',
         $fixed_width = false
     ) {
@@ -1407,7 +1407,7 @@ class Display
      * @param array $attributes
      * @return string
      */
-    public static function table($headers, $rows, $attributes = array())
+    public static function table($headers, $rows, $attributes = [])
     {
         if (empty($attributes)) {
             $attributes['class'] = 'data_table';
@@ -1515,7 +1515,7 @@ class Display
 
         $group_ids = GroupManager::get_group_ids($courseInfo['real_id'], $user_id);
         $group_ids[] = 0; //add group 'everyone'
-        $notifications = array();
+        $notifications = [];
         if ($tools) {
             foreach ($tools as $tool) {
                 $toolName = $tool['name'];
@@ -1638,7 +1638,7 @@ class Display
         if (!$nosession) {
             global $now, $date_start, $date_end;
         }
-        $output = array();
+        $output = [];
         $active = false;
         if (!$nosession) {
             $main_user_table = Database::get_main_table(TABLE_MAIN_USER);
@@ -1653,7 +1653,7 @@ class Display
             $session_info = Database::store_result($rs, 'ASSOC');
             $session_info = $session_info[0];
 
-            $session = array();
+            $session = [];
             $session['category_id'] = $session_info['session_category_id'];
             $session['title'] = $session_info['name'];
             $session['id_coach'] = $session_info['id_coach'];
@@ -1750,7 +1750,7 @@ class Display
                     <li><a href="javascript:void(0);" data-link="'.$url.'&amp;star=5" title="'.$star_label.'" class="five-stars">5</a></li>
                 </ul>';
 
-        $labels = array();
+        $labels = [];
 
         $labels[] = $number_of_users_who_voted == 1 ? $number_of_users_who_voted.' '.get_lang('Vote') : $number_of_users_who_voted.' '.get_lang('Votes');
         $labels[] = $accesses == 1 ? $accesses.' '.get_lang('Visit') : $accesses.' '.get_lang('Visits');
@@ -1978,7 +1978,7 @@ class Display
                     $class = 'class ="active"';
                 }
                 $html .= "<li $class >";
-                $attributes = isset($value['url_attributes']) ? $value['url_attributes'] : array();
+                $attributes = isset($value['url_attributes']) ? $value['url_attributes'] : [];
                 $html .= self::url($value['content'], $value['url'], $attributes);
                 $html .= '</li>';
             }
@@ -2090,7 +2090,7 @@ class Display
      * @param array $params
      * @return null|string
      */
-    public static function getMediaPlayer($file, $params = array())
+    public static function getMediaPlayer($file, $params = [])
     {
         $fileInfo = pathinfo($file);
 
@@ -2217,7 +2217,7 @@ class Display
         $defaultClass = 'before';
         $class = $defaultClass;
         foreach ($conditions as $condition) {
-            $array = isset($condition['items']) ? $condition['items'] : array();
+            $array = isset($condition['items']) ? $condition['items'] : [];
             $class_to_applied = $condition['class'];
             $type = isset($condition['type']) ? $condition['type'] : 'positive';
             $mode = isset($condition['mode']) ? $condition['mode'] : 'add';
@@ -2564,7 +2564,7 @@ class Display
         $title,
         $content,
         $id = null,
-        $params = array(),
+        $params = [],
         $idAccordion = null,
         $idCollapse = null,
         $open = true,

+ 51 - 51
main/inc/lib/document.lib.php

@@ -484,7 +484,7 @@ class DocumentManager
         if ($originalPath == '/shared_folder') {
             $students = CourseManager::get_user_list_from_course_code($_course['code'], $sessionId);
             if (!empty($students)) {
-                $conditionList = array();
+                $conditionList = [];
                 foreach ($students as $studentId => $studentInfo) {
                     $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id'];
                 }
@@ -525,8 +525,8 @@ class DocumentManager
                 ";
         $result = Database::query($sql);
 
-        $doc_list = array();
-        $document_data = array();
+        $doc_list = [];
+        $document_data = [];
         $is_allowed_to_edit = api_is_allowed_to_edit(null, true);
         $isCoach = api_is_coach();
         if ($result !== false && Database::num_rows($result) != 0) {
@@ -570,8 +570,8 @@ class DocumentManager
 
             // Only for the student we filter the results see BT#1652
             if (!$isCoach && !$is_allowed_to_edit) {
-                $ids_to_remove = array();
-                $my_repeat_ids = $temp = array();
+                $ids_to_remove = [];
+                $my_repeat_ids = $temp = [];
 
                 // Selecting repeated ids
                 foreach ($doc_list as $row) {
@@ -615,7 +615,7 @@ class DocumentManager
                 }
 
                 // Checking parents visibility.
-                $final_document_data = array();
+                $final_document_data = [];
                 foreach ($document_data as $row) {
                     $is_visible = self::check_visibility_tree(
                         $row['id'],
@@ -660,14 +660,14 @@ class DocumentManager
         $TABLE_ITEMPROPERTY = Database::get_course_table(TABLE_ITEM_PROPERTY);
         $TABLE_DOCUMENT = Database::get_course_table(TABLE_DOCUMENT);
         $groupIid = intval($groupIid);
-        $document_folders = array();
+        $document_folders = [];
 
         $students = CourseManager::get_user_list_from_course_code(
             $_course['code'],
             api_get_session_id()
         );
 
-        $conditionList = array();
+        $conditionList = [];
         if (!empty($students)) {
             foreach ($students as $studentId => $studentInfo) {
                 $conditionList[] = '/shared_folder/sf_user_'.$studentInfo['user_id'];
@@ -791,7 +791,7 @@ class DocumentManager
 
             $result = Database::query($sql);
 
-            $visibleFolders = array();
+            $visibleFolders = [];
             while ($row = Database::fetch_array($result, 'ASSOC')) {
                 $visibleFolders[$row['id']] = $row['path'];
             }
@@ -813,7 +813,7 @@ class DocumentManager
                         last.c_id = {$_course['real_id']} AND
                         docs.c_id = {$_course['real_id']} ";
             $result = Database::query($sql);
-            $invisibleFolders = array();
+            $invisibleFolders = [];
             while ($row = Database::fetch_array($result, 'ASSOC')) {
                 //get visible folders in the invisible ones -> they are invisible too
                 $sql = "SELECT DISTINCT docs.id, path
@@ -1356,7 +1356,7 @@ class DocumentManager
             } else {
                 $row['parent_id'] = self::get_document_id($course_info, dirname($row['path']), $session_id);
             }
-            $parents = array();
+            $parents = [];
 
             //Use to generate parents (needed for the breadcrumb)
             //@todo sorry but this for is here because there's not a parent_id in the document table so we parsed the path!!
@@ -1782,7 +1782,7 @@ class DocumentManager
                     WHERE c_id = $course_id AND id = $document_id";
             $rs = Database::query($sql);
             $new_content = '';
-            $all_user_info = array();
+            $all_user_info = [];
             if (Database::num_rows($rs)) {
                 $row = Database::fetch_array($rs);
                 $filepath = api_get_path(SYS_COURSE_PATH).$course_info['path'].'/document'.$row['path'];
@@ -1822,7 +1822,7 @@ class DocumentManager
      */
     public static function get_all_info_to_certificate($user_id, $course_id, $is_preview = false)
     {
-        $info_list = array();
+        $info_list = [];
         $user_id = intval($user_id);
         $course_info = api_get_course_info($course_id);
 
@@ -2080,7 +2080,7 @@ class DocumentManager
         $recursivity = 1
     ) {
         $max = 5;
-        $attributes = array();
+        $attributes = [];
         $wanted_attributes = array(
             'src',
             'url',
@@ -2094,7 +2094,7 @@ class DocumentManager
         $abs_path = '';
 
         if ($recursivity > $max) {
-            return array();
+            return [];
         }
 
         if (!isset($type)) {
@@ -2130,7 +2130,7 @@ class DocumentManager
             }
         }
 
-        $files_list = array();
+        $files_list = [];
         switch ($type) {
             case TOOL_DOCUMENT:
             case TOOL_QUIZ:
@@ -2418,8 +2418,8 @@ class DocumentManager
                 break;
         }
 
-        $checked_files_list = array();
-        $checked_array_list = array();
+        $checked_files_list = [];
+        $checked_array_list = [];
 
         if (count($files_list) > 0) {
             foreach ($files_list as $idx => $file) {
@@ -2444,10 +2444,10 @@ class DocumentManager
      * @return   array   An associative array of attributes
      * @author 	 Based on a function from the HTML_Common2 PEAR module     *
      */
-    public static function parse_HTML_attributes($attrString, $wanted = array(), $explode_variables = array())
+    public static function parse_HTML_attributes($attrString, $wanted = [], $explode_variables = [])
     {
-        $attributes = array();
-        $regs = array();
+        $attributes = [];
+        $regs = [];
         $reduced = false;
         if (count($wanted) > 0) {
             $reduced = true;
@@ -2815,7 +2815,7 @@ class DocumentManager
 
                     if (!empty($documentId)) {
                         $table_document = Database::get_course_table(TABLE_DOCUMENT);
-                        $params = array();
+                        $params = [];
 
                         if (!empty($title)) {
                             $params['title'] = $title;
@@ -2906,7 +2906,7 @@ class DocumentManager
                 }
                 // Avoid index unrtf comments
                 if (is_array($output) && count($output) > 1) {
-                    $parsed_output = array();
+                    $parsed_output = [];
                     foreach ($output as & $line) {
                         if (!preg_match('/^###/', $line, $matches)) {
                             if (!empty($line)) {
@@ -3038,7 +3038,7 @@ class DocumentManager
      * @param array $params count, url, extension
      * @return string
      */
-    public static function generate_jplayer_jquery($params = array())
+    public static function generate_jplayer_jquery($params = [])
     {
         $js_path = api_get_path(WEB_LIBRARY_PATH).'javascript/';
 
@@ -3109,7 +3109,7 @@ class DocumentManager
      * @param array $document_data
      * @return string
      */
-    public static function generate_video_preview($document_data = array())
+    public static function generate_video_preview($document_data = [])
     {
         //<button class="jp-video-play-icon" role="button" tabindex="0">play</button>
         $html = '
@@ -3317,7 +3317,7 @@ class DocumentManager
         if ($lp_id) {
             if ($folderId === false) {
                 /*$return .= '<div class="lp_resource_element">';
-                $return .= Display::return_icon('new_doc.gif', '', array(), ICON_SIZE_SMALL);
+                $return .= Display::return_icon('new_doc.gif', '', [], ICON_SIZE_SMALL);
                 $return .= Display::url(
                     get_lang('CreateTheDocument'),
                     api_get_self().'?'.api_get_cidreq().'&action=add_item&type='.TOOL_DOCUMENT.'&lp_id='.$_SESSION['oLP']->lp_id
@@ -3327,7 +3327,7 @@ class DocumentManager
         } else {
             $return .= Display::div(
                 Display::url(
-                    Display::return_icon('close.png', get_lang('Close'), array(), ICON_SIZE_SMALL),
+                    Display::return_icon('close.png', get_lang('Close'), [], ICON_SIZE_SMALL),
                     ' javascript:void(0);',
                     array('id' => 'close_div_'.$course_info['real_id'].'_'.$session_id, 'class' => 'close_div')
                 ),
@@ -3336,7 +3336,7 @@ class DocumentManager
         }
 
         // If you want to debug it, I advise you to do "echo" on the eval statements.
-        $newResources = array();
+        $newResources = [];
         if (!empty($resources) && $user_in_course) {
             foreach ($resources as $resource) {
                 $is_visible = self::is_visible_by_id(
@@ -3560,7 +3560,7 @@ class DocumentManager
 
         if ($add_move_button) {
             $return .= '<a class="moved" href="#">';
-            $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), array(), ICON_SIZE_TINY);
+            $return .= Display::return_icon('move_everywhere.png', get_lang('Move'), [], ICON_SIZE_TINY);
             $return .= '</a> ';
         }
         $return .= $link;
@@ -3808,7 +3808,7 @@ class DocumentManager
         $course_code,
         $session_id = 0,
         $lang = 'english',
-        $specific_fields_values = array(),
+        $specific_fields_values = [],
         $if_exists = '',
         $simulation = false
     ) {
@@ -4046,7 +4046,7 @@ class DocumentManager
      */
     public static function getJodconverterExtensionList($mode, $format)
     {
-        $extensionList = array();
+        $extensionList = [];
         $extensionListFromText = array(
             'odt',
             'sxw',
@@ -4166,7 +4166,7 @@ class DocumentManager
      */
     public static function getFormatTypeListConvertor($mode = 'from', $extension)
     {
-        $formatTypesList = array();
+        $formatTypesList = [];
         $formatTypes = array('text', 'spreadsheet', 'presentation', 'drawing');
         foreach ($formatTypes as $formatType) {
             if (
@@ -4195,7 +4195,7 @@ class DocumentManager
         $systemFolder = api_get_course_setting('show_system_folders');
 
         if ($systemFolder == 1) {
-            $foldersToAvoid = array();
+            $foldersToAvoid = [];
         }
 
         if (basename($path) == 'css') {
@@ -5008,10 +5008,10 @@ class DocumentManager
     ) {
         $doc_table = Database::get_course_table(TABLE_DOCUMENT);
         $course_id = api_get_course_int_id();
-        $folder_titles = array();
+        $folder_titles = [];
 
         if (is_array($folders)) {
-            $escaped_folders = array();
+            $escaped_folders = [];
             foreach ($folders as $key => & $val) {
                 $escaped_folders[$key] = Database::escape_string($val);
             }
@@ -5024,7 +5024,7 @@ class DocumentManager
                         c_id = $course_id AND 
                         path IN ('".$folder_sql."')";
             $res = Database::query($sql);
-            $folder_titles = array();
+            $folder_titles = [];
             while ($obj = Database::fetch_object($res)) {
                 $folder_titles[$obj->path] = $obj->title;
             }
@@ -5222,19 +5222,19 @@ class DocumentManager
                             $isAllowedToEdit || api_is_platform_admin()
                         ) {
                             $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
-                                Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
+                                Display::return_icon($forcedownload_icon, get_lang('Download'), [], ICON_SIZE_SMALL).'</a>';
                         }
                     } elseif (!preg_match('/shared_folder/', urldecode($forcedownload_link)) ||
                         $isAllowedToEdit ||
                         api_is_platform_admin()
                     ) {
                         $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.'>'.
-                            Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
+                            Display::return_icon($forcedownload_icon, get_lang('Download'), [], ICON_SIZE_SMALL).'</a>';
                     }
                 }
             } else {
                 $force_download_html = ($size == 0) ? '' : '<a href="'.$forcedownload_link.'" style="float:right"'.$prevent_multiple_click.' download="'.$document_data['basename'].'">'.
-                    Display::return_icon($forcedownload_icon, get_lang('Download'), array(), ICON_SIZE_SMALL).'</a>';
+                    Display::return_icon($forcedownload_icon, get_lang('Download'), [], ICON_SIZE_SMALL).'</a>';
             }
 
             // Copy files to user's myfiles
@@ -5244,7 +5244,7 @@ class DocumentManager
                 $copy_myfiles_link = $filetype == 'file' ? api_get_self().'?'.$courseParams.'&action=copytomyfiles&id='.$document_data['id'] : api_get_self().'?'.$courseParams;
                 if ($filetype == 'file') {
                     $copyToMyFiles = '<a href="'.$copy_myfiles_link.'" style="float:right"'.$prevent_multiple_click.'>'.
-                        Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), array(), ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
+                        Display::return_icon('briefcase.png', get_lang('CopyToMyFiles'), [], ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
 
                     if (api_get_setting('allow_my_files') === 'false') {
                         $copyToMyFiles = '';
@@ -5264,12 +5264,12 @@ class DocumentManager
                 in_array($extension, array('html', 'htm'))
             ) {
                 $pdf_icon = ' <a style="float:right".'.$prevent_multiple_click.' href="'.api_get_self().'?'.$courseParams.'&action=export_to_pdf&id='.$document_data['id'].'&curdirpath='.$curdirpath.'">'.
-                    Display::return_icon('pdf.png', get_lang('Export2PDF'), array(), ICON_SIZE_SMALL).'</a> ';
+                    Display::return_icon('pdf.png', get_lang('Export2PDF'), [], ICON_SIZE_SMALL).'</a> ';
             }
 
             if ($is_browser_viewable_file) {
                 $open_in_new_window_link = '<a href="'.$www.str_replace('%2F', '/', $url_path).'?'.$courseParams.'" style="float:right"'.$prevent_multiple_click.' target="_blank">'.
-                    Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), array(), ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
+                    Display::return_icon('open_in_new_window.png', get_lang('OpenInANewWindow'), [], ICON_SIZE_SMALL).'&nbsp;&nbsp;</a>';
             }
 
             if ($filetype == 'file') {
@@ -5358,18 +5358,18 @@ class DocumentManager
                         $url = 'showinframes.php?'.$courseParams.'&id='.$document_data['id'];
                         return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
                             self::build_document_icon_tag($filetype, $path, $isAllowedToEdit).
-                            Display::return_icon('shared.png', get_lang('ResourceShared'), array()).
+                            Display::return_icon('shared.png', get_lang('ResourceShared'), []).
                         '</a>';
                     } else {
                         return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" '.$visibility_class.' style="float:left">'.
                             self::build_document_icon_tag($filetype, $path, $isAllowedToEdit).
-                            Display::return_icon('shared.png', get_lang('ResourceShared'), array()).
+                            Display::return_icon('shared.png', get_lang('ResourceShared'), []).
                         '</a>';
                     }
                 } else {
                     return '<a href="'.$url.'" title="'.$tooltip_title_alt.'" target="'.$target.'"'.$visibility_class.' style="float:left">'.
                         self::build_document_icon_tag($filetype, $path, $isAllowedToEdit).
-                        Display::return_icon('shared.png', get_lang('ResourceShared'), array()).
+                        Display::return_icon('shared.png', get_lang('ResourceShared'), []).
                     '</a>';
                 }
             } else {
@@ -5511,10 +5511,10 @@ class DocumentManager
         }
 
         if ($user_image) {
-            return Display::img($icon, $basename, array(), false);
+            return Display::img($icon, $basename, [], false);
         }
 
-        return Display::return_icon($icon, $basename, array(), ICON_SIZE_SMALL);
+        return Display::return_icon($icon, $basename, [], ICON_SIZE_SMALL);
     }
 
     /**
@@ -5898,7 +5898,7 @@ class DocumentManager
         // Form title
         $form->addElement('hidden', 'move_file', $move_file);
 
-        $options = array();
+        $options = [];
 
         // Group documents cannot be uploaded in the root
         if ($group_dir == '') {
@@ -6272,7 +6272,7 @@ class DocumentManager
         ";
 
         $result = Database::query($sql);
-        $files = array();
+        $files = [];
         while ($document = Database::fetch_array($result, 'ASSOC')) {
             $files[] = $document;
         }
@@ -6311,7 +6311,7 @@ class DocumentManager
             return $result;
         }
 
-        return array();
+        return [];
     }
 
     /**
@@ -6527,7 +6527,7 @@ class DocumentManager
         $slideshow = 0
     ) {
         // Modifications by Ivan Tcholakov, 04-MAY-2009.
-        $result = array();
+        $result = [];
         $imageResize = Session::read('image_resizing');
         if ($imageResize == 'resizing' || $slideshow == 1) {
             $new_sizes = api_resize_image($image, $target_width, $target_height);

+ 110 - 112
main/inc/lib/sessionmanager.lib.php

@@ -132,7 +132,7 @@ class SessionManager
         $duration = null,
         $description = null,
         $showDescription = 0,
-        $extraFields = array(),
+        $extraFields = [],
         $sessionAdminId = 0,
         $sendSubscriptionNotification = false
     ) {
@@ -431,7 +431,7 @@ class SessionManager
      * @param array $extraFieldsToLoad
      *
      * @return mixed Integer for number of rows, or array of results
-     * @assert (array(),true) !== false
+     * @assert ([],true) !== false
      */
     public static function get_sessions_admin(
         $options = [],
@@ -551,13 +551,13 @@ class SessionManager
         $result = Database::query($query);
 
         $categories = self::get_all_session_category();
-        $orderedCategories = array();
+        $orderedCategories = [];
         if (!empty($categories)) {
             foreach ($categories as $category) {
                 $orderedCategories[$category['id']] = $category['name'];
             }
         }
-        $formatted_sessions = array();
+        $formatted_sessions = [];
         if (Database::num_rows($result)) {
             $sessions = Database::store_result($result, 'ASSOC');
             if ($get_count) {
@@ -567,13 +567,13 @@ class SessionManager
             $activeIcon = Display::return_icon(
                 'accept.png',
                 get_lang('Active'),
-                array(),
+                [],
                 ICON_SIZE_SMALL
             );
             $inactiveIcon = Display::return_icon(
                 'error.png',
                 get_lang('Inactive'),
-                array(),
+                [],
                 ICON_SIZE_SMALL
             );
 
@@ -609,7 +609,7 @@ class SessionManager
                             $session['id'],
                             $field['id']
                         );
-                        $fieldDataArray = array();
+                        $fieldDataArray = [];
                         $fieldDataToString = '';
                         if (!empty($fieldData)) {
                             foreach ($fieldData as $data) {
@@ -781,7 +781,7 @@ class SessionManager
         // Get lessons
         $lessons = LearnpathList::get_course_lessons($course['code'], $sessionId);
 
-        $table = array();
+        $table = [];
         foreach ($users as $user) {
             $data = array(
                 'lastname' => $user[1],
@@ -810,7 +810,7 @@ class SessionManager
 
             $result = Database::query($sql_query);
 
-            $user_lessons = array();
+            $user_lessons = [];
             while ($row = Database::fetch_array($result)) {
                 $user_lessons[$row['id']] = $row;
             }
@@ -902,7 +902,7 @@ class SessionManager
         $row = Database::fetch_array($result);
         $anonymous = ($row['anonymous'] == 1) ? true : false;
 
-        $table = array();
+        $table = [];
         foreach ($users as $user) {
             $data = array(
                 'lastname' => ($anonymous ? '***' : $user[1]),
@@ -930,7 +930,7 @@ class SessionManager
 
             $result = Database::query($sql_query);
 
-            $user_questions = array();
+            $user_questions = [];
             while ($row = Database::fetch_array($result)) {
                 $user_questions[$row['question_id']] = $row;
             }
@@ -1032,7 +1032,7 @@ class SessionManager
         $sql = "SELECT * FROM $tbl_course_lp WHERE c_id = %s "; //AND session_id = %s
         $sql_query = sprintf($sql, $course['real_id']);
         $result = Database::query($sql_query);
-        $arrLesson = array(array());
+        $arrLesson = array([]);
         while ($row = Database::fetch_array($result)) {
             if (empty($arrLesson[$row['session_id']]['lessons_total'])) {
                 $arrLesson[$row['session_id']]['lessons_total'] = 1;
@@ -1108,7 +1108,7 @@ class SessionManager
         /**
          * Surveys
          */
-        $survey_user_list = array();
+        $survey_user_list = [];
         $survey_list = SurveyManager::get_surveys($course['code'], $sessionId);
 
         $surveys_total = count($survey_list);
@@ -1158,7 +1158,7 @@ class SessionManager
             $lessons_progress = Tracking::get_avg_student_progress(
                 $user['user_id'],
                 $course['code'],
-                array(),
+                [],
                 $user['id_session']
             );
             $lessons_done = ($lessons_progress * $lessons_total) / 100;
@@ -1397,7 +1397,7 @@ class SessionManager
             $where $order $limit";
         $result = Database::query(sprintf($sql, $sessionId, $courseId));
 
-        $data = array();
+        $data = [];
         while ($user = Database::fetch_assoc($result)) {
             $data[] = $user;
         }
@@ -1523,7 +1523,7 @@ class SessionManager
         $description = null,
         $showDescription = 0,
         $duration = null,
-        $extraFields = array(),
+        $extraFields = [],
         $sessionAdminId = 0,
         $sendSubscriptionNotification = false
     ) {
@@ -1852,7 +1852,7 @@ class SessionManager
         $sql = "SELECT user_id FROM $tbl_session_rel_course_rel_user
                 WHERE session_id = $id_session AND status = 0";
         $result = Database::query($sql);
-        $existingUsers = array();
+        $existingUsers = [];
         while ($row = Database::fetch_array($result)) {
             $existingUsers[] = $row['user_id'];
         }
@@ -1860,7 +1860,7 @@ class SessionManager
         $sql = "SELECT c_id FROM $tbl_session_rel_course
                 WHERE session_id = $id_session";
         $result = Database::query($sql);
-        $course_list = array();
+        $course_list = [];
         while ($row = Database::fetch_array($result)) {
             $course_list[] = $row['c_id'];
         }
@@ -1938,7 +1938,7 @@ class SessionManager
                         status = 0
                     ";
             $result = Database::query($sql);
-            $existingUsers = array();
+            $existingUsers = [];
             while ($row = Database::fetch_array($result)) {
                 $existingUsers[] = $row['user_id'];
             }
@@ -2067,7 +2067,7 @@ class SessionManager
         $courseId = $courseInfo['real_id'];
 
         if (empty($sessionId) || empty($courseId)) {
-            return array();
+            return [];
         }
 
         $statusCondition = null;
@@ -2087,7 +2087,7 @@ class SessionManager
                 ";
 
         $result = Database::query($sql);
-        $existingUsers = array();
+        $existingUsers = [];
         while ($row = Database::fetch_array($result)) {
             $existingUsers[] = $row['user_id'];
         }
@@ -2139,7 +2139,7 @@ class SessionManager
             $sql .= "LIMIT $start, $limit";
         }
         $result = Database::query($sql);
-        $existingUsers = array();
+        $existingUsers = [];
         while ($row = Database::fetch_array($result)) {
             $existingUsers[] = $row['user_id'];
         }
@@ -2998,7 +2998,7 @@ class SessionManager
      * @return array An array with all sessions of the platform.
      * @todo   optional course code parameter, optional sorting parameters...
      */
-    public static function get_sessions_list($conditions = array(), $order_by = array(), $from = null, $to = null)
+    public static function get_sessions_list($conditions = [], $order_by = [], $from = null, $to = null)
     {
         $session_table = Database::get_main_table(TABLE_MAIN_SESSION);
         $session_category_table = Database::get_main_table(TABLE_MAIN_SESSION_CATEGORY);
@@ -3007,7 +3007,7 @@ class SessionManager
         $session_course_table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
         $course_table = Database::get_main_table(TABLE_MAIN_COURSE);
         $access_url_id = api_get_current_access_url_id();
-        $return_array = array();
+        $return_array = [];
 
         $sql_query = " SELECT
                     DISTINCT(s.id),
@@ -3563,7 +3563,7 @@ class SessionManager
             return $row['count'];
         }
 
-        $sessions = array();
+        $sessions = [];
         if (Database::num_rows($result) > 0) {
             $sysUploadPath = api_get_path(SYS_UPLOAD_PATH).'sessions/';
             $webUploadPath = api_get_path(WEB_UPLOAD_PATH).'sessions/';
@@ -3671,7 +3671,7 @@ class SessionManager
         $sql .= Database::escape_string($orderBy);
         $result = Database::query($sql);
         $num_rows = Database::num_rows($result);
-        $courses = array();
+        $courses = [];
         if ($num_rows > 0) {
             if ($getCount) {
                 $count = Database::fetch_assoc($result);
@@ -3761,7 +3761,7 @@ class SessionManager
 
         $result = Database::query($sql);
         $num_rows = Database::num_rows($result);
-        $courses = array();
+        $courses = [];
 
         if ($num_rows > 0) {
             while ($row = Database::fetch_array($result, 'ASSOC')) {
@@ -3803,7 +3803,7 @@ class SessionManager
         $sql .= "ORDER BY title;";
         $result = Database::query($sql);
         $num_rows = Database::num_rows($result);
-        $courses = array();
+        $courses = [];
         if ($num_rows > 0) {
             while ($row = Database::fetch_array($result, 'ASSOC')) {
                 $courses[$row['id']] = $row;
@@ -3887,7 +3887,7 @@ class SessionManager
         $urlId = 0
     ) {
         if (empty($id)) {
-            return array();
+            return [];
         }
         $id = intval($id);
         $tbl_user = Database::get_main_table(TABLE_MAIN_USER);
@@ -3931,7 +3931,7 @@ class SessionManager
             return $count['count'];
         }
 
-        $return = array();
+        $return = [];
         while ($row = Database::fetch_array($result, 'ASSOC')) {
             $return[] = $row;
         }
@@ -4068,7 +4068,7 @@ class SessionManager
     public static function subscribe_sessions_to_promotion($promotion_id, $list)
     {
         $table = Database::get_main_table(TABLE_MAIN_SESSION);
-        $params = array();
+        $params = [];
         $params['promotion_id'] = 0;
         Database::update(
             $table,
@@ -4164,7 +4164,7 @@ class SessionManager
             // Register courses from the original session to the new session
             $courses = self::get_course_list_by_session_id($id);
 
-            $short_courses = $new_short_courses = array();
+            $short_courses = $new_short_courses = [];
             if (is_array($courses) && count($courses) > 0) {
                 foreach ($courses as $course) {
                     $short_courses[] = $course;
@@ -4180,7 +4180,7 @@ class SessionManager
                         api_set_memory_limit('256M');
                         ini_set('max_execution_time', 0);
                     }
-                    $params = array();
+                    $params = [];
                     $params['skip_lp_dates'] = true;
 
                     foreach ($short_courses as $course_data) {
@@ -4239,7 +4239,7 @@ class SessionManager
         if ($copy_users) {
             // Register users from the original session to the new session
             $users = self::get_users_by_session($id);
-            $short_users = array();
+            $short_users = [];
             if (is_array($users) && count($users) > 0) {
                 foreach ($users as $user) {
                     $short_users[] = $user['user_id'];
@@ -4467,7 +4467,7 @@ class SessionManager
             $ignoreTimeLimit
         );
 
-        $sessionArray = array();
+        $sessionArray = [];
         if (!empty($sessionCategories)) {
             foreach ($sessionCategories as $category) {
                 if (isset($category['sessions'])) {
@@ -4510,20 +4510,20 @@ class SessionManager
         $updateSession,
         $defaultUserId = null,
         $logger = null,
-        $extraFields = array(),
+        $extraFields = [],
         $extraFieldId = null,
         $daysCoachAccessBeforeBeginning = null,
         $daysCoachAccessAfterBeginning = null,
         $sessionVisibility = 1,
-        $fieldsToAvoidUpdate = array(),
+        $fieldsToAvoidUpdate = [],
         $deleteUsersNotInList = false,
         $updateCourseCoaches = false,
         $sessionWithCoursesModifier = false,
         $addOriginalCourseTeachersAsCourseSessionCoaches = true,
         $removeAllTeachersFromCourse = true,
         $showDescription = null,
-        &$teacherBackupList = array(),
-        &$groupBackup = array()
+        &$teacherBackupList = [],
+        &$groupBackup = []
     ) {
         $content = file($file);
         $error_message = null;
@@ -4544,13 +4544,11 @@ class SessionManager
         $tbl_session_user = Database::get_main_table(TABLE_MAIN_SESSION_USER);
         $tbl_session_course = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
         $tbl_session_course_user = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
-
-        $sessions = array();
-
+        $sessions = [];
         if (!api_strstr($content[0], ';')) {
             $error_message = get_lang('NotCSV');
         } else {
-            $tag_names = array();
+            $tag_names = [];
             foreach ($content as $key => $enreg) {
                 $enreg = explode(';', trim($enreg));
                 if ($key) {
@@ -4573,7 +4571,7 @@ class SessionManager
                 }
             }
 
-            $sessionList = array();
+            $sessionList = [];
             // Looping the sessions.
             foreach ($sessions as $enreg) {
                 $user_counter = 0;
@@ -4945,7 +4943,7 @@ class SessionManager
                 $sessionList[] = $session_id;
 
                 // Adding the relationship "Session - User" for students
-                $userList = array();
+                $userList = [];
                 if (is_array($users)) {
                     foreach ($users as $user) {
                         $user_id = UserManager::get_user_id_from_username($user);
@@ -5045,7 +5043,7 @@ class SessionManager
 
                         // Adding coaches to session course user.
                         if (!empty($course_coaches)) {
-                            $savedCoaches = array();
+                            $savedCoaches = [];
                             // only edit if add_teachers_to_sessions_courses is set.
                             if ($addTeachersToSession) {
                                 if ($addOriginalCourseTeachersAsCourseSessionCoaches) {
@@ -5055,7 +5053,7 @@ class SessionManager
                                     );
 
                                     if (!empty($alreadyAddedTeachers)) {
-                                        $teachersToAdd = array();
+                                        $teachersToAdd = [];
                                         foreach ($alreadyAddedTeachers as $user) {
                                             $teachersToAdd[] = $user['username'];
                                         }
@@ -5460,7 +5458,7 @@ class SessionManager
                     status = 2";
         $result = Database::query($sql);
 
-        $coaches = array();
+        $coaches = [];
         if (Database::num_rows($result) > 0) {
             while ($row = Database::fetch_array($result)) {
                 $coaches[] = $row['user_id'];
@@ -5480,7 +5478,7 @@ class SessionManager
         $courseId
     ) {
         $coaches = self::getCoachesByCourseSession($sessionId, $courseId);
-        $list = array();
+        $list = [];
         if (!empty($coaches)) {
             foreach ($coaches as $coachId) {
                 $userInfo = api_get_user_info($coachId);
@@ -5508,7 +5506,7 @@ class SessionManager
                 WHERE session_id = '$sessionId' AND status = 2";
         $result = Database::query($sql);
 
-        $coaches = array();
+        $coaches = [];
         if (Database::num_rows($result) > 0) {
             while ($row = Database::fetch_array($result)) {
                 $coaches[] = $row['user_id'];
@@ -5525,7 +5523,7 @@ class SessionManager
     public static function getAllCoursesFromAllSessionFromDrh($userId)
     {
         $sessions = self::get_sessions_followed_by_drh($userId);
-        $coursesFromSession = array();
+        $coursesFromSession = [];
         if (!empty($sessions)) {
             foreach ($sessions as $session) {
                 $courseList = self::get_course_list_by_session_id($session['id']);
@@ -5545,7 +5543,7 @@ class SessionManager
     public static function getAllCoursesFromAllSessions()
     {
         $sessions = self::get_sessions_list();
-        $coursesFromSession = array();
+        $coursesFromSession = [];
         if (!empty($sessions)) {
             foreach ($sessions as $session) {
                 $courseList = self::get_course_list_by_session_id($session['id']);
@@ -5584,8 +5582,8 @@ class SessionManager
         $keyword = null,
         $active = null,
         $lastConnectionDate = null,
-        $sessionIdList = array(),
-        $studentIdList = array(),
+        $sessionIdList = [],
+        $studentIdList = [],
         $filterByStatus = null
     ) {
         $filterByStatus = intval($filterByStatus);
@@ -5822,13 +5820,13 @@ class SessionManager
      */
     public static function copyStudentsFromSession($sessions, $sessionsDestination)
     {
-        $messages = array();
+        $messages = [];
         if (!empty($sessions)) {
             foreach ($sessions as $sessionId) {
                 $sessionInfo = self::fetch($sessionId);
                 $userList = self::get_users_by_session($sessionId, 0);
                 if (!empty($userList)) {
-                    $newUserList = array();
+                    $newUserList = [];
                     $userToString = null;
                     foreach ($userList as $userInfo) {
                         $newUserList[] = $userInfo['user_id'];
@@ -5892,13 +5890,13 @@ class SessionManager
      */
     public static function copyCoachesFromSessionToCourse($sessions, $courses)
     {
-        $coachesPerSession = array();
+        $coachesPerSession = [];
         foreach ($sessions as $sessionId) {
             $coaches = self::getCoachesBySession($sessionId);
             $coachesPerSession[$sessionId] = $coaches;
         }
 
-        $result = array();
+        $result = [];
 
         if (!empty($courses)) {
             foreach ($courses as $courseId) {
@@ -5931,7 +5929,7 @@ class SessionManager
                     $htmlResult .= Display::url(
                         get_lang('Session').': '.$sessionInfo['name'].' <br />', $sessionUrl.$sessionId, array('target' => '_blank')
                     );
-                    $teacherList = array();
+                    $teacherList = [];
                     foreach ($coachList as $coachId) {
                         $userInfo = api_get_user_info($coachId);
                         $teacherList[] = $userInfo['complete_name'];
@@ -5963,8 +5961,8 @@ class SessionManager
         $keyword = null,
         $active = null,
         $lastConnectionDate = null,
-        $sessionIdList = array(),
-        $studentIdList = array(),
+        $sessionIdList = [],
+        $studentIdList = [],
         $filterUserStatus = null
     ) {
         $userId = api_get_user_id();
@@ -6026,15 +6024,15 @@ class SessionManager
         $active = 1,
         $lastConnectionDate = null,
         $getCount = false,
-        $sessionIdList = array()
+        $sessionIdList = []
     ) {
-        $teacherListId = array();
+        $teacherListId = [];
         if (api_is_drh() || api_is_platform_admin()) {
             // Followed teachers by drh
             if (api_drh_can_access_all_session_content()) {
                 if (empty($sessionIdList)) {
                     $sessions = self::get_sessions_followed_by_drh($userId);
-                    $sessionIdList = array();
+                    $sessionIdList = [];
                     foreach ($sessions as $session) {
                         $sessionIdList[] = $session['id'];
                     }
@@ -6227,7 +6225,7 @@ class SessionManager
     ) {
         if (!empty($userSessionList)) {
             foreach ($userSessionList as $userId => $data) {
-                $sessionList = array();
+                $sessionList = [];
                 foreach ($data['session_list'] as $sessionInfo) {
                     $sessionList[] = $sessionInfo['session_id'];
                 }
@@ -6260,7 +6258,7 @@ class SessionManager
                         $sessionListSubscribed = array_keys($sessionListSubscribed);
                     }
 
-                    $sessionList = array();
+                    $sessionList = [];
                     if (!empty($data['session_list'])) {
                         foreach ($data['session_list'] as $sessionInfo) {
                             if (in_array($sessionInfo['session_id'], $sessionListSubscribed)) {
@@ -6301,7 +6299,7 @@ class SessionManager
         $list = Import::csv_reader($file);
 
         if (!empty($list)) {
-            $userSessionList = array();
+            $userSessionList = [];
             foreach ($list as $data) {
                 $userInfo = api_get_user_info_from_username($data['Username']);
                 $sessionInfo = self::get_session_by_name($data['SessionName']);
@@ -6351,7 +6349,7 @@ class SessionManager
         $table = Database::get_main_table(TABLE_MAIN_SESSION_COURSE);
         $courseList = self::get_course_list_by_session_id($sessionId, null, 'position');
 
-        $position = array();
+        $position = [];
         $count = 0;
         foreach ($courseList as $course) {
             if ($course['position'] == '') {
@@ -6514,7 +6512,7 @@ class SessionManager
         $sql = "SELECT * FROM $table
                 WHERE session_id = $sessionId AND user_id = $userId";
         $result = Database::query($sql);
-        $values = array();
+        $values = [];
         if (Database::num_rows($result)) {
             $values = Database::fetch_array($result, 'ASSOC');
         }
@@ -6597,7 +6595,7 @@ class SessionManager
         $sessions = self::get_sessions_by_general_coach($coachId, $asPlatformAdmin);
         // Get all sessions where $coachId is the course - session coach
         $courseSessionList = self::getCoursesListByCourseCoach($coachId);
-        $sessionsByCoach = array();
+        $sessionsByCoach = [];
         if (!empty($courseSessionList)) {
             foreach ($courseSessionList as $userCourseSubscription) {
                 $session = $userCourseSubscription->getSession();
@@ -6613,7 +6611,7 @@ class SessionManager
 
         // Remove repeated sessions
         if (!empty($sessions)) {
-            $cleanSessions = array();
+            $cleanSessions = [];
             foreach ($sessions as $session) {
                 $cleanSessions[$session['id']] = $session;
             }
@@ -6622,7 +6620,7 @@ class SessionManager
 
         if ($checkSessionRelUserVisibility) {
             if (!empty($sessions)) {
-                $newSessions = array();
+                $newSessions = [];
                 foreach ($sessions as $session) {
                     $visibility = api_get_session_visibility($session['id']);
                     if ($visibility == SESSION_INVISIBLE) {
@@ -6677,7 +6675,7 @@ class SessionManager
      */
     public static function getAllCourseCoaches()
     {
-        $coaches = array();
+        $coaches = [];
 
         $scuTable = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
         $userTable = Database::get_main_table(TABLE_MAIN_USER);
@@ -6799,7 +6797,7 @@ class SessionManager
 
         $result = Database::query($sql);
 
-        $list = array();
+        $list = [];
         while ($data = Database::fetch_assoc($result)) {
             $list[] = $data;
         }
@@ -6823,7 +6821,7 @@ class SessionManager
         $publicationDate = null
     ) {
         $categoryId = (int) $categoryId;
-        $sessionList = array();
+        $sessionList = [];
         // Check if categoryId is valid
         if ($categoryId > 0) {
             $target = Database::escape_string($target);
@@ -6832,7 +6830,7 @@ class SessionManager
             $sfvTable = Database::get_main_table(TABLE_EXTRA_FIELD_VALUES);
             // Join session field and session field values tables
             $joinTable = $sfTable.' sf INNER JOIN '.$sfvTable.' sfv ON sf.id = sfv.field_id';
-            $fieldsArray = array();
+            $fieldsArray = [];
             foreach ($extraFields as $field) {
                 $fieldsArray[] = Database::escape_string($field);
             }
@@ -6864,8 +6862,8 @@ class SessionManager
                     ),
                 )
             );
-            $whereFieldVariables = array();
-            $whereFieldIds = array();
+            $whereFieldVariables = [];
+            $whereFieldIds = [];
             if (
                 is_array($fieldsArray) &&
                 count($fieldsArray) > 0
@@ -7023,7 +7021,7 @@ class SessionManager
 
                 // Check if session field values had result
                 if (!empty($sessionFieldValueList)) {
-                    $sessionFieldValueListBySession = array();
+                    $sessionFieldValueListBySession = [];
                     foreach ($sessionFieldValueList as $key => $sessionFieldValue) {
                         // Create an array to index ids to session id
                         $sessionFieldValueListBySession[$sessionFieldValue['item_id']][] = $key;
@@ -7178,11 +7176,11 @@ class SessionManager
      * @param array $extraFieldsToInclude
      * @return array
      */
-    public static function getFilteredExtraFields($sessionId, $extraFieldsToInclude = array())
+    public static function getFilteredExtraFields($sessionId, $extraFieldsToInclude = [])
     {
-        $extraData = array();
-        $variables = array();
-        $variablePlaceHolders = array();
+        $extraData = [];
+        $variables = [];
+        $variablePlaceHolders = [];
 
         foreach ($extraFieldsToInclude as $sessionExtraField) {
             $variablePlaceHolders[] = "?";
@@ -7194,7 +7192,7 @@ class SessionManager
             "variable IN ( ".implode(", ", $variablePlaceHolders)." ) " => $variables,
         ));
 
-        $fields = array();
+        $fields = [];
 
         // Index session fields
         foreach ($fieldList as $field) {
@@ -7262,7 +7260,7 @@ class SessionManager
      */
     public static function getSessionsFollowedForGroupAdmin($userId)
     {
-        $sessionList = array();
+        $sessionList = [];
         $sessionTable = Database::get_main_table(TABLE_MAIN_SESSION);
         $sessionUserTable = Database::get_main_table(TABLE_MAIN_SESSION_USER);
         $userGroup = new UserGroup();
@@ -7498,7 +7496,7 @@ class SessionManager
                 $result = Database::query($sql);
                 $coachesList = Database::store_result($result);
 
-                $coachesOptions = array();
+                $coachesOptions = [];
                 foreach ($coachesList as $coachItem) {
                     $coachesOptions[$coachItem['user_id']] =
                         api_get_person_name($coachItem['firstname'], $coachItem['lastname']).' ('.$coachItem['username'].')';
@@ -7572,7 +7570,7 @@ class SessionManager
 
         $form->addElement('checkbox', 'show_description', null, get_lang('ShowDescription'));
 
-        $visibilityGroup = array();
+        $visibilityGroup = [];
         $visibilityGroup[] = $form->createElement('select', 'session_visibility', null, array(
             SESSION_VISIBLE_READ_ONLY => get_lang('SessionReadOnly'),
             SESSION_VISIBLE => get_lang('SessionAccessible'),
@@ -7711,7 +7709,7 @@ class SessionManager
      * @return integer The number of rows, or false on wrong param
      * @assert ('a') === false
      */
-    static function get_count_admin_complete($options = array())
+    static function get_count_admin_complete($options = [])
     {
         if (!is_array($options)) {
             return false;
@@ -7816,7 +7814,7 @@ class SessionManager
      */
     public static function getGridColumns(
         $list_type = 'simple',
-        $extraFields = array()
+        $extraFields = []
     ) {
         $showCount = api_get_configuration_value('session_list_show_count_users');
         // Column config
@@ -8030,7 +8028,7 @@ class SessionManager
      * @return array Array of rows results
      * @asset ('a') === false
      */
-    public static function get_sessions_admin_complete($options = array())
+    public static function get_sessions_admin_complete($options = [])
     {
         if (!is_array($options)) {
             return false;
@@ -8064,12 +8062,12 @@ class SessionManager
 
         $today = api_get_utc_datetime();
         $inject_extra_fields = null;
-        $extra_fields = array();
-        $extra_fields_info = array();
+        $extra_fields = [];
+        $extra_fields_info = [];
 
         //for now only sessions
         $extra_field = new ExtraFieldModel('session');
-        $double_fields = array();
+        $double_fields = [];
         $extra_field_option = new ExtraFieldOption('session');
 
         if (isset($options['extra'])) {
@@ -8091,7 +8089,7 @@ class SessionManager
             }
         }
 
-        $options_by_double = array();
+        $options_by_double = [];
         foreach ($double_fields as $double) {
             $my_options = $extra_field_option->get_field_options_by_field(
                 $double['id'],
@@ -8212,18 +8210,18 @@ class SessionManager
         $acceptIcon = Display::return_icon(
             'accept.png',
             get_lang('Active'),
-            array(),
+            [],
             ICON_SIZE_SMALL
         );
 
         $errorIcon = Display::return_icon(
             'error.png',
             get_lang('Inactive'),
-            array(),
+            [],
             ICON_SIZE_SMALL
         );
 
-        $formatted_sessions = array();
+        $formatted_sessions = [];
         if (Database::num_rows($result)) {
             $sessions = Database::store_result($result, 'ASSOC');
             foreach ($sessions as $session) {
@@ -8401,7 +8399,7 @@ class SessionManager
      */
     public static function getCoursesForCourseSessionCoach($userId)
     {
-        $listResCourseSession = array();
+        $listResCourseSession = [];
         $tblCourse = Database::get_main_table(TABLE_MAIN_COURSE);
         $tblSessionRelCourseRelUser = Database::get_main_table(TABLE_MAIN_SESSION_COURSE_USER);
 
@@ -8418,7 +8416,7 @@ class SessionManager
         while ($data = Database::fetch_assoc($res)) {
             if (api_get_session_visibility($data['session_id'])) {
                 if (!isset($listResCourseSession[$data['id']])) {
-                    $listResCourseSession[$data['id']] = array();
+                    $listResCourseSession[$data['id']] = [];
                 }
                 $listResCourseSession[$data['id']][] = $data['session_id'];
             }
@@ -8436,7 +8434,7 @@ class SessionManager
      */
     public static function getCoursesForMainSessionCoach($userId)
     {
-        $listResCourseSession = array();
+        $listResCourseSession = [];
         $tblSession = Database::get_main_table(TABLE_MAIN_SESSION);
 
         // list of SESSION where user is session coach
@@ -8450,7 +8448,7 @@ class SessionManager
             foreach ($listCoursesInSession as $i => $courseId) {
                 if (api_get_session_visibility($sessionId)) {
                     if (!isset($listResCourseSession[$courseId])) {
-                        $listResCourseSession[$courseId] = array();
+                        $listResCourseSession[$courseId] = [];
                     }
                     $listResCourseSession[$courseId][] = $sessionId;
                 }
@@ -8483,7 +8481,7 @@ class SessionManager
                 WHERE session_id = ".intval($sessionId);
         $res = Database::query($sql);
 
-        $listResultsCourseId = array();
+        $listResultsCourseId = [];
         while ($data = Database::fetch_assoc($res)) {
             $listResultsCourseId[] = $data['id'];
         }
@@ -8519,18 +8517,18 @@ class SessionManager
      */
     public static function getNamedSessionCourseForCoach($userId)
     {
-        $listResults = array();
+        $listResults = [];
         $listCourseSession = self::getSessionCourseForUser($userId);
         foreach ($listCourseSession as $courseId => $listSessionId) {
             // Course info
             $courseInfo = api_get_course_info_by_id($courseId);
-            $listOneCourse = array();
+            $listOneCourse = [];
             $listOneCourse['courseId'] = $courseId;
             $listOneCourse['title'] = $courseInfo['title'];
             //$listOneCourse['courseCode'] = $courseInfo['code'];
             $listOneCourse['course'] = $courseInfo;
-            $listOneCourse['sessionCatList'] = array();
-            $listCat = array();
+            $listOneCourse['sessionCatList'] = [];
+            $listCat = [];
             foreach ($listSessionId as $i => $sessionId) {
                 // here we got all session for this course
                 // lets check there session categories
@@ -8538,10 +8536,10 @@ class SessionManager
                 $catId = $sessionInfo['session_category_id'];
                 if (!isset($listCat[$catId])) {
                     $listCatInfo = self::get_session_category($catId);
-                    $listCat[$catId] = array();
+                    $listCat[$catId] = [];
                     $listCat[$catId]['catSessionId'] = $catId;
                     $listCat[$catId]['catSessionName'] = $listCatInfo['name'];
-                    $listCat[$catId]['sessionList'] = array();
+                    $listCat[$catId]['sessionList'] = [];
                 }
                 $listSessionInfo = self::fetch($sessionId);
                 $listSessionIdName = array(
@@ -8673,10 +8671,10 @@ class SessionManager
             $courseInfo = $listCoursesInfo['course'];
             $courseCode = $listCoursesInfo['course']['code'];
 
-            $listParamsCourse = array();
+            $listParamsCourse = [];
             $listParamsCourse['icon'] = '<div style="float:left">
                 <input style="border:none;" type="button" onclick="$(\'#course-'.$courseCode.'\').toggle(\'fast\')" value="+" /></div>'.
-                Display::return_icon('blackboard.png', $courseInfo['title'], array(), ICON_SIZE_LARGE);
+                Display::return_icon('blackboard.png', $courseInfo['title'], [], ICON_SIZE_LARGE);
             $listParamsCourse['link'] = '';
             $listParamsCourse['title'] = Display::tag(
                 'a',
@@ -8692,7 +8690,7 @@ class SessionManager
                 $catSessionId = $listCoursesInfo['sessionCatList'][$j]['catSessionId'];
                 $catSessionName = $listCoursesInfo['sessionCatList'][$j]['catSessionName'];
 
-                $listParamsCatSession['icon'] = Display::return_icon('folder_blue.png', $catSessionName, array(), ICON_SIZE_LARGE);
+                $listParamsCatSession['icon'] = Display::return_icon('folder_blue.png', $catSessionName, [], ICON_SIZE_LARGE);
                 $listParamsCatSession['link'] = '';
                 $listParamsCatSession['title'] = $catSessionName;
 
@@ -8711,7 +8709,7 @@ class SessionManager
                     $sessionId = $listSessionInfo['sessionId'];
                     $sessionName = $listSessionInfo['sessionName'];
 
-                    $listParamsSession['icon'] = Display::return_icon('blackboard_blue.png', $sessionName, array(), ICON_SIZE_LARGE);
+                    $listParamsSession['icon'] = Display::return_icon('blackboard_blue.png', $sessionName, [], ICON_SIZE_LARGE);
                     $listParamsSession['link'] = '';
                     $linkToCourseSession = $courseInfo['course_public_url'].'?id_session='.$sessionId;
                     $listParamsSession['title'] =