Example #1
0
 public function delete($id)
 {
     if (!$this->check_power('subject_category_delete')) {
         return;
     }
     $id = intval($id);
     $id && ($row = SubjectCategoryModel::get_method_tactic($id));
     if (empty($row)) {
         message('方法策略不存在');
         return;
     }
     if ($this->_has_relate_info($id)) {
         message('该方法策略有关联的其他信息,无法删除');
     }
     $query1 = $this->db->get_where('subject_category', array('id' => $row['subject_category_id']), 1);
     $row1 = $query1->row_array();
     $subject_category_id = $row1['id'];
     $this->db->delete('method_tactic', array('id' => $id));
     message('方法策略删除成功', 'admin/method_tactic/index/' . $subject_category_id);
 }
Example #2
0
 private function _has_relate_info($id)
 {
     $id = intval($id);
     if (!$id) {
         return false;
     }
     $query = array('subject_category_id' => $id);
     $count_method_tactics = SubjectCategoryModel::count_method_tactic_lists($query);
     if ($count_method_tactics > 0) {
         return true;
     }
     return false;
 }
Example #3
0
 /**
  * 选择 方法策略
  */
 public function method_tactic_select()
 {
     $subject_id = explode(',', $this->input->post('subject_id'));
     $method_tactic_ids = ',' . trim($this->input->post('method_tactic_ids')) . ',';
     //获取学科分类
     $data = array();
     $query = array('subject_id' => $subject_id);
     $subject_categories = SubjectCategoryModel::get_subject_category_subject_list($query, false, false, null, 'subject_category_id');
     foreach ($subject_categories as $val) {
         $subject_category_id = $val['subject_category_id'];
         $subject_category_name = SubjectCategoryModel::get_subject_category($subject_category_id, 'name');
         $method_tactic_list = SubjectCategoryModel::get_method_tactic_list(array('subject_category_id' => $subject_category_id), false, false, null, 'id,name');
         if (count($method_tactic_list)) {
             $data[$subject_category_id]['name'] = $subject_category_name;
             $data[$subject_category_id]['method_tactics'] = $method_tactic_list;
         }
     }
     $data['list'] = $data;
     $data['method_tactic_ids'] = $method_tactic_ids;
     $this->load->view('question/method_tactic_select', $data);
 }
Example #4
0
 public function edit($id = 0)
 {
     if (!$this->check_power('comparison_manage')) {
         return;
     }
     $id = intval($id);
     //$sql = "select * from rd_comparison_info where cmp_info_id=3";
     //$res = mysql_query($sql, $this->db->conn_id);
     //pr(mysql_fetch_array($res));
     $id && ($info_detail = ComparisonInfoModel::get_comparison_info_by_id($id));
     if (empty($info_detail)) {
         message('信息不存在');
     }
     $info_detail['cmp_extraction_ratio'] = json_decode($info_detail['cmp_extraction_ratio'], true);
     $type_detail = ComparisonTypeModel::get_comparison_type_by_id($info_detail['cmp_type_id']);
     //$this->load->library('Fn');
     $db = Fn::db();
     $res = $db->fetchCol('SELECT DISTINCT subject_id FROM rd_subject_category_subject');
     $type_detail['subject_ids'] = $res;
     //$result = $this->db->query('SELECT group_concat(DISTINCT subject_id) as subject_ids FROM {pre}subject_category_subject')->row_array();
     //$type_detail['subject_ids'] = explode(',', $result['subject_ids']);
     if (empty($type_detail)) {
         message('分类信息不存在');
     } else {
         $type_detail['class_name'] = ClassModel::get_question_class_by_id($type_detail['class_id'], 'class_name');
         $type_detail['grade_name'] = C('grades/' . $type_detail['grade_id']);
         $type_detail['subject_name'] = C('subject/' . $type_detail['subject_id']);
     }
     $items = ComparisonInfoModel::get_comparison_items($id, TRUE);
     $items2 = ComparisonInfoModel::get_comparison_items2($id, TRUE);
     //外部知识点与对比信息关系
     $external_items = ComparisonInfoModel::get_comparison_items_external($id, TRUE);
     // 一级知识点
     $knowledge_list = KnowledgeModel::get_knowledge_list($type_detail['subject_id'], 0, false);
     ksort($knowledge_list);
     //信息提取方式
     $group_type_list = array();
     if ($type_detail['subject_id'] == 3) {
         $group_type_list = GroupTypeModel::get_group_type_list(0, $type_detail['subject_id'], false);
         ksort($group_type_list);
     }
     //对比项《难易度》
     $item_difficulties = ComparisonInfoModel::get_comparison_items_difficutly($id, TRUE);
     //对比项《外部题型 难易度》
     $item_external_difficulties = ComparisonInfoModel::get_comparison_items_external_difficutly($id, TRUE);
     //方法策略
     $method_tactic_list = SubjectCategoryModel::get_method_tactic_by_subject_id($type_detail['subject_id']);
     ksort($method_tactic_list);
     //对比项《方法策略》
     $item_method_tactics = ComparisonInfoModel::get_comparison_items_method_tactic($id, TRUE);
     //对比项《外部方法策略》
     $external_method_tactics = ComparisonInfoModel::get_comparison_items_external_method_tactic($id, TRUE);
     $data['act'] = 'edit';
     $data['type_detail'] =& $type_detail;
     $data['info_detail'] =& $info_detail;
     $data['items'] =& $items;
     $data['items2'] =& $items2;
     $data['external_items'] =& $external_items;
     $data['knowledge_list'] =& $knowledge_list;
     $data['group_type_list'] =& $group_type_list;
     $data['item_difficulties'] =& $item_difficulties;
     $data['item_external_difficulties'] =& $item_external_difficulties;
     $data['method_tactic_list'] =& $method_tactic_list;
     $data['item_method_tactics'] =& $item_method_tactics;
     $data['external_method_tactics'] =& $external_method_tactics;
     $data['q_types'] = C('q_type');
     //试题题型
     $data['difficulty_types'] = array('2' => '高', '1' => '中', '0' => '低');
     //试题题型
     // 模版
     $this->load->view('comparison_info/edit', $data);
 }