index.php 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php // $Id: index.php 10675 2007-01-11 13:03:10Z bmol $
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) Facultad de Matematicas, UADY (México)
  6. Copyright (c) Evie, Free University of Brussels (Belgium)
  7. For a full list of contributors, see "credits.txt".
  8. The full license can be read in "license.txt".
  9. This program is free software; you can redistribute it and/or
  10. modify it under the terms of the GNU General Public License
  11. as published by the Free Software Foundation; either version 2
  12. of the License, or (at your option) any later version.
  13. See the GNU General Public License for more details.
  14. Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  15. Mail: info@dokeos.com
  16. ==============================================================================
  17. */
  18. include_once('functions.inc.php');
  19. $e= api_get_path(WEB_PLUGIN_PATH).'messages/inbox.php';
  20. $e2= api_get_path(WEB_PLUGIN_PATH).'messages/new_message.php';
  21. $inb = get_lang("Inbox");
  22. $newm = get_lang("ComposeMessage");
  23. if(api_get_user_id())
  24. {
  25. $query = "CREATE TABLE IF NOT EXISTS `".MESSAGES_DATABASE."` (".
  26. "`id` VARCHAR(150) NOT NULL,".
  27. "`id_sender` INT( 10 ) NOT NULL ,".
  28. "`id_receiver` INT( 10 ) NOT NULL ,".
  29. "`status` BOOL NOT NULL,".
  30. "`date` DATETIME NOT NULL ,".
  31. "`title` VARCHAR(255) NOT NULL,".
  32. "`content` TEXT NOT NULL,".
  33. "INDEX ( `id`,`id_receiver` )".
  34. ") TYPE = MYISAM ;";
  35. @api_sql_query($query,__FILE__,__LINE__);
  36. echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_PLUGIN_PATH).'messages/cookies.js"> </script> ';
  37. echo '<script language="javascript" type="text/javascript">set_url("'.api_get_path(WEB_PLUGIN_PATH).'messages/notify.php") ; notificar()</script> ';
  38. $number_of_new_messages = get_new_messages();
  39. if(is_null($number_of_new_messages))
  40. {
  41. $number_of_new_messages = 0;
  42. }
  43. echo "<a href=$e>".$inb."(<span id=\"nuevos\" style=\"none\">".$number_of_new_messages."</span>)</a>";
  44. echo " - ";
  45. echo "<a href=$e2>".$newm."</a>";
  46. if($number_of_new_messages > 0)
  47. {
  48. ?>
  49. <div id="box" style="background-color:white;border:1px solid black;position:absolute;width:200px;height:60px;z-index:3;visibility:hidden;top:85px;left:10px;margin: 0px;padding: 0px;">
  50. <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="2" id="table" class="content">
  51. <tr>
  52. <td width="28%" height="16" class="content" id="ref"><a style="color:red;font-size:10px" href="javascript:;" onclick="ocultar_aviso()">Close</a></td>
  53. <td width="72%" rowspan="2" class="content" id="ref"><?php echo '<a href="'.$e.'" style="color:#000000" onclick="ocultar_aviso()">'.get_lang('YouHaveNewMessage').'</a>'; ?></td>
  54. </tr>
  55. <tr>
  56. <td class="content" id="ref"><?php echo'<img src="'.api_get_path(WEB_PLUGIN_PATH).'messages/images/newmsg.gif" alt="new message" align="middle" class="images"></p>';?> </td>
  57. </tr>
  58. </table>
  59. </div>
  60. <?php
  61. }
  62. }
  63. else
  64. {
  65. echo '<script language="javascript" type="text/javascript" src="'.api_get_path(WEB_PLUGIN_PATH).'messages/cookies.js"> </script>';
  66. echo '<script language="javascript" type="text/javascript">Set_Cookie( "nuevos", 0, 0, "/","","")</script> ';
  67. }
  68. ?>