myfiles.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  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. $this_section = SECTION_SOCIAL;
  18. $_SESSION['this_section']=$this_section;
  19. $interbreadcrumb[]= array ('url' =>'profile.php','name' => get_lang('SocialNetwork'));
  20. $interbreadcrumb[]= array ('url' =>'#','name' => get_lang('MyFiles'));
  21. $htmlHeadXtra[] = '<script>
  22. function denied_friend (element_input) {
  23. name_button=$(element_input).attr("id");
  24. name_div_id="id_"+name_button.substring(13);
  25. user_id=name_div_id.split("_");
  26. friend_user_id=user_id[1];
  27. $.ajax({
  28. contentType: "application/x-www-form-urlencoded",
  29. beforeSend: function(objeto) {
  30. $("#id_response").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  31. type: "POST",
  32. url: "'.api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=deny_friend",
  33. data: "denied_friend_id="+friend_user_id,
  34. success: function(datos) {
  35. $("div#"+name_div_id).hide("slow");
  36. $("#id_response").html(datos);
  37. }
  38. });
  39. }
  40. function register_friend(element_input) {
  41. if(confirm("'.get_lang('AddToFriends').'")) {
  42. name_button=$(element_input).attr("id");
  43. name_div_id="id_"+name_button.substring(13);
  44. user_id=name_div_id.split("_");
  45. user_friend_id=user_id[1];
  46. $.ajax({
  47. contentType: "application/x-www-form-urlencoded",
  48. beforeSend: function(objeto) {
  49. $("div#dpending_"+user_friend_id).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  50. type: "POST",
  51. url: "'.api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=add_friend",
  52. data: "friend_id="+user_friend_id+"&is_my_friend="+"friend",
  53. success: function(datos) { $("div#"+name_div_id).hide("slow");
  54. $("form").submit()
  55. }
  56. });
  57. }
  58. }
  59. </script>';
  60. $show_message = null;
  61. $usergroup = new UserGroup();
  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 = $usergroup->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. $usergroup->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. $usergroup->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. $actions = null;
  87. if (isset($_GET['cidReq'])){
  88. $actions = '<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').')').'</a>';
  89. }
  90. $social_right_content = '<div class="span9">';
  91. $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:480px; width:100%; float:left"></iframe>';
  92. $social_right_content .= '</div>';
  93. $app['title'] = get_lang('Social');
  94. $tpl = $app['template'];
  95. $tpl->assign('social_left_content', $social_left_content);
  96. $tpl->assign('social_right_content', $social_right_content);
  97. $tpl->assign('actions', $actions);
  98. $tpl->assign('message', $show_message);
  99. $social_layout = $tpl->get_template('layout/social_layout.tpl');
  100. $tpl->display($social_layout);