myfiles.php 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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 __DIR__.'/../inc/global.inc.php';
  9. api_block_anonymous_users();
  10. if (api_get_setting('allow_my_files') === 'false') {
  11. api_not_allowed(true);
  12. }
  13. $htmlHeadXtra[] = '
  14. <script>
  15. function denied_friend (element_input) {
  16. name_button=$(element_input).attr("id");
  17. name_div_id="id_"+name_button.substring(13);
  18. user_id=name_div_id.split("_");
  19. friend_user_id=user_id[1];
  20. $.ajax({
  21. contentType: "application/x-www-form-urlencoded",
  22. beforeSend: function(objeto) {
  23. $("#id_response").html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  24. type: "POST",
  25. url: "' . api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=deny_friend",
  26. data: "denied_friend_id="+friend_user_id,
  27. success: function(datos) {
  28. $("div#"+name_div_id).hide("slow");
  29. $("#id_response").html(datos);
  30. }
  31. });
  32. }
  33. function register_friend(element_input) {
  34. if(confirm("' . get_lang('AddToFriends').'")) {
  35. name_button=$(element_input).attr("id");
  36. name_div_id="id_"+name_button.substring(13);
  37. user_id=name_div_id.split("_");
  38. user_friend_id=user_id[1];
  39. $.ajax({
  40. contentType: "application/x-www-form-urlencoded",
  41. beforeSend: function(objeto) {
  42. $("div#dpending_"+user_friend_id).html("<img src=\'../inc/lib/javascript/indicator.gif\' />"); },
  43. type: "POST",
  44. url: "' . api_get_path(WEB_AJAX_PATH).'social.ajax.php?a=add_friend",
  45. data: "friend_id="+user_friend_id+"&is_my_friend="+"friend",
  46. success: function(datos) { $("div#"+name_div_id).hide("slow");
  47. $("form").submit()
  48. }
  49. });
  50. }
  51. }
  52. $(document).on("ready", function () {
  53. $("#el-finder").elfinder({
  54. url: "' . api_get_path(WEB_LIBRARY_PATH).'elfinder/php/connector.php",
  55. lang: "' . api_get_language_isocode().'",
  56. height: 600,
  57. resizable: false,
  58. rememberLastDir: false,
  59. }).elfinder("instance");
  60. });
  61. </script>';
  62. // Social Menu Block
  63. $social_menu_block = SocialManager::show_social_menu('myfiles');
  64. $actions = null;
  65. if (isset($_GET['cidReq'])) {
  66. $actions = Display::url(
  67. Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('Documents').' ('.get_lang('Course').')'),
  68. api_get_self().'?'.api_get_cidreq().'&id='.$_GET['parent_id']
  69. );
  70. }
  71. if (api_get_setting('allow_social_tool') == 'true') {
  72. $_SESSION['this_section'] = SECTION_SOCIAL;
  73. $interbreadcrumb[] = array(
  74. 'url' => 'profile.php',
  75. 'name' => get_lang('SocialNetwork')
  76. );
  77. } else {
  78. $_SESSION['this_section'] = SECTION_COURSES;
  79. $interbreadcrumb[] = array(
  80. 'url' => api_get_path(WEB_PATH).'user_portal.php',
  81. 'name' => get_lang('MyCourses')
  82. );
  83. }
  84. $interbreadcrumb[] = array('url' => '#', 'name' => get_lang('MyFiles'));
  85. $tpl = new Template();
  86. SocialManager::setSocialUserBlock($tpl, api_get_user_id(), 'myfiles');
  87. $editor = new \Chamilo\CoreBundle\Component\Editor\Editor();
  88. $template = $tpl->get_template($editor->getEditorStandAloneTemplate());
  89. $editor = $tpl->fetch($template);
  90. $tpl->assign('show_media_element', 0);
  91. if (api_get_setting('allow_social_tool') == 'true') {
  92. $tpl->assign('social_menu_block', $social_menu_block);
  93. $tpl->assign('social_right_content', $editor);
  94. $social_layout = $tpl->get_template('social/myfiles.tpl');
  95. $tpl->display($social_layout);
  96. } else {
  97. $controller = new IndexManager(get_lang('MyCourses'));
  98. $tpl->assign(
  99. 'actions',
  100. Display::toolbarAction('toolbar', [$actions])
  101. );
  102. $tpl->assign('content', $editor);
  103. $tpl->assign('profile_block', $controller->return_profile_block());
  104. $tpl->assign('user_image_block', $controller->return_user_image_block());
  105. $tpl->assign('course_block', $controller->return_course_block());
  106. $tpl->display_two_col_template();
  107. }