whoisonline.html.twig 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. {% extends "@ChamiloTheme/Layout/layout_one_col.html.twig" %}
  2. {% block content %}
  3. {% autoescape false %}
  4. <div class="row">
  5. <div class="col-md-12">
  6. {% if social_search %}
  7. <div class="search-user">
  8. <div class="panel panel-default">
  9. <div class="panel-heading">
  10. {{ 'SearchUsers' | get_lang}}
  11. </div>
  12. <div class="panel-body">
  13. {{ social_search }}
  14. </div>
  15. </div>
  16. </div>
  17. {% endif %}
  18. <div id="whoisonline">
  19. <div id="user-list" class="row">
  20. {{ whoisonline }}
  21. </div>
  22. <div class="col-md-12">
  23. <a class="btn btn-large btn-default" id="link_load_more_items" data_link="2" >{{ 'More' | get_lang }}</a>
  24. </div>
  25. </div>
  26. </div>
  27. </div>
  28. <script>
  29. $(function() {
  30. $("#link_load_more_items").click(function() {
  31. page = $("#link_load_more_items").attr("data_link");
  32. $.ajax({
  33. beforeSend: function() {
  34. $("#link_load_more_items").html("{{ 'Loading' | get_lang|escape('js') }} <em class='fa fa-spinner fa-pulse fa-fw'></em>");
  35. },
  36. type: "GET",
  37. url: "main/inc/ajax/online.ajax.php?a=load_online_user",
  38. data: "online_page_nr=" + page,
  39. success: function(data) {
  40. if (data != "end") {
  41. $("#link_load_more_items").attr("data_link", parseInt(page) + 1);
  42. $("#user-list").append(data);
  43. $("#link_load_more_items").html("{{ 'More' | get_lang|escape('js')}}");
  44. } else {
  45. $("#link_load_more_items").remove();
  46. }
  47. }
  48. });
  49. });
  50. });
  51. </script>
  52. {% endautoescape %}
  53. {% endblock %}