Minor - Fixing group ordering

skala
Julio Montoya 14 years ago
parent 15f73cd1e7
commit 6c7540c478
  1. 2
      main/inc/lib/display.lib.php
  2. 8
      main/inc/lib/message.lib.php
  3. 4
      main/inc/lib/sortabletable.class.php
  4. 3
      main/social/group_topics.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 * @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 * Can be also only a bool value. TRUE: show all columns, FALSE: show nothing
* @param bool true for sorting data or false otherwise * @param bool true for sorting data or false otherwise
* @param array grid classes
* @return string html grid * @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()) { 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; $column = 0;
$default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20; $default_items_per_page = isset($paging_options['per_page']) ? $paging_options['per_page'] : 20;
$table = new SortableTableFromArray($content, $column, $default_items_per_page, $name); $table = new SortableTableFromArray($content, $column, $default_items_per_page, $name);
if (is_array($query_vars)) { if (is_array($query_vars)) {
$table->set_additional_parameters($query_vars); $table->set_additional_parameters($query_vars);
} }

@ -1006,7 +1006,6 @@ class MessageManager
$rows = self::get_messages_by_group_by_message($group_id, $topic_id); $rows = self::get_messages_by_group_by_message($group_id, $topic_id);
$rows = self::calculate_children($rows, $topic_id); $rows = self::calculate_children($rows, $topic_id);
$current_user_id = api_get_user_id(); $current_user_id = api_get_user_id();
$topics_per_page = 5; $topics_per_page = 5;
@ -1016,7 +1015,6 @@ class MessageManager
$html_messages = ''; $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 // Main message
$html = ''; $html = '';
$user_link = ''; $user_link = '';
@ -1027,6 +1025,7 @@ class MessageManager
$items_page_nr = null; $items_page_nr = null;
echo Display::tag('h3', Security::remove_XSS($main_message['title'], STUDENT, true)); 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']); $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']); $files_attachments = self::get_links_message_attachment_files($main_message['id']);
$name = api_get_person_name($user_sender_info['firstname'], $user_sender_info['lastname']); $name = api_get_person_name($user_sender_info['firstname'], $user_sender_info['lastname']);
@ -1068,6 +1067,7 @@ class MessageManager
if (is_array($rows) && count($rows)> 0) { if (is_array($rows) && count($rows)> 0) {
$topics = $rows; $topics = $rows;
$array_html = array(); $array_html = array();
foreach ($topics as $index => $topic) { foreach ($topics as $index => $topic) {
if (empty($topic['id'])) { if (empty($topic['id'])) {
continue; continue;
@ -1124,11 +1124,11 @@ class MessageManager
} }
// grids for items with paginations // grids for items with paginations
$options = array('hide_navigation' => false, 'per_page' => $items_per_page); $options = array('hide_navigation' => false, 'per_page' => $items_per_page);
$order = array(true, true, true,false); $visibility = array(true, true, true, false);
$style_class = array('item' => array('class'=>'group_social_item'), 'main' => array('class'=>'group_social_grid')); $style_class = array('item' => array('class'=>'group_social_item'), 'main' => array('class'=>'group_social_grid'));
if (!empty($array_html_items)) { 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 .= '</div>'; $html .= '</div>';

@ -549,7 +549,9 @@ class SortableTable extends HTML_Table {
$val = $pager->getOffsetByPageId(); $val = $pager->getOffsetByPageId();
$offset = $pager->getOffsetByPageId(); $offset = $pager->getOffsetByPageId();
$from = $offset[0] - 1; $from = $offset[0] - 1;
$table_data = $this->get_table_data($from); $table_data = $this->get_table_data($from);
if (is_array($table_data)) { if (is_array($table_data)) {
foreach ($table_data as $index => & $row) { foreach ($table_data as $index => & $row) {
$row = $this->filter_data($row); $row = $this->filter_data($row);
@ -577,7 +579,7 @@ class SortableTable extends HTML_Table {
$offset = $pager->getOffsetByPageId(); $offset = $pager->getOffsetByPageId();
$from = $offset[0] - 1; $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(); $new_table_data = array();
if (is_array($table_data)) { if (is_array($table_data)) {

@ -36,8 +36,6 @@ if (empty($group_id)) {
} }
} }
// save message group // save message group
if (isset($_POST['token']) && $_POST['token'] === $_SESSION['sec_token']) { if (isset($_POST['token']) && $_POST['token'] === $_SESSION['sec_token']) {
@ -172,7 +170,6 @@ $interbreadcrumb[] = array('url' => '#','name' => get_lang('Thread'));
Display::display_header($tool_name, 'Groups'); Display::display_header($tool_name, 'Groups');
echo '<div id="social-content">'; echo '<div id="social-content">';
echo '<div id="social-content-left">'; echo '<div id="social-content-left">';
//this include the social menu div //this include the social menu div

Loading…
Cancel
Save