send_message_to_userfriend.inc.php 2.6 KB

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