Testing.cshtml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  1. 
  2. @{
  3. ViewBag.Title = "Learning";
  4. Layout = "~/Views/Shared/_LayoutLearning.cshtml";
  5. }
  6. @using NEducation.NEduService;
  7. @using NEducation.Content.Texts;
  8. @model NEducation.Models.GrammarModel
  9. <link href="~/Content/assets/css/learning-complete.css" rel="stylesheet" type="text/css" />
  10. <link type="text/css" rel="stylesheet" href="~/Content/assets/css/animate.css" />
  11. <link href="~/Content/assets/css/kontext.css" rel="stylesheet" type="text/css" />
  12. <link href="~/Content/assets/css/testing.css" rel="stylesheet" type="text/css" />
  13. <link href="~/Content/assets/css/animate.css" rel="stylesheet" type="text/css" />
  14. <input type='hidden' id='hidden-userid' value='477879' />
  15. <input type='hidden' id='hidden-topicid' value='97' />
  16. <input type='hidden' id='hidden-parent' value='95' />
  17. <input type='hidden' id='hidden-parent-name' value='Grammar' />
  18. <input type='hidden' id='hidden-topic-name' value='TestingResult' />
  19. <input type="hidden" id="back-link" value="/Grammar/Lesson" msg="Bạn chắn chắn muốn thoát? Quá trình làm bài sẽ không được lưu." name="">
  20. <script type="text/javascript">
  21. $(document).ready(function () {
  22. $('.button-review, .button-learning-continue, .button-learning-relearn').click(function () {
  23. var isReview = $(this).attr('is_review');
  24. if (isReview == undefined || isReview != 1) {
  25. if ($(this).hasClass('button-learning-relearn')) {
  26. $('#learning-modal .learning-modal-btn a.learning-modal-btn-learning').text('@NEducation.Content.Texts.Lang.Relearn');
  27. $('#learning-modal .learning-modal-btn a.learning-modal-btn-testing').html('@NEducation.Content.Texts.Lang.Retest');
  28. } else {
  29. $('#learning-modal .learning-modal-btn a.learning-modal-btn-learning').text('Học tiếp');
  30. $('#learning-modal .learning-modal-btn a.learning-modal-btn-testing').text('Kiểm tra');
  31. }
  32. if ($(this).hasClass('button-learning-continue')) {
  33. var text = $(this).attr('text');
  34. if (text != undefined) {
  35. $('#learning-modal .learning-modal-btn a.learning-modal-btn-learning').text(text);
  36. }
  37. }
  38. $('#learning-modal .learning-modal-btn a.learning-modal-btn-result').css('display', 'none');
  39. } else {
  40. $('#learning-modal .learning-modal-btn a.learning-modal-btn-result').css('display', 'block');
  41. var resultLink = $(this).attr('result_link');
  42. $('#learning-modal .learning-modal-btn a.learning-modal-btn-result').attr('href', resultLink);
  43. $('#learning-modal .learning-modal-btn a.learning-modal-btn-learning').text('@NEducation.Content.Texts.Lang.Relearn');
  44. $('#learning-modal .learning-modal-btn a.learning-modal-btn-testing').html('@NEducation.Content.Texts.Lang.Retest');
  45. }
  46. var isTesting = $(this).attr('is_testing');
  47. if (isTesting != undefined && isTesting == 1) {
  48. $('#learning-modal .learning-modal-btn a.learning-modal-btn-learning').css('display', 'none');
  49. } else {
  50. $('#learning-modal .learning-modal-btn a.learning-modal-btn-learning').css('display', 'block');
  51. }
  52. var isUnknow = $(this).attr('is_unknow');
  53. var isFinish = $(this).attr('is_finish');
  54. var topic = $(this).attr('topic');
  55. var parent = $(this).attr('parent');
  56. $('#learning-modal-info').attr('is_unknow', isUnknow);
  57. $('#learning-modal-info').attr('is_finish', isFinish);
  58. $('#learning-modal-info').attr('is_review', isReview);
  59. $('#learning-modal-info').attr('topic', topic);
  60. $('#learning-modal-info').attr('parent', parent);
  61. $('#learning-modal').modal();
  62. if (isFinish == 1 && isUnknow == 0) {
  63. $('.learning-modal-btn-unknow').css('display', 'none');
  64. $('#learning-modal-btn-unknow-content').css('display', 'none');
  65. } else {
  66. $('.learning-modal-btn-unknow').css('display', 'block');
  67. if (isFinish == 0) {
  68. var unknowContent = $('#learning-modal-btn-unknow-content').attr('unfinish');
  69. } else {
  70. var unknowContent = $('#learning-modal-btn-unknow-content').attr('unknow');
  71. }
  72. $('.learning-modal-btn-unknow').text(unknowContent);
  73. }
  74. //testing link
  75. //var testingLink = $('.learning-modal-btn-testing').attr('link');
  76. //$('.learning-modal-btn-testing').attr('href', testingLink + '/' + topic + '-' + parent);
  77. });
  78. $('.button-learning-now').click(function () {
  79. var isReview = 0;
  80. var isUnknow = $(this).attr('is_unknow');
  81. var isFinish = $(this).attr('is_finish');
  82. if (isFinish == undefined) {
  83. isFinish = 1;
  84. }
  85. var topic = $(this).attr('topic');
  86. var parent = $(this).attr('parent');
  87. $('#learning-modal-info').attr('is_unknow', isUnknow);
  88. $('#learning-modal-info').attr('is_finish', isFinish);
  89. $('#learning-modal-info').attr('is_review', isReview);
  90. $('#learning-modal-info').attr('topic', topic);
  91. $('#learning-modal-info').attr('parent', parent);
  92. if (isFinish == 1 && isUnknow == 0) {
  93. $('.learning-modal-btn-unknow').css('display', 'none');
  94. $('#learning-modal-btn-unknow-content').css('display', 'none');
  95. } else {
  96. $('.learning-modal-btn-unknow').css('display', 'block');
  97. if (isFinish == 1) {
  98. var unknowContent = $('#learning-modal-btn-unknow-content').attr('unknow');
  99. } else {
  100. var unknowContent = $('#learning-modal-btn-unknow-content').attr('unfinish');
  101. }
  102. $('.learning-modal-btn-unknow').text(unknowContent);
  103. }
  104. $('#learning-question-modal').modal();
  105. });
  106. $('.button-learning').click(function () {
  107. var topic = $(this).attr('topic');
  108. var parent = $(this).attr('parent');
  109. $('#learning-modal-info').attr('topic', topic);
  110. $('#learning-modal-info').attr('parent', parent);
  111. var isUnknow = $(this).attr('is_unknow');
  112. var isFinish = $(this).attr('is_finish');
  113. if (isUnknow != undefined) {
  114. $('#learning-modal-info').attr('is_unknow', isUnknow);
  115. } else {
  116. isUnknow = 0;
  117. }
  118. if (isFinish != undefined) {
  119. $('#learning-modal-info').attr('is_finish', isFinish);
  120. } else {
  121. isFinish = 1;
  122. }
  123. if (isFinish == 1 && isUnknow == 0) {
  124. $('.learning-modal-btn-unknow').css('display', 'none');
  125. $('#learning-modal-btn-unknow-content').css('display', 'none');
  126. } else {
  127. $('.learning-modal-btn-unknow').css('display', 'block');
  128. if (isFinish == 1) {
  129. var unknowContent = $('#learning-modal-btn-unknow-content').attr('unknow');
  130. } else {
  131. var unknowContent = $('#learning-modal-btn-unknow-content').attr('unfinish');
  132. }
  133. $('.learning-modal-btn-unknow').text(unknowContent);
  134. }
  135. });
  136. });
  137. </script>
  138. <input type="hidden" name="" id="learning-modal-info" is_unknow="0" is_finish="1" is_review="0" topic="0" parent="0" />
  139. <script type="text/javascript">
  140. $(document).ready(function () {
  141. $('#learning-question-modal a').click(function () {
  142. var link = $(this).attr('link');
  143. var topic = $('#learning-modal-info').attr('topic');
  144. var parent = $('#learning-modal-info').attr('parent');
  145. var url = link + '/' + topic + '-' + parent;
  146. $('#learning-modal-form').attr('action', url);
  147. $('.learning-modal-btn-unknow').attr('href', (url + '-unknow'));
  148. $('.learning-modal-btn-all').attr('href', url);
  149. });
  150. });
  151. </script>
  152. <script type="text/javascript">
  153. $(document).ready(function () {
  154. $('.learning-modal-btn-choosing').click(function () {
  155. var topic = $('#learning-modal-info').attr('topic');
  156. var parent = $('#learning-modal-info').attr('parent');
  157. $.ajax({
  158. url: urlConfig("choose-learn-words"),
  159. data: {
  160. topic: topic,
  161. parent: parent
  162. },
  163. type: "POST"
  164. }).success(function (data) {
  165. if (data[0] != 0) {
  166. $('#modal-choose-word .choose-word-content-cover').html(data);
  167. $('#modal-choose-word').modal();
  168. }
  169. });
  170. });
  171. });
  172. </script>
  173. <script type="text/javascript">
  174. $(document).on('click', '.choose-word-title .choose-all .choose-word-check', function () {
  175. if ($(this).hasClass('word-checked')) {
  176. $(this).removeClass('word-checked');
  177. $('.choose-word-content .word-item .item-check input[type="checkbox"]').prop('checked', false);
  178. } else {
  179. $(this).addClass('word-checked');
  180. $('.choose-word-content .word-item .item-check input[type="checkbox"]').prop('checked', true);
  181. }
  182. $('.choose-word-content .word-item .item-check input[type="checkbox"]').trigger('change');
  183. });
  184. $(document).on('change', '.choose-word-content .word-item .item-check input[type="checkbox"]', function () {
  185. var total = $(".choose-word-content .word-item .item-check input[type='checkbox']").length;
  186. var totalCheck = $(".choose-word-content .word-item .item-check input[type='checkbox']:checked").length;
  187. if (total == totalCheck) {
  188. $(".choose-word-title .choose-all .choose-word-check").addClass('word-checked');
  189. } else {
  190. $(".choose-word-title .choose-all .choose-word-check").removeClass('word-checked');
  191. }
  192. $(".choose-word-title .number").text(totalCheck < 10 ? '0' + totalCheck : totalCheck);
  193. });
  194. </script>
  195. <!--******** AUDIO MAIN ******** -->
  196. <audio id="learning-main-audio">
  197. <source class="src" src="" type="audio/mpeg">
  198. </audio>
  199. <div class="testing-container">
  200. <!-- Process -->
  201. <div class="testing-process">
  202. <span class="testing-process-bar learning-main-process-value"></span>
  203. </div>
  204. <div class="testing-container-cover">
  205. <div class="testing-body">
  206. <div class="testing-body-cover" total="@Model.questions.Count">
  207. <div class="testing-countdown" id="testing-countdown">
  208. <span class="testing-countdown-number">15</span>
  209. <svg>
  210. <circle class="circle-shadow" r="16" cx="17" cy="17"></circle>
  211. <circle class="circle" r="16" cx="17" cy="17" stroke="url(#gradientPercent)" style="stroke-dashoffset: -101px;"></circle>
  212. <linearGradient id="gradientPercent" gradientUnits="userSpaceOnUse" x1="0" y1="0" x2="0" y2="34">
  213. <stop offset="0" style="stop-color:#F88600"></stop>
  214. <stop offset="0.5" style="stop-color:#FFB500"></stop>
  215. <stop offset="1" style="stop-color:#FAD300"></stop>
  216. </linearGradient>
  217. </svg>
  218. </div><!--pronounce - sound => word -->
  219. @for (int i = 0; i < Model.questions.Count; i++)
  220. {
  221. NEducation.Code.Question question = Model.questions[i];
  222. //String correct = (question.answerTrue == "1" ? question.answer1 :
  223. // question.answerTrue == "2" ? question.answer2 :
  224. // question.answerTrue == "3" ? question.answer3 : question.answer4);
  225. // multi choice
  226. var listCorrect = question.answerTrue.Split(',');
  227. <div class="testing-exercise @(@i == 0? " exercise-current" : "")" index="@i" questionId="@question.id" typeQuestion="guessing"
  228. correctAnswer="@question.answerTrue" time="15" type="4">
  229. <div class="testing-exercise-flashcard">
  230. <div class="flash-card-viewport">
  231. <div class="flash-card-box" id="learning-theory-box-@i" index="@i">
  232. <figure class="slide jbs-current">
  233. <div class="testing-exercise-content">
  234. <p class="testing-exercise-title">
  235. @*@NEducation.Content.Texts.Lang.QuestionBegin*@
  236. @question.description
  237. </p>
  238. <div class="testing-exercise-quesiton">
  239. @*<p class="question-definition">@question.content</p>*@
  240. @{ if (question.contentType == NEducation.Controllers.UtilsController.GetContentType.AUDIO_FILE ||
  241. question.contentType == NEducation.Controllers.UtilsController.GetContentType.AUDIO_LINK)
  242. {
  243. <div class="learning-theory-flashcard question-definition">
  244. <a class="card-content-sound main-sound-play" href="javascript:void(0)"
  245. sound_url="@(question.content)"></a>
  246. </div>
  247. }
  248. else if (question.contentType == NEducation.Controllers.UtilsController.GetContentType.VIDEO_LINK)
  249. {
  250. <iframe class="iframe-testing-video" width="100%" height="77%" src="@question.content" autoplay=false frameborder="0" allowfullscreen style="border-radius:10px;"></iframe>
  251. }
  252. else if (question.contentType == NEducation.Controllers.UtilsController.GetContentType.VIDEO_FILE)
  253. {
  254. <video class="iframe-testing-video" width="100%" height="77%" src="@question.content" controls>
  255. </video>
  256. }
  257. else if (question.contentType == NEducation.Controllers.UtilsController.GetContentType.TEXT_TYPE)
  258. {
  259. <p class="question-definition">@question.content</p>
  260. }
  261. else if (question.contentType == NEducation.Controllers.UtilsController.GetContentType.PICTURE_FILE)
  262. {
  263. <img style="width:100%;height:75%;padding:0 30% 0 30%" src="@question.content" />
  264. }
  265. }
  266. </div>
  267. </div>
  268. </figure>
  269. <figure class="slide jbs-current">
  270. <div class="testing-exercise-result" img_url="" synset="400518641" word="1103">
  271. <div class="testing-exercise-result-cover">
  272. <div class="result-img">
  273. @*<img alt="img" src="" />*@
  274. </div>
  275. <div class="result-content">
  276. <p class="result-content-label">
  277. @Lang.RightAnswer:
  278. @*Đáp án:*@
  279. </p>
  280. @for (int j = 0; j < listCorrect.Length; j++)
  281. {
  282. var correctAnswer = listCorrect[j] == "1" ? question.answer1 :
  283. listCorrect[j] == "2" ? question.answer2 :
  284. listCorrect[j] == "3" ? question.answer3 : question.answer4;
  285. <p class="result-content-text-main">
  286. @correctAnswer <span class="result-content-type">n</span>
  287. </p>
  288. }
  289. @*<p class="result-content-text-main">
  290. @correct <span class="result-content-type">n</span>
  291. </p>*@
  292. </div>
  293. </div>
  294. </div>
  295. </figure>
  296. </div>
  297. </div>
  298. </div>
  299. <div class="testing-exercise-answer ">
  300. <div class="answer-cover">
  301. <a class="answer-guessing no-answer" href="javascript:void(0)" val="1">
  302. <span class="guessing-text">@question.answer1</span>
  303. </a>
  304. <a class="answer-guessing no-answer" href="javascript:void(0)" val="2">
  305. <span class="guessing-text">@question.answer2</span>
  306. </a>
  307. <a class="answer-guessing no-answer" href="javascript:void(0)" val="3">
  308. <span class="guessing-text">@question.answer3</span>
  309. </a>
  310. <a class="answer-guessing no-answer" href="javascript:void(0)" val="4" hideanswer="@question.answer1">
  311. <span class="guessing-text">@question.answer4</span>
  312. </a>
  313. </div>
  314. </div>
  315. </div>
  316. }
  317. </div>
  318. </div>
  319. </div>
  320. </div>
  321. <!--******** AUDIO MAIN ******** -->
  322. <audio id="learning-main-audio">
  323. <source class="src" src="" type="audio/mpeg">
  324. </audio>
  325. <audio id="audio-answer-right">
  326. <source class="src" src="~/Content/assets/sounds/right_answer.mp3" type="audio/mpeg">
  327. </audio>
  328. <audio id="audio-answer-wrong">
  329. <source class="src" src="~/Content/assets/sounds/wrong_answer.mp3" type="audio/mpeg">
  330. </audio>
  331. <audio id="normal-time-sound">
  332. <source class="src" src="~/Content/assets/sounds/second_tick.mp3" type="audio/mpeg">
  333. </audio>
  334. <audio id="warning-time-sound">
  335. <source class="src" src="~/Content/assets/sounds/clock_tick.mp3" type="audio/mpeg">
  336. </audio>
  337. <script type="text/javascript" src="~/Content/assets/js/voca/box-slider.jquery.js"></script>
  338. <script type="text/javascript" src="~/Content/assets/js/voca/box-slider-fx-scroll-3d.js"></script>
  339. <script type="text/javascript" src="~/Content/assets/js/voca/kontext.js"></script>
  340. <script type="text/javascript" src="~/Content/assets/js/voca/learning-main.js"></script>
  341. <script type="text/javascript" src="~/Content/assets/js/voca/testing.js"></script>
  342. <!-- Modal -->
  343. <div class="modal fade" id="modal-pin-word" tabindex="-1"></div>
  344. <script>
  345. runCountdown();
  346. updateProcess();
  347. </script>