Merge branch 'MDL-59436-master' of git://github.com/junpataleta/moodle

This commit is contained in:
Dan Poltawski
2017-07-24 16:55:54 +01:00
3 changed files with 9 additions and 23 deletions
+2
View File
@@ -189,6 +189,8 @@ if ($hassiteconfig
'phone2' => new lang_string('phone2'),
'department' => new lang_string('department'),
'institution' => new lang_string('institution'),
'city' => new lang_string('city'),
'country' => new lang_string('country'),
)));
$setting = new admin_setting_configtext('fullnamedisplay', new lang_string('fullnamedisplay', 'admin'),
new lang_string('configfullnamedisplay', 'admin'), 'language', PARAM_TEXT, 50);
+3 -18
View File
@@ -146,14 +146,6 @@ class participants_table extends \table_sql {
}
// Do not show the columns if it exists in the hiddenfields array.
if (!isset($hiddenfields['city'])) {
$headers[] = get_string('city');
$columns[] = 'city';
}
if (!isset($hiddenfields['country'])) {
$headers[] = get_string('country');
$columns[] = 'country';
}
if (!isset($hiddenfields['lastaccess'])) {
if ($courseid == SITEID) {
$headers[] = get_string('lastsiteaccess');
@@ -166,6 +158,9 @@ class participants_table extends \table_sql {
$this->define_columns($columns);
$this->define_headers($headers);
// Make this table sorted by first name by default.
$this->sortable(true, 'firstname');
$this->no_sorting('select');
$this->set_attribute('id', 'participants');
@@ -228,16 +223,6 @@ class participants_table extends \table_sql {
return $OUTPUT->render_from_template('core/inplace_editable', $editable->export_for_template($OUTPUT));
}
/**
* Generate the city column.
*
* @param \stdClass $data
* @return string
*/
public function col_city($data) {
return $data->city;
}
/**
* Generate the country column.
*
+4 -5
View File
@@ -1239,18 +1239,17 @@ function user_get_participants_sql($courseid, $groupid = 0, $accesssince = 0, $r
$joins = array('FROM {user} u');
$wheres = array();
$userfields = array('username', 'email', 'city', 'country', 'lang', 'timezone', 'maildisplay');
$mainuserfields = user_picture::fields('u', $userfields);
$extrasql = get_extra_user_fields_sql($context, 'u', '', $userfields);
$userfields = get_extra_user_fields($context, array('username', 'lang', 'timezone', 'maildisplay'));
$userfieldssql = user_picture::fields('u', $userfields);
if ($isfrontpage) {
$select = "SELECT $mainuserfields, u.lastaccess$extrasql";
$select = "SELECT $userfieldssql, u.lastaccess";
$joins[] = "JOIN ($esql) e ON e.id = u.id"; // Everybody on the frontpage usually.
if ($accesssince) {
$wheres[] = user_get_user_lastaccess_sql($accesssince);
}
} else {
$select = "SELECT $mainuserfields, COALESCE(ul.timeaccess, 0) AS lastaccess$extrasql";
$select = "SELECT $userfieldssql, COALESCE(ul.timeaccess, 0) AS lastaccess";
$joins[] = "JOIN ($esql) e ON e.id = u.id"; // Course enrolled users only.
// Not everybody has accessed the course yet.
$joins[] = 'LEFT JOIN {user_lastaccess} ul ON (ul.userid = u.id AND ul.courseid = :courseid)';