forked from bostelm/moodle-mod_scheduler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
customlib.php
67 lines (55 loc) · 1.63 KB
/
customlib.php
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
/**
* Library with functions that are intended for local customizations.
*
* @package mod
* @subpackage scheduler
* @copyright 2011 Henning Bostelmann and others (see README.txt)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Get a list of fields to be displayed in lists of users, etc.
*
* The input of the function is a user record;
* possibly null, in this case the function should return only the field titles.
*
* The function returns an array of objects that describe user data fields.
* Each of these objects has the following properties:
* $field->title : Displayable title of the field
* $field->value : Value of the field for this user (not set if $user is null)
*
* @param stdClass $user the user record; may be null
* @return array an array of field objects
*/
function scheduler_get_user_fields($user) {
$fields = array();
$emailfield = new stdClass();
$fields[] = $emailfield;
$emailfield->title = get_string('email');
if ($user) {
$emailfield->value = obfuscate_mailto($user->email);
}
/*
* As an example: Uncomment the following lines in order to display the user's city and country.
*/
/*
$cityfield = new stdClass();
$cityfield->title = get_string('city');
$fields[] = $cityfield;
$countryfield = new stdClass();
$countryfield->title = get_string('country');
$fields[] = $countryfield;
if ($user) {
$cityfield->value = $user->city;
if ($user->country) {
$countryfield->value = get_string($user->country, 'countries');
}
else {
$countryfield->value = '';
}
}
*/
return $fields;
}
?>