message_for_group_form.inc.php 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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. require_once api_get_path(LIBRARY_PATH).'group_portal_manager.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. $group_id = intval($_GET['group_id']);
  27. $message_id = intval($_GET['message_id']);
  28. $to_group = '';
  29. $title_group = '';
  30. if (!empty($group_id)) {
  31. $group_info = GroupPortalManager::get_group_data($group_id);
  32. $to_group = $group_info['name'];
  33. if (!empty($message_id)) {
  34. $message_info = MessageManager::get_message_by_id($message_id);
  35. $title_group = get_lang('Re:').api_xml_http_response_encode($message_info['title']);
  36. }
  37. }
  38. ?>
  39. <form name="form" action="groups.php?id=<?php echo $group_id ?>" method="POST" enctype="multipart/form-data">
  40. <input type="hidden" name="action" value="send_message_group" />
  41. <input type="hidden" name="group_id" value="<?php echo $group_id ?>" />
  42. <input type="hidden" name="parent_id" value="<?php echo $message_id ?>" />
  43. <input type="hidden" name="token" value="<?php echo $_SESSION['sec_token'] ?>" />
  44. <table width="600" border="0" height="220">
  45. <tr height="180">
  46. <td align="left">
  47. <div id="id_content_panel_init">
  48. <dl>
  49. <?php
  50. if (api_get_setting('allow_message_tool')=='true') {
  51. //normal message
  52. $user_info=api_get_user_info($userfriend_id);
  53. echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode($to_group); ?>
  54. <br />
  55. <br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br />
  56. <input id="txt_subject_id" name="title" type="text" style="width:450px;" value="<?php echo $title_group ?>"><br/>
  57. <br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br />
  58. <textarea id="txt_area_invite" name="content" rows="3" cols="68"></textarea><br/>
  59. <br /><?php echo api_xml_http_response_encode(get_lang('AttachmentFiles')); ?> :<br />
  60. <span id="filepaths"><div id="filepath_1"><input type="file" name="attach_1" size="20" /></div></span>
  61. <div id="link-more-attach"><a href="javascript://" onclick="return add_image_form()"><?php echo get_lang('AddOneMoreFile') ?></a>&nbsp;(<?php echo api_xml_http_response_encode(sprintf(get_lang('MaximunFileSizeX'),format_file_size(api_get_setting('message_max_upload_filesize')))) ?>)</div>
  62. <!--button class="save" type="button" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>" onclick="return ajaxFileUpload()"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button-->
  63. <br />
  64. <button class="save" type="submit" value="<?php echo api_xml_http_response_encode(get_lang('SendMessage')); ?>"><?php echo api_xml_http_response_encode(get_lang('SendMessage')) ?></button>
  65. <?php } ?>
  66. </dl>
  67. </td>
  68. </tr>
  69. </div>
  70. <tr>
  71. <td>
  72. <div id="display_response_id" style="position:relative"></div>
  73. </td>
  74. </tr>
  75. </table>
  76. </form>