mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
MDL-29474 fix qtype and qbehaviour plugins to use proper pluginname strings.
But maintain backwards-compatibility for now.
This commit is contained in:
parent
6740c6058e
commit
44a7f3840d
@ -1237,7 +1237,11 @@ class plugintype_qtype extends plugintype_base implements plugintype_interface {
|
||||
* @see plugintype_interface::init_display_name()
|
||||
*/
|
||||
public function init_display_name() {
|
||||
$this->displayname = get_string($this->name, 'qtype_' . $this->name);
|
||||
if (get_string_manager()->string_exists('pluginname', $this->type . '_' . $this->name)) {
|
||||
$this->displayname = get_string('pluginname', $this->type . '_' . $this->name);
|
||||
} else {
|
||||
$this->displayname = get_string($this->name, 'qtype_' . $this->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1250,7 +1254,11 @@ class plugintype_qformat extends plugintype_base implements plugintype_interface
|
||||
* @see plugintype_interface::init_display_name()
|
||||
*/
|
||||
public function init_display_name() {
|
||||
$this->displayname = get_string($this->name, 'qformat_' . $this->name);
|
||||
if (get_string_manager()->string_exists('pluginname', $this->type . '_' . $this->name)) {
|
||||
$this->displayname = get_string('pluginname', $this->type . '_' . $this->name);
|
||||
} else {
|
||||
$this->displayname = get_string($this->name, 'qformat_' . $this->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1191,29 +1191,27 @@ function question_categorylist($categoryid) {
|
||||
*/
|
||||
function get_import_export_formats($type) {
|
||||
global $CFG;
|
||||
require_once($CFG->dirroot . '/question/format.php');
|
||||
|
||||
$fileformats = get_plugin_list('qformat');
|
||||
$formatclasses = get_plugin_list_with_class('qformat', '', 'format.php');
|
||||
|
||||
$fileformatname = array();
|
||||
require_once($CFG->dirroot . '/question/format.php');
|
||||
foreach ($fileformats as $fileformat => $fdir) {
|
||||
$formatfile = $fdir . '/format.php';
|
||||
if (is_readable($formatfile)) {
|
||||
include_once($formatfile);
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
foreach ($formatclasses as $component => $formatclass) {
|
||||
|
||||
$classname = 'qformat_' . $fileformat;
|
||||
$formatclass = new $classname();
|
||||
$format = new $formatclass();
|
||||
if ($type == 'import') {
|
||||
$provided = $formatclass->provide_import();
|
||||
$provided = $format->provide_import();
|
||||
} else {
|
||||
$provided = $formatclass->provide_export();
|
||||
$provided = $format->provide_export();
|
||||
}
|
||||
|
||||
if ($provided) {
|
||||
$fileformatnames[$fileformat] = get_string($fileformat, 'qformat_' . $fileformat);
|
||||
list($notused, $fileformat) = explode('_', $component, 2);
|
||||
if (get_string_manager()->string_exists('pluginname', $component)) {
|
||||
$fileformatnames[$fileformat] = get_string('pluginname', $component);
|
||||
} else {
|
||||
$fileformatnames[$fileformat] = get_string($fileformat, $component);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +27,7 @@
|
||||
require_once(dirname(__FILE__) . '/../config.php');
|
||||
require_once($CFG->dirroot . '/question/editlib.php');
|
||||
require_once($CFG->dirroot . '/question/export_form.php');
|
||||
require_once($CFG->dirroot . '/question/format.php');
|
||||
|
||||
list($thispageurl, $contexts, $cmid, $cm, $module, $pagevars) =
|
||||
question_edit_setup('export', '/question/export.php');
|
||||
|
@ -74,7 +74,11 @@ class question_type {
|
||||
* You should not need to override this method, the default behaviour should be fine.
|
||||
*/
|
||||
public function local_name() {
|
||||
return get_string($this->name(), $this->plugin_name());
|
||||
if (get_string_manager()->string_exists('pluginname', $this->plugin_name())) {
|
||||
$this->displayname = get_string('pluginname', $this->plugin_name());
|
||||
} else {
|
||||
$this->displayname = get_string($this->name(), $this->plugin_name());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user