$extradata = json_decode(param_variable('extradata')); $type = param_alpha('type', 'users'); $subpages = array('users', 'groups', 'views', 'content', 'historical', 'institutions'); if (!in_array($type, $subpages)) { $type = 'users'; } if ($type == 'historical') { $field = isset($extradata->field) ? $extradata->field : 'count_usr'; } if ($type == 'institutions') { $sort = isset($extradata->sort) ? $extradata->sort : 'displayname'; $sortdesc = isset($extradata->sortdesc) ? $extradata->sortdesc : false; } switch ($type) { case 'institutions': $data = institution_comparison_stats_table($limit, $offset, $sort, $sortdesc); break; case 'historical': $data = historical_stats_table($limit, $offset, $field); break; case 'content': $data = content_stats_table($limit, $offset); break; case 'groups': $data = group_stats_table($limit, $offset); break; case 'views': $data = view_stats_table($limit, $offset); break; case 'users': default:
function institution_comparison_statistics($limit, $offset, $sort, $sortdesc) { $data = array(); $data['tableheadings'] = array(array('name' => get_string('institution'), 'class' => 'search-results-sort-column' . ($sort == 'displayname' ? ' ' . ($sortdesc ? 'desc' : 'asc') : ''), 'link' => get_config('wwwroot') . 'admin/statistics.php?type=institutions&sort=displayname&sortdesc=' . ($sort == 'displayname' ? !$sortdesc : false) . '&limit=' . $limit . '&offset=' . $offset), array('name' => get_string('members'), 'class' => 'search-results-sort-column' . ($sort == 'count_members' ? ' ' . ($sortdesc ? 'desc' : 'asc') : ''), 'link' => get_config('wwwroot') . 'admin/statistics.php?type=institutions&sort=count_members&sortdesc=' . ($sort == 'count_members' ? !$sortdesc : true) . '&limit=' . $limit . '&offset=' . $offset), array('name' => get_string('views'), 'class' => 'search-results-sort-column' . ($sort == 'count_views' ? ' ' . ($sortdesc ? 'desc' : 'asc') : ''), 'link' => get_config('wwwroot') . 'admin/statistics.php?type=institutions&sort=count_views&sortdesc=' . ($sort == 'count_views' ? !$sortdesc : true) . '&limit=' . $limit . '&offset=' . $offset), array('name' => get_string('blocks'), 'class' => 'search-results-sort-column' . ($sort == 'count_blocks' ? ' ' . ($sortdesc ? 'desc' : 'asc') : ''), 'link' => get_config('wwwroot') . 'admin/statistics.php?type=institutions&sort=count_blocks&sortdesc=' . ($sort == 'count_blocks' ? !$sortdesc : true) . '&limit=' . $limit . '&offset=' . $offset), array('name' => get_string('artefacts'), 'class' => 'search-results-sort-column' . ($sort == 'count_artefacts' ? ' ' . ($sortdesc ? 'desc' : 'asc') : ''), 'link' => get_config('wwwroot') . 'admin/statistics.php?type=institutions&sort=count_artefacts&sortdesc=' . ($sort == 'count_artefacts' ? !$sortdesc : true) . '&limit=' . $limit . '&offset=' . $offset), array('name' => get_string('posts'), 'class' => 'search-results-sort-column' . ($sort == 'count_interaction_forum_post' ? ' ' . ($sortdesc ? 'desc' : 'asc') : ''), 'link' => get_config('wwwroot') . 'admin/statistics.php?type=institutions&sort=count_interaction_forum_post&sortdesc=' . ($sort == 'count_interaction_forum_post' ? !$sortdesc : true) . '&limit=' . $limit . '&offset=' . $offset)); $data['table'] = institution_comparison_stats_table($limit, $offset, $sort, $sortdesc); $data['tabletitle'] = get_string('institutionstatstabletitle', 'admin'); $data['summary'] = $data['table']['count'] == 0 ? get_string('nostats', 'admin') : null; return $data; }