inbox.php 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /*
  3. ==============================================================================
  4. Dokeos - elearning and course management software
  5. Copyright (c) 2009 Dokeos SPRL
  6. Copyright (c) 2009 Julio Montoya Armas <gugli100@gmail.com>
  7. Copyright (c) Facultad de Matematicas, UADY (México)
  8. Copyright (c) Evie, Free University of Brussels (Belgium)
  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 address: Dokeos, rue du Corbeau, 108, B-1030 Brussels, Belgium
  17. Mail: info@dokeos.com
  18. ==============================================================================
  19. */
  20. /*
  21. ==============================================================================
  22. INIT SECTION
  23. ==============================================================================
  24. */
  25. // name of the language file that needs to be included
  26. $language_file= 'messages';
  27. $cidReset=true;
  28. include_once ('../inc/global.inc.php');
  29. require_once (api_get_path(LIBRARY_PATH).'message.lib.php');
  30. api_block_anonymous_users();
  31. if (api_get_setting('allow_message_tool')!='true'){
  32. api_not_allowed();
  33. }
  34. $htmlHeadXtra[]='<script language="javascript">
  35. <!--
  36. function enviar(miforma)
  37. {
  38. if(confirm("'.get_lang("SureYouWantToDeleteSelectedMessages").'"))
  39. miforma.submit();
  40. }
  41. function select_all(formita)
  42. {
  43. for (i=0;i<formita.elements.length;i++)
  44. {
  45. if(formita.elements[i].type == "checkbox")
  46. formita.elements[i].checked=1
  47. }
  48. }
  49. function deselect_all(formita)
  50. {
  51. for (i=0;i<formita.elements.length;i++)
  52. {
  53. if(formita.elements[i].type == "checkbox")
  54. formita.elements[i].checked=0
  55. }
  56. }
  57. //-->
  58. </script>';
  59. /*
  60. ==============================================================================
  61. MAIN CODE
  62. ==============================================================================
  63. */
  64. $nameTools = get_lang('Messages');
  65. Display::display_header($nameTools,get_lang('Inbox'));
  66. api_display_tool_title(get_lang('Inbox'));
  67. $table_message = Database::get_course_table(TABLE_MESSAGE);
  68. echo '<div class=actions>';
  69. echo '<a href="new_message.php">'.Display::return_icon('message_new.png',get_lang('ComposeMessage')).get_lang('ComposeMessage').'</a>';
  70. echo '</div>';
  71. if(!isset($_GET[del_msg])) {
  72. inbox_display();
  73. } else {
  74. $num_msg = $_POST['total'];
  75. for ($i=0;$i<$num_msg;$i++) {
  76. if($_POST[$i]) {
  77. //the user_id was necesarry to delete a message??
  78. delete_message_by_user_receiver(api_get_user_id(), $_POST['_'.$i]);
  79. }
  80. }
  81. inbox_display();
  82. }
  83. /*
  84. ==============================================================================
  85. FOOTER
  86. ==============================================================================
  87. */
  88. Display::display_footer();
  89. ?>