mirror of
https://github.com/moodle/moodle.git
synced 2025-08-04 16:36:37 +02:00
MDL-70801 core_my: Add a new courses page
This commit is contained in:
parent
c69c33b14d
commit
6ca9c2154a
33 changed files with 417 additions and 51 deletions
|
@ -249,7 +249,7 @@ class block_base {
|
|||
$this->arialabel = $bc->arialabel;
|
||||
}
|
||||
|
||||
if ($this->page->user_is_editing()) {
|
||||
if ($this->page->user_is_editing() && $this->instance_can_be_edited()) {
|
||||
$bc->controls = $this->page->blocks->edit_controls($this);
|
||||
} else {
|
||||
// we must not use is_empty on hidden blocks
|
||||
|
@ -692,6 +692,15 @@ class block_base {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* If overridden and set to false by the block it will not be editable.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function instance_can_be_edited() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** @callback callback functions for comments api */
|
||||
public static function comment_template($options) {
|
||||
$ret = <<<EOD
|
||||
|
|
|
@ -70,4 +70,4 @@ Feature: Add and configure blocks throughout the site
|
|||
| Text block title | Foo " onload="document.getElementsByTagName('body')[0].remove()" alt=" |
|
||||
| Content | Example |
|
||||
When I press "Save changes"
|
||||
Then I should see "Course overview"
|
||||
Then I should see "Example"
|
||||
|
|
|
@ -327,9 +327,14 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
|
|||
// Force a setting change to check the returned blocks settings.
|
||||
set_config('displaycategories', 0, 'block_myoverview');
|
||||
|
||||
$systempage = $DB->get_record('my_pages', array('userid' => null, 'name' => MY_PAGE_DEFAULT, 'private' => true));
|
||||
// Get the expected default blocks.
|
||||
$alldefaultblocksordered = $DB->get_records_menu('block_instances',
|
||||
array('pagetypepattern' => 'my-index'), 'defaultregion, defaultweight ASC', 'id, blockname');
|
||||
$alldefaultblocksordered = $DB->get_records_menu(
|
||||
'block_instances',
|
||||
array('pagetypepattern' => 'my-index', 'subpagepattern' => $systempage->id),
|
||||
'defaultregion, defaultweight ASC',
|
||||
'id, blockname'
|
||||
);
|
||||
|
||||
$this->setUser($user);
|
||||
|
||||
|
@ -368,8 +373,13 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
|
|||
$user = $this->getDataGenerator()->create_user();
|
||||
$PAGE->set_url('/my/index.php'); // Need this because some internal API calls require the $PAGE url to be set.
|
||||
|
||||
$systempage = $DB->get_record('my_pages', array('userid' => null, 'name' => MY_PAGE_DEFAULT, 'private' => true));
|
||||
// Get the expected default blocks.
|
||||
$alldefaultblocks = $DB->get_records_menu('block_instances', array('pagetypepattern' => 'my-index'), '', 'id, blockname');
|
||||
$alldefaultblocks = $DB->get_records_menu(
|
||||
'block_instances', array('pagetypepattern' => 'my-index', 'subpagepattern' => $systempage->id),
|
||||
'',
|
||||
'id, blockname'
|
||||
);
|
||||
|
||||
// Now, add a sticky block.
|
||||
$page = new moodle_page();
|
||||
|
@ -411,8 +421,14 @@ class core_block_externallib_testcase extends externallib_advanced_testcase {
|
|||
$user = $this->getDataGenerator()->create_user();
|
||||
$PAGE->set_url('/my/index.php'); // Need this because some internal API calls require the $PAGE url to be set.
|
||||
|
||||
$systempage = $DB->get_record('my_pages', array('userid' => null, 'name' => MY_PAGE_DEFAULT, 'private' => true));
|
||||
// Get the expected default blocks.
|
||||
$alldefaultblocks = $DB->get_records_menu('block_instances', array('pagetypepattern' => 'my-index'), '', 'id, blockname');
|
||||
$alldefaultblocks = $DB->get_records_menu(
|
||||
'block_instances',
|
||||
array('pagetypepattern' => 'my-index', 'subpagepattern' => $systempage->id),
|
||||
'',
|
||||
'id, blockname'
|
||||
);
|
||||
|
||||
// Add a custom block.
|
||||
$page = new moodle_page();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue