myfiles.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @author Juan Carlos Trabado herodoto@telefonica.net
  5. * @package chamilo.social
  6. */
  7. /**
  8. * Initialization
  9. */
  10. $language_file = array('messages','userInfo');
  11. $cidReset=true;
  12. require_once '../inc/global.inc.php';
  13. api_block_anonymous_users();
  14. if (api_get_setting('allow_social_tool') !='true') {
  15. api_not_allowed();
  16. }
  17. require_once api_get_path(LIBRARY_PATH).'group_portal_manager.lib.php';
  18. $this_section = SECTION_SOCIAL;
  19. $interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('Social'));
  20. $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('MyFiles'));
  21. $htmlHeadXtra[] = '
  22. <script type="text/javascript">
  23. function denied_friend (element_input) {
  24. name_button=$(element_input).attr("id");
  25. name_div_id="id_"+name_button.substring(13);
  26. user_id=name_div_id.split("_");
  27. friend_user_id=user_id[1];
  28. $.ajax({
  29. contentType: "application/x-www-form-urlencoded",
  30. beforeSend: function(objeto) {
  31. $("#id_response").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  32. type: "POST",
  33. url: "'.api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=deny_friend",
  34. data: "denied_friend_id="+friend_user_id,
  35. success: function(datos) {
  36. $("div#"+name_div_id).hide("slow");
  37. $("#id_response").html(datos);
  38. }
  39. });
  40. }
  41. function register_friend(element_input) {
  42. if(confirm("'.get_lang('AddToFriends').'")) {
  43. name_button=$(element_input).attr("id");
  44. name_div_id="id_"+name_button.substring(13);
  45. user_id=name_div_id.split("_");
  46. user_friend_id=user_id[1];
  47. $.ajax({
  48. contentType: "application/x-www-form-urlencoded",
  49. beforeSend: function(objeto) {
  50. $("div#dpending_"+user_friend_id).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  51. type: "POST",
  52. url: "'.api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=add_friend",
  53. data: "friend_id="+user_friend_id+"&is_my_friend="+"friend",
  54. success: function(datos) { $("div#"+name_div_id).hide("slow");
  55. $("form").submit()
  56. }
  57. });
  58. }
  59. }
  60. </script>';
  61. //Display :: display_header($tool_name, 'Groups');
  62. // easy links
  63. if (is_array($_GET) && count($_GET)>0) {
  64. foreach($_GET as $key => $value) {
  65. switch ($key) {
  66. case 'accept':
  67. $user_role = GroupPortalManager::get_user_group_role(api_get_user_id(), $value);
  68. if (in_array($user_role , array(GROUP_USER_PERMISSION_PENDING_INVITATION_SENT_BY_USER,GROUP_USER_PERMISSION_PENDING_INVITATION))) {
  69. GroupPortalManager::update_user_role(api_get_user_id(), $value, GROUP_USER_PERMISSION_READER);
  70. $show_message = get_lang('UserIsSubscribedToThisGroup');
  71. } elseif (in_array($user_role , array(GROUP_USER_PERMISSION_READER, GROUP_USER_PERMISSION_ADMIN, GROUP_USER_PERMISSION_MODERATOR))) {
  72. $show_message = get_lang('UserIsAlreadySubscribedToThisGroup');
  73. } else {
  74. $show_message = get_lang('UserIsNotSubscribedToThisGroup');
  75. }
  76. break 2;
  77. case 'deny':
  78. // delete invitation
  79. GroupPortalManager::delete_user_rel_group(api_get_user_id(), $value);
  80. $show_message = get_lang('GroupInvitationWasDeny');
  81. break 2;
  82. }
  83. }
  84. }
  85. $social_left_content = SocialManager::show_social_menu('myfiles');
  86. if (isset($_GET['cidReq'])){
  87. $social_right_content .='<div class="actions">';
  88. $social_right_content .= '<a href="'.api_get_path(WEB_CODE_PATH).'document/document.php?cidReq='.Security::remove_XSS($_GET['cidReq']).'&amp;id_session='.Security::remove_XSS($_GET['id_session']).'&amp;gidReq='.Security::remove_XSS($_GET['gidReq']).'&amp;id='.Security::remove_XSS($_GET['parent_id']).'">'.Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('Documents').' ('.get_lang('Course').')').get_lang('BackTo').' '.get_lang('Documents').' ('.get_lang('Course').')</a>';
  89. $social_right_content .= '</div>';
  90. }
  91. else{
  92. $social_right_content .= '<br />';
  93. }
  94. $social_right_content .= '<iframe name="fileManager" id="fileManager" src="'.api_get_path(WEB_PATH).'main/inc/lib/fckeditor/editor/plugins/ajaxfilemanager/ajaxfilemanager.php?editor=stand_alone" scrolling="no" noresize="noresize" frameborder="no" style="height:450px; width:100%; float:left"></iframe>';
  95. $social_right_content .= '</div>';
  96. $social_right_content .= '</div>';
  97. $tpl = new Template(get_lang('Social'));
  98. $tpl->assign('social_left_content', $social_left_content);
  99. $tpl->assign('social_left_menu', $social_left_menu);
  100. $tpl->assign('social_right_content', $social_right_content);
  101. $social_layout = $tpl->get_template('layout/social_layout.tpl');
  102. $content = $tpl->fetch($social_layout);
  103. $tpl->assign('actions', $actions);
  104. $tpl->assign('message', $show_message);
  105. $tpl->assign('content', $content);
  106. $tpl->display_one_col_template();