Merge branch 'MDL-51988-29' of git://github.com/danpoltawski/moodle into MOODLE_29_STABLE

This commit is contained in:
David Monllao
2015-11-17 10:23:42 +08:00
3 changed files with 107 additions and 25 deletions
+1 -1
View File
@@ -131,7 +131,7 @@ XPATH
[./descendant::*[self::h2][normalize-space(.) = %locator%] or %locator% = 'frontpage']
XPATH
, 'table' => <<<XPATH
.//table[(./@id = %locator% or contains(.//caption, %locator%) or contains(concat(' ', normalize-space(@class), ' '), %locator% ))]
.//table[(./@id = %locator% or contains(.//caption, %locator%) or contains(.//th, %locator%) or contains(concat(' ', normalize-space(@class), ' '), %locator% ))]
XPATH
, 'table_row' => <<<XPATH
.//tr[contains(normalize-space(.), %locator%) and not(.//tr[contains(normalize-space(.), %locator%)])]
+37 -24
View File
@@ -173,8 +173,15 @@ if (!empty($instanceid) && !empty($roleid)) {
$table = new flexible_table('course-participation-'.$course->id.'-'.$cm->id.'-'.$roleid);
$table->course = $course;
$table->define_columns(array('fullname','count','select'));
$table->define_headers(array(get_string('user'),((!empty($action)) ? get_string($action) : get_string('allactions')),get_string('select')));
$actionheader = !empty($action) ? get_string($action) : get_string('allactions');
if (empty($CFG->messaging)) {
$table->define_columns(array('fullname', 'count'));
$table->define_headers(array(get_string('user'), $actionheader));
} else {
$table->define_columns(array('fullname', 'count', 'select'));
$table->define_headers(array(get_string('user'), $actionheader, get_string('select')));
}
$table->define_baseurl($baseurl);
$table->set_attribute('cellpadding','5');
@@ -336,10 +343,14 @@ if (!empty($instanceid) && !empty($roleid)) {
echo '<input type="hidden" name="sesskey" value="'.sesskey().'" />'."\n";
foreach ($users as $u) {
$data = array('<a href="'.$CFG->wwwroot.'/user/view.php?id='.$u->userid.'&amp;course='.$course->id.'">'.fullname($u,true).'</a>'."\n",
((!empty($u->count)) ? get_string('yes').' ('.$u->count.') ' : get_string('no')),
'<input type="checkbox" class="usercheckbox" name="user'.$u->userid.'" value="'.$u->count.'" />'."\n",
);
$data = array();
$data[] = html_writer::link(new moodle_url('/user/view.php', array('id' => $u->userid, 'course' => $course->id)),
fullname($u, true));
$data[] = !empty($u->count) ? get_string('yes').' ('.$u->count.') ' : get_string('no');
if (!empty($CFG->messaging)) {
$data[] = '<input type="checkbox" class="usercheckbox" name="user'.$u->userid.'" value="'.$u->count.'" />';
}
$table->add_data($data);
}
@@ -357,25 +368,27 @@ if (!empty($instanceid) && !empty($roleid)) {
echo html_writer::end_div();
}
echo '<div class="selectbuttons">';
echo '<input type="button" id="checkall" value="'.get_string('selectall').'" /> '."\n";
echo '<input type="button" id="checknone" value="'.get_string('deselectall').'" /> '."\n";
if ($perpage >= $matchcount) {
echo '<input type="button" id="checknos" value="'.get_string('selectnos').'" />'."\n";
}
echo '</div>';
echo '<div>';
echo html_writer::label(get_string('withselectedusers'), 'formactionselect');
$displaylist['messageselect.php'] = get_string('messageselectadd');
echo html_writer::select($displaylist, 'formaction', '', array(''=>'choosedots'), array('id'=>'formactionselect'));
echo $OUTPUT->help_icon('withselectedusers');
echo '<input type="submit" value="' . get_string('ok') . '" />'."\n";
echo '</div>';
echo '</div>'."\n";
echo '</form>'."\n";
echo '</div>'."\n";
if (!empty($CFG->messaging)) {
echo '<div class="selectbuttons">';
echo '<input type="button" id="checkall" value="'.get_string('selectall').'" /> '."\n";
echo '<input type="button" id="checknone" value="'.get_string('deselectall').'" /> '."\n";
if ($perpage >= $matchcount) {
echo '<input type="button" id="checknos" value="'.get_string('selectnos').'" />'."\n";
}
echo '</div>';
echo '<div>';
echo html_writer::label(get_string('withselectedusers'), 'formactionselect');
$displaylist['messageselect.php'] = get_string('messageselectadd');
echo html_writer::select($displaylist, 'formaction', '', array('' => 'choosedots'), array('id' => 'formactionselect'));
echo $OUTPUT->help_icon('withselectedusers');
echo '<input type="submit" value="' . get_string('ok') . '" />'."\n";
echo '</div>';
echo '</div>'."\n";
echo '</form>'."\n";
echo '</div>'."\n";
$PAGE->requires->js_init_call('M.report_participation.init');
$PAGE->requires->js_init_call('M.report_participation.init');
}
}
echo $OUTPUT->footer();
@@ -0,0 +1,69 @@
@report @report_participation @javascript
Feature: Use the particiaption report to message groups of students
In order to engage with students based on participation
As a teacher
I need to be able to message students who have not participated in an activity
Background:
Given the following "courses" exist:
| fullname | shortname | category | groupmode |
| Course 1 | C1 | 0 | 1 |
And the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
| student1 | Student | 1 | student1@example.com |
| student2 | Student | 2 | student2@example.com |
| student3 | Student | 3 | student3@example.com |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
| student1 | C1 | student |
| student2 | C1 | student |
| student3 | C1 | student |
And I log in as "teacher1"
And I follow "Course 1"
And I turn editing mode on
And I add a "Book" to section "1" and I fill the form with:
| Name | Test book name |
| Description | Test book |
And I follow "Test book name"
And I set the following fields to these values:
| Chapter title | Test chapter |
| Content | Test chapter content |
And I log out
And I log in as "student1"
And I follow "Course 1"
And I follow "Test book name"
And I log out
Scenario: Message students who have not participated in book
Given I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Course participation" node in "Course administration > Reports"
And I set the field "instanceid" to "Test book name"
And I set the field "roleid" to "Student"
And I press "Go"
And I should see "Yes (1)" in the "Student 1" "table_row"
And I should see "No" in the "Student 2" "table_row"
And I should see "No" in the "Student 3" "table_row"
When I press "Select all 'No'"
And I set the field "With selected users..." to "Send a message"
And I press "OK"
Then I should see "Added 2 new recipients"
And I should see "Student 2" in the "Currently selected users" "table"
And I should see "Student 3" in the "Currently selected users" "table"
And I should not see "Student 1" in the "Currently selected users" "table"
Scenario: Ensure no message options when messaging is disabled
Given I log in as "admin"
And I set the following administration settings values:
| messaging | 0 |
And I log out
And I log in as "teacher1"
And I follow "Course 1"
And I navigate to "Course participation" node in "Course administration > Reports"
When I set the field "instanceid" to "Test book name"
And I set the field "roleid" to "Student"
And I press "Go"
Then I should not see "With selected users..."
And I should not see "Select all"