Browse Source

block_completion_progress: Fix label URL issue, assignment redirection, constants and strings

master
Michael de Raadt 9 years ago
parent
commit
d7256a4e1e
  1. 19
      block_completion_progress.php
  2. 11
      edit_form.php
  3. 154
      lang/en/block_completion_progress.php
  4. 30
      lib.php
  5. 8
      overview.php
  6. 24
      settings.php
  7. 4
      version.php

19
block_completion_progress.php

@ -203,10 +203,9 @@ class block_completion_progress extends block_base {
if ($this->page->user_is_editing() && $this->content->text == '') { if ($this->page->user_is_editing() && $this->content->text == '') {
$this->content->text = get_string('no_blocks', 'block_completion_progress'); $this->content->text = get_string('no_blocks', 'block_completion_progress');
} }
}
// Gather content for block on regular course. } else {
else { // Gather content for block on regular course.
// Check if user is in group for block. // Check if user is in group for block.
if ( if (
@ -217,15 +216,23 @@ class block_completion_progress extends block_base {
return $this->content; return $this->content;
} }
// Check if completion is enabled. // Check if completion is enabled at site level.
$completion = new completion_info($COURSE); if (!$CFG->enablecompletion) {
if (!$CFG->enablecompletion || !$completion->is_enabled()) {
if (has_capability('moodle/block:edit', $this->context)) { if (has_capability('moodle/block:edit', $this->context)) {
$this->content->text .= get_string('completion_not_enabled', 'block_completion_progress'); $this->content->text .= get_string('completion_not_enabled', 'block_completion_progress');
} }
return $this->content; return $this->content;
} }
// Check if completion is enabled at course level.
$completion = new completion_info($COURSE);
if (!$completion->is_enabled()) {
if (has_capability('moodle/block:edit', $this->context)) {
$this->content->text .= get_string('completion_not_enabled_course', 'block_completion_progress');
}
return $this->content;
}
// Check if any activities/resources have been created. // Check if any activities/resources have been created.
$activities = block_completion_progress_get_activities($COURSE->id, $this->config); $activities = block_completion_progress_get_activities($COURSE->id, $this->config);
$activities = block_completion_progress_filter_visibility($activities, $USER->id, $COURSE->id); $activities = block_completion_progress_filter_visibility($activities, $USER->id, $COURSE->id);

11
edit_form.php

@ -57,7 +57,7 @@ class block_completion_progress_edit_form extends block_edit_form {
); );
$orderbylabel = get_string('config_orderby', 'block_completion_progress'); $orderbylabel = get_string('config_orderby', 'block_completion_progress');
$mform->addElement('select', 'config_orderby', $orderbylabel, $orderingoptions); $mform->addElement('select', 'config_orderby', $orderbylabel, $orderingoptions);
$mform->setDefault('config_orderby', DEFAULT_ORDERBY); $mform->setDefault('config_orderby', DEFAULT_COMPLETIONPROGRESS_ORDERBY);
$mform->addHelpButton('config_orderby', 'how_ordering_works', 'block_completion_progress'); $mform->addHelpButton('config_orderby', 'how_ordering_works', 'block_completion_progress');
// Check if all elements have an expect completion by time set. // Check if all elements have an expect completion by time set.
@ -69,9 +69,8 @@ class block_completion_progress_edit_form extends block_edit_form {
} }
if (!$allwithexpected) { if (!$allwithexpected) {
$warningstring = get_string('not_all_expected_set', 'block_completion_progress', $expectedbystring); $warningstring = get_string('not_all_expected_set', 'block_completion_progress', $expectedbystring);
$expectedwarning = HTML_WRITER::tag('div', $warningstring, array('class' => 'error')); $expectedwarning = HTML_WRITER::tag('div', $warningstring, array('class' => 'warning'));
$mform->addElement('static', $expectedwarning, '', $expectedwarning); $mform->addElement('static', $expectedwarning, '', $expectedwarning);
$mform->disabledif($expectedwarning, 'config_orderby', 'neq', 'orderbytime');
} }
// Control how long bars wrap/scroll. // Control how long bars wrap/scroll.
@ -82,7 +81,7 @@ class block_completion_progress_edit_form extends block_edit_form {
); );
$longbarslabel = get_string('config_longbars', 'block_completion_progress'); $longbarslabel = get_string('config_longbars', 'block_completion_progress');
$mform->addElement('select', 'config_longbars', $longbarslabel, $longbaroptions); $mform->addElement('select', 'config_longbars', $longbarslabel, $longbaroptions);
$defaultlongbars = get_config('block_completion_progress', 'defaultlongbars') ?: DEFAULT_LONGBARS; $defaultlongbars = get_config('block_completion_progress', 'defaultlongbars') ?: DEFAULT_COMPLETIONPROGRESS_LONGBARS;
$mform->setDefault('config_longbars', $defaultlongbars); $mform->setDefault('config_longbars', $defaultlongbars);
$mform->addHelpButton('config_longbars', 'how_longbars_works', 'block_completion_progress'); $mform->addHelpButton('config_longbars', 'how_longbars_works', 'block_completion_progress');
@ -91,13 +90,13 @@ class block_completion_progress_edit_form extends block_edit_form {
get_string('config_icons', 'block_completion_progress').' '. get_string('config_icons', 'block_completion_progress').' '.
$OUTPUT->pix_icon('tick', '', 'block_completion_progress', array('class' => 'iconOnConfig')).' '. $OUTPUT->pix_icon('tick', '', 'block_completion_progress', array('class' => 'iconOnConfig')).' '.
$OUTPUT->pix_icon('cross', '', 'block_completion_progress', array('class' => 'iconOnConfig'))); $OUTPUT->pix_icon('cross', '', 'block_completion_progress', array('class' => 'iconOnConfig')));
$mform->setDefault('config_progressBarIcons', DEFAULT_PROGRESSBARICONS); $mform->setDefault('config_progressBarIcons', DEFAULT_COMPLETIONPROGRESS_PROGRESSBARICONS);
$mform->addHelpButton('config_progressBarIcons', 'why_use_icons', 'block_completion_progress'); $mform->addHelpButton('config_progressBarIcons', 'why_use_icons', 'block_completion_progress');
// Allow progress percentage to be turned on for students. // Allow progress percentage to be turned on for students.
$mform->addElement('selectyesno', 'config_showpercentage', $mform->addElement('selectyesno', 'config_showpercentage',
get_string('config_percentage', 'block_completion_progress')); get_string('config_percentage', 'block_completion_progress'));
$mform->setDefault('config_showpercentage', DEFAULT_SHOWPERCENTAGE); $mform->setDefault('config_showpercentage', DEFAULT_COMPLETIONPROGRESS_SHOWPERCENTAGE);
$mform->addHelpButton('config_showpercentage', 'why_show_precentage', 'block_completion_progress'); $mform->addHelpButton('config_showpercentage', 'why_show_precentage', 'block_completion_progress');
// Allow the block to be visible to a single group. // Allow the block to be visible to a single group.

154
lang/en/block_completion_progress.php

@ -22,129 +22,75 @@
* @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
*/ */
// Stings for the Config page. $string['completed_colour'] = '#73A839';
$string['completed_colour_descr'] = 'HTML Colour code for elements that have been completed';
$string['completed_colour_title'] = 'Completed colour';
$string['completion_not_enabled'] = 'Completion tracking is not enabled on this site.';
$string['completion_not_enabled_course'] = 'Completion tracking is not enabled in this course.';
$string['completion_progress:addinstance'] = 'Add a new Completion Progress block';
$string['completion_progress:myaddinstance'] = 'Add a Completion Progress block to My home page';
$string['completion_progress:overview'] = 'View course overview of Completion Progress for all students';
$string['completion_progress:showbar'] = 'Show the bar in the Completion Progress block';
$string['config_activitiesincluded'] = 'Activities included';
$string['config_activitycompletion'] = 'All activities with completion set';
$string['config_default_title'] = 'Completion Progress'; $string['config_default_title'] = 'Completion Progress';
$string['config_group'] = 'Visible only to group'; $string['config_group'] = 'Visible only to group';
$string['config_header_monitored'] = 'Monitored'; $string['config_header_monitored'] = 'Monitored';
$string['config_icons'] = 'Use icons in bar'; $string['config_icons'] = 'Use icons in bar';
$string['config_longbars'] = 'How to present long bars'; $string['config_longbars'] = 'How to present long bars';
$string['config_orderby'] = 'Order bar by';
$string['config_orderby_course_order'] = 'Ordering in course';
$string['config_orderby_due_time'] = 'Time using "{$a}" date';
$string['config_percentage'] = 'Show percentage to students'; $string['config_percentage'] = 'Show percentage to students';
$string['config_scroll'] = 'Scroll'; $string['config_scroll'] = 'Scroll';
$string['config_selectactivities'] = 'Select activities';
$string['config_selectedactivities'] = 'Selected activities';
$string['config_squeeze'] = 'Squeeze'; $string['config_squeeze'] = 'Squeeze';
$string['config_title'] = 'Alternate title'; $string['config_title'] = 'Alternate title';
$string['config_orderby'] = 'Order bar by';
$string['config_orderby_due_time'] = '"{$a}" date';
$string['config_orderby_course_order'] = 'Ordering in course';
$string['config_wrap'] = 'Wrap'; $string['config_wrap'] = 'Wrap';
$string['config_activitycompletion'] = 'All activities with completion set'; $string['coursenametoshow'] = 'Course name to show on Dashboard';
$string['config_selectedactivities'] = 'Selected activities'; $string['defaultlongbars'] = 'Default presentation for long bars';
$string['config_activitiesincluded'] = 'Activities included'; $string['fullname'] = 'Full course name';
$string['config_selectactivities'] = 'Select activities'; $string['futureNotCompleted_colour'] = '#025187';
$string['futureNotCompleted_colour_descr'] = 'HTML colour code for future elements that have not yet been completed';
// Help strings. $string['futureNotCompleted_colour_title'] = 'Future not-completed colour';
$string['why_set_the_title'] = 'Why you might want to set the block instance title?'; $string['how_activitiesincluded_works'] = 'How including activities works';
$string['why_set_the_title_help'] = ' $string['how_activitiesincluded_works_help'] = '<p>By default, all activities with Activity completion settings set are included in the bar.</p><p>You can also manually select activities to be included.</p>';
<p>There can be multiple instances of the Completion Progress block. You may use different Completion Progress blocks to monitor different sets of activities or resources. For instance you could track progress in assignments in one block and quizzes in another. For this reason you can override the default title and set a more appropriate block title for each instance.</p>
';
$string['why_use_icons'] = 'Why you might want to use icons?';
$string['why_use_icons_help'] = '
<p>You may wish to add tick and cross icons in the Completion Progress to make this block more visually accessible for students with colour-blindness.</p>
<p>It may also make the meaning of the block clearer if you believe colours are not intuitive, either for cultural or personal reasons.</p>
';
$string['why_show_precentage'] = 'Why show a progress percentage to students?';
$string['why_show_precentage_help'] = '
<p>It is possible to show an overall percentage of progress to students.</p>
<p>This is calculated as the number of items complete divided by the total number of items in the bar.</p>
<p>The progress percentage appears until the student mouses over an item in the bar.</p>
';
$string['how_ordering_works'] = 'How ordering works';
$string['how_ordering_works_help'] = '
<p>There are two ways items in the Completion Progress can be ordered.</p>
<ul>
<li><em>"Expect completion on" date</em> (default)<br />
The expected completion dates of activities/resources are used to order the bar. Where activities/resources don\'t have an expected completion date, ordering in the course is used instead.
</li>
<li><em>Ordering in course</em><br />
Activities/resources are presented in the same order as they are on the course page. When this option is used, expected completion dates are ignored.
</li>
</ul>
';
$string['how_group_works'] = 'How visible group works'; $string['how_group_works'] = 'How visible group works';
$string['how_group_works_help'] = ' $string['how_group_works_help'] = '<p>Selecting a group will limit the display of the this block to that group only.</p>';
<p>Selecting a group will limit the display of the this block to that group only.</p>
';
$string['how_longbars_works'] = 'How long bars are presented'; $string['how_longbars_works'] = 'How long bars are presented';
$string['how_longbars_works_help'] = ' $string['how_longbars_works_help'] = '<p>When bars exceed a set length, how they can be presented in one of the following ways.</p><ul><li>Squeezed into one horizontal bar</li><li>Scrolling sideways to show overflowing bar segments</li><li>Wrapping to show all bar segments on multiple lines</li></ul><p>Note that when the bar is wrapped, the NOW indicator will not be shown.</p>';
<p>When bars exceed a set length, how they can be presented in one of the following ways.</p> $string['how_ordering_works'] = 'How ordering works';
<ul> $string['how_ordering_works_help'] = '<p>There are two ways to order activities in the Completion Progress block.</p><ul><li><em>Time using "Expect completion on" date</em> (default)<br />The expected completion dates of activities/resources are used to order the bar. Where activities/resources don\'t have an expected completion date, ordering in the course is used instead. When this option is used, the NOW indicator is shown.</li><li><em>Ordering in course</em><br />Activities/resources are presented in the same order as they are on the course page. When this option is used, expected completion dates are ignored. When this option is used, the NOW indicator is not shown.</li></ul>';
<li>Squeezed into one horizontal bar</li>
<li>Scrolling sideways to show overflowing bar segments</li>
<li>Wrapping to show all bar segments on multiple lines</li>
</ul>
<p>Note that when the bar is wrapped, the NOW indicator will not be shown.</p>
';
$string['how_activitiesincluded_works'] = 'How including activities works';
$string['how_activitiesincluded_works_help'] = '
<p>By default, all activities with Activity completion settings set are included in the bar.</p>
<p>You can also manually select activities to be included.</p>
';
$string['how_selectactivities_works'] = 'How including activities works'; $string['how_selectactivities_works'] = 'How including activities works';
$string['how_selectactivities_works_help'] = ' $string['how_selectactivities_works_help'] = '<p>To manually select activities to be include in the bar, ensure that "'.$string['config_activitiesincluded'].'" is set to "'.$string['config_selectedactivities'].'".</p><p>Only activities with activity completion settings set can be included.</p><p>Hold the CTRL key to select multiple activities.</p>';
<p>To manually select activities to be include in the bar, ensure that "'.$string['config_activitiesincluded'].'" is set to "'.$string['config_selectedactivities'].'".</p> $string['lastonline'] = 'Last in course';
<p>Only activities with activity completion settings set can be included.</p>
<p>Hold the CTRL key to select multiple items.</p>
';
// Other terms.
$string['completion_not_enabled'] = 'Completion tracking is not enabled.';
$string['mouse_over_prompt'] = 'Mouse over or touch bar for info.'; $string['mouse_over_prompt'] = 'Mouse over or touch bar for info.';
$string['no_activities_config_message'] = ' $string['no_activities_config_message'] = 'There are no activities or resources with activity completion set or no activities or resources have been selected. Set activity completion on activities and resources then configure this block.';
There are no activities or resources with activity completion set or no activities or resources have been selected.
Set activity completion on activities and resources then configure this block.
';
$string['no_activities_message'] = 'No activities or resources are being monitored. Use config to set up monitoring.'; $string['no_activities_message'] = 'No activities or resources are being monitored. Use config to set up monitoring.';
$string['no_visible_activities_message'] = 'None of the monitored events are currently visible.'; $string['no_blocks'] = 'No Completion Progress blocks are set up for your courses.';
$string['no_visible_activities_message'] = 'None of the monitored activities are currently visible.';
$string['not_all_expected_set'] = 'Not all activities with completion have an "{$a}" date set.';
$string['notCompleted_colour'] = '#C71C22';
$string['notCompleted_colour_descr'] = 'HTML colour code for current elements that have not yet been completed';
$string['notCompleted_colour_title'] = 'Not-completed colour';
$string['now_indicator'] = 'NOW'; $string['now_indicator'] = 'NOW';
$string['overview'] = 'Overview of students';
$string['pluginname'] = 'Completion Progress'; $string['pluginname'] = 'Completion Progress';
$string['progress'] = 'Progress';
$string['progressbar'] = 'Completion Progress';
$string['shortname'] = 'Short course name';
$string['showallinfo'] = 'Show all info'; $string['showallinfo'] = 'Show all info';
$string['time_expected'] = 'Expected'; $string['showinactive'] = 'Show inactive students in Overview';
$string['not_all_expected_set'] = 'Not all activities with completion have an "{$a}" date set.';
$string['submitted'] = 'Submitted'; $string['submitted'] = 'Submitted';
// Global setting strings
// Default colours that may have different cultural meanings.
// Note that these defaults can be overridden by the block's global settings.
$string['attempted_colour'] = '#73A839';
$string['submittednotcomplete_colour'] = '#FFCC00'; $string['submittednotcomplete_colour'] = '#FFCC00';
$string['notAttempted_colour'] = '#C71C22';
$string['futureNotAttempted_colour'] = '#025187';
$string['attempted_colour_title'] = 'Attempted colour';
$string['attempted_colour_descr'] = 'HTML Colour code for elements that have been attempted';
$string['submittednotcomplete_colour_title'] = 'Submitted but not complete colour';
$string['submittednotcomplete_colour_descr'] = 'HTML colour code for elements that have been submitted, but are not yet complete'; $string['submittednotcomplete_colour_descr'] = 'HTML colour code for elements that have been submitted, but are not yet complete';
$string['notattempted_colour_title'] = 'Not-attempted colour'; $string['submittednotcomplete_colour_title'] = 'Submitted but not complete colour';
$string['notattempted_colour_descr'] = 'HTML colour code for current elements that have not yet been attempted'; $string['time_expected'] = 'Expected';
$string['futurenotattempted_colour_title'] = 'Future Not-attempted colour'; $string['why_set_the_title'] = 'Why you might want to set the block instance title?';
$string['futurenotattempted_colour_descr'] = 'HTML colour code for future elements that have not yet been attemted'; $string['why_set_the_title_help'] = '<p>There can be multiple instances of the Completion Progress block. You may use different Completion Progress blocks to monitor different sets of activities or resources. For instance you could track progress in assignments in one block and quizzes in another. For this reason you can override the default title and set a more appropriate block title for each instance.</p>';
$string['coursenametoshow'] = 'Course name to show on Dashboard'; $string['why_show_precentage'] = 'Why show a progress percentage to students?';
$string['shortname'] = 'Short course name'; $string['why_show_precentage_help'] = '<p>It is possible to show an overall percentage of progress to students.</p><p>This is calculated as the number of activities completed divided by the total number of activities in the bar.</p><p>The progress percentage appears until the student mouses over an item in the bar.</p>';
$string['fullname'] = 'Full course name'; $string['why_use_icons'] = 'Why you might want to use icons?';
$string['showinactive'] = 'Show inactive students in Overview'; $string['why_use_icons_help'] = '<p>You may wish to add tick and cross icons in the Completion Progress to make this block more visually accessible for students with colour-blindness.</p><p>It may also make the meaning of the block clearer if you believe colours are not intuitive, either for cultural or personal reasons.</p>';
$string['wrapafter'] = 'When wrapping, limit rows to'; $string['wrapafter'] = 'When wrapping, limit rows to';
$string['defaultlongbars'] = 'Default presentation for long bars';
// Overview page strings.
$string['lastonline'] = 'Last in course';
$string['overview'] = 'Overview of students';
$string['progress'] = 'Progress';
$string['progressbar'] = 'Completion Progress';
// For capabilities.
$string['completion_progress:overview'] = 'View course overview of Completion Progresss for all students';
$string['completion_progress:addinstance'] = 'Add a new Completion Progress block';
$string['completion_progress:myaddinstance'] = 'Add a Completion Progress block to My home page';
$string['completion_progress:showbar'] = 'Show the bar in the Completion Progress block';
// For My home page.
$string['no_blocks'] = "No Completion Progress blocks are set up for your courses.";

30
lib.php

@ -120,6 +120,7 @@ function block_completion_progress_course_submissions($courseid) {
$submissions[] = $mapping; $submissions[] = $mapping;
} }
} }
return $submissions; return $submissions;
} }
@ -129,10 +130,8 @@ function block_completion_progress_course_submissions($courseid) {
* @return array URLs and associated capabilities, per activity * @return array URLs and associated capabilities, per activity
*/ */
function block_completion_progress_modules_with_alternate_links() { function block_completion_progress_modules_with_alternate_links() {
return array( $alternatelinks = array(
'assign' => array( 'assign' => array(
// The following can be used when MDL-52133 is resolved
// 'url' => '/mod/assign/view.php?id=:cmid&action=grade&userid=:userid&rownum=0',
'url' => '/mod/assign/view.php?id=:cmid&action=grading', 'url' => '/mod/assign/view.php?id=:cmid&action=grading',
'capability' => 'mod/assign:grade', 'capability' => 'mod/assign:grade',
), ),
@ -150,6 +149,12 @@ function block_completion_progress_modules_with_alternate_links() {
'capability' => 'mod/quiz:viewreports', 'capability' => 'mod/quiz:viewreports',
), ),
); );
if ($CFG->version > 2015111604) {
$alternatelinks['assign']['url'] = '/mod/assign/view.php?id=:cmid&action=grade&userid=:userid';
}
return $alternatelinks;
} }
/** /**
@ -164,7 +169,6 @@ function block_completion_progress_get_activities($courseid, $config = null, $fo
$modinfo = get_fast_modinfo($courseid, -1); $modinfo = get_fast_modinfo($courseid, -1);
$sections = $modinfo->get_sections(); $sections = $modinfo->get_sections();
$activities = array(); $activities = array();
foreach ($modinfo->instances as $module => $instances) { foreach ($modinfo->instances as $module => $instances) {
$modulename = get_string('pluginname', $module); $modulename = get_string('pluginname', $module);
foreach ($instances as $index => $cm) { foreach ($instances as $index => $cm) {
@ -184,7 +188,7 @@ function block_completion_progress_get_activities($courseid, $config = null, $fo
'expected' => $cm->completionexpected, 'expected' => $cm->completionexpected,
'section' => $cm->sectionnum, 'section' => $cm->sectionnum,
'position' => array_search($cm->id, $sections[$cm->sectionnum]), 'position' => array_search($cm->id, $sections[$cm->sectionnum]),
'url' => $cm->url->out(), 'url' => method_exists($cm->url, 'out') ? $cm->url->out() : '',
'context' => $cm->context, 'context' => $cm->context,
'icon' => $cm->get_icon_url(), 'icon' => $cm->get_icon_url(),
'available' => $cm->available, 'available' => $cm->available,
@ -342,10 +346,10 @@ function block_completion_progress_bar($activities, $completions, $config, $user
// Get colours and use defaults if they are not set in global settings. // Get colours and use defaults if they are not set in global settings.
$colournames = array( $colournames = array(
'attempted_colour' => 'attempted_colour', 'completed_colour' => 'completed_colour',
'submittednotcomplete_colour' => 'submittednotcomplete_colour', 'submittednotcomplete_colour' => 'submittednotcomplete_colour',
'notattempted_colour' => 'notAttempted_colour', 'notCompleted_colour' => 'notCompleted_colour',
'futurenotattempted_colour' => 'futureNotAttempted_colour' 'futureNotCompleted_colour' => 'futureNotCompleted_colour'
); );
$colours = array(); $colours = array();
foreach ($colournames as $name => $stringkey) { foreach ($colournames as $name => $stringkey) {
@ -457,23 +461,23 @@ function block_completion_progress_bar($activities, $completions, $config, $user
$cellcontent = $OUTPUT->pix_icon('blank', '', 'block_completion_progress'); $cellcontent = $OUTPUT->pix_icon('blank', '', 'block_completion_progress');
} else if ($complete === true) { } else if ($complete === true) {
$celloptions['style'] .= $colours['attempted_colour'].';'; $celloptions['style'] .= $colours['completed_colour'].';';
$cellcontent = $OUTPUT->pix_icon($useicons == 1 ? 'tick' : 'blank', '', 'block_completion_progress'); $cellcontent = $OUTPUT->pix_icon($useicons == 1 ? 'tick' : 'blank', '', 'block_completion_progress');
} else if ( } else if (
(!isset($config->orderby) || $config->orderby == 'orderbytime') && (!isset($config->orderby) || $config->orderby == 'orderbytime') &&
(isset($activity['expected']) && $activity['expected'] > 0 && $activity['expected'] < $now) (isset($activity['expected']) && $activity['expected'] > 0 && $activity['expected'] < $now)
) { ) {
$celloptions['style'] .= $colours['notattempted_colour'].';'; $celloptions['style'] .= $colours['notCompleted_colour'].';';
$cellcontent = $OUTPUT->pix_icon($useicons == 1 ? 'cross' : 'blank', '', 'block_completion_progress'); $cellcontent = $OUTPUT->pix_icon($useicons == 1 ? 'cross' : 'blank', '', 'block_completion_progress');
} else { } else {
$celloptions['style'] .= $colours['futurenotattempted_colour'].';'; $celloptions['style'] .= $colours['futureNotCompleted_colour'].';';
$cellcontent = $OUTPUT->pix_icon('blank', '', 'block_completion_progress'); $cellcontent = $OUTPUT->pix_icon('blank', '', 'block_completion_progress');
} }
if (!empty($activity['available']) || $simple) { if (!empty($activity['available']) || $simple) {
$celloptions['onclick'] = 'document.location=\''.$activity['link'].'\';'; $celloptions['onclick'] = 'document.location=\''.$activity['link'].'\';';
} else { } else if (!empty($activity['link'])) {
$celloptions['style'] .= 'cursor: not-allowed;'; $celloptions['style'] .= 'cursor: not-allowed;';
} }
if ($longbars != 'wrap' && $counter == 1) { if ($longbars != 'wrap' && $counter == 1) {
@ -523,7 +527,7 @@ function block_completion_progress_bar($activities, $completions, $config, $user
$text .= html_writer::empty_tag('img', $text .= html_writer::empty_tag('img',
array('src' => $activity['icon'], 'class' => 'moduleIcon', 'alt' => '', 'role' => 'presentation')); array('src' => $activity['icon'], 'class' => 'moduleIcon', 'alt' => '', 'role' => 'presentation'));
$text .= s($activity['name']); $text .= s($activity['name']);
if (!empty($activity['available']) || $simple) { if (!empty($activity['link']) && (!empty($activity['available']) || $simple)) {
$content .= $OUTPUT->action_link($activity['link'], $text); $content .= $OUTPUT->action_link($activity['link'], $text);
} else { } else {
$content .= $text; $content .= $text;

8
overview.php

@ -28,10 +28,10 @@ require_once(dirname(__FILE__) . '/../../config.php');
require_once($CFG->dirroot.'/blocks/completion_progress/lib.php'); require_once($CFG->dirroot.'/blocks/completion_progress/lib.php');
require_once($CFG->libdir.'/tablelib.php'); require_once($CFG->libdir.'/tablelib.php');
define('USER_SMALL_CLASS', 20); // Below this is considered small. const USER_SMALL_CLASS = 20; // Below this is considered small.
define('USER_LARGE_CLASS', 200); // Above this is considered large. const USER_LARGE_CLASS = 200; // Above this is considered large.
define('DEFAULT_PAGE_SIZE', 20); const DEFAULT_PAGE_SIZE = 20;
define('SHOW_ALL_PAGE_SIZE', 5000); const SHOW_ALL_PAGE_SIZE = 5000;
// Gather form data. // Gather form data.
$id = required_param('instanceid', PARAM_INT); $id = required_param('instanceid', PARAM_INT);

24
settings.php

@ -59,10 +59,10 @@ if ($ADMIN->fulltree) {
$options) $options)
); );
$settings->add(new admin_setting_configcolourpicker('block_completion_progress/attempted_colour', $settings->add(new admin_setting_configcolourpicker('block_completion_progress/completed_colour',
get_string('attempted_colour_title', 'block_completion_progress'), get_string('completed_colour_title', 'block_completion_progress'),
get_string('attempted_colour_descr', 'block_completion_progress'), get_string('completed_colour_descr', 'block_completion_progress'),
get_string('attempted_colour', 'block_completion_progress'), get_string('completed_colour', 'block_completion_progress'),
null ) null )
); );
@ -73,17 +73,17 @@ if ($ADMIN->fulltree) {
null ) null )
); );
$settings->add(new admin_setting_configcolourpicker('block_completion_progress/notattempted_colour', $settings->add(new admin_setting_configcolourpicker('block_completion_progress/notCompleted_colour',
get_string('notattempted_colour_title', 'block_completion_progress'), get_string('notCompleted_colour_title', 'block_completion_progress'),
get_string('notattempted_colour_descr', 'block_completion_progress'), get_string('notCompleted_colour_descr', 'block_completion_progress'),
get_string('notAttempted_colour', 'block_completion_progress'), get_string('notCompleted_colour', 'block_completion_progress'),
null ) null )
); );
$settings->add(new admin_setting_configcolourpicker('block_completion_progress/futurenotattempted_colour', $settings->add(new admin_setting_configcolourpicker('block_completion_progress/futureNotCompleted_colour',
get_string('futurenotattempted_colour_title', 'block_completion_progress'), get_string('futureNotCompleted_colour_title', 'block_completion_progress'),
get_string('futurenotattempted_colour_descr', 'block_completion_progress'), get_string('futureNotCompleted_colour_descr', 'block_completion_progress'),
get_string('futureNotAttempted_colour', 'block_completion_progress'), get_string('futureNotCompleted_colour', 'block_completion_progress'),
null ) null )
); );

4
version.php

@ -25,8 +25,8 @@
defined('MOODLE_INTERNAL') || die; defined('MOODLE_INTERNAL') || die;
$plugin->version = 2016050100; $plugin->version = 2016051400;
$plugin->requires = 2014051200; // Moodle 2.7. $plugin->requires = 2014051200; // Moodle 2.7.
$plugin->maturity = MATURITY_BETA; $plugin->maturity = MATURITY_RC;
$plugin->release = 'Version for Moodle 2.7 onwards'; $plugin->release = 'Version for Moodle 2.7 onwards';
$plugin->component = 'block_completion_progress'; $plugin->component = 'block_completion_progress';

Loading…
Cancel
Save