Skip to content

Commit

Permalink
Merge branch '69-courseActivityProgressLink' into 'master'
Browse files Browse the repository at this point in the history
Add link to activity progress report

See merge request mediamaisteri/moodle/block_mmquicklink!120
  • Loading branch information
mikkohaikonen committed Dec 16, 2020
2 parents 2ef8568 + a9a0ba9 commit 5720ed7
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 3 deletions.
1 change: 1 addition & 0 deletions block_mmquicklink.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,7 @@ public function get_content() {
$this->content->text .= $buttons->showhide();
$this->content->text .= $buttons->deletecourse();
$this->content->text .= $buttons->archivecourse();
$this->content->text .= $buttons->activityprogress();
$this->content->text .= $buttons->completionprogressblock($plugins);
$this->content->text .= $buttons->enrolmentkey();
$this->content->text .= $buttons->participants();
Expand Down
26 changes: 26 additions & 0 deletions classes/buttons.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

defined('MOODLE_INTERNAL') || die();
require_once($CFG->dirroot . '/blocks/mmquicklink/lib.php');
require_once("{$CFG->libdir}/completionlib.php");

class buttons {

Expand Down Expand Up @@ -493,6 +494,31 @@ public function participants() {
}
}

/**
* Render 'participants' element.
*
* @return html rendered element.
*/
public function activityprogress() {

if (!empty(get_config('mmquicklink', 'config_hide_activityprogress'))) {
return '';
}

// Get criteria for course
$completion = new completion_info($this->course);

if (!$completion->has_criteria()) {
return '';
}

if (has_capability('moodle/course:update', context_course::instance($this->course->id))) {
return $this->default_element($this->cfg->wwwroot .
"/report/completion/index.php?course=" . $this->course->id, get_string('pluginname', 'report_progress'),
"activityprogress");
}
}

/**
* Render 'add completion progress block' element.
*
Expand Down
3 changes: 3 additions & 0 deletions lang/en/block_mmquicklink.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@
$string['setting_coursecompletionsettings'] = "Course completion settings";
$string['setting_coursecompletionsettings_desc'] = "Check to hide 'Edit course completion setting' link";

$string['setting_activityprogresssettings'] = "Course progress report";
$string['setting_activityprogresssettings_desc'] = "Check to hide 'Activity completion' link";

$string['setting_general'] = "General settings";
$string['setting_blocktitle'] = "Block title";
$string['setting_blocktitle_desc'] = "If title is unset, the block uses default title.";
Expand Down
2 changes: 2 additions & 0 deletions lang/fi/block_mmquicklink.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
$string['setting_coursecompletionsettings'] = "Kurssin suoritusasetukset";
$string['setting_coursecompletionsettings_desc'] = "Valitse piilottaksesi 'Muokkaa kurssin suoritusasetuksia' -painikkeen.";

$string['setting_activityprogresssettings'] = "Kurssin aktiviteettiraportti";
$string['setting_activityprogresssettings_desc'] = "Valitse piilottaaksesi kurssin aktiviteettiraportti -linkki.";

$string['setting_archive'] = "Arkistoi kurssi";
$string['setting_archive_desc'] = "Valitse piilottaaksesi arkistointipainikkeen. Painikkeen toiminta vaatii lisäksi local_course_archive -lisäosan.";
Expand Down
6 changes: 5 additions & 1 deletion settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,13 @@
$settings->add(new admin_setting_configcheckbox('mmquicklink/config_hide_editsettings',
get_string('setting_editsettings', 'block_mmquicklink'), get_string('setting_editsettings_desc', 'block_mmquicklink'), 0));

$settings->add(new admin_setting_configcheckbox('mmquicklink/config_hide_activityprogress',
get_string('setting_activityprogresssettings', 'block_mmquicklink'),
get_string('setting_activityprogresssettings_desc', 'block_mmquicklink'), 1));

$settings->add(new admin_setting_configcheckbox('mmquicklink/config_hide_coursecompletionsettings',
get_string('setting_coursecompletionsettings', 'block_mmquicklink'),
get_string('setting_coursecompletionsettings_desc', 'block_mmquicklink'), 0));
get_string('setting_coursecompletionsettings_desc', 'block_mmquicklink'), 1));

$settings->add(new admin_setting_configcheckbox('mmquicklink/config_hide_participants',
get_string('setting_participants', 'block_mmquicklink'), get_string('setting_participants_desc', 'block_mmquicklink'), 0));
Expand Down
1 change: 1 addition & 0 deletions templates/setting_quicklink.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@
<li id='16' data-button="enrolmentkey" class="btn btn-block btn-default text-center">{{#str}}enrolmentkey, block_mmquicklink{{/str}}</li>
<li id='17' data-button="coursebgimagechanger" class="btn btn-block btn-default text-center">{{#str}}coursebgimagechanger, block_mmquicklink{{/str}}</li>
<li id='18' data-button="coursecompletionsettings" class="btn btn-block btn-default text-center">{{#str}}setting_coursecompletionsettings, block_mmquicklink{{/str}}</li>
<li id='19' data-button="activityprogress" class="btn btn-block btn-default text-center">{{#str}}pluginname, report_progress{{/str}}</li>
</ul>
4 changes: 2 additions & 2 deletions version.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
defined('MOODLE_INTERNAL') || die();

$plugin->component = 'block_mmquicklink';
$plugin->version = 2020091600;
$plugin->version = 2020121600;
$plugin->requires = 2016052300;
$plugin->maturity = MATURITY_STABLE;
$plugin->release = "1.7.0";
$plugin->release = "1.7.1";

0 comments on commit 5720ed7

Please sign in to comment.