mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
Merge branch 'MDL-71161-master-4' of git://github.com/junpataleta/moodle
This commit is contained in:
commit
83b71194cd
@ -226,6 +226,8 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
* @return string
|
||||
*/
|
||||
public function render_assign_header(assign_header $header) {
|
||||
global $USER;
|
||||
|
||||
$o = '';
|
||||
|
||||
if ($header->subpage) {
|
||||
@ -244,6 +246,14 @@ class mod_assign_renderer extends plugin_renderer_base {
|
||||
|
||||
$o .= $this->output->header();
|
||||
$o .= $this->output->heading($heading);
|
||||
|
||||
// Show the activity information output component.
|
||||
$modinfo = get_fast_modinfo($header->assign->course);
|
||||
$cm = $modinfo->get_cm($header->coursemoduleid);
|
||||
$cmcompletion = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
$o .= $this->output->activity_information($cm, $cmcompletion, $activitydates);
|
||||
|
||||
if ($header->preface) {
|
||||
$o .= $header->preface;
|
||||
}
|
||||
|
@ -208,6 +208,12 @@ book_view($book, $chapter, $islastchapter, $course, $cm, $context);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($book->name));
|
||||
|
||||
// Render the activity information.
|
||||
$cminfo = cm_info::create($cm);
|
||||
$cmcompletion = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $cmcompletion, $activitydates);
|
||||
|
||||
// Info box.
|
||||
if ($book->intro) {
|
||||
echo $OUTPUT->box(format_module_intro('book', $book, $cm->id), 'generalbox', 'intro');
|
||||
|
@ -105,6 +105,12 @@ if ($currentgroup) {
|
||||
|
||||
echo $OUTPUT->heading(format_string($chat->name), 2);
|
||||
|
||||
// Render the activity information.
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
if ($chat->intro) {
|
||||
echo $OUTPUT->box(format_module_intro('chat', $chat, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
|
@ -80,7 +80,7 @@
|
||||
}
|
||||
$record = NULL;
|
||||
}
|
||||
|
||||
$cm = cm_info::create($cm);
|
||||
require_course_login($course, true, $cm);
|
||||
|
||||
require_once($CFG->dirroot . '/comment/lib.php');
|
||||
@ -268,6 +268,11 @@
|
||||
|
||||
echo $OUTPUT->heading(format_string($data->name), 2);
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
|
||||
// Do we need to show a link to the RSS feed for the records?
|
||||
//this links has been Settings (database activity administration) block
|
||||
/*if (!empty($CFG->enablerssfeeds) && !empty($CFG->data_enablerssfeeds) && $data->rssarticles > 0) {
|
||||
|
@ -78,6 +78,11 @@ $preview = html_writer::link($previewlnk, $previewimg);
|
||||
|
||||
echo $OUTPUT->heading(format_string($feedback->name) . $preview);
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
|
||||
// Print the tabs.
|
||||
require('tabs.php');
|
||||
|
||||
|
@ -76,6 +76,12 @@ echo $output->header();
|
||||
|
||||
echo $output->heading(format_string($folder->name), 2);
|
||||
|
||||
// Render the activity information.
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $output->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
echo $output->display_folder($folder);
|
||||
|
||||
echo $output->footer();
|
||||
|
@ -156,6 +156,11 @@ if (!empty($CFG->enablerssfeeds) && !empty($CFG->forum_enablerssfeeds) && $forum
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($forum->get_name()), 2);
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
|
||||
if (!$istypesingle && !empty($forum->get_intro())) {
|
||||
echo $OUTPUT->box(format_module_intro('forum', $forumrecord, $cm->id), 'generalbox', 'intro');
|
||||
}
|
||||
|
@ -46,6 +46,7 @@ if (!empty($id)) {
|
||||
} else {
|
||||
print_error('invalidid', 'glossary');
|
||||
}
|
||||
$cm = cm_info::create($cm);
|
||||
|
||||
require_course_login($course->id, true, $cm);
|
||||
$context = context_module::instance($cm->id);
|
||||
@ -298,6 +299,11 @@ if ($tab == GLOSSARY_APPROVAL_VIEW) {
|
||||
}
|
||||
echo $OUTPUT->heading(format_string($glossary->name), 2);
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
|
||||
/// All this depends if whe have $showcommonelements
|
||||
if ($showcommonelements) {
|
||||
/// To calculate available options
|
||||
|
@ -70,6 +70,11 @@ $PAGE->set_context($context);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($moduleinstance->name));
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
|
||||
$instance = $manager->get_instance();
|
||||
if (!empty($instance->intro)) {
|
||||
echo $OUTPUT->box(format_module_intro('h5pactivity', $instance, $cm->id), 'generalbox', 'intro');
|
||||
|
@ -70,6 +70,13 @@ if (!$imscp->structure) {
|
||||
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($imscp->name));
|
||||
|
||||
// Render the activity information.
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
// Info box.
|
||||
if ($imscp->intro) {
|
||||
echo $OUTPUT->box(format_module_intro('imscp', $imscp, $cm->id), 'generalbox', 'intro');
|
||||
|
@ -37,7 +37,7 @@ class mod_lesson_renderer extends plugin_renderer_base {
|
||||
* @return string
|
||||
*/
|
||||
public function header($lesson, $cm, $currenttab = '', $extraeditbuttons = false, $lessonpageid = null, $extrapagetitle = null) {
|
||||
global $CFG;
|
||||
global $CFG, $USER;
|
||||
|
||||
$activityname = format_string($lesson->name, true, $lesson->course);
|
||||
if (empty($extrapagetitle)) {
|
||||
@ -55,8 +55,13 @@ class mod_lesson_renderer extends plugin_renderer_base {
|
||||
lesson_add_header_buttons($cm, $context, $extraeditbuttons, $lessonpageid);
|
||||
$output = $this->output->header();
|
||||
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
if (has_capability('mod/lesson:manage', $context)) {
|
||||
$output .= $this->output->heading_with_help($activityname, 'overview', 'lesson');
|
||||
$output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
// Info box.
|
||||
if ($lesson->intro) {
|
||||
$output .= $this->output->box(format_module_intro('lesson', $lesson, $cm->id), 'generalbox', 'intro');
|
||||
@ -69,6 +74,8 @@ class mod_lesson_renderer extends plugin_renderer_base {
|
||||
}
|
||||
} else {
|
||||
$output .= $this->output->heading($activityname);
|
||||
$output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
// Info box.
|
||||
if ($lesson->intro) {
|
||||
$output .= $this->output->box(format_module_intro('lesson', $lesson, $cm->id), 'generalbox', 'intro');
|
||||
|
81
mod/lti/tests/behat/lti_activity_completion.feature
Normal file
81
mod/lti/tests/behat/lti_activity_completion.feature
Normal file
@ -0,0 +1,81 @@
|
||||
@mod @mod_lti @core_completion
|
||||
Feature: View activity completion information in the LTI activity
|
||||
In order to have visibility of LTI completion requirements
|
||||
As a student
|
||||
I need to be able to view my LTI completion progress
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Vinnie | Student1 | student1@example.com |
|
||||
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Enable completion tracking | Yes |
|
||||
| Show completion conditions | Yes |
|
||||
And I press "Save and display"
|
||||
And I turn editing mode on
|
||||
And I add a "External tool" to section "1" and I fill the form with:
|
||||
| Activity name | Music history |
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| Require view | 1 |
|
||||
| Require grade | 1 |
|
||||
And I log out
|
||||
|
||||
Scenario: View automatic completion items as a teacher
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I follow "Music history"
|
||||
Then "Music history" should have the "Receive a grade" completion condition
|
||||
And "Music history" should have the "View" completion condition
|
||||
|
||||
Scenario: View automatic completion items as a student
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
And the "View" completion condition of "Music history" is displayed as "done"
|
||||
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "View > Grader report" in the course gradebook
|
||||
And I turn editing mode on
|
||||
And I give the grade "90.00" to the user "Vinnie Student1" for the grade item "Music history"
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the "Receive a grade" completion condition of "Music history" is displayed as "done"
|
||||
And the "View" completion condition of "Music history" is displayed as "done"
|
||||
|
||||
@javascript
|
||||
Scenario: Use manual completion
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the field "Completion tracking" to "Students can manually mark the activity as completed"
|
||||
And I press "Save and display"
|
||||
# Teacher view.
|
||||
And I follow "Music history"
|
||||
And the manual completion button for "Music history" should be disabled
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the manual completion button of "Music history" is displayed as "Mark as done"
|
||||
And I toggle the manual completion state of "Music history"
|
||||
And the manual completion button of "Music history" is displayed as "Done"
|
@ -114,6 +114,12 @@ if ($lti->showtitlelaunch) {
|
||||
echo $OUTPUT->heading(format_string($lti->name, true, array('context' => $context)));
|
||||
}
|
||||
|
||||
// Display any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
if ($lti->showdescriptionlaunch && $lti->intro) {
|
||||
echo $OUTPUT->box(format_module_intro('lti', $lti, $cm->id), 'generalbox description', 'intro');
|
||||
}
|
||||
|
62
mod/page/tests/behat/page_activity_completion.feature
Normal file
62
mod/page/tests/behat/page_activity_completion.feature
Normal file
@ -0,0 +1,62 @@
|
||||
@mod @mod_page @core_completion
|
||||
Feature: View activity completion information in the Page resource
|
||||
In order to have visibility of page completion requirements
|
||||
As a student
|
||||
I need to be able to view my page completion progress
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Vinnie | Student1 | student1@example.com |
|
||||
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Enable completion tracking | Yes |
|
||||
| Show completion conditions | Yes |
|
||||
And I press "Save and display"
|
||||
|
||||
Scenario: View automatic completion items
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Page" to section "1" and I fill the form with:
|
||||
| Name | Music history |
|
||||
| Page content | A lesson learned in life |
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| Require view | 1 |
|
||||
# Teacher view.
|
||||
And I follow "Music history"
|
||||
And "Music history" should have the "View" completion condition
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the "View" completion condition of "Music history" is displayed as "done"
|
||||
|
||||
@javascript
|
||||
Scenario: Use manual completion
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Page" to section "1" and I fill the form with:
|
||||
| Name | Music history |
|
||||
| Page content | A lesson learned in life |
|
||||
| Completion tracking | Students can manually mark the activity as completed |
|
||||
# Teacher view.
|
||||
And I follow "Music history"
|
||||
And the manual completion button for "Music history" should be disabled
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the manual completion button of "Music history" is displayed as "Mark as done"
|
||||
And I toggle the manual completion state of "Music history"
|
||||
And the manual completion button of "Music history" is displayed as "Done"
|
@ -72,6 +72,12 @@ if (!isset($options['printheading']) || !empty($options['printheading'])) {
|
||||
echo $OUTPUT->heading(format_string($page->name), 2);
|
||||
}
|
||||
|
||||
// Display any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
if (!empty($options['printintro'])) {
|
||||
if (trim(strip_tags($page->intro))) {
|
||||
echo $OUTPUT->box_start('mod_introbox', 'pageintro');
|
||||
|
@ -936,12 +936,20 @@ class mod_quiz_renderer extends plugin_renderer_base {
|
||||
* @return string HTML to output.
|
||||
*/
|
||||
public function view_information($quiz, $cm, $context, $messages) {
|
||||
global $CFG;
|
||||
global $USER;
|
||||
|
||||
$output = '';
|
||||
|
||||
// Print quiz name and description.
|
||||
// Print quiz name.
|
||||
$output .= $this->heading(format_string($quiz->name));
|
||||
|
||||
// Print any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
$output .= $this->output->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
// Print quiz description.
|
||||
$output .= $this->quiz_intro($quiz, $cm);
|
||||
|
||||
// Output any access messages.
|
||||
|
@ -61,7 +61,7 @@ function resource_redirect_if_migrated($oldid, $cmid) {
|
||||
* @return does not return
|
||||
*/
|
||||
function resource_display_embed($resource, $cm, $course, $file) {
|
||||
global $CFG, $PAGE, $OUTPUT;
|
||||
global $PAGE, $OUTPUT, $USER;
|
||||
|
||||
$clicktoopen = resource_get_clicktoopen($file, $resource->revision);
|
||||
|
||||
@ -102,6 +102,12 @@ function resource_display_embed($resource, $cm, $course, $file) {
|
||||
resource_print_header($resource, $cm, $course);
|
||||
resource_print_heading($resource, $cm, $course);
|
||||
|
||||
// Display any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
echo $code;
|
||||
|
||||
resource_print_intro($resource, $cm, $course);
|
||||
@ -202,10 +208,16 @@ function resource_get_clicktodownload($file, $revision) {
|
||||
* @return does not return
|
||||
*/
|
||||
function resource_print_workaround($resource, $cm, $course, $file) {
|
||||
global $CFG, $OUTPUT;
|
||||
|
||||
global $CFG, $OUTPUT, $USER;
|
||||
resource_print_header($resource, $cm, $course);
|
||||
resource_print_heading($resource, $cm, $course, true);
|
||||
|
||||
// Display any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
resource_print_intro($resource, $cm, $course, true);
|
||||
|
||||
$resource->mainfile = $file->get_filename();
|
||||
|
@ -139,6 +139,12 @@ $PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($scorm->name));
|
||||
|
||||
// Display any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
if (!empty($action) && confirm_sesskey() && has_capability('mod/scorm:deleteownresponses', $contextmodule)) {
|
||||
if ($action == 'delete') {
|
||||
$confirmurl = new moodle_url($PAGE->url, array('action' => 'deleteconfirm'));
|
||||
|
@ -31,6 +31,8 @@ if (! $cm = get_coursemodule_from_id('survey', $id)) {
|
||||
print_error('invalidcoursemodule');
|
||||
}
|
||||
|
||||
$cm = cm_info::create($cm);
|
||||
|
||||
if (! $course = $DB->get_record("course", array("id" => $cm->course))) {
|
||||
print_error('coursemisconf');
|
||||
}
|
||||
@ -71,6 +73,11 @@ $PAGE->set_heading($course->fullname);
|
||||
echo $OUTPUT->header();
|
||||
echo $OUTPUT->heading(format_string($survey->name));
|
||||
|
||||
// Render the activity information.
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cm, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cm, $USER->id);
|
||||
echo $OUTPUT->activity_information($cm, $completiondetails, $activitydates);
|
||||
|
||||
// Check to see if groups are being used in this survey.
|
||||
if ($groupmode = groups_get_activity_groupmode($cm)) { // Groups are being used.
|
||||
$currentgroup = groups_get_activity_group($cm);
|
||||
|
@ -266,10 +266,17 @@ EOF;
|
||||
* @return does not return
|
||||
*/
|
||||
function url_print_workaround($url, $cm, $course) {
|
||||
global $OUTPUT;
|
||||
global $OUTPUT, $USER;
|
||||
|
||||
url_print_header($url, $cm, $course);
|
||||
url_print_heading($url, $cm, $course, true);
|
||||
|
||||
// Display any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
url_print_intro($url, $cm, $course, true);
|
||||
|
||||
$fullurl = url_get_full_url($url, $cm, $course);
|
||||
@ -306,7 +313,7 @@ function url_print_workaround($url, $cm, $course) {
|
||||
* @return does not return
|
||||
*/
|
||||
function url_display_embed($url, $cm, $course) {
|
||||
global $CFG, $PAGE, $OUTPUT;
|
||||
global $PAGE, $OUTPUT, $USER;
|
||||
|
||||
$mimetype = resourcelib_guess_url_mimetype($url->externalurl);
|
||||
$fullurl = url_get_full_url($url, $cm, $course);
|
||||
@ -339,6 +346,12 @@ function url_display_embed($url, $cm, $course) {
|
||||
url_print_header($url, $cm, $course);
|
||||
url_print_heading($url, $cm, $course);
|
||||
|
||||
// Display any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $OUTPUT->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
echo $code;
|
||||
|
||||
url_print_intro($url, $cm, $course);
|
||||
|
118
mod/url/tests/behat/url_activity_completion.feature
Normal file
118
mod/url/tests/behat/url_activity_completion.feature
Normal file
@ -0,0 +1,118 @@
|
||||
@mod @mod_url @core_completion
|
||||
Feature: View activity completion information in the URL resource
|
||||
In order to have visibility of URL completion requirements
|
||||
As a student
|
||||
I need to be able to view my URL completion progress
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Vinnie | Student1 | student1@example.com |
|
||||
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Enable completion tracking | Yes |
|
||||
| Show completion conditions | Yes |
|
||||
And I press "Save and display"
|
||||
|
||||
Scenario: View automatic completion items in automatic display mode
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "URL" to section "1" and I fill the form with:
|
||||
| Name | Music history |
|
||||
| External URL | https://moodle.org/ |
|
||||
| Display | Automatic |
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| Require view | 1 |
|
||||
# Teacher view.
|
||||
And I follow "Music history"
|
||||
And "Music history" should have the "View" completion condition
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the "View" completion condition of "Music history" is displayed as "done"
|
||||
|
||||
Scenario: View automatic completion items in embed display mode
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "URL" to section "1" and I fill the form with:
|
||||
| Name | Music history |
|
||||
| External URL | https://moodle.org/ |
|
||||
| Display | Embed |
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| Require view | 1 |
|
||||
# Teacher view.
|
||||
And I follow "Music history"
|
||||
And "Music history" should have the "View" completion condition
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the "View" completion condition of "Music history" is displayed as "done"
|
||||
|
||||
Scenario: View automatic completion items in open display mode
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "URL" to section "1" and I fill the form with:
|
||||
| Name | Music history |
|
||||
| External URL | https://moodle.org/ |
|
||||
| Display | Open |
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| Require view | 1 |
|
||||
# Teacher view.
|
||||
And I follow "Music history"
|
||||
And "Music history" should have the "View" completion condition
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the "View" completion condition of "Music history" is displayed as "done"
|
||||
|
||||
Scenario: View automatic completion items in pop-up display mode
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "URL" to section "1" and I fill the form with:
|
||||
| Name | Music history |
|
||||
| External URL | https://moodle.org/ |
|
||||
| Display | In pop-up |
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| Require view | 1 |
|
||||
# Teacher view.
|
||||
And I follow "Music history"
|
||||
And "Music history" should have the "View" completion condition
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the "View" completion condition of "Music history" is displayed as "done"
|
||||
|
||||
@javascript
|
||||
Scenario: Use manual completion
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "URL" to section "1" and I fill the form with:
|
||||
| Name | Music history |
|
||||
| External URL | https://moodle.org/ |
|
||||
| Display | Automatic |
|
||||
| Completion tracking | Students can manually mark the activity as completed |
|
||||
# Teacher view.
|
||||
And I follow "Music history"
|
||||
And the manual completion button for "Music history" should be disabled
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the manual completion button of "Music history" is displayed as "Mark as done"
|
||||
And I toggle the manual completion state of "Music history"
|
||||
And the manual completion button of "Music history" is displayed as "Done"
|
@ -235,8 +235,19 @@ class mod_wiki_renderer extends plugin_renderer_base {
|
||||
return $output;
|
||||
}
|
||||
public function wiki_info() {
|
||||
return $this->output->box(format_module_intro('wiki',
|
||||
global $USER;
|
||||
|
||||
// Display any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($this->page->cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
$info = $this->output->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
// Add the rest of the wiki info.
|
||||
$info .= $this->output->box(format_module_intro('wiki',
|
||||
$this->page->activityrecord, $this->page->cm->id), 'generalbox', 'intro');
|
||||
|
||||
return $info;
|
||||
}
|
||||
|
||||
public function tabs($page, $tabitems, $options) {
|
||||
|
64
mod/wiki/tests/behat/wiki_activity_completion.feature
Normal file
64
mod/wiki/tests/behat/wiki_activity_completion.feature
Normal file
@ -0,0 +1,64 @@
|
||||
@mod @mod_url @core_completion
|
||||
Feature: View activity completion information in the Wiki activity
|
||||
In order to have visibility of URL completion requirements
|
||||
As a student
|
||||
I need to be able to view my URL completion progress
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Vinnie | Student1 | student1@example.com |
|
||||
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Enable completion tracking | Yes |
|
||||
| Show completion conditions | Yes |
|
||||
And I press "Save and display"
|
||||
|
||||
Scenario: View automatic completion items
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Wiki" to section "1" and I fill the form with:
|
||||
| Wiki name | Music history |
|
||||
| First page name | Respect |
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| Require view | 1 |
|
||||
# Teacher view.
|
||||
And I follow "Music history"
|
||||
And I click on "Create page" "button"
|
||||
And "Music history" should have the "View" completion condition
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
And the "View" completion condition of "Music history" is displayed as "done"
|
||||
|
||||
@javascript
|
||||
Scenario: Use manual completion
|
||||
Given I am on "Course 1" course homepage with editing mode on
|
||||
And I add a "Wiki" to section "1" and I fill the form with:
|
||||
| Wiki name | Music history |
|
||||
| First page name | Respect |
|
||||
| Completion tracking | Students can manually mark the activity as completed |
|
||||
# Teacher view.
|
||||
And I follow "Music history"
|
||||
And I click on "Create page" "button"
|
||||
And the manual completion button for "Music history" should be disabled
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the manual completion button of "Music history" is displayed as "Mark as done"
|
||||
And I toggle the manual completion state of "Music history"
|
||||
And the manual completion button of "Music history" is displayed as "Done"
|
107
mod/workshop/tests/behat/workshop_activity_completion.feature
Normal file
107
mod/workshop/tests/behat/workshop_activity_completion.feature
Normal file
@ -0,0 +1,107 @@
|
||||
@mod @mod_workshop @core_completion
|
||||
Feature: View activity completion information in the Workshop activity
|
||||
In order to have visibility of lesson completion requirements
|
||||
As a student
|
||||
I need to be able to view my lesson completion progress
|
||||
|
||||
Background:
|
||||
Given the following "users" exist:
|
||||
| username | firstname | lastname | email |
|
||||
| student1 | Vinnie | Student1 | student1@example.com |
|
||||
| student2 | Rex | Student2 | student2@example.com |
|
||||
| teacher1 | Darrell | Teacher1 | teacher1@example.com |
|
||||
And the following "courses" exist:
|
||||
| fullname | shortname | category |
|
||||
| Course 1 | C1 | 0 |
|
||||
And the following "course enrolments" exist:
|
||||
| user | course | role |
|
||||
| student1 | C1 | student |
|
||||
| student2 | C1 | student |
|
||||
| teacher1 | C1 | editingteacher |
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the following fields to these values:
|
||||
| Enable completion tracking | Yes |
|
||||
| Show completion conditions | Yes |
|
||||
And I press "Save and display"
|
||||
And I turn editing mode on
|
||||
And I add a "Workshop" to section "1" and I fill the form with:
|
||||
| Workshop name | Music history |
|
||||
| Completion tracking | Show activity as complete when conditions are met |
|
||||
| Require view | 1 |
|
||||
| Require grade | Submission |
|
||||
And I edit assessment form in workshop "Music history" as:"
|
||||
| id_description__idx_0_editor | Aspect1 |
|
||||
And I change phase in workshop "Music history" to "Submission phase"
|
||||
And I log out
|
||||
|
||||
Scenario: View automatic completion items as a teacher
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
When I follow "Music history"
|
||||
Then "Music history" should have the "Receive a grade" completion condition
|
||||
And "Music history" should have the "View" completion condition
|
||||
|
||||
Scenario: View automatic completion items as a student
|
||||
Given I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
And the "View" completion condition of "Music history" is displayed as "done"
|
||||
And the "Receive a grade" completion condition of "Music history" is displayed as "todo"
|
||||
# Add a submission.
|
||||
And I press "Add submission"
|
||||
And I set the field "Title" to "Pinch harmonics"
|
||||
And I set the field "Submission content" to "Satisfying to play"
|
||||
And I press "Save changes"
|
||||
And I log out
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I change phase in workshop "Music history" to "Assessment phase"
|
||||
And I allocate submissions in workshop "Music history" as:"
|
||||
| Participant | Reviewer |
|
||||
| Vinnie Student1 | Rex Student2 |
|
||||
And I log out
|
||||
# Assess the submission.
|
||||
And I log in as "student2"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
And I assess submission "Pinch harmonics" in workshop "Music history" as:"
|
||||
| grade__idx_0 | 9 / 10 |
|
||||
| peercomment__idx_0 | Well done |
|
||||
And I log out
|
||||
# Evaluate and close the workshop so a grade is recorded for the student.
|
||||
And I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I change phase in workshop "Music history" to "Grading evaluation phase"
|
||||
And I follow "Music history"
|
||||
And I click on "Re-calculate grades" "button"
|
||||
And I change phase in workshop "Music history" to "Closed"
|
||||
And I log out
|
||||
# Confirm completion condition is updated.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the "View" completion condition of "Music history" is displayed as "done"
|
||||
And the "Receive a grade" completion condition of "Music history" is displayed as "done"
|
||||
|
||||
@javascript
|
||||
Scenario: Use manual completion
|
||||
Given I log in as "teacher1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
And I navigate to "Edit settings" in current page administration
|
||||
And I expand all fieldsets
|
||||
And I set the field "Completion tracking" to "Students can manually mark the activity as completed"
|
||||
And I press "Save and display"
|
||||
# Teacher view
|
||||
And the manual completion button for "Music history" should be disabled
|
||||
And I log out
|
||||
# Student view.
|
||||
When I log in as "student1"
|
||||
And I am on "Course 1" course homepage
|
||||
And I follow "Music history"
|
||||
Then the manual completion button of "Music history" is displayed as "Mark as done"
|
||||
And I toggle the manual completion state of "Music history"
|
||||
And the manual completion button of "Music history" is displayed as "Done"
|
@ -103,6 +103,13 @@ $output = $PAGE->get_renderer('mod_workshop');
|
||||
|
||||
echo $output->header();
|
||||
echo $output->heading_with_help(format_string($workshop->name), 'userplan', 'workshop');
|
||||
|
||||
// Display any activity information (eg completion requirements / dates).
|
||||
$cminfo = cm_info::create($cm);
|
||||
$completiondetails = \core_completion\cm_completion_details::get_instance($cminfo, $USER->id);
|
||||
$activitydates = \core\activity_dates::get_dates_for_module($cminfo, $USER->id);
|
||||
echo $output->activity_information($cminfo, $completiondetails, $activitydates);
|
||||
|
||||
echo $output->heading(format_string($currentphasetitle), 3, null, 'mod_workshop-userplanheading');
|
||||
echo $output->render($userplan);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user