send_message_to_userfriend.inc.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <?php
  2. /* For licensing terms, see /dokeos_license.txt */
  3. $language_file = array('registration','messages','userInfo','admin');
  4. $cidReset=true;
  5. require_once '../inc/global.inc.php';
  6. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  7. require_once api_get_path(LIBRARY_PATH).'message.lib.php';
  8. require_once api_get_path(LIBRARY_PATH).'social.lib.php';
  9. if (api_is_anonymous()) {
  10. api_not_allowed();
  11. }
  12. if (api_get_setting('allow_message_tool') != 'true' && api_get_setting('allow_social_tool') != 'true'){
  13. api_not_allowed();
  14. }
  15. if ( isset($_REQUEST['user_friend']) ) {
  16. $info_user_friend=array();
  17. $info_path_friend=array();
  18. $userfriend_id=Security::remove_XSS($_REQUEST['user_friend']);
  19. // panel=1 send message
  20. // panel=2 send invitation
  21. $panel=Security::remove_XSS($_REQUEST['view_panel']);
  22. $info_user_friend=api_get_user_info($userfriend_id);
  23. $info_path_friend=UserManager::get_user_picture_path_by_id($userfriend_id,'web',false,true);
  24. }
  25. ?>
  26. <table width="600" border="0" height="220">
  27. <tr height="180">
  28. <td align="center">
  29. <div class="message-content-body-left">
  30. <img class="message-image-info" src="<?php echo $info_path_friend['dir'].$info_path_friend['file']; ?>"/>
  31. <?php
  32. if ($panel != 1) {
  33. echo '<br /><center>'.api_xml_http_response_encode(api_get_person_name($info_user_friend['firstName'], $info_user_friend['lastName'])).'</center>';
  34. }
  35. ?>
  36. </div>
  37. <div class="message-content-body-right">
  38. <div id="id_content_panel_init">
  39. <dl>
  40. <?php
  41. if (api_get_setting('allow_message_tool')=='true') {
  42. if ($panel == 1) {
  43. //normal message
  44. $user_info=api_get_user_info($userfriend_id);
  45. echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?>
  46. <br />
  47. <br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br /><input id="txt_subject_id" type="text" style="width:300px;"><br/>
  48. <br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br /><textarea id="txt_area_invite" rows="4" cols="41"></textarea>
  49. <br /><br />
  50. <button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="action_database_panel('5','<?php echo $userfriend_id;?>')"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
  51. <?php
  52. } else {
  53. // friend invitation message
  54. echo api_xml_http_response_encode(get_lang('AddPersonalMessage')); ?> :<br /><br />
  55. <textarea id="txt_area_invite" rows="5" cols="41"></textarea><br /><br />
  56. <button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SocialAddToFriends')); ?>" onclick="action_database_panel('4','<?php echo $userfriend_id;?>')" ><?php echo api_xml_http_response_encode(get_lang('SocialAddToFriends')) ?></button>
  57. <?php
  58. }
  59. }
  60. ?>
  61. </dl>
  62. </div>
  63. </td>
  64. </tr>
  65. </div>
  66. <tr>
  67. <td>
  68. <div id="display_response_id" style="position:relative"></div>
  69. </td>
  70. </tr>
  71. </table>