we254/addons/fy_teacher/mobile/index/edit.php | ●●●●● patch | view | raw | blame | history | |
we254/addons/fy_teacher/template/mobile/index/edit.html | ●●●●● patch | view | raw | blame | history |
we254/addons/fy_teacher/mobile/index/edit.php
@@ -87,23 +87,73 @@ $data['lesson_type'] = 5; $data['knowledge_pid'] = intval($_GPC['know_pid']); $data['knowledge_id'] = intval($_GPC['know_cid']); $know_parent_name = trim($_GPC['know_parent_name']); $know_name = trim($_GPC['know_name']); $know_arr = array(); if(empty($data['knowledge_pid'])){ message("请选择专题!"); foreach ($_GPC['know_parent_name'] as $key => $row) { $know_parent_name = trim($_GPC['know_parent_name'][$key]); $know_name = trim($_GPC['know_name'][$key]); if (empty($know_parent_name) && !empty($know_name) ){ message("请输入知识点【{know_name}】对应的专题名称!"); break; } if (!empty($know_parent_name) && empty($know_name) ){ message("请输入专题【{know_parent_name}】对应的知识点名称!"); break; } $know_arr[] = array( 'know_parent_name' => $know_parent_name, 'know_name' => $know_name); } if($data['knowledge_pid']=="-1" && empty($know_parent_name)){ message("请输入要添加的专题名称!"); } if($data['knowledge_pid']=="-1" && empty($know_name)){ message("请输入要添加的知识点名称!"); } if($data['knowledge_pid']!="-1" && empty($data['knowledge_id'])){ message("请选择知识点!"); } if($data['knowledge_id']=="-1" && empty($know_name)){ message("请输入要添加的知识点名称!"); foreach ($know_arr as $key => $row) { // 验证要添加的专题名称是否已经存在 $know_parent = pdo_get("fy_lesson_knowledge_point", array('catalog_id_1'=>$data['pid'],'catalog_id_2'=>$data['cid'],'name'=>$know_parent_name, 'parentid'=>0)); // 添加专题 $know = array( 'uniacid' => $_W['uniacid'], 'name' => $know_arr['know_parent_name'][$key], 'ico' => "", 'link' => "", 'link_pc' => "", 'parentid' => 0, 'displayorder' => 0, 'is_hot' => 0, 'is_show' => 1, 'search_show' => 1, 'addtime' => time(), 'catalog_id_1' => $data['pid'], 'catalog_id_2' => $data['cid'], 'teacher_created_flag' => 1, 'created_by' => $_SESSION[$uniacid.'_teacher_id'] ); // 如果添加的专题名称存在,则取出专题id,作为新添加知识点的parentid if($know_parent){ $know['parentid'] = $know_parent[0]['id']; }else{ pdo_insert("fy_lesson_knowledge_point", $know); $new_know_pid = pdo_insertid(); if($new_know_pid){ $know['parentid'] = $new_know_pid; } } // 添加知识点 $know['name'] = $know_arr['know_name'][$key]; pdo_insert("fy_lesson_knowledge_point", $know); $new_know_cid = pdo_insertid(); // 成功添加专题和知识点时,将新的专题和知识点ID添加到课程中 if($new_know_pid && $new_know_cid){ $data['knowledge_pid'] = $new_know_pid; $data['knowledge_id'] = $new_know_cid; }else{ message("添加专题知识点失败,请联系管理员!"); } } // 先插入添加的专题和知识点 we254/addons/fy_teacher/template/mobile/index/edit.html
@@ -585,9 +585,9 @@ //$("#knowdiv").empty(); spec_html += '<div id="add_know_parent" class="input-group w60">'; spec_html += ' <span class="input-group-addon">专题名称</span>'; spec_html += ' <input type="text" class="input" id="know_parent_name" name="know_parent_name">'; spec_html += ' <input type="text" class="input" name="know_parent_name[]">'; spec_html += ' <span class="input-group-addon">知识点名称</span>'; spec_html += ' <input type="text" class="input" id="know_name" name="know_name">'; spec_html += ' <input type="text" class="input" name="know_name[]">'; spec_html += '</div>'; $("#knowdiv").append(spec_html); @@ -795,31 +795,26 @@ return false; } <?php if($type=='5'){ ?> if($("#know_parent option:selected").val()=='0' || $("#know_parent option:selected").val()==''){ alert('请选择专题'); $("#know_parent").focus(); return false; } if($("#know_parent option:selected").val()!='-1' &&($("#know_child option:selected").val()=='0' || $("#know_child option:selected").val()=='')){ if($("#selectposhidden").val()=='' || $("#selectposhidden").val()==','){ alert('请选择知识点'); $("#know_child").focus(); return false; } if($("#know_parent option:selected").val()=='-1' && $("#know_parent_name").val()==''){ alert('请输入要添加专题的名称'); $("#know_parent_name").focus(); return false; } if($("#know_parent option:selected").val()=='-1' && $("#know_name").val()==''){ alert('请输入要添加知识点的名称'); $("#know_name").focus(); return false; } if($("#know_child option:selected").val()=='-1' && $("#know_name").val()==''){ alert('请输入要添加知识点的名称'); $("#know_name").focus(); return false; } var know_name_arr = $("input[name='know_name[]']"); var know_parent_name_arr = $("input[name='know_parent_name[]']"); for(var i in know_name_arr){ if(know_name_arr[i].value.trim() != '' && know_parent_name_arr[i].value.trim() == ''){ alert("请输入专题名称"); know_parent_name_arr[i].focus(); return false; } if(know_parent_name_arr[i].value.trim() != '' && know_name_arr[i].value.trim() == ''){ alert("请输入知识点名称"); know_name_arr[i].focus(); return false; } } <?php } ?> if($("input[name=images]").val()==''){