]> git.mjollnir.org Git - moodle.git/commitdiff
pagelib: MDL-12212 eliminate data_page
authortjhunt <tjhunt>
Wed, 6 May 2009 09:26:46 +0000 (09:26 +0000)
committertjhunt <tjhunt>
Wed, 6 May 2009 09:26:46 +0000 (09:26 +0000)
lib/pagelib.php
mod/data/pagelib.php [deleted file]
mod/data/view.php

index 143e1a13533a163aba9d846edd54d5d8385abae7..dab145d19138998b2c270bbab682c00042b00283 100644 (file)
@@ -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 (executable)
index 8b99f8c..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-<?php // $Id$
-
-require_once($CFG->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);
-    }
-}
-
-?>
index 85e3d25936adfcf3b21e16763b0bc263ab5d3482..5c7b6ab924c9666424b2740e0a3fce00999f60f0 100755 (executable)
 //                                                                       //
 ///////////////////////////////////////////////////////////////////////////
 
-    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
 
 
 // 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);
         $meta .= '<script type="text/javascript" src="'.$CFG->wwwroot.'/mod/data/js.php?d='.$data->id.'"></script>';
     }
 
-
 /// Print the page header
-    $PAGE->print_header($course->shortname.': %fullname%', '', $meta);
+    $title = $course->shortname.': ' . format_string($data->name);
+
+    $buttons = '<table><tr><td>'.update_module_button($cm->id, $course->id, get_string('modulename', 'data')).'</td>';
+    if ($PAGE->user_allowed_editing() && !empty($CFG->showblocksonmodpages)) {
+        $buttons .= '<td><form '.$CFG->frametarget.' method="get" action="view.php"><div>'.
+            '<input type="hidden" name="id" value="'.$cm->id.'" />'.
+            '<input type="hidden" name="edit" value="'.($PAGE->user_is_editing()?'off':'on').'" />'.
+            '<input type="submit" value="'.get_string($PAGE->user_is_editing()?'blockseditoff':'blocksediton').'" /></div></form></td>';
+    }
+    $buttons .= '</tr></table>';
 
+    $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)) {