index.php 5.6 KB

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