if ($newid = insert_record('course', $form)) {
// Site created, add blocks for it
- $page = page_create_object(MOODLE_PAGE_COURSE, $newid);
+ $page = page_create_object(PAGE_COURSE_VIEW, $newid);
blocks_repopulate_page($page); // Return value not checked because you can always edit later
$cat->name = get_string('miscellaneous');
// Read all of the block table
$blocks = blocks_get_record();
- $page = page_create_object(MOODLE_PAGE_COURSE, $preferences->backup_course);
+ $page = page_create_object(PAGE_COURSE_VIEW, $preferences->backup_course);
if ($instances = blocks_get_by_page($page)) {
//Blocks open tag
$status = true;
- delete_records('block_instance', 'pageid', $restore->course_id, 'pagetype', MOODLE_PAGE_COURSE);
+ delete_records('block_instance', 'pageid', $restore->course_id, 'pagetype', PAGE_COURSE_VIEW);
if (empty($backup_block_format)) { // This is a backup from Moodle < 1.5
if (empty($blockinfo)) {
echo ' (pre 1.3)'; //debug
// Looks like it's from Moodle < 1.3. Let's give the course default blocks...
- $newpage = page_create_object(MOODLE_PAGE_COURSE, $restore->course_id);
+ $newpage = page_create_object(PAGE_COURSE_VIEW, $restore->course_id);
blocks_repopulate_page($newpage);
} else {
echo ' (1.3-1.4)'; //debug
}
$blockinstance->blockid = $blockrecords[$blockname]->id;
$blockinstance->pageid = $restore->course_id;
- $blockinstance->pagetype = MOODLE_PAGE_COURSE;
+ $blockinstance->pagetype = PAGE_COURSE_VIEW;
$blockinstance->position = $blockposition;
$blockinstance->weight = $blockweight;
if(!$status = insert_record('block_instance', $blockinstance)) {
}
function specialization() {
- if($this->instance->pagetype == MOODLE_PAGE_COURSE && $this->instance->pageid != SITEID) {
+ if($this->instance->pagetype == PAGE_COURSE_VIEW && $this->instance->pageid != SITEID) {
$this->title = get_string('coursesummary', 'block_course_summary');
}
}
$instance = new stdClass;
$instance->blockid = abs($blk);
$instance->pageid = $thiscourse->id;
- $instance->pagetype = MOODLE_PAGE_COURSE;
+ $instance->pagetype = PAGE_COURSE_VIEW;
$instance->position = BLOCK_POS_LEFT;
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance = new stdClass;
$instance->blockid = abs($blk);
$instance->pageid = $thiscourse->id;
- $instance->pagetype = MOODLE_PAGE_COURSE;
+ $instance->pagetype = PAGE_COURSE_VIEW;
$instance->position = BLOCK_POS_RIGHT;
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance = new stdClass;
$instance->blockid = abs($blk);
$instance->pageid = $thiscourse->id;
- $instance->pagetype = MOODLE_PAGE_COURSE;
+ $instance->pagetype = PAGE_COURSE_VIEW;
$instance->position = BLOCK_POS_LEFT;
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$instance = new stdClass;
$instance->blockid = abs($blk);
$instance->pageid = $thiscourse->id;
- $instance->pagetype = MOODLE_PAGE_COURSE;
+ $instance->pagetype = PAGE_COURSE_VIEW;
$instance->position = BLOCK_POS_RIGHT;
$instance->weight = $weight;
$instance->visible = ($blk > 0) ? 1 : 0;
$this->content->text = '';
$this->content->footer = '';
- if($this->instance->pagetype == MOODLE_PAGE_COURSE) {
+ if($this->instance->pagetype == PAGE_COURSE_VIEW) {
// We need to see if we are monitoring a quiz
$quizid = empty($this->config->quizid) ? 0 : $this->config->quizid;
$courseid = $this->instance->pageid;
<table cellpadding="9" cellspacing="0">
-<?php if($this->instance->pagetype == MOODLE_PAGE_COURSE) { ?>
+<?php if($this->instance->pagetype == PAGE_COURSE_VIEW) { ?>
<tr valign="top">
<td align="right">
<?php print_string('config_select_quiz', 'block_quiz_results') ?>
?>
</td>
</tr>
-<?php } // end if($this->instance->pagetype == MOODLE_PAGE_COURSE) ?>
+<?php } // end if($this->instance->pagetype == PAGE_COURSE_VIEW) ?>
<tr valign="top">
<td align="right">
<?php print_string('config_show_best', 'block_quiz_results') ?>
$isteacher = false;
$courseid = '';
- if ($this->instance->pagetype == MOODLE_PAGE_COURSE) {
+ if ($this->instance->pagetype == PAGE_COURSE_VIEW) {
$isteacher = isteacher($this->instance->pageid);
$courseid = $this->instance->pageid;
}
if (!empty($course)) {
// Test for and remove blocks which aren't appropriate anymore
- $page = page_create_object(MOODLE_PAGE_COURSE, $course->id);
+ $page = page_create_object(PAGE_COURSE_VIEW, $course->id);
blocks_remove_inappropriate($page);
// Update with the new data
if ($newcourseid = insert_record('course', $form)) { // Set up new course
// Setup the blocks
- $page = page_create_object(MOODLE_PAGE_COURSE, $newcourseid);
+ $page = page_create_object(PAGE_COURSE_VIEW, $newcourseid);
blocks_repopulate_page($page); // Return value not checked because you can always edit later
$section = NULL;
$course->format = 'weeks'; // Default format is weeks
}
- $PAGE = page_create_object(MOODLE_PAGE_COURSE, $course->id);
+ $PAGE = page_create_object(PAGE_COURSE_VIEW, $course->id);
$pageblocks = blocks_get_by_page($PAGE);
if (!isset($USER->editing)) {
$langmenu = popup_form ($CFG->wwwroot .'/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true);
}
- $PAGE = page_create_object(MOODLE_PAGE_COURSE, SITEID);
+ $PAGE = page_create_object(PAGE_COURSE_VIEW, SITEID);
$editing = $PAGE->user_is_editing();
//Iterate over each course
if ($courses = get_records('course')) {
foreach ($courses as $course) {
- $page = page_create_object(MOODLE_PAGE_COURSE, $course->id);
+ $page = page_create_object(PAGE_COURSE_VIEW, $course->id);
blocks_repopulate_page($page);
}
}
}
if (!empty($CFG->siteblocksadded)) { /// This is a once-off hack to make a proper upgrade
- $page = page_create_object(MOODLE_PAGE_COURSE, SITEID);
+ $page = page_create_object(PAGE_COURSE_VIEW, SITEID);
blocks_repopulate_page($page);
delete_records('config', 'name', 'siteblocksadded');
}
* @package pages
*/
+
+// Start of dirty compatibility hack -- this will be here for a couple of weeks
+if(record_exists('block_instance', 'pagetype', 'course')) {
+ execute_sql('UPDATE '.$GLOBALS['CFG']->prefix.'block_instance SET pagetype = \'course-view\' WHERE pagetype = \'course\'', false);
+}
+// End of dirty compatibility hack -- remove this before 1.5 goes gold
+
/// Constants
/**
* Definition of course page type.
*/
-define('MOODLE_PAGE_COURSE', 'course');
+define('PAGE_COURSE_VIEW', 'course-view');
/**
* Factory function page_create_object(). Called with a pagetype identifier and possibly with
if ($mappings === NULL) {
$mappings = array(
- MOODLE_PAGE_COURSE => 'page_course'
+ PAGE_COURSE_VIEW => 'page_course'
);
}
// This is hardwired here so the factory function page_create_object() can be sure there was no mistake.
// Also, it doubles as a way to let others inquire about our type.
function get_type() {
- return MOODLE_PAGE_COURSE;
+ return PAGE_COURSE_VIEW;
}
- // This is like the "category" of a page of this "type". For example, if the type is MOODLE_PAGE_COURSE
- // the format_name is the actual name of the course format. If the type were MOODLE_PAGE_ACTIVITY, then
+ // This is like the "category" of a page of this "type". For example, if the type is PAGE_COURSE_VIEW
+ // the format_name is the actual name of the course format. If the type were PAGE_ACTIVITY_VIEW, then
// the format_name might be that activity's name etc.
function get_format_name() {
$this->init_full();