-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathblock_userreport.php
More file actions
67 lines (59 loc) · 2.12 KB
/
Copy pathblock_userreport.php
File metadata and controls
67 lines (59 loc) · 2.12 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
<?php
class block_userreport extends block_base {
public function init() {
if(is_siteadmin()){
$this->title = get_string('userreport', 'block_userreport');
} else {
return;
}
}
public function get_content() {
global $DB, $USER, $CFG ,$COURSE;
$course = $this->page->course;
$context = get_context_instance(CONTEXT_COURSE, $course->id);
if (!has_capability('block/userreport:addinstance', $context)) {
return;
}
$phpversion = phpversion();
$version = $CFG->release;
$username = $USER->username;
$firstname = $USER->firstname;
$lastname = $USER->lastname;
$city = $USER->city;
$country = $USER->country;
$picnum = $USER->picture;
$displaypicimgpath = "{$CFG->wwwroot}".'/pluginfile.php/5/user/icon/ilearn/f1?rev="'.$picnum.'"';
$displaypic = '<img src="'.$displaypicimgpath.'" heigh="50" width="50"/>';
$userauth = $USER->auth;
if ($this->content !== null) {
return $this->content;
}
$this->content = new stdClass;
$this->content->text .= $displaypic. '<br />';
$this->content->text .= 'PHP Version: ' .$phpversion. '<br />';
$this->content->text .= 'Moodle Version: ' .$version. '<br />';
$this->content->text .= 'Logged in User Username: ' .$username. '<br />';
$this->content->text .= 'Logged in User Firstname: ' .$firstname. '<br />';
$this->content->text .= 'Logged in User Lastname: ' .$lastname. '<br />';
$this->content->text .= 'Logged in User City: ' .$city. '<br />';
$this->content->text .= 'Logged in User Country: ' .$country. '<br />';
$this->content->text .= 'Logged in User Authentication: ' .$userauth. '<br />';
return $this->content;
}
/**
* Where to add the block
*
* @return boolean
**/
public function applicable_formats() {
return array('site' => true);
}
/**
* More than one instance per page?
*
* @return boolean
**/
function instance_allow_multiple() {
return false;
}
}