diff --git a/mod/glossary/lang/en/glossary.php b/mod/glossary/lang/en/glossary.php
index bb08727a2f5ef..8a25a1ea6515b 100644
--- a/mod/glossary/lang/en/glossary.php
+++ b/mod/glossary/lang/en/glossary.php
@@ -260,6 +260,7 @@
$string['nopermissiontoviewresult'] = 'You can only look at results for your own entries';
$string['notcategorised'] = 'Not categorised';
$string['notapproved'] = 'glossary entry is not approved yet.';
+$string['entrynotapproved'] = 'Entry not approved';
$string['numberofentries'] = 'Number of entries';
$string['onebyline'] = '(one per line)';
$string['page-mod-glossary-x'] = 'Any glossary module page';
diff --git a/mod/glossary/locallib.php b/mod/glossary/locallib.php
index 4496f3ce993e0..1146adb4e8426 100644
--- a/mod/glossary/locallib.php
+++ b/mod/glossary/locallib.php
@@ -743,7 +743,12 @@ function mod_glossary_get_tagged_entries($tag, $exclusivemode = false, $fromctx
$coursename = format_string($item->fullname, true, array('context' => context_course::instance($item->courseid)));
$coursename = html_writer::link($courseurl, $coursename);
$icon = html_writer::link($pageurl, html_writer::empty_tag('img', array('src' => $cm->get_icon_url())));
- $tagfeed->add($icon, $pagename, $cmname.'
'.$coursename);
+
+ $approved = "";
+ if (!$item->approved) {
+ $approved = '
'. html_writer::span(get_string('entrynotapproved', 'mod_glossary'), 'badge badge-warning');
+ }
+ $tagfeed->add($icon, $pagename, $cmname.'
'.$coursename.$approved);
}
$content = $OUTPUT->render_from_template('core_tag/tagfeed',
diff --git a/mod/glossary/tests/behat/entries_require_approval.feature b/mod/glossary/tests/behat/entries_require_approval.feature
index 8ece7c3f46a5f..589bdf0533105 100644
--- a/mod/glossary/tests/behat/entries_require_approval.feature
+++ b/mod/glossary/tests/behat/entries_require_approval.feature
@@ -4,7 +4,7 @@ Feature: A teacher can choose whether glossary entries require approval
As a user
I need to enable entries requiring approval
- Scenario: Approve and undo approve glossary entries
+ Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
@@ -25,7 +25,9 @@ Feature: A teacher can choose whether glossary entries require approval
| Description | Test glossary entries require approval |
| Approved by default | No |
And I log out
- And I log in as "student1"
+
+ Scenario: Approve and undo approve glossary entries
+ Given I log in as "student1"
And I am on "Course 1" course homepage
And I follow "Test glossary name"
When I add a glossary entry with the following data:
@@ -66,3 +68,25 @@ Feature: A teacher can choose whether glossary entries require approval
And I am on "Course 1" course homepage
And I follow "Test glossary name"
Then I should see "No entries found in this section"
+
+ @javascript
+ Scenario: View pending approval glossary items
+ Given I log in as "student1"
+ And I am on "Course 1" course homepage
+ And I follow "Test glossary name"
+ When I add a glossary entry with the following data:
+ | Concept | Just a test concept |
+ | Definition | Concept definition |
+ | Keyword(s) | Black |
+ | Tags | Test |
+ And I log out
+ And I log in as "teacher1"
+ And I press "Customise this page"
+ And I add the "Navigation" block if not present
+ And I expand "Site pages" node
+ And I click on "Tags" "link" in the "Navigation" "block"
+ And I follow "Test"
+ Then I should see "Glossary entries"
+ And I should see "Just a test concept"
+ And I should see "Entry not approved"
+ And I log out