From: tjhunt Date: Wed, 6 May 2009 09:26:46 +0000 (+0000) Subject: pagelib: MDL-12212 eliminate data_page X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=3681f9a953d86020600691b323235e7daa8d41eb;p=moodle.git pagelib: MDL-12212 eliminate data_page --- diff --git a/lib/pagelib.php b/lib/pagelib.php index 143e1a1353..dab145d191 100644 --- a/lib/pagelib.php +++ b/lib/pagelib.php @@ -1074,6 +1074,9 @@ class page_course extends page_base { * @package pages */ class page_generic_activity extends page_base { + // Although this function is deprecated, it should be left here becuase people + // upgrading legacy code need to copy it. See + // http://docs.moodle.org/en/Development:Migrating_your_code_code_to_the_2.0_rendering_API function print_header($title, $morenavlinks = NULL, $bodytags = '', $meta = '') { global $USER, $CFG; diff --git a/mod/data/pagelib.php b/mod/data/pagelib.php deleted file mode 100755 index 8b99f8c51f..0000000000 --- a/mod/data/pagelib.php +++ /dev/null @@ -1,36 +0,0 @@ -libdir.'/pagelib.php'); -require_once($CFG->dirroot.'/course/lib.php'); // needed for some blocks - -define('PAGE_DATA_VIEW', 'mod-data-view'); - -page_map_class(PAGE_DATA_VIEW, 'page_data'); - -$DEFINEDPAGES = array(PAGE_DATA_VIEW); -/* -*/ - -/** - * Class that models the behavior of a data - * - * @author Jon Papaioannou - * @package pages - */ - -class page_data extends page_generic_activity { - - function init_quick($data) { - if(empty($data->pageid)) { - print_error('invalidcourseid'); - } - $this->activityname = 'data'; - parent::init_quick($data); - } - - function print_header($title, $morenavlinks = NULL, $meta) { - parent::print_header($title, $morenavlinks, '', $meta); - } -} - -?> diff --git a/mod/data/view.php b/mod/data/view.php index 85e3d25936..5c7b6ab924 100755 --- a/mod/data/view.php +++ b/mod/data/view.php @@ -22,11 +22,9 @@ // // /////////////////////////////////////////////////////////////////////////// - require_once('../../config.php'); - require_once('lib.php'); - require_once("$CFG->libdir/rsslib.php"); - - require_once('pagelib.php'); + require_once(dirname(__FILE__) . '/../../config.php'); + require_once($CFG->dirroot . '/mod/data/lib.php'); + require_once($CFG->libdir . '/rsslib.php'); /// One of these is necessary! $id = optional_param('id', 0, PARAM_INT); // course module id @@ -255,7 +253,6 @@ // Initialize $PAGE, compute blocks - $PAGE = page_create_instance($data->id); $PAGE->set_url('mod/data/view.php', array('id' => $cm->id)); $pageblocks = blocks_setup($PAGE); $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210); @@ -278,10 +275,20 @@ $meta .= ''; } - /// Print the page header - $PAGE->print_header($course->shortname.': %fullname%', '', $meta); + $title = $course->shortname.': ' . format_string($data->name); + + $buttons = ''; + if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) { + $buttons .= ''; + } + $buttons .= '
'.update_module_button($cm->id, $course->id, get_string('modulename', 'data')).'
frametarget.' method="get" action="view.php">
'. + ''. + ''. + '
'; + $navigation = build_navigation(array(), $cm); + print_header($title, $course->fullname, $navigation, '', '', true, $buttons, navmenu($course, $cm)); /// If we have blocks, then print the left side here if (!empty($CFG->showblocksonmodpages)) {