mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-19692: Completion tracking help icon enhancements
This commit is contained in:
parent
02b126af8a
commit
905b1de634
5 changed files with 29 additions and 3 deletions
|
@ -92,4 +92,18 @@ function completion_toggle(e) {
|
||||||
'id='+this.cmid+'&completionstate='+this.otherState+'&fromajax=1');
|
'id='+this.cmid+'&completionstate='+this.otherState+'&fromajax=1');
|
||||||
}
|
}
|
||||||
|
|
||||||
YAHOO.util.Event.onDOMReady(completion_init);
|
function completion_set_progressicon_visibility(spanid,displaystatus) {
|
||||||
|
// Check if the progress icon exists
|
||||||
|
if (document.getElementById(spanid)!= null) {
|
||||||
|
if (displaystatus=='show') {
|
||||||
|
document.getElementById(spanid).style.display="block";
|
||||||
|
}
|
||||||
|
else if (displaystatus=='hide') {
|
||||||
|
document.getElementById(spanid).style.display="none";
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
alert ("An error occurred when calling completion_set_progressicon_visibility() function.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1197,6 +1197,8 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
|
||||||
static $strunreadpostsone;
|
static $strunreadpostsone;
|
||||||
static $usetracking;
|
static $usetracking;
|
||||||
static $groupings;
|
static $groupings;
|
||||||
|
static $shownhelp=false;
|
||||||
|
static $hiddenhelp=false;
|
||||||
|
|
||||||
|
|
||||||
if (!isset($initialised)) {
|
if (!isset($initialised)) {
|
||||||
|
@ -1491,6 +1493,10 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
|
||||||
echo "<span class='autocompletion'>";
|
echo "<span class='autocompletion'>";
|
||||||
echo "<img src='$imgsrc' alt='$imgalt' title='$imgalt' /></span>";
|
echo "<img src='$imgsrc' alt='$imgalt' title='$imgalt' /></span>";
|
||||||
}
|
}
|
||||||
|
if (!$shownhelp && !$isediting) {
|
||||||
|
$PAGE->requires->js_function_call('completion_set_progressicon_visibility', array('completionprogressid', 'show'));
|
||||||
|
$shownhelp=true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1526,6 +1532,12 @@ function print_section($course, $section, $mods, $modnamesused, $absolute=false,
|
||||||
if (!empty($section->sequence) || $ismoving) {
|
if (!empty($section->sequence) || $ismoving) {
|
||||||
echo "</ul><!--class='section'-->\n\n";
|
echo "</ul><!--class='section'-->\n\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//use javascript to hide the progress help button when no progress tick boxes have been displayed
|
||||||
|
if (!$shownhelp && !$hiddenhelp && $completioninfo->is_enabled()&& !$isediting && isloggedin() && !isguestuser()) {
|
||||||
|
$PAGE->requires->js_function_call('completion_set_progressicon_visibility', array('completionprogressid', 'hide'));
|
||||||
|
$hiddenhelp = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -178,6 +178,7 @@
|
||||||
if ($completion->is_enabled() && ajaxenabled()) {
|
if ($completion->is_enabled() && ajaxenabled()) {
|
||||||
$PAGE->requires->yui_lib('connection');
|
$PAGE->requires->yui_lib('connection');
|
||||||
$PAGE->requires->js('course/completion.js');
|
$PAGE->requires->js('course/completion.js');
|
||||||
|
$PAGE->requires->js_function_call('completion_init')->on_dom_ready();
|
||||||
$PAGE->requires->data_for_js('completion_strsaved', get_string('saved', 'completion'));
|
$PAGE->requires->data_for_js('completion_strsaved', get_string('saved', 'completion'));
|
||||||
$PAGE->requires->data_for_js('completion_strtitley', get_string('completion-title-manual-y', 'completion'));
|
$PAGE->requires->data_for_js('completion_strtitley', get_string('completion-title-manual-y', 'completion'));
|
||||||
$PAGE->requires->data_for_js('completion_strtitlen', get_string('completion-title-manual-n', 'completion'));
|
$PAGE->requires->data_for_js('completion_strtitlen', get_string('completion-title-manual-n', 'completion'));
|
||||||
|
|
|
@ -49,5 +49,4 @@ $string['unlockcompletion']='Unlock completion options';
|
||||||
$string['writingcompletiondata']='Writing completion data';
|
$string['writingcompletiondata']='Writing completion data';
|
||||||
$string['completionicons']='progress tick boxes';
|
$string['completionicons']='progress tick boxes';
|
||||||
$string['yourprogress']='Your progress';
|
$string['yourprogress']='Your progress';
|
||||||
$string['yourprogress']='Your progress';
|
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -168,7 +168,7 @@ class completion_info {
|
||||||
public function print_help_icon() {
|
public function print_help_icon() {
|
||||||
global $PAGE;
|
global $PAGE;
|
||||||
if ($this->is_enabled() && !$PAGE->user_is_editing() && isloggedin() && !isguestuser()) {
|
if ($this->is_enabled() && !$PAGE->user_is_editing() && isloggedin() && !isguestuser()) {
|
||||||
echo '<span class="completionprogress">'.get_string('yourprogress','completion').' ';
|
echo '<span id = "completionprogressid" class="completionprogress">'.get_string('yourprogress','completion').' ';
|
||||||
helpbutton('completionicons',get_string('completionicons','completion'),'completion');
|
helpbutton('completionicons',get_string('completionicons','completion'),'completion');
|
||||||
echo '</span>';
|
echo '</span>';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue