index.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258
  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. width: 230px;
  11. }
  12. .index_inner {
  13. margin-left: auto;
  14. margin-right: auto;
  15. }
  16. .content_inner {
  17. display: grid;
  18. justify-content: center;
  19. grid-gap: 20px;
  20. }
  21. .title_bar {
  22. justify-content: space-between;
  23. display: flex;
  24. margin: 1em 0;
  25. align-items: center;
  26. }
  27. h3 {
  28. font-size: 18px;
  29. margin: 0;
  30. }
  31. .index_list_categories {
  32. padding: 1rem;
  33. margin-bottom: 2rem;
  34. }
  35. .index_list_categories a:hover {
  36. color: var(--tool-link-hover-color);
  37. }
  38. /*.index_list_categories a,a:link{
  39. color: var(--main-color);
  40. }*/
  41. .index_list_categories button {
  42. border: none;
  43. }
  44. .card li {
  45. white-space: unset;
  46. }
  47. .card code {
  48. white-space: unset;
  49. }
  50. .teacher_photo {
  51. width: 230px;
  52. height: 178px;
  53. background-color: gray;
  54. border-radius: 8px;
  55. }
  56. .teacher_text {
  57. padding: 0 5px;
  58. }
  59. .teacher_text .title {
  60. font-size: 120%;
  61. font-weight: 700;
  62. margin: 0.5em 0;
  63. }
  64. .teacher_intro {
  65. display: -webkit-box;
  66. -webkit-box-orient: vertical;
  67. overflow: hidden;
  68. text-overflow: ellipsis;
  69. width: 100%;
  70. -webkit-line-clamp: 3;
  71. }
  72. #course_list_complete .card,
  73. #course_list_ongoing .card {
  74. height: 120px;
  75. padding: 0;
  76. display: grid;
  77. grid-template-columns: 120px 1fr;
  78. }
  79. .course_block {
  80. background-color: #f5f5f5;
  81. padding: 1rem;
  82. }
  83. .course_right {
  84. padding: 10px;
  85. display: flex;
  86. flex-direction: column;
  87. width: calc(100% - 10px);
  88. }
  89. .card_photo {
  90. border-radius: 20px 0 0 20px;
  91. }
  92. .course_right .title a {
  93. font-size: 120%;
  94. font-weight: 700;
  95. display: -webkit-box;
  96. -webkit-box-orient: vertical;
  97. overflow: hidden;
  98. text-overflow: ellipsis;
  99. -webkit-line-clamp: 2;
  100. color: var(--main-color);
  101. }
  102. .subtitle {
  103. margin-top: auto;
  104. display: -webkit-box;
  105. -webkit-box-orient: vertical;
  106. overflow: hidden;
  107. text-overflow: ellipsis;
  108. width: 100%;
  109. -webkit-line-clamp: 2;
  110. }
  111. @media screen and (min-width:800px) {
  112. .index_list_categories {
  113. max-width: 760px;
  114. margin: 0 auto 3rem auto;
  115. }
  116. .content_inner {
  117. grid-template-columns: 230px 230px 230px;
  118. }
  119. h3 {
  120. font-size: 22px;
  121. }
  122. .course_block h3 {
  123. text-align: center;
  124. margin: 1em 0;
  125. }
  126. #course_list_ongoing,
  127. #course_list_complete {
  128. max-width: 600px;
  129. margin: 0 auto;
  130. }
  131. }
  132. @media screen and (min-width:1020px) {
  133. .index_list_categories {
  134. max-width: 1020px;
  135. }
  136. .content_inner {
  137. grid-template-columns: 230px 230px 230px 230px;
  138. }
  139. }
  140. </style>
  141. <div class="index_inner">
  142. <div class="index_list_categories">
  143. <div class="title_bar">
  144. <h3><?php echo $_local->gui->speaker ?></h3>
  145. <span class="title_more"><a href="../course"><?php echo $_local->gui->more ?></a></span>
  146. </div>
  147. <div class="content">
  148. <div id="course_list_new" class="content_inner">
  149. </div>
  150. </div>
  151. </div>
  152. <script>
  153. $.get("../course/teacher_list.php", function(data, status) {
  154. let xDiv = document.getElementById("course_list_new");
  155. if (xDiv) {
  156. xDiv.innerHTML = data;
  157. }
  158. });
  159. </script>
  160. <div class="course_block">
  161. <h3>
  162. <?php echo $_local->gui->in_progress; ?>
  163. </h3>
  164. <div id="course_list_ongoing">
  165. </div>
  166. </div>
  167. <div class="course_block">
  168. <h3>
  169. <?php echo $_local->gui->already_over; ?>
  170. </h3>
  171. <div id="course_list_complete">
  172. </div>
  173. </div>
  174. <script>
  175. var speaker = "<?php echo $_local->gui->speaker . ':' . $row['teacher'] ?>";
  176. $.get("../course/course_list.php", function(data, status) {
  177. let arrData = JSON.parse(data);
  178. let html_complete = "";
  179. let html_ongoing = "";
  180. for (const iterator of arrData) {
  181. let html = "";
  182. html += '<div class="card">';
  183. html += '<div style="height:120px;width:120px;">';
  184. html += '<img src="../../tmp/images/course/' + iterator.id + '.jpg" alt="cover" width="120" height="120" class="card_photo">';
  185. html += '</div>';
  186. html += '<div class="course_right">';
  187. html += '<div class="title"><a href="../course/course.php?id=' + iterator.id + '">' + iterator.title + '</a></div>';
  188. //協助補上代碼:
  189. html += '<div class="author">主講人:</div>';
  190. html += '<div class="subtitle">' + iterator.subtitle + '</div>';
  191. /*let summary = "";
  192. try {
  193. summary = marked(iterator.summary);
  194. } catch (e) {}
  195. html += '<div class="summary">' + summary + '</div>';*/
  196. html += '</div>';
  197. html += '</div>';
  198. if (iterator.status == 40) {
  199. html_complete += html;
  200. } else if (iterator.status == 30 || iterator.status == 20) {
  201. html_ongoing += html;
  202. }
  203. }
  204. $("#course_list_complete").html(html_complete);
  205. $("#course_list_ongoing").html(html_ongoing);
  206. $("img").one("error", function() {
  207. $(this).attr("src", "../course/img/default.jpg");
  208. });
  209. });
  210. </script>
  211. </div>
  212. <?php
  213. include "../pcdl/html_foot.php";
  214. ?>