chat.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. <?php // $Id: chat.php 9832 2006-10-26 12:56:25Z gmludo $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2004 Dokeos S.A.
  6. Copyright (c) 2003 Ghent University (UGent)
  7. Copyright (c) 2001 Universite catholique de Louvain (UCL)
  8. Copyright (c) Olivier Brouckaert
  9. For a full list of contributors, see "credits.txt".
  10. The full license can be read in "license.txt".
  11. This program is free software; you can redistribute it and/or
  12. modify it under the terms of the GNU General Public License
  13. as published by the Free Software Foundation; either version 2
  14. of the License, or (at your option) any later version.
  15. See the GNU General Public License for more details.
  16. Contact: Dokeos, 181 rue Royale, B-1000 Brussels, Belgium, info@dokeos.com
  17. ==============================================================================
  18. */
  19. /**
  20. ==============================================================================
  21. * Frameset of the Chat tool
  22. *
  23. * @author Ludovic Gasc
  24. * @package dokeos.chat
  25. * @todo improve multi-language support
  26. * @todo stock each chat text file into each course
  27. * @todo remove duplicate libs (XAJAX, PEAR...)
  28. ==============================================================================
  29. */
  30. /*
  31. -----------------------------------------------------------
  32. Init section
  33. -----------------------------------------------------------
  34. */
  35. $langFile='chat';
  36. include('../inc/global.inc.php');
  37. $this_section=SECTION_COURSES;
  38. $nameTools=get_lang('Chat');
  39. if ($_GET["origin"] != 'whoisonline')
  40. {
  41. api_protect_course_script();
  42. }
  43. else
  44. {
  45. $origin = $_SESSION['origin'];
  46. $target = $_SESSION['target'];
  47. $_SESSION['origin']=$_GET["origin"];
  48. $_SESSION['target']=$_GET["target"];
  49. }
  50. /*
  51. -----------------------------------------------------------
  52. Tracking
  53. -----------------------------------------------------------
  54. */
  55. include('../inc/lib/events.lib.inc.php');
  56. event_access_tool(TOOL_CHAT);
  57. /*
  58. -----------------------------------------------------------
  59. Main section
  60. -----------------------------------------------------------
  61. */
  62. require_once './phpfreechat/src/phpfreechat.class.php';
  63. // initialisation of phpfreechat
  64. $courseinfo = api_get_course_info();
  65. //print_r($courseinfo);
  66. $params['serverid'] = (string) $courseinfo['id']; // used to identify the chat
  67. $params['nick'] = $_SESSION['_user']['firstName'].' '.$_SESSION['_user']['lastName'];
  68. $params['title'] = $courseinfo['name'];
  69. //$params['channel'] = $courseinfo['name'];
  70. $params['frozen_nick'] = true;
  71. $params['max_nick_len'] = 100;
  72. $params['height'] = "300px";
  73. //$params['xajaxpath'] = $rootSys.'main/inc/lib/xajax/';
  74. // $params['debug'] = true;
  75. // $params['debugxajax'] = true;
  76. $params['language'] = Database::get_language_isocode($courseinfo['language']).'_'.strtoupper(Database::get_language_isocode($courseinfo['language']));
  77. // In phpfreechat, some translations depends of the country
  78. $chat = new phpFreeChat($params);
  79. $htmlHeadXtra[] = $chat->printJavascript();
  80. $htmlHeadXtra[] = $chat->printStyle();
  81. Display::display_header($nameTools,"Chat");
  82. $chat->printChat();
  83. Display::display_footer();
  84. ?>