Commit 03e9b076 authored by Mihail Geshoski's avatar Mihail Geshoski
Browse files

MDL-62835 resource: Display description for book, lesson and imscp

parent 29c39518
@mod @mod_book
Feature: Display the book description in the book and optionally in the course
In order to display the the book description in the course
As a teacher
I need to enable the 'Display description on course page' setting.
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Book" to section "1" and I fill the form with:
| Name | Test book |
| Description | A book about dreams! |
And I follow "Test book"
And I should see "Add new chapter"
And I set the following fields to these values:
| Chapter title | Dummy first chapter |
| Content | Dream is the start of a journey |
And I press "Save changes"
Scenario: Description is displayed in the book
Given I am on "Course 1" course homepage
When I follow "Test book"
Then I should see "A book about dreams!"
Scenario: Show book description in the course homepage
Given I am on "Course 1" course homepage
And I follow "Test book"
And I navigate to "Edit settings" in current page administration
And the following fields match these values:
| Display description on course page | |
And I set the following fields to these values:
| Display description on course page | 1 |
And I press "Save and return to course"
When I am on "Course 1" course homepage
Then I should see "A book about dreams!"
Scenario: Hide book description in the course homepage
Given I am on "Course 1" course homepage
And I follow "Test book"
And I navigate to "Edit settings" in current page administration
And the following fields match these values:
| Display description on course page | |
And I press "Save and return to course"
When I am on "Course 1" course homepage
Then I should not see "A book about dreams!"
......@@ -213,6 +213,11 @@ book_view($book, $chapter, $islastchapter, $course, $cm, $context);
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($book->name));
// Info box.
if ($book->intro) {
echo $OUTPUT->box(format_module_intro('book', $book, $cm->id), 'generalbox', 'intro');
}
$navclasses = book_get_nav_classes();
if ($book->navstyle) {
......
@mod @mod_imscp
Feature: Display the IMS content package description in the IMSCP and optionally in the course
In order to display the the IMS content package description description in the course
As a teacher
I need to enable the 'Display description on course page' setting.
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
@javascript
Scenario: Description is displayed in the IMS content package
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "IMS content package" to section "1"
And I set the following fields to these values:
| Name | Test IMS content package |
| Description | Test IMS content package description |
And I upload "mod/imscp/tests/packages/singlescobasic.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I am on "Course 1" course homepage
And I should see "Test IMS content package"
When I follow "Test IMS content package"
Then I should see "Test IMS content package description"
@javascript
Scenario: Show IMS description in the course homepage
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "IMS content package" to section "1"
And I set the following fields to these values:
| Name | Test IMS content package |
| Description | Test IMS content package description |
And I upload "mod/imscp/tests/packages/singlescobasic.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I am on "Course 1" course homepage
And I follow "Test IMS content package"
And I navigate to "Edit settings" in current page administration
And the following fields match these values:
| Display description on course page | |
And I set the following fields to these values:
| Display description on course page | 1 |
And I press "Save and return to course"
When I am on "Course 1" course homepage
Then I should see "Test IMS content package description"
@javascript
Scenario: Hide IMS description in the course homepage
Given I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "IMS content package" to section "1"
And I set the following fields to these values:
| Name | Test IMS content package |
| Description | Test IMS content package description |
And I upload "mod/imscp/tests/packages/singlescobasic.zip" file to "Package file" filemanager
And I click on "Save and display" "button"
And I am on "Course 1" course homepage
And I follow "Test IMS content package"
And I navigate to "Edit settings" in current page administration
And the following fields match these values:
| Display description on course page | |
And I press "Save and return to course"
When I am on "Course 1" course homepage
Then I should not see "Test IMS content package description"
......@@ -70,6 +70,10 @@ if (!$imscp->structure) {
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($imscp->name));
// Info box.
if ($imscp->intro) {
echo $OUTPUT->box(format_module_intro('imscp', $imscp, $cm->id), 'generalbox', 'intro');
}
imscp_print_content($imscp, $cm, $course);
......
......@@ -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, $OUTPUT;
$activityname = format_string($lesson->name, true, $lesson->course);
if (empty($extrapagetitle)) {
......@@ -49,7 +49,7 @@ class mod_lesson_renderer extends plugin_renderer_base {
// Build the buttons
$context = context_module::instance($cm->id);
/// Header setup
// Header setup.
$this->page->set_title($title);
$this->page->set_heading($this->page->course->fullname);
lesson_add_header_buttons($cm, $context, $extraeditbuttons, $lessonpageid);
......@@ -57,7 +57,10 @@ class mod_lesson_renderer extends plugin_renderer_base {
if (has_capability('mod/lesson:manage', $context)) {
$output .= $this->output->heading_with_help($activityname, 'overview', 'lesson');
// Info box.
if ($lesson->intro) {
$output .= $OUTPUT->box(format_module_intro('lesson', $lesson, $cm->id), 'generalbox', 'intro');
}
if (!empty($currenttab)) {
ob_start();
include($CFG->dirroot.'/mod/lesson/tabs.php');
......@@ -66,6 +69,10 @@ class mod_lesson_renderer extends plugin_renderer_base {
}
} else {
$output .= $this->output->heading($activityname);
// Info box.
if ($lesson->intro) {
$output .= $OUTPUT->box(format_module_intro('lesson', $lesson, $cm->id), 'generalbox', 'intro');
}
}
foreach ($lesson->messages as $message) {
......
@mod @mod_lesson
Feature: Display the lesson description in the lesson and optionally in the course
In order to display the the lesson description description in the course
As a teacher
I need to enable the 'Display description on course page' setting.
Background:
Given the following "users" exist:
| username | firstname | lastname | email |
| teacher1 | Teacher | 1 | teacher1@example.com |
And the following "courses" exist:
| fullname | shortname | format |
| Course 1 | C1 | topics |
And the following "course enrolments" exist:
| user | course | role |
| teacher1 | C1 | editingteacher |
And I log in as "teacher1"
And I am on "Course 1" course homepage with editing mode on
And I add a "Lesson" to section "1"
And I set the following fields to these values:
| Name | Test lesson |
| Description | Test lesson description |
And I click on "Save and display" "button"
Scenario: Description is displayed in the Lesson
Given I am on "Course 1" course homepage
When I follow "Test lesson"
Then I should see "Test lesson description"
Scenario: Show lesson description in the course homepage
Given I am on "Course 1" course homepage
And I follow "Test lesson"
And I navigate to "Edit settings" in current page administration
And the following fields match these values:
| Display description on course page | |
And I set the following fields to these values:
| Display description on course page | 1 |
And I press "Save and return to course"
When I am on "Course 1" course homepage
Then I should see "Test lesson description"
Scenario: Hide lesson description in the course homepage
Given I am on "Course 1" course homepage
And I follow "Test lesson"
And I navigate to "Edit settings" in current page administration
And the following fields match these values:
| Display description on course page | |
And I press "Save and return to course"
When I am on "Course 1" course homepage
Then I should not see "Test lesson description"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment