send_message_to_userfriend.inc.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @package chamilo.messages
  5. */
  6. /**
  7. * Code
  8. */
  9. $language_file = array('registration','messages','userInfo','admin');
  10. $cidReset = true;
  11. require_once '../inc/global.inc.php';
  12. require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php';
  13. require_once api_get_path(LIBRARY_PATH).'message.lib.php';
  14. require_once api_get_path(LIBRARY_PATH).'social.lib.php';
  15. if (api_is_anonymous()) {
  16. api_not_allowed();
  17. }
  18. if (api_get_setting('allow_message_tool') != 'true' && api_get_setting('allow_social_tool') != 'true'){
  19. api_not_allowed();
  20. }
  21. if (isset($_REQUEST['user_friend']) ) {
  22. $info_user_friend=array();
  23. $userfriend_id=intval($_REQUEST['user_friend']);
  24. // panel=1 send message
  25. // panel=2 send invitation
  26. $panel=intval($_REQUEST['view_panel']);
  27. $info_user_friend=api_get_user_info($userfriend_id);
  28. }
  29. ?>
  30. <div id="id_content_panel_init">
  31. <dl>
  32. <?php
  33. if (api_get_setting('allow_message_tool')=='true') {
  34. if ($panel == 1) {
  35. //normal message
  36. $user_info=api_get_user_info($userfriend_id); ?>
  37. <div id="display_response_id" style="height:200px;width:400px">
  38. <?php echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;<?php echo api_xml_http_response_encode(api_get_person_name($user_info['firstName'], $user_info['lastName'])); ?>
  39. <br />
  40. <br /><span style="color:red"> * </span><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br />
  41. <input id="txt_subject_id" type="text" style="width:400px;"><br/>
  42. <br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br />
  43. <textarea id="txt_area_invite" rows="5" cols="55"></textarea>
  44. <br />
  45. <br />
  46. <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>
  47. </div>
  48. <?php
  49. } else {
  50. // friend invitation message
  51. ?>
  52. <div id="display_response_id" style="height:200px;">
  53. <?php echo api_xml_http_response_encode(get_lang('AddPersonalMessage')); ?> :<br /><br />
  54. <textarea id="txt_area_invite" rows="5" cols="55"></textarea><br /><br />
  55. <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;?>')" >
  56. <?php echo api_xml_http_response_encode(get_lang('SendInvitation')) ?></button>
  57. </div>
  58. <?php }
  59. } ?>
  60. </dl>
  61. </div>