diff --git a/main/inc/lib/display.lib.php b/main/inc/lib/display.lib.php index 8ea0a7f471..381efe31a4 100644 --- a/main/inc/lib/display.lib.php +++ b/main/inc/lib/display.lib.php @@ -228,6 +228,7 @@ class Display { * @param mixed An array with bool values to know which columns show. i.e: $visibility_options= array(true, false) we will only show the first column * Can be also only a bool value. TRUE: show all columns, FALSE: show nothing * @param bool true for sorting data or false otherwise + * @param array grid classes * @return string html grid */ public static function return_sortable_grid($name, $header, $content, $paging_options = array(), $query_vars = null, $form_actions = array(), $visibility_options = true, $sort_data = true, $grid_class = array()) { @@ -235,7 +236,6 @@ class Display { $column = 0; $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20; $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name); - if (is_array($query_vars)) { $table->set_additional_parameters($query_vars); } diff --git a/main/inc/lib/message.lib.php b/main/inc/lib/message.lib.php index 9195cb7f29..b672f4c44e 100644 --- a/main/inc/lib/message.lib.php +++ b/main/inc/lib/message.lib.php @@ -1003,9 +1003,8 @@ class MessageManager $main_message = self::get_message_by_id($topic_id); $group_info = GroupPortalManager::get_group_data($group_id); - $rows = self::get_messages_by_group_by_message($group_id, $topic_id); - $rows = self::calculate_children($rows, $topic_id); - + $rows = self::get_messages_by_group_by_message($group_id, $topic_id); + $rows = self::calculate_children($rows, $topic_id); $current_user_id = api_get_user_id(); @@ -1014,8 +1013,7 @@ class MessageManager $count_items = 0; $html_messages = ''; - $query_vars = array('id'=>$group_id, 'topic_id'=>$topic_id , 'topics_page_nr'=>0); - + $query_vars = array('id' => $group_id, 'topic_id' => $topic_id , 'topics_page_nr' => 0); // Main message $html = ''; @@ -1027,6 +1025,7 @@ class MessageManager $items_page_nr = null; echo Display::tag('h3', Security::remove_XSS($main_message['title'], STUDENT, true)); + $user_sender_info = UserManager::get_user_info_by_id($main_message['user_sender_id']); $files_attachments = self::get_links_message_attachment_files($main_message['id']); $name = api_get_person_name($user_sender_info['firstname'], $user_sender_info['lastname']); @@ -1067,7 +1066,8 @@ class MessageManager if (is_array($rows) && count($rows)> 0) { $topics = $rows; - $array_html = array(); + $array_html = array(); + foreach ($topics as $index => $topic) { if (empty($topic['id'])) { continue; @@ -1123,12 +1123,12 @@ class MessageManager $array_html_items[] = array($html_items); } // grids for items with paginations - $options = array('hide_navigation'=>false, 'per_page' => $items_per_page); - $order = array(true, true, true,false); + $options = array('hide_navigation' => false, 'per_page' => $items_per_page); + $visibility = array(true, true, true, false); $style_class = array('item' => array('class'=>'group_social_item'), 'main' => array('class'=>'group_social_grid')); if (!empty($array_html_items)) { - $html .= Display::return_sortable_grid('items_'.$topic['id'], array(), $array_html_items, $options, $query_vars, false, $order, false, $style_class); + $html .= Display::return_sortable_grid('items_'.$topic['id'], array(), $array_html_items, $options, $query_vars, null, $visibility, false, $style_class); } } $html .= ''; diff --git a/main/inc/lib/sortabletable.class.php b/main/inc/lib/sortabletable.class.php index 7eee4117b9..429623a3bb 100644 --- a/main/inc/lib/sortabletable.class.php +++ b/main/inc/lib/sortabletable.class.php @@ -482,10 +482,10 @@ class SortableTable extends HTML_Table { } if ($hide_navigation) { - $items = $this->table_data; // This is a faster way to get what we want - } else { - // The normal way - $items = $this->get_clean_html($sort_data); // Getting the items of the table + $items = $this->table_data; // This is a faster way to get what we want + } else { + // The normal way + $items = $this->get_clean_html($sort_data); // Getting the items of the table } // Generation of style classes must be improved. Maybe we need a a table name to create style on the fly: @@ -545,11 +545,13 @@ class SortableTable extends HTML_Table { * Get the HTML-code with the data-table. */ public function get_table_html () { - $pager = $this->get_pager(); - $val = $pager->getOffsetByPageId(); - $offset = $pager->getOffsetByPageId(); - $from = $offset[0] - 1; + $pager = $this->get_pager(); + $val = $pager->getOffsetByPageId(); + $offset = $pager->getOffsetByPageId(); + $from = $offset[0] - 1; + $table_data = $this->get_table_data($from); + if (is_array($table_data)) { foreach ($table_data as $index => & $row) { $row = $this->filter_data($row); @@ -576,8 +578,8 @@ class SortableTable extends HTML_Table { $val = $pager->getOffsetByPageId(); $offset = $pager->getOffsetByPageId(); $from = $offset[0] - 1; - - $table_data = $this->get_table_data($from, $sort); + + $table_data = $this->get_table_data($from, null, null, null, $sort); $new_table_data = array(); if (is_array($table_data)) { @@ -868,7 +870,7 @@ class SortableTableFromArray extends SortableTable { * Get table data to show on current page * @see SortableTable#get_table_data */ - public function get_table_data ($from = 1, $per_page = null, $column = null, $direction = null, $sort = true) { + public function get_table_data($from = 1, $per_page = null, $column = null, $direction = null, $sort = true) { if ($sort) { $content = TableSort :: sort_table($this->table_data, $this->column, $this->direction == 'ASC' ? SORT_ASC : SORT_DESC); } else { @@ -937,7 +939,7 @@ class SortableTableFromArrayConfig extends SortableTable { * Get table data to show on current page * @see SortableTable#get_table_data */ - public function get_table_data ($from = 1, $per_page = null, $column = null, $direction = null, $sort = true) { + public function get_table_data ($from = 1, $per_page = null, $column = null, $direction = null, $sort = true) { $content = TableSort :: sort_table_config($this->table_data, $this->column, $this->direction == 'ASC' ? SORT_ASC : SORT_DESC, $this->column_show, $this->column_order, SORT_REGULAR, $this->doc_filter); return array_slice($content, $from, $this->per_page); } diff --git a/main/social/group_topics.php b/main/social/group_topics.php index a12d9f78b5..a7b41df918 100644 --- a/main/social/group_topics.php +++ b/main/social/group_topics.php @@ -36,8 +36,6 @@ if (empty($group_id)) { } } - - // save message group if (isset($_POST['token']) && $_POST['token'] === $_SESSION['sec_token']) { @@ -166,13 +164,12 @@ $(document).ready(function() { '; $this_section = SECTION_SOCIAL; -$interbreadcrumb[]= array ('url' =>'home.php','name' => get_lang('Social')); -$interbreadcrumb[] = array('url' => 'groups.php','name' => get_lang('Groups')); -$interbreadcrumb[] = array('url' => '#','name' => get_lang('Thread')); +$interbreadcrumb[]= array ('url' =>'home.php', 'name' => get_lang('Social')); +$interbreadcrumb[] = array('url' => 'groups.php', 'name' => get_lang('Groups')); +$interbreadcrumb[] = array('url' => '#', 'name' => get_lang('Thread')); Display::display_header($tool_name, 'Groups'); - echo '