MDL-51864 blocks: Fixed title display for block_course_summary
This commit is contained in:
@@ -23,6 +23,12 @@
|
||||
*/
|
||||
|
||||
class block_course_summary extends block_base {
|
||||
|
||||
/**
|
||||
* @var bool Flag to indicate whether the header should be hidden or not.
|
||||
*/
|
||||
private $headerhidden = true;
|
||||
|
||||
function init() {
|
||||
$this->title = get_string('pluginname', 'block_course_summary');
|
||||
}
|
||||
@@ -32,8 +38,10 @@ class block_course_summary extends block_base {
|
||||
}
|
||||
|
||||
function specialization() {
|
||||
if($this->page->pagetype == PAGE_COURSE_VIEW && $this->page->course->id != SITEID) {
|
||||
// Page type starts with 'course-view' and the page's course ID is not equal to the site ID.
|
||||
if (strpos($this->page->pagetype, PAGE_COURSE_VIEW) === 0 && $this->page->course->id != SITEID) {
|
||||
$this->title = get_string('coursesummary', 'block_course_summary');
|
||||
$this->headerhidden = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +79,7 @@ class block_course_summary extends block_base {
|
||||
}
|
||||
|
||||
function hide_header() {
|
||||
return true;
|
||||
return $this->headerhidden;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,19 +25,22 @@ Feature: Course summary block used in a course
|
||||
Scenario: Student can view course summary
|
||||
When I log in as "student1"
|
||||
And I follow "Course 1"
|
||||
Then "Course/site summary" "block" should exist
|
||||
And I should see "Proved the course summary block works!" in the "Course/site summary" "block"
|
||||
Then "Course summary" "block" should exist
|
||||
And I should see "Course summary" in the "Course summary" "block"
|
||||
And I should see "Proved the course summary block works!" in the "Course summary" "block"
|
||||
|
||||
Scenario: Teacher can see an edit icon when edit mode is on and follow it to the course edit page
|
||||
When I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
And I turn editing mode on
|
||||
Then I should see "Proved the course summary block works!" in the "Course/site summary" "block"
|
||||
And I click on "Edit" "link" in the "Course/site summary" "block"
|
||||
Then I should see "Proved the course summary block works!" in the "Course summary" "block"
|
||||
And I should see "Course summary" in the "Course summary" "block"
|
||||
And I click on "Edit" "link" in the "Course summary" "block"
|
||||
Then I should see "Edit course settings" in the "h2" "css_element"
|
||||
|
||||
Scenario: Teacher can not see edit icon when edit mode is off
|
||||
When I log in as "teacher1"
|
||||
And I follow "Course 1"
|
||||
Then I should see "Proved the course summary block works!" in the "Course/site summary" "block"
|
||||
And "Edit" "link" should not exist in the "Course/site summary" "block"
|
||||
Then I should see "Proved the course summary block works!" in the "Course summary" "block"
|
||||
And I should see "Course summary" in the "Course summary" "block"
|
||||
And "Edit" "link" should not exist in the "Course summary" "block"
|
||||
|
||||
@@ -17,6 +17,7 @@ Feature: Course summary block used on the frontpage
|
||||
Scenario: Guest can view site summary
|
||||
When I am on site homepage
|
||||
Then "Course/site summary" "block" should exist
|
||||
And I should not see "Course summary" in the "Course/site summary" "block"
|
||||
And I should see "Proved the summary block works!" in the "Course/site summary" "block"
|
||||
|
||||
Scenario: Admin can see an edit icon when edit mode is on and follow it to the front page settings
|
||||
@@ -24,6 +25,7 @@ Feature: Course summary block used on the frontpage
|
||||
And I am on site homepage
|
||||
And I follow "Turn editing on"
|
||||
Then I should see "Proved the summary block works!" in the "Course/site summary" "block"
|
||||
And I should not see "Course summary" in the "Course/site summary" "block"
|
||||
And I click on "Edit" "link" in the "Course/site summary" "block"
|
||||
Then I should see "Front page settings" in the "h2" "css_element"
|
||||
|
||||
@@ -31,4 +33,5 @@ Feature: Course summary block used on the frontpage
|
||||
When I log in as "admin"
|
||||
And I am on site homepage
|
||||
Then I should see "Proved the summary block works!" in the "Course/site summary" "block"
|
||||
And I should not see "Course summary" in the "Course/site summary" "block"
|
||||
And "Edit" "link" should not exist in the "Course/site summary" "block"
|
||||
|
||||
Reference in New Issue
Block a user