mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
Merge branch 'MDL-71305-master' of git://github.com/rezaies/moodle
This commit is contained in:
commit
2431f7bff8
5 changed files with 71 additions and 52 deletions
|
@ -747,26 +747,22 @@ abstract class question_flags {
|
|||
'requires' => array('base', 'dom', 'event-delegate', 'io-base'),
|
||||
);
|
||||
$actionurl = $CFG->wwwroot . '/question/toggleflag.php';
|
||||
$flagtext = array(
|
||||
0 => get_string('clickflag', 'question'),
|
||||
1 => get_string('clickunflag', 'question')
|
||||
);
|
||||
$flagattributes = array(
|
||||
0 => array(
|
||||
'src' => $OUTPUT->image_url('i/unflagged') . '',
|
||||
'title' => get_string('clicktoflag', 'question'),
|
||||
'alt' => get_string('notflagged', 'question'),
|
||||
// 'text' => get_string('clickflag', 'question'),
|
||||
'alt' => get_string('flagged', 'question'), // Label on toggle should not change.
|
||||
'text' => get_string('clickflag', 'question'),
|
||||
),
|
||||
1 => array(
|
||||
'src' => $OUTPUT->image_url('i/flagged') . '',
|
||||
'title' => get_string('clicktounflag', 'question'),
|
||||
'alt' => get_string('flagged', 'question'),
|
||||
// 'text' => get_string('clickunflag', 'question'),
|
||||
'text' => get_string('clickunflag', 'question'),
|
||||
),
|
||||
);
|
||||
$PAGE->requires->js_init_call('M.core_question_flags.init',
|
||||
array($actionurl, $flagattributes, $flagtext), false, $module);
|
||||
array($actionurl, $flagattributes), false, $module);
|
||||
$done = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -256,8 +256,6 @@ class core_question_renderer extends plugin_renderer_base {
|
|||
* @param int $flagsoption the option that says whether flags should be displayed.
|
||||
*/
|
||||
protected function question_flag(question_attempt $qa, $flagsoption) {
|
||||
global $CFG;
|
||||
|
||||
$divattributes = array('class' => 'questionflag');
|
||||
|
||||
switch ($flagsoption) {
|
||||
|
@ -283,17 +281,14 @@ class core_question_renderer extends plugin_renderer_base {
|
|||
|
||||
$flagcontent = html_writer::empty_tag('input',
|
||||
array('type' => 'hidden', 'name' => $id, 'value' => 0)) .
|
||||
html_writer::empty_tag('input', $checkboxattributes) .
|
||||
html_writer::empty_tag('input',
|
||||
array('type' => 'hidden', 'value' => $postdata, 'class' => 'questionflagpostdata')) .
|
||||
html_writer::empty_tag('input', $checkboxattributes) .
|
||||
html_writer::tag('label', $this->get_flag_html($qa->is_flagged(), $id . 'img'),
|
||||
array('id' => $id . 'label', 'for' => $id . 'checkbox')) . "\n";
|
||||
|
||||
$divattributes = array(
|
||||
'class' => 'questionflag editable',
|
||||
'aria-atomic' => 'true',
|
||||
'aria-relevant' => 'text',
|
||||
'aria-live' => 'assertive',
|
||||
);
|
||||
|
||||
break;
|
||||
|
@ -315,18 +310,16 @@ class core_question_renderer extends plugin_renderer_base {
|
|||
protected function get_flag_html($flagged, $id = '') {
|
||||
if ($flagged) {
|
||||
$icon = 'i/flagged';
|
||||
$alt = get_string('flagged', 'question');
|
||||
$label = get_string('clickunflag', 'question');
|
||||
} else {
|
||||
$icon = 'i/unflagged';
|
||||
$alt = get_string('notflagged', 'question');
|
||||
$label = get_string('clickflag', 'question');
|
||||
}
|
||||
$attributes = array(
|
||||
$attributes = [
|
||||
'src' => $this->image_url($icon),
|
||||
'alt' => $alt,
|
||||
'alt' => '',
|
||||
'class' => 'questionflagimage',
|
||||
);
|
||||
];
|
||||
if ($id) {
|
||||
$attributes['id'] = $id;
|
||||
}
|
||||
|
@ -336,10 +329,14 @@ class core_question_renderer extends plugin_renderer_base {
|
|||
return $img;
|
||||
}
|
||||
|
||||
protected function edit_question_link(question_attempt $qa,
|
||||
question_display_options $options) {
|
||||
global $CFG;
|
||||
|
||||
/**
|
||||
* Generate the display of the edit question link.
|
||||
*
|
||||
* @param question_attempt $qa The question attempt to display.
|
||||
* @param question_display_options $options controls what should and should not be displayed.
|
||||
* @return string
|
||||
*/
|
||||
protected function edit_question_link(question_attempt $qa, question_display_options $options) {
|
||||
if (empty($options->editquestionparams)) {
|
||||
return '';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue