From: samhemelryk Date: Mon, 7 Sep 2009 04:08:56 +0000 (+0000) Subject: mod-chat MDL-19804 Updated print_header and build_navigation to OUTPUT and PAGE equiv... X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=296b589efde4cdacec6345c1704bdeca1922bed7;p=moodle.git mod-chat MDL-19804 Updated print_header and build_navigation to OUTPUT and PAGE equivalents --- diff --git a/mod/chat/gui_ajax/index.php b/mod/chat/gui_ajax/index.php index 9deed34827..dfedd59d74 100644 --- a/mod/chat/gui_ajax/index.php +++ b/mod/chat/gui_ajax/index.php @@ -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")); } diff --git a/mod/chat/gui_basic/index.php b/mod/chat/gui_basic/index.php index d8be302fcb..c0b3ca3a41 100644 --- a/mod/chat/gui_basic/index.php +++ b/mod/chat/gui_basic/index.php @@ -95,9 +95,9 @@ redirect('index.php?id='.$id.'&newonly='.$newonly.'&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 '
'; echo '

'.get_string('participants').'

'; echo '
    '; diff --git a/mod/chat/gui_header_js/chat_gui_header.js b/mod/chat/gui_header_js/chat_gui_header.js index ddfe2614a3..c9c9b7039d 100644 --- a/mod/chat/gui_header_js/chat_gui_header.js +++ b/mod/chat/gui_header_js/chat_gui_header.js @@ -28,6 +28,7 @@ function stop() { function start() { timer = setTimeout("update()", f*1000); + YAHOO.util.Event.addListener(document.body, 'unload', stop); } function update() { diff --git a/mod/chat/gui_header_js/chatinput.php b/mod/chat/gui_header_js/chatinput.php index 33e56d5751..cd52b35bb7 100644 --- a/mod/chat/gui_header_js/chatinput.php +++ b/mod/chat/gui_header_js/chatinput.php @@ -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(); ?>
    visible and !has_capability('moodle/course:viewhiddenactivities', get_context_instance(CONTEXT_MODULE, $cm->id))) { - print_header(); + echo $OUTPUT->header(); notice(get_string("activityiscurrentlyhidden")); } diff --git a/mod/chat/gui_header_js/users.php b/mod/chat/gui_header_js/users.php index c12191047b..df62e33f56 100644 --- a/mod/chat/gui_header_js/users.php +++ b/mod/chat/gui_header_js/users.php @@ -65,11 +65,8 @@ } $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(); diff --git a/mod/chat/gui_sockets/chatinput.php b/mod/chat/gui_sockets/chatinput.php index e54697a301..2fb5f38829 100644 --- a/mod/chat/gui_sockets/chatinput.php +++ b/mod/chat/gui_sockets/chatinput.php @@ -18,14 +18,15 @@ $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, ' ', '', false); + $PAGE->set_focuscontrol('chat_message'); + $PAGE->set_cacheable(false); + echo $OUTPUT->header(); ?> - + help_icon(moodle_help_icon::make("chatting", get_string("helpchatting", "chat"), "chat", true)); ?>
    diff --git a/mod/chat/gui_sockets/index.php b/mod/chat/gui_sockets/index.php index 3830d0482e..37be772fdc 100644 --- a/mod/chat/gui_sockets/index.php +++ b/mod/chat/gui_sockets/index.php @@ -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")); } diff --git a/mod/chat/index.php b/mod/chat/index.php index 15f6111532..b3f12f42d6 100644 --- a/mod/chat/index.php +++ b/mod/chat/index.php @@ -21,12 +21,9 @@ /// 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 diff --git a/mod/chat/report.php b/mod/chat/report.php index f67ea8d5d6..c25382e597 100644 --- a/mod/chat/report.php +++ b/mod/chat/report.php @@ -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); @@ -103,9 +103,9 @@ /// 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')); diff --git a/mod/chat/view.php b/mod/chat/view.php index 9b17b916c3..21e08dd411 100644 --- a/mod/chat/view.php +++ b/mod/chat/view.php @@ -45,10 +45,8 @@ // 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').'

    '.get_string('liketologin'), get_login_url(), $CFG->wwwroot.'/course/view.php?id='.$course->id); @@ -83,8 +81,10 @@ } $buttons .= ''; - $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);