-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadmin_users.php
More file actions
78 lines (58 loc) · 2.69 KB
/
Copy pathadmin_users.php
File metadata and controls
78 lines (58 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* SNAPP user admin screen (external admin page)
*
* @package local
* @subpackage snapp
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once(dirname(__FILE__).'/../../config.php');
global $CFG, $OUTPUT, $PAGE;
require_once($CFG->libdir.'/adminlib.php');
require_once($CFG->libdir.'/tablelib.php');
admin_externalpage_setup('snapp_manageusers');
$context = context_system::instance();
require_capability('local/snapp:vieweditusermapping', $context);
require_once(dirname(__FILE__).'/snapp_lib.php');
$PAGE->requires->css('/local/snapp/styles.css');
$baseurl = '/local/snapp/admin_users.php';
$page = optional_param('page', 0, PARAM_INT); // which page to show
$perpage = 25;
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('socialnetworkapps', 'local_snapp'));
echo $OUTPUT->heading(get_string('manageuserspage', 'local_snapp'), 2);
echo $OUTPUT->box_start('generalbox');
//Print a table of all users that are recorded in snapp user table
$table = new flexible_table('local_snapp_admin_mapusers_table');
$table->define_columns(array('username', 'link'));
$table->define_headers(array(get_string('manageuser_th_username', 'local_snapp'), get_string('manageuser_th_link', 'local_snapp')));
$table->define_baseurl($PAGE->url);
$table->set_attribute('id', 'local_snapp_admin_conts_table');
$table->set_attribute('class', 'generaltable generalbox boxaligncenter boxwidthnormal');
$table->setup();
$table->start_output();//Cheat here and call this method so table always shows
$users = snapp_mapuser::get_all_users_map($usercount, $page * $perpage, $perpage);
foreach ($users as $user) {
$link = new moodle_url('/local/snapp/manageuser.php', array('userid' => $user->id));
$link = html_writer::link($link, get_string('mapusers_link', 'local_snapp'));
$table->add_data(array($user->username, $link));
}
$table->finish_output();
echo $OUTPUT->paging_bar($usercount, $page, $perpage, $baseurl);
echo $OUTPUT->box_end();
echo $OUTPUT->footer();