} } } if ($newheader == '') { $columnsarray = array('c1', 'numdiscussions', 'numposts', 'c4', $c5value); $headersarray = array($userstr, $discussions, $replies, $action, $grade); } else { $columnsarray = array('c1', 'numdiscussions', 'numposts', 'c4', $c5value, 'ratingcol'); $headersarray = array($userstr, $discussions, $replies, $action, $grade, $newheader); } $ptable->define_columns($columnsarray); $ptable->define_headers($headersarray); $ptable->define_baseurl($thisurl); $ptable->sortable(true); $ptable->maxsortkeys = 1; $ptable->no_sorting('c4'); $ptable->no_sorting('c5'); $ptable->setup(); $sort = flexible_table::get_sort_for_table('mod-forumng-participation'); if (empty($sort)) { $sort = 'c1 ASC'; } // Need to check whether sort refers to column 'c1' and if it does get correct sql sort statement. $orderbyuser = stristr($sort, 'c1'); $filename = "{$course->shortname}-" . format_string($forum->get_name(), true); if ($groupid != -1 && !empty($download)) { $groupname = $DB->get_field('groups', 'name', array('id' => $groupid)); $filename .= '-' . format_string($groupname, true); } $ptable->is_downloading($download, $filename, get_string('userposts', 'forumngfeature_userposts')); if (!$ptable->is_downloading()) {