myfiles.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. use Chamilo\CoreBundle\Framework\Container;
  4. /**
  5. * @author Juan Carlos Trabado herodoto@telefonica.net
  6. * @package chamilo.social
  7. */
  8. $cidReset = true;
  9. api_block_anonymous_users();
  10. if (api_get_setting('social.allow_social_tool') != 'true') {
  11. api_not_allowed();
  12. }
  13. if (api_get_setting('platform.allow_my_files') === 'false') {
  14. api_not_allowed(true);
  15. }
  16. $this_section = SECTION_SOCIAL;
  17. $_SESSION['this_section'] = $this_section;
  18. $interbreadcrumb[] = array(
  19. 'url' => 'profile.php',
  20. 'name' => get_lang('SocialNetwork')
  21. );
  22. $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('MyFiles'));
  23. $htmlHeadXtra[] = '
  24. <script>
  25. function denied_friend (element_input) {
  26. name_button=$(element_input).attr("id");
  27. name_div_id="id_"+name_button.substring(13);
  28. user_id=name_div_id.split("_");
  29. friend_user_id=user_id[1];
  30. $.ajax({
  31. contentType: "application/x-www-form-urlencoded",
  32. beforeSend: function(objeto) {
  33. $("#id_response").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  34. type: "POST",
  35. url: "' . api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?a=deny_friend",
  36. data: "denied_friend_id="+friend_user_id,
  37. success: function(datos) {
  38. $("div#"+name_div_id).hide("slow");
  39. $("#id_response").html(datos);
  40. }
  41. });
  42. }
  43. function register_friend(element_input) {
  44. if(confirm("' . get_lang('AddToFriends') . '")) {
  45. name_button=$(element_input).attr("id");
  46. name_div_id="id_"+name_button.substring(13);
  47. user_id=name_div_id.split("_");
  48. user_friend_id=user_id[1];
  49. $.ajax({
  50. contentType: "application/x-www-form-urlencoded",
  51. beforeSend: function(objeto) {
  52. $("div#dpending_"+user_friend_id).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  53. type: "POST",
  54. url: "' . api_get_path(WEB_AJAX_PATH) . 'social.ajax.php?a=add_friend",
  55. data: "friend_id="+user_friend_id+"&is_my_friend="+"friend",
  56. success: function(datos) { $("div#"+name_div_id).hide("slow");
  57. $("form").submit()
  58. }
  59. });
  60. }
  61. }
  62. $(document).on("ready", function () {
  63. $("#el-finder").elfinder({
  64. url: "' . api_get_path(WEB_LIBRARY_PATH) . 'elfinder/php/connector.php",
  65. lang: "' . api_get_language_isocode() . '",
  66. height: 600,
  67. resizable: false,
  68. rememberLastDir: false,
  69. }).elfinder("instance");
  70. });
  71. </script>';
  72. // Social Menu Block
  73. $social_menu_block = SocialManager::show_social_menu('myfiles');
  74. $actions = null;
  75. if (isset($_GET['cidReq'])) {
  76. $actions = '<a href="' . api_get_path(WEB_CODE_PATH) . 'document/document.php?cidReq=' . Security::remove_XSS(
  77. $_GET['cidReq']
  78. ) . '&amp;id_session=' . intval($_GET['id_session']) . '&amp;gidReq=' . intval($_GET['gidReq']) . '&amp;id=' . intval($_GET['parent_id']) . '">' . Display::return_icon(
  79. 'back.png',
  80. get_lang('BackTo') . ' ' . get_lang('Documents') . ' (' . get_lang('Course') . ')'
  81. ) . '</a>';
  82. }
  83. $tpl = Container::getTwig();
  84. SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'myfiles');
  85. $tpl->addGlobal('course_id', '');
  86. $tpl->addGlobal('session_id', '');
  87. $tpl->addGlobal('social_right_content', '');
  88. $tpl->addGlobal('social_menu_block', $social_menu_block);
  89. $tpl->addGlobal('actions', $actions);
  90. echo $tpl->render('@template_style/social/myfiles.html.twig');