Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]

   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  define('NO_MOODLE_COOKIES', true); // Session not used here.
  18  
  19  require('../../../config.php');
  20  require_once ('../lib.php');
  21  
  22  $chatsid = required_param('chat_sid', PARAM_ALPHANUM);
  23  
  24  $PAGE->set_url('/mod/chat/gui_sockets/chatinput.php', array('chat_sid' => $chatsid));
  25  $PAGE->set_popup_notification_allowed(false);
  26  
  27  if (!$chatuser = $DB->get_record('chat_users', array('sid' => $chatsid))) {
  28      throw new \moodle_exception('notlogged', 'chat');
  29  }
  30  
  31  // Get the user theme.
  32  $USER = $DB->get_record('user', array('id' => $chatuser->userid));
  33  
  34  // Setup course, lang and theme.
  35  $PAGE->set_pagelayout('embedded');
  36  $PAGE->set_course($DB->get_record('course', array('id' => $chatuser->course)));
  37  $PAGE->requires->js('/mod/chat/gui_sockets/chat_gui_sockets.js', true);
  38  $PAGE->requires->js_function_call('setfocus');
  39  $PAGE->set_focuscontrol('chat_message');
  40  $PAGE->set_cacheable(false);
  41  echo $OUTPUT->header();
  42  
  43  ?>
  44  
  45      <form action="../empty.php" method="get" target="empty" id="inputform"
  46            onsubmit="return empty_field_and_submit();">
  47          <label class="accesshide" for="chat_message"><?php print_string('entermessage', 'chat'); ?></label>
  48          <input type="text" name="chat_message" id="chat_message" size="60" value="" />
  49      </form>
  50  
  51      <form action="<?php echo "http://$CFG->chat_serverhost:$CFG->chat_serverport/"; ?>" method="get" target="empty" id="sendform">
  52          <input type="hidden" name="win" value="message" />
  53          <input type="hidden" name="chat_message" value="" />
  54          <input type="hidden" name="chat_msgidnr" value="0" />
  55          <input type="hidden" name="chat_sid" value="<?php echo $chatsid ?>" />
  56      </form>
  57  <?php
  58  echo $OUTPUT->footer();
  59