myfiles.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * @author Juan Carlos Trabado herodoto@telefonica.net
  5. * @package chamilo.social
  6. */
  7. $cidReset = true;
  8. require_once '../inc/global.inc.php';
  9. api_block_anonymous_users();
  10. if (api_get_setting('allow_social_tool') != 'true') {
  11. api_not_allowed();
  12. }
  13. $this_section = SECTION_SOCIAL;
  14. $_SESSION['this_section'] = $this_section;
  15. $interbreadcrumb[] = array(
  16. 'url' => 'profile.php',
  17. 'name' => get_lang('SocialNetwork')
  18. );
  19. $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('MyFiles'));
  20. $htmlHeadXtra[] = '
  21. <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. $(document).on("ready", function () {
  60. $("#el-finder").elfinder({
  61. url: "' . api_get_path(WEB_LIBRARY_PATH) . 'elfinder/php/connector.php",
  62. lang: "' . api_get_language_isocode() . '",
  63. height: 600,
  64. resizable: false,
  65. rememberLastDir: false,
  66. }).elfinder("instance");
  67. });
  68. </script>';
  69. // Social Menu Block
  70. $social_menu_block = SocialManager::show_social_menu('myfiles');
  71. $actions = null;
  72. if (isset($_GET['cidReq'])) {
  73. $actions = '<a href="' . api_get_path(
  74. WEB_CODE_PATH
  75. ) . 'document/document.php?cidReq=' . Security::remove_XSS(
  76. $_GET['cidReq']
  77. ) . '&amp;id_session=' . Security::remove_XSS(
  78. $_GET['id_session']
  79. ) . '&amp;gidReq=' . Security::remove_XSS(
  80. $_GET['gidReq']
  81. ) . '&amp;id=' . Security::remove_XSS(
  82. $_GET['parent_id']
  83. ) . '">' . Display::return_icon(
  84. 'back.png',
  85. get_lang('BackTo') . ' ' . get_lang('Documents') . ' (' . get_lang(
  86. 'Course'
  87. ) . ')'
  88. ) . '</a>';
  89. }
  90. $tpl = new Template();
  91. SocialManager::setSocialUserBlock($tpl, $user_id, 'myfiles');
  92. $editor = new \Chamilo\CoreBundle\Component\Editor\Editor();
  93. $editor = $tpl->fetch('default/'.$editor->getEditorStandAloneTemplate());
  94. $tpl->assign('social_right_content', $editor);
  95. $tpl->assign('social_menu_block', $social_menu_block);
  96. $tpl->assign('actions', $actions);
  97. $social_layout = $tpl->get_template('social/myfiles.tpl');
  98. $tpl->display($social_layout);