send_message_to_userfriend.inc.php 3.2 KB

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