myfiles.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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(true);
  12. }
  13. if (api_get_setting('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(
  77. WEB_CODE_PATH
  78. ) . 'document/document.php?cidReq=' . Security::remove_XSS(
  79. $_GET['cidReq']
  80. ) . '&amp;id_session=' . Security::remove_XSS(
  81. $_GET['id_session']
  82. ) . '&amp;gidReq=' . Security::remove_XSS(
  83. $_GET['gidReq']
  84. ) . '&amp;id=' . Security::remove_XSS(
  85. $_GET['parent_id']
  86. ) . '">' . Display::return_icon(
  87. 'back.png',
  88. get_lang('BackTo') . ' ' . get_lang('Documents') . ' (' . get_lang(
  89. 'Course'
  90. ) . ')'
  91. ) . '</a>';
  92. }
  93. $tpl = new Template();
  94. SocialManager::setSocialUserBlock($tpl, $user_id, 'myfiles');
  95. $editor = new \Chamilo\CoreBundle\Component\Editor\Editor();
  96. $editor = $tpl->fetch('default/'.$editor->getEditorStandAloneTemplate());
  97. $tpl->assign('social_right_content', $editor);
  98. $tpl->assign('social_menu_block', $social_menu_block);
  99. $tpl->assign('actions', $actions);
  100. $tpl->assign('show_media_element', 0);
  101. $social_layout = $tpl->get_template('social/myfiles.tpl');
  102. $tpl->display($social_layout);