english_reading_setting.php 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <link rel="stylesheet" href="/fonts/fpdf/iconfont.css"/>
  2. <link rel="stylesheet" href="/css/alert.css"/>
  3. <style>
  4. .color-red{
  5. color: red;
  6. }
  7. .en-tfb-grade-1 .date>span{
  8. margin-right: 40px;
  9. }
  10. .option-wrap{
  11. margin-top: 20px;
  12. min-width: 600px;
  13. }
  14. .option-name{
  15. display: inline-block;
  16. width: 100px;
  17. vertical-align: top;
  18. margin-top: 10px;
  19. }
  20. .option-con{
  21. display: inline-block;
  22. width: 80%;
  23. min-width: 490px;
  24. padding: 10px;
  25. border: 1px solid #ccc;
  26. }
  27. .option-con>span{
  28. display: inline-block;
  29. margin-right: 20px;
  30. margin-top:10px;
  31. line-height: 1rem;
  32. cursor: pointer;
  33. }
  34. .select-grade{
  35. width: 150px;
  36. line-height: 30px;
  37. margin-bottom: 10px;
  38. }
  39. .option-con-class label{
  40. display: inline-block;
  41. margin-right: 20px;
  42. }
  43. .active{
  44. color: #07af66;
  45. }
  46. .btn-start{
  47. display: inline-block;
  48. margin-top: 20px;
  49. margin-left: 100px;
  50. padding: 10px 30px;
  51. color: #fff;
  52. background-color: #07af66;
  53. cursor: pointer;
  54. }
  55. .en-tfb-grade-1{
  56. margin-left: 20px;
  57. }
  58. </style>
  59. <div class="main-content-inner">
  60. <!-- 导航栏开始-->
  61. <?php include(Yii::app()->basePath.'/views/layouts/view_production_navigation.php');?>
  62. <!-- 导航栏结束-->
  63. <div class="en-tfb-grade-1">
  64. <h2>外刊宝生成</h2>
  65. <p class="color-red">提示:每个班级每周允许生成一次,请根据实际教学进度进行选择设置</p>
  66. <p class="date">
  67. <span>当前时间:</span>
  68. <span><?php echo $year;?>年<?php echo $month;?>月第<?php echo $week;?>周</span>
  69. <span class="btn-start fr" onclick="location='/index.php/print/englishReadingTime'" style="margin: -9px 200px 0px 0!important;">时文阅读</span>
  70. <span class="btn-start fr" onclick="location='/index.php/print/englishReading3'" style="margin: -9px 15px 0px 0!important;">主题语境设置</span>
  71. </p>
  72. <div class="option-wrap">
  73. <span class="option-name">版本:</span>
  74. <div class="option-con" id="optionEdition">
  75. <?php if(isset($textbookNames) && $textbookNames):?>
  76. <?php $no =1;?>
  77. <?php foreach($textbookNames as $k=>$v):?>
  78. <span code="<?php echo $k;?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v;?></span>
  79. <?php $no++;?>
  80. <?php endforeach;?>
  81. <?php endif;?>
  82. </div>
  83. </div>
  84. <div class="option-wrap">
  85. <span class="option-name">模块:</span>
  86. <div class="option-con" id="optionModular">
  87. <?php if(isset($moduleNames) && $moduleNames):?>
  88. <?php $no =1;?>
  89. <?php foreach($moduleNames as $k=>$v):?>
  90. <span code="<?php echo $k;?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v;?></span>
  91. <?php $no++;?>
  92. <?php endforeach;?>
  93. <?php endif;?>
  94. </div>
  95. </div>
  96. <div class="option-wrap">
  97. <span class="option-name">单元:</span>
  98. <div class="option-con" id="optionUnit">
  99. <?php if(isset($unitNames) && $unitNames):?>
  100. <?php $no =1;?>
  101. <?php foreach($unitNames as $k=>$v):?>
  102. <span code="<?php echo $k;?>" class="<?php echo $no==1?'active':'';?>"><?php echo $v;?></span>
  103. <?php $no++;?>
  104. <?php endforeach;?>
  105. <?php endif;?>
  106. </div>
  107. </div>
  108. <div class="option-wrap">
  109. <span class="option-name">班级:</span>
  110. <div class="option-con">
  111. <div>
  112. <select name="grade" class="select-grade">
  113. <option value="1" selected>高一</option>
  114. <option value="2">高二</option>
  115. <option value="3">高三</option>
  116. </select>
  117. </div>
  118. <div class="option-con-class" id="optionClass">
  119. </div>
  120. </div>
  121. </div>
  122. <div class="option-wrap">
  123. <span class="option-name">外刊类别:</span>
  124. <div class="option-con">
  125. <div><input type="radio" name="reading_type" value="1" checked="checked">个性外刊<span class="color-red">(班级同学语篇不完全相同,根据学生水平个性化)</span></div>
  126. <div><input type="radio" name="reading_type" value="2">共性外刊<span class="color-red">(班级同学语篇完全相同,老师可讲解)</span></div>
  127. </div>
  128. </div>
  129. <div class="option-wrap reading-level" style="display:none">
  130. <span class="option-name">外刊分级:</span>
  131. <div class="option-con">
  132. <div><input type="radio" name="reading_level" value="1" checked="checked">尖子班(优秀生)</div>
  133. <div><input type="radio" name="reading_level" value="2">培优班(中等生)</div>
  134. <div><input type="radio" name="reading_level" value="3">提高班(学困生)</div>
  135. </div>
  136. </div>
  137. <div class="option-wrap">
  138. <span class="option-name">下载方式:</span>
  139. <div class="option-con">
  140. <span><input type="radio" name="is_answer_separate" value="0" checked="checked">合并题目和答案</span>
  141. <span><input type="radio" name="is_answer_separate" value="1" >分离题目和答案</span>
  142. </div>
  143. </div>
  144. <span class="btn-start" id="confirm" active="true">开始生成</span>
  145. <span class="red class-msg" style="margin-left:20px"></span>
  146. </div>
  147. </div>
  148. <script src="/js/jquery.ajaxfileupload.js"></script>
  149. <script type="text/javascript">
  150. $(document).ready(function () {
  151. getClassByGrade(1);
  152. var optionData={
  153. edition:0,
  154. modular:0,
  155. unit:0,
  156. class:[],
  157. }
  158. //获取版本模块单元
  159. // 版本点击
  160. $("#optionEdition>span").on("click", function(event) {
  161. $("#optionEdition>span").removeClass('active')
  162. $(this).addClass('active');
  163. var code = $(this).attr("code");
  164. optionData.edition=code;
  165. console.log('版本',code)
  166. });
  167. // 模块点击
  168. $("#optionModular>span").on("click", function(event) {
  169. $("#optionModular>span").removeClass('active')
  170. $(this).addClass('active');
  171. var code = $(this).attr("code");
  172. optionData.modular=code;
  173. console.log('模块',code)
  174. });
  175. // 单元点击
  176. $("body").delegate("#optionUnit>span", "click", function() {
  177. // $("#optionUnit>span").on("click", function(event) {
  178. $("#optionUnit>span").removeClass('active')
  179. $(this).addClass('active');
  180. var code = $(this).attr("code");
  181. optionData.unit=code;
  182. console.log('单元',code)
  183. });
  184. // 选择年级
  185. $(".select-grade").change(function() {
  186. console.log($(this).val())
  187. });
  188. // 单选按钮
  189. $("input[name='option-class']").change(function() {
  190. getsClassSelected();
  191. });
  192. function getsClassSelected() {
  193. optionData.class=[];
  194. var selectedData = $("input[name='option-class']:checked"); //获取所以选中学生
  195. for (var i = 0; i < selectedData.length; i++) {
  196. code = $(selectedData[i]).val();
  197. optionData.class.push(code);
  198. }
  199. };
  200. //
  201. $("body").delegate("#optionEdition span", "click", function() {
  202. // $('#optionEdition span').on("click", function(event) {
  203. var textbookId = $(this).attr("code");
  204. if(textbookId){
  205. $.ajax({
  206. url: "<?php echo $this->createUrl('print/ajaxGetModuleAndUnit');?>",
  207. type: "POST",
  208. dataType: "json",
  209. data: {
  210. textbookId: textbookId
  211. },
  212. success: function (data) {
  213. console.log(data);
  214. var htmlModule = '';
  215. var htmlUnit = '';
  216. if(data.moduleNames){
  217. var a = 1;
  218. for(var i in data.moduleNames){
  219. if(a == 1){
  220. htmlModule += '<span code="'+i+'" class="active">'+data.moduleNames[i]+'</span>';
  221. }else{
  222. htmlModule += '<span code="'+i+'">'+data.moduleNames[i]+'</span>';
  223. }
  224. a++;
  225. }
  226. }
  227. if(data.unitNames){
  228. var a = 1;
  229. for(var i in data.unitNames){
  230. if(a == 1){
  231. htmlUnit += '<span code="'+i+'" class="active">'+data.unitNames[i]+'</span>';
  232. }else{
  233. htmlUnit += '<span code="'+i+'">'+data.unitNames[i]+'</span>';
  234. }
  235. a++;
  236. }
  237. }
  238. $('#optionModular').html(htmlModule);
  239. $('#optionUnit').html(htmlUnit);
  240. }
  241. });
  242. }
  243. })
  244. $("body").delegate("#optionModular span", "click", function() {
  245. $("#optionModular>span").removeClass('active')
  246. $(this).addClass('active');
  247. var code = $(this).attr("code");
  248. optionData.modular=code;
  249. // $('#optionModular span').on("click", function(event) {
  250. var moduleId = $(this).attr("code");
  251. var textbookId = $('#optionEdition span.active').attr("code");
  252. if(textbookId && moduleId){
  253. $.ajax({
  254. url: "<?php echo $this->createUrl('print/ajaxGetUnitByModuleId');?>",
  255. type: "POST",
  256. dataType: "json",
  257. data: {
  258. textbookId: textbookId,
  259. moduleId:moduleId
  260. },
  261. success: function (data) {
  262. console.log(data);
  263. var htmlUnit = '';
  264. if(data.unitNames){
  265. var a = 1;
  266. for(var i in data.unitNames){
  267. if(a == 1){
  268. htmlUnit += '<span code="'+i+'" class="active">'+data.unitNames[i]+'</span>';
  269. }else{
  270. htmlUnit += '<span code="'+i+'">'+data.unitNames[i]+'</span>';
  271. }
  272. a++;
  273. }
  274. }
  275. $('#optionUnit').html(htmlUnit);
  276. }
  277. });
  278. }
  279. })
  280. $('.select-grade').change(function(){
  281. var grade = $(this).val();
  282. getClassByGrade(grade);
  283. });
  284. $("body").delegate("#confirm[active='true']", "click", function() {
  285. var This = $(this);
  286. This.attr("active","false");
  287. var error = [];
  288. var selectClassIds = [];
  289. var grade = parseInt($('.select-grade').val());
  290. var textbookId = parseInt($('#optionEdition span.active').attr("code"));
  291. var moduleId = parseInt($('#optionModular span.active').attr("code"));
  292. var unitId = parseInt($('#optionUnit span.active').attr("code"));
  293. var moduleName = $('#optionModular span.active').text();
  294. var unitName = $('#optionUnit span.active').text();
  295. var type = parseInt($('input[name="reading_type"]:checked').val());
  296. var level = parseInt($('input[name="reading_level"]:checked').val());
  297. var isAnswerSeparate = $("input[name='is_answer_separate']:checked").val();
  298. $('#optionClass input:checked').each(function(k,v){
  299. if($(this).attr("status") == 0){
  300. selectClassIds.push($(this).val());
  301. }
  302. });
  303. if(selectClassIds.length == 0){
  304. error.push("请选择班级");
  305. }
  306. if(grade <= 0 || !grade){
  307. error.push("请选择年级");
  308. }
  309. if(textbookId <= 0 || !textbookId){
  310. error.push("请选择版本");
  311. }
  312. if(moduleId <= 0 || !moduleId){
  313. error.push("请选择模块");
  314. }
  315. if(unitId <= 0 || !unitId){
  316. error.push("请选择单元");
  317. }
  318. if(error.length == 0){
  319. $.ajax({
  320. url: "<?php echo $this->createUrl('print/ajaxSaveEnglishReading');?>",
  321. type: "POST",
  322. dataType: "json",
  323. data: {
  324. grade: grade,
  325. selectClassIds:selectClassIds,
  326. textbookId:textbookId,
  327. moduleId:moduleId,
  328. unitId:unitId,
  329. moduleName:moduleName,
  330. unitName:unitName,
  331. type:type,
  332. level:level,
  333. isAnswerSeparate:isAnswerSeparate
  334. },
  335. success: function (data) {
  336. if(data.status == 1){
  337. layer.msg('已发送到后台,预计1小时左右生成!', {
  338. time: 2000,
  339. });
  340. setTimeout(function(){window.location.href = "<?php echo Yii::app()->createUrl('print/english_reading');?>";}, 2000);
  341. }else{
  342. layer.msg(data.error.join('</br>'));
  343. This.attr("active","true");
  344. }
  345. }
  346. });
  347. }else{
  348. This.attr("active","true");
  349. layer.msg(error.join('</br>'));
  350. }
  351. });
  352. $("body").delegate("input[name='reading_type']", "click", function() {
  353. if($(this).val() == 1){
  354. $(".reading-level").hide();
  355. }else{
  356. $(".reading-level").show();
  357. }
  358. });
  359. function getClassByGrade(grade){
  360. if(grade){
  361. $.ajax({
  362. url: "<?php echo $this->createUrl('print/ajaxGetClassesBySettingReading');?>",
  363. type: "POST",
  364. dataType: "json",
  365. data: {
  366. grade: grade,
  367. },
  368. success: function (data) {
  369. console.log(data);
  370. var html = '';
  371. if(data && data.length > 0){
  372. for(var i in data){
  373. html +='<label>';
  374. if(data[i].status == 1){
  375. html += ' <input type="checkbox" name="option-class" value="'+data[i].class_id+'" checked="checked" disabled="disabled" status="1">'+data[i].class_name;
  376. }else{
  377. html += ' <input type="checkbox" name="option-class" value="'+data[i].class_id+'" status="0">'+data[i].class_name;
  378. }
  379. html +='</label>';
  380. }
  381. }
  382. $('#optionClass').html(html);
  383. if($("#optionClass input[status=0]").length > 0){
  384. $("#confirm").attr("active","true");
  385. $(".class-msg").html("");
  386. }else{
  387. $("#confirm").attr("active","false");
  388. $(".class-msg").html("本周您已经生成过啦,下周再来看看吧~");
  389. }
  390. }
  391. });
  392. }
  393. }
  394. });
  395. </script>