MDL-38011 completion: Use new localised role names

This commit is contained in:
Aaron Barnes 2013-04-07 00:00:05 +13:00 committed by Aaron Barnes
parent 931eff3b84
commit 3220058b14

View file

@ -59,7 +59,7 @@ class completion_criteria_role extends completion_criteria {
*/ */
public function config_form_display(&$mform, $data = null) { public function config_form_display(&$mform, $data = null) {
$mform->addElement('checkbox', 'criteria_role['.$data->id.']', $data->name); $mform->addElement('checkbox', 'criteria_role['.$data->id.']', $this->get_title($data));
if ($this->id) { if ($this->id) {
$mform->setDefault('criteria_role['.$data->id.']', 1); $mform->setDefault('criteria_role['.$data->id.']', 1);
@ -122,8 +122,8 @@ class completion_criteria_role extends completion_criteria {
*/ */
public function get_title() { public function get_title() {
global $DB; global $DB;
$role = $DB->get_field('role', 'name', array('id' => $this->role)); $role = $DB->get_record('role', array('id' => $this->role));
return $role; return role_get_name($role, context_course::instance($this->course));
} }
/** /**
@ -132,8 +132,7 @@ class completion_criteria_role extends completion_criteria {
* @return string * @return string
*/ */
public function get_title_detailed() { public function get_title_detailed() {
global $DB; return $this->get_title();
return $DB->get_field('role', 'name', array('id' => $this->role));
} }
/** /**