Merge branch 'MDL-30120' of git://github.com/timhunt/moodle

This commit is contained in:
Eloy Lafuente (stronk7) 2012-01-25 00:47:10 +01:00
commit 2def471913
4 changed files with 19 additions and 33 deletions

View File

@ -1778,23 +1778,19 @@ function print_choose_qtype_to_add_form($hiddenparams) {
/** /**
* Private function used by the preceding one. * Private function used by the preceding one.
* @param $qtype the question type. * @param question_type $qtype the question type.
*/ */
function print_qtype_to_add_option($qtype) { function print_qtype_to_add_option($qtype) {
if (get_string_manager()->string_exists('pluginnamesummary', $qtype->plugin_name())) {
$summary = get_string('pluginnamesummary', $qtype->plugin_name());
} else {
$summary = get_string($qtype->name() . 'summary', $qtype->plugin_name());
}
echo '<div class="qtypeoption">' . "\n"; echo '<div class="qtypeoption">' . "\n";
echo '<label for="qtype_' . $qtype->name() . '">'; echo '<label for="' . $qtype->plugin_name() . '">';
echo '<input type="radio" name="qtype" id="qtype_' . $qtype->name() . '" value="' . $qtype->name() . '" />'; echo '<input type="radio" name="qtype" id="' . $qtype->plugin_name() .
'" value="' . $qtype->name() . '" />';
echo '<span class="qtypename">'; echo '<span class="qtypename">';
$fakequestion = new stdClass(); $fakequestion = new stdClass();
$fakequestion->qtype = $qtype->name(); $fakequestion->qtype = $qtype->name();
echo print_question_icon($fakequestion); echo print_question_icon($fakequestion);
echo $qtype->menu_name() . '</span><span class="qtypesummary">' . $summary; echo $qtype->menu_name() . '</span><span class="qtypesummary">' .
get_string('pluginnamesummary', $qtype->plugin_name());
echo "</span></label>\n"; echo "</span></label>\n";
echo "</div>\n"; echo "</div>\n";
} }

View File

@ -74,11 +74,7 @@ class question_type {
* You should not need to override this method, the default behaviour should be fine. * You should not need to override this method, the default behaviour should be fine.
*/ */
public function local_name() { public function local_name() {
if (get_string_manager()->string_exists('pluginname', $this->plugin_name())) { return get_string('pluginname', $this->plugin_name());
return get_string('pluginname', $this->plugin_name());
} else {
return get_string($this->name(), $this->plugin_name());
}
} }
/** /**
@ -249,11 +245,7 @@ class question_type {
global $OUTPUT; global $OUTPUT;
$heading = $this->get_heading(empty($question->id)); $heading = $this->get_heading(empty($question->id));
if (get_string_manager()->string_exists('pluginname_help', $this->plugin_name())) { echo $OUTPUT->heading_with_help($heading, 'pluginname', $this->plugin_name());
echo $OUTPUT->heading_with_help($heading, 'pluginname', $this->plugin_name());
} else {
echo $OUTPUT->heading_with_help($heading, $this->name(), $this->plugin_name());
}
$permissionstrs = array(); $permissionstrs = array();
if (!empty($question->id)) { if (!empty($question->id)) {
@ -288,16 +280,10 @@ class question_type {
public function get_heading($adding = false) { public function get_heading($adding = false) {
if ($adding) { if ($adding) {
$string = 'pluginnameadding'; $string = 'pluginnameadding';
$fallback = 'adding' . $this->name();
} else { } else {
$string = 'pluginnameediting'; $string = 'pluginnameediting';
$fallback = 'editing' . $this->name();
}
if (get_string_manager()->string_exists($string, $this->plugin_name())) {
return get_string($string, $this->plugin_name());
} else {
return get_string($fallback, $this->plugin_name());
} }
return get_string($string, $this->plugin_name());
} }
/** /**

View File

@ -23,11 +23,11 @@
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/ */
$string['addingrandomsamatch'] = 'Adding a Random short-answer matching question';
$string['editingrandomsamatch'] = 'Editing a Random short-answer matching question';
$string['nosaincategory'] = 'There are no short answer questions in the category that you chose \'{$a->catname}\'. Choose a different category, make some questions in this category.'; $string['nosaincategory'] = 'There are no short answer questions in the category that you chose \'{$a->catname}\'. Choose a different category, make some questions in this category.';
$string['notenoughsaincategory'] = 'There is/are only {$a->nosaquestions} short answer questions in the category that you chose \'{$a->catname}\'. Choose a different category, make some more questions in this category or reduce the amount of questions you\'ve selected.'; $string['notenoughsaincategory'] = 'There is/are only {$a->nosaquestions} short answer questions in the category that you chose \'{$a->catname}\'. Choose a different category, make some more questions in this category or reduce the amount of questions you\'ve selected.';
$string['randomsamatch'] = 'Random short-answer matching'; $string['pluginname'] = 'Random short-answer matching';
$string['randomsamatch_help'] = 'From the student perspective, this looks just like a matching question. The difference is that the list of names or statements (questions) for matching are drawn randomly from the short answer questions in the current category. There should be sufficient unused short answer questions in the category, otherwise an error message will be displayed.'; $string['pluginname_help'] = 'From the student perspective, this looks just like a matching question. The difference is that the list of names or statements (questions) for matching are drawn randomly from the short answer questions in the current category. There should be sufficient unused short answer questions in the category, otherwise an error message will be displayed.';
$string['randomsamatch_link'] = 'question/type/randomsamatch'; $string['pluginname_link'] = 'question/type/randomsamatch';
$string['randomsamatchsummary'] = 'Like a Matching question, but created randomly from the short answer questions in a particular category.'; $string['pluginnameadding'] = 'Adding a Random short-answer matching question';
$string['pluginnameediting'] = 'Editing a Random short-answer matching question';
$string['pluginnamesummary'] = 'Like a Matching question, but created randomly from the short answer questions in a particular category.';

View File

@ -58,3 +58,7 @@ The old strings will continue to work, but only until Moodle 2.3 is released.
or questionid_column_name methods, then you must change these to be public or questionid_column_name methods, then you must change these to be public
methods. (This is required so that backup and restore can be made to work methods. (This is required so that backup and restore can be made to work
automatically. MDL-24408, MDL-25617, MDL-30562) automatically. MDL-24408, MDL-25617, MDL-30562)
=== 2.3 ===
* Support for backwards-compatible string names dropped. MDL-30120. (See under 2.2 above.)