index.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <?PHP
  2. include "../pcdl/html_head.php";
  3. ?>
  4. <body>
  5. <?php
  6. require_once("../pcdl/head_bar.php");
  7. ?>
  8. <style>
  9. .content_block{
  10. flex: 0 0 auto;
  11. width: 25%;
  12. padding: 10px;
  13. }
  14. .index_inner{
  15. width: 960px;
  16. margin-left: auto;
  17. margin-right: auto;
  18. }
  19. .content_inner{
  20. display:flex;
  21. }
  22. .h3{
  23. font-size: 16px;
  24. }
  25. .index_list_categories{
  26. margin: 2em 0;
  27. }
  28. .index_list_categories a:hover{
  29. color: var(--tool-link-hover-color);
  30. }
  31. /*.index_list_categories a,a:link{
  32. color: var(--main-color);
  33. }*/
  34. .index_list_categories button{
  35. border: none;
  36. }
  37. .pd-10{
  38. padding:10px;
  39. }
  40. .card li{
  41. white-space: unset;
  42. }
  43. .card code{
  44. white-space: unset;
  45. }
  46. </style>
  47. <div class="index_inner" >
  48. <div class="index_list_categories">
  49. <div class="title_bar">
  50. <span class="title h3"><?php echo $_local->gui->speaker ?></span>
  51. <span class="title_more"><a href="../course"><?php echo $_local->gui->more ?></a></span>
  52. </div>
  53. <div class="content">
  54. <div id="course_list_new" class="content_inner">
  55. </div>
  56. </div>
  57. </div>
  58. <script>
  59. $.get("../course/teacher_list.php",function(data,status){
  60. let xDiv = document.getElementById("course_list_new");
  61. if(xDiv){
  62. xDiv.innerHTML=data;
  63. }
  64. });
  65. </script>
  66. <div class="course_block">
  67. <div class="title" >
  68. <?php echo $_local->gui->in_progress; ?>
  69. </div>
  70. <div id="course_list_ongoing">
  71. </div >
  72. </div>
  73. <div class="course_block">
  74. <div class="title" >
  75. <?php echo $_local->gui->already_over; ?>
  76. </div>
  77. <div id="course_list_complete">
  78. </div >
  79. </div>
  80. <script>
  81. $.get("../course/course_list.php",function(data,status){
  82. let arrData = JSON.parse(data);
  83. let html_complete="";
  84. let html_ongoing="";
  85. for (const iterator of arrData) {
  86. let html="";
  87. html += '<div class="card" style="display:flex;margin:1em;padding:10px;">';
  88. html += '<div style="flex:3;max-width:15em;">';
  89. html += '<img src="../../tmp/images/course/'+iterator.id+'.jpg" alt="cover" width="200" height="200">'
  90. html += '</div>';
  91. html += '<div style="flex:7;padding:5px;">';
  92. html += '<div class="title" style="padding-bottom:5px;font-size:110%;font-weight:600;"><a href="../course/course.php?id='+iterator.id+'">'+iterator.title+'</a></div>';
  93. html += '<div class="summary" style="padding-bottom:5px;">'+iterator.subtitle+'</div>';
  94. let summary = "";
  95. try{
  96. summary = marked(iterator.summary);
  97. }
  98. catch(e){
  99. }
  100. html += '<div class="summary" style="padding-bottom:5px;">'+summary+'</div>';
  101. html += '</div>';
  102. html += '<div style="flex:3;max-width:15em;">';
  103. html += '</div>';
  104. html += '</div>';
  105. if(iterator.status==40){
  106. html_complete += html;
  107. }
  108. else if(iterator.status==30 || iterator.status==20 ){
  109. html_ongoing += html;
  110. }
  111. }
  112. $("#course_list_complete").html(html_complete);
  113. $("#course_list_ongoing").html(html_ongoing);
  114. $("img").one("error", function(){
  115. $(this).attr("src", "../course/img/default.jpg");
  116. });
  117. });
  118. </script>
  119. </div>
  120. <?php
  121. include "../pcdl/html_foot.php";
  122. ?>