]> git.mjollnir.org Git - moodle.git/commitdiff
mod-chat MDL-19804 Updated print_header and build_navigation to OUTPUT and PAGE equiv...
authorsamhemelryk <samhemelryk>
Mon, 7 Sep 2009 04:08:56 +0000 (04:08 +0000)
committersamhemelryk <samhemelryk>
Mon, 7 Sep 2009 04:08:56 +0000 (04:08 +0000)
mod/chat/gui_ajax/index.php
mod/chat/gui_basic/index.php
mod/chat/gui_header_js/chat_gui_header.js
mod/chat/gui_header_js/chatinput.php
mod/chat/gui_header_js/index.php
mod/chat/gui_header_js/users.php
mod/chat/gui_sockets/chatinput.php
mod/chat/gui_sockets/index.php
mod/chat/index.php
mod/chat/report.php
mod/chat/view.php

index 9deed34827d18d4c55875d1b8f18fc550ba8fb20..dfedd59d74d58b8f9f2c8147a3c948c96d0e9ca2 100644 (file)
@@ -19,9 +19,8 @@ $context = get_context_instance(CONTEXT_MODULE, $cm->id);
 require_login($course->id, false, $cm);
 require_capability('mod/chat:chat',$context);
 
-if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id)))
-{
-    print_header();
+if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id))) {
+    echo $OUTPUT->header();
     notice(get_string("activityiscurrentlyhidden"));
 }
 
index d8be302fcb239a53ae3e7690bc80995f71746a34..c0b3ca3a41e3a005e1295553f63590f2e7fe50e0 100644 (file)
@@ -95,9 +95,9 @@
         redirect('index.php?id='.$id.'&amp;newonly='.$newonly.'&amp;last='.$last);
     }
 
-
-    print_header("$strchat: $course->shortname: ".format_string($chat->name,true)."$groupname", '', '', 'message');
-
+    $PAGE->set_title("$strchat: $course->shortname: ".format_string($chat->name,true)."$groupname");
+    $PAGE->set_focuscontrol('message');
+    echo $OUTPUT->header();
     echo '<div id="mod-chat-gui_basic">';
     echo '<h1>'.get_string('participants').'</h1>';
     echo '<div id="participants"><ul>';
index ddfe2614a34f0a6241f358545fc8a2b7082a7b0a..c9c9b7039dcff10797846aa8f0cb0bc7368a53c9 100644 (file)
@@ -28,6 +28,7 @@ function stop() {
 
 function start() {
     timer = setTimeout("update()", f*1000);
+    YAHOO.util.Event.addListener(document.body, 'unload', stop);
 }
 
 function update() {
index 33e56d57517bbfb90c9be7c9a67333e51e493d9d..cd52b35bb732d1070d21377e63bd87e164b73a30 100644 (file)
@@ -32,8 +32,9 @@
     $PAGE->set_course($course);
     $PAGE->requires->js('mod/chat/gui_header_js/chat_gui_header.js')->in_head();
     $PAGE->set_generaltype('embedded');
-
-    print_header('', '', '', 'input_chat_message', '', false);
+    $PAGE->set_focuscontrol('input_chat_message');
+    $PAGE->set_cacheable(false);
+    echo $OUTPUT->header();
 
 ?>
     <form action="../empty.php" method="post" target="empty" id="inputForm"
index aba89dfbaa4d14a21cf86c5066ea4b0db331fb03..98750fefca251918a687383628af0a4f41093c2a 100644 (file)
@@ -25,7 +25,7 @@
     require_capability('mod/chat:chat',$context);
 
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id))) {
-        print_header();
+        echo $OUTPUT->header();
         notice(get_string("activityiscurrentlyhidden"));
     }
 
index c12191047bc8460cc1d3d071a11a503d55a0b5c9..df62e33f563876ca1e1ca2d07201bb2e9afd198d 100644 (file)
     }
     $PAGE->requires->data_for_js('uidles', $uidles)->in_head();
     $PAGE->requires->js('mod/chat/gui_header_js/chat_gui_header.js')->in_head();
-
-    // Use ob to support Keep-Alive
-    ob_start();
-    print_header('', '', '', '', '', false, '', '', false, 'onload="start()" onunload="stop()"');
-
+    $PAGE->requires->js_function_call('start')->on_dom_ready();
+    echo $OUTPUT->header();
 
     /// Print user panel body
     $timenow    = time();
index e54697a3010926ba978e30eae47e75cd18f67713..2fb5f38829aefcb0598f65225dd9518e4fb659ae 100644 (file)
     $PAGE->set_course($DB->get_record('course', array('id' => $chatuser->course)));
     $PAGE->requires->js('mod/chat/gui_sockets/chat_gui_sockets.js')->in_head();
     $PAGE->requires->js_function_call('setfocus');
-    // TODO: there will be two onload in body tag, does it matter?
-    print_header('', '', '', 'inputform.chat_message', '', false, '&nbsp;', '', false);
+    $PAGE->set_focuscontrol('chat_message');
+    $PAGE->set_cacheable(false);
+    echo $OUTPUT->header();
 
 ?>
 
     <form action="../empty.php" method="get" target="empty" id="inputform"
           onsubmit="return empty_field_and_submit();">
-        <input type="text" name="chat_message" size="60" value="" />
+        <input type="text" name="chat_message" id="chat_message" size="60" value="" />
         <?php echo $OUTPUT->help_icon(moodle_help_icon::make("chatting", get_string("helpchatting", "chat"), "chat", true)); ?>
     </form>
     
index 3830d0482ee1172c0dbe22d63fb4cb719eb10659..37be772fdc6a73f70969e956f5ab11d2ceb5f53b 100644 (file)
@@ -25,7 +25,7 @@
     }
 
     if (!$cm->visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id))) {
-        print_header();
+        echo $OUTPUT->header();
         notice(get_string("activityiscurrentlyhidden"));
     }
 
index 15f6111532f26b840e60c087c8727d7e83e1bb79..b3f12f42d6e7f31b0ce9626890b875cfb3b9c5a2 100644 (file)
 
 
 /// Print the header
-
-    $navlinks = array();
-    $navlinks[] = array('name' => $strchats, 'link' => '', 'type' => 'activity');
-    $navigation = build_navigation($navlinks);
-
-    print_header_simple($strchats, '', $navigation, '', '', true, '', navmenu($course));
+    $PAGE->navbar->add($strchats);
+    $PAGE->set_title($strchats);
+    echo $OUTPUT->header();
 
 /// Get all the appropriate data
 
index f67ea8d5d6e52443d2bb6791beee3103d2b15b9b..c25382e5979a43675ad2e9ff7abdebf0317cd306 100644 (file)
@@ -39,9 +39,9 @@
 /// Print a session if one has been specified
 
     if ($start and $end and !$confirmdelete) {   // Show a full transcript
-        $navigation = build_navigation($strchatreport, $cm);
-        print_header_simple(format_string($chat->name).": $strchatreport", '', $navigation,
-                      '', '', true, '', navmenu($course, $cm));
+        $PAGE->navbar->add($strchatreport);
+        $PAGE->set_title(format_string($chat->name).": $strchatreport");
+        echo $OUTPUT->header();
 
     /// Check to see if groups are being used here
         $groupmode = groups_get_activity_groupmode($cm);
 
 
 /// Print the Sessions display
-    $navigation = build_navigation($strchatreport, $cm);
-    print_header_simple(format_string($chat->name).": $strchatreport", '', $navigation,
-                  '', '', true, '', navmenu($course, $cm));
+    $PAGE->navbar->add($strchatreport);
+    $PAGE->set_title(format_string($chat->name).": $strchatreport");
+    echo $OUTPUT->header();
 
     echo $OUTPUT->heading(format_string($chat->name).': '.get_string('sessions', 'chat'));
 
index 9b17b916c38312a28b9ee43a2ed22beb34c24dad..21e08dd411aa6c594b8a150d9132fa1e2bcc83ca 100644 (file)
 
     // show some info for guests
     if (isguestuser()) {
-        $navigation = build_navigation('', $cm);
-        print_header_simple(format_string($chat->name), '', $navigation,
-                      '', '', true, '', navmenu($course, $cm));
-
+        $PAGE->set_title(format_string($chat->name));
+        echo $OUTPUT->header();
         echo $OUTPUT->confirm(get_string('noguests', 'chat').'<br /><br />'.get_string('liketologin'),
                 get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id);
 
     }
     $buttons .= '</tr></table>';
 
-    $navigation = build_navigation(array(), $cm);
-    print_header($title, $course->fullname, $navigation, '', '', true, $buttons, navmenu($course, $cm));
+    $PAGE->set_title($title);
+    $PAGE->set_heading($course->fullname);
+    $PAGE->set_button($buttons);
+    echo $OUTPUT->header();
 
     /// Check to see if groups are being used here
     $groupmode = groups_get_activity_groupmode($cm);