index.php 5.5 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. border-radius: 20px 0 0 20px;
  106. }
  107. .course_right .title a {
  108. font-size: 120%;
  109. font-weight: 700;
  110. display: -webkit-box;
  111. -webkit-box-orient: vertical;
  112. overflow: hidden;
  113. text-overflow: ellipsis;
  114. -webkit-line-clamp: 2;
  115. color: var(--main-color);
  116. }
  117. .subtitle {
  118. margin-top: auto;
  119. display: -webkit-box;
  120. -webkit-box-orient: vertical;
  121. overflow: hidden;
  122. text-overflow: ellipsis;
  123. width: 100%;
  124. -webkit-line-clamp: 2;
  125. }
  126. @media screen and (min-width:800px) {
  127. .index_list_categories {
  128. max-width: 760px;
  129. margin: 0 auto 3rem auto;
  130. }
  131. .content_inner {
  132. grid-template-columns: 230px 230px 230px;
  133. }
  134. h3 {
  135. font-size: 22px;
  136. }
  137. .course_block h3 {
  138. text-align: center;
  139. margin: 1em 0;
  140. }
  141. #course_list_ongoing,
  142. #course_list_complete {
  143. max-width: 600px;
  144. margin: 0 auto;
  145. }
  146. }
  147. @media screen and (min-width:1020px) {
  148. .index_list_categories {
  149. max-width: 1020px;
  150. }
  151. .content_inner {
  152. grid-template-columns: 230px 230px 230px 230px;
  153. }
  154. }
  155. </style>
  156. <div class="index_inner">
  157. <div id="course_head_bar" class="collect_head_bar">
  158. <div class="section_inner">
  159. <h1>課程</h1>
  160. <div style="max-width:30em">來自世界個地的巴利專家詳細解析聖典</div>
  161. </div>
  162. </div>
  163. <div class="index_list_categories">
  164. <div class="title_bar">
  165. <h3><?php echo $_local->gui->speaker ?></h3>
  166. <span class="title_more"><a href="../course"><?php echo $_local->gui->more ?></a></span>
  167. </div>
  168. <div class="content">
  169. <div id="course_list_new" class="content_inner">
  170. </div>
  171. </div>
  172. </div>
  173. <script>
  174. $.get("../course/teacher_list.php", function(data, status) {
  175. let xDiv = document.getElementById("course_list_new");
  176. if (xDiv) {
  177. xDiv.innerHTML = data;
  178. }
  179. });
  180. </script>
  181. <div class="course_block">
  182. <h3>
  183. <?php echo $_local->gui->in_progress; ?>
  184. </h3>
  185. <div id="course_list_ongoing">
  186. </div>
  187. </div>
  188. <div class="course_block">
  189. <h3>
  190. <?php echo $_local->gui->already_over; ?>
  191. </h3>
  192. <div id="course_list_complete">
  193. </div>
  194. </div>
  195. <script>
  196. var speaker = "<?php echo $_local->gui->speaker . ':' . $row['teacher'] ?>";
  197. $.get("../course/course_list.php", function(data, status) {
  198. let arrData = JSON.parse(data);
  199. let html_complete = "";
  200. let html_ongoing = "";
  201. for (const iterator of arrData) {
  202. let html = "";
  203. html += '<div class="card">';
  204. html += '<div style="height:120px;width:120px;">';
  205. html += '<img src="../../tmp/images/course/' + iterator.id + '.jpg" alt="cover" width="120" height="120" class="card_photo">';
  206. html += '</div>';
  207. html += '<div class="course_right">';
  208. html += '<div class="title"><a href="../course/course.php?id=' + iterator.id + '">' + iterator.title + '</a></div>';
  209. //協助補上代碼:
  210. html += '<div class="author">'+gLocal.gui.speaker+':';
  211. html += "<a href='../uhome/course.php?userid="+iterator.teacher+"'>"
  212. html += iterator.teacher_info.nickname;
  213. html += "</a>";
  214. html +='</div>';
  215. html += '<div class="subtitle">' + iterator.subtitle + '</div>';
  216. /*let summary = "";
  217. try {
  218. summary = marked(iterator.summary);
  219. } catch (e) {}
  220. html += '<div class="summary">' + summary + '</div>';*/
  221. html += '</div>';
  222. html += '</div>';
  223. if (iterator.status == 40) {
  224. html_complete += html;
  225. } else if (iterator.status == 30 || iterator.status == 20) {
  226. html_ongoing += html;
  227. }
  228. }
  229. $("#course_list_complete").html(html_complete);
  230. $("#course_list_ongoing").html(html_ongoing);
  231. $("img").one("error", function() {
  232. $(this).attr("src", "../course/img/default.jpg");
  233. });
  234. });
  235. </script>
  236. </div>
  237. <?php
  238. include "../pcdl/html_foot.php";
  239. ?>