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

index 878726fbe5405d9fdff502827676aed866df7190..143e1a13533a163aba9d846edd54d5d8385abae7 100644 (file)
@@ -902,6 +902,7 @@ function page_import_types($path) {
  * @return the global $PAGE object.
  */
 function page_create_instance($instance) {
+    global $PAGE;
     return page_create_object($PAGE->pagetype, $instance);
 }
 
index 40d88732fa45f015226c9dc4c981a96a48227204..6871da87fb4c7bbfc5738c70f93b126f689fdb3d 100644 (file)
@@ -1,7 +1,6 @@
 <?php  // $Id$
 
 /// Library of functions and constants for module chat
-require_once($CFG->libdir.'/pagelib.php');
 require_once($CFG->libdir.'/portfoliolib.php');
 
 $CFG->chat_ajax_debug  = false;
@@ -151,13 +150,6 @@ function chat_delete_instance($id) {
         $result = false;
     }
 
-    $pagetypes = page_import_types('mod/chat/');
-    foreach($pagetypes as $pagetype) {
-        if(!blocks_delete_all_on_page($pagetype, $chat->id)) {
-            $result = false;
-        }
-    }
-
     if (! $DB->delete_records('event', array('modulename'=>'chat', 'instance'=>$chat->id))) {
         $result = false;
     }
diff --git a/mod/chat/pagelib.php b/mod/chat/pagelib.php
deleted file mode 100644 (file)
index 23b438a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-<?php // $Id$
-
-require_once($CFG->libdir.'/pagelib.php');
-
-define('PAGE_CHAT_VIEW',   'mod-chat-view');
-
-page_map_class(PAGE_CHAT_VIEW, 'page_chat');
-
-$DEFINEDPAGES = array(PAGE_CHAT_VIEW);
-
-/**
- * Class that models the behavior of a chat
- *
- * @author Jon Papaioannou
- * @package pages
- */
-
-class page_chat extends page_generic_activity {
-
-    function init_quick($data) {
-        if(empty($data->pageid)) {
-            print_error('invalidcourseid');
-        }
-        $this->activityname = 'chat';
-        parent::init_quick($data);
-    }
-}
-
-?>
index 48337573eee900e42ee663d18d80223c8825acd2..df0f4f96c04a568d12571c655b93d9a5d42a2a3d 100644 (file)
@@ -2,9 +2,8 @@
 
 /// This page prints a particular instance of chat
 
-    require_once('../../config.php');
-    require_once('lib.php');
-    require_once('pagelib.php');
+    require_once(dirname(__FILE__) . '/../../config.php');
+    require_once($CFG->dirroot . '/mod/chat/lib.php');
 
     $id   = optional_param('id', 0, PARAM_INT);
     $c    = optional_param('c', 0, PARAM_INT);
     add_to_log($course->id, 'chat', 'view', "view.php?id=$cm->id", $chat->id, $cm->id);
 
 // Initialize $PAGE, compute blocks
-
-    $PAGE = page_create_instance($chat->id);
     $PAGE->set_url('mod/chat/view.php', array('id' => $cm->id));
     $pageblocks = blocks_setup($PAGE);
     $blocks_preferred_width = bounded_number(180, blocks_preferred_width($pageblocks[BLOCK_POS_LEFT]), 210);
 
 /// Print the page header
-
     $strenterchat    = get_string('enterchat', 'chat');
     $stridle         = get_string('idle', 'chat');
     $strcurrentusers = get_string('currentusers', 'chat');
         $USER->editing = $edit;
     }
 
-    $PAGE->print_header($course->shortname.': %fullname%');
+    $title = $course->shortname . ': ' . format_string($chat->name);
+
+    $buttons = '<table><tr><td>'.update_module_button($cm->id, $course->id, get_string('modulename', 'chat')).'</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));
 
     echo '<table id="layout-table"><tr>';