mirror of
https://github.com/moodle/moodle.git
synced 2025-04-24 09:55:33 +02:00
blocklib: MDL-19010 eliminate remaining calls to blocks_repopulate_page
This commit is contained in:
parent
cf37931b7f
commit
6cbcbf0fb3
admin
backup
course
enrol
lib
@ -1109,8 +1109,7 @@ if ( file_exists(dirname(dirname(__FILE__)) . '/config.php')) {
|
||||
|
||||
if ($newid = $DB->insert_record('course', $newsite)) {
|
||||
// Site created, add blocks for it
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $newid);
|
||||
blocks_repopulate_page($page); // Return value not checked because you can always edit later
|
||||
blocks_add_default_course_blocks($DB->get_record('course', array('id' => $newid)));
|
||||
|
||||
// create default course category
|
||||
$cat = get_course_category();
|
||||
|
@ -842,8 +842,7 @@ define('RESTORE_GROUPS_GROUPINGS', 3);
|
||||
if (empty($backup_block_format)) { // This is a backup from Moodle < 1.5
|
||||
if (empty($blockinfo)) {
|
||||
// Looks like it's from Moodle < 1.3. Let's give the course default blocks...
|
||||
$newpage = page_create_object(PAGE_COURSE_VIEW, $restore->course_id);
|
||||
blocks_repopulate_page($newpage);
|
||||
blocks_add_default_course_blocks($DB->get_record('course', array('id' => $restore->course_id)));
|
||||
} else {
|
||||
// We just have a blockinfo field, this is a legacy 1.4 or 1.3 backup
|
||||
$blockrecords = $DB->get_records('block', null, '', 'name, id');
|
||||
|
@ -67,13 +67,13 @@
|
||||
}
|
||||
|
||||
/// Insert the record.
|
||||
if ($courseid = $DB->insert_record("course",$course)) {
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $courseid);
|
||||
blocks_repopulate_page($page); // Return value not checked because you can always edit later
|
||||
if ($courseid = $DB->insert_record('course', $course)) {
|
||||
$course = $DB->get_record('course', array('id' => $courseid));
|
||||
blocks_add_default_course_blocks($course);
|
||||
$context = get_context_instance(CONTEXT_COURSE, $courseid);
|
||||
role_assign($CFG->creatornewroleid, $teacherid, 0, $context->id); // assing teacher role
|
||||
$course->id = $courseid;
|
||||
if (!empty($CFG->restrictmodulesfor) && $CFG->restrictmodulesfor != 'none' && !empty($CFG->restrictbydefault)) { // if we're all or requested we're ok.
|
||||
if (!empty($CFG->restrictmodulesfor) && $CFG->restrictmodulesfor != 'none' && !empty($CFG->restrictbydefault)) {
|
||||
// if we're all or requested we're ok.
|
||||
$allowedmods = explode(',',$CFG->defaultallowedmodules);
|
||||
update_restricted_mods($course,$allowedmods);
|
||||
}
|
||||
|
@ -607,8 +607,8 @@ function create_course ($course,$skip_fix_course_sortorder=0){
|
||||
$section->course = $newcourseid; // Create a default section.
|
||||
$section->section = 0;
|
||||
$section->id = $DB->insert_record("course_sections", $section);
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $newcourseid);
|
||||
blocks_repopulate_page($page); // Return value no
|
||||
$course = $DB->get_record('course', array('id' => $newcourseid));
|
||||
blocks_add_default_course_blocks($course);
|
||||
|
||||
if (!$skip_fix_course_sortorder){
|
||||
fix_course_sortorder();
|
||||
|
@ -536,11 +536,11 @@ function process_group_tag($tagcontents){
|
||||
// Choose a sort order that puts us at the start of the list!
|
||||
$course->sortorder = 0;
|
||||
|
||||
if($course->id = $DB->insert_record('course', $course)){
|
||||
if ($courseid = $DB->insert_record('course', $course)) {
|
||||
|
||||
// Setup the blocks
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $course->id);
|
||||
blocks_repopulate_page($page); // Return value not checked because you can always edit later
|
||||
$course = $DB->get_record('course', array('id' => $courseid));
|
||||
blocks_add_default_course_blocks($course);
|
||||
|
||||
$section = new object();
|
||||
$section->course = $course->id; // Create a default section.
|
||||
|
@ -593,8 +593,8 @@ function create_course ($course_ext,$skip_fix_course_sortorder=0){
|
||||
$section->course = $newcourseid; // Create a default section.
|
||||
$section->section = 0;
|
||||
$section->id = $DB->insert_record("course_sections", $section);
|
||||
$page = page_create_object(PAGE_COURSE_VIEW, $newcourseid);
|
||||
blocks_repopulate_page($page); // Return value no
|
||||
$course = $DB->get_record('course', array('id' => $newcourseid));
|
||||
blocks_add_default_course_blocks($course);
|
||||
|
||||
if (!$skip_fix_course_sortorder){
|
||||
fix_course_sortorder();
|
||||
|
@ -735,7 +735,7 @@ function blocks_delete_instance($instance, $nolongerused = false, $skipblockstab
|
||||
function blocks_delete_all_on_page($pagetype, $pageid) {
|
||||
global $DB;
|
||||
|
||||
debugging('Call to deprecated function blocks_repopulate_page. ' .
|
||||
debugging('Call to deprecated function blocks_delete_all_on_page. ' .
|
||||
'This function cannot work any more. Doing nothing. ' .
|
||||
'Please update your code to use another method.', DEBUG_DEVELOPER);
|
||||
return false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user