view_message.php 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. <?php // $Id: view_message.php 17903 2009-01-21 19:50:57Z juliomontoya $
  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. =========================================================================5====
  24. */
  25. // name of the language file that needs to be included
  26. $language_file= 'messages';
  27. include_once('../inc/global.inc.php');
  28. api_block_anonymous_users();
  29. if (api_get_setting('allow_message_tool')!='true'){
  30. api_not_allowed();
  31. }
  32. require_once(api_get_path(LIBRARY_PATH).'message.lib.php');
  33. $nameTools = get_lang('Messages');
  34. $interbredcrump[]=array('url' => 'inbox.php','name' => get_lang('Inbox'));
  35. Display::display_header($nameTools,get_lang('Messages'));
  36. api_display_tool_title(get_lang('ReadMessage'));
  37. $table_message = Database::get_course_table(TABLE_MESSAGE);
  38. $query = "UPDATE $table_message SET msg_status = '0' WHERE user_receiver_id=".api_get_user_id()." AND id='".Database::escape_string($_GET['id'])."';";
  39. $result = api_sql_query($query,__FILE__,__LINE__);
  40. $query = "SELECT * FROM $table_message WHERE user_receiver_id=".api_get_user_id()." AND id='".Database::escape_string($_GET['id'])."';";
  41. $result = api_sql_query($query,__FILE__,__LINE__);
  42. $row = Database::fetch_array($result);
  43. $user_con = users_connected_by_id();
  44. $band=0;
  45. $reply='';
  46. for($i=0;$i<count($user_con);$i++)
  47. if($row[1]==$user_con[$i])
  48. $band=1;
  49. if($band==1)
  50. $reply = '<a href="new_message.php?re_id='.$_GET['id'].'">'.Display::return_icon('message_reply.png',get_lang('ReplyToMessage')).get_lang('ReplyToMessage').'</a>';
  51. echo '<div class=actions>';
  52. echo '<a href="inbox.php">&laquo;&nbsp;'.get_lang('BackToInbox').'</a>';
  53. echo $reply;
  54. echo '<a href="inbox.php?action=deleteone&id='.$row[0].'" onclick="javascript:if(!confirm('."'".addslashes(htmlentities(get_lang('ConfirmDeleteMessage')))."'".')) return false;">'.Display::return_icon('message_delete.png',get_lang('DeleteMessage')).''.get_lang('Delete').'</a>';
  55. echo '</div><br />';
  56. echo '
  57. <table class="message_view_table" >
  58. <TR>
  59. <TD width=10>&nbsp; </TD>
  60. <TD vAlign=top width="100%">
  61. <TABLE>
  62. <TR>
  63. <TD width="100%">
  64. <TR> <h1>'.$row[5].'</h1></TR>
  65. </TD>
  66. <TR>
  67. <TD>'.get_lang('From').'&nbsp;<b>'.GetFullUserName($row[1],$mysqlMainDb).'</b> '.strtolower(get_lang('To')).'&nbsp; <b>'.GetFullUserName($row[2],$mysqlMainDb).'</b> </TD>
  68. </TR>
  69. <TR>
  70. <TD >'.get_lang('Date').'&nbsp; '.$row[4].'</TD>
  71. </TR>
  72. </TR>
  73. </TABLE>
  74. <br />
  75. <TABLE height=209 width="100%" bgColor=#ffffff>
  76. <TBODY>
  77. <TR>
  78. <TD vAlign=top>'.$row[6].'</TD>
  79. </TR>
  80. </TBODY>
  81. </TABLE>
  82. <DIV class=HT style="PADDING-BOTTOM: 5px"> </DIV></TD>
  83. <TD width=10>&nbsp;</TD>
  84. </TR>
  85. </TABLE>';
  86. /*
  87. ==============================================================================
  88. FOOTER
  89. ==============================================================================
  90. */
  91. Display::display_footer();
  92. ?>