message_for_group_form.inc.php 4.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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. require_once api_get_path(LIBRARY_PATH).'fckeditor/fckeditor.php';
  11. $tok = Security::get_token();
  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. $info_path_friend=array();
  21. $userfriend_id=Security::remove_XSS($_REQUEST['user_friend']);
  22. // panel=1 send message
  23. // panel=2 send invitation
  24. $panel=Security::remove_XSS($_REQUEST['view_panel']);
  25. $info_user_friend=api_get_user_info($userfriend_id);
  26. $info_path_friend=UserManager::get_user_picture_path_by_id($userfriend_id,'web',false,true);
  27. }
  28. $group_id = intval($_GET['group_id']);
  29. $message_id = intval($_GET['message_id']);
  30. $actions = array('add_message_group','edit_message_group','reply_message_group');
  31. $allowed_action = (isset($_GET['action']) && in_array($_GET['action'],$actions))?Security::remove_XSS($_GET['action']):'';
  32. $to_group = '';
  33. $subject = '';
  34. $message = '';
  35. if (!empty($group_id) && $allowed_action) {
  36. $group_info = GroupPortalManager::get_group_data($group_id);
  37. $to_group = $group_info['name'];
  38. if (!empty($message_id)) {
  39. $message_info = MessageManager::get_message_by_id($message_id);
  40. if ($allowed_action == 'reply_message_group') {
  41. $subject = get_lang('Reply').':'.api_xml_http_response_encode($message_info['title']);
  42. } else {
  43. $subject = api_xml_http_response_encode($message_info['title']);
  44. $message = api_xml_http_response_encode($message_info['content']);
  45. }
  46. }
  47. }
  48. ?>
  49. <form name="form" action="groups.php?id=<?php echo $group_id ?>" method="POST" enctype="multipart/form-data">
  50. <input type="hidden" name="action" value="<?php echo $allowed_action ?>" />
  51. <input type="hidden" name="group_id" value="<?php echo $group_id ?>" />
  52. <input type="hidden" name="parent_id" value="<?php echo $message_id ?>" />
  53. <input type="hidden" name="message_id" value="<?php echo $message_id ?>" />
  54. <input type="hidden" name="token" value="<?php echo $tok ?>" />
  55. <table width="600" border="0" height="220">
  56. <tr height="180">
  57. <td align="left">
  58. <div id="id_content_panel_init">
  59. <dl>
  60. <?php
  61. if (api_get_setting('allow_message_tool')=='true') {
  62. //normal message
  63. $user_info=api_get_user_info($userfriend_id);
  64. echo api_xml_http_response_encode(get_lang('To')); ?> :&nbsp;&nbsp;&nbsp;&nbsp;<?php echo api_xml_http_response_encode($to_group); ?>
  65. <br />
  66. <br /><?php echo api_xml_http_response_encode(get_lang('Subject')); ?> :<br />
  67. <input id="txt_subject_id" name="title" type="text" style="width:450px;" value="<?php echo $subject ?>"><br/>
  68. <br /><?php echo api_xml_http_response_encode(get_lang('Message')); ?> :<br />
  69. <?php
  70. $oFCKeditor = new FCKeditor('content') ;
  71. $oFCKeditor->ToolbarSet = 'profile';
  72. $oFCKeditor->Width = '100%';
  73. $oFCKeditor->Height = '120';
  74. $oFCKeditor->Value = $message;
  75. $return = $oFCKeditor->CreateHtml();
  76. echo $return;
  77. ?>
  78. <br /><br /><?php echo api_xml_http_response_encode(get_lang('AttachmentFiles')); ?> :<br />
  79. <span id="filepaths"><div id="filepath_1"><input type="file" name="attach_1" size="20" /></div></span>
  80. <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>
  81. <br />
  82. <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>
  83. <?php } ?>
  84. </dl>
  85. </td>
  86. </tr>
  87. </div>
  88. </table>
  89. </form>